@deftai/directive-content 0.83.0 → 0.85.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.
@@ -209,14 +209,27 @@ All xBRIEFs (including those read from `xbrief/active/` and any new xBRIEFs this
209
209
  - ! If any required tool is missing, stop and report — do not proceed to Step 3
210
210
  - ⊗ Assume tools are available because the spec references them
211
211
 
212
- ### Step 3: Build Phase by Phase
212
+ ### Gate throughput iteration fast lane vs merge chokepoint (#1704)
213
+
214
+ > **Invariant:** every change MUST pass the full gate at least once before merge. Iteration MAY use a cheaper proxy; the merge chokepoint MUST NOT be skipped.
215
+
216
+ - ! **Iteration lane (agents + humans):** during implementation commits, use affected/static gates — targeted tests on changed paths (`vitest run --coverage <paths>` or project equivalent), static `verify:*` gates relevant to touched files, and `task coverage:hotspots` / `task verify:forward-coverage` — NOT full `task check` on every commit.
217
+ - ! **Merge chokepoint:** run full `task check` (or `task check:merge` in the framework source repo) once before push/PR and again when CI merge gate runs. Pre-PR skill exit and review-cycle fix batches still require a green full gate.
218
+ - ! **Escape-rate safety (#1703 Tier-1):** before tightening fast-lane defaults fleet-wide, consult `#1703` measurement — `task eval:health` (Tier 0) and Tier-1 session telemetry (`helped/crud-metrics.jsonl` via instrumented CRUD / workflow metrics). Do NOT invent a separate fast-lane escape-rate surface (#1704 LockedDecisions).
219
+ - ~ **In-engine incrementality (#1713):** content-hash task cache and runner-delegated affected selection are sibling work — not required for this policy face.
220
+ - ⊗ Run full `task check` on every iteration commit when a cheaper proxy suffices — reserve the full gate for PR/merge (#1704).
221
+ - ⊗ Skip the merge chokepoint because the iteration lane passed — the fast lane is convenience only.
222
+
223
+ **Cost model (swarm-heavy path):** moves from roughly `O(commits × full-gate)` toward `O(merges × full-gate) + O(iterations × cheap-proxy)` when workers iterate with affected/static gates and run full `task check` only at PR/merge.
224
+
225
+ ## Step 3: Build Phase by Phase
213
226
 
214
227
  For each phase:
215
228
 
216
229
  1. ! **Scaffold** — file structure, dependencies, config
217
230
  2. ! **Test first** — write tests before implementation (TDD)
218
231
  3. ! **Implement** — make tests pass, following deft coding standards
219
- 4. ! **Verify** — run `task check`, fix any issues
232
+ 4. ! **Verify (iteration lane)** — run affected/static gates per `#1704` fast lane above; fix failures before checkpoint commits
220
233
  5. ! **Origin sync** — when this phase materially changed an origin-linked scope xBRIEF (`plan.references` includes `x-xbrief/github-issue`), run `task issue:sync-from-xbrief -- <path>` (or `--dry-run` to preview) so the linked GitHub issue receives a sync comment; if skipped, document why in the PR or session notes (#2540)
221
234
  6. ! **Checkpoint** — tell user what's done, what's next
222
235
 
@@ -224,15 +237,24 @@ For each phase:
224
237
 
225
238
  ### Step 4: Quality Gates
226
239
 
227
- After EVERY phase:
240
+ After EVERY phase (iteration lane — #1704):
241
+
242
+ ```bash
243
+ vitest run --coverage <changed-paths> # or project test runner on touched modules
244
+ task coverage:hotspots # branch headroom before merge
245
+ task verify:forward-coverage # new-source coverage (#1310)
246
+ ```
247
+
248
+ Before PR / phase handoff (merge chokepoint):
228
249
 
229
250
  ```bash
230
- task check # Format, lint, type check, test, coverage
251
+ task check # Full gate — format, lint, typecheck, tests, coverage, verify:*
231
252
  task test:coverage # >=85% or PROJECT-DEFINITION.xbrief.json override
232
253
  ```
233
254
 
234
- - ! Phase is NOT done until `task check` passes
255
+ - ! Phase checkpoint commits MAY use the iteration lane; phase is NOT done for PR handoff until full `task check` passes at the merge chokepoint
235
256
  - ⊗ Skip quality gates or claim they passed without running
257
+ - ⊗ Treat iteration-lane green as merge-ready without full `task check`
236
258
 
237
259
  ## Coding Standards (Summary)
238
260
 
@@ -244,7 +266,7 @@ Read full files when you need detail:
244
266
  - ~ Naming: hyphens for filenames unless language idiom dictates otherwise
245
267
  - ! Contracts first: define interfaces/types before implementation
246
268
  - ! Secrets: in `secrets/` dir with `.example` templates; ⊗ secrets in code
247
- - ! Commits: Conventional Commits format; ! run `task check` before every commit
269
+ - ! Commits: Conventional Commits format; ! use iteration fast lane before checkpoint commits; ! run full `task check` at PR/merge chokepoint only (#1704)
248
270
 
249
271
  See `deft/coding/coding.md` and `deft/coding/testing.md` for full rules.
250
272
 
@@ -266,7 +288,7 @@ See `deft/coding/coding.md` and `deft/coding/testing.md` for full rules.
266
288
 
267
289
  - ! Default to one story per branch/PR. Batching multiple stories in one branch requires explicit operator approval and a short rationale.
268
290
  - ! Create a checkpoint commit after each completed story before beginning another story.
269
- - ! Run `task check` before committing
291
+ - ! Use iteration fast lane before checkpoint commits; run full `task check` at PR/merge chokepoint (#1704)
270
292
  - ⊗ Claim checks passed without running them
271
293
 
272
294
  ```
@@ -296,7 +318,7 @@ feat(phase-2): add REST API endpoints with integration tests
296
318
  - ⊗ Implement things not in scope xBRIEF without asking
297
319
  - ⊗ Read every deft file upfront
298
320
  - ⊗ Move to next phase before current passes checks
299
- - ⊗ Make commits without running `task check`
321
+ - ⊗ Make commits without running iteration-lane validation; ⊗ skip full `task check` at PR/merge chokepoint (#1704)
300
322
  - ⊗ Proceed without USER.md -- always run the USER.md Gate first
301
323
  - ⊗ Spawn an implementation agent or invoke a code-writing tool against a xBRIEF that has not passed `task xbrief:preflight` (which wraps `scripts/preflight_implementation.py`) -- always run the Step 0 Implementation Preflight (#810) first; satisfy via `task xbrief:activate <path>`
302
324
  - ⊗ Proceed without `COST-ESTIMATE.md` and a recorded build / rescope / no-build / skip(+reason) decision -- always run the Cost Phase Gate (#739) first
@@ -60,10 +60,20 @@ task verify:plan-sequence -- --target-kind <entry-kind> --target <entry-id>
60
60
  - ! After the PR's review cycle completes successfully, run `task plan-sequence:advance` so "next" resolves to the following entry (or exhausted).
61
61
  - ⊗ Treat skill-chaining or "what's next?" as permission to open a PR outside the current sequence entry.
62
62
 
63
+ ## Gate throughput — iteration fast lane vs merge chokepoint (#1704)
64
+
65
+ > **Invariant:** every change MUST pass the full gate at least once before merge. Pre-PR is the merge chokepoint — NOT every iteration commit.
66
+
67
+ - ! **Iteration lane (Phases 2–3 loop):** use affected/static gates on changed paths — `vitest run --coverage <paths>`, relevant `verify:*` on touched files, `task coverage:hotspots` — instead of full `task check` on every RWLDL iteration.
68
+ - ! **Merge chokepoint (Phase 3 Lint exit + final confirm):** run full `task check` once before push/PR; Phase 3c targeted coverage precedes but does not replace the full gate.
69
+ - ! **Escape-rate safety (#1703 Tier-1):** before recommending fleet-wide fast-lane tightening, cite `#1703` Tier-1 telemetry (`helped/crud-metrics.jsonl`) and `task eval:health` — do NOT invent a separate escape-rate surface.
70
+ - ~ **In-engine incrementality (#1713):** content-hash cache + runner-delegated affected selection are sibling work (#1713).
71
+ - ⊗ Treat Phase 3c targeted coverage alone as PR-ready without full `task check` at the merge chokepoint.
72
+
63
73
  ## When to Use
64
74
 
65
75
  - ! Before pushing a branch for PR creation
66
- - ! After completing implementation but before the final `task check` gate
76
+ - ! After completing implementation but before the final merge-chokepoint `task check` (#1704)
67
77
  - ~ After addressing bot reviewer findings (run one RWLDL pass before pushing the fix batch)
68
78
  - ? During mid-implementation checkpoints on large changes
69
79
 
@@ -95,9 +105,9 @@ Each iteration proceeds through all phases in order. Do NOT skip phases or reord
95
105
 
96
106
  ### Phase 3 -- Lint
97
107
 
98
- ! Run `task check` and fix any failures.
108
+ ! Run the merge-chokepoint gate and fix any failures (#1704).
99
109
 
100
- - ! Run `task check` (fmt + lint + typecheck + tests + coverage)
110
+ - ! Run full `task check` (fmt + lint + typecheck + tests + coverage + verify:*) — the merge chokepoint, not every RWLDL iteration
101
111
  - ! Fix all failures before proceeding to Phase 3b
102
112
  - ~ If a lint fix requires changing a file, that counts as a change for the Loop phase
103
113
 
@@ -251,11 +251,17 @@ Both commands extract the "Comments Outside Diff" section with surrounding conte
251
251
 
252
252
  ! Swarm agents (whether launched via `start_agent` or `spawn_subagent` per the platform descriptor) SHOULD prefer Approach 1 for their own review-monitor sub-agent. Approach 2's yield-between-polls is not self-sustaining for swarm agents (see warning below). Always include the canonical `templates/agent-prompt-preamble.md` (AGENTS.md read mandate, #810 xBRIEF gate, #798 PowerShell UTF-8, pre-PR + review-cycle mandates) when spawning a poller sub-agent.
253
253
 
254
- ! **Deterministic review-monitor gate (#2655):** When Tier 1 is available, run `task verify:review-monitor -- --pr <N> [--call-site solo]` before yielding, entering Approach 3, or claiming review monitoring started. After spawning Approach 1, register with `task review-monitor:register -- --pr <N> --monitor-agent-id <id> --platform-primitive start_agent|spawn_subagent|cursor-task`. Exit `0` ready / `1` not ready / `2` config. Approach 3 on Tier 1 is a gate failure use `--approach3 --approach3-warned` only on Tier 3 after the user warning.
254
+ ! **Deterministic review-monitor gate (#2655 / #2814):** When Tier 1 is available, run `task verify:review-monitor -- --pr <N> [--call-site solo]` before yielding, entering Approach 3, or claiming review monitoring started. After spawning Approach 1, claim the PR-anchored lease with `task review-monitor:register -- --pr <N> --monitor-agent-id <id> --platform-primitive start_agent|spawn_subagent|cursor-task`. Release with `task review-monitor:release -- --pr <N>` when done. Exit `0` ready / `1` not ready or held-by-other / `2` config. The sole source of truth is the sticky GitHub PR comment (`<!-- deft:review-owner -->`); legacy `.deft/review-monitor.json` is obsolete and ignored. On register conflict, attach to the existing owner or stop — do not parallel-fix.
255
+
256
+ ! **Regression trigger (#2797):** A leaf that claims a monitor is active without a preceding successful `task review-monitor:register` GitHub claim MUST fail the review-monitor checklist/eval; a backgrounded `task pr:watch` shell is insufficient.
257
+
258
+
255
259
 
256
260
  ! **CI-holdout carve-out (#2688):** When `task pr:watch --one-shot --json` reports `clean_gate_holdout=ci_failures` with Greptile fields otherwise satisfied on current HEAD, do **not** freeze on `verify:review-monitor` / spawn-monitor as if Greptile latency were the blocker. Fix CI first (same ownership as Greptile P0). Keep or register a review-monitor only while still waiting on Greptile latency; a `BLOCKED: ci_failures` DONE handback to the implementation owner is correct.
257
261
 
258
262
 
263
+ ! **Cursor leaf boundary (#2797):** A Cursor `Task` leaf cannot reliably spawn another Cursor `Task`; nested Task (leaf spawning leaf) is unsupported for an Approach 1 review-monitor. A Cursor `drive-to: merge-ready` leaf MUST either keep ownership in the same agent by blocking on `task pr:watch -- <N>`, or its envelope MUST instead be `stop-at: pr-open` so the orchestrator can spawn and register a sibling review-monitor. A background shell `task pr:watch` is not a monitor and MUST NOT be claimed as one.
264
+
259
265
  **Approach 1 (preferred -- sub-agent orchestration available per platform descriptor):**
260
266
 
261
267
  ! **Background dispatch (#1880):** Spawn the review-monitor sub-agent via the matching primitive IN THE BACKGROUND (Cursor: Task `run_in_background: true`; Grok Build: `spawn_subagent` with parent yielding). The parent MUST remain interactive while the poller runs.
@@ -325,6 +325,18 @@ git worktree add <path> -b <branch-name> <configured-base-branch>
325
325
 
326
326
  ~ Also prepare plain-text prompt versions for pasting into Warp agent chat or other terminal interfaces.
327
327
 
328
+ ## Gate throughput — iteration fast lane vs merge chokepoint (#1704)
329
+
330
+ > **Invariant:** every change MUST pass the full gate at least once before merge. Swarm workers and human operators share the same commands.
331
+
332
+ - ! **Iteration lane:** during implement/fix loops, run affected/static gates (targeted tests on changed paths, relevant static `verify:*` gates, `task coverage:hotspots`) — NOT full `task check` on every commit.
333
+ - ! **Merge chokepoint:** run full `task check` once before push/PR open; CI enforces the same monolith at merge (#1704). Monitor checkpoints treat "Validating" as iteration-lane OR full gate; push requires full gate green at least once on the branch.
334
+ - ! **Escape-rate safety (#1703 Tier-1):** consult `task eval:health` and Tier-1 session telemetry (`helped/crud-metrics.jsonl`) before fleet-wide fast-lane tightening — do NOT invent a separate escape-rate surface.
335
+ - ~ **In-engine incrementality (#1713):** content-hash cache + runner-delegated affected plumbing is sibling work; this skill owns process policy only.
336
+ - ⊗ Require full `task check` on every swarm iteration commit when affected/static proxies suffice (#1704).
337
+
338
+ **Swarm cost model:** cohort workers move from `O(commits × full-gate)` toward `O(merges × full-gate) + O(iterations × cheap-proxy)` when they iterate with the fast lane and reserve full `task check` for PR/merge.
339
+
328
340
  ## Phase 3 — Launch
329
341
 
330
342
  ### Step 0: Populate the allocation-context consent token (#1378)
@@ -443,6 +455,8 @@ Cross-references: `packages/core/src/swarm/routing.ts` (`SWARM_WORKER_ROLES`), `
443
455
 
444
456
  ! **Deliberate model routing before ANY dispatch:** Before launching ANY worker in this phase (cohort OR solo), run `task verify:routing` and resolve each `(dispatch_provider, worker_role)` via `task swarm:routing-set` / `.deft/routing.local.json`. Populate `## Worker metadata` per `templates/agent-prompt-preamble.md` §2.6 and pass `resolved_model` into the actual dispatch primitive when non-null. Never silently inherit the monitor's model. Deterministic gate enforcement is #1877; this rule is behavioral doctrine (#1880).
445
457
 
458
+ ! **Cursor ownership split (#2797):** A Cursor `Task` implementation leaf MUST NOT launch a nested Cursor `Task` review-monitor: nested Task (leaf spawning leaf) is unsupported/unreliable. For Cursor, a `drive-to: merge-ready` leaf owns a blocking `task pr:watch -- <N>` in its own process, or the dispatcher uses `stop-at: pr-open` and itself launches a sibling monitor then runs `task review-monitor:register`. A leaf that backgrounds `task pr:watch` and exits MUST NOT claim monitoring is active; this is a review-monitor-gate failure.
459
+
446
460
  ! **Worker-owns-lifecycle (Gap C):** Every implementation-worker dispatch prompt MUST declare the unit-of-work boundary: `stop-at: pr-open` OR `drive-to: merge-ready` (default for story xBRIEF work). Workers scoped `drive-to: merge-ready` own pre-PR, push, PR open, Greptile review-cycle poll/fix, and the #1259 Step 6 fail-closed exit as ONE dispatch — they spawn their own review poller per `skills/deft-directive-review-cycle/SKILL.md` monitoring tiers. The monitor MUST NOT plan a separate post-PR review leaf for a worker already scoped merge-ready.
447
461
 
448
462
  ! **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 monitor (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). `task verify:orphan-active` fails closed when active/running briefs remain after their issues close or PR merges.
@@ -552,7 +566,7 @@ Track each agent through these stages:
552
566
 
553
567
  1. **Reading** — agent is loading AGENTS.md, xBRIEF files, project files (no file changes yet)
554
568
  2. **Implementing** — working tree shows modified files
555
- 3. **Validating** — agent running `task check`
569
+ 3. **Validating** — agent running iteration-lane gates or full `task check` (full gate required before push/PR — #1704)
556
570
  4. **Committed** — new commit(s) in `git log`
557
571
  5. **Pushed** — branch exists on `origin`
558
572
  6. **PR Created** — PR visible via `gh pr list --head <branch>`
@@ -613,7 +627,7 @@ For each agent's PR:
613
627
  All PRs meet ALL of:
614
628
  - Greptile confidence > 3
615
629
  - No P0 or P1 issues remain (P2 issues are non-blocking style suggestions)
616
- - `task check` passed (or equivalent validation completed)
630
+ - `task check` passed at merge chokepoint before push (or equivalent full-gate validation — #1704)
617
631
  - CHANGELOG entries present under `[Unreleased]`
618
632
 
619
633
  ! **Mandatory cohort verifier (#1364):** After every poller (Phase 6 review-cycle sub-agent) reports back, the monitor MUST run `task swarm:verify-review-clean -- <pr-numbers...>` and confirm exit 0 BEFORE evaluating the rest of the Exit Condition or surfacing the Phase 5 -> 6 gate. The verifier re-uses the Greptile rolling-summary parser from `task pr:merge-ready` so the per-PR merge gate and the cohort gate stay in lockstep (a parser fix lands in both surfaces at once). Exit codes: 0 (cohort CLEAN -- all PRs simultaneously have SHA match + confidence > 3 + zero P0/P1 + not errored on current HEAD); 1 (one or more PRs unclean with per-PR diagnostics -- re-dispatch the poller for the unclean PR or address findings, then re-run the verifier); 2 (config error -- empty cohort, malformed xBRIEF glob, gh missing). The verifier is the structural answer to the #1166 swarm execution recurrence where multiple pollers exited with `clean_gate_holdout=confidence` (confidence == 3) and the monitor still raised the Phase 5 -> 6 gate because the trigger keyed on "all pollers have reported back" rather than "every PR in the cohort is objectively CLEAN".
@@ -641,7 +655,7 @@ All PRs meet ALL of:
641
655
  2. ! **Merge-readiness checklist:** Before any `gh pr merge` call, the monitor MUST emit a structured checklist confirming each PR is merge-ready. For each PR, verify and explicitly confirm:
642
656
  - Greptile confidence score > 3
643
657
  - No P0 or P1 issues remaining
644
- - `task check` passed on the branch
658
+ - full `task check` passed on the branch before push (#1704 merge chokepoint)
645
659
  - CHANGELOG.md entry present under `[Unreleased]`
646
660
  - Explicit user approval received for this merge cascade
647
661
 
@@ -918,7 +932,8 @@ When a monitor session crashes or a new session must take over an in-progress sw
918
932
  ```
919
933
  TASK: You must complete N [type] fixes on this branch ([branch-name]) in the deft directive repo.
920
934
  This is a git worktree. Do NOT just read files and stop — you must implement all changes,
921
- run task check, commit, push, create a PR, and run the review cycle.
935
+ run iteration-lane validation during implement/fix loops, full task check before push,
936
+ commit, push, create a PR, and run the review cycle.
922
937
  DO NOT STOP until all steps are complete.
923
938
 
924
939
  STEP 1 — Read directives: Read AGENTS.md, vbrief/vbrief.md, and the assigned xBRIEF(s) from xbrief/active/.
@@ -932,7 +947,7 @@ Task B (xBRIEF: [filename], issue #[N]): [one-paragraph description with specifi
932
947
 
933
948
  [...repeat for each task...]
934
949
 
935
- STEP 3 — Validate: Run task check. Fix any failures.
950
+ STEP 3 — Validate: Use iteration fast lane during commits (affected/static gates). Run full task check once before push/PR (#1704). Fix any failures.
936
951
 
937
952
  STEP 4 — Commit: Add CHANGELOG.md entries under [Unreleased].
938
953
  Commit with message: [type]([scope]): [description] — with bullet-point body.
@@ -948,7 +963,7 @@ CONSTRAINTS:
948
963
  - Do not touch [list files other agents are working on]
949
964
  - New source files (scripts/, src/, cmd/, *.py, *.go) must have corresponding test files in the same PR
950
965
  - Use conventional commits: type(scope): description
951
- - Run task check before every commit
966
+ - Iteration commits: affected/static fast lane only; full task check required before push (#1704)
952
967
  - Never force-push
953
968
  ```
954
969
 
@@ -963,7 +978,7 @@ CONSTRAINTS:
963
978
 
964
979
  ## Push Autonomy
965
980
 
966
- ! Swarm agents operating under this skill with a monitor agent may push, create PRs, and run review cycles autonomously after passing `task check`. The global "never push/commit without explicit user instruction" convention does not apply to swarm agents executing the full STEP 1-6 prompt workflow -- the skill's quality gates (`task check`, Greptile review cycle) replace the interactive confirmation gate.
981
+ ! Swarm agents operating under this skill with a monitor agent may push, create PRs, and run review cycles autonomously after passing full `task check` at the merge chokepoint (#1704). The global "never push/commit without explicit user instruction" convention does not apply to swarm agents executing the full STEP 1-6 prompt workflow -- the skill's quality gates (merge chokepoint `task check`, Greptile review cycle) replace the interactive confirmation gate.
967
982
 
968
983
  ## Anti-Patterns
969
984
 
@@ -0,0 +1,15 @@
1
+ version: '3'
2
+
3
+ vars:
4
+ DEFT_ROOT: '{{joinPath .TASKFILE_DIR ".."}}'
5
+
6
+ tasks:
7
+ monitor:
8
+ desc: "Sub-agent heartbeat sweep (#1365 / #2824). Three-state exit (0 ok / 1 stale-or-malformed / 2 config). Alias for the raw subagent-monitor engine."
9
+ dir: '{{.USER_WORKING_DIR}}'
10
+ deps:
11
+ - task: :engine:_ts-build
12
+ cmds:
13
+ - task: :engine:invoke
14
+ vars:
15
+ ENGINE_CMD: 'subagent-monitor {{.CLI_ARGS}}'
package/tasks/docs.yml ADDED
@@ -0,0 +1,37 @@
1
+ version: '3'
2
+
3
+ # Maintainer documentation tasks.
4
+ #
5
+ # docs:rule-map renders the Rule Map: a maintainer-facing view of how the
6
+ # framework's rules are layered and grouped. Source of truth is content/ +
7
+ # tasks/ + the packs; the map is a derived view, so regenerate after changing
8
+ # rules rather than hand-editing the outputs.
9
+ #
10
+ # docs/RULE-MAP.md committed, diff-friendly Markdown (no timestamps)
11
+ # docs/rule-map/index.html gitignored, self-contained interactive explorer
12
+ #
13
+ # Implemented as the `rule-map` engine verb (packages/core/src/render/rule-map.ts),
14
+ # dispatched through the TS engine like the other render gates. No Python, no
15
+ # external dependencies, no network.
16
+
17
+ tasks:
18
+
19
+ rule-map:
20
+ desc: "Build the maintainer Rule Map (docs/RULE-MAP.md + gitignored docs/rule-map/index.html)"
21
+ dir: '{{.USER_WORKING_DIR}}'
22
+ deps:
23
+ - task: :engine:_ts-build
24
+ cmds:
25
+ - task: :engine:invoke
26
+ vars:
27
+ ENGINE_CMD: 'rule-map --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
28
+
29
+ rule-map:check:
30
+ desc: "Fail if committed docs/RULE-MAP.md is out of date (for CI / pre-commit gating)"
31
+ dir: '{{.USER_WORKING_DIR}}'
32
+ deps:
33
+ - task: :engine:_ts-build
34
+ cmds:
35
+ - task: :engine:invoke
36
+ vars:
37
+ ENGINE_CMD: 'rule-map --project-root "{{.USER_WORKING_DIR}}" --check'
package/tasks/policy.yml CHANGED
@@ -62,6 +62,16 @@ tasks:
62
62
  vars:
63
63
  ENGINE_CMD: 'policy enable-value-feedback --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
64
64
 
65
+ clear-value-feedback:
66
+ desc: "Remove typed plan.policy.valueFeedback so trusted-org repos return to org-auto resolution (#2822). -- task policy:clear-value-feedback"
67
+ dir: '{{.USER_WORKING_DIR}}'
68
+ deps:
69
+ - task: :engine:_ts-build
70
+ cmds:
71
+ - task: :engine:invoke
72
+ vars:
73
+ ENGINE_CMD: 'policy clear-value-feedback --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
74
+
65
75
  wip-cap:
66
76
  desc: "Set plan.policy.wipCap=N (#1124 / D4 of #1119). Requires --set N --confirm. Default cap is 20 (#2319; raised from the original 10 per umbrella #1119 Current Shape v3)."
67
77
  dir: '{{.USER_WORKING_DIR}}'
@@ -5,7 +5,7 @@ vars:
5
5
 
6
6
  tasks:
7
7
  register:
8
- desc: "Record an active Approach 1 review-monitor after spawn (#2655). Writes .deft/review-monitor.json at the main worktree root."
8
+ desc: "Claim PR-anchored review-owner lease via sticky GitHub comment (#2814). Does not write local JSON."
9
9
  dir: '{{.USER_WORKING_DIR}}'
10
10
  deps:
11
11
  - task: :engine:_ts-build
@@ -13,3 +13,13 @@ tasks:
13
13
  - task: :engine:invoke
14
14
  vars:
15
15
  ENGINE_CMD: 'review-monitor-register {{.CLI_ARGS}}'
16
+
17
+ release:
18
+ desc: "Release PR-anchored review-owner lease by editing the sticky GitHub comment (#2814)."
19
+ dir: '{{.USER_WORKING_DIR}}'
20
+ deps:
21
+ - task: :engine:_ts-build
22
+ cmds:
23
+ - task: :engine:invoke
24
+ vars:
25
+ ENGINE_CMD: 'review-monitor-release {{.CLI_ARGS}}'
package/tasks/verify.yml CHANGED
@@ -466,3 +466,13 @@ tasks:
466
466
  - task: :engine:invoke
467
467
  vars:
468
468
  ENGINE_CMD: 'verify-review-monitor {{.CLI_ARGS}}'
469
+
470
+ subagent-alive:
471
+ desc: "Fail-closed worker liveness gate (#2824): missing/STALE heartbeats for in-flight drive-to:merge* workers exit 1 with REDISPATCH_OK. Three-state exit (0 alive / 1 stale-or-missing / 2 config error)."
472
+ dir: '{{.USER_WORKING_DIR}}'
473
+ deps:
474
+ - task: :engine:_ts-build
475
+ cmds:
476
+ - task: :engine:invoke
477
+ vars:
478
+ ENGINE_CMD: 'verify-subagent-alive {{.CLI_ARGS}}'
@@ -449,6 +449,8 @@ These rules bind **orchestrators** dispatching implementation, fix, or review-cy
449
449
  **Worker-owns-lifecycle (Gap C):**
450
450
 
451
451
  - ! When dispatching an implementation worker, the dispatch envelope MUST declare the unit-of-work boundary explicitly: `stop-at: pr-open` (worker opens PR and exits) OR `drive-to: merge-ready` (worker owns PR + Greptile review cycle + fix batches through merge-ready as ONE unit of work, spawning its own review poller per `skills/deft-directive-review-cycle/SKILL.md` monitoring tiers). Default for story implementation dispatches is `drive-to: merge-ready`.
452
+ - ! **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).
453
+ - ⊗ 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.
452
454
  - ! **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).
453
455
  - ! 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.
454
456
  - ⊗ 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).
@@ -502,6 +504,11 @@ The contract in one paragraph:
502
504
 
503
505
  The parent monitor watches the heartbeat file directly (three-state exit 0 ok / 1 stale-or-malformed / 2 config error). Skipping the heartbeat is a hard `⊗` for any long-running sub-agent: a stalled agent with no heartbeat surface is the exact #1166 failure mode this contract closes.
504
506
 
507
+ ! **Cursor false-alive / REDISPATCH_OK (#2824):** On the Cursor `Task` path, the host may report a leaf as "still running" after it has gone silent (empty transcript, no heartbeats, no DONE/FAILED). When `task verify:subagent-alive` exits `1` for a registered in-flight `drive-to: merge*` worker — missing heartbeat, STALE heartbeat, or no recent git/PR activity — the monitor MUST treat the worker as dead and print `REDISPATCH_OK` to authorize takeover re-dispatch. Do NOT block on host resume when the liveness gate has failed closed.
508
+
509
+ - Monitors run `task verify:subagent-alive -- --require-agent <agent-id> [--scratch-dir <worktree>/.deft-scratch/subagent-status]` each poll iteration.
510
+ - Workers run `task agent:monitor` (raw sweep) or the gate verb above; both wrap `subagent-monitor` (#1365).
511
+
505
512
  ## 11. Mandatory DONE message even on early exit
506
513
 
507
514
  Every worker MUST send a final status message before exiting its tool loop, regardless of outcome:
@@ -13,7 +13,8 @@ Directive runs against arbitrary repositories, including private monorepos with
13
13
  ## Rules
14
14
 
15
15
  - ! Read-only, session-start, and session-ritual flows (`deft session:start`, `deft verify:session-ritual`, `deft verify:tools`) MUST perform no npm/pnpm registry access. Tool-presence probes MUST use PATH lookups (`which`/`accessSync`) or `--version` checks, never a subcommand that can resolve dependencies or query a registry.
16
- - ! `deft doctor` MUST default to an OFFLINE tier: no check in the default run may contact an npm/pnpm registry. The one check that can (`payload-staleness`, which uses `git ls-remote` to verify the installed pin and `npm view <package> version` to compare a release-tag install with the latest stable package) is gated behind the explicit `--network` flag and is skipped by default with a pointer to that flag.
16
+ - ! `npm config get @deftai:registry` and `npm config get registry` are offline configuration reads, not registry access. `deft doctor` MAY use them in its default tier to identify effective routing, but MUST NOT print the raw values because registry URLs can contain internal hostnames or credentials.
17
+ - ! `deft doctor` MUST default to an OFFLINE tier: no check in the default run may contact an npm/pnpm registry. The one check that can (`payload-staleness`, which uses `git ls-remote` to verify the installed pin and `npm view <package> version --registry=https://registry.npmjs.org/ --ignore-scripts` to compare a release-tag install with the latest stable package) is gated behind the explicit `--network` flag and is skipped by default with a pointer to that flag.
17
18
  - ! Before a network-gated check runs, `deft doctor --network` MUST print a disclosure line naming the tool and registry class it may contact (for example, "may contact your git remote and the npm registry") BEFORE any network call is attempted.
18
19
  - ! Any future doctor check, session step, or read-only command that needs to invoke `npm`/`pnpm` in a way that can reach a registry MUST follow the same pattern: explicit flag or subcommand, disclosed registry class before the call, and offline by default.
19
20
  - ~ Where a package-manager operation is unavoidable in an explicitly-invoked flow (e.g. a release or install workflow that legitimately needs to fetch packages), prefer offline/frozen modes (`--offline`, `--prefer-offline`, `--frozen-lockfile`) when the operation only needs to validate local state rather than resolve fresh metadata.
@@ -26,4 +27,4 @@ This does not ban dependency installation or registry verification from explicit
26
27
 
27
28
  ## Reference implementation
28
29
 
29
- `packages/core/src/doctor/payload-staleness.ts` is the only code path in the TS engine that shells out to `npm` (`npm view`) or performs a git-remote network call for framework-currency checks; `packages/core/src/doctor/main.ts` gates it behind `--network` and prints the disclosure line first. `packages/core/src/session/session-start.ts` and `packages/core/src/verify-env/verify-tools.ts` perform no package-manager network access at all -- tool presence is resolved via PATH probing only.
30
+ `packages/core/src/doctor/npm-registry.ts` performs only the two offline `npm config get` reads above and redacts their values from findings. `packages/core/src/doctor/payload-staleness.ts` owns the network-capable doctor probes (`git ls-remote` and `npm view`); `packages/core/src/doctor/main.ts` gates them behind `--network` and prints the disclosure line first. The npm release lookup pins `--registry=https://registry.npmjs.org/` and `--ignore-scripts`, so a configured mirror cannot silently report an old latest release. `packages/core/src/session/session-start.ts` and `packages/core/src/verify-env/verify-tools.ts` perform no package-manager network access at all -- tool presence is resolved via PATH probing only.