fix: spec {{PREAMBLE}} duplication bug + factor shared conduct block out of every skill#2342
Open
agrawalparth08 wants to merge 1 commit into
Open
fix: spec {{PREAMBLE}} duplication bug + factor shared conduct block out of every skill#2342agrawalparth08 wants to merge 1 commit into
agrawalparth08 wants to merge 1 commit into
Conversation
…ck into docs/shared-conduct.md
Two fixes found in a context-engineering audit:
1. spec/SKILL.md.tmpl referenced {{PREAMBLE}} inline in prose ('emitted by
`{{PREAMBLE}}`'s preamble bash'), which the resolver expanded, pasting the
entire ~770-line preamble block a second time mid-sentence into the
generated spec/SKILL.md (2360 lines instead of ~1590). Fixed the prose and
added a generator guard: {{PREAMBLE}} appearing more than once per template
now throws at gen time instead of silently corrupting output.
2. The identical behavioral block stamped into every Claude-host skill
(Model-Specific Behavioral Patch, Voice, Completion Status Protocol,
Operational Self-Improvement — ~150-190 lines x 49 skills) is factored
into one generated docs/shared-conduct.md; each skill carries a short
'## Shared Conduct' pointer instead. Operational parts (telemetry bash,
plan-status footer) stay inline. External hosts (Codex/Factory) keep the
full inline block since their installs don't ship the shared doc.
Saves ~45K tokens across the generated corpus.
Tests updated for the factoring; parity baseline recaptured and claude-ship
golden refreshed (deliberate uniform shrink).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
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.
What
Two fixes found in a 2026-07-25 context-engineering audit of the generated skills:
1. Template-assembly bug: spec/SKILL.md ships with the entire preamble pasted twice
spec/SKILL.md.tmplreferenced{{PREAMBLE}}inline in prose ("emitted by{{PREAMBLE}}'s preamble bash"). The resolver expands every occurrence, so the generatedspec/SKILL.mdcontained the full ~770-line preamble block a second time, spliced mid-sentence into the Phase 5 dispatch logic (2360 lines instead of ~1590).gen-skill-docs.ts:{{PREAMBLE}}appearing more than once in a template now throws at gen time with a clear message, instead of silently corrupting output.2. Factor the identical behavioral block into one shared doc (Claude host)
Every Claude-host skill carried the same ~150-190 line block: "Model-Specific Behavioral Patch", "Voice", "Completion Status Protocol", "Operational Self-Improvement" — identical for a given build, duplicated ~49 times. Per Anthropic's Claude-5 context-engineering guidance this is generic behavioral prose that should be stated once.
docs/shared-conduct.md; each skill's preamble carries a short## Shared Conductpointer to it.Tests
bun teston the touched suites: 822 pass, 0 fail on top of current main.🤖 Generated with Claude Code