|
2 | 2 |
|
3 | 3 | ## Current State |
4 | 4 |
|
5 | | -`delegate-agent/first-use.md` and `work-with-issue-agent/first-use.md` both describe how to plan and delegate work |
6 | | -to subagents, but they document the approach independently. This leads to duplication and drift between the two |
7 | | -files. For example, `delegate-agent` describes a two-stage planning subagent pattern (Stage 1: approach outline, |
8 | | -Stage 2: detailed spec) while `work-with-issue-agent` has its own delegation prompt construction guidance. |
| 5 | +Planning logic is scattered across three skills: |
| 6 | + |
| 7 | +- **`add/first-use.md`** contains effort-based planning depth, PLAN.md comprehensiveness requirements, execution wave |
| 8 | + guidance, and batch execution checks — all inline within the add workflow |
| 9 | +- **`delegate-agent/first-use.md`** contains two-stage planning pattern, model selection, hook inheritance block, |
| 10 | + main agent responsibilities, execution plan format, prompt completeness checklist, and batch orchestration |
| 11 | +- **`work-with-issue-agent/first-use.md`** contains delegation prompt construction guidance |
| 12 | + |
| 13 | +This duplication and scattering causes: |
| 14 | +1. Planning logic drifts between files |
| 15 | +2. No single authoritative source for how to build a comprehensive PLAN.md |
| 16 | +3. `delegate-agent` mixes planning with batch orchestration with subagent principles — all of which are covered |
| 17 | + better elsewhere or unnecessary |
9 | 18 |
|
10 | 19 | ## Target State |
11 | 20 |
|
12 | | -Common planning/delegation content is extracted into a shared file (e.g., `plugin/concepts/planning-approach.md`) |
13 | | -that both `delegate-agent` and `work-with-issue-agent` reference. Each skill retains only its unique orchestration |
14 | | -logic. |
| 21 | +1. A new `cat:plan-builder-agent` skill owns all PLAN.md generation logic (effort-based depth, approach research, |
| 22 | + execution plan format, comprehensiveness requirements) |
| 23 | +2. `/cat:add` invokes `plan-builder-agent` to generate initial PLAN.md |
| 24 | +3. `/cat:work` can invoke `plan-builder-agent` for mid-work PLAN.md revisions when requirements change |
| 25 | +4. `delegate-agent` is deleted entirely — its content is either moved or unnecessary: |
| 26 | + - Model selection → `subagent-delegation.md` |
| 27 | + - Hook inheritance block → deleted (rules injection handles this) |
| 28 | + - Batch orchestration → deleted (agent already knows how to spawn parallel subagents) |
| 29 | + - Planning content → `plan-builder-agent` |
| 30 | + - Subagent principles → already in `subagent-delegation.md` |
| 31 | +5. Planning-related instructions removed from `work-with-issue-agent` (only a hook for mid-work revision remains) |
15 | 32 |
|
16 | 33 | ## Parent Requirements |
17 | 34 |
|
18 | 35 | None |
19 | 36 |
|
20 | 37 | ## Risk Assessment |
21 | 38 |
|
22 | | -- **Risk Level:** MEDIUM |
23 | | -- **Breaking Changes:** Skill file restructuring; content moves but semantics preserved |
24 | | -- **Mitigation:** Both skills reference the shared file; verify no behavioral regression via E2E |
| 39 | +- **Risk Level:** HIGH |
| 40 | +- **Breaking Changes:** Deleting `delegate-agent` removes a user-invocable skill; `optimize-doc` references it |
| 41 | +- **Mitigation:** Update `optimize-doc` to remove delegate references; verify `/cat:work` still functions after |
| 42 | + removing planning content from `work-with-issue-agent` |
25 | 43 |
|
26 | 44 | ## Files to Modify |
27 | 45 |
|
28 | | -- `plugin/concepts/planning-approach.md` (new) ��� shared planning/delegation approach documentation |
29 | | -- `plugin/skills/delegate-agent/first-use.md` ��� extract common sections, reference shared file |
30 | | -- `plugin/skills/work-with-issue-agent/first-use.md` ��� extract common sections, reference shared file |
| 46 | +- `plugin/skills/plan-builder-agent/SKILL.md` (new) — skill definition |
| 47 | +- `plugin/skills/plan-builder-agent/first-use.md` (new) — planning logic extracted from add and delegate |
| 48 | +- `plugin/skills/add/first-use.md` — replace inline planning logic with plan-builder invocation |
| 49 | +- `plugin/skills/add-agent/SKILL.md` — add Skill to allowed-tools if needed |
| 50 | +- `plugin/skills/work-with-issue-agent/first-use.md` — remove planning content, add mid-work revision hook |
| 51 | +- `plugin/skills/delegate-agent/` (delete) — entire skill directory |
| 52 | +- `plugin/concepts/subagent-delegation.md` — add model selection table from delegate-agent |
| 53 | +- `plugin/skills/optimize-doc/first-use.md` — remove `/cat:delegate-agent` references |
| 54 | +- `plugin/concepts/planning-approach.md` (delete if exists) — replaced by plan-builder-agent |
31 | 55 |
|
32 | 56 | ## Pre-conditions |
33 | 57 |
|
|
37 | 61 |
|
38 | 62 | ### Wave 1 |
39 | 63 |
|
40 | | -- Identify common content between delegate-agent and work-with-issue-agent: |
41 | | - - Files: `plugin/skills/delegate-agent/first-use.md`, `plugin/skills/work-with-issue-agent/first-use.md` |
42 | | - - Compare planning/delegation sections in both files |
43 | | - - Extract shared concepts: two-stage planning pattern, delegation prompt construction, subagent responsibilities |
| 64 | +- Create `plan-builder-agent` skill: |
| 65 | + - Files: `plugin/skills/plan-builder-agent/SKILL.md`, `plugin/skills/plan-builder-agent/first-use.md` |
| 66 | + - Extract from `add/first-use.md`: effort-based planning depth, PLAN.md comprehensiveness requirements, |
| 67 | + execution wave guidance, batch execution check, PLAN.md templates |
| 68 | + - Extract from `delegate-agent/first-use.md`: two-stage planning pattern, execution plan format, |
| 69 | + prompt completeness checklist |
| 70 | + - The skill should accept an issue description and effort level, and produce a complete PLAN.md |
44 | 71 |
|
45 | | -- Create shared planning approach file: |
46 | | - - Files: `plugin/concepts/planning-approach.md` |
47 | | - - Document the canonical planning/delegation approach in one place |
48 | | - - Include: two-stage planning (Stage 1 approach, Stage 2 spec), delegation prompt patterns, |
49 | | - main agent vs subagent responsibilities |
| 72 | +- Move model selection to `subagent-delegation.md`: |
| 73 | + - Files: `plugin/concepts/subagent-delegation.md` |
| 74 | + - Move the model selection table and opus guidance from `delegate-agent/first-use.md` |
| 75 | + |
| 76 | +- Commit: `feature: create plan-builder-agent skill with extracted planning logic` |
| 77 | + |
| 78 | +### Wave 2 |
50 | 79 |
|
51 | | -- Update both skills to reference shared file: |
52 | | - - Files: `plugin/skills/delegate-agent/first-use.md`, `plugin/skills/work-with-issue-agent/first-use.md` |
53 | | - - Replace duplicated content with references to `plugin/concepts/planning-approach.md` |
54 | | - - Keep skill-specific orchestration logic in each skill |
| 80 | +- Update `add` skill to invoke plan-builder: |
| 81 | + - Files: `plugin/skills/add/first-use.md`, `plugin/skills/add-agent/SKILL.md` |
| 82 | + - Replace inline planning logic (effort-based depth, comprehensiveness, wave guidance) with |
| 83 | + invocation of `plan-builder-agent` |
| 84 | + - Keep issue creation workflow (version selection, naming, STATE.md generation) |
| 85 | + |
| 86 | +- Remove planning content from `work-with-issue-agent`: |
| 87 | + - Files: `plugin/skills/work-with-issue-agent/first-use.md` |
| 88 | + - Remove "Delegation Prompt Construction" section |
| 89 | + - Add a brief mid-work revision hook: "If PLAN.md needs revision mid-work, invoke |
| 90 | + `cat:plan-builder-agent` to update it, then resume execution" |
| 91 | + |
| 92 | +- Update `optimize-doc` to remove delegate references: |
| 93 | + - Files: `plugin/skills/optimize-doc/first-use.md` |
| 94 | + - Remove references to `/cat:delegate-agent` for batch operations |
| 95 | + - Simplify batch section (agent spawns parallel subagents directly) |
| 96 | + |
| 97 | +- Delete `delegate-agent`: |
| 98 | + - Files: `plugin/skills/delegate-agent/` (entire directory) |
| 99 | + - Verify no other skills reference it beyond optimize-doc |
| 100 | + |
| 101 | +- Delete `planning-approach.md` if it exists from prior implementation attempt: |
| 102 | + - Files: `plugin/concepts/planning-approach.md` |
55 | 103 |
|
56 | | -- Commit: `refactor: extract shared planning approach from delegate and work-with-issue skills` |
| 104 | +- Commit: `refactor: integrate plan-builder-agent, delete delegate-agent` |
57 | 105 |
|
58 | 106 | ## Post-conditions |
59 | 107 |
|
60 | | -- [ ] Common planning content exists in a single shared file |
61 | | -- [ ] Both delegate-agent and work-with-issue-agent reference the shared file |
62 | | -- [ ] No duplication of planning approach between the two skills |
63 | | -- [ ] No behavioral regression in either skill |
64 | | -- [ ] E2E: Run /cat:work and verify delegation still works correctly |
| 108 | +- [ ] `plan-builder-agent` skill exists and contains all planning logic |
| 109 | +- [ ] `add` skill invokes `plan-builder-agent` instead of inline planning |
| 110 | +- [ ] `work-with-issue-agent` has no planning content except mid-work revision hook |
| 111 | +- [ ] `delegate-agent` is fully deleted |
| 112 | +- [ ] `subagent-delegation.md` contains model selection guidance |
| 113 | +- [ ] `optimize-doc` has no references to `delegate-agent` |
| 114 | +- [ ] No other files reference `delegate-agent` |
| 115 | +- [ ] E2E: Run `/cat:add` with a test issue and verify PLAN.md is generated correctly |
| 116 | +- [ ] E2E: Run `/cat:work` and verify implementation subagent receives proper PLAN.md |
0 commit comments