Rewrite /deepen-plan with context-managed map-reduce (v3) #178
+773
−362
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
/deepen-planwith a phased file-based map-reduce architecture (same pattern as the review command v2 in Rewrite workflows:review with context-managed map-reduce architecture #157).deepen/on disk and return only ~100 token summaries to parent.deepen/instead of/tmp/Architecture Changes
find+head(bash, Windows-broken).deepen/, return 1 sentencedocs/solutions/files via compound-docs skillAlignment Audit: v3 vs Plugin Ecosystem
Performed a full audit of v3 against the compound-engineering plugin (v2.33.0) -- all agents, skills, commands, MCP servers, and conventions.
1. Agent Discovery Completeness -- Aligned
~/.claude/plugins/cache/**/agents/**/*.mdmatchesevery-marketplace/compound-engineering/2.33.0/agents/review/(14),research/(4),design/(3),docs/(1). SKIP:workflow/(5 orchestrators)security-sentinel.md,architecture-strategist.md,performance-oracle.mdall verifiedcode-simplicity-reviewer,agent-native-reviewer,pattern-recognition-specialist, language-specific reviewersFixed from v1: v1 said "run ALL agents" (40+ parallel). v3 uses intelligent selection: 3 always-run + manifest-matched, reducing from ~30 agents to 10-15 targeted ones.
2. Skill Discovery -- Aligned (with fixes applied)
~/.claude/plugins/cache/**/skills/*/SKILL.mdmatches all 14 skillskieran-rails-style(doesn't exist as a skill -- it's an agent). Added:andrew-kane-gem-writer,dspy-ruby,every-style-editor,create-agent-skillsreferences/,assets/,templates/subdirectoriesFixed from v1: v1 only read
SKILL.md. v3 agents also readreferences/*.md,assets/*,templates/*-- critical for skills likeagent-native-architecture(14 reference files) andcreate-agent-skills(11 references + templates + workflows).3. Command Pipeline -- Aligned (with fixes applied)
/workflows:planto/deepen-planplans/directory./deepen-planto/workflows:work// ENHANCED:comments. Work command reads it fine./deepen-planto/plan_review/workflows:review(code review, not plan review). v3 correctly offers/plan_review./lfgchainname: deepen-plan(notworkflows:deepen-plan) so/lfgand/slfgreferences to/compound-engineering:deepen-planstill work.compound-docsskill and its YAML schema for properly validated learning files.4. MCP Server Integration -- Aligned
resolve-library-idandquery-docsverified againstplugin.jsonmcpServers config5. Naming and Convention Alignment -- Aligned (with fixes applied)
name: deepen-plan(incommands/notcommands/workflows/). Matches existing plugin structure and/lfg//slfgreferences.docs/solutions/[category]/with compound-docs schema.6. Philosophy Alignment -- Aligned
skill > documented-learning > official-docs > community-webmatchesbest-practices-researcherPhase 1-2-3 order7. Edge Cases -- Compatible
.claude/agents/*.mdglob catches project-local agentsreferences/,assets/,templates/~/.claude/plugins/cache/**/agents/**/*.mdcatches all.deepen/, Node.js for validation (no Python/bash dependency)Key Fixes Applied (v1 to v3)
SKILL.md. v3 reads full skill tree including references, assets, templates.kieran-rails-styleghost skill -- v1 referenced a skill that doesn't exist. v3 maps to actual skill names./workflows:reviewvs/plan_review-- v1 offered code review for plan feedback. v3 correctly offers plan review.deepen-plan(notworkflows:deepen-plan) for/lfg//slfgcompatibility.compound-docsYAML schema..deepen/instead of/tmp/. Node.js instead of Python3. Glob/Read instead offind/head.tools_usedflagged, judge downweights confidence by 0.2.Test plan
/deepen-plan plans/test-plan.mdon a Rails plan -- verify.deepen/directory created with expected JSON files/lfgend-to-end to confirm/compound-engineering:deepen-planstill resolves correctlycompound-docsYAML schema.deepen/path and Node.js validation work cross-platformdocs/solutions/to confirm sparse discovery handles gracefullyBreaking Changes Risk
If the plugin updates these, v3 would need updating:
security-sentinel). If agents are renamed, the always-run tier and manifest-matched lists need updating.These are the same risks the existing
/workflows:reviewand/workflows:plancommands face -- nothing unique to/deepen-plan.