@deftai/directive-content 0.95.0 → 0.96.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.
- package/QUICK-START.md +2 -0
- package/Taskfile.yml +22 -0
- package/UPGRADING.md +69 -0
- package/commands.md +16 -4
- package/docs/consumer-issue-label-kit.md +211 -0
- package/docs/getting-started.md +2 -0
- package/docs/openclaw-agent-host.md +22 -6
- package/package.json +1 -1
- package/packs/skills/skills-pack-0.1.json +6 -9
- package/scm/github.md +9 -3
- package/skills/deft-directive-refinement/SKILL.md +1 -3
- package/skills/deft-directive-review-cycle/SKILL.md +16 -12
- package/skills/deft-directive-swarm/SKILL.md +22 -11
- package/skills/deft-directive-swarm/references/core-ops.md +2 -1
- package/skills/deft-directive-swarm/references/core-phase-0.md +6 -14
- package/skills/deft-directive-swarm/references/core-phase-3.md +12 -9
- package/skills/deft-directive-swarm/references/core-phase-5-6.md +1 -1
- package/skills/deft-directive-swarm/references/host-claude-code.md +86 -0
- package/skills/deft-directive-swarm/references/host-cursor.md +1 -1
- package/skills/deft-directive-swarm/references/host-openclaw.md +8 -4
- package/skills/deft-directive-triage/SKILL.md +19 -6
- package/skills/deft-directive-xbrief/SKILL.md +0 -1
- package/tasks/cache.yml +31 -0
- package/templates/agent-prompt-preamble.md +7 -4
- package/templates/agents-entry.md +1 -0
package/scm/github.md
CHANGED
|
@@ -361,11 +361,17 @@ Agent `edit_files` operations can fail when structured file sections contain Uni
|
|
|
361
361
|
|
|
362
362
|
### Issue Labels
|
|
363
363
|
|
|
364
|
-
**
|
|
364
|
+
**Consumer projects (recommended starter kit, #2611):** use the portable minimal kit in [`docs/consumer-issue-label-kit.md`](../docs/consumer-issue-label-kit.md) (deposit path under `.deft/core/docs/…`). Core labels (`bug`, `enhancement`, `documentation`, `duplicate`, `wontfix`, optional `urgent`), thin epic/tracker/child rules, optional `triaged` + mirror PD knobs (`triageAutoClassify`, `triageLabelMirror.actionLabels`). Prefer existing repo names over inventing twins. ⊗ Do not import the full maintainer taxonomy.
|
|
365
365
|
|
|
366
|
-
**
|
|
366
|
+
**Framework source (`deftai/directive` only):** use the maintainer catalog at repo-root `.github/ISSUE_LABELS.md` (#2609) — full facets, platform, machine/mirror set (`triaged`, `triage:*`). That path is **repository-only** (not deposited under `.deft/core/`); browse the live file on GitHub rather than a relative path from this shipped guide. Do not invent labels outside that catalog.
|
|
367
367
|
|
|
368
|
-
**
|
|
368
|
+
**When no project taxonomy file exists** (fallback shorthand; full kit is the consumer doc above):
|
|
369
|
+
|
|
370
|
+
**Type**: `bug`, `enhancement`, `documentation`, `duplicate`, `wontfix` (prefer existing repo names over inventing `feat` / bare `docs` twins); optional `urgent`
|
|
371
|
+
|
|
372
|
+
**Status / role**: `status:tracker`, `status:child` (parented work), optional `epic` only for multi-ship product roots; project-specific holds as needed
|
|
373
|
+
|
|
374
|
+
**Mirror** (if using `triage:classify -- --mirror`): at least `triaged`; optional `triage:deferred` / `triage:archived` when `actionLabels` maps them
|
|
369
375
|
|
|
370
376
|
### Post-1.0.0 Issue Linking
|
|
371
377
|
|
|
@@ -116,9 +116,7 @@ The agent may suggest the next phase, but the user decides. Phases can be entere
|
|
|
116
116
|
1. ! Pull the ingestion candidate list via `task triage:queue --state=accept` (D11 / #1128). Each row is a cached issue whose latest audit-log decision is `accept` -- the canonical "ready to become a scope xBRIEF" cohort. ! MUST NOT enumerate `xbrief/proposed/` independently of the queue; the folder participates only via the join described in step 2.
|
|
117
117
|
2. ! Join the queue against `xbrief/proposed/` (and the rest of the lifecycle folders) by `references[].uri`: queue rows whose issue is already represented by an existing xBRIEF surface as "already tracked"; queue rows with no matching xBRIEF are "new accept candidates". Items already in `xbrief/proposed/` continue to participate -- they are joined against the cache rather than enumerated separately.
|
|
118
118
|
3. ~ When the join surfaces zero new candidates (every `accept` row already has a xBRIEF), Phase 0b is a clean no-op; chain straight into Phase 0c.
|
|
119
|
-
4. ! For each new candidate, fall through to Phase 1 -- Ingest, which delegates the actual scope-xBRIEF write to `task issue:ingest
|
|
120
|
-
|
|
121
|
-
<!-- TODO(#1136 / D18): when `task scope:promote --from-issue=<N>` ships, refinement Phase 0b consumes it directly instead of chaining `task issue:ingest` + `task scope:promote`. -->
|
|
119
|
+
4. ! For each new candidate, fall through to Phase 1 -- Ingest, which delegates the actual scope-xBRIEF write to `task issue:ingest` (or `task triage:accept`, which already ingests into `proposed/`). After the proposed artifact exists, promote with `task scope:promote -- --from-issue=<N> [--repo OWNER/NAME]` (#1136 / D18), or chain accept+promote via `task triage:accept -- --issue <N> --repo OWNER/NAME --auto-promote` when the operator wants pending/ in one step.
|
|
122
120
|
|
|
123
121
|
⊗ Walk `xbrief/proposed/` directly as the primary ingestion surface -- the cache is the authoritative "what is ready to refine?" surface; the folder is the destination, not the source of truth.
|
|
124
122
|
⊗ Drop items that exist in `xbrief/proposed/` but lack a matching cache row -- those are reconciled later (Phase 3 / origin reconciliation), not silently discarded.
|
|
@@ -262,7 +262,7 @@ Remediation:
|
|
|
262
262
|
|
|
263
263
|
! **Official gh-only fallback** (when both `deft`/`directive` and `task deft:<verb>` probes fail for pr:watch / review-monitor):
|
|
264
264
|
|
|
265
|
-
1. Still select Approach 1 when a sub-agent primitive exists (OpenClaw `sessions_spawn`, Cursor `Task`, `spawn_subagent`, `start_agent`) — spawn a review-monitor that runs the gh-only loop; do not block the parent.
|
|
265
|
+
1. Still select Approach 1 when a sub-agent primitive exists (OpenClaw `sessions_spawn`, Cursor `Task`, Claude Code `Agent`, `spawn_subagent`, `start_agent`) — spawn a review-monitor that runs the gh-only loop; do not block the parent.
|
|
266
266
|
2. **Do not call** gate verbs via any surface the probe showed absent — those invocations cannot succeed and must not gate the spawn.
|
|
267
267
|
3. Ownership claim without the tasks: post/update the sticky `<!-- deft:review-owner -->` PR comment via `gh api` (same field shape as the task-written lease) **or** keep ownership in the parent and document `missing-task: review-monitor` in the PR/parent handback. Never invent `.deft/review-monitor.json`.
|
|
268
268
|
4. Poll with adaptive cadence (20-30s / 60s / 90s) using:
|
|
@@ -354,7 +354,7 @@ Remediation:
|
|
|
354
354
|
~ **Eval / regression (#3090):** Given PR open + check SUCCESS + open inline P1s + agent text claims driving merge + turn ends with 0 subagents and no lease → **FAIL** (Owner Continuity Gate), not PASS.
|
|
355
355
|
|
|
356
356
|
### Review Monitoring
|
|
357
|
-
! **Background / independent dispatch (#1880 Gap D):** Long-running review-cycle owners and pollers (>~3 min) MUST be dispatched independently / in the background so the parent conversation stays interactive. On Cursor, use the Task tool background path (`run_in_background: true`). This generalizes the Approach-1 sub-agent monitor rule to implementation and fix workers as well — foreground dispatch is reserved for short tasks. The parent receives completion via `DONE` / `BLOCKED` / `FAILED` per `templates/agent-prompt-preamble.md` §11.
|
|
357
|
+
! **Background / independent dispatch (#1880 Gap D):** Long-running review-cycle owners and pollers (>~3 min) MUST be dispatched independently / in the background so the parent conversation stays interactive. On Cursor, use the Task tool background path (`run_in_background: true`) when the current agent is the top-level owner of that primitive (not a nested leaf — see Cursor leaf boundary). On Claude Code, top-level parents/orchestrators use the `Agent` tool with `run_in_background: true` (register primitive `claude-agent`, #3134); implementation leaves follow the Claude Code leaf boundary (blocking `pr:watch` or `stop-at: pr-open` sibling), not nested Agent. This generalizes the Approach-1 sub-agent monitor rule to implementation and fix workers as well — foreground dispatch is reserved for short tasks. The parent receives completion via `DONE` / `BLOCKED` / `FAILED` per `templates/agent-prompt-preamble.md` §11.
|
|
358
358
|
|
|
359
359
|
! **Worker-owns-lifecycle (#1880 Gap C):** When this skill runs as part of an implementation worker scoped `drive-to: merge-ready`, the worker owns the full review/fix loop through merge-ready in its own tool loop — do NOT exit at PR-open expecting the orchestrator to spawn a separate review leaf.
|
|
360
360
|
|
|
@@ -362,17 +362,17 @@ Remediation:
|
|
|
362
362
|
|
|
363
363
|
|
|
364
364
|
|
|
365
|
-
! Select the monitoring approach based on runtime capability detection (the matrix in `skills/deft-directive-swarm/SKILL.md` Phase 3 Step 1, extended per #1342 slices 1-2 for `spawn_subagent` / "grok-build", per #1877 for Cursor as first-class Tier-1 tiers,
|
|
365
|
+
! Select the monitoring approach based on runtime capability detection (the matrix in `skills/deft-directive-swarm/SKILL.md` Phase 3 Step 1, extended per #1342 slices 1-2 for `spawn_subagent` / "grok-build", per #1877 for Cursor as first-class Tier-1 tiers, per #2876 for OpenClaw `sessions_spawn`, and per #3134 for Claude Code `claude-code` / `claude-agent`). Probe the environment (tool set + env vars) to obtain the stable platform descriptor (`grok-build`, `warp-orchestrated`, `warp-manual`, `cursor-composer`, `cursor-cloud-agent`, `claude-code`, `openclaw`, etc.) from the launch adapter / `get_platform_capabilities` and map the descriptor to the appropriate tier + dispatch primitive (`start_agent`, `spawn_subagent`, the Cursor `Task` tool, Claude Code `Agent` / `claude-agent`, or OpenClaw `sessions_spawn`). The descriptor (not hard-coded tool presence) is the single source of truth for both launch and review monitoring.
|
|
366
366
|
|
|
367
|
-
- **Tier 1 (orchestrated sub-agent)** → Approach 1 (spawn review-monitor sub-agent via the primitive matching the descriptor: `start_agent`, `spawn_subagent`, the Cursor `Task` tool with `run_in_background: true`, or OpenClaw `sessions_spawn`)
|
|
367
|
+
- **Tier 1 (orchestrated sub-agent)** → Approach 1 (spawn review-monitor sub-agent via the primitive matching the descriptor: `start_agent`, `spawn_subagent`, the Cursor `Task` tool with `run_in_background: true`, Claude Code `Agent` with `run_in_background: true` / register `claude-agent`, or OpenClaw `sessions_spawn`)
|
|
368
368
|
- **Tier 2 (no sub-agent primitive, but scheduler/timer/auto-reinvocation)** → Approach 2 (yield-between-polls) — includes OpenClaw `cron` / host scheduler **only when** `sessions_spawn` is unavailable (#2876)
|
|
369
369
|
- **Tier 3 (interactive session, nothing else)** → Approach 3 (blocking sleep loop as last resort)
|
|
370
370
|
|
|
371
|
-
! Detection: use the full runtime capability matrix (swarm Phase 3 + launch adapter from #1342 slice 2). The old single-probe for `start_agent` is superseded; the returned platform descriptor determines both the orchestration path and the MCP surface (see MCP probe below). If the descriptor is `grok-build` (spawn_subagent present, start_agent + WARP_* absent), treat as Tier 1 with the spawn_subagent poller path. If the descriptor is `cursor-composer` / `cursor-cloud-agent` (Cursor `Task` tool present, start_agent + WARP_* + spawn_subagent absent), treat as **Tier 1 with the backgrounded Cursor `Task` poller path** (#1877) — NOT Tier 3. Cursor's `Task` tool is a first-class sub-agent primitive; degrading a Cursor session to the Approach-3 blocking poll is the misclassification #1877 closes. If the descriptor is `openclaw` (`sessions_spawn` present), treat as **Tier 1 with the backgrounded `sessions_spawn` poller path** (#2876) — NOT Approach 2 cron and NOT main-session gh poll.
|
|
371
|
+
! Detection: use the full runtime capability matrix (swarm Phase 3 + launch adapter from #1342 slice 2). The old single-probe for `start_agent` is superseded; the returned platform descriptor determines both the orchestration path and the MCP surface (see MCP probe below). If the descriptor is `grok-build` (spawn_subagent present, start_agent + WARP_* absent), treat as Tier 1 with the spawn_subagent poller path. If the descriptor is `cursor-composer` / `cursor-cloud-agent` (Cursor `Task` tool present, start_agent + WARP_* + spawn_subagent absent), treat as **Tier 1 with the backgrounded Cursor `Task` poller path** (#1877) — NOT Tier 3. Cursor's `Task` tool is a first-class sub-agent primitive; degrading a Cursor session to the Approach-3 blocking poll is the misclassification #1877 closes. If the descriptor is `claude-code` (Claude-unique `Agent` / `CLAUDECODE` / `DEFT_PROBE_CLAUDE_CODE` signals), treat as **Tier 1 with the backgrounded Claude Code `Agent` poller path** (#3134) — NOT Tier 3 and NOT `cursor-composer` (bare `Task` is not a Claude-unique signal). If the descriptor is `openclaw` (`sessions_spawn` present), treat as **Tier 1 with the backgrounded `sessions_spawn` poller path** (#2876) — NOT Approach 2 cron and NOT main-session gh poll.
|
|
372
372
|
|
|
373
373
|
! Swarm agents (whether launched via `start_agent`, `spawn_subagent`, or OpenClaw `sessions_spawn` 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.
|
|
374
374
|
|
|
375
|
-
! **Deterministic review-monitor gate (#2655 / #2814 / #2876 / #2893):** When Tier 1 is available **and** a dual-invoke probe succeeds for review-monitor verbs (`deft verify:review-monitor` / `deft review-monitor:register`, or `task deft:verify:review-monitor` / `task deft:review-monitor:register`), run that verify form before yielding, entering Approach 3, or claiming review monitoring started — CLI: `deft verify:review-monitor --pr <N> [--call-site solo]`; task: `task deft:verify:review-monitor -- --pr <N> [--call-site solo]`. After spawning Approach 1, claim the PR-anchored lease with the matching register form (CLI: `deft review-monitor:register --pr <N> --monitor-agent-id <id> --platform-primitive ...`; task: `task deft:review-monitor:register -- --pr <N> --monitor-agent-id <id> --platform-primitive start_agent|spawn_subagent|cursor-task|sessions_spawn|openclaw-sessions-spawn`). Release with the matching release form (CLI: `deft review-monitor:release --pr <N>`; task: `task deft: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.
|
|
375
|
+
! **Deterministic review-monitor gate (#2655 / #2814 / #2876 / #2893):** When Tier 1 is available **and** a dual-invoke probe succeeds for review-monitor verbs (`deft verify:review-monitor` / `deft review-monitor:register`, or `task deft:verify:review-monitor` / `task deft:review-monitor:register`), run that verify form before yielding, entering Approach 3, or claiming review monitoring started — CLI: `deft verify:review-monitor --pr <N> [--call-site solo]`; task: `task deft:verify:review-monitor -- --pr <N> [--call-site solo]`. After spawning Approach 1, claim the PR-anchored lease with the matching register form (CLI: `deft review-monitor:register --pr <N> --monitor-agent-id <id> --platform-primitive ...`; task: `task deft:review-monitor:register -- --pr <N> --monitor-agent-id <id> --platform-primitive start_agent|spawn_subagent|cursor-task|claude-agent|sessions_spawn|openclaw-sessions-spawn`). Release with the matching release form (CLI: `deft review-monitor:release --pr <N>`; task: `task deft: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.
|
|
376
376
|
|
|
377
377
|
! **Missing review-monitor surface carve-out (#2878 / #2893):** When dual-invoke probes fail for `pr:watch` **and** `review-monitor:*` (no `deft` CLI, no `task deft:` include), do **not** invoke those gates and do **not** block Approach 1 on them. Fail-loud once with `missing-task: review-monitor` / `missing-task: pr:watch`, then:
|
|
378
378
|
1. Still spawn Approach 1 with the official gh-only fallback when a sub-agent primitive exists.
|
|
@@ -389,18 +389,20 @@ Remediation:
|
|
|
389
389
|
|
|
390
390
|
! **Cursor leaf boundary (#2797 / #2893):** 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 `deft pr:watch <N>` (or `task deft:pr:watch -- <N>` when include-present), or its envelope MUST instead be `stop-at: pr-open` so the orchestrator can spawn and register a sibling review-monitor. A background shell `pr:watch` is not a monitor and MUST NOT be claimed as one.
|
|
391
391
|
|
|
392
|
+
! **Claude Code leaf boundary (#3134 / #2797 analogue):** Nested `Agent` (implementation leaf spawning a second-level review-monitor Agent) is unsupported/unreliable on some Claude Code surfaces. A Claude Code `drive-to: merge-ready` leaf MUST either keep ownership in the same agent by blocking on `deft pr:watch <N>` (or `task deft:pr:watch -- <N>` when include-present), or its envelope MUST instead be `stop-at: pr-open` so the orchestrator can spawn and register a sibling review-monitor with `--platform-primitive claude-agent`. ⊗ Background a nested Agent poller from an implementation leaf and exit claiming monitoring is active. Top-level parents/orchestrators that own the `Agent` primitive MAY still Approach-1 background a review-monitor Agent.
|
|
393
|
+
|
|
392
394
|
**Approach 1 (preferred -- sub-agent orchestration available per platform descriptor):**
|
|
393
395
|
|
|
394
|
-
! **Background dispatch (#1880 / #2876):** 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; OpenClaw: `sessions_spawn` with parent yielding). The parent MUST remain interactive while the poller runs — never block the parent OpenClaw/Cursor/Grok session for >~3 min of monitor ownership.
|
|
396
|
+
! **Background dispatch (#1880 / #2876 / #3134):** Spawn the review-monitor sub-agent via the matching primitive IN THE BACKGROUND (Cursor: Task `run_in_background: true`; Claude Code: `Agent` `run_in_background: true`; Grok Build: `spawn_subagent` with parent yielding; OpenClaw: `sessions_spawn` with parent yielding). The parent MUST remain interactive while the poller runs — never block the parent OpenClaw/Cursor/Claude Code/Grok session for >~3 min of monitor ownership.
|
|
395
397
|
|
|
396
|
-
! **Heartbeat contract for Cursor pollers (#1877 / #1166 / #2876):** OpenClaw sessions_spawn pollers share this contract. A Cursor `Task` or OpenClaw `sessions_spawn` review-monitor poller whose loop runs > ~3 min MUST honour the sub-agent heartbeat contract (`docs/subagent-heartbeat.md`), same as the `spawn_subagent` path — emit periodic progress so the parent can distinguish a live poller from a hung one.
|
|
398
|
+
! **Heartbeat contract for Cursor pollers (#1877 / #1166 / #2876 / #3134):** Claude Code `Agent` and OpenClaw `sessions_spawn` pollers share this contract. A Cursor `Task`, Claude Code `Agent`, or OpenClaw `sessions_spawn` review-monitor poller whose loop runs > ~3 min MUST honour the sub-agent heartbeat contract (`docs/subagent-heartbeat.md`), same as the `spawn_subagent` path — emit periodic progress so the parent can distinguish a live poller from a hung one.
|
|
397
399
|
|
|
398
400
|
~ **Visible Control UI (OpenClaw / #3044):** When OpenClaw Control UI is the operator control plane, SHOULD spawn the review-monitor with `visible:true` when the tool surface allows so humans can inspect progress without attaching to the parent session; invisible empty settles are higher FC04 residual risk.
|
|
399
401
|
|
|
400
402
|
! When the platform descriptor indicates Tier 1 (sub-agent support), spawn a review-monitor sub-agent using the primitive matching the descriptor:
|
|
401
403
|
|
|
402
|
-
1. ! Launch via the matching primitive: `start_agent` (Warp), `spawn_subagent` (grok-build / TUI / non-Warp), the Cursor `Task` tool with `run_in_background: true` (`cursor-composer` / `cursor-cloud-agent`, #1877), **or OpenClaw `sessions_spawn` (`openclaw`, #2876)** with a prompt that instructs it to poll for Greptile completion. For `spawn_subagent`, Cursor `Task`, and OpenClaw `sessions_spawn` the prompt MUST reference the canonical poller template `templates/swarm-greptile-poller-prompt.md` (with placeholders filled) plus the agent preamble; the working directory / context must be the PR branch (worktree or equivalent for hybrid).
|
|
403
|
-
2. ! The sub-agent polls using the mechanism for its primitive: for `spawn_subagent` use `get_command_or_subagent_output` (adaptive cadence: ~20-30s first check after push, ~60s second, ~90s thereafter; Greptile typically lands in 3-7 min); for `start_agent` the native messaging path; for the Cursor `Task` tool the backgrounded-task completion-notification path; for OpenClaw `sessions_spawn` the host session completion / messaging channel (prefer `task pr:watch` inside the child when available). Front-load the first check to catch fast reviews.
|
|
404
|
+
1. ! Launch via the matching primitive: `start_agent` (Warp), `spawn_subagent` (grok-build / TUI / non-Warp), the Cursor `Task` tool with `run_in_background: true` (`cursor-composer` / `cursor-cloud-agent`, #1877), the Claude Code `Agent` tool with `run_in_background: true` (`claude-code` / register `claude-agent`, #3134), **or OpenClaw `sessions_spawn` (`openclaw`, #2876)** with a prompt that instructs it to poll for Greptile completion. For `spawn_subagent`, Cursor `Task`, Claude Code `Agent`, and OpenClaw `sessions_spawn` the prompt MUST reference the canonical poller template `templates/swarm-greptile-poller-prompt.md` (with placeholders filled) plus the agent preamble; the working directory / context must be the PR branch (worktree or equivalent for hybrid).
|
|
405
|
+
2. ! The sub-agent polls using the mechanism for its primitive: for `spawn_subagent` use `get_command_or_subagent_output` (adaptive cadence: ~20-30s first check after push, ~60s second, ~90s thereafter; Greptile typically lands in 3-7 min); for `start_agent` the native messaging path; for the Cursor `Task` tool the backgrounded-task completion-notification path; for Claude Code `Agent` the backgrounded-agent completion-notification path; for OpenClaw `sessions_spawn` the host session completion / messaging channel (prefer `task pr:watch` inside the child when available). Front-load the first check to catch fast reviews.
|
|
404
406
|
3. ! When the exit condition is met (Greptile review current on the HEAD commit SHA, confidence meets resolved min (policy/dogfood/default; see Step 6 #3095), no P0/P1 remaining), the sub-agent reports completion back to the parent (via `send_message_to_agent`, the spawn_subagent result channel, or the OpenClaw sessions completion channel).
|
|
405
407
|
4. ! The main conversation pane stays fully interactive during monitoring -- the user (or parent monitor) can continue other work.
|
|
406
408
|
5. ! On receiving the completion message / result, the parent re-fetches findings (both gh pr view --comments and the secondary source) and proceeds to Step 5.
|
|
@@ -427,7 +429,7 @@ Remediation:
|
|
|
427
429
|
|
|
428
430
|
! **One sticky lease per PR:** ownership is the single sticky GitHub PR comment `<!-- deft:review-owner -->` (or the dual-invoke `review-monitor:register` form that writes it). Parallel ownership is forbidden.
|
|
429
431
|
|
|
430
|
-
! **Pre-spawn check:** before launching another Approach 1 review-monitor (`sessions_spawn`, `spawn_subagent`, Cursor `Task`, `start_agent`):
|
|
432
|
+
! **Pre-spawn check:** before launching another Approach 1 review-monitor (`sessions_spawn`, `spawn_subagent`, Cursor `Task`, Claude Code `Agent`, `start_agent`):
|
|
431
433
|
|
|
432
434
|
1. ! Read the sticky lease (dual-invoke `verify:review-monitor` when available, else `gh api` issues comments for `<!-- deft:review-owner -->`).
|
|
433
435
|
2. ! List active same-PR / same-`taskName` subagents when the host exposes that surface (OpenClaw `subagents list` or equivalent).
|
|
@@ -642,6 +644,8 @@ task lifecycle:event -- emit plan:approved \
|
|
|
642
644
|
- ⊗ Route PR shepherding to Cursor global `babysit` on Deft-managed repos when `.deft/core/` is installed -- use this review-cycle skill instead (#2261)
|
|
643
645
|
- ⊗ Route OpenClaw babysit/shepherd/watch to main-session gh poll + cron when `sessions_spawn` is available -- use Approach 1 with `sessions_spawn` (#2876 / #2261)
|
|
644
646
|
- ⊗ Treat OpenClaw `cron` alone as Approach 1 — cron/timer is Approach 2 only if spawn is unavailable (#2876)
|
|
647
|
+
- ⊗ Route Claude Code babysit/shepherd/watch to Approach 3 blocking poll when Claude `Agent` spawn is available — use Approach 1 with backgrounded `Agent` / `claude-agent` (#3134)
|
|
648
|
+
- ⊗ Misclassify Claude Code as `cursor-composer` from bare `Task` alone (#3134)
|
|
645
649
|
- ⊗ Expand active story scope past xBRIEF AC mid-babysit without follow-up issue or consented brief amend (#2881)
|
|
646
650
|
- ⊗ Treat confidence-only holds (0 P0/P1) as a mandate for unbounded redesign (#2881)
|
|
647
651
|
- ⊗ Invent freestyle sleep/poll loops when dual-invoke probes fail for `pr:watch` — use the official gh-only fallback and fail-loud missing-task (#2878 / #2893)
|
|
@@ -675,4 +679,4 @@ task lifecycle:event -- emit plan:approved \
|
|
|
675
679
|
- ⊗ Spawn a second review-monitor while prior owner is running or last settle was empty/unknown without terminal ground truth (#3044)
|
|
676
680
|
- ⊗ Accept empty review-monitor final message missing STATUS/HEAD/CHECKS/MERGE handback (#3044)
|
|
677
681
|
- ⊗ Invent remote PR/SHA/CI/review claims in handoff evidence without same-turn probe binding — invented-done (#3120)
|
|
678
|
-
- ⊗ Fill remote ship/gate fields from memory when only local work completed; legal partial omits PR fields (#3120)
|
|
682
|
+
- ⊗ Fill remote ship/gate fields from memory when only local work completed; legal partial omits PR fields (#3120)
|
|
@@ -69,6 +69,7 @@ Large multi-host skills use a **host-neutral core** plus **one** per-host adapte
|
|
|
69
69
|
|---------------------|-----------------|--------------|
|
|
70
70
|
| `warp-orchestrated` / `warp-manual` | `start_agent` / Warp tabs | [`references/host-warp.md`](references/host-warp.md) |
|
|
71
71
|
| `cursor-composer` / `cursor-cloud-agent` | Cursor `Task` | [`references/host-cursor.md`](references/host-cursor.md) |
|
|
72
|
+
| `claude-code` | Claude `Agent` (`run_in_background`) / `claude-agent` | [`references/host-claude-code.md`](references/host-claude-code.md) |
|
|
72
73
|
| `openclaw` | `sessions_spawn` | [`references/host-openclaw.md`](references/host-openclaw.md) |
|
|
73
74
|
| `grok-build` | `spawn_subagent` | [`references/host-grok-build.md`](references/host-grok-build.md) |
|
|
74
75
|
| `generic-terminal` (or explicit cloud) | serial / paste / `oz agent run-cloud` | [`references/host-generic.md`](references/host-generic.md) |
|
|
@@ -104,16 +105,21 @@ Large multi-host skills use a **host-neutral core** plus **one** per-host adapte
|
|
|
104
105
|
⊗ End the turn with only narrative “I will spawn…” / “review next” and zero tools (#2934).
|
|
105
106
|
~ Keep a small phase-state note: `cohort_id → phase → next_action|terminal`.
|
|
106
107
|
|
|
107
|
-
### Parent-monitor after leaf announce (#2943)
|
|
108
|
+
### Parent-monitor after leaf announce (#2943 / hard-stop #3131)
|
|
108
109
|
|
|
109
|
-
! After any leaf completion event (`subagent_announce` / parent-push / host completion notify), the parent’s **first response** MUST be
|
|
110
|
-
- tool-first ground-truth batch (`gh` / `git` / worktree or file status), **or**
|
|
111
|
-
- host yield (`sessions_yield` on OpenClaw, or equivalent)
|
|
110
|
+
! After any leaf completion event (`subagent_announce` / parent-push / host completion notify), the parent’s **first response** MUST be one of:
|
|
111
|
+
- tool-first ground-truth batch (`gh` / `git` / worktree or file status) then one consolidate, **or**
|
|
112
|
+
- host yield (`sessions_yield` on OpenClaw, or equivalent), **or**
|
|
113
|
+
- one short user answer that is **not** a repeated progress line.
|
|
114
|
+
|
|
115
|
+
! **Hard-stop (machine-checkable, not prose-only):** **MUST NOT** emit N>2 near-identical assistant sentences (or streaming text chunks) in one turn with no `tool_use` / yield — **FC14** text-repetition hang. Library: `evaluateParentTurnShape` in `@deftai/directive-core/parent-turn-shape` (`packages/core/src/parent-turn-shape/`). Hosts SHOULD abort the turn when `ok === false`. Operator recovery: `docs/openclaw-agent-host.md` § Operator recovery — FC14. Soft skill text is **not** sole mitigation (#3131).
|
|
112
116
|
|
|
113
117
|
! **Thin DONE = failed leaf:** completion without PR URL / merge evidence is **failed** (re-dispatch or take over) — not success. Prefer structured fields when present (`prUrl`, `mergeStatus`, `emptyDiff`).
|
|
114
118
|
|
|
115
119
|
⊗ Multi-sentence progress-only first response after announce with zero tools / yield (#2943 text-repetition hang).
|
|
120
|
+
⊗ N>2 near-identical assistant sentences with no tool_use / yield (FC14 / #3131 hard-stop).
|
|
116
121
|
⊗ Treat thin DONE (no PR URL / merge evidence) as success (#2943).
|
|
122
|
+
⊗ Rely on soft skill prose alone as the sole mitigation for the parent hang (#3131).
|
|
117
123
|
|
|
118
124
|
|
|
119
125
|
|
|
@@ -127,15 +133,17 @@ Large multi-host skills use a **host-neutral core** plus **one** per-host adapte
|
|
|
127
133
|
|
|
128
134
|
1. ! **Probe for `start_agent` tool** — Warp orchestrated.
|
|
129
135
|
2. ! **Probe for Warp environment** — `WARP_*` without `start_agent` → warp-manual.
|
|
130
|
-
3. ! **Probe for the Cursor `Task` tool** — Tier 1; descriptor `cursor-composer` / `cursor-cloud-agent` (#1877).
|
|
131
|
-
4. ! **Probe for
|
|
132
|
-
5. ! **Probe for `
|
|
133
|
-
6. ! **
|
|
134
|
-
7. ! **
|
|
135
|
-
8.
|
|
136
|
+
3. ! **Probe for the Cursor `Task` tool** — Tier 1; descriptor `cursor-composer` / `cursor-cloud-agent` (#1877). Require Cursor signals (`CURSOR_*` or Cursor-only Task surface) — not bare `Task` alone.
|
|
137
|
+
4. ! **Probe for Claude Code** — Tier 1; descriptor `claude-code` (#3134). Claude-unique signals only: `Agent` (or `CreateAgent` / `SubagentStart`) with background / `run_in_background`, and/or `DEFT_PROBE_CLAUDE_CODE` / `DEFT_AGENT_RUNTIME=claude-code` / `CLAUDECODE`. ⊗ Misclassify as `cursor-composer` via bare `Task`.
|
|
138
|
+
5. ! **Probe for the OpenClaw `sessions_spawn` tool** — Tier 1; descriptor `openclaw` (#2875). Do NOT misclassify as `grok-build` or `generic-terminal`.
|
|
139
|
+
6. ! **Probe for `spawn_subagent` tool** — descriptor `grok-build`.
|
|
140
|
+
7. ! **Select launch path automatically** — load the matching host adapter (route table). No static A/B/C menu.
|
|
141
|
+
8. ! **Return a stable platform descriptor** for Phase 4/6: `warp-orchestrated`, `warp-manual`, `cursor-composer`, `cursor-cloud-agent`, `claude-code`, `openclaw`, `grok-build`, or `generic-terminal`.
|
|
142
|
+
9. ? **Cloud escape hatch** — `oz agent run-cloud` only on explicit user request (host-generic).
|
|
136
143
|
|
|
137
144
|
⊗ Present static launch options instead of detecting capabilities at runtime.
|
|
138
145
|
⊗ Offer Warp-specific launch paths when not inside Warp.
|
|
146
|
+
⊗ Classify Claude Code as `cursor-composer` / `generic-terminal` when Claude-unique signals are present (#3134).
|
|
139
147
|
|
|
140
148
|
## Phase overview
|
|
141
149
|
|
|
@@ -157,11 +165,14 @@ Large multi-host skills use a **host-neutral core** plus **one** per-host adapte
|
|
|
157
165
|
- ⊗ Parallel OpenClaw `sessions_spawn` on shared repo root without worktrees (#2929)
|
|
158
166
|
- ⊗ Prose-only phase handoff after cohort complete (“I will spawn…”) (#2934)
|
|
159
167
|
- ⊗ Multi-sentence progress-only first response after leaf announce with zero tools / yield (#2943)
|
|
168
|
+
- ⊗ N>2 near-identical assistant sentences with no tool_use / yield (FC14 / #3131 hard-stop)
|
|
160
169
|
- ⊗ Treat thin DONE (no PR URL / merge evidence) as success (#2943)
|
|
170
|
+
- ⊗ Rely on soft skill prose alone as the sole parent-hang mitigation (#3131)
|
|
161
171
|
- ⊗ Second+ user-visible consolidate for the same child runId without new evidence (#3092)
|
|
162
172
|
- ⊗ Assign overlapping files to multiple agents
|
|
163
173
|
- ⊗ Merge before Greptile exit condition (score > 3, no P0/P1)
|
|
164
174
|
- ⊗ Skip Phase 0 approval before Phase 1
|
|
165
175
|
- ⊗ Misclassify OpenClaw `sessions_spawn` as `grok-build` or `generic-terminal` (#2875)
|
|
176
|
+
- ⊗ Misclassify Claude Code as `cursor-composer` / `generic-terminal` (#3134)
|
|
166
177
|
|
|
167
|
-
Full anti-pattern list: [`references/core-ops.md`](references/core-ops.md).
|
|
178
|
+
Full anti-pattern list: [`references/core-ops.md`](references/core-ops.md).
|
|
@@ -141,7 +141,8 @@ CONSTRAINTS:
|
|
|
141
141
|
- ⊗ Load all host adapters “just in case” — detect host, then load core + **one** `references/host-*.md` only (#2928)
|
|
142
142
|
- ⊗ DIY parallel `sessions_spawn` (or any multi-leaf OpenClaw dispatch) on the shared repo root without worktree prep or a worktree-map (#2929)
|
|
143
143
|
- ⊗ End a cohort phase-boundary turn with only narrative “I will spawn…” / “review next” and zero next-phase tool calls and no explicit terminal status (`blocked` / `awaiting-human` / `done`) (#2934)
|
|
144
|
-
- ⊗ Multi-sentence progress-only first response after leaf completion announce (`subagent_announce` / parent-push) with zero tools / yield — tool-first ground-truth batch
|
|
144
|
+
- ⊗ Multi-sentence progress-only first response after leaf completion announce (`subagent_announce` / parent-push) with zero tools / yield — tool-first ground-truth batch, host yield, or one short non-repeated answer only (#2943 text-repetition hang)
|
|
145
|
+
- ⊗ N>2 near-identical assistant sentences in one turn with no tool_use / yield — FC14 hard-stop (`evaluateParentTurnShape` in `packages/core/src/parent-turn-shape/`; soft prose not sole mitigation) (#3131 / #2943)
|
|
145
146
|
- ⊗ Treat thin DONE (completion without PR URL / merge evidence) as success — re-dispatch or take over after ground truth (#2943)
|
|
146
147
|
- ⊗ Second+ user-visible consolidate / final for the same child `runId` / settle batch without new evidence or principal reopen — completion latch silent-replay path (`templates/agent-prompt-preamble.md` §11.5 / #3092)
|
|
147
148
|
- ⊗ Full dual-source re-QC solely because the harness re-delivered the same settle event (#3092)
|
|
@@ -62,26 +62,18 @@ Loop body, per candidate (top-of-queue first):
|
|
|
62
62
|
3. On `yes` -- promote via the canonical lifecycle verb:
|
|
63
63
|
|
|
64
64
|
```pwsh path=null start=null
|
|
65
|
-
# D18 #1136
|
|
66
|
-
#
|
|
67
|
-
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
# file path rather than the issue-number shortcut.
|
|
71
|
-
task scope:promote xbrief/proposed/<file>.xbrief.json
|
|
72
|
-
# TODO(#1136): when D18 ships, replace the two-step (resolve file from #N,
|
|
73
|
-
# then pass to `task scope:promote`) with the deterministic one-step
|
|
74
|
-
# `task scope:promote --from-issue=<N>` invocation. The integration point
|
|
75
|
-
# is this Phase 0c loop body; the operator-facing prompt collapses from
|
|
76
|
-
# "Promote #<N>? [resolved to <path>]" to "Promote #<N>?" with the path
|
|
77
|
-
# resolution done inside the task.
|
|
65
|
+
# D18 #1136: promote by issue number (provenance locates proposed/ artifact;
|
|
66
|
+
# gates on latest candidates.jsonl decision == accept).
|
|
67
|
+
task scope:promote -- --from-issue=<N> [--repo OWNER/NAME]
|
|
68
|
+
# Path form remains valid for refinement scaffolds / disambiguation:
|
|
69
|
+
# task scope:promote -- xbrief/proposed/<file>.xbrief.json
|
|
78
70
|
```
|
|
79
71
|
|
|
80
72
|
Re-run `task triage:summary` (or read the post-promote count directly) to refresh the `pending/ + active/` total before the next loop iteration.
|
|
81
73
|
4. On `skip` -- drop this candidate from the current session's cohort; it stays in the queue for the next session. Advance to the next ranked candidate.
|
|
82
74
|
5. On `stop` -- exit the loop early; the partial cohort proceeds to Phase 0d.
|
|
83
75
|
|
|
84
|
-
! **D18 #1136
|
|
76
|
+
! **D18 #1136**: prefer `task scope:promote -- --from-issue=<N>` in this Phase 0c loop so the monitor does not resolve the xBRIEF path by hand. Path-based `task scope:promote -- <file>` remains for scaffolds and multi-match disambiguation (`--path`). Non-accept latest decisions refuse unless `--force-no-cache`; missing decision soft-warns (`--strict` hard-fails).
|
|
85
77
|
|
|
86
78
|
! **WIP-cap exit-clean prose**: When WIP cap is reached, swarm Phase 0 stops adding to the cohort and exits cleanly with a count of what was filled. Operator can demote (D1 / #1121, `task scope:demote <existing>` or `task scope:demote --batch --older-than-days 30`) to free slots or `--force` to override (the override is audit-logged as `wip_cap_override` in `xbrief/.eval/scope-lifecycle.jsonl` per D4 / #1124).
|
|
87
79
|
|
|
@@ -25,18 +25,20 @@
|
|
|
25
25
|
|
|
26
26
|
1. ! **Probe for `start_agent` tool** — check the available tool set for `start_agent` (or equivalent agent-orchestration tool). Its presence indicates a Warp environment with native orchestration support.
|
|
27
27
|
2. ! **Probe for Warp environment** — if `start_agent` is not available, check for `WARP_*` environment variables (e.g. `WARP_TERMINAL_SESSION`, `WARP_IS_WARP_TERMINAL`). Their presence indicates Warp without orchestration.
|
|
28
|
-
3. ! **Probe for the Cursor `Task` tool** — when neither `start_agent` nor `WARP_*` is present, check the tool set for the Cursor `Task` sub-agent tool (dispatchable in the background via `run_in_background: true`). Its presence indicates a Cursor environment with a **first-class Tier-1 sub-agent primitive** (#1877). Classify as `cursor-composer` for an interactive Composer session and `cursor-cloud-agent` for a Cursor cloud agent. Cursor is **Tier 1 → Approach 1** — do NOT let it fall through to `generic-terminal` / the Approach-3 blocking poll.
|
|
29
|
-
4. ! **Probe for
|
|
30
|
-
5. ! **Probe for `
|
|
31
|
-
6. ! **
|
|
28
|
+
3. ! **Probe for the Cursor `Task` tool** — when neither `start_agent` nor `WARP_*` is present, check the tool set for the Cursor `Task` sub-agent tool (dispatchable in the background via `run_in_background: true`) **with Cursor signals** (`CURSOR_COMPOSER` / `CURSOR_AGENT` or Cursor-only Task surface). Its presence indicates a Cursor environment with a **first-class Tier-1 sub-agent primitive** (#1877). Classify as `cursor-composer` for an interactive Composer session and `cursor-cloud-agent` for a Cursor cloud agent. Cursor is **Tier 1 → Approach 1** — do NOT let it fall through to `generic-terminal` / the Approach-3 blocking poll. ⊗ Classify from bare `Task` alone when Claude Code also exposes a similarly named tool (#3134).
|
|
29
|
+
4. ! **Probe for Claude Code** — when none of `start_agent`, `WARP_*`, or Cursor-classified `Task` is present, check for **Claude-unique** signals: the Claude Code `Agent` tool (or host-equivalent `CreateAgent` / `SubagentStart`) with background / `run_in_background: true`, and/or env `DEFT_PROBE_CLAUDE_CODE` / `DEFT_HAS_CLAUDE_AGENT` / `DEFT_AGENT_RUNTIME=claude-code` / `CLAUDECODE`. Classify as descriptor `claude-code`. Claude Code is **Tier 1 → Approach 1** (#3134) — do NOT misclassify as `cursor-composer` (bare `Task`) or fall through to `generic-terminal`. Engine env probe: `packages/core/src/review-monitor/tier-detection.ts` `probeMonitoringTier` (ordered after Cursor, before OpenClaw).
|
|
30
|
+
5. ! **Probe for the OpenClaw `sessions_spawn` tool** — when none of `start_agent`, `WARP_*`, Cursor, or Claude Code is present, check the tool set for OpenClaw `sessions_spawn` (optional `visible` flag). Its presence indicates an OpenClaw environment with a **first-class Tier-1 sub-agent primitive** (#2875). Classify as descriptor `openclaw`. OpenClaw is **Tier 1 → Approach 1** — do NOT misclassify it as `grok-build` (that uses `spawn_subagent`) or fall through to `generic-terminal`.
|
|
31
|
+
6. ! **Probe for `spawn_subagent` tool** — when none of `start_agent`, `WARP_*`, Cursor, Claude Code, or OpenClaw `sessions_spawn` is present, check for `spawn_subagent` (Grok Build / non-Warp TUI launch adapter, #1342 slice 2). Its presence indicates the grok-build platform.
|
|
32
|
+
7. ! **Select launch path automatically** based on detection results — do NOT present static options:
|
|
32
33
|
- **`start_agent` available** → Orchestrated launch (Step 2a) — preferred path, fully automated, no manual tab management
|
|
33
34
|
- **`start_agent` unavailable, Warp detected** → Interactive Warp tabs (Step 2b) — full MCP, global rules, warm index; requires manual tab management
|
|
34
35
|
- **Cursor `Task` tool available (no `start_agent`, no `WARP_*`)** → Cursor sub-agent launch (Step 2e) via the `Task` tool with `run_in_background: true` (Tier 1 / Approach 1) — keeps the monitor pane interactive; descriptor is `cursor-composer` (interactive) or `cursor-cloud-agent` (cloud)
|
|
35
|
-
- **
|
|
36
|
-
-
|
|
36
|
+
- **Claude Code available (no `start_agent`, no `WARP_*`, no Cursor classification)** → Claude Code launch (Step 2g) via `Agent` with `run_in_background: true` (Tier 1 / Approach 1) — descriptor is `claude-code` (#3134)
|
|
37
|
+
- **OpenClaw `sessions_spawn` available (no `start_agent`, no `WARP_*`, no Cursor, no Claude Code)** → OpenClaw launch (Step 2f) via `sessions_spawn` (Tier 1 / Approach 1) — descriptor is `openclaw`
|
|
38
|
+
- **`grok-build` (`spawn_subagent` available, no earlier Tier-1 primitive)** → Grok Build launch (Step 2d) — first-class non-Warp path
|
|
37
39
|
- **No orchestration primitive detected** → `generic-terminal` degraded launch. Offer a **Serial self-execution downgrade** first: with explicit operator consent, the monitor may execute the prepared worker prompts itself one story at a time from the isolated worktrees. This preserves forward progress but is not true concurrent swarm execution.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
8. ! **Return a stable platform descriptor** for downstream phases — one of `warp-orchestrated` (start_agent available), `warp-manual` (Warp without start_agent), `cursor-composer` (Cursor `Task` tool, interactive Composer), `cursor-cloud-agent` (Cursor `Task` tool, cloud agent), `claude-code` (Claude Code `Agent` / Claude-unique env, #3134), `openclaw` (`sessions_spawn` available, non-Warp, non-Cursor, non-Claude), `grok-build` (spawn_subagent available after earlier primitives absent), or `generic-terminal` (no orchestration primitives). The detection matrix MUST include explicit absence checks for `start_agent`, `WARP_*`, Cursor, Claude Code, and OpenClaw `sessions_spawn` so the descriptors are unambiguous. Phase 4 monitoring and Phase 6 sub-agent dispatch read this stable platform descriptor as a single source of truth instead of re-running detection per call.
|
|
41
|
+
9. ? **Cloud escape hatch** — use `oz agent run-cloud` (Step 2c) ONLY if the user explicitly requests cloud execution. Never default to cloud. (The Cursor `cursor-cloud-agent` descriptor above is distinct — it is a Cursor-native cloud agent detected via the `Task` tool, not the `oz` escape hatch.)
|
|
40
42
|
|
|
41
43
|
! In `generic-terminal` mode, if the operator declines serial self-execution, the manual terminal prompt-paste fallback remains available: the user can paste each generated prompt into any terminal or agent interface with access to the matching worktree. Surface the tradeoff clearly: manual paste preserves user control but requires tab/process management and is still not automated orchestration.
|
|
42
44
|
|
|
@@ -126,7 +128,7 @@ Cross-references: `packages/core/src/swarm/routing.ts` (`SWARM_WORKER_ROLES`), `
|
|
|
126
128
|
|
|
127
129
|
! **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.
|
|
128
130
|
|
|
129
|
-
! **Background / independent dispatch (Gap D):** Dispatch implementation, fix, and review-cycle workers independently / in the background when the platform supports it. On Cursor, use the Task tool background path (`run_in_background: true`); on OpenClaw, use `sessions_spawn` with the host's non-blocking / background session flags so the monitor conversation stays interactive. Foreground dispatch is for short tasks (<~3 min) only.
|
|
131
|
+
! **Background / independent dispatch (Gap D):** Dispatch implementation, fix, and review-cycle workers independently / in the background when the platform supports it. On Cursor, use the Task tool background path (`run_in_background: true`); on Claude Code, use the `Agent` tool with `run_in_background: true` (or host equivalent) (#3134); on OpenClaw, use `sessions_spawn` with the host's non-blocking / background session flags so the monitor conversation stays interactive. Foreground dispatch is for short tasks (<~3 min) only.
|
|
130
132
|
|
|
131
133
|
⊗ Hand back at PR-open and re-dispatch separate review-monitor or fix leaf agents for a worker whose envelope scoped `drive-to: merge-ready` (#1880 Gap C).
|
|
132
134
|
|
|
@@ -138,6 +140,7 @@ Cross-references: `packages/core/src/swarm/routing.ts` (`SWARM_WORKER_ROLES`), `
|
|
|
138
140
|
! After runtime detection (Step 1), load **one** host adapter from the route table in `SKILL.md` and follow its Step 2 launch rules.
|
|
139
141
|
- Warp orchestrated / manual → `references/host-warp.md`
|
|
140
142
|
- Cursor → `references/host-cursor.md`
|
|
143
|
+
- Claude Code → `references/host-claude-code.md`
|
|
141
144
|
- OpenClaw → `references/host-openclaw.md`
|
|
142
145
|
- Grok Build → `references/host-grok-build.md`
|
|
143
146
|
- generic-terminal / cloud escape → `references/host-generic.md`
|
|
@@ -35,7 +35,7 @@ For each agent's PR:
|
|
|
35
35
|
- ⊗ Treat `DONE` without merge-ready verification as success — that is the false-terminal pattern §11 closes.
|
|
36
36
|
- ⊗ Treat thin DONE (no PR URL / merge evidence) as success (#2943).
|
|
37
37
|
|
|
38
|
-
! **Parent tool-first after leaf announce (#2943):** On the first parent turn after a leaf completion event (`subagent_announce` / parent-push / host completion notify), the parent MUST
|
|
38
|
+
! **Parent tool-first after leaf announce (#2943 / hard-stop #3131):** On the first parent turn after a leaf completion event (`subagent_announce` / parent-push / host completion notify), the parent MUST do exactly one of: (a) emit a **tool-first** ground-truth batch (`gh` / `git` / worktree or file status) then one consolidate, (b) **yield** (`sessions_yield` on OpenClaw, or host equivalent), or (c) one short non-repeated user answer. ⊗ Multi-sentence progress-only first response with zero tools / yield — the text-repetition hang class. ⊗ **N>2** near-identical assistant sentences with no `tool_use` / yield (**FC14**). Machine check: `evaluateParentTurnShape` in `packages/core/src/parent-turn-shape/` — soft prose is not sole mitigation (#3131).
|
|
39
39
|
|
|
40
40
|
! **Completion latch after first consolidate (#3092):** After the parent has emitted **one** user/caller-visible consolidate for a child `runId` / settle batch (accept or reject), **identical or equivalent completion replay** for the same key MUST be **silent** (no tools, no re-QC, no second final; host silent token when defined, e.g. OpenClaw `NO_REPLY`). Re-open only on new `runId`/batch, principal explicit reopen, or **materially new** evidence (new HEAD, new blocker class) — not fat re-embeds of the same rollup. Replay storms: at most one fail-loud note, then silent. Full MUST + anti-patterns: `templates/agent-prompt-preamble.md` §11.5. Orthogonal to empty settle ≠ done (#3044).
|
|
41
41
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Host adapter: Claude Code
|
|
2
|
+
|
|
3
|
+
Legend (RFC2119): !=MUST, ~=SHOULD, ≉=SHOULD NOT, ⊗=MUST NOT, ?=MAY.
|
|
4
|
+
|
|
5
|
+
Descriptor: `claude-code` (Claude Code backgroundable sub-agent primitive — commonly the `Agent` tool with `run_in_background: true`). Tier 1 → Approach 1 (#3134).
|
|
6
|
+
|
|
7
|
+
Register primitive: `claude-agent` (`task review-monitor:register -- --platform-primitive claude-agent`).
|
|
8
|
+
|
|
9
|
+
Load this file only after detect selects Claude Code. Do not load other host adapters (#2928).
|
|
10
|
+
|
|
11
|
+
## Detection spike (ordered matrix placement) — #3134
|
|
12
|
+
|
|
13
|
+
! Claude Code MUST be classified with **Claude-unique** signals. ⊗ Classify Claude Code from bare `Task` alone — that misclassifies as `cursor-composer` (or vice versa).
|
|
14
|
+
|
|
15
|
+
### Skill-side ordered probe (tool set + env)
|
|
16
|
+
|
|
17
|
+
Probe order (must match engine `probeMonitoringTier` / `resolveDispatchProvider`):
|
|
18
|
+
|
|
19
|
+
1. `start_agent` → `warp-orchestrated`
|
|
20
|
+
2. `WARP_*` → `warp-manual`
|
|
21
|
+
3. Cursor `Task` **with Cursor signals** (`CURSOR_COMPOSER` / `CURSOR_AGENT` or Cursor-only Task surface) → `cursor-composer` / `cursor-cloud-agent`
|
|
22
|
+
4. **Claude Code** (this descriptor) — see unique signals below → `claude-code`
|
|
23
|
+
5. OpenClaw `sessions_spawn` → `openclaw`
|
|
24
|
+
6. `spawn_subagent` → `grok-build`
|
|
25
|
+
7. else → `generic-terminal` (Tier 3)
|
|
26
|
+
|
|
27
|
+
### Claude-unique signals (any one is sufficient when earlier probes are absent)
|
|
28
|
+
|
|
29
|
+
| Signal | Notes |
|
|
30
|
+
|--------|--------|
|
|
31
|
+
| Tool fingerprint | `Agent` (or host-equivalent `CreateAgent` / `SubagentStart`) with background / `run_in_background: true` — **not** bare `Task` alone |
|
|
32
|
+
| `DEFT_PROBE_CLAUDE_CODE` / `DEFT_HAS_CLAUDE_AGENT` | Explicit framework probe / override |
|
|
33
|
+
| `DEFT_AGENT_RUNTIME=claude-code` (or `claude`) | Explicit runtime stamp |
|
|
34
|
+
| `CLAUDECODE` / `CLAUDE_CODE` | Anthropic sets `CLAUDECODE=1` in Claude Code tool/hook/IDE-terminal subprocesses |
|
|
35
|
+
|
|
36
|
+
! When both Cursor and Claude signals could appear, **Cursor probes win** (earlier in the chain) so Claude never steals a Cursor session.
|
|
37
|
+
|
|
38
|
+
! Engine env probe is env-centric (same pattern as Cursor `CURSOR_*`); skill prose names the tool fingerprint for agents that can see the tool set. Do not widen that skew further.
|
|
39
|
+
|
|
40
|
+
## Launch — Step 2g
|
|
41
|
+
|
|
42
|
+
### Step 2g: Claude Code Launch (`Agent` / background sub-agent available) — #3134
|
|
43
|
+
|
|
44
|
+
! When the platform descriptor is `claude-code` (Claude-unique signals detected; no `start_agent`, no `WARP_*`, no Cursor `CURSOR_*` / Cursor-only Task classification), dispatch each worker via the Claude Code backgroundable sub-agent primitive (commonly `Agent` with `run_in_background: true`) with:
|
|
45
|
+
|
|
46
|
+
1. The canonical `templates/agent-prompt-preamble.md` content as the preamble (AGENTS.md read mandate, #810 xBRIEF gate, #798 PowerShell UTF-8, pre-PR + review-cycle mandates).
|
|
47
|
+
2. The standard worktree prompt (STEP 1-6 from the Prompt Template in `references/core-ops.md`).
|
|
48
|
+
3. The worktree path set to the agent's isolated git worktree.
|
|
49
|
+
4. ! **`run_in_background: true` (or host equivalent)** for any worker or poller whose loop runs longer than a short task (~3 min) — implementation, fix, and review-cycle workers — so the monitor conversation pane stays interactive (#1880 Gap D). The parent is notified on completion.
|
|
50
|
+
5. ! **Deliberate model routing (#1739):** resolve `(dispatch_provider=claude, worker_role)` via `task verify:routing` / `task swarm:routing-set` and pass `resolved_model` into the spawn when non-null — stamping the C2 manifest is prep; the recorded model MUST reach the actual spawn call.
|
|
51
|
+
|
|
52
|
+
~ This is the first-class Claude Code path. It is **Tier 1 → Approach 1** (a backgroundable sub-agent primitive), equivalent in tier to `start_agent` / Cursor `Task` / OpenClaw `sessions_spawn` / `spawn_subagent`; it MUST NOT be misclassified as `cursor-composer` or downgraded to a `generic-terminal` blocking poll.
|
|
53
|
+
|
|
54
|
+
! Claude Code pollers whose loop runs > ~3 min MUST honour the sub-agent heartbeat contract (`docs/subagent-heartbeat.md`, #1166), same as the Cursor / `spawn_subagent` paths.
|
|
55
|
+
|
|
56
|
+
## Nested Agent boundary
|
|
57
|
+
|
|
58
|
+
! Claude Code ownership split (analogue of Cursor #2797 / #2893): Nested `Agent` (implementation leaf spawning leaf) is unsupported/unreliable for an Approach 1 review-monitor. A Claude Code **implementation leaf** MUST NOT nested-spawn a second-level review-monitor via `Agent`. Prefer either:
|
|
59
|
+
|
|
60
|
+
- (a) a `drive-to: merge-ready` leaf that owns a blocking dual-invoke `pr:watch` (`deft pr:watch` then `task deft:pr:watch`) in its own process, or
|
|
61
|
+
- (b) `stop-at: pr-open` with the dispatcher (parent that owns the Agent primitive) launching a sibling monitor and registering it via dual-invoke `review-monitor:register -- --platform-primitive claude-agent`.
|
|
62
|
+
|
|
63
|
+
! Top-level parents/orchestrators that own the `Agent` primitive MAY Approach-1 background a review-monitor Agent (register `claude-agent`).
|
|
64
|
+
|
|
65
|
+
⊗ An implementation leaf backgrounds a nested Agent poller and exits claiming monitoring is active.
|
|
66
|
+
|
|
67
|
+
## Babysit / review-monitor
|
|
68
|
+
|
|
69
|
+
! Babysit / PR shepherd on Claude Code is **Approach 1** via backgrounded `Agent` (`skills/deft-directive-review-cycle/SKILL.md`). Register with `--platform-primitive claude-agent`.
|
|
70
|
+
|
|
71
|
+
! Long review-monitor ownership (>~3 min) MUST NOT block the parent Claude Code session — background `Agent` + parent yield (#1880 Gap D); heartbeats per #1166.
|
|
72
|
+
|
|
73
|
+
⊗ Fall through to Approach 3 blocking `sleep` poll when Claude Code sub-agent spawn is available (#3134).
|
|
74
|
+
⊗ Misclassify Claude Code as `cursor-composer` because a historical surface also exposed a tool named `Task` (#3134).
|
|
75
|
+
|
|
76
|
+
## Monitor / completion channel
|
|
77
|
+
|
|
78
|
+
! Completion is host completion / background-task notify for the Claude Code `Agent` path. Do not poll via Grok Build `get_command_or_subagent_output` or OpenClaw `subagent_announce` unless those primitives are actually present under a different descriptor.
|
|
79
|
+
|
|
80
|
+
! Long pollers MUST honour on-disk heartbeats (`docs/subagent-heartbeat.md`, #1166).
|
|
81
|
+
|
|
82
|
+
! Pre-spawn verification and Duplicate-Agent rules in `references/core-phase-4.md` apply.
|
|
83
|
+
|
|
84
|
+
## Phase handoff (see also core #2934)
|
|
85
|
+
|
|
86
|
+
! After coding cohort complete, same-turn next-phase tool dispatch or explicit terminal status — see `references/core-phase-5-6.md` and the thin SKILL MUST block. ⊗ End the turn with only narrative “I will spawn…”.
|
|
@@ -10,7 +10,7 @@ Load this file only after detect selects Cursor. Do not load other host adapters
|
|
|
10
10
|
|
|
11
11
|
### Step 2e: Cursor Launch (Task tool available) — #1877
|
|
12
12
|
|
|
13
|
-
! When the platform descriptor is `cursor-composer` or `cursor-cloud-agent` (Cursor `Task` tool detected, no `start_agent`, no `WARP_*`, no OpenClaw `sessions_spawn`, no `spawn_subagent`), dispatch each worker via the Cursor `Task` tool with:
|
|
13
|
+
! When the platform descriptor is `cursor-composer` or `cursor-cloud-agent` (Cursor `Task` tool detected with Cursor signals, no `start_agent`, no `WARP_*`, no Claude Code classification, no OpenClaw `sessions_spawn`, no `spawn_subagent`), dispatch each worker via the Cursor `Task` tool with:
|
|
14
14
|
1. The canonical `templates/agent-prompt-preamble.md` content as the preamble (AGENTS.md read mandate, #810 xBRIEF gate, #798 PowerShell UTF-8, pre-PR + review-cycle mandates).
|
|
15
15
|
2. The standard worktree prompt (STEP 1-6 from the Prompt Template below).
|
|
16
16
|
3. The worktree path set to the agent's isolated git worktree.
|
|
@@ -89,14 +89,18 @@ Skill residual of #2874 / #2876 (spawn routing fixed; post-spawn ownership still
|
|
|
89
89
|
! Long pollers MUST honour on-disk heartbeats (`docs/subagent-heartbeat.md`, #1166).
|
|
90
90
|
! Pre-spawn verification and Duplicate-Agent rules in `references/core-phase-4.md` apply; resume the same OpenClaw session when possible rather than spawning a replacement on the same worktree.
|
|
91
91
|
|
|
92
|
-
### Parent-monitor after `subagent_announce` (#2943)
|
|
92
|
+
### Parent-monitor after `subagent_announce` (#2943 / hard-stop #3131)
|
|
93
93
|
|
|
94
|
-
! When a leaf completion arrives via `subagent_announce` (parent-push completion), the parent’s **first response** MUST be
|
|
94
|
+
! When a leaf completion arrives via `subagent_announce` (parent-push completion), the parent’s **first response** MUST be one of:
|
|
95
95
|
|
|
96
|
-
1. ! **Tool-first ground-truth batch** in the same turn: inspect worktrees / open PRs / xBRIEF state via `gh`, `git`, or file reads, **or**
|
|
97
|
-
2. ! **`sessions_yield`** (or host yield) so the Control UI stays steerable without narrating unfinished work
|
|
96
|
+
1. ! **Tool-first ground-truth batch** in the same turn: inspect worktrees / open PRs / xBRIEF state via `gh`, `git`, or file reads, then one consolidate, **or**
|
|
97
|
+
2. ! **`sessions_yield`** (or host yield / wait) so the Control UI stays steerable without narrating unfinished work, **or**
|
|
98
|
+
3. ! **One short user answer** that is **not** a repeated progress line.
|
|
98
99
|
|
|
99
100
|
⊗ Open the first post-announce turn with multi-sentence status narration only (“Checking worktrees and open PRs next…”, “Two leaves look unfinished…”) and zero tool calls / yield — that is the #2943 text-repetition hang class (`stopReason: length` / abort with no tools).
|
|
101
|
+
⊗ Emit **N>2** near-identical assistant sentences (or streaming text chunks) in one turn with no `tool_use` / yield — **FC14** illegal shape; **hard-stop** the turn (#3131). Soft skill prose is not sole mitigation.
|
|
102
|
+
|
|
103
|
+
! **Machine check:** `evaluateParentTurnShape` in `@deftai/directive-core/parent-turn-shape` (`packages/core/src/parent-turn-shape/`). When `failClass` is `FC14` (or post-announce `progress-only-no-tool`), abort / force tool-or-yield. Operator recovery: [`../../docs/openclaw-agent-host.md`](../../docs/openclaw-agent-host.md) § Operator recovery — FC14.
|
|
100
104
|
|
|
101
105
|
! **Thin DONE = failed leaf (#2943):** completion text without PR URL / merge evidence (and not a structured `BLOCKED` / `FAILED` terminal per preamble §11) is a **failed leaf**, not success. After the ground-truth batch, re-dispatch or take over. ⊗ Treat thin DONE as shipped / success.
|
|
102
106
|
|
|
@@ -86,11 +86,11 @@ For each candidate, render the canonical numbered action menu and dispatch:
|
|
|
86
86
|
|
|
87
87
|
```
|
|
88
88
|
What would you like to do with this candidate?
|
|
89
|
-
1. Accept -- `task triage:accept <N
|
|
90
|
-
2. Reject -- `task triage:reject <N
|
|
91
|
-
3. Defer -- `task triage:defer <N> [--resume-on <event>]`
|
|
92
|
-
4. Needs-AC -- `task triage:needs-ac <N
|
|
93
|
-
5. Mark duplicate -- `task triage:mark-duplicate <N> <of-issue
|
|
89
|
+
1. Accept -- `task triage:accept -- --issue <N> --repo OWNER/NAME`
|
|
90
|
+
2. Reject -- `task triage:reject -- --issue <N> --repo OWNER/NAME`
|
|
91
|
+
3. Defer -- `task triage:defer -- --issue <N> --repo OWNER/NAME [--resume-on <event>]`
|
|
92
|
+
4. Needs-AC -- `task triage:needs-ac -- --issue <N> --repo OWNER/NAME`
|
|
93
|
+
5. Mark duplicate -- `task triage:mark-duplicate -- --issue <N> --of <of-issue> --repo OWNER/NAME`
|
|
94
94
|
6. Discuss
|
|
95
95
|
7. Back
|
|
96
96
|
```
|
|
@@ -100,6 +100,7 @@ What would you like to do with this candidate?
|
|
|
100
100
|
- ! On `Back`, un-buffer prior selection and re-render its action menu only before a `task triage:*` dispatch; after dispatch use `task triage:reset`.
|
|
101
101
|
- ~ Bulk: `task triage:bulk-{accept,reject,defer,needs-ac}`; results still flow through the audit log.
|
|
102
102
|
- ⊗ Write to `xbrief/proposed/` directly -- only `task triage:accept` is authorised.
|
|
103
|
+
- ~ **Accept → pending chain (#1136):** `task triage:accept` ingests into **`proposed/`**. To stage into WIP (`pending/`) in one operator action: `task triage:accept -- --issue <N> --repo OWNER/NAME --auto-promote` (WIP cap still enforced; use `--force` on the accept command for WIP override). Separately, promote an already-accepted proposed scope by issue: `task scope:promote -- --from-issue=<N> [--repo OWNER/NAME]` (gates on latest `candidates.jsonl` decision = `accept`; non-accept refuses unless `--force-no-cache`; no decision soft-warns, `--strict` fails). Path-based `task scope:promote -- <file>` remains ungated for refinement scaffolds.
|
|
103
104
|
|
|
104
105
|
## Phase 4 -- Audit
|
|
105
106
|
|
|
@@ -116,6 +117,18 @@ What would you like to do with this candidate?
|
|
|
116
117
|
|
|
117
118
|
! Undo via `task triage:reset <N>` (Layer 5; history never deleted). ⊗ Edit/delete `xbrief/.eval/candidates.jsonl` to "undo".
|
|
118
119
|
|
|
120
|
+
## Quarterly closed-entry archive vs TTL prune (#1137)
|
|
121
|
+
|
|
122
|
+
Live walkers (`triage:queue`, scope-drift, bootstrap) scan `.deft-cache/github-issue/`. Closed issues can linger forever. Operators may run an **explicit, reversible** archive pass — never auto on bootstrap/session/check.
|
|
123
|
+
|
|
124
|
+
| Tool | What it does |
|
|
125
|
+
| --- | --- |
|
|
126
|
+
| `task triage:cache-archive` | Move **closed** + aged (default 30d) entries → `.deft-cache/archived/github-issue/...` with `archive-meta.json`. Skips open lifecycle scopes. `--dry-run` first. |
|
|
127
|
+
| `task triage:archive-list` / `task triage:restore-from-archive` | List / move back to live. |
|
|
128
|
+
| `task cache:prune` | **TTL hard-delete** by `expires_at` — **not** reversible; **not** closed-state archive. |
|
|
129
|
+
|
|
130
|
+
! Prefer archive for closed clutter; use prune only for expired TTL / cap eviction. ⊗ Wire archive into session-start or `task check`.
|
|
131
|
+
|
|
119
132
|
## Anti-Patterns
|
|
120
133
|
|
|
121
134
|
- ⊗ Recommend work without `task triage:queue` (#1149).
|
|
@@ -128,5 +141,5 @@ What would you like to do with this candidate?
|
|
|
128
141
|
|
|
129
142
|
## References
|
|
130
143
|
|
|
131
|
-
- #1119 D6; #1128 D11 (`triage:queue` / `show` / `audit`); #2890 Phase 3 operator brief; #3116 validity + URL-first; #1122 / #1123 / #1127 / #1129 / #1131
|
|
144
|
+
- #1119 D6; #1128 D11 (`triage:queue` / `show` / `audit`); #2890 Phase 3 operator brief; #3116 validity + URL-first; #1122 / #1123 / #1127 / #1129 / #1131; #1136 (`scope:promote --from-issue` / `triage:accept --auto-promote`)
|
|
132
145
|
- Siblings: `deft-directive-refinement`, `deft-directive-swarm`, `deft-directive-sync`
|
package/tasks/cache.yml
CHANGED
|
@@ -77,3 +77,34 @@ tasks:
|
|
|
77
77
|
- task: :engine:invoke
|
|
78
78
|
vars:
|
|
79
79
|
ENGINE_CMD: 'cache prune {{.CLI_ARGS}}'
|
|
80
|
+
|
|
81
|
+
# #1137 — reversible closed-entry archive (NOT TTL prune; never auto-wired)
|
|
82
|
+
archive-closed:
|
|
83
|
+
desc: "Reversible archive of closed github-issue cache entries (#1137). -- task triage:cache-archive -- [--dry-run] [--older-than-days 30] [--repo OWNER/NAME] [--json]"
|
|
84
|
+
dir: '{{.USER_WORKING_DIR}}'
|
|
85
|
+
deps:
|
|
86
|
+
- task: :engine:_ts-build
|
|
87
|
+
cmds:
|
|
88
|
+
- task: :engine:invoke
|
|
89
|
+
vars:
|
|
90
|
+
ENGINE_CMD: 'cache archive-closed --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
|
|
91
|
+
|
|
92
|
+
archive-list:
|
|
93
|
+
desc: "List archived github-issue cache entries (#1137). -- task triage:archive-list -- [--repo OWNER/NAME] [--format=json] [--since ISO] [--limit N]"
|
|
94
|
+
dir: '{{.USER_WORKING_DIR}}'
|
|
95
|
+
deps:
|
|
96
|
+
- task: :engine:_ts-build
|
|
97
|
+
cmds:
|
|
98
|
+
- task: :engine:invoke
|
|
99
|
+
vars:
|
|
100
|
+
ENGINE_CMD: 'cache archive-list --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
|
|
101
|
+
|
|
102
|
+
restore-from-archive:
|
|
103
|
+
desc: "Restore archived github-issue entry to live cache (#1137). -- task triage:restore-from-archive -- --issue N [--repo OWNER/NAME] [--force]"
|
|
104
|
+
dir: '{{.USER_WORKING_DIR}}'
|
|
105
|
+
deps:
|
|
106
|
+
- task: :engine:_ts-build
|
|
107
|
+
cmds:
|
|
108
|
+
- task: :engine:invoke
|
|
109
|
+
vars:
|
|
110
|
+
ENGINE_CMD: 'cache restore-from-archive --project-root "{{.USER_WORKING_DIR}}" {{.CLI_ARGS}}'
|