Skip to content

fix: harden worker prompt against context compression - #57

Open
jflowers wants to merge 1 commit into
unbound-force:mainfrom
jflowers:opsx/harden-worker-prompt
Open

fix: harden worker prompt against context compression#57
jflowers wants to merge 1 commit into
unbound-force:mainfrom
jflowers:opsx/harden-worker-prompt

Conversation

@jflowers

@jflowers jflowers commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Hardens worker.md agent 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:

  • Constraints co-located with their checklist steps using MUST/NEVER language
  • Reservation failure recovery path added (STOP + comms_send to coordinator)
  • Separate ## Constraints section eliminated
  • File reduced from 27 to 20 lines

How to Test

# Run the content-verification test
go test ./internal/agentkit/ -run TestWorkerPrompt_HardenedStructure -v

# Run the full suite
make check

Verify structurally:

  • worker.md has no ## Constraints heading
  • Step 3 (comms_reserve) includes "NEVER edit unreserved files" and reservation failure recovery
  • Steps 5 and 6 use "MUST" language for progress reporting and learning storage
  • File is 20 lines (under 35-line target from design decision D4)

How to Demo

cat internal/agentkit/content/agents/worker.md

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

File Change
internal/agentkit/content/agents/worker.md Hardened prompt: constraints inline, MUST/NEVER language, reservation failure recovery, Constraints section removed (27→20 lines)
internal/agentkit/agentkit_test.go New TestWorkerPrompt_HardenedStructure — structural verification test for the hardened prompt
openspec/changes/harden-worker-prompt/ OpenSpec change artifacts: proposal, design, delta spec, tasks

This PR was generated by /uf.finale (AI-assisted).

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)
@jflowers
jflowers requested a review from a team as a code owner August 2, 2026 19:44
@jflowers
jflowers requested a review from yvonnedevlinrh August 2, 2026 20:50
@jflowers jflowers self-assigned this Aug 2, 2026
@jflowers jflowers moved this to In Review 👀 in Unbound Force Planning Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review 👀

Development

Successfully merging this pull request may close these issues.

bug: worker.md reservation constraint and progress reporting lost under context compression

1 participant