From d96671b9e9ecbe417568b2ce7f7fa4d379c2bec2 Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Sun, 8 Mar 2026 12:51:56 -0700 Subject: [PATCH 1/2] fix(review): add serial mode to prevent context limit crashes Adds --serial flag and auto-detection (6+ agents) to run review agents sequentially instead of in parallel, preventing context limit errors with Opus 4.6. Closes #166 Co-Authored-By: Claude Opus 4.6 --- .../commands/ce/review.md | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/plugins/compound-engineering/commands/ce/review.md b/plugins/compound-engineering/commands/ce/review.md index cf4a061..65aebff 100644 --- a/plugins/compound-engineering/commands/ce/review.md +++ b/plugins/compound-engineering/commands/ce/review.md @@ -1,7 +1,7 @@ --- name: ce:review description: Perform exhaustive code reviews using multi-agent analysis, ultra-thinking, and worktrees -argument-hint: "[PR number, GitHub URL, branch name, or latest]" +argument-hint: "[PR number, GitHub URL, branch name, or latest] [--serial]" --- # Review Command @@ -65,17 +65,50 @@ Read `compound-engineering.local.md` in the project root. If found, use `review_ If no settings file exists, invoke the `setup` skill to create one. Then read the newly created file and continue. +#### Choose Execution Mode + + + +Before launching review agents, check for context constraints: + +**If `--serial` flag is passed OR conversation is in a long session:** + +Run agents ONE AT A TIME in sequence. Wait for each agent to complete before starting the next. This uses less context but takes longer. + +**Default (parallel):** + +Run all agents simultaneously for speed. If you hit context limits, retry with `--serial` flag. + +**Auto-detect:** If more than 5 review agents are configured, automatically switch to serial mode and inform the user: +"Running review agents in serial mode (6+ agents configured). Use --parallel to override." + + + #### Parallel Agents to review the PR: +**Parallel mode (default for ≤5 agents):** + Run all configured review agents in parallel using Task tool. For each agent in the `review_agents` list: ``` Task {agent-name}(PR content + review context from settings body) ``` -Additionally, always run these regardless of settings: +**Serial mode (--serial flag, or auto for 6+ agents):** + +Run configured review agents ONE AT A TIME. For each agent in the `review_agents` list, wait for it to complete before starting the next: + +``` +For each agent in review_agents: + 1. Task {agent-name}(PR content + review context) + 2. Wait for completion + 3. Collect findings + 4. Proceed to next agent +``` + +Always run these last regardless of mode: - Task agent-native-reviewer(PR content) - Verify new features are agent-accessible - Task learnings-researcher(PR content) - Search docs/solutions/ for past issues related to this PR's modules and patterns From e94ca0409671efcfa2d4a8fcb2d60b79a848fd85 Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Sun, 8 Mar 2026 12:52:20 -0700 Subject: [PATCH 2/2] feat(plan): add daily sequence number to plan filenames Closes #135 Co-Authored-By: Claude Opus 4.6 --- .../compound-engineering/commands/ce/plan.md | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/plugins/compound-engineering/commands/ce/plan.md b/plugins/compound-engineering/commands/ce/plan.md index e4b0240..dfd5402 100644 --- a/plugins/compound-engineering/commands/ce/plan.md +++ b/plugins/compound-engineering/commands/ce/plan.md @@ -138,8 +138,11 @@ Think like a product manager - what would make this issue clear and actionable? - [ ] Draft clear, searchable issue title using conventional format (e.g., `feat: Add user authentication`, `fix: Cart total calculation`) - [ ] Determine issue type: enhancement, bug, refactor -- [ ] Convert title to filename: add today's date prefix, strip prefix colon, kebab-case, add `-plan` suffix - - Example: `feat: Add User Authentication` → `2026-01-21-feat-add-user-authentication-plan.md` +- [ ] Convert title to filename: add today's date prefix, determine daily sequence number, strip prefix colon, kebab-case, add `-plan` suffix + - Scan `docs/plans/` for files matching today's date pattern `YYYY-MM-DD-\d{3}-` + - Find the highest existing sequence number for today + - Increment by 1, zero-padded to 3 digits (001, 002, etc.) + - Example: `feat: Add User Authentication` → `2026-01-21-001-feat-add-user-authentication-plan.md` - Keep it descriptive (3-5 words after prefix) so plans are findable by context **Stakeholder Analysis:** @@ -538,9 +541,13 @@ Before finalizing, re-read the brainstorm document and verify: ```bash mkdir -p docs/plans/ +# Determine daily sequence number +today=$(date +%Y-%m-%d) +last_seq=$(ls docs/plans/${today}-*-plan.md 2>/dev/null | grep -oP "${today}-\K\d{3}" | sort -n | tail -1) +next_seq=$(printf "%03d" $(( ${last_seq:-0} + 1 ))) ``` -Use the Write tool to save the complete plan to `docs/plans/YYYY-MM-DD---plan.md`. This step is mandatory and cannot be skipped — even when running as part of LFG/SLFG or other automated pipelines. +Use the Write tool to save the complete plan to `docs/plans/YYYY-MM-DD-NNN---plan.md` (where NNN is `$next_seq` from the bash command above). This step is mandatory and cannot be skipped — even when running as part of LFG/SLFG or other automated pipelines. Confirm: "Plan written to docs/plans/[filename]" @@ -548,26 +555,26 @@ Confirm: "Plan written to docs/plans/[filename]" ## Output Format -**Filename:** Use the date and kebab-case filename from Step 2 Title & Categorization. +**Filename:** Use the date, daily sequence number, and kebab-case filename from Step 2 Title & Categorization. ``` -docs/plans/YYYY-MM-DD---plan.md +docs/plans/YYYY-MM-DD-NNN---plan.md ``` Examples: -- ✅ `docs/plans/2026-01-15-feat-user-authentication-flow-plan.md` -- ✅ `docs/plans/2026-02-03-fix-checkout-race-condition-plan.md` -- ✅ `docs/plans/2026-03-10-refactor-api-client-extraction-plan.md` -- ❌ `docs/plans/2026-01-15-feat-thing-plan.md` (not descriptive - what "thing"?) -- ❌ `docs/plans/2026-01-15-feat-new-feature-plan.md` (too vague - what feature?) -- ❌ `docs/plans/2026-01-15-feat: user auth-plan.md` (invalid characters - colon and space) -- ❌ `docs/plans/feat-user-auth-plan.md` (missing date prefix) +- ✅ `docs/plans/2026-01-15-001-feat-user-authentication-flow-plan.md` +- ✅ `docs/plans/2026-02-03-001-fix-checkout-race-condition-plan.md` +- ✅ `docs/plans/2026-03-10-002-refactor-api-client-extraction-plan.md` +- ❌ `docs/plans/2026-01-15-feat-thing-plan.md` (missing sequence number, not descriptive) +- ❌ `docs/plans/2026-01-15-001-feat-new-feature-plan.md` (too vague - what feature?) +- ❌ `docs/plans/2026-01-15-001-feat: user auth-plan.md` (invalid characters - colon and space) +- ❌ `docs/plans/feat-user-auth-plan.md` (missing date prefix and sequence number) ## Post-Generation Options After writing the plan file, use the **AskUserQuestion tool** to present these options: -**Question:** "Plan ready at `docs/plans/YYYY-MM-DD---plan.md`. What would you like to do next?" +**Question:** "Plan ready at `docs/plans/YYYY-MM-DD-NNN---plan.md`. What would you like to do next?" **Options:** 1. **Open plan in editor** - Open the plan file for review