feat(ce-review): add compact returns to reduce orchestrator context during merge#535
feat(ce-review): add compact returns to reduce orchestrator context during merge#535
Conversation
…uring merge Sub-agents now write full-detail JSON (including why_it_matters, evidence, suggested_fix) to artifact files on disk and return only merge-tier fields to the orchestrator. This reduces orchestrator context by ~24-37k tokens during Stage 5 merge while preserving full detail for headless output enrichment and debugging. Key changes: - Subagent template: two-output contract (artifact file + compact return), conditional on run_id presence for report-only compatibility - Findings schema: return_tiers metadata documenting the merge/detail split - SKILL.md: run-id generation before dispatch, merge-tier-only validation in Stage 5, headless detail enrichment from per-agent artifact files with file+line lookup for merged multi-reviewer findings Also fixes pre-existing duplicate step numbering in Stage 5 (was 5,5,6 now correctly 5,6,7). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0d539b066b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…are reviewer selection suggested_fix is small and optional but directly supports the orchestrator's auto-apply decision in interactive mode. Without it in the compact return, the orchestrator lacks fix context and hesitates on safe_auto routing. Move it from detail-tier to merge-tier across schema, template, and SKILL.md. Also add file-type awareness to adversarial reviewer selection — prose/instruction Markdown and JSON schemas don't benefit from runtime-focused techniques (race conditions, cascade failures). Skip adversarial for pure prose diffs unless they describe high-risk behavior like auth or payments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f21cc461a1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ookup (#535) Stage 5 compact return validation now checks value constraints (severity enum, autofix_class enum, owner enum, confidence range, type checks) in addition to field presence. Previously only presence was checked, allowing malformed values to survive into routing. Detail enrichment now scopes artifact lookups to contributing reviewers and disambiguates same-line findings by normalized title, preventing cross-wiring when multiple findings share a file+line. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38eedeb42d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…r suggested_fix (#535) Headless enrichment text still called suggested_fix a detail-tier field after it was moved to merge-tier. Now correctly uses suggested_fix from compact returns and only loads why_it_matters/evidence from artifact files. Fallback path preserves suggested_fix even when artifacts fail. Also adds a clarifying note in the subagent template explaining that the embedded schema describes the artifact file format, not the compact return -- resolving the contradiction between required fields in the schema and the "Do NOT include" instruction. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1cae0414d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…el validation (#535) Line 65 headless mode rules still listed suggested_fix as detail-tier loaded from artifacts -- leftover from before the merge-tier move. Now correctly lists it alongside other merge-tier fields. Stage 5 validation now checks top-level compact return fields (reviewer, residual_risks, testing_gaps) before processing findings, catching malformed returns that would silently degrade agreement attribution. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f044cdca27
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…tion (#535) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Step 2 relied on the reader carrying "include resolved threads" from the gate-fires paragraph two steps earlier. In practice the orchestrator grouped only new threads, missing clusters that span new + resolved items. Restating the input set at the grouping step prevents this. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a36f9f4c1e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…mat as sub-bullets (#535) - Detail enrichment matching now uses file + line_bucket(line, +/-3) instead of exact file + line, matching Stage 5 dedup tolerance - Reformatted detail enrichment section from prose to labeled sub-bullets for better agent adherence (Field tiers, Artifact matching, Reviewer order, No-match fallback) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Sub-agents now produce two outputs: a full-detail JSON artifact file on disk and a compact merge-tier-only return to the orchestrator. This reduces orchestrator context during Stage 5 merge while preserving full detail for headless output enrichment and debugging.
Inspired by the work originally by @Drewx-Design in #157.
Changes
subagent-template.md.context/write.{run_id}and{reviewer_name}variables added.findings-schema.json_meta.return_tiersdocumenting merge-tier vs detail-tier field split. Schemarequiredarray unchanged (enforces full fields for artifact file).SKILL.mdfile + linelookup. Fixes pre-existing duplicate step numbering (5,5,6 -> 5,6,7).persona-catalog.mdDesign decisions
suggested_fixstays in compact returns -- it's small (often null), directly supports the orchestrator's auto-apply decision in interactive mode, and doesn't meaningfully impact context savings. Without it, the orchestrator lacks fix context and hesitates onsafe_autorouting.why_it_mattersandevidence(the bulky fields) remain detail-tier only.file + linelookup for enrichment (nottitle) -- Stage 5 dedup appliesnormalize(title)which could alter the title string, breaking a title-based lookup.Test plan
suggested_fixtier misplacement causing auto-apply hesitation, adversarial over-triggering on prose diffs.context/