Metadata-Version: 2.4
Name: acps-vocab-master
Version: 1.0.0
Summary: Protocol-native multi-agent vocabulary trainer for postgraduate exams, TOEFL/GRE and business English. A Quiz Master builds EN-ZH, root-affix and cloze retrieval practice; a Memory Analyst diagnoses spelling and meaning-confusion patterns; a Review Scheduler turns results into Ebbinghaus spaced-review plans over ACPs AIP v2.
Author-email: ACPs Vocab Master Engineering <team@acps-vocab-master.dev>
License-Expression: MIT
Project-URL: Homepage, https://github.com/acps-labs/acps-vocab-master
Project-URL: Repository, https://github.com/acps-labs/acps-vocab-master
Project-URL: Documentation, https://github.com/acps-labs/acps-vocab-master#readme
Project-URL: Changelog, https://github.com/acps-labs/acps-vocab-master/releases
Keywords: acps,acps-sdk,multi-agent,agent-collaboration,vocabulary,spaced-repetition,ebbinghaus,english-learning,gre,toefl,postgraduate-entrance-exam,business-english
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: End Users/Desktop
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Education
Classifier: Topic :: Education :: Computer Aided Instruction (CAI)
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: acps-sdk==2.1.0
Requires-Dist: fastapi>=0.100.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: uvicorn>=0.27.0
Provides-Extra: dev
Requires-Dist: build>=1.0.0; extra == "dev"
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: twine>=5.0.0; extra == "dev"
Dynamic: license-file

# ACPs Vocab Master

**A protocol-native multi-agent vocabulary acquisition system for high-stakes English exams and professional communication.**

ACPs Vocab Master turns vocabulary revision into a closed collaborative loop: one agent builds retrieval practice, a second diagnoses *why* an answer failed, and a third converts that diagnosis into an Ebbinghaus review schedule whose weak words feed the next quiz. The three agents are independent ACPs agents, discovered through ADP and coordinated over the AIP v2 task lifecycle.

Built on **`acps-sdk==2.1.0`** (`acps_sdk.aic`, `acps_sdk.acs`, `acps_sdk.adp`, `acps_sdk.aip`).

---

## Naming

| Segment | Meaning |
| --- | --- |
| `acps-` | The tool is implemented as a mesh of ACPs-compliant agents, not a monolithic script. |
| `Vocab` | Vocabulary acquisition: exam word pools, roots and affixes, collocations, contextual examples. |
| `Master` | Both senses matter: *to master* a word across retrieval modes, and a *master orchestrator* that coordinates specialist agents. |

The Python package is `vocab_master`, the CLI is `vocab-master`.

---

## Why three agents?

| Agent | ACPs skill id | Responsibility | Output product |
| --- | --- | --- | --- |
| **Quiz Master** | `vocab-master.quiz-master` | Builds a mode-balanced paper: EN→ZH, ZH→EN, root/affix matching and cloze. Distractors include near-miss spellings and same-part-of-speech meanings. | `quiz-paper` |
| **Memory Analyst** | `vocab-master.memory-analyst` | Grades the answer sheet with Levenshtein-aware logic and separates spelling slips from meaning confusion, root gaps, contextual misuse, blank answers and slow retrieval. | `memory-analysis` |
| **Review Scheduler** | `vocab-master.review-scheduler` | Projects the forgetting curve from memory strength, assigns per-word intervals and due dates, and fits the plan to the learner's daily time budget. | `review-plan` |

The **Leader** (`VocabSession`) is a pure ACPs client. It discovers each skill by tag through ADP and never duplicates domain logic. Weak words returned by the Memory Analyst become the `focus_word_ids` of the next Quiz Master request — that feedback edge is what makes the system adaptive rather than a static quiz bank.

```text
                 ADP discovery (skills.tags)
   ┌────────────────────────────────────────────────────┐
   │                                                    │
   ▼                                                    │
Leader ──start_task──► QuizMaster ──quiz-paper──► Learner answers
   │                                                    │
   │◄───────────────── focus_word_ids ──────────────────┤
   │                                                    │
   └──start_task──► MemoryAnalyst ◄──answer_sheet───────┘
                        │
                        └──memory-analysis──► ReviewScheduler
                                                   │
                                                   └──review-plan──► next session
```

Every hop is a real AIP v2 RPC call (`POST /aip/v2/rpc`), and every payload is a `StructuredDataItem` inside an AIP `Product`.

---

## Installation

```bash
python -m venv .venv
source .venv/bin/activate          # Windows: .venv\Scripts\activate
python -m pip install -U pip
python -m pip install -e ".[dev]"
```

Requirements: Python 3.10 – 3.13.

---

## One-command demonstration

```bash
vocab-master demo
# or: python -m vocab_master demo
```

The demo starts three loopback ACPs services, runs **three scripted rounds** with deliberately designed learner behaviour (meaning confusion, a near-miss spelling, a root/affix error, one slow-but-correct retrieval), and prints the full collaboration transcript.

Available tracks:

```bash
vocab-master demo --track postgrad --daily-minutes 20   # 考研英语词汇冲刺
vocab-master demo --track gre-toefl                    # 托福 / GRE 核心词汇
vocab-master demo --track business                     # 职场商务英语
```

### Interactive practice

```bash
vocab-master practice --track business --daily-minutes 15
```

Type `A` / `B` / `C` / `D`, or type the word directly for spelling-sensitive items. Press Enter to skip.

### What the output looks like (excerpt)

```text
==============================================================================
 ACPs Vocab Master v1.0.0 · AIP v2 多智能体协作单词背诵
 学员: 林晓 | 轨道: 考研英语词汇冲刺 | 每日预算: 20 分钟
==============================================================================
[ADP] 通过 Agent Discovery Protocol 解析到以下 ACPs 智能体:
  1. QuizMaster       skill=vocab-master.quiz-master
     aic=1.2.156.3088.1.1.34C2.478BDF.000001.0SEN
     rpc=http://127.0.0.1:55250/aip/v2/rpc
  2. MemoryAnalyst    skill=vocab-master.memory-analyst
  3. ReviewScheduler  skill=vocab-master.review-scheduler

  Q1. [英译中] mitigate /ˈmɪtɪɡeɪt/ (v.) 的意思是？
      A. 阻碍         B. 分配，拨出
      C. 加剧，恶化   D. 缓解，减轻
  Q2. [中译英] 以下哪个选项对应 adj.「无处不在的」？
      A. viable  B. ubiqiutous  C. ubiuitous  D. ubiquitous

[MemoryAnalyst] 记忆评估报告
  正确率: 3/6 (50.0%) | 记忆强度: 48/100 | 稳定度 S: 29.0 天 | 风险: 高
  错误模式:
    - 词义混淆 × 1: mitigate
      证据: mitigate: 选择了「阻碍」，正确选项为「缓解，减轻」
    - 拼写易错 × 1: ubiquitous
      证据: ubiquitous: 作答「ubiquitos」，正确拼写「ubiquitous」（编辑距离 1）
    - 词根词缀失分 × 1: ambiguous
      证据: ambiguous: 选择了「尖锐的，苦涩的」，正确选项为「两者，双」
    - 提取速度偏慢 × 1: incentive
      证据: incentive 作答正确，但耗时 31.0 秒

[ReviewScheduler] 艾宾浩斯复习计划
  下一次复习日期: 2026-11-30 | 预计用时: 10 分钟
  遗忘曲线投影: D+0 100% → D+1 97% → D+2 93% → D+4 87% → D+7 79% → D+15 60% → D+30 36%
    mitigate        缓解，减轻 | 掌握 25 | 1 天 | 到期 2026-11-30 | 优先级 高
    ubiquitous      无处不在的 | 掌握 25 | 1 天 | 到期 2026-11-30 | 优先级 高
    ambiguous       模棱两可的 | 掌握 25 | 1 天 | 到期 2026-11-30 | 优先级 高
    incentive       激励，诱因 | 掌握 50 | 4 天 | 到期 2026-12-03 | 优先级 中
    facilitate      促进，使便利 | 掌握 65 | 7 天 | 到期 2026-12-06 | 优先级 中
```

Across the three rounds the same learner moves from `50.0% / memory 48 / 1-day intervals` to `100.0% / memory 77 / 7–15-day intervals`, while the weak words of each round are automatically pushed into the next paper.

---

## How the pedagogy works

### Four retrieval modes

| Mode | What it trains | Distractor design |
| --- | --- | --- |
| `en-to-zh` | Recognition of meaning | Same-part-of-speech meanings from the same exam pool |
| `zh-to-en` | Productive spelling | Two near-miss spellings (adjacent swap / dropped letter) plus one real word |
| `root-affix` | Morphological decomposition | Root meanings of other words in the pool |
| `cloze` | Contextual use | Real words of the same part of speech |

### Error taxonomy

`spelling`, `meaning-confusion`, `root-affix`, `context-usage`, `slow-recall` (correct but above 25 s) and `blank`. Spelling is distinguished from meaning confusion by Levenshtein distance on typed answers and on selected near-miss options.

### Mastery and memory strength

Each word carries a 0–100 mastery score updated per round:

* first correct answer → 65 (50 if slow)
* later correct answers → +35 below 50, otherwise +22
* wrong answer → 45% of the previous score, or 25 on first exposure

Overall memory strength blends average mastery (60%), accuracy (25%) and retrieval speed (15%).

### Ebbinghaus scheduling

Memory stability is `S = 5 + 0.5 × memory_strength` days, with retention `R(t) = e^(−t/S)`. The scheduler targets `R = 70%`, whose critical point is `0.357 × S`, and snaps to the review ladder `1 / 2 / 4 / 7 / 15 / 30` days. Wrong words are forced to a 1-day interval; slow-but-correct words are capped at 4 days. The resulting per-word due dates and the projected `R(t)` table are both published in the `review-plan` product.

---

## Project structure

```text
acps-vocab-master/
├── pyproject.toml                 # PEP 621 metadata, version 1.0.0, CLI entry point
├── README.md
├── LICENSE
├── .gitignore
├── src/
│   └── vocab_master/
│       ├── __init__.py            # __version__
│       ├── __main__.py            # python -m vocab_master
│       ├── cli.py                 # argparse: demo / practice
│       ├── demo.py                # three-round scripted transcript
│       ├── engine.py              # word bank + quiz/grading/scheduling logic
│       ├── identity.py            # AIC + ACS documents
│       ├── leader.py              # VocabSession orchestrator (ADP + AIP client)
│       ├── mesh.py                # start three agents on loopback
│       ├── models.py              # pydantic wire models
│       ├── registry.py            # ADP discovery service
│       ├── runtime.py             # AIP RPC server + product encoding
│       ├── py.typed
│       └── agents/
│           ├── __init__.py
│           ├── base.py            # AIP lifecycle base class
│           ├── quiz_master.py
│           ├── memory_analyst.py
│           └── review_scheduler.py
└── tests/
    └── test_end_to_end.py         # discovery, all four modes, spelling, 3-round adaptation
```

---

## Build the wheel

```bash
python -m pip install -U build twine
python -m build
```

Artifacts:

```text
dist/acps_vocab_master-1.0.0-py3-none-any.whl
dist/acps_vocab_master-1.0.0.tar.gz
```

Verify the wheel installs cleanly in a fresh environment:

```bash
python -m venv .venv-wheel
.venv-wheel/Scripts/activate        # Windows
python -m pip install dist/acps_vocab_master-1.0.0-py3-none-any.whl
vocab-master --version
vocab-master demo --track gre-toefl
```

## Publish to PyPI

```bash
python -m twine check dist/*

# TestPyPI first (recommended)
python -m twine upload --repository testpypi dist/*

# Production
python -m twine upload dist/*
```

Credentials are read from `TWINE_USERNAME` / `TWINE_PASSWORD` (or `~/.pypirc`). With a PyPI API token, use `TWINE_USERNAME=__token__` and the token as the password.

PowerShell:

```powershell
$env:TWINE_USERNAME = "__token__"
$env:TWINE_PASSWORD = "pypi-..."
python -m twine upload dist/*
```

---

## Tests

```bash
python -m pytest
```

Expected:

```text
....                                                                     [100%]
4 passed
```

The suite verifies that ADP discovers all three agents, that a paper covers all four retrieval modes, that `ubiquitos` is classified as a spelling slip rather than a meaning error, and that three full AIP rounds raise memory strength while extending review intervals from 1 day to 15 days and feeding round-1 weak words into round 2.

---

## Design notes

* **Deterministic by default.** The pedagogical engine is rule-based and seed-stable, so demos, tests and the wheel behave identically offline. Replace `VocabEngine` with an LLM-backed implementation and the ACPs wiring, discovery and task lifecycle stay unchanged.
* **Protocol-first.** Identity is a validated AIC, capability is an ACS document, discovery is ADP, and every interaction is an AIP v2 task with `StructuredDataItem` products.
* **Bounded review load.** The scheduler caps the number of scheduled words by `daily_minutes / 2` and states the estimated duration in the product.

## License

MIT
