fix: harden /handoff command against DCP context compression - #58
Conversation
- 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)
sonupreetam
left a comment
There was a problem hiding this comment.
Review Council
Ran the review council (6 Divisor agents). This is the cleanest of the 6 PRs — well-structured change, thorough test, honest spec (correctly lists the forge precondition as a "New Capability"). One minor note below.
Merge note: This PR inserts a test at line 152 of agentkit_test.go, same as #54 and #57. Suggest merging after both, then rebasing.
| if sessionEndIdx < 0 { | ||
| t.Fatal("handoff.md: missing org_session_end reference") | ||
| } | ||
| afterSessionEnd := text[sessionEndIdx:] |
There was a problem hiding this comment.
[MEDIUM] Category co-location check could be stronger
afterSessionEnd is everything from org_session_end to the end of the file. If the categories appeared in a completely different section that happens to follow org_session_end, this would still pass. The spec requires co-location "within the same markdown section."
A stronger assertion would find the next ## heading after org_session_end and verify categories appear before it. Not blocking — the test is directionally correct.
Summary
Hardens the
/handoffcommand 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
Verify the following structural properties:
org_session_endstep sectionHow to Demo
Read the hardened
handoff.mdfile 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
internal/agentkit/content/commands/handoff.mdinternal/agentkit/agentkit_test.goTestHandoffMD_StructuralHardeningwith 5 assertionsopenspec/changes/harden-handoff-dcp/proposal.mdopenspec/changes/harden-handoff-dcp/design.mdopenspec/changes/harden-handoff-dcp/specs/*.mdopenspec/changes/harden-handoff-dcp/tasks.mdThis PR was generated by /uf.finale (AI-assisted).