Rewrite /deepen-plan with context-managed map-reduce (v3)#178
Draft
Drewx-Design wants to merge 4 commits intoEveryInc:mainfrom
Draft
Rewrite /deepen-plan with context-managed map-reduce (v3)#178Drewx-Design wants to merge 4 commits intoEveryInc:mainfrom
Drewx-Design wants to merge 4 commits intoEveryInc:mainfrom
Conversation
…re (v3) Replace unbounded v1 agent output with phased file-based map-reduce pattern that keeps parent context under ~12k tokens. Adds plan manifest analysis, validation, judge phase with source attribution priority, and preservation checking. Aligns with plugin ecosystem conventions.
…mplementing The compound-docs skill already has a validated YAML schema and 7-step process. Instead of reimplementing it inside deepen-plan, offer the user the option to run /workflows:compound themselves.
The deepen-plan command deepens decisions but never challenges them. Real reviewer feedback showed it misses redundant tool params, YAGNI violations built despite being flagged, and misplaced business logic. Adds two new always-run agents: - agent-native-architecture-reviewer: routes to skill checklist, anti-patterns, and reference files (not generic prompt) - project-architecture-challenger: reads CLAUDE.md and challenges every decision against project-specific principles Also injects PROJECT ARCHITECTURE CONTEXT into all review/research agent prompts so they evaluate against project conventions.
…ents Validated across two real-world pipeline runs. Key changes: - Batched agent launches (max 4 pending) to prevent context overflow crashes - 200-char return cap on agent messages (all analysis in JSON files) - Version grounding: lockfile > package.json > plan text priority - Per-section judge parallelization (~21 min -> ~8-10 min) - Two-part output: Decision Record (reviewers) + Implementation Spec (developers) - Quality review phase (CoVe pattern) catches self-contradictions and code gaps - Enhancer resolves conditionals, verifies API versions, checks accessibility - fast_follow classification bucket for ticketable items - Convergence signals with [Strong Signal] markers - Task() failure recovery (retry once on infrastructure errors) - truncated_count field for judge convergence weighting - Pipeline checkpoint logging for diagnostics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.