Skip to content

Rewrite workflows:review with context-managed map-reduce architecture#157

Open
Drewx-Design wants to merge 3 commits intoEveryInc:mainfrom
Drewx-Design:feat/review-command-v2-context-managed
Open

Rewrite workflows:review with context-managed map-reduce architecture#157
Drewx-Design wants to merge 3 commits intoEveryInc:mainfrom
Drewx-Design:feat/review-command-v2-context-managed

Conversation

@Drewx-Design
Copy link

Summary

  • Replaces the v1 review command with a phased file-based map-reduce architecture that prevents context overflow
  • Sub-agents write full analysis to .review/ on disk and return only ~100 token summaries to the parent, keeping parent context under ~12k tokens (vs ~30-50k in v1)
  • Adds new phases: PR Intent Analysis (shared context), Validation (catches silent failures), Judge (dedup + hallucination removal), and Deep Analysis (P1/P2 enrichment)
  • Smart agent selection based on PR content instead of running all 13+ agents on every PR
  • Cross-platform safe: uses project-relative .review/ instead of /tmp/ (fixes Windows path issues)

Key Architecture Changes

Phase What Changed
Intent (new) Single agent produces shared context so specialists don't redundantly re-derive PR intent
Map Agents write JSON to .review/, return 1 sentence each (~100 tokens vs 2-4k)
Validate (new) Catches silent agent failures + validates JSON schema before judging
Judge (new) Deduplicates, evidence-checks (removes hallucinated findings), ranks top-N
Deep Analysis (new) Enriches P1/P2 with stakeholder impact, failure scenarios, suggested fixes
Reduce Parent reads only ENRICHED_FINDINGS.json (~8k tokens max), spawns todo-creation agents

Test plan

  • Run /workflows:review on a PR with mixed file types (Ruby + JS) to verify agent selection
  • Verify .review/ directory is created with expected agent output files
  • Confirm parent context stays under ~14k tokens of agent output
  • Test on Windows to verify cross-platform .review/ path works
  • Verify hallucinated findings (referencing non-existent files) are removed by judge

Drewx-Design and others added 2 commits February 8, 2026 12:31
Replace the v1 review command with a context-managed v2 that prevents
context overflow by having sub-agents write findings to .review/ on disk
and return only single-sentence summaries to the parent.

Key changes:
- Add PR Intent Analysis phase (shared context for all specialists)
- Agents write JSON to .review/, return ~100 tokens each to parent
- Add validation step to catch silent agent failures and invalid JSON
- Add Judge phase for dedup, hallucination removal, and ranking
- Add Deep Analysis phase for P1/P2 enrichment
- Parent reads only ENRICHED_FINDINGS.json (~8k tokens vs ~30-50k in v1)
- Smart agent selection based on PR content instead of running all agents
- Cross-platform safe: uses project-relative .review/ instead of /tmp/

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
…exploration

- Add git-history-analyzer and code-philosopher to conditional agent selection
- Expand Deep Analysis Phase with detailed stakeholder impact analysis
  (Developer, Operations, End User, Security, Business perspectives)
- Add comprehensive scenario exploration checklist (invalid inputs,
  concurrency, scale, network, resource exhaustion, security vectors, etc.)
- Note that deep analysis inherits the Ultra-Thinking approach from v1
  but scoped to judged findings in an isolated context window

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
@kieranklaassen kieranklaassen added the enhancement New feature or request label Feb 8, 2026
@gregoryfm
Copy link

I ran into this issue today. I asked for a PR review, and it hit the limit. I am on the Max 5 plan.


Ensure that the code is ready for analysis (either in worktree or on current branch). ONLY then proceed to the next step.

- [ ] If ALREADY on the target branch → proceed with analysis on current branch
Copy link
Contributor

@XSAM XSAM Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why we keep - [ ] instead of a numbered list. What is the benefit of using - [ ] in this case?

- Remove 4 ghost agents (rails-turbo-expert, dependency-detective,
  devops-harmony-analyst, code-philosopher) that don't exist in plugin
- Add 5 missing real agents to selection matrix (kieran-typescript-reviewer,
  kieran-python-reviewer, julik-frontend-races-reviewer, schema-drift-detector,
  learnings-researcher)
- Replace Python3 JSON validation with Node.js for cross-platform compat
- Add excluded paths check to judge prompt (not just agent prompts)
- Add 0-findings short-circuit for clean PRs
- Fix .gitignore append duplication with grep -q guard
- Update frontmatter description to match v2 purpose
- Bump version to 2.31.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants