fix: harden coordinator prompt against context compression - #54
Open
jflowers wants to merge 1 commit into
Open
Conversation
Restructure coordinator.md to survive DCP context compression: - Add identity-first opening embedding key constraints (NEVER reserve files) - Create dedicated Critical Constraints section before Protocol - Add explicit forge_review BEFORE forge_complete ordering - Use uppercase MUST/NEVER keywords for compression-resistant severity signaling - Convert flat rules list to numbered 8-step Protocol Add TestCoordinatorPrompt_StructuralResilience verifying 7 properties: frontmatter, identity paragraph, section ordering, behavioral rule markers, per-line RFC 2119 keywords, ordering semantics, and compression resilience (first 50% of lines contain all critical constraints). Fixes unbound-force#46 Assisted-by: claude-opus-4 Generated with AI assistance (claude-opus-4)
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.
Summary
Fixes #46 — the coordinator agent prompt (
internal/agentkit/content/agents/coordinator.md) was compression-fragile. Its 6 behavioral constraints were expressed as unordered bullet points in a single "Rules" section, where critical constraints like "Never reserve files" and "Review every worker completion" would be lost under DCP context compression.This restructures the prompt using patterns proven in the project's other agent files and the forge coordination skill:
forge_review→forge_completeorderingTestCoordinatorPrompt_StructuralResilience) verifying 7 compression-resilience propertiesHow to Test
The structural test verifies:
How to Demo
Read the restructured
internal/agentkit/content/agents/coordinator.md— the identity-first opening, Critical Constraints section, and numbered Protocol are self-evident. Compare against the previous version (flat bullet list) to see the structural improvement.Key Files Changed
internal/agentkit/content/agents/coordinator.mdinternal/agentkit/agentkit_test.goTestCoordinatorPrompt_StructuralResilience(151 lines)openspec/changes/coordinator-prompt-hardening/This PR was generated by /uf.finale (AI-assisted).