<!-- AUTO-GENERATED by task packs:render -- DO NOT EDIT MANUALLY -->
<!-- Purpose: rendered skill -->
<!-- Source of truth: packs/skills/skills-pack-0.1.json -->
<!-- Regenerate with: task packs:render -->
<!-- Edit the source, not this file. Slice instead of loading every SKILL.md: task packs:slice skills by-trigger --trigger <kw> (or list) -->
Deft Directive Build
Implements a project from its scope xBRIEFs following Deft Directive standards.
Legend (from RFC2119): !=MUST, ~=SHOULD, ≉=SHOULD NOT, ⊗=MUST NOT, ?=MAY.
When to Use
- After
deft-directive-setupcompletes and generatesPROJECT-DEFINITION.xbrief.json - User says "build this", "implement the spec", or "start building"
- Resuming a partially-built project that has story xBRIEFs in
xbrief/active/
Ordered-plan / cohort exhaustion (#2402)
Multi-scope turn/cache budget (epic #3009)
Multi-scope greenfield (app-bank pins, N story scopes) multiplies agent turns when ceremony, promote, check, and render are re-run per scope. Apply the following after offline seed.
Offline seed vs implement phase (#3010)
! Distinguish offline seed (operator or harness already ran directive init / deposit, pin-copied scopes into xbrief/proposed/, and recorded session ritual) from the agent implement phase.
! When seed + session ritual are already complete for the engagement:
- ⊗ Run
directive initagain - ⊗ Run full cold
session:startunless hooks deny writes and recovery is required - ⊗ Run
directive migrateor re-copy scopes already present - ! Prefer recovery via
session:ready(or re-arm) when PreToolUse denies — not full re-init - ! Documented consumer/harness contract: seed is done once; implement agents only activate+implement
Batch promote; one active implement (#3011)
! For a multi-scope pin, batch-stage scopes with task scope:promote -- --batch (all proposed/) or task scope:promote -- --batch <path>….
! Implement path remains one scope:activate + implement at a time — no multi-active write fence.
! When pin order is known, do not re-list the entire lifecycle tree every scope; walk the known ordered list.
⊗ Activate all scopes at once or drop the one-active-scope / story-ready stack.
Quality check once at end of multi-scope batch (#3012)
! On an approved multi-scope batch (operator-approved multi-story branch, swarm cohort, or pin walk): run the merge chokepoint once at the end of the batch (or after the last scope), not after every scope — prefer deft check; if the CLI is missing, use the tree-correct task form (task deft:check on include-only consumers; task check in framework source). Do not run both.
! Exception: if the last full check failed, fix loops MAY re-run check until green.
! Pre-PR / merge-ready gates remain end-of-unit — this does not weaken them.
! Iteration lane (affected tests / verify:forward-coverage / coverage:hotspots) still applies per scope during implementation (#1704).
⊗ Spam full directive check / task check after every scope when the batch is still mid-flight and the last merge-chokepoint check was green.
One-shot project:render (#3013)
! Greenfield init seeds a minimal render-ready PROJECT-DEFINITION. Treat task project:render as a refresh of items from lifecycle folders, not multi-turn identity research.
⊗ Invent project identity across many turns when seed already stamped the skeleton.
! When processing an approved multi-story cohort or an active ordered-plan sequence, stop after the final approved entry. Do not promote or dispatch adjacent stories from queue intuition. Continuation language advances only within the approved order; skill-chaining is non-authorizing.
Step 0 -- Implementation Preflight (#810)
- ! Before starting any new implementation story or switching from one story to another, MUST run
git status --short --branch. - ! If the working tree is dirty, MUST stop and summarize the current branch, modified/untracked files, and whether the changes appear related to the target story. Ask the operator to choose one path: commit existing work, stash existing work, include existing work in the current story, or stop.
- ⊗ Begin a new story while unrelated dirty work is present without explicit operator approval.
- ! Resolve exactly one target story xBRIEF path by default. One story is the default implementation unit for this skill; if the user asks for a phase/epic, decompose or ask which story to start.
- ! Batching multiple stories in one branch/PR requires explicit operator approval and a short rationale recorded in the handoff.
- ! Swarm-cohort dispatch carve-out: when this skill is invoked as part of a swarm cohort allocated by
skills/deft-directive-swarm/SKILL.md, the approved Phase 5 allocation plan satisfies the "explicit operator approval and short rationale recorded in the handoff" requirement above -- the dispatched xBRIEF paths and allocation rationale ARE the consent token. Process each assigned story sequentially under the checkpoint-commit discipline below. Post-merge completion is in-PR first (task scope:complete -- <active-path> --in-pr, #6277); a story the verb refuses stops at product merge withdeft-story: Nfor the cohort closer (#7082) -- not atask scope:completeafter each story. Do NOT re-prompt the parent for batching approval mid-cohort -- the all-or-nothing dispatch envelope rule (AGENTS.md## Multi-agent orchestration discipline (#954)) forbids mid-scope user-approval gates. - ! Structured consent-token recognition (#1378): the canonical recognition path for the carve-out above is the structured
## Allocation contextsection of the dispatch envelope (the frozen schema intemplates/agent-prompt-preamble.md, Story A of #1378). When that section reportsdispatch_kind: swarm-cohortwith a non-nullallocation_plan_idAND a non-nullbatching_rationale, the consent token is satisfied mechanically -- readcohort_vbriefsas the authoritative file boundary and process each entry sequentially under the checkpoint-commit discipline below (completion per the cohort-closer rule above, #7082), without re-prompting the parent for batching approval mid-cohort. When the## Allocation contextsection is ABSENT (pre-#1378 dispatches, solo-interactive sessions), fall back to the #1371 prose carve-out immediately above -- the prose carve-out remains the recognition path of record for un-elevated envelopes. - ! Within a cohort, between stories: the working tree MUST be clean after each story's checkpoint commit. If
git status --shortshows uncommitted state between stories (e.g. a missed--in-prcompletion move, an unstaged file from the prior story), checkpoint-commit it and proceed -- do NOT pause to ask the operator. The dirty-tree "ask the operator" branch above applies only at the FIRST story-start of a fresh branch, where uncommitted operator work might legitimately exist. - ! If the target story is in
xbrief/proposed/, runtask scope:promote -- <path>first (ortask scope:promote -- --batchfor a multi-scope pin — #3011); if it is inxbrief/pending/, runtask scope:activate -- <path>. After activation, update the path to the active-file location before preflight. - ! Effort estimate gate (#1581): before
task scope:activate/task vbrief:activate, scanplan.items(including nesteditems/subItems) foreffort. Time anchors:S<2h,Mhalf-day (2-4h),L1-2 days,XLneeds breakdown. The activate path fails closed while any item still haseffort: "XL"— break XL work into S/M/L items (or re-estimate) first. Omittedeffortremains valid (field is optional). Plan-item effort is post-planning authority (confirms/corrects intake estimates); it is not session-start ritual input — ceremony depth (#3214) uses two-stage rapid→escalate, not a required plan-item read at cold start. Headless: no operator confirm. Depth:vbrief/vbrief.md§ Effort estimate. - ⊗ Activate a scope that still carries plan items with
effort: "XL"— XL means "not ready to start" until broken down (#1581). - ⊗ Require plan-item
effortto choose session-start ritual depth — estimates do not exist until after planning (#1581 / #3214). - ! Before any code-writing tool call -- the first scaffold edit, the first
taskinvocation that mutates files, or anystart_agentdispatch that will implement scope -- MUST runtask xbrief:preflight -- <active-story-path>(the structural intent gate; the same invocation works whether deft is the project root or installed as adeft/subdirectory).
The gate exits 0 only when the candidate xBRIEF lives in xbrief/active/ AND plan.status == "running". Any other state (pending/, proposed/, completed/, active/-with-non-running-status, malformed JSON, missing keys) exits 1 with an actionable redirect to task xbrief:activate <path>.
- ! A non-zero exit MUST halt the skill. Surface the helper's stderr message verbatim to the user; do NOT proceed to USER.md Gate, File Reading, or any later phase.
- ! Use canonical lifecycle tasks to satisfy this gate:
task scope:promote -- <path>for proposed stories,task scope:activate -- <path>for pending stories, and the helper's idempotent companiontask xbrief:activate <path>only when following the preflight redirect directly. Manual lifecycle moves bypass the activation contract -- use the task. - ⊗ Infer implementation intent from lifecycle vocabulary ("do the full PR process", "start the work", "poller agents"), branching language, or workflow shape. Workflow-shape vocabulary is NOT authorization to spawn an implementation agent (#810 surfacing event).
- ⊗ Skip this preflight because the user said "yes", "go", or "proceed" -- affirmative continuation phrases are NOT implementation authorization unless the prior turn explicitly proposed implementation. When intent is ambiguous, ask one targeted question before invoking the gate.
Platform Detection
! Before resolving any config paths, detect the host OS from your environment context:
| Platform | USER.md default path |
|--------------------|-------------------------------------------------------------------|
| Windows | %APPDATA%\deft\USER.md (e.g. C:\Users\{user}\AppData\Roaming\deft\USER.md) |
| Unix (macOS/Linux) | ~/.config/deft/USER.md |
- ! If
$DEFT_USER_PATHis set, it takes precedence on any platform
Pre-Cutover Detection Guard
! Before proceeding with any build step, detect whether the project uses the pre-v0.20 document model or was generated by a strategy that emitted non-conformant v0.20 output shape (the root cause of most "build fails immediately after spec" complaints in #1166). Redirect or block with the precise remediation.
Detection Criteria
A project is pre-cutover if ANY of the following are true. This prose mirrors the executable helper in task migrate:preflight; when in doubt, the helper is canonical.
SPECIFICATION.mdexists and is neither a deprecation redirect nor a current generated spec export. A current generated spec export contains<!-- Purpose: rendered specification -->, all five lifecycle folders exist, and its<!-- Source of truth: ... -->marker names an authority artifact that exists: eitherxbrief/specification.xbrief.jsonfor full-spec compatibility orxbrief/PROJECT-DEFINITION.xbrief.jsonfor greenfield authority (legacyvbrief/...aliases remain read-compatible).PROJECT.mdexists and contains neither the legacy<!-- deft:deprecated-redirect -->sentinel NOR the currentPurpose: deprecation redirectcanonical-banner marker (real content, not a deprecation redirect)xbrief/specification.xbrief.jsonexists but the lifecycle folders (xbrief/proposed/,xbrief/pending/,xbrief/active/,xbrief/completed/,xbrief/cancelled/) do NOT exist- Strategy output shape violations (run
task verify-strategy-output-- the canonical gate for source and consumer installs):
- Any scope xBRIEF under
xbrief/proposed/(or other lifecycle dirs) lacks the requiredYYYY-MM-DD-date prefix in its filename (e.g. barescaffold.xbrief.json). xbrief/PROJECT-DEFINITION.xbrief.jsonis missing.xbrief/specification.xbrief.jsonexists as a legacy dual-write in a user-generated project. This is tolerated only for the framework source tree or a complete post-cutover full-spec consumer where all lifecycle folders exist andSPECIFICATION.mdis rendered fromxbrief/specification.xbrief.json.
Action on Detection
! If pre-cutover or strategy-nonconformant state is detected, stop immediately and display an actionable message that cites the exact validator:
"This project was generated with pre-v0.20 or non-conformant strategy output. Run the deterministic validator and follow its remediation:
task verify-strategy-output(works in source and afterdeftpackage install). For document-model migration, follow UPGRADING.md § Frozen pre-v0.20 document-model migration (#2068): pin v0.59.0, then runtask migrate:vbrieffrom that payload. Otherwisetask project:render/ strategy re-run as indicated."
! Include specific details about what was detected (the validator output is authoritative):
- Legacy specification.xbrief.json or missing lifecycle folders: "Follow the frozen v0.59.0 migrator path (#2068) or run
task migrate:preflightfor current-release guidance" - Non-date-prefixed xBRIEFs: "Re-run the emitting strategy after the v0.20 migrations (#1166 s1+s2+...) or manually rename files to
YYYY-MM-DD-<slug>.xbrief.jsonandtask scope:promote" - Missing
PROJECT-DEFINITION.xbrief.json: "Runtask project:renderto generate the project definition" SPECIFICATION.md/PROJECT.mdwithout sentinel: the classic pre-cutover messages- Scope xBRIEF in wrong folder: "Status is '{status}' but file is in {folder}/ -- run
task scope:activate <file>to fix"
! After the validator reports clean, re-run this guard before continuing.
⊗ Proceed with build when pre-cutover or strategy-nonconformant artifacts are detected -- always redirect to the frozen migration path first (or run the validator) and surface the exact remediation.
⊗ Silently ignore these artifacts or guess at fixes -- the validator (wired into task check and this guard) is the deterministic gate.
USER.md Gate
! Before proceeding, verify USER.md exists at the platform-appropriate path
(resolved via Platform Detection above, or $DEFT_USER_PATH if set).
- ! If USER.md is not found: inform the user and redirect to
deft-directive-setup
Phase 1 before continuing -- do not proceed without user preferences
- ! Once USER.md exists, continue with the Cost Phase Gate below
Forge-outage drop-back (#3422)
! On attributed platform outage or repeated REST 429/502/503 during YOLO / through-merge implement: drop GitHub I/O, report once to the human in chat, and re-probe on plan.policy.forgeOutageRetryMinutes (default 30; USER.md Personal wins; min 5; task policy:show --field=forgeOutageRetryMinutes). Local edit/test/commit MAY continue. Depth: