@deftai/directive-content 0.66.1 → 0.67.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/SKILL.md ADDED
@@ -0,0 +1,220 @@
1
+ <!-- DEFT-PREAMBLE-V1 -->
2
+ <!--
3
+ ! Cold-start check: deft runs from the npm-installed engine (`npm i -g @deftai/directive`). If neither `deft` nor `directive` will run on this machine, do not proceed with the instructions below -- recover first (#1933 Option 1, deprecate-by-disuse).
4
+ ! To recover: read `.deft/core/UPGRADING.md`, find the section whose "Applies when" clause matches your symptom, and follow that section verbatim before any other instruction in this file or in the consumer AGENTS.md.
5
+ ! Respect any "Restart required" directive -- if present, stop and tell the user to start a fresh session after cleanup commands complete. Otherwise continue.
6
+ -->
7
+ ---
8
+ name: deft
9
+ description: Apply deft framework standards for AI-assisted development. Use when starting projects, writing code, running tests, making commits, or when the user references deft, project standards, or coding guidelines.
10
+ user-invocable: false
11
+ metadata:
12
+ clawdbot:
13
+ requires:
14
+ bins: ["task"]
15
+ homepage: "https://github.com/deftai/directive"
16
+ os: ["darwin", "linux", "windows"]
17
+ ---
18
+
19
+ # Deft Framework
20
+
21
+ A layered framework for AI-assisted development with consistent standards and workflows.
22
+
23
+ ## When This Skill Activates
24
+
25
+ This skill automatically loads when you:
26
+ - Start work in a deft-enabled project (has `.deft/core/` directory)
27
+ - Reference deft, project standards, or coding conventions
28
+ - Run tests, make commits, or perform quality checks
29
+ - Ask about project structure, workflows, or best practices
30
+
31
+ ## Missing Config Auto-Setup
32
+
33
+ ! When this skill activates, check for USER.md at the platform-appropriate path
34
+ (Windows: `%APPDATA%\deft\USER.md`, Unix: `~/.config/deft/USER.md`, or `$DEFT_USER_PATH`).
35
+
36
+ **If USER.md is missing**: Skip everything else in this file. Ask this question immediately
37
+ as your FIRST and ONLY response — no summary, no menu, no preamble:
38
+
39
+ > Deft has solid opinions on how code should be written and tested — I just need
40
+ > a few things about you and your project. First, how deep do you want to go?
41
+ >
42
+ > 1. **I'm technical — ask me everything**
43
+ > 2. **I have some opinions but keep it simple**
44
+ > 3. **Just pick good defaults — I care about the product, not the tools**
45
+
46
+ Then continue with `skills/deft-directive-setup/SKILL.md` Phase 1 for remaining questions.
47
+
48
+ **If USER.md exists but `./vbrief/PROJECT-DEFINITION.vbrief.json` is missing**: Skip to
49
+ `skills/deft-directive-setup/SKILL.md` Phase 2.
50
+
51
+ **If USER.md and `./vbrief/PROJECT-DEFINITION.vbrief.json` both exist but no scope vBRIEFs in `./vbrief/` lifecycle folders**:
52
+ Skip to `skills/deft-directive-setup/SKILL.md` Phase 3. Start the specification interview
53
+ imediately — ask what to build and features as the first question.
54
+
55
+ ### ⊗ Project Root vs Framework Internals
56
+
57
+ ! When checking for project-level files (`PROJECT-DEFINITION.vbrief.json`, scope vBRIEFs,
58
+ `PRD.md`), ONLY look at `./vbrief/` and its lifecycle subdirectories.
59
+
60
+ - ! `./vbrief/PROJECT-DEFINITION.vbrief.json` — the user's project config
61
+ - ! `./vbrief/proposed/`, `./vbrief/pending/`, `./vbrief/active/`, `./vbrief/completed/` — scope vBRIEFs in lifecycle folders
62
+ - ⊗ Count ANY file inside `.deft/core/` (canonical) or `./deft/` (legacy pre-v0.27) as a project-level artifact — those are
63
+ framework-internal (e.g. `.deft/core/PROJECT.md`, `.deft/core/specs/`, `.deft/core/templates/`
64
+ are all part of the framework, NOT the user's project)
65
+
66
+ - ⊗ Present a summary of the config and ask what the user wants to do
67
+ - ⊗ Ask "what would you like to do" or "what are we building" — start the interview directly
68
+ - ⊗ Show menus, recaps, or workflow overviews before starting the next missing phase
69
+
70
+ ## Core Principle: Rule Precedence
71
+
72
+ Deft uses hierarchical rules where more specific overrides general.
73
+ USER.md has two sections with different precedence:
74
+
75
+ ```
76
+ USER.md Personal ← HIGHEST (name, custom rules — always wins)
77
+
78
+ PROJECT-DEFINITION.vbrief.json ← Project-specific (strategy, coverage, languages, tech stack)
79
+
80
+ USER.md Defaults ← Fallback defaults (used when PROJECT-DEFINITION doesn't specify)
81
+
82
+ {language}.md ← Language standards (python.md, go.md, typescript.md, cpp.md)
83
+
84
+ {tool}.md ← Tool guidelines (taskfile.md, git.md)
85
+
86
+ main.md ← General AI behavior
87
+
88
+ scope vBRIEFs ← LOWEST precedence (requirements in lifecycle folders)
89
+ ```
90
+
91
+ **IMPORTANT**: USER.md `Personal` section always wins. For project-scoped settings
92
+ (strategy, coverage, languages), `PROJECT-DEFINITION.vbrief.json` overrides USER.md `Defaults`.
93
+
94
+ ## File Reading Strategy (Lazy Loading)
95
+
96
+ **DO NOT** read all deft files at once. Read only what you need:
97
+
98
+ 1. **Always start with**: `.deft/core/main.md` (general guidelines)
99
+ 2. **Check for**: `~/.config/deft/USER.md` (personal overrides - highest precedence)
100
+ 3. **Check for**: `./vbrief/PROJECT-DEFINITION.vbrief.json` (project-specific rules)
101
+ 4. **Then read language-specific** only if working with that language:
102
+ - `.deft/core/languages/python.md`
103
+ - `.deft/core/languages/go.md`
104
+ - `.deft/core/languages/typescript.md`
105
+ - `.deft/core/languages/cpp.md`
106
+ 5. **Read tool files** only when using that tool:
107
+ - `.deft/core/tools/taskfile.md` (when running tasks)
108
+ - `.deft/core/scm/git.md` (when using git)
109
+ - `.deft/core/scm/github.md` (when using GitHub)
110
+
111
+ ## Task-Centric Workflow
112
+
113
+ Deft projects use **Taskfile** as the universal task runner.
114
+
115
+ ```bash
116
+ task --list # See all available tasks
117
+ task check # CRITICAL: Run before EVERY commit
118
+ ```
119
+
120
+ See `.deft/core/tools/taskfile.md` for complete task standards and common commands.
121
+
122
+ ## Development Methodology
123
+
124
+ **Test-Driven Development (TDD)**:
125
+ 1. Write test first → Watch it fail → Implement → Refactor → Repeat
126
+ 2. Default: ≥85% coverage (check `project.md` for overrides)
127
+ 3. Implementation is INCOMPLETE until tests pass
128
+
129
+ **Spec-Driven Development (SDD)** for new features/projects:
130
+ 1. Run `.deft/core/run spec` — sizing gate selects Light or Full path
131
+ 2. Light: Interview → scope vBRIEFs in `vbrief/proposed/` (embedded requirements) → Implement
132
+ 3. Full: Interview → rich narratives in `specification.vbrief.json` (approval gate) → scope vBRIEFs → Implement
133
+
134
+ See `.deft/core/coding/testing.md` for complete testing standards.
135
+
136
+ ## Quality Standards
137
+
138
+ **Before Every Commit**:
139
+ ```bash
140
+ task check # MUST run: fmt, lint, type check, test, coverage
141
+ ```
142
+
143
+ **Conventional Commits**: Use https://www.conventionalcommits.org/en/v1.0.0/ format
144
+ **File Naming**: Use hyphens (e.g., `user-service.py`), not underscores
145
+ **Secrets**: Store in `secrets/` directory with `.example` templates
146
+
147
+ See `.deft/core/coding/coding.md` and `.deft/core/scm/git.md` for complete standards.
148
+
149
+ ## Language-Specific Standards
150
+
151
+ All languages require ≥85% test coverage. See language-specific files:
152
+ - `.deft/core/languages/python.md`
153
+ - `.deft/core/languages/go.md`
154
+ - `.deft/core/languages/typescript.md`
155
+ - `.deft/core/languages/cpp.md`
156
+
157
+ ## New Project Setup
158
+
159
+ **Initialize new project**:
160
+ ```bash
161
+ .deft/core/run init # Create deft structure
162
+ .deft/core/run bootstrap # User config (first time only)
163
+ .deft/core/run project # Project config → vbrief/PROJECT-DEFINITION.vbrief.json
164
+ .deft/core/run spec # Sizing gate → Light (scope vBRIEFs) or Full (specification.vbrief.json → scope vBRIEFs)
165
+ ```
166
+
167
+ **Work with existing deft project**:
168
+ 1. **First time?** If `~/.config/deft/USER.md` doesn't exist, run `.deft/core/run bootstrap`
169
+ 2. Read `.deft/core/main.md` (general guidelines)
170
+ 3. Read `~/.config/deft/USER.md` (personal preferences - highest precedence)
171
+ 4. Read `./vbrief/PROJECT-DEFINITION.vbrief.json` (project rules)
172
+ 5. Run `task --list` to see available tasks
173
+
174
+ See `.deft/core/main.md` for complete workflow details.
175
+
176
+ ## Self-Improvement
177
+
178
+ Deft learns and evolves via `meta/` directory:
179
+ - `lessons.md` - Patterns learned (AI can update)
180
+ - `ideas.md` - Future improvements
181
+ - `suggestions.md` - Project-specific suggestions
182
+
183
+ ## Platform Integration
184
+
185
+ This SKILL.md follows the **AgentSkills specification**, compatible with:
186
+ - **Claude Code**: `~/.claude/skills/deft/` or `.claude/skills/deft/`
187
+ - **clawd.bot**: `~/.clawdbot/skills/deft/` or install via `clawdhub sync deft`
188
+ - **Warp AI**: Upload to Warp Drive, reference in `WARP.md`/`AGENTS.md`
189
+
190
+ See `.deft/core/docs/claude-code-integration.md` for integration details.
191
+
192
+ ## Quick Reference
193
+
194
+ | Task | Command |
195
+ |------|---------|
196
+ | List tasks | `task` or `task --list` |
197
+ | Pre-commit checks | `task check` |
198
+ | Run tests | `task test` |
199
+ | Check coverage | `task test:coverage` |
200
+ | Format code | `task fmt` |
201
+ | Lint code | `task lint` |
202
+ | Initialize deft | `.deft/core/run init` |
203
+ | Configure user | `.deft/core/run bootstrap` |
204
+ | Configure project | `.deft/core/run project` |
205
+ | Generate spec | `.deft/core/run spec` |
206
+
207
+ ## Remember
208
+
209
+ 1. **Lazy load files** - Only read what you need
210
+ 2. **User.md Personal is king** - Personal section always wins; Defaults are fallback
211
+ 3. **Task-centric** - Use `task` for everything
212
+ 4. **Test first** - Write tests before implementation
213
+ 5. **Always check** - Run `task check` before commits
214
+ 6. **Conventional commits** - Follow the standard
215
+ 7. **Coverage matters** - ≥85% by default
216
+ 8. **Never lie** - Don't claim checks passed without running them
217
+
218
+ ---
219
+
220
+ For more details, read the specific files in `.deft/core/` as needed. Start with `main.md` and follow the precedence hierarchy.
package/Taskfile.yml CHANGED
@@ -345,6 +345,7 @@ tasks:
345
345
  - verify:stubs
346
346
  - verify:links
347
347
  - verify:rule-ownership
348
+ - verify:biome-config
348
349
  - verify:content-manifest
349
350
  - verify:contract-drift
350
351
  - verify:cursor-tier1
@@ -360,6 +361,7 @@ tasks:
360
361
  - verify:cache-fresh
361
362
  - verify:pack-drift
362
363
  - verify-wip-cap-framework-self-check
364
+ - verify:agents-md-budget
363
365
  - vbrief:validate
364
366
  - codebase:validate-structure
365
367
  - verify:codebase-map-fresh
@@ -479,7 +481,7 @@ tasks:
479
481
  # in ``tasks/framework.yml`` now prints a redaction notice pointing
480
482
  # the operator at this surface.
481
483
  doctor:
482
- desc: "Canonical doctor surface (#1272) -- task doctor [-- --session | --fix | --json | --quiet]. Uses vendored bin.js in source checkouts or global deft on npm consumer deposits (#2022 Phase 3)."
484
+ desc: "Canonical doctor surface (#1272) -- task doctor [-- --session | --fix | --json | --quiet | --network]. Uses vendored bin.js in source checkouts or global deft on npm consumer deposits (#2022 Phase 3). --network is required to run the payload-staleness check (git remote, then npm registry fallback); it is offline (skipped) by default and discloses the tool + registry class before contacting either (#2182)."
483
485
  dir: '{{.USER_WORKING_DIR}}'
484
486
  cmds:
485
487
  - task: engine:invoke
package/UPGRADING.md CHANGED
@@ -56,6 +56,26 @@ deft migrate:xbrief
56
56
 
57
57
  (or `task migrate:xbrief` from a maintainer checkout). The command requires a clean working tree unless you pass `--force`. Legacy `vbrief/` paths and `x-vbrief/` tokens remain **read-accepted** until this migration runs; `deft update` may signpost the same guidance on non-patch upgrades.
58
58
 
59
+ Post-migration behavior check (#2149): on xbrief-only projects (`vbrief/` removed), `task issue:ingest -- <N>` now emits `xbrief/proposed/*.xbrief.json` with `xBRIEFInfo.version` from `xbrief/PROJECT-DEFINITION.xbrief.json` (fallback `0.8`), while legacy `vbrief/` projects keep `.vbrief.json` + `vBRIEFInfo.version: "0.6"` until migrated. `task project:render` / `project-render` also stays on `xbrief/PROJECT-DEFINITION.xbrief.json` and no longer recreates `vbrief/` in migrated trees.
60
+
61
+ ### AGENTS.md: managed vs unmanaged header (#2154)
62
+
63
+ `migrate:xbrief` touches your `AGENTS.md` in two distinct regions:
64
+
65
+ - **Managed section** (between the `<!-- deft:managed-section ... -->` / `<!-- /deft:managed-section -->` markers): regenerated wholesale by `agents:refresh`, so it always reflects the current framework layout. This region is rendered from the framework template — do not hand-edit it.
66
+ - **Unmanaged header/tail** (everything outside those markers — your project-specific `Session orientation`, `Lifecycle` examples, `Local dev` notes): preserved verbatim across upgrades so your consumer notes survive. Because it is preserved, a rename migration would otherwise leave stale `vbrief/` path literals here. `migrate:xbrief` now applies a **bounded, idempotent** rewrite over the unmanaged region only, replacing the known crossover tokens (`vbrief/` → `xbrief/`, `*.vbrief.json` → `*.xbrief.json`, `vbrief:preflight` → `xbrief:preflight`) while leaving freeform prose untouched. It prints a summary of the replacements.
67
+
68
+ If you upgraded before this fix landed and your header still points at `vbrief/`, `deft doctor` now emits an `AGENTS.md header drift:` signpost. Re-run `deft migrate:xbrief` (idempotent) to patch the header, or hand-edit the offending path literals.
69
+
70
+ **Option A (canonical, #2065):** new installs scaffold a **bounded** unmanaged header only — a project one-liner plus a **Session orientation** pointer at the canonical sources below. Do **not** add freeform `Status`, `Next:`, or `Known Issues` blocks; they are retired because the framework preserves the header verbatim while `deft doctor` only checks the managed section (#794, #1308). Session orientation comes from:
71
+
72
+ - `xbrief/PROJECT-DEFINITION.xbrief.json` (project identity)
73
+ - `xbrief/` lifecycle folders (scoped work)
74
+ - `deft triage:queue` / `deft triage:welcome` (ranked queue)
75
+ - GitHub issues (tracked bugs)
76
+
77
+ If your header still carries `Status` / `Known Issues` from an older handoff, replace them with the Session orientation pointer (reference implementation: [deftai/cartograph#75](https://github.com/deftai/cartograph/pull/75)). Ephemeral shell quirks MAY stay under a `Local dev` heading only.
78
+
59
79
  ## Public contract layer — `@deftai/directive-types` (#1799)
60
80
 
61
81
  Downstream TypeScript projects can import the canonical xBRIEF/policy contract instead of hand-mirroring JSON shapes:
@@ -0,0 +1,44 @@
1
+ # Authoring agent docs (AGENTS.md) for a project
2
+
3
+ Guidance for structuring the AGENTS.md (and its reference docs) of a project directive creates or maintains. Unlike most style advice, the patterns here are **empirically measured**, not opinion: Augment Code's April 2026 AuggieBench study ran real PRs with and without each pattern and scored the agent's output against the human-reviewed golden PR. Full write-up: [good-agents-md.md](./good-agents-md.md).
4
+
5
+ Legend (RFC2119): `!`=MUST, `~`=SHOULD, `≉`=SHOULD NOT, `⊗`=MUST NOT, `?`=MAY.
6
+
7
+ > The headline finding: a good AGENTS.md gave the agent a quality jump equivalent to a model upgrade; a bad one made output **worse than no AGENTS.md at all**. The same file boosted `best_practices` +25% on a routine bug fix and dropped `completeness` -30% on a complex feature in the same module. Structure is the difference.
8
+
9
+ ## The pattern (what the study measured)
10
+
11
+ | Pattern | Measured effect |
12
+ |---|---|
13
+ | 100–150 line main file + a handful of focused reference files | Top performers; **10–15%** improvement across all metrics in mid-size modules. Gains **reverse** once the main file grows past ~150 lines. |
14
+ | Numbered procedural workflows for multi-step tasks | Missing-wiring PRs **40% → 10%**; correctness **+25%**, completeness **+20%**. |
15
+ | Decision tables for common ambiguities (2–3 reasonable options) | **+25%** best-practices adherence — resolves the choice before the agent writes a line. |
16
+ | 3–10 line snippets from the **real** codebase | Improved reuse and pattern adherence. More than a few, and the agent pattern-matches on the wrong thing. |
17
+ | Paired don't/do rules | Warning-only docs underperform; **15+ unpaired don'ts** measurably cause overexploration. |
18
+ | Module-level files over a root cross-cutting file | Root-level cross-cutting AGENTS.md underperforms module-scoped files. |
19
+
20
+ ## How to structure a project's AGENTS.md
21
+
22
+ 1. ! Keep the always-loaded AGENTS.md to **~100–150 lines**. It is a map (what exists, where to look, the few load-bearing rules), not a manual.
23
+ 2. ! Push detail into **focused reference files** the agent loads on demand, each with a clear "load when…" scope. See the reference-chain contract below.
24
+ 3. ~ Express multi-step tasks (deploy an integration, add a migration, wire a new endpoint) as **numbered workflows**, not prose. Keep branching cases in reference files.
25
+ 4. ~ For each recurring "which of these two approaches?" ambiguity, add a **decision table** that forces the choice up front.
26
+ 5. ~ Include a few **short, real** code snippets (3–10 lines) for the patterns you most want reused. Do not paste large or duplicative examples.
27
+ 6. ! Write rules as **paired don't/do**, not lone warnings — an unpaired "don't" leaves the agent to guess the "do", and a pile of them triggers overexploration.
28
+ 7. ~ Prefer **module-level** agent docs (scoped to the package/app the agent is working in) over one root file that tries to cover everything.
29
+
30
+ ## The reference-chain contract
31
+
32
+ The discovery-rate principle that governs *what to reference* is named in `REFERENCES.md` ("The reference-chain contract", #644) — read it there rather than duplicating it here. In one line: **if a rule must be followed, it must be reachable in the reference chain; orphan docs (<10% discovery) are effectively invisible, and reachable-but-unreferenced docs are still found and still cost context.**
33
+
34
+ ## The overexploration trap (measured failure modes, not style)
35
+
36
+ These are the specific blocks the study measured *hurting* agent quality — treat them as defects, not taste:
37
+
38
+ - ⊗ Do **not** add an "architecture overview" / broad-context section to an always-loaded agent file. On complex tasks it pulls the agent into the reference section to verify its approach against every guideline, producing unnecessary abstractions and incomplete solutions (the measured -30% completeness case).
39
+ - ⊗ Do **not** accumulate 15+ unpaired warnings. Past that threshold the agent over-explores instead of acting.
40
+ - ≉ Avoid stacking dozens of domain-specific gotchas. Domain rules help when specific and enforceable; they stop helping when piled up. Prefer a deterministic gate over prose where one exists (the gate is platform-correct by construction and travels with the repo).
41
+
42
+ ## Relationship to directive's own dogfooding
43
+
44
+ Directive holds its own AGENTS.md to this bar via the `verify:agents-md-budget` ratchet (#645) and the consumer-side advisory signal (`agentsMdAdvisory`, #2155). The doc-sprawl awareness step in the `deft-directive-sync` skill (#647) surfaces reachable-doc-volume drift before it silently degrades agent quality. This doc is the "how to structure it well" companion to those "keep it from bloating" guards.