Skip to content

fix: harden /handoff command against DCP context compression - #58

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

fix: harden /handoff command against DCP context compression#58
jflowers wants to merge 1 commit into
unbound-force:mainfrom
jflowers:opsx/harden-handoff-dcp

Conversation

@jflowers

@jflowers jflowers commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Hardens the /handoff command prompt against DCP context compression to prevent step reordering, template loss, and unsafe reservation releases during compressed sessions.

Under DCP context compression, the original handoff.md suffered three fragilities: numbered steps could be reordered or merged, the handoff note template section could be dropped entirely, and no precondition check prevented releasing reservations while forge workers were active. This is the same class of vulnerability as unbound-force/unbound-force#346 (review-pr confirmation gate bypass).

Fixes #50.

How to Test

# Run the structural content test
go test ./internal/agentkit/ -run TestHandoffMD -v

# Run the full test suite
make test

# Verify the hardened file structure
cat internal/agentkit/content/commands/handoff.md

Verify the following structural properties:

  1. "Steps MUST execute in this exact order" appears before the first numbered step
  2. All five handoff note categories (Completed, In Progress, Blocked, Next Steps, Gotchas) appear within the org_session_end step section
  3. No separate "## Handoff Note Template" section exists
  4. "Forge precondition check" text is present before step 1
  5. "Depends on step N" rationale exists for steps 2-5

How to Demo

Read the hardened handoff.md file and observe the structural changes: explicit ordering constraint, forge precondition check (step 0), per-step dependency rationale, and inlined handoff note template in step 5. Run the test to see the 5 structural assertions pass.

Key Files Changed

File Change
internal/agentkit/content/commands/handoff.md Hardened prompt: ordering constraint, forge precondition, step rationale, inline template
internal/agentkit/agentkit_test.go New TestHandoffMD_StructuralHardening with 5 assertions
openspec/changes/harden-handoff-dcp/proposal.md Change proposal with constitution alignment
openspec/changes/harden-handoff-dcp/design.md Technical design (4 decisions, 3 risks)
openspec/changes/harden-handoff-dcp/specs/*.md Delta spec with 4 requirements and scenarios
openspec/changes/harden-handoff-dcp/tasks.md Implementation task checklist (all complete)

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

- Add explicit step ordering constraint (MUST language)
- Add forge precondition check (SHOULD, graceful degradation)
- Add per-step dependency rationale to resist reordering
- Inline handoff note template into org_session_end step
- Remove separate "Handoff Note Template" section
- Add structural content test (5 assertions)
- Add OpenSpec change artifacts (proposal, design, spec, tasks)

Fixes unbound-force#50

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 20:04
@jflowers jflowers self-assigned this Aug 2, 2026
@jflowers
jflowers requested a review from yvonnedevlinrh August 2, 2026 20:50
@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: /handoff command step ordering and template structure lost under context compression

1 participant