DIDP Compliance Mitigation
Protocol Version: DIDP v2.1
Status: Active
Category: Doctrine
Purpose
This document defines deterministic mitigation and prevention rules for DIDP workflow violations. These rules are:
- Generic — Not tied to any specific executor or agent system
- Mechanical — Enforceable without human interpretation
- Reusable — Applicable to any DIDP-compliant system
Violation Types
| Type | Meaning |
|---|---|
out_of_iteration | Work occurred without an active iteration |
out_of_phase_action | Work executed after terminal phase |
phase_skip | Required phase was skipped |
incomplete_cleanup | Temporary or draft artifacts remain |
1. Mitigation Actions
1.1 out_of_iteration
Corrective Actions:
-
Create
iteration_state.yamlretroactively with:iteration_id: Generated from date + sequencecreated: Timestamp of first work artifactphase.name: Set to phase where work was discovered
-
Attach prior work as retrospective documentation:
retrospective: pre_iteration_work: true artifacts_created_before_iteration: - <list of files/commits> note: "Work performed before iteration created. Non-authoritative until validated." -
Log deviation to
deviations.logwith:- Date
- Identifier:
NO-ITER - Description of work performed
- Resolution taken
-
Continue iteration from current state (do not restart work)
1.2 out_of_phase_action
Corrective Actions:
-
Identify the terminal phase at which violation occurred
-
Determine if action was:
- Substantive (new content, spec changes) → Requires new iteration
- Mechanical (deployment, cleanup) → May be absorbed with deviation log
-
If substantive:
- Abort current state
- Create new iteration for remaining work
- Reference prior iteration in
handoff_notes
-
If mechanical:
- Log deviation
- Document action in iteration’s
outcomesection - Propose amendment to exit criteria
1.3 phase_skip
Corrective Actions:
-
Identify skipped phase(s) in the required sequence:
planning → analysis → spec_lock → implementation → testing → archive → merge → complete -
Execute skipped phase retroactively:
- Create phase artifacts that would have been produced
- Mark exit criteria as satisfied (or document why N/A)
-
Block
mergeuntil all prior phases complete -
Update
iteration_state.yaml:phase_history: - name: <skipped_phase> entered: <retroactive_timestamp> exit_criteria_met: true note: "Executed retroactively after phase_skip deviation"
1.4 incomplete_cleanup
Corrective Actions:
-
Identify orphaned artifacts:
- Draft files in
pending/,drafts/, or temporary locations - Uncommitted changes
- Stale branch references
- Draft files in
-
For each artifact, determine disposition:
- Archive: Move to
archive/with timestamp - Delete: Remove if no longer needed
- Promote: If draft should be published, create iteration
- Archive: Move to
-
Verify cleanup complete before marking iteration
complete -
Document cleanup actions in iteration
outcome:outcome: cleanup_performed: - action: deleted path: pending/drafts/old-spec.md - action: archived path: archive/2025-12-26-orphan.md
2. Prevention Gates
2.1 GATE-001: out_of_iteration
Enforcement Phase: Before any work begins (pre-planning)
| Requirement | Level | Description |
|---|---|---|
| Iteration exists | MUST | iteration_state.yaml MUST exist with valid iteration_id before any work |
| Branch created | MUST | Iteration branch MUST be checked out before file modifications |
| Phase defined | MUST | phase.name MUST be set before work proceeds |
On Failure:
- ABORT: No work permitted
- ACTION: Create iteration first
Exemption (FTL-014):
Trivial work MAY bypass iteration ceremony if ALL conditions are met:
- Human explicitly approves BEFORE work begins
- No new content pages (specs, docs)
- No spec changes
- Configuration/tooling only
- < 5 files modified
When exemption applies, log to maintenance.log:
[DATE] APPROVED-TRIVIAL | description | human approval note
2.2 GATE-002: out_of_phase_action
Enforcement Phase: All phases (continuous)
| Requirement | Level | Description |
|---|---|---|
| Terminal phase immutable | MUST | phase: complete is terminal; no further work on that iteration |
| Work matches phase | MUST | Actions MUST be permitted by current phase constraints |
| Deployment before complete | SHOULD | Deployment SHOULD occur during archive or merge, not after complete |
On Failure:
- BLOCK TRANSITION: Cannot advance to next phase
- ACTION: Require new iteration for additional work
Phase Immutability:
| Phase | Mutable | Permitted Actions |
|---|---|---|
| planning | Yes | Scope changes, exploration |
| analysis | Yes | Validation, clarification |
| spec_lock | Yes | Finalization only |
| implementation | Yes | Code, docs per spec |
| testing | Yes | Defect fixes only |
| archive | Yes | Cleanup, versioning |
| merge | Yes | Merge to target branch |
| complete | No | None (terminal) |
2.3 GATE-003: phase_skip
Enforcement Phase: archive → merge transition
| Requirement | Level | Description |
|---|---|---|
| Linear progression | MUST | Phases MUST advance in defined order |
| Exit criteria satisfied | MUST | All exit criteria for current phase MUST be met before transition |
| No phase omission | MUST | Every phase MUST be entered and exited |
On Failure:
- BLOCK MERGE: Cannot merge to target branch
- ACTION: Execute skipped phase(s) before proceeding
Legal Transitions:
planning ──► analysis ──► spec_lock ──► implementation ──► testing ──► archive ──► merge ──► complete
│ │
▼ ▼
(replan) planning
(if replan_required)
Back-transitions:
- ONLY
analysis → planningis permitted (whenreplan_required: true) - All other back-transitions are FORBIDDEN
2.4 GATE-004: incomplete_cleanup
Enforcement Phase: archive (before merge)
| Requirement | Level | Description |
|---|---|---|
| No orphaned drafts | MUST | pending/, drafts/ directories MUST be empty or archived |
| No uncommitted changes | MUST | Working directory MUST be clean |
| Temporary files removed | SHOULD | Build artifacts, cache files SHOULD be excluded |
| Version source updated | MUST | Canonical version MUST reflect release |
On Failure:
- BLOCK TRANSITION: Cannot advance from
archivetomerge - ACTION: Complete cleanup before proceeding
Cleanup Checklist:
[ ] Draft directories empty (pending/, drafts/)
[ ] No TODO markers in published content
[ ] Version source updated (VERSION, package.json, or tag)
[ ] Changelog entry added (if required)
[ ] Build artifacts excluded from commit
[ ] Working directory clean (git status)
Summary
| Violation Type | Gate ID | Enforcement Phase | On Failure |
|---|---|---|---|
| out_of_iteration | GATE-001 | pre-planning | Abort |
| out_of_phase_action | GATE-002 | all phases | Block transition |
| phase_skip | GATE-003 | archive → merge | Block merge |
| incomplete_cleanup | GATE-004 | archive | Block transition |
Protocol Invariant
These gates are deterministic and mechanically enforceable. Any DIDP-compliant system MUST implement equivalent checks at the specified enforcement phases.
Related
- Workflow Contract — Agent constitution
- Phase Model — Phase state machine
- Foundation Task Ledger — FTL-014 (Trivial Work Exemption)