fix: harden worker prompt against context compression - #57
Merged
Conversation
This was referenced Aug 6, 2026
sonupreetam
reviewed
Aug 6, 2026
sonupreetam
left a comment
Contributor
There was a problem hiding this comment.
Review Council
Ran the review council (6 Divisor agents). Well-executed — the inline constraint approach is the right architectural choice and the test is thorough. One brittleness concern below.
Merge note: This PR inserts a test at line 152 of agentkit_test.go, same as #54 and #58. Suggest merging after #54, then rebasing.
This was referenced Aug 6, 2026
jflowers
added a commit
to jflowers/replicator
that referenced
this pull request
Aug 7, 2026
Refactor TestWorkerPrompt_HardenedStructure to search within a window of lines (current + next 3) for STOP and comms_send assertions instead of requiring single-line co-location. This makes the test resilient to sub-bullet reformatting of step 3 in worker.md. Addresses review feedback from @sonupreetam on PR unbound-force#57.
jflowers
added a commit
to jflowers/replicator
that referenced
this pull request
Aug 10, 2026
Refactor TestWorkerPrompt_HardenedStructure to search within a window of lines (current + next 3) for STOP and comms_send assertions instead of requiring single-line co-location. This makes the test resilient to sub-bullet reformatting of step 3 in worker.md. Addresses review feedback from @sonupreetam on PR unbound-force#57.
jflowers
force-pushed
the
opsx/harden-worker-prompt
branch
from
August 10, 2026 16:40
1e1d338 to
571c85f
Compare
Restructure worker.md to make critical behavioral constraints compression-resistant by integrating them inline with checklist steps using MUST/NEVER language. Addresses unbound-force#49. - Integrate file reservation, progress reporting, and learning storage constraints directly into the checklist steps they govern - Add reservation failure recovery path (STOP + comms_send) - Remove separate Constraints section (compression-vulnerable) - Add TestWorkerPrompt_HardenedStructure content-verification test - Add OpenSpec change artifacts (proposal, design, specs, tasks) Assisted-by: claude-opus Generated with AI assistance (claude-opus)
Refactor TestWorkerPrompt_HardenedStructure to search within a window of lines (current + next 3) for STOP and comms_send assertions instead of requiring single-line co-location. This makes the test resilient to sub-bullet reformatting of step 3 in worker.md. Addresses review feedback from @sonupreetam on PR unbound-force#57.
jflowers
force-pushed
the
opsx/harden-worker-prompt
branch
from
August 10, 2026 16:50
571c85f to
2ff616e
Compare
sonupreetam
reviewed
Aug 10, 2026
sonupreetam
left a comment
Contributor
There was a problem hiding this comment.
Review Council (6 Divisor agents)
Verdict: APPROVE (conditional on rebase)
Cleanest PR in the series. No blocking findings from any of the 6 Divisor agents. The windowed line search pattern (commit 571c85f) is a good solution for the brittleness concern from the prior review.
Mechanical blocker
- Needs rebase onto main (PR #54 merged, test file has shifted)
Merge order recommendation
Merge 3rd (#54 already merged → #55 → #57 → #56 → #59). Rebase before merge.
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
Hardens
worker.mdagent prompt against LLM context compression by restructuring critical behavioral constraints. Fixes #49.The worker's file reservation enforcement, progress reporting requirements, and learning storage constraints were in a separate "Constraints" section vulnerable to being summarized away by context compressors. This restructuring integrates each constraint inline with the checklist step it governs, making them atomic units that compressors must keep or drop together.
Key changes:
comms_sendto coordinator)## Constraintssection eliminatedHow to Test
Verify structurally:
worker.mdhas no## Constraintsheadingcomms_reserve) includes "NEVER edit unreserved files" and reservation failure recoveryHow to Demo
Compare the before (separate Constraints section with flat bullets) to the after (all constraints inline with numbered steps). Each step now reads as "do X — MUST/NEVER Y" rather than having the constraint in a disconnected section.
Key Files Changed
internal/agentkit/content/agents/worker.mdinternal/agentkit/agentkit_test.goTestWorkerPrompt_HardenedStructure— structural verification test for the hardened promptopenspec/changes/harden-worker-prompt/This PR was generated by /uf.finale (AI-assisted).