@deftai/directive-content 0.103.0 → 0.105.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/Taskfile.yml +13 -6
  2. package/UPGRADING.md +4 -0
  3. package/coding/coding.md +2 -2
  4. package/commands.md +28 -8
  5. package/docs/directive-lifecycle.md +12 -4
  6. package/docs/project-invariants.md +79 -0
  7. package/docs/scope-provenance.md +53 -8
  8. package/docs/writing-ste100.md +38 -4
  9. package/main.md +2 -0
  10. package/meta/ralph.md +1 -1
  11. package/package.json +1 -1
  12. package/packs/rules/rules-pack-0.1.json +3 -3
  13. package/packs/skills/skills-pack-0.1.json +15 -9
  14. package/scm/github.md +34 -1
  15. package/skills/deft-directive-build/SKILL.md +26 -1
  16. package/skills/deft-directive-gh-slice/SKILL.md +2 -2
  17. package/skills/deft-directive-refinement/SKILL.md +8 -6
  18. package/skills/deft-directive-review-cycle/SKILL.md +37 -11
  19. package/skills/deft-directive-setup/SKILL.md +2 -0
  20. package/skills/deft-directive-swarm/SKILL.md +21 -5
  21. package/skills/deft-directive-swarm/references/core-ops.md +3 -1
  22. package/skills/deft-directive-swarm/references/core-phase-0.md +1 -0
  23. package/skills/deft-directive-swarm/references/core-phase-3.md +1 -1
  24. package/skills/deft-directive-swarm/references/core-phase-4.md +27 -11
  25. package/skills/deft-directive-swarm/references/core-phase-5-6.md +4 -1
  26. package/skills/deft-directive-sync/SKILL.md +9 -11
  27. package/tasks/engine.yml +2 -0
  28. package/tasks/occupancy.yml +17 -0
  29. package/tasks/scm.yml +13 -7
  30. package/tasks/vbrief.yml +3 -2
  31. package/tasks/verify.yml +32 -2
  32. package/tasks/xbrief.yml +43 -0
  33. package/templates/agent-prompt-preamble.md +22 -3
  34. package/templates/agents-entry.md +9 -2
  35. package/vbrief/schemas/vbrief-core.schema.json +72 -0
@@ -0,0 +1,17 @@
1
+ version: '3'
2
+
3
+ # tasks/occupancy.yml -- worktree occupancy lease (#3433).
4
+
5
+ vars:
6
+ DEFT_ROOT: '{{joinPath .TASKFILE_DIR ".."}}'
7
+
8
+ tasks:
9
+ steal:
10
+ desc: "Supersede a live worktree occupancy lease (#3433). Flags: --confirm --occupant <id>"
11
+ dir: '{{.USER_WORKING_DIR}}'
12
+ env:
13
+ PYTHONUTF8: "1"
14
+ cmds:
15
+ - task: :engine:invoke
16
+ vars:
17
+ ENGINE_CMD: 'occupancy:steal --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
package/tasks/scm.yml CHANGED
@@ -33,13 +33,9 @@ version: '3'
33
33
  # surfaces (--body-file, --add-label, --remove-label, ...) that this
34
34
  # stub deliberately does not re-implement; #881 owns the full surface.
35
35
  #
36
- # Forward-compat marker: the ONLY scm:* surface in v1 is the four issue:*
37
- # commands above plus the #1555 body-posting safety wrapper. PR commands
38
- # (scm:pr:list/view/merge/close) and any additional scm:* surface are
39
- # EXPLICITLY deferred to #881; do not add them here. See
40
- # vbrief/active/2026-05-05-883-story-1-scm-stub.vbrief.json for the full
41
- # Story 1 scope and vbrief/active/2026-05-05-883-deft-cache-quarantine-v1.vbrief.json
42
- # for the epic chain context.
36
+ # Forward-compat marker: v1 was issue:* plus #1555 body-posting. #3391
37
+ # adds scm:sync-default (dest-targeted staged sync PRs). Other PR verbs
38
+ # remain #881.
43
39
  # ---------------------------------------------------------------------------
44
40
 
45
41
  vars:
@@ -163,6 +159,16 @@ tasks:
163
159
  vars:
164
160
  ENGINE_CMD: 'github-body comment-edit {{.CLI_ARGS}}'
165
161
 
162
+ sync-default:
163
+ desc: "[#3391] Open dest-targeted sync PRs under syncMaxFiles -- new PR per staged leg"
164
+ dir: '{{.USER_WORKING_DIR}}'
165
+ deps:
166
+ - task: :engine:_ts-build
167
+ cmds:
168
+ - task: :engine:invoke
169
+ vars:
170
+ ENGINE_CMD: 'scm:sync-default {{.CLI_ARGS}}'
171
+
166
172
  body:pr:edit:
167
173
  desc: "[#1555] Safely edit a PR body from --body-file and live gh read-back"
168
174
  dir: '{{.USER_WORKING_DIR}}'
package/tasks/vbrief.yml CHANGED
@@ -142,8 +142,9 @@ tasks:
142
142
  ENGINE_CMD: 'vbrief-reconcile labels --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
143
143
 
144
144
  reconcile:umbrellas:
145
- # Umbrella current-shape auto-update (#1289). Walks every kind=epic
146
- # vBRIEF, resolves its children from its x-vbrief/plan references,
145
+ # Umbrella current-shape auto-update (#1289 / #3428). Walks every
146
+ # kind=epic vBRIEF and slices.jsonl umbrellas. Epic children come from
147
+ # x-vbrief/plan / github-issue refs; slices rows already list children.
147
148
  # computes the wave structure from the children's swarm.depends_on[]
148
149
  # edges, builds the canonical AGENTS.md section-1152 current-shape body
149
150
  # (Last updated / Last pass type / Child count / Child-count history /
package/tasks/verify.yml CHANGED
@@ -47,6 +47,16 @@ tasks:
47
47
  vars:
48
48
  ENGINE_CMD: 'verify-biome-config --project-root "{{.DEFT_ROOT}}"'
49
49
 
50
+ telemetry-coverage:
51
+ desc: "Dead-surface detector for run-summary event kinds (#3362). Every RUN_SUMMARY_EVENT_KINDS member needs a production caller and a field-shaped fixture. Default is warn-only; pass --enforce to fail closed. -- task verify:telemetry-coverage [-- --enforce]"
52
+ deps:
53
+ - task: :engine:_ts-build
54
+ # Framework-source-only gate: scans THIS repo's packages/core/src emitters.
55
+ cmds:
56
+ - task: :engine:invoke
57
+ vars:
58
+ ENGINE_CMD: 'verify-telemetry-coverage --project-root "{{.DEFT_ROOT}}" {{.CLI_ARGS}}'
59
+
50
60
  contained-writes:
51
61
  desc: "Inventory raw product write sinks outside the contained-write allowlist (#2951 / #2980). Default CLI remains fail-open; task check wires --enforce fail-closed. -- task verify:contained-writes [-- --enforce]"
52
62
  deps:
@@ -155,6 +165,26 @@ tasks:
155
165
  vars:
156
166
  ENGINE_CMD: 'verify:branch --project-root "{{.USER_WORKING_DIR}}" --allow-missing-project-definition'
157
167
 
168
+ gh-auth:
169
+ # Worker-envelope GitHub auth validation (#1557). Thin task wrapper over the
170
+ # existing `github-auth-modes` engine verb, added by #3483: the swarm skill
171
+ # named `task verify:gh-auth` at MUST/⊗ level (references/core-phase-3.md
172
+ # Step 3, references/core-ops.md) but only the engine verb ever shipped, so
173
+ # the documented invocation exited 200 ("task does not exist").
174
+ #
175
+ # NOTE: NO `sources:` / `generates:` per conventions/task-caching.md --
176
+ # this probes live process/network state through {{.CLI_ARGS}} flags and a
177
+ # cached skip would return a stale verdict.
178
+ desc: "Validate GitHub auth from the worker envelope (#1557): host-gh vs injected-token mode, gh auth status, and API reachability. Fails closed on missing_injected_token in cloud-headless. -- task verify:gh-auth [-- --json] [--repo OWNER/NAME] [--github-auth-mode host-gh|injected-token]"
179
+ dir: '{{.USER_WORKING_DIR}}'
180
+ deps:
181
+ - task: :engine:_ts-build
182
+ cmds:
183
+ # Bare CLI_ARGS per the verify:encoding convention -- go-task shell-escapes pass-through args.
184
+ - task: :engine:invoke
185
+ vars:
186
+ ENGINE_CMD: 'github-auth-modes {{.CLI_ARGS}}'
187
+
158
188
  routing:
159
189
  desc: "Operator coding sub-agent model routing gate (#1739). Pre-dispatch (default): fails when a dispatched worker role has no decision in .deft/routing.local.json. Pass --advise for the non-blocking session-start disclosure; --roles a,b to widen the gated set; --provider to override the runtime."
160
190
  dir: '{{.USER_WORKING_DIR}}'
@@ -463,7 +493,7 @@ tasks:
463
493
  ENGINE_CMD: 'verify:wip-cap --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
464
494
 
465
495
  orphan-active:
466
- desc: "Fail-closed orphan-active guard (#2321). Detects xbrief/active/ briefs with plan.status==running whose referenced GitHub issues are all closed and/or whose linked PR is merged — the stop-at:pr-open lifecycle leak. Remediation points at task scope:complete / scope:cancel or swarm finalize surfaces. Three-state exit (0 clean / 1 orphan / 2 config). Pass --skip-gh to rely on triage cache only."
496
+ desc: "Fail-closed orphan-active guard (#2321 / #3429). Detects xbrief/active/ briefs with plan.status==running whose referenced GitHub issues are all closed and/or whose linked PR is merged — the stop-at:pr-open lifecycle leak. Confirmed shipped remediates with task scope:complete / scope:cancel or swarm finalize. Unresolved GitHub lookup still exits 1 but prints a retry, not scope:complete. Three-state exit (0 clean / 1 orphan / 2 config). Pass --issue N to scan one origin after merge; --skip-gh to rely on triage cache only."
467
497
  dir: '{{.USER_WORKING_DIR}}'
468
498
  deps:
469
499
  - task: :engine:_ts-build
@@ -473,7 +503,7 @@ tasks:
473
503
  ENGINE_CMD: 'verify:orphan-active --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
474
504
 
475
505
  completed-tracked:
476
- desc: "Fail-closed completed-tracked land guard (#3264 / #1358 recurrence). Closed scoped GitHub issues with a known lifecycle xBRIEF origin must have a tracked xbrief/completed/ or xbrief/cancelled/ artifact on the delivery tip. Remediation: task swarm:finalize-cohort or a lifecycle PR. Three-state exit (0 clean / 1 missing land / 2 config). Pass --skip-gh to rely on triage cache only; --tip to override delivery tip."
506
+ desc: "Fail-closed completed-tracked land guard (#3264 / #1358 / #3476). Closed scoped GitHub issues with a known lifecycle xBRIEF origin must have a tracked xbrief/completed/ or xbrief/cancelled/ artifact on the delivery tip. --issue N is the drive-to DONE form. Remediation: task swarm:finalize-cohort or a lifecycle PR. Three-state exit (0 clean / 1 missing land / 2 config). Pass --skip-gh to rely on triage cache only; --tip to override delivery tip."
477
507
  dir: '{{.USER_WORKING_DIR}}'
478
508
  deps:
479
509
  - task: :engine:_ts-build
package/tasks/xbrief.yml CHANGED
@@ -5,6 +5,29 @@ vars:
5
5
 
6
6
  tasks:
7
7
 
8
+ validate:
9
+ # Canonical xBRIEF lifecycle validation verb (#3483).
10
+ # Mirrors tasks/vbrief.yml validate exactly; callers use:
11
+ # task xbrief:validate
12
+ # Legacy `task vbrief:validate` remains accepted for the same gate and is
13
+ # what CONSUMER_CHECK_GATES / `task check` still wire (gate ids are stable).
14
+ #
15
+ # The #2109 vbrief -> xbrief rename added xbrief:-prefixed verbs where the
16
+ # surface was rewritten (xbrief:preflight), but validate never got its
17
+ # alias while the swarm skill prose was updated as if it had -- leaving
18
+ # four MUST/⊗-level cohort-close instructions naming a verb that did not
19
+ # resolve. Refs #1487 (the recurrence the cohort-close gate prevents).
20
+ desc: "Validate xBRIEF lifecycle folder structure and cross-file consistency. Alias of vbrief:validate with xbrief-first naming (#3483)."
21
+ dir: '{{.USER_WORKING_DIR}}'
22
+ deps:
23
+ - task: :engine:_ts-build
24
+ cmds:
25
+ # Layout-aware (#2109 part 2a): pass --project-root and let the engine
26
+ # resolve the lifecycle dir (xbrief when migrated, else vbrief).
27
+ - task: :engine:invoke
28
+ vars:
29
+ ENGINE_CMD: 'xbrief:validate --project-root "{{.USER_WORKING_DIR}}"'
30
+
8
31
  preflight:
9
32
  # Canonical #810 implementation-intent gate for the xBRIEF lifecycle (#2449).
10
33
  # Mirrors tasks/vbrief.yml preflight; callers use:
@@ -18,3 +41,23 @@ tasks:
18
41
  - task: :engine:invoke
19
42
  vars:
20
43
  ENGINE_CMD: 'xbrief:preflight --vbrief-path {{.CLI_ARGS}}'
44
+
45
+ activate:
46
+ # Implementation-intent activation companion to xbrief:preflight (#3483).
47
+ # Mirrors tasks/vbrief.yml activate; callers use:
48
+ # task xbrief:activate -- xbrief/pending/<story>.xbrief.json
49
+ # This is the redirect the preflight failure message names, and the swarm
50
+ # skill names it at MUST level (references/core-phase-0.md Step 1) -- so it
51
+ # has to resolve under the xbrief: spelling, not just vbrief:.
52
+ #
53
+ # NOTE: NO `sources:` / `generates:` per conventions/task-caching.md --
54
+ # the xBRIEF path is a user-facing {{.CLI_ARGS}} argument and a cached
55
+ # skip would silently swallow it.
56
+ desc: "Activate an xBRIEF: pending/ -> active/ (status: running). Idempotent. Alias of vbrief:activate with xbrief-first naming (#810 / #3483)."
57
+ dir: '{{.USER_WORKING_DIR}}'
58
+ deps:
59
+ - task: :engine:_ts-build
60
+ cmds:
61
+ - task: :engine:invoke
62
+ vars:
63
+ ENGINE_CMD: 'xbrief:activate {{.CLI_ARGS}}'
@@ -418,6 +418,15 @@ Decision tree:
418
418
 
419
419
  The probe itself is a `core`-bucket call, so polling it cheaply does not consume GraphQL.
420
420
 
421
+ ## 7.5 Forge-outage drop-back (#3422)
422
+
423
+ #3167 caps CI-holdout babysit loops. #3180 attributes weather holds. Neither replaces this drop-back.
424
+
425
+ ! On attributed platform outage (`attribution: platform`) or repeated REST 429/502/503: **drop back** GitHub I/O (empty-commit, close/reopen, tight polls, new poller children), **report once** to the human in chat (what is down, attribution/incident, parked work, next probe time), and **re-probe once per** `plan.policy.forgeOutageRetryMinutes` (default **30**; USER.md Personal wins; min 5; `task policy:show --field=forgeOutageRetryMinutes`). Local work that does not need the forge MAY continue. Depth: `content/scm/github.md` § #3180 / #3422.
426
+
427
+ ⊗ Tight retry, empty-commit thrash, or sending the human to github.com as the only remediation.
428
+ ⊗ Auto-merge / `--skip-ci` because a status page is red (#3180).
429
+
421
430
  ## 8. Identity separation -- mode-aware GitHub credential rules (#983 / #1557)
422
431
 
423
432
  Workers MUST follow the GitHub credential rule recorded in the dispatch envelope's `github_auth_mode` field (§2.7) or launch manifest. The rule prevents maintainer/worker bucket coupling and audit conflation when modes are mixed across a cohort.
@@ -464,11 +473,11 @@ These rules bind **orchestrators** dispatching implementation, fix, or review-cy
464
473
  - ! **Envelope selection SLA (#3153):** Choose the boundary before spawn using the swarm decision tree (`skills/deft-directive-swarm/references/core-phase-0.md` — capacity stall, conf-only residual, wall-clock budget, large multi-gate, host nest limits). Happy-path default remains `drive-to: merge-ready`. A **deliberate** `stop-at: pr-open` is valid only with an immediate partner merge-path owner per `skills/deft-directive-review-cycle/SKILL.md` § Partner merge-path (babysit / Approach 1 lease / parent-retained — not freestyle global babysit). Under human-merge policy, that owner (or an explicit handoff recipient) remains responsible through merge + `scope:complete` — do not stand down at CLEAN alone. Consumer pin: `templates/agents-entry.md` § Envelope selection SLA. Silent PR-open handback for a worker already scoped merge-ready remains **forbidden**.
465
474
  - ! **Cursor Task ownership split (#2797 / #2814):** A Cursor `Task` implementation leaf MUST NOT spawn another Cursor `Task` review-monitor: nested Task (leaf spawning leaf) is unsupported/unreliable. A Cursor `drive-to: merge-ready` leaf instead owns a blocking `task pr:watch -- <N>` in its own process. To use an Approach 1 monitor, scope the leaf `stop-at: pr-open`; the orchestrator that owns the Task primitive then launches the sibling monitor and runs `task review-monitor:register -- --pr <N> --monitor-agent-id <id> --platform-primitive cursor-task` (GitHub sticky `<!-- deft:review-owner -->` lease — not local JSON).
466
475
  - ⊗ Let a Cursor leaf background `task pr:watch` and claim review monitoring is active. The process dies with the leaf and has no GitHub review-owner lease; treat that claim as a regression/eval failure and let `task verify:review-monitor -- --pr <N>` fail closed.
467
- - ! **Post-merge scope lifecycle (#2321 / Gap C):** Workers scoped `stop-at: pr-open` MUST NOT run `task scope:complete` before exit — their activation checkpoint rides into master on merge. The **orchestrator** (or Phase 6 `task swarm:finalize-cohort` / `task swarm:complete-cohort` on the headless path) MUST run `task scope:complete` or `task scope:cancel` for each shipped story xBRIEF after its PR merges. Workers scoped `drive-to: merge-ready` (or `drive-to: merge`) MUST include `task scope:complete` on their active xBRIEF as part of the same unit of work (after merge when appropriate).
476
+ - ! **Post-merge scope lifecycle (#2321 / Gap C / #3429 / #3476):** Workers scoped `stop-at: pr-open` MUST NOT run `task scope:complete` before exit — their activation checkpoint rides into master on merge. The **orchestrator** (or Phase 6 `task swarm:finalize-cohort` / `task swarm:complete-cohort` on the headless path) MUST run `task scope:complete` or `task scope:cancel` for each shipped story xBRIEF after its PR merges. Workers scoped `drive-to: merge-ready` (or `drive-to: merge`) MUST include `task scope:complete` on their active xBRIEF as part of the same unit of work (after merge when appropriate). After merge (or observing merge) of issue `#N`, run `task verify:orphan-active -- --issue N`. Exit `0` is required before `DONE`. Exit `1` shipped → run the printed `task scope:complete -- <path>`. Exit `1` unresolved lookup → retry / emit `BLOCKED`; ⊗ complete unfinished scope. After `scope:complete`, `task verify:completed-tracked -- --issue N` MUST be exit `0` against `origin/<deliveryBranch>` (not feature-worktree HEAD) before `DONE` (#3476). Exit `1` missing tracked artifact → not DONE; remediate with `task swarm:finalize-cohort` or a lifecycle PR. `scope:complete` stays filesystem-only — ⊗ teach every leaf to commit on master.
468
477
  - ! Workers scoped `drive-to: merge-ready` MUST drive to merge-ready in their own tool loop — pre-PR, push, PR open, review-cycle poll/fix loop, and the #1259 Step 6 fail-closed exit — without handing back at PR-open for the orchestrator to re-dispatch separate leaf agents for review or fixes.
469
478
  - ⊗ Re-dispatch a separate review-monitor or fix agent after an implementation worker exits at PR-open when the original envelope scoped `drive-to: merge-ready` — that split recreates cross-agent state-handoff hazards and terminal lifecycle gaps (#1878 / Gap C).
470
479
  - ⊗ Dispatch `stop-at: pr-open` without a named review-cycle partner merge-path owner plan (#3153).
471
- - ⊗ Leave an `xbrief/active/` brief with `plan.status == running` on master after the story's issue is closed or its PR merged — `task verify:orphan-active` fails closed on that signature (#2321).
480
+ - ⊗ Leave an `xbrief/active/` brief with `plan.status == running` on master after the story's issue is closed or its PR merged, or emit `DONE` with `ISSUE: closed` while that brief remains in `active/` — `task verify:orphan-active -- --issue N` must be exit `0` after merge (#2321 / #3429).
472
481
 
473
482
  **Background / independent dispatch (Gap D):**
474
483
 
@@ -535,6 +544,16 @@ The parent monitor watches the heartbeat file directly (three-state exit 0 ok /
535
544
  Principle: `main.md` `## Rule Authority [AXIOM]`.
536
545
  Principle: `main.md` `## Thin Fail-Closed Design (#3265)`.
537
546
 
547
+ ## 10.56 Writing bar — clarity, simplicity, brevity (#3368)
548
+
549
+ ! Clarity, simplicity, brevity in documents and user communications, including sub-agent status and handbacks. Cut ceremony, not required fields. Depth: `.deft/core/docs/writing-ste100.md` (#2927 / #3368). ⊗ Full STE; ⊗ historical rewrite; ⊗ red CI style gate; ⊗ prefacing the rule.
550
+
551
+ ## 10.57 Telemetry deliverable fixture (#3362)
552
+
553
+ ! A telemetry deliverable is not done until a field-shaped fixture reads its events from the shared fake trial (`task verify:telemetry-coverage`). Silence is the failure mode this gate exists for.
554
+
555
+ ⊗ Ship a new `RUN_SUMMARY_EVENT_KINDS` member or exported emitter method without a production caller and a fixture that asserts the kind in `DEFT_RUN_SUMMARY_PATH` JSONL.
556
+
538
557
  ## 10.6 Dual stop for multi-iteration worker loops (#2442)
539
558
 
540
559
  Multi-iteration implement, pre-PR, repair, and monitor loops require **two** stops: **success** (goal / AC / checker met) and **failure or budget** (max iterations, no-progress, or time/token budget). Single-turn tasks are exempt. Principle and defaults: `main.md` `## Dual Stop Rule (#2442)`; build skill dual-stop table; swarm Phase 4 / core-ops.
@@ -552,7 +571,7 @@ Every worker MUST send a final status message before exiting its tool loop, rega
552
571
  - Failure: `FAILED: <reason> + recovery hint`
553
572
  - Stand-down: `STOOD-DOWN: <reason>` (e.g. user said "wait" with no follow-up dispatch)
554
573
 
555
- ! **`drive-to: merge-ready` DONE reservation (#2843):** When the dispatch envelope scoped `drive-to: merge-ready` (or `drive-to: merge`), `DONE` is reserved for merge-ready completion — `task pr:merge-ready -- <N>` exit 0 on current HEAD, or merge + `task scope:complete` when the envelope included merge authority. Greptile P0/P1 outstanding, CI failure, branch behind, review-cycle cap, or any other merge blocker MUST NOT exit as `DONE`.
574
+ ! **`drive-to: merge-ready` DONE reservation (#2843):** When the dispatch envelope scoped `drive-to: merge-ready` (or `drive-to: merge`), `DONE` is reserved for merge-ready completion — `task pr:merge-ready -- <N>` exit 0 on current HEAD, or merge + `task scope:complete` when the envelope included merge authority. After merge, `task verify:orphan-active -- --issue <N>` MUST be exit 0 before `DONE` (#3429). Exit 1 shipped → run the printed `task scope:complete -- <path>`. Exit 1 unresolved lookup → retry / emit `BLOCKED`; ⊗ complete unfinished scope. After `scope:complete`, `task verify:completed-tracked -- --issue <N>` MUST be exit 0 against `origin/<deliveryBranch>` (not feature-worktree HEAD) before `DONE` (#3476). Exit 1 missing tracked artifact → not DONE; remediate with `task swarm:finalize-cohort` or a lifecycle PR. Untracked laptop `xbrief/completed/` is not land. Greptile P0/P1 outstanding, CI failure, branch behind, review-cycle cap, or any other merge blocker MUST NOT exit as `DONE`.
556
575
 
557
576
  ! **Mid-cycle BLOCKED contract (#2843):** A `drive-to: merge-ready` worker that must exit before merge-ready (blocker, cap, context limit, host turn budget) MUST emit `BLOCKED:` (never `DONE`) with: PR number (or `no-pr`), HEAD SHA, blocker class (`greptile_p0_p1` / `ci_failures` / `behind_base` / `review_cycle_cap` / `context_limit` / other), worktree path, and `REDISPATCH_OK` when a continuation leaf should take over. Example: `BLOCKED: Greptile P1 on HEAD abc1234 (PR #2842, blocker greptile_p0_p1, worktree .deft-scratch/worktrees/2839-appsec, REDISPATCH_OK)`.
558
577
 
@@ -12,11 +12,11 @@ Deft is installed in .deft/core/. Full guidelines: .deft/core/main.md
12
12
 
13
13
  ## Session routing (#2176)
14
14
 
15
- ! **Read-only default** until mutation intent: load AGENTS.md / main.md / USER.md / `xbrief/PROJECT-DEFINITION.xbrief.json`; resolve USER.md via `deft session:start` (`USER.md resolved …`; win32 `%APPDATA%\deft\USER.md`; unix `~/.config/deft/USER.md`; ⊗ invent `~/.config/deft` on Windows #2544); confirm Deft alignment + addressing-name; ⊗ no mutable `deft session:start` / triage welcome / sync / branch-policy unless asked or implementation-ready (#2176) — `.deft/core/commands.md` § Session routing. Bootstrap: cold-start → README § Cold-start (#2273) ⊗ never `.deft/core/`; pre-cutover → setup Pre-Cutover (#2068); missing USER.md / PROJECT-DEFINITION → setup Phase 1/2 (#1813) ⊗ before answering; else main → USER → PROJECT-DEFINITION; ~ sync. Mutation → `deft session:start` then `deft verify:session-ritual -- --tier=gated` (#1149). ? `deft session:start -- --read-only` (#2176).
15
+ ! **Read-only default** until mutation intent: load AGENTS.md / main.md / USER.md / `xbrief/PROJECT-DEFINITION.xbrief.json`; resolve USER.md via `deft session:start` (`USER.md resolved …`; win32 `%APPDATA%\deft\USER.md`; unix `~/.config/deft/USER.md`; ⊗ invent `~/.config/deft` on Windows #2544); confirm Deft alignment + addressing-name; ⊗ no mutable `deft session:start` / triage welcome / sync / branch-policy unless asked or implementation-ready (#2176) — `.deft/core/commands.md` § Session routing. Bootstrap: cold-start → README § Cold-start (#2273) ⊗ never `.deft/core/`; pre-cutover → setup Pre-Cutover (#2068); missing USER.md / PROJECT-DEFINITION → setup Phase 1/2 (#1813) ⊗ before answering; else main → USER → PROJECT-DEFINITION; ~ sync. Mutation → `deft session:start` then `deft verify:session-ritual -- --tier=gated` (#1149). Mutation ceremony claims a worktree occupancy lease (#3433; `commands.md` § Session routing). ? `deft session:start -- --read-only` (#2176).
16
16
 
17
17
  ## Session-start ritual (#1149)
18
18
 
19
- ! On **mutation** session start, run `deft session:start`; before code-writing or `start_agent` dispatch run `deft verify:session-ritual -- --tier=gated` (stale after `plan.policy.sessionRitualStalenessHours`; records `deft verify:tools` / `deft doctor` / `deft verify:cache-fresh` / `deft agents:refresh` / `npm i -g @deftai/directive@latest`; #1149 / #1348) — `.deft/core/commands.md` § Session-start ritual. ! SCM mirror tip (#3124): restate existence + get-the-most user-visible when tip fires (depth `commands.md`). ⊗ Absorb tip without restating.
19
+ ! On **mutation** session start, run `deft session:start`; before code-writing or `start_agent` dispatch run `deft verify:session-ritual -- --tier=gated` (stale after `plan.policy.sessionRitualStalenessHours`; records `deft verify:tools` / `deft doctor` / `deft verify:cache-fresh` / `deft agents:refresh` / `npm i -g @deftai/directive@latest`; #1149 / #1348) — `.deft/core/commands.md` § Session-start ritual. Recovery: `deft session:ready` (one-shot: start + gated ritual + cache recovery; #2993). ! SCM mirror tip (#3124): restate existence + get-the-most user-visible when tip fires (depth `commands.md`). ⊗ Absorb tip without restating.
20
20
 
21
21
  ## WIP cap
22
22
 
@@ -25,6 +25,8 @@ Deft is installed in .deft/core/. Full guidelines: .deft/core/main.md
25
25
  ## xBRIEF layout (#2034 / #2110)
26
26
 
27
27
  Legacy `vbrief/` read-accepted; `deft migrate:xbrief` for `xbrief/` (v0.6→v0.8). `x-vbrief/` tokens read-accepted until migrated.
28
+ ! Completed xBRIEFs are record of *what is*, zero authority over *what to build next* (#3383). Current contract = active xBRIEF + human operator live instruction. Depth: `main.md` Persistence; build skill declare-the-contract / halt-and-ask.
29
+ ⊗ Treat a completed xBRIEF as the next-build contract.
28
30
 
29
31
  ## Unmanaged project header (#2065)
30
32
 
@@ -70,6 +72,8 @@ Legacy `vbrief/` read-accepted; `deft migrate:xbrief` for `xbrief/` (v0.6→v0.8
70
72
  ! Prefer `task deft:*` over AGENTS.md prose. See main.md.
71
73
  ## Thin Fail-Closed Design (#3265)
72
74
  ! One fail-closed `task deft:*` check + one remediation. See main.md.
75
+ ## Writing bar (#3368)
76
+ ! Clarity, simplicity, brevity in documents and user communications, including sub-agent status and handbacks. Cut ceremony, not required fields. STE how: `.deft/core/docs/writing-ste100.md` (#2927). ⊗ Full STE; ⊗ historical rewrite; ⊗ red CI style gate; ⊗ prefacing the rule.
73
77
 
74
78
  ## Continuous Improvement Learning (#607 / #3164)
75
79
 
@@ -88,6 +92,8 @@ Legacy `vbrief/` read-accepted; `deft migrate:xbrief` for `xbrief/` (v0.6→v0.8
88
92
  ⊗ Silent PR-open handback for a worker already scoped `drive-to: merge-ready`.
89
93
  ⊗ `stop-at: pr-open` without a named babysit / merge-path owner, or dual review-monitor leases on recovery (#3044 / #2261).
90
94
  ⊗ Stand down at CLEAN under human-merge with no reachable post-merge `scope:complete` owner.
95
+ ! After merge of issue `#N`, `deft verify:orphan-active -- --issue N` MUST exit 0 before `DONE` (#3429). After `scope:complete`, `deft verify:completed-tracked -- --issue N` MUST exit 0 on `origin/<deliveryBranch>` before `DONE` (#3476). Exit 1 shipped → printed `scope:complete`; missing tracked land → `swarm:finalize-cohort` or a lifecycle PR; unresolved lookup → retry / `BLOCKED` (⊗ complete unfinished scope).
96
+ ⊗ Emit `ISSUE: closed` while that brief is still in `active/`.
91
97
 
92
98
  ## Nuclear-family A2A topology (#3155)
93
99
 
@@ -129,6 +135,7 @@ Legacy `vbrief/` read-accepted; `deft migrate:xbrief` for `xbrief/` (v0.6→v0.8
129
135
  ## Contextual guardrails (runtime-detect lazy-load)
130
136
 
131
137
  ! Detect OS/shell; use portable syntax or explicit shell (#2568). `.deft/core/scm/github.md` (#2157/#2369): PS encoding→`deft verify:encoding` (#798); TS capture; cascade→`deft pr:wait-mergeable-and-merge`; SCM→`deft verify:scm-boundary`.
138
+ ! Forge outage (#3422): drop GitHub I/O on attributed outage or repeated 429/502/503; report once to the human; re-probe on `plan.policy.forgeOutageRetryMinutes` (default 30; USER.md Personal wins). Depth: `scm/github.md` § #3180. Complements #3167 / #3180.
132
139
 
133
140
  ## Development Process
134
141
 
@@ -614,6 +614,18 @@
614
614
  "minimum": 1,
615
615
  "description": "Maximum age, in hours, for .deft/ritual-state.json before the fail-closed session ritual verifier requires task session:start to run again. Default: 4."
616
616
  },
617
+ "forgeOutageRetryMinutes": {
618
+ "type": ["integer", "null"],
619
+ "minimum": 5,
620
+ "description": "Minutes to wait between GitHub I/O re-probes after a forge outage drop-back (#3422). Default: 30. USER.md Personal wins over this project field. null is unset (same as omit)."
621
+ },
622
+ "projectInvariants": {
623
+ "type": "array",
624
+ "description": "Authored project-level must-not-break contracts (#3425). Empty or omitted is a no-op. Each entry names an id, statement, and contract surface (paths and/or module ids).",
625
+ "items": {
626
+ "$ref": "#/$defs/ProjectInvariant"
627
+ }
628
+ },
617
629
  "requireHumanMerge": {
618
630
  "type": "boolean",
619
631
  "description": "When true, agents may open PRs but must not merge (#1193). Defaults true when autoDeployOnMerge is also true. Override: policy:allow-bot-merge --confirm or DEFT_ALLOW_BOT_MERGE=1."
@@ -631,6 +643,66 @@
631
643
  },
632
644
  "additionalProperties": true
633
645
  },
646
+ "ProjectInvariant": {
647
+ "type": "object",
648
+ "description": "One authored project invariant (#3425). Contract surface is paths and/or module ids that must not be broken.",
649
+ "required": ["id", "statement"],
650
+ "properties": {
651
+ "id": {
652
+ "type": "string",
653
+ "minLength": 1
654
+ },
655
+ "statement": {
656
+ "type": "string",
657
+ "minLength": 1
658
+ },
659
+ "contractSurface": {
660
+ "$ref": "#/$defs/ProjectInvariantContractSurface"
661
+ },
662
+ "contract_surface": {
663
+ "oneOf": [
664
+ { "$ref": "#/$defs/ProjectInvariantContractSurface" },
665
+ { "type": "array", "items": { "type": "string" } }
666
+ ]
667
+ },
668
+ "paths": {
669
+ "type": "array",
670
+ "items": { "type": "string" }
671
+ },
672
+ "moduleIds": {
673
+ "type": "array",
674
+ "items": { "type": "string" }
675
+ },
676
+ "module_ids": {
677
+ "type": "array",
678
+ "items": { "type": "string" }
679
+ }
680
+ },
681
+ "additionalProperties": true
682
+ },
683
+ "ProjectInvariantContractSurface": {
684
+ "type": "object",
685
+ "description": "Must-not-break module/contract surface: repository paths and/or codeStructure module ids.",
686
+ "properties": {
687
+ "paths": {
688
+ "type": "array",
689
+ "items": { "type": "string" }
690
+ },
691
+ "pathGlobs": {
692
+ "type": "array",
693
+ "items": { "type": "string" }
694
+ },
695
+ "moduleIds": {
696
+ "type": "array",
697
+ "items": { "type": "string" }
698
+ },
699
+ "module_ids": {
700
+ "type": "array",
701
+ "items": { "type": "string" }
702
+ }
703
+ },
704
+ "additionalProperties": true
705
+ },
634
706
  "HotfixCriteria": {
635
707
  "type": "object",
636
708
  "description": "Structural hotfix eligibility thresholds (#1193). Agent may label hotfix-candidate only; human promotes hotfix.",