compound-agent 1.2.3 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [1.2.4] - 2026-02-15
13
+
14
+ ### Changed
15
+
16
+ - **lfg.md delegates phases to slash commands**: Instead of inlining all 5 phase workflows (~80 lines), lfg.md now invokes `/compound:{brainstorm,plan,work,review,compound}`. This prevents phase instructions from being compacted away by late phases.
17
+ - **lfg.md slimmed to thin orchestrator**: Reduced from ~2200 to ~1324 characters. Removed inlined Purpose, Stop Conditions, and Memory Integration sections.
18
+ - **Phase gates relocated to individual commands**: PHASE GATE 3 moved to work.md, PHASE GATE 4 to review.md, FINAL GATE to compound.md — gates now survive compaction.
19
+ - **YAML frontmatter on all 13 command templates**: Each template now has name, description, and argument-hint metadata. lfg.md additionally uses `disable-model-invocation: true`.
20
+ - **Anti-MEMORY.md guardrails**: compound.md and review.md now explicitly warn against using MEMORY.md for lesson storage, directing Claude to use `memory_capture` MCP tool instead.
21
+
22
+ ### Fixed
23
+
24
+ - **Phase 5 context drift**: Claude no longer falls back to MEMORY.md during compound phase because each phase loads fresh instructions from its dedicated slash command.
25
+
12
26
  ## [1.2.1] - 2026-02-15
13
27
 
14
28
  ### Added
@@ -456,7 +470,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
456
470
  - Vitest test suite
457
471
  - tsup build configuration
458
472
 
459
- [Unreleased]: https://github.com/Nathandela/learning_agent/compare/v1.2.1...HEAD
473
+ [Unreleased]: https://github.com/Nathandela/learning_agent/compare/v1.2.4...HEAD
474
+ [1.2.4]: https://github.com/Nathandela/learning_agent/compare/v1.2.1...v1.2.4
460
475
  [1.2.1]: https://github.com/Nathandela/learning_agent/compare/v1.2.0...v1.2.1
461
476
  [1.2.0]: https://github.com/Nathandela/learning_agent/compare/v1.1.0...v1.2.0
462
477
  [1.1.0]: https://github.com/Nathandela/learning_agent/compare/v1.0.0...v1.1.0
package/dist/cli.js CHANGED
@@ -2881,7 +2881,12 @@ var AGENT_TEMPLATES = {
2881
2881
 
2882
2882
  // src/setup/templates/commands.ts
2883
2883
  var WORKFLOW_COMMANDS = {
2884
- "brainstorm.md": `$ARGUMENTS
2884
+ "brainstorm.md": `---
2885
+ name: compound:brainstorm
2886
+ description: Explore requirements through collaborative dialogue before committing to a plan
2887
+ argument-hint: "<goal or topic to brainstorm>"
2888
+ ---
2889
+ $ARGUMENTS
2885
2890
 
2886
2891
  # Brainstorm
2887
2892
 
@@ -2939,7 +2944,12 @@ Explore requirements through collaborative dialogue before committing to a plan.
2939
2944
  - Create a beads epic from brainstorm conclusions with \`bd create --type=feature\`.
2940
2945
  - If the brainstorm identifies sub-tasks, suggest creating them with \`bd create\`.
2941
2946
  `,
2942
- "plan.md": `$ARGUMENTS
2947
+ "plan.md": `---
2948
+ name: compound:plan
2949
+ description: Create a structured implementation plan with concrete tasks and dependencies
2950
+ argument-hint: "<goal or epic to plan>"
2951
+ ---
2952
+ $ARGUMENTS
2943
2953
 
2944
2954
  # Plan
2945
2955
 
@@ -2997,7 +3007,12 @@ If either is missing, CREATE THEM NOW. The plan is NOT complete without these ga
2997
3007
  - Map dependencies with bd dep add (dependent) (blocker).
2998
3008
  - Each task should include acceptance criteria in its description.
2999
3009
  `,
3000
- "work.md": `$ARGUMENTS
3010
+ "work.md": `---
3011
+ name: compound:work
3012
+ description: Execute implementation by delegating to an agent team
3013
+ argument-hint: "<task ID or description>"
3014
+ ---
3015
+ $ARGUMENTS
3001
3016
 
3002
3017
  # Work
3003
3018
 
@@ -3054,8 +3069,19 @@ for complex changes. For all changes, /implementation-reviewer is the minimum re
3054
3069
  - Start with \`bd ready\` to pick work.
3055
3070
  - Update status with bd update (id) --status=in_progress.
3056
3071
  - Close with bd close (id) when all tests pass.
3072
+
3073
+ ## PHASE GATE 3 -- MANDATORY
3074
+ Before starting Review, verify ALL work tasks are closed:
3075
+ - Run bd list with status in_progress -- must return empty
3076
+ - Run bd list with status open -- only Review and Compound tasks should remain
3077
+ If any work tasks remain open, DO NOT proceed. Complete them first.
3057
3078
  `,
3058
- "review.md": `$ARGUMENTS
3079
+ "review.md": `---
3080
+ name: compound:review
3081
+ description: Multi-agent code review with severity classification and mandatory gate
3082
+ argument-hint: "<scope or git diff range>"
3083
+ ---
3084
+ $ARGUMENTS
3059
3085
 
3060
3086
  # Review
3061
3087
 
@@ -3098,6 +3124,7 @@ Multi-agent code review with severity classification and a mandatory \`/implemen
3098
3124
  - **pattern-matcher** auto-reinforces recurring findings via \`memory_capture\`.
3099
3125
  - **cct-reviewer** reads \`.claude/lessons/cct-patterns.jsonl\` for known Claude mistakes.
3100
3126
  - After review, call \`memory_capture\` with \`type=solution\` to store the review report.
3127
+ - **CRITICAL**: Use \`memory_capture\` MCP tool for ALL lesson storage -- NOT MEMORY.md.
3101
3128
 
3102
3129
  ## Docs Integration
3103
3130
  - **docs-reviewer** checks code changes align with \`docs/\` and existing ADRs.
@@ -3106,14 +3133,27 @@ Multi-agent code review with severity classification and a mandatory \`/implemen
3106
3133
  ## Beads Integration
3107
3134
  - Create \`bd\` issues for P1 and P2 findings with \`bd create\`.
3108
3135
  - Close related issues with \`bd close\` when findings are resolved.
3136
+
3137
+ ## PHASE GATE 4 -- MANDATORY
3138
+ Before starting Compound, verify review is complete:
3139
+ - /implementation-reviewer must have returned APPROVED
3140
+ - All P1 findings must be resolved
3109
3141
  `,
3110
- "compound.md": `$ARGUMENTS
3142
+ "compound.md": `---
3143
+ name: compound:compound
3144
+ description: Capture high-quality lessons from completed work into the memory system
3145
+ argument-hint: "<topic or epic context>"
3146
+ ---
3147
+ $ARGUMENTS
3111
3148
 
3112
3149
  # Compound
3113
3150
 
3114
3151
  ## Purpose
3115
3152
  Multi-agent analysis to capture high-quality lessons from completed work into the memory system and update project documentation.
3116
3153
 
3154
+ **CRITICAL**: Store all lessons via \`memory_capture\` MCP tool -- NOT via MEMORY.md, NOT via markdown files.
3155
+ Lessons go to \`.claude/lessons/index.jsonl\` through the MCP tool. MEMORY.md is a different system and MUST NOT be used for compounding.
3156
+
3117
3157
  ## Workflow
3118
3158
  1. Parse what was done from the arguments above or recent git history (\`git diff\`, \`git log\`).
3119
3159
  2. Call \`memory_search\` with the topic to check what is already known (avoid duplicates).
@@ -3162,118 +3202,53 @@ Multi-agent analysis to capture high-quality lessons from completed work into th
3162
3202
  ## Beads Integration
3163
3203
  - Check \`bd ready\` for related open issues.
3164
3204
  - Close resolved issues with \`bd close\`.
3165
- `,
3166
- "lfg.md": `$ARGUMENTS
3167
-
3168
- # LFG (Full Cycle)
3169
-
3170
- ## Purpose
3171
- Chain all phases: brainstorm, plan, work, review, compound. End-to-end delivery.
3172
-
3173
- ## Workflow
3174
- 1. **Brainstorm phase**: Explore the goal stated above.
3175
- - MEMORY CHECK: Call \`memory_search\` with the current goal/task. Display results to user. If relevant items found, state which ones apply and why. If none found, state "No relevant lessons found."
3176
- - Call \`memory_search\` with the goal.
3177
- - \`TeamCreate\` team "brainstorm-<slug>", spawn docs-explorer + code-explorer as parallel teammates.
3178
- - Ask clarifying questions via \`AskUserQuestion\`, explore alternatives.
3179
- - Auto-create ADRs for significant decisions in \`docs/decisions/\`.
3180
- - Create a beads epic from conclusions with \`bd create --type=feature\`.
3181
- - Shut down brainstorm team before next phase.
3182
- - Update epic phase state: bd update (epic-id) --notes="Phase: brainstorm COMPLETE, Next: plan"
3183
-
3184
- 2. **Plan phase**: Structure the work.
3185
- - MEMORY CHECK: Call \`memory_search\` with the current goal/task. Display results to user. If relevant items found, state which ones apply and why. If none found, state "No relevant lessons found."
3186
- - Check for brainstorm epic via \`bd list\`.
3187
- - \`TeamCreate\` team "plan-<slug>", spawn docs-analyst + repo-analyst + memory-analyst as parallel teammates.
3188
- - Break into tasks with dependencies and acceptance criteria.
3189
- - Create beads issues with \`bd create\` and map dependencies with \`bd dep add\`.
3190
- - Create review and compound blocking tasks (\`bd create\` + \`bd dep add\`) so they survive compaction and surface via \`bd ready\` after work completes.
3191
- - Shut down plan team before next phase.
3192
- - Update epic phase state: bd update (epic-id) --notes="Phase: plan COMPLETE, Next: work"
3193
-
3194
- 3. **Work phase**: Implement with adaptive TDD.
3195
- - MEMORY CHECK: Call \`memory_search\` with the current goal/task. Display results to user. If relevant items found, state which ones apply and why. If none found, state "No relevant lessons found."
3196
- - Assess complexity (trivial/simple/complex) to choose strategy.
3197
- - Trivial: single subagent, no team. Simple/complex: \`TeamCreate\` team "work-<task-id>".
3198
- - Spawn test-analyst first, then test-writer + implementer as teammates.
3199
- - Call \`memory_search\` per subtask; \`memory_capture\` after corrections.
3200
- - Commit incrementally. Close tasks as they complete.
3201
- - Run verification gate before marking complete. Shut down work team.
3202
- - Update epic phase state: bd update (epic-id) --notes="Phase: work COMPLETE, Next: review"
3203
-
3204
- ## PHASE GATE 3->4 -- MANDATORY
3205
- Before starting Review, verify ALL work tasks are closed:
3206
- - Run \`bd list --status=in_progress\` \u2014 must return empty
3207
- - Run \`bd list --status=open\` \u2014 only Review and Compound tasks should remain
3208
- If any work tasks remain open, DO NOT proceed. Complete them first.
3209
- Update epic phase: bd update (epic-id) --notes="Phase: work COMPLETE, Next: review"
3210
-
3211
- 4. **Review phase**: 11-agent review with severity classification.
3212
- - MEMORY CHECK: Call \`memory_search\` with the current goal/task. Display results to user. If relevant items found, state which ones apply and why. If none found, state "No relevant lessons found."
3213
- - Run quality gates first: pnpm test, then pnpm lint.
3214
- - \`TeamCreate\` team "review-<slug>", spawn all 11 reviewers as parallel teammates.
3215
- - Classify findings as P1 (critical/blocking), P2 (important), P3 (minor).
3216
- - P1 findings must be fixed before proceeding \u2014 they block completion.
3217
- - Submit to \`/implementation-reviewer\` as the mandatory gate. Shut down review team.
3218
- - Update epic phase state: bd update (epic-id) --notes="Phase: review COMPLETE, Next: compound"
3219
-
3220
- ## PHASE GATE 4->5 -- MANDATORY
3221
- Before starting Compound, verify review is complete:
3222
- - /implementation-reviewer must have returned APPROVED
3223
- - All P1 findings must be resolved
3224
- Update epic phase: bd update (epic-id) --notes="Phase: review COMPLETE, Next: compound"
3225
-
3226
- 5. **Compound phase**: Capture learnings.
3227
- - MEMORY CHECK: Call \`memory_search\` with the current goal/task. Display results to user. If relevant items found, state which ones apply and why. If none found, state "No relevant lessons found."
3228
- - \`TeamCreate\` team "compound-<slug>", spawn 6 analysis agents as parallel teammates.
3229
- - Search first with \`memory_search\` to avoid duplicates. Apply quality filters (novelty + specificity).
3230
- - Store novel insights via \`memory_capture\` with supersedes/related links.
3231
- - Update outdated docs and deprecate superseded ADRs.
3232
- - Use \`AskUserQuestion\` to confirm high-severity items. Shut down compound team.
3233
- - Update epic phase state: bd update (epic-id) --notes="Phase: compound COMPLETE, Next: close"
3234
3205
 
3235
3206
  ## FINAL GATE -- EPIC CLOSURE
3236
3207
  Before closing the epic:
3237
- - Run ca verify-gates (epic-id) \u2014 must return PASS for both gates
3238
- - Run \`pnpm test\` \u2014 must pass
3239
- - Run \`pnpm lint\` \u2014 must pass
3208
+ - Run ca verify-gates (epic-id) -- must return PASS for both gates
3209
+ - Run pnpm test -- must pass
3210
+ - Run pnpm lint -- must pass
3240
3211
  If verify-gates fails, the missing phase was SKIPPED. Go back and complete it.
3241
3212
  CRITICAL: 3/5 phases is NOT success. All 5 phases are required.
3213
+ `,
3214
+ "lfg.md": `---
3215
+ name: compound:lfg
3216
+ description: Full workflow cycle chaining brainstorm, plan, work, review, and compound phases
3217
+ argument-hint: "<goal>"
3218
+ disable-model-invocation: true
3219
+ ---
3220
+ $ARGUMENTS
3242
3221
 
3243
- ## Agent Team Pattern
3244
- Each phase creates its own AgentTeam via \`TeamCreate\`, spawns teammates via \`Task\` tool with \`team_name\`, coordinates via \`SendMessage\`, and shuts down with \`shutdown_request\` before the next phase starts. Use subagents (Task without team_name) only for quick lookups like \`memory_search\` or \`bd\` commands.
3245
-
3246
- ## Phase Control
3247
- - **Skip phases**: If the arguments above contain "from <phase>" (e.g., "from plan"), skip all phases before the named one.
3248
- - **Progress**: Announce the current phase before starting it (e.g., "[Phase 2/5] Plan").
3249
- - **Retry**: If a phase fails, report the failure and ask the user whether to retry, skip, or abort.
3250
- - **Resume**: After interruption, run bd show (epic-id) and read the notes field for current phase state. Resume from that phase. If no phase state, check \`bd list --status=in_progress\` to infer.
3222
+ # LFG (Full Cycle)
3251
3223
 
3252
- ## Stop Conditions
3253
- - Stop if brainstorm reveals the goal is unclear (ask user).
3254
- - Stop if any test phase produces failures that cannot be resolved.
3255
- - Stop if review finds critical security issues.
3224
+ ## Workflow
3225
+ 1. **Brainstorm**: /compound:brainstorm with the goal. Update: bd update (epic-id) --notes="Phase: brainstorm COMPLETE, Next: plan"
3226
+ 2. **Plan**: /compound:plan with conclusions. Update: bd update (epic-id) --notes="Phase: plan COMPLETE, Next: work"
3227
+ 3. **Work**: /compound:work (finds tasks via bd ready). Update: bd update (epic-id) --notes="Phase: work COMPLETE, Next: review"
3228
+ 4. **Review**: /compound:review on changed code. Update: bd update (epic-id) --notes="Phase: review COMPLETE, Next: compound"
3229
+ 5. **Compound**: /compound:compound to capture learnings (via memory_capture, NOT MEMORY.md). Update: bd update (epic-id) --notes="Phase: compound COMPLETE, Next: close"
3256
3230
 
3257
- ## Memory Integration
3258
- - \`memory_search\` is called in brainstorm, work, and compound phases.
3259
- - \`memory_capture\` is called in work and compound phases.
3231
+ ## Phase Control
3232
+ - Skip: "from <phase>" in arguments skips earlier phases.
3233
+ - Resume: bd show (epic-id), read notes field for phase state.
3234
+ - Progress: announce "[Phase N/5] Name" before each phase.
3260
3235
 
3261
3236
  ## SESSION CLOSE -- INVIOLABLE
3262
- Before saying "done" or "complete", ALL of these must pass:
3263
- 1. ca verify-gates (epic-id) -- All workflow gates satisfied
3264
- 2. pnpm test -- All tests green
3265
- 3. pnpm lint -- Zero violations
3266
- 4. git status -- Review changes
3267
- 5. git add (specific files) -- Stage (never git add .)
3268
- 6. bd sync -- Sync beads
3269
- 7. git commit -- Commit with descriptive message
3270
- 8. git push -- Push to remote
3271
- If ANY step fails, fix it. Work is NOT done until git push succeeds.
3237
+ 1. ca verify-gates (epic-id)
3238
+ 2. pnpm test -- all green
3239
+ 3. pnpm lint -- zero violations
3240
+ 4. git status, git add (specific files), bd sync, git commit, git push
3241
+ Work is NOT done until git push succeeds.
3272
3242
  `,
3273
3243
  // =========================================================================
3274
3244
  // Utility commands (CLI wrappers)
3275
3245
  // =========================================================================
3276
- "learn.md": `Capture a lesson from this session.
3246
+ "learn.md": `---
3247
+ name: compound:learn
3248
+ description: Capture a lesson from this session into the memory system
3249
+ argument-hint: "<insight to remember>"
3250
+ ---
3251
+ Capture a lesson from this session.
3277
3252
 
3278
3253
  Usage: /compound learn <insight>
3279
3254
 
@@ -3285,7 +3260,12 @@ Examples:
3285
3260
  npx ca learn "$ARGUMENTS"
3286
3261
  \`\`\`
3287
3262
  `,
3288
- "search.md": `Search lessons for relevant context.
3263
+ "search.md": `---
3264
+ name: compound:search
3265
+ description: Search stored lessons for relevant context
3266
+ argument-hint: "<search query>"
3267
+ ---
3268
+ Search lessons for relevant context.
3289
3269
 
3290
3270
  Usage: /compound search <query>
3291
3271
 
@@ -3299,19 +3279,32 @@ npx ca search "$ARGUMENTS"
3299
3279
 
3300
3280
  Note: You can also use the \`memory_search\` MCP tool directly.
3301
3281
  `,
3302
- "list.md": `Show all stored lessons.
3282
+ "list.md": `---
3283
+ name: compound:list
3284
+ description: Show all stored lessons
3285
+ ---
3286
+ Show all stored lessons.
3303
3287
 
3304
3288
  \`\`\`bash
3305
3289
  npx ca list
3306
3290
  \`\`\`
3307
3291
  `,
3308
- "prime.md": `Load compound-agent workflow context after compaction or context loss.
3292
+ "prime.md": `---
3293
+ name: compound:prime
3294
+ description: Load compound-agent workflow context after compaction or context loss
3295
+ ---
3296
+ Load compound-agent workflow context after compaction or context loss.
3309
3297
 
3310
3298
  \`\`\`bash
3311
3299
  npx ca prime
3312
3300
  \`\`\`
3313
3301
  `,
3314
- "show.md": `Show details of a specific lesson.
3302
+ "show.md": `---
3303
+ name: compound:show
3304
+ description: Show details of a specific lesson
3305
+ argument-hint: "<lesson-id>"
3306
+ ---
3307
+ Show details of a specific lesson.
3315
3308
 
3316
3309
  Usage: /compound show <lesson-id>
3317
3310
 
@@ -3319,7 +3312,12 @@ Usage: /compound show <lesson-id>
3319
3312
  npx ca show "$ARGUMENTS"
3320
3313
  \`\`\`
3321
3314
  `,
3322
- "wrong.md": `Mark a lesson as incorrect or invalid.
3315
+ "wrong.md": `---
3316
+ name: compound:wrong
3317
+ description: Mark a lesson as incorrect or invalid
3318
+ argument-hint: "<lesson-id>"
3319
+ ---
3320
+ Mark a lesson as incorrect or invalid.
3323
3321
 
3324
3322
  Usage: /compound wrong <lesson-id>
3325
3323
 
@@ -3327,7 +3325,11 @@ Usage: /compound wrong <lesson-id>
3327
3325
  npx ca wrong "$ARGUMENTS"
3328
3326
  \`\`\`
3329
3327
  `,
3330
- "stats.md": `Show compound-agent database statistics and health.
3328
+ "stats.md": `---
3329
+ name: compound:stats
3330
+ description: Show compound-agent database statistics and health
3331
+ ---
3332
+ Show compound-agent database statistics and health.
3331
3333
 
3332
3334
  \`\`\`bash
3333
3335
  npx ca stats