P2: token discipline — schema caps, output contracts, CLAUDE.md - #43
Conversation
An unbounded verifier verdict (many issues, a wall-of-text summary) is a failed task even when correct, but nothing enforced that: oversized verdicts sailed through validate_review_verdict and downstream. Add caps to the live runtime schema (issues.maxItems=5; summary/iteration_notes/ per-issue-field maxLength) and mirror them shell-side so a cap-violating verdict takes the existing invalid-verdict path — the claude verifier seat has no --output-schema, so the CLI check alone would not catch it. The frozen PS-runner schema pair (schemas/ + runners/codex-ps/) stays at the loose F-2 shape; the drift guard is reworked to assert that split (frozen pair identical, runtime a strict superset) and to pin the caps in both the jq and jq-less validator branches. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Belt to the schema's braces: even where output is structured, the model does better when the prompt states the budget up front. Verifier prompts now spell out summary <=40 words, <=5 one-line file:line issues, and no pasted file contents; the composer prompt caps the plan body at <=120 lines so a sprawling plan is a signal to cut scope, not write more. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Give the return-size contracts, working style, and delegation template a home in CLAUDE.md so agents inherit them, and make the codex-build wake gate explicit that it reads dev-review-status.sh --json only — the raw compose/execute/review logs are noise, not the interface, and pulling them into the gate's reasoning is the token blow-up the discipline exists to prevent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8d69f60a1d
ℹ️ 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".
| if (( ${#summary} > MAX_SUMMARY_LEN )); then | ||
| printf 'summary exceeded the %s-character cap' "$MAX_SUMMARY_LEN" | ||
| return 1 | ||
| fi |
There was a problem hiding this comment.
Enforce all caps in the jq-less validator path
When jq is unavailable, the new fallback branch only counts issue severities and checks summary; after this check it returns success without enforcing the 240-character caps for file/line_range/description/suggestion or the 600-character iteration_notes cap that the schema and jq branch now require. I verified the fallback path by shadowing command -v jq: a REVISE verdict with a 300-character issues[0].description is accepted, so jq-less installs can still pass wall-of-text verifier output into the revise loop.
Useful? React with 👍 / 👎.
Both P2 and P3 added a section at the same anchor (Model Routing was the EOF section when both branched), which left the PR unmergeable and silently suppressed all pull_request CI runs. Order: Model Routing -> Token Discipline -> Interactive vs Pipeline Boundary. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Phase 2 of the workflow-upgrade plan (plan @ e6db065).
What changed (3 commits)
skills/dev-review/schemas/review-verdict.json— machine-checked caps:issues.maxItems: 5,maxLengthon all free text (summary 320, per-issue fields 240, iteration_notes 600). The two frozen copies (rootschemas/,runners/codex-ps/schemas/) untouched (0 diff); the F-2 drift-guard sim reworked to the new invariant: frozen pair byte-identical + cap-free, runtime copy a strict superset with caps.lib/co-evolution.sh:830-965—validate_review_verdictenforces the same caps in BOTH the jq and jq-less branches; an over-cap verdict takes the existing invalid-verdict path (never passed downstream).skills/dev-review/templates/review-prompt-{opus,codex}.md— output contracts (summary ≤40 words, ≤5 one-line file:line issues, no pasted file contents);dev-review/codex/dev-review.sh:632inline compose prompt caps plan body ≤120 lines (composition has no template file — deviation noted).skills/codex-build/SKILL.md— wake gate readsdev-review-status.sh --jsononly, never raw logs.CLAUDE.md— Token Discipline section (return contracts, grep-before-read, noisy-op isolation, escalation ladder, 4-part delegation template), inserted after Model Routing.tests/review-verdict-schema-simulation.sh— 5→23 scenarios.Verification — 23/23 schema sim (stash-proof: pre-change, the 6 cap scenarios ACCEPT oversized verdicts; post-change REJECT); quick suite 25/25; pr-emitter 12/12; code-proposer 16/16; codex-ps zero diff. Live smoke:
codex exec --output-schemawith the capped schema → accepted, conformant verdict returned.Skipped by design: PEL
--budgetpreflight wire-up — it's a USD spend cap, not a token estimator; nothing trivial to surface.🤖 Generated with Claude Code