Skip to content

fix: harden forge command prompt against DCP context compression - #55

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

fix: harden forge command prompt against DCP context compression#55
jflowers wants to merge 1 commit into
unbound-force:mainfrom
jflowers:opsx/forge-dcp-hardening

Conversation

@jflowers

@jflowers jflowers commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Restructures the /forge command prompt (internal/agentkit/content/commands/forge.md) to survive DCP context compression, fixing the quality gate vulnerability where the review-before-complete ordering constraint was lost under compression.

Addresses all four fragilities identified in #47:

  1. Review-before-complete ordering embedded with explicit constraint language
  2. Critical review rule moved from 5th to 1st position
  3. Error Recovery section inlined at point of use
  4. Strategy Selection section inlined at point of use

Additionally documents the skip_review: true API bypass discovered during spec review and adds a prohibition to the Critical Invariants section.

How to Test

# Build succeeds (forge.md is embedded content)
make build

# All tests pass (no behavioral changes)
make test

# Verify all 17 MCP tool references preserved
grep -c 'forge_review\|forge_complete\|comms_inbox\|forge_status' \
  internal/agentkit/content/commands/forge.md

# Verify review constraint in 3 redundant locations
grep -n 'review.*before.*complete\|MUST finish before step 8\|NEVER skip' \
  internal/agentkit/content/commands/forge.md

How to Demo

Read internal/agentkit/content/commands/forge.md and verify the restructured prompt:

  • Critical Invariants section appears before Workflow
  • Step 7 includes "MUST finish before step 8"
  • First rule in Rules section is the review-before-complete rule
  • No standalone Strategy Selection, Error Recovery, or Completion sections remain

Key Files Changed

File Change
internal/agentkit/content/commands/forge.md Restructured for DCP compression resilience (+22/-39 lines)
openspec/changes/forge-dcp-hardening/proposal.md Change proposal with constitution alignment
openspec/changes/forge-dcp-hardening/design.md 6 design decisions with risk analysis
openspec/changes/forge-dcp-hardening/specs/forge-prompt-structure.md Delta spec with Given/When/Then scenarios
openspec/changes/forge-dcp-hardening/tasks.md Implementation tasks (all complete)

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

@jflowers
jflowers requested a review from a team as a code owner August 2, 2026 19:06
@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
Restructure forge.md to prevent the review-before-complete
quality gate from being lost under context compression:

- Add Critical Invariants section at top of file
- Embed ordering constraint directly in step 7 text
- Move review rule to 1st position in Rules section
- Inline strategy selection into decompose step
- Inline error recovery into monitoring step
- Merge Completion section into step 8 sub-items
- Add skip_review prohibition to invariants

All original content preserved (17 MCP tool references
verified). No behavioral changes to the forge workflow.

Closes unbound-force#47

Assisted-by: claude-opus-4-6
Generated with AI assistance (claude-opus-4-6)
@yvonnedevlinrh
yvonnedevlinrh force-pushed the opsx/forge-dcp-hardening branch from 643e740 to b389f4b Compare August 4, 2026 16:12
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.

1 participant