---
phase: 04-onboarding-validation
plan: '03'
type: execute
wave: 1
depends_on: []
files_modified:
  - AGENTS.md
autonomous: true
requirements:
  - ONBD-03

must_haves:
  truths:
    - AGENTS.md shows `paperforge <command>` as the primary invocation method
    - Legacy Python path calls are shown as secondary/backup options
    - All command examples in AGENTS.md use the new CLI form
  artifacts:
    - path: "AGENTS.md"
      provides: "Updated command documentation"
      contains: "paperforge "
  key_links:
    - from: "AGENTS.md"
      to: "paperforge/cli.py"
      via: "paperforge CLI"
      pattern: "paperforge"
---

<objective>
Update AGENTS.md to use `paperforge <command>` as the primary invocation, with legacy Python path calls as backup/legacy options.
</objective>

<execution_context>
@C:/Users/Lin/.opencode/get-shit-done/workflows/execute-plan.md
@C:/Users/Lin/.opencode/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/phases/04-onboarding-validation/04-CONTEXT.md (Area 4 for Doc-Command Alignment details)
@.planning/STATE.md
@AGENTS.md
</context>

<tasks>

<task type="auto">
  <name>Task 1: Update AGENTS.md Section 4 worker commands to paperforge CLI form</name>
  <files>AGENTS.md</files>
  <read_first>
    - AGENTS.md (lines 121-155 for Section 4, lines 240-345 for Section 7 and 8)
  </read_first>
  <action>
    In AGENTS.md, update all worker command examples from legacy Python path to `paperforge` CLI form.

    Section 4 (Core Workers) — update the example bash commands:
    - selection-sync: `python <system_dir>/.../literature_pipeline.py --vault ... selection-sync` → `paperforge selection-sync`
    - index-refresh: `python ... literature_pipeline.py ... index-refresh` → `paperforge index-refresh`
    - ocr: `python ... literature_pipeline.py ... ocr` → `paperforge ocr run`
    - deep-reading: `python ... literature_pipeline.py ... deep-reading` → `paperforge deep-reading`
    - status: `python ... literature_pipeline.py ... status` → `paperforge status`

    Section 7 (First-time Guide) — update Step 2-6 bash examples:
    - selection-sync command
    - index-refresh command
    - ocr command
    - deep-reading command (Step 6)

    Section 8 (Command Reference) — update all bash examples:
    - selection-sync
    - index-refresh
    - ocr
    - deep-reading
    - status

    For each, keep the legacy form as a comment: `# Legacy: python ...`

    Example transformation:
    ```bash
    # Primary (recommended):
    paperforge selection-sync

    # Legacy (backup):
    # python <system_dir>/PaperForge/worker/scripts/literature_pipeline.py \
    #   --vault "你的Vault路径" selection-sync
    ```
  </action>
  <verify>
    <automated>grep -n "python.*literature_pipeline.py" AGENTS.md | wc -l && grep -n "paperforge " AGENTS.md | wc -l</automated>
  </verify>
  <done>All worker command examples in AGENTS.md show paperforge CLI as primary</done>
</task>

<task type="auto">
  <name>Task 2: Verify AGENTS.md internal consistency</name>
  <files>AGENTS.md</files>
  <read_first>
    - AGENTS.md (full file to verify all command references)
  </read_first>
  <action>
    After updating AGENTS.md, verify:
    1. No remaining bare `python ... literature_pipeline.py` calls (without being commented as legacy)
    2. All paperforge commands are valid subcommands (paths, status, selection-sync, index-refresh, ocr run, deep-reading, doctor)
    3. Section 0 checklist still makes sense with new commands

    Run consistency check:
    - All `paperforge` subcommands mentioned exist in cli.py build_parser()
    - All legacy python paths are properly commented as backup
  </action>
  <verify>
    <automated>python -c "
import re
content = open('AGENTS.md', encoding='utf-8').read()
# Check paperforge commands
paperforge_cmds = re.findall(r'paperforge\s+(\w+)', content)
valid_cmds = {'paths', 'status', 'selection-sync', 'index-refresh', 'ocr', 'doctor', 'deep-reading', 'base-refresh'}
for cmd in paperforge_cmds:
    if cmd not in valid_cmds:
        print(f'INVALID: paperforge {cmd}')
# Check no uncommented legacy paths
legacy_lines = [l for l in content.split('\n') if 'python' in l and 'literature_pipeline.py' in l and not l.strip().startswith('#')]
if legacy_lines:
    print(f'UNCOMMENTED LEGACY: {legacy_lines}')
if not legacy_lines:
    print('OK: No uncommented legacy paths')
"</automated>
  </verify>
  <done>AGENTS.md passes internal consistency check</done>
</task>

</tasks>

<verification>
- AGENTS.md has more paperforge CLI references than legacy references
- All paperforge commands are valid subcommands
- No uncommented legacy python literature_pipeline.py calls remain
</verification>

<success_criteria>
AGENTS.md uses paperforge CLI as primary invocation with legacy paths as backup comments
</success_criteria>

<output>
After completion, create `.planning/phases/04-onboarding-validation/04-03-SUMMARY.md`
</output>
