Optimize spec-enforcer prompt with inline small-model sub-agents#32641
Merged
pelikhan merged 3 commits intoMay 16, 2026
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Optimize spec-enforcer with inline sub-agents
Optimize May 16, 2026
spec-enforcer prompt with inline small-model sub-agents
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the spec-enforcer workflow prompt to reduce token usage by delegating bounded parsing/extraction/classification steps to inline small-model sub-agents, while keeping the main model responsible for test generation and PR authoring.
Changes:
- Delegates rotation recovery to a new
rotation-state-recovererinline agent (and fetchesmergedAtin PR list output). - Parallelizes README specification extraction via
readme-spec-extractorand uses its JSON as the Phase 3 test-generation source of truth. - Delegates build/test failure triage to
test-output-classifierwith a fixed action taxonomy.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/spec-enforcer.md |
Refactors prompt phases to invoke inline sub-agents for rotation recovery, README spec extraction, and test output classification. |
.github/workflows/pr-sous-chef.lock.yml |
Regenerates the workflow lockfile to reflect updated prompt/heredoc identifiers and minor formatting deltas. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 2
Comment on lines
+137
to
+146
| 3. If `rotation.json` is missing or empty, fetch the most recently merged PR with: | ||
| - `gh pr list --repo ${{ github.repository }} --state merged --label pkg-specifications --limit 1 --json number,body,mergedAt` | ||
| Then use the `rotation-state-recoverer` agent — pass it the PR body text and the eligible package list — to produce the rotation JSON. Write the agent's output to `rotation.json` (set `last_run` to the PR's `mergedAt` UTC date). If no matching PR exists, write fallback state: | ||
| ```json | ||
| { | ||
| "last_index": -1, | ||
| "last_packages": [], | ||
| "last_run": "unknown", | ||
| "total_eligible": N | ||
| } |
Comment on lines
+425
to
+426
| Output JSON only: | ||
| `{"last_index": <int>, "last_packages": ["..."], "total_eligible": <int>}` |
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.
spec-enforcerwas consuming very high Claude tokens without using inline sub-agents, despite having separable extractive/classification phases. This updates the workflow prompt to offload bounded tasks to small-model inline agents while preserving main-model ownership of test generation and PR authoring.Phase 0: rotation recovery delegated
rotation-state-recoverer.mergedAtand clarified fallback rotation state handling.Phase 2: README extraction parallelized
readme-spec-extractorper selected package.Phase 4: test/build failure triage delegated
test-output-classifieroutput-driven actions:fix_testflag_spec_ambiguityflag_spec_mismatchinvestigateInline sub-agent definitions added
.github/workflows/spec-enforcer.md:rotation-state-recoverer(model: small)readme-spec-extractor(model: small)test-output-classifier(model: small)