@deftai/directive-content 0.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/.agents/skills/deft/SKILL.md +6 -0
  2. package/.agents/skills/deft-directive-article-review/SKILL.md +11 -0
  3. package/.agents/skills/deft-directive-build/SKILL.md +10 -0
  4. package/.agents/skills/deft-directive-cost/SKILL.md +12 -0
  5. package/.agents/skills/deft-directive-debug/SKILL.md +13 -0
  6. package/.agents/skills/deft-directive-gh-arch/SKILL.md +11 -0
  7. package/.agents/skills/deft-directive-gh-slice/SKILL.md +10 -0
  8. package/.agents/skills/deft-directive-glossary/SKILL.md +10 -0
  9. package/.agents/skills/deft-directive-interview/SKILL.md +9 -0
  10. package/.agents/skills/deft-directive-pre-pr/SKILL.md +9 -0
  11. package/.agents/skills/deft-directive-refinement/SKILL.md +10 -0
  12. package/.agents/skills/deft-directive-release/SKILL.md +12 -0
  13. package/.agents/skills/deft-directive-review-cycle/SKILL.md +10 -0
  14. package/.agents/skills/deft-directive-setup/SKILL.md +10 -0
  15. package/.agents/skills/deft-directive-swarm/SKILL.md +10 -0
  16. package/.agents/skills/deft-directive-sync/SKILL.md +9 -0
  17. package/.agents/skills/deft-directive-triage/SKILL.md +9 -0
  18. package/.agents/skills/deft-directive-write-skill/SKILL.md +9 -0
  19. package/LICENSE.md +22 -0
  20. package/QUICK-START.md +167 -0
  21. package/UPGRADING.md +517 -0
  22. package/coding/build-output.md +28 -0
  23. package/coding/coding.md +235 -0
  24. package/coding/debugging.md +110 -0
  25. package/coding/holzmann.md +96 -0
  26. package/coding/hygiene.md +127 -0
  27. package/coding/security.md +158 -0
  28. package/coding/testing.md +162 -0
  29. package/coding/toolchain.md +44 -0
  30. package/commands.md +300 -0
  31. package/context/context.md +57 -0
  32. package/context/deterministic-split.md +67 -0
  33. package/context/examples.md +26 -0
  34. package/context/fractal-summaries.md +69 -0
  35. package/context/long-horizon.md +46 -0
  36. package/context/spec-deltas.md +177 -0
  37. package/context/tool-design.md +34 -0
  38. package/context/working-memory.md +62 -0
  39. package/contracts/boundary-maps.md +65 -0
  40. package/contracts/deterministic-questions.md +59 -0
  41. package/contracts/hierarchy.md +77 -0
  42. package/conventions/content-manifest.json +399 -0
  43. package/conventions/machine-generated-banner.md +130 -0
  44. package/conventions/references.md +120 -0
  45. package/conventions/rule-ownership.json +382 -0
  46. package/conventions/task-caching.md +43 -0
  47. package/conventions/vbrief-filenames.md +70 -0
  48. package/deployments/README.md +37 -0
  49. package/deployments/agentuity/README.md +138 -0
  50. package/deployments/agentuity/via-cli.md +380 -0
  51. package/deployments/agentuity/via-cloud.md +425 -0
  52. package/deployments/agentuity/via-github-actions.md +664 -0
  53. package/deployments/agentuity/via-gravity-network.md +606 -0
  54. package/deployments/agentuity/via-vpc.md +607 -0
  55. package/deployments/aws/README.md +38 -0
  56. package/deployments/aws/via-app-runner.md +612 -0
  57. package/deployments/aws/via-ecs-fargate.md +561 -0
  58. package/deployments/aws/via-elastic-beanstalk.md +628 -0
  59. package/deployments/aws/via-lambda.md +649 -0
  60. package/deployments/azure/README.md +37 -0
  61. package/deployments/azure/via-aks.md +390 -0
  62. package/deployments/azure/via-app-service.md +564 -0
  63. package/deployments/azure/via-container-apps.md +599 -0
  64. package/deployments/azure/via-functions.md +552 -0
  65. package/deployments/cloud-gov/README.md +63 -0
  66. package/deployments/cloud-gov/agents/compliance-docs.md +154 -0
  67. package/deployments/cloud-gov/agents.md +39 -0
  68. package/deployments/cloud-gov/cicd.md +64 -0
  69. package/deployments/cloud-gov/deployment.md +150 -0
  70. package/deployments/cloud-gov/logging.md +43 -0
  71. package/deployments/cloud-gov/manifest.md +121 -0
  72. package/deployments/cloud-gov/overview.md +58 -0
  73. package/deployments/cloud-gov/security.md +46 -0
  74. package/deployments/cloud-gov/services.md +72 -0
  75. package/deployments/cloud-gov/upstream/README.md +18 -0
  76. package/deployments/cloudflare/README.md +33 -0
  77. package/deployments/cloudflare/via-dashboard.md +83 -0
  78. package/deployments/cloudflare/via-git.md +90 -0
  79. package/deployments/cloudflare/via-github-actions.md +185 -0
  80. package/deployments/cloudflare/via-terraform.md +157 -0
  81. package/deployments/cloudflare/via-wrangler.md +165 -0
  82. package/deployments/fly-io/README.md +37 -0
  83. package/deployments/fly-io/via-dockerfile.md +648 -0
  84. package/deployments/fly-io/via-flyctl.md +653 -0
  85. package/deployments/fly-io/via-github-actions.md +695 -0
  86. package/deployments/fly-io/via-multi-region.md +598 -0
  87. package/deployments/google/README.md +34 -0
  88. package/deployments/google/via-app-engine.md +42 -0
  89. package/deployments/google/via-cloud-functions.md +23 -0
  90. package/deployments/google/via-cloud-run.md +330 -0
  91. package/deployments/google/via-gke.md +23 -0
  92. package/deployments/netlify/README.md +99 -0
  93. package/deployments/netlify/via-cli.md +17 -0
  94. package/deployments/netlify/via-functions.md +19 -0
  95. package/deployments/netlify/via-git.md +25 -0
  96. package/deployments/vercel/README.md +90 -0
  97. package/deployments/vercel/via-api.md +16 -0
  98. package/deployments/vercel/via-cli.md +17 -0
  99. package/deployments/vercel/via-git.md +24 -0
  100. package/docs/BROWNFIELD.md +179 -0
  101. package/docs/getting-started.md +137 -0
  102. package/docs/good-agents-md.md +137 -0
  103. package/events/README.md +89 -0
  104. package/events/event-record.schema.json +26 -0
  105. package/events/registry.json +166 -0
  106. package/events/registry.schema.json +71 -0
  107. package/glossary.md +145 -0
  108. package/incidents/README.md +81 -0
  109. package/incidents/_template.md +38 -0
  110. package/interfaces/cli.md +104 -0
  111. package/interfaces/rest.md +212 -0
  112. package/interfaces/tui.md +242 -0
  113. package/interfaces/web.md +123 -0
  114. package/languages/6502-DASM.md +132 -0
  115. package/languages/c.md +235 -0
  116. package/languages/commands.md +23 -0
  117. package/languages/cpp.md +132 -0
  118. package/languages/csharp.md +259 -0
  119. package/languages/dart.md +183 -0
  120. package/languages/delphi.md +218 -0
  121. package/languages/elixir.md +208 -0
  122. package/languages/go.md +78 -0
  123. package/languages/java.md +278 -0
  124. package/languages/javascript.md +163 -0
  125. package/languages/julia.md +175 -0
  126. package/languages/kotlin.md +193 -0
  127. package/languages/markdown.md +168 -0
  128. package/languages/mermaid.md +146 -0
  129. package/languages/officejs.md +392 -0
  130. package/languages/python.md +209 -0
  131. package/languages/r.md +163 -0
  132. package/languages/rust.md +216 -0
  133. package/languages/sql.md +216 -0
  134. package/languages/swift.md +153 -0
  135. package/languages/typescript.md +132 -0
  136. package/languages/vba.md +279 -0
  137. package/languages/vhdl.md +180 -0
  138. package/languages/visual-basic.md +151 -0
  139. package/languages/zig.md +196 -0
  140. package/meta/SOUL.md +27 -0
  141. package/meta/code-field.md +44 -0
  142. package/meta/morals.md +40 -0
  143. package/meta/philosophy.md +39 -0
  144. package/meta/project.md +49 -0
  145. package/meta/ralph.md +223 -0
  146. package/meta/security.md +80 -0
  147. package/meta/versioning.md +326 -0
  148. package/package.json +22 -0
  149. package/packs/lessons/lessons-pack-0.1.json +553 -0
  150. package/packs/patterns/patterns-pack-0.1.json +57 -0
  151. package/packs/rules/rules-pack-0.1.json +4767 -0
  152. package/packs/skills/skills-pack-0.1.json +262 -0
  153. package/packs/strategies/strategies-pack-0.1.json +167 -0
  154. package/packs/swarm-spec/swarm-spec-pack-0.1.json +17 -0
  155. package/patterns/executor-layer-credentials.md +227 -0
  156. package/patterns/llm-app.md +156 -0
  157. package/patterns/multi-agent.md +278 -0
  158. package/patterns/prompt-assembly-layer-ordering.md +154 -0
  159. package/patterns/role-as-overlay.md +179 -0
  160. package/platforms/2600.md +137 -0
  161. package/platforms/unity.md +329 -0
  162. package/references/composer-skill-porting.md +152 -0
  163. package/references/cost-models.md +163 -0
  164. package/references/ip-risk.md +246 -0
  165. package/references/plain-english-ux.md +275 -0
  166. package/resilience/context-pruning.md +67 -0
  167. package/resilience/continue-here.md +62 -0
  168. package/scm/changelog.md +276 -0
  169. package/scm/git.md +139 -0
  170. package/scm/github.md +265 -0
  171. package/secrets/.gitkeep +0 -0
  172. package/skills/deft-build/SKILL.md +20 -0
  173. package/skills/deft-directive-article-review/SKILL.md +156 -0
  174. package/skills/deft-directive-build/SKILL.md +302 -0
  175. package/skills/deft-directive-cost/SKILL.md +201 -0
  176. package/skills/deft-directive-debug/SKILL.md +140 -0
  177. package/skills/deft-directive-decompose/SKILL.md +96 -0
  178. package/skills/deft-directive-gh-arch/SKILL.md +160 -0
  179. package/skills/deft-directive-gh-slice/SKILL.md +199 -0
  180. package/skills/deft-directive-glossary/SKILL.md +118 -0
  181. package/skills/deft-directive-interview/SKILL.md +528 -0
  182. package/skills/deft-directive-pre-pr/SKILL.md +131 -0
  183. package/skills/deft-directive-probe/SKILL.md +127 -0
  184. package/skills/deft-directive-refinement/SKILL.md +403 -0
  185. package/skills/deft-directive-release/SKILL.md +266 -0
  186. package/skills/deft-directive-review-cycle/SKILL.md +401 -0
  187. package/skills/deft-directive-setup/SKILL.md +717 -0
  188. package/skills/deft-directive-swarm/SKILL.md +989 -0
  189. package/skills/deft-directive-sync/SKILL.md +288 -0
  190. package/skills/deft-directive-triage/SKILL.md +137 -0
  191. package/skills/deft-directive-write-skill/SKILL.md +169 -0
  192. package/skills/deft-interview/SKILL.md +16 -0
  193. package/skills/deft-pre-pr/SKILL.md +16 -0
  194. package/skills/deft-review-cycle/SKILL.md +16 -0
  195. package/skills/deft-roadmap-refresh/SKILL.md +16 -0
  196. package/skills/deft-setup/SKILL.md +20 -0
  197. package/skills/deft-swarm/SKILL.md +16 -0
  198. package/skills/deft-sync/SKILL.md +16 -0
  199. package/strategies/README.md +83 -0
  200. package/strategies/artifact-guards.md +85 -0
  201. package/strategies/bdd.md +115 -0
  202. package/strategies/brownfield.md +7 -0
  203. package/strategies/discuss.md +129 -0
  204. package/strategies/emit-hints.md +69 -0
  205. package/strategies/enterprise.md +193 -0
  206. package/strategies/interview.md +551 -0
  207. package/strategies/map.md +179 -0
  208. package/strategies/probe.md +151 -0
  209. package/strategies/rapid.md +155 -0
  210. package/strategies/research.md +155 -0
  211. package/strategies/roadmap.md +9 -0
  212. package/strategies/speckit.md +437 -0
  213. package/strategies/v0-20-contract.md +134 -0
  214. package/strategies/yolo.md +169 -0
  215. package/swarm/swarm.md +300 -0
  216. package/templates/COST-ESTIMATE.md +114 -0
  217. package/templates/PULL_REQUEST_TEMPLATE.md +35 -0
  218. package/templates/agent-prompt-preamble.md +409 -0
  219. package/templates/agents-entry.md +211 -0
  220. package/templates/agents-entry.placeholders.md +75 -0
  221. package/templates/embed.go +20 -0
  222. package/templates/embed_test.go +36 -0
  223. package/templates/make-spec-example.md +9 -0
  224. package/templates/make-spec.md +246 -0
  225. package/templates/project.md.template +52 -0
  226. package/templates/specification.md +1 -0
  227. package/templates/swarm-greptile-poller-prompt.md +556 -0
  228. package/templates/user.md.template +31 -0
  229. package/tools/RWLDL.md +80 -0
  230. package/tools/greptile.md +141 -0
  231. package/tools/installer.md +23 -0
  232. package/tools/taskfile-migration.md +32 -0
  233. package/tools/taskfile.md +185 -0
  234. package/tools/telemetry.md +285 -0
  235. package/vbrief/schemas/cache-meta.schema.json +137 -0
  236. package/vbrief/schemas/candidates.schema.json +130 -0
  237. package/vbrief/schemas/codebase-map.schema.json +213 -0
  238. package/vbrief/schemas/lessons-pack.schema.json +134 -0
  239. package/vbrief/schemas/patterns-pack.schema.json +84 -0
  240. package/vbrief/schemas/rules-pack.schema.json +105 -0
  241. package/vbrief/schemas/skills-pack.schema.json +94 -0
  242. package/vbrief/schemas/slices.schema.json +87 -0
  243. package/vbrief/schemas/strategies-pack.schema.json +89 -0
  244. package/vbrief/schemas/swarm-spec-pack.schema.json +84 -0
  245. package/vbrief/schemas/vbrief-core.schema.json +1022 -0
  246. package/vbrief/vbrief.md +684 -0
  247. package/verification/integration.md +76 -0
  248. package/verification/plan-checking.md +85 -0
  249. package/verification/uat.md +60 -0
  250. package/verification/verification.md +117 -0
@@ -0,0 +1,179 @@
1
+ # Adding Deft to an Existing Project (Brownfield Adoption)
2
+
3
+ Adding Deft to an existing codebase is the harder path and the one most likely to go wrong without guidance. This guide walks you through the steps, what changes, and how to preserve existing spec content.
4
+
5
+ **Greenfield users:** If you are starting a new project from scratch, follow the [Getting Started](../../README.md#-getting-started) flow in the README instead. This guide is only for projects that already have code, docs, or a pre-v0.20 Deft layout.
6
+
7
+ > **See also:** [README.md](../../README.md), [QUICK-START.md](../QUICK-START.md), [vbrief/vbrief.md](../vbrief/vbrief.md), and `UPGRADING.md` at the repo root (added in v0.20 -- issue #411).
8
+
9
+ Legend (from RFC2119): !=MUST, ~=SHOULD, ≉=SHOULD NOT, ⊗=MUST NOT, ?=MAY.
10
+
11
+ ---
12
+
13
+ ## 1. Install Deft in Your Project
14
+
15
+ You have three ways to add the `deft/` framework to an existing project. Pick the one that fits your workflow:
16
+
17
+ ### Option A: Git submodule (recommended)
18
+
19
+ ```bash
20
+ git submodule add https://github.com/deftai/directive.git deft
21
+ git submodule update --init --recursive
22
+ ```
23
+
24
+ - ~ Pin to a release tag so framework updates are explicit:
25
+ ```bash
26
+ cd deft && git checkout v0.20.0 && cd ..
27
+ git add deft && git commit -m "chore(deft): pin framework to v0.20.0"
28
+ ```
29
+ - ~ Update later with `cd deft && git fetch && git checkout <new-tag>`.
30
+ - ! Commit the submodule pointer after every version bump so teammates do not drift.
31
+
32
+ ### Option B: Installer binary
33
+
34
+ If you downloaded the Deft installer (see [GitHub Releases](https://github.com/deftai/directive/releases)), run it against your existing project directory:
35
+
36
+ ```bash
37
+ ./install-<platform>-<arch>
38
+ ```
39
+
40
+ - The installer clones `deft/` into the project root, wires it into `AGENTS.md` (append-mode if the file already exists), and creates your user config directory.
41
+ - Your existing `AGENTS.md` content is preserved; Deft entries are appended with two blank lines before them.
42
+
43
+ ### Option C: Direct clone (no installer, no submodule)
44
+
45
+ ```bash
46
+ git clone https://github.com/deftai/directive.git deft
47
+ ```
48
+
49
+ - ~ Fine for experimentation; use submodule or installer for anything durable.
50
+ - ! Tell your agent: "Read `deft/QUICK-START.md` and follow it." QUICK-START creates your `AGENTS.md` idempotently.
51
+
52
+ ---
53
+
54
+ ## 2. Migrate Existing Docs (`task migrate:vbrief`)
55
+
56
+ If your project already contains `SPECIFICATION.md`, `PROJECT.md`, or `ROADMAP.md`, run the one-shot migration:
57
+
58
+ ```bash
59
+ task migrate:vbrief
60
+ ```
61
+
62
+ The migration is **idempotent** -- safe to re-run on a partially-migrated project.
63
+
64
+ ### What migration does
65
+
66
+ 1. **Parses** existing `specification.vbrief.json` (if present) + `PROJECT.md` and generates `vbrief/PROJECT-DEFINITION.vbrief.json` with a `narratives` map (project identity) and an `items` registry (scope).
67
+ 2. **Creates** the five lifecycle folders: `vbrief/proposed/`, `vbrief/pending/`, `vbrief/active/`, `vbrief/completed/`, `vbrief/cancelled/`.
68
+ 3. **Converts** `ROADMAP.md` items into individual `pending/` scope vBRIEFs with origin provenance (`references` array pointing back to GitHub issue numbers, if available).
69
+ 4. **Replaces** `SPECIFICATION.md` and `PROJECT.md` with deprecation redirect stubs containing `<!-- deft:deprecated-redirect -->` -- the sentinel that tells future `task vbrief:validate` runs these files are no longer authoritative.
70
+ 5. **Preserves** user-customized content it cannot parse: anything non-standard in `PROJECT.md` is stored in a `ProjectConfig` narrative on `PROJECT-DEFINITION.vbrief.json` instead of being discarded.
71
+
72
+ ### Preserving existing spec content (#397 ingestion)
73
+
74
+ `task migrate:vbrief` also reads structured `## ` sections from `PRD.md` and `SPECIFICATION.md` (Problem Statement, Goals, User Stories, Requirements, Success Metrics, Non-Functional Requirements, Open Questions) and maps them to canonical narrative keys on `vbrief/specification.vbrief.json`. Existing keys are never overwritten.
75
+
76
+ - ~ Review the generated `vbrief/specification.vbrief.json` after migration; fill in any narrative the parser could not map.
77
+ - ~ If the parser missed content you care about, copy it into the appropriate narrative before deleting the old file backup.
78
+
79
+ ---
80
+
81
+ ## 3. What Changes After Migration
82
+
83
+ ### Source of truth: `.vbrief.json` files
84
+
85
+ - `vbrief/PROJECT-DEFINITION.vbrief.json` replaces `PROJECT.md` as the project identity gestalt (tech stack, strategy, coverage, architecture, branching convention).
86
+ - `vbrief/specification.vbrief.json` replaces `SPECIFICATION.md` as the project spec source of truth.
87
+ - Individual units of work live in `vbrief/{proposed,pending,active,completed,cancelled}/` as `YYYY-MM-DD-<slug>.vbrief.json`.
88
+
89
+ ### Rendered views: `.md` artifacts
90
+
91
+ `.md` files like `PRD.md`, `SPECIFICATION.md`, and `ROADMAP.md` become **rendered views**, generated on demand:
92
+
93
+ ```bash
94
+ task spec:render # vbrief/specification.vbrief.json -> SPECIFICATION.md
95
+ task prd:render # vbrief/specification.vbrief.json narratives -> PRD.md
96
+ task roadmap:render # vbrief/pending/ scope vBRIEFs -> ROADMAP.md
97
+ task project:render # lifecycle folders -> PROJECT-DEFINITION.vbrief.json items registry
98
+ ```
99
+
100
+ - ⊗ Edit the rendered `.md` files directly -- your changes are overwritten on the next `task *:render` run.
101
+ - ! Edit the underlying `.vbrief.json` instead, then run `task *:render` to refresh the export.
102
+ - ~ `task spec:render` and `task prd:render` are also invoked automatically by `skills/deft-directive-pre-pr/SKILL.md` Phase 3b if the export files already exist.
103
+
104
+ ### Deprecation sentinels
105
+
106
+ After migration, the root `SPECIFICATION.md` and `PROJECT.md` contain a redirect stub with a sentinel comment on its first line followed by a short pointer. The exact output is produced by `_deprecation_redirect()` in `scripts/migrate_vbrief.py`; the first line is always `<!-- deft:deprecated-redirect -->`, which is the only line `scripts/vbrief_validate.py` checks. A simplified representation:
107
+
108
+ ```markdown
109
+ <!-- deft:deprecated-redirect -->
110
+ # PROJECT.md -- DEPRECATED
111
+
112
+ This file has been migrated to `vbrief/PROJECT-DEFINITION.vbrief.json`.
113
+
114
+ **See instead:**
115
+ - `vbrief/PROJECT-DEFINITION.vbrief.json` (project identity)
116
+ - scope vBRIEFs in `vbrief/{proposed,pending,active,completed,cancelled}/`
117
+ ```
118
+
119
+ (The actual generated body may include additional context; the sentinel comment on line 1 is what the validator enforces.)
120
+
121
+ `scripts/vbrief_validate.py` warns if these files exist without the sentinel; `skills/deft-directive-build/SKILL.md` Pre-Cutover Detection Guard redirects to `task migrate:vbrief` if it detects pre-v0.20 state on first setup.
122
+
123
+ ---
124
+
125
+ ## 4. Pre-Cutover Detection Guard
126
+
127
+ On first interactive session after adding Deft, the agent-driven path runs a **pre-cutover detection guard** from `skills/deft-directive-setup/SKILL.md` and `skills/deft-directive-build/SKILL.md`. The guard detects legacy artifacts and redirects to the migration command instead of silently proceeding with a mismatched project layout.
128
+
129
+ **Detection criteria** (any one triggers the guard):
130
+
131
+ 1. `SPECIFICATION.md` exists and does **not** contain `<!-- deft:deprecated-redirect -->`.
132
+ 2. `PROJECT.md` exists and does **not** contain `<!-- deft:deprecated-redirect -->`.
133
+ 3. `vbrief/specification.vbrief.json` exists but the lifecycle folders (`proposed/`, `pending/`, `active/`, `completed/`, `cancelled/`) do **not**.
134
+
135
+ **Action on detection:** the agent stops with an actionable message such as "Run `task migrate:vbrief` to upgrade to the vBRIEF-centric model."
136
+
137
+ ### CLI path (`.deft/core/run`)
138
+
139
+ The CLI has a companion non-fatal upgrade gate (issue #410): `.deft/core/run` warns on every invocation when `vbrief/.deft-version` does not match the framework `VERSION`, or when legacy artifacts are found without the sentinel. Interactive sessions get a `Continue anyway? [y/N]` prompt; non-interactive sessions (CI, cloud agents) warn once and continue so CI is never blocked.
140
+
141
+ After completing migration, record the framework version so the CLI gate stays silent:
142
+
143
+ ```bash
144
+ .deft/core/run upgrade # writes vbrief/.deft-version = <current VERSION>
145
+ ```
146
+
147
+ ---
148
+
149
+ ## 5. Post-Migration Checklist
150
+
151
+ Run these in order once `task migrate:vbrief` completes:
152
+
153
+ 1. ! `task vbrief:validate` -- should report zero errors and zero warnings about `SPECIFICATION.md` / `PROJECT.md`. Deprecation-sentinel warnings from `scripts/vbrief_validate.py` fire when the sentinel is **missing** from those files -- if you see them, the redirect stubs were not written correctly and the migration is incomplete; re-run `task migrate:vbrief` or patch the stubs to include the `<!-- deft:deprecated-redirect -->` line.
154
+ 2. ! `task check` -- the full pre-commit pipeline (fmt + lint + typecheck + tests + coverage + vbrief validation + link check). Must be green before your first Deft-aware commit.
155
+ 3. ~ `task project:render` -- regenerate `vbrief/PROJECT-DEFINITION.vbrief.json` items registry to reflect the newly-migrated scopes.
156
+ 4. ~ `task roadmap:render` and `task spec:render` -- refresh the rendered views so teammates browsing the repo see current content.
157
+ 5. ~ Review the generated `vbrief/proposed/` and `vbrief/pending/` scope vBRIEFs; promote / activate / cancel them as appropriate via `task scope:promote|activate|complete|cancel|restore|block|unblock`.
158
+ 6. ~ Commit the migration in a focused PR with a conventional-commit subject such as `chore(deft): migrate to vBRIEF-centric document model (v0.20)`.
159
+
160
+ ---
161
+
162
+ ## 6. Troubleshooting
163
+
164
+ - **`task vbrief:validate` fails on my scope vBRIEFs:** filename must follow `YYYY-MM-DD-<lowercase-slug>.vbrief.json` (D7); folder must match `plan.status` (D2); PROJECT-DEFINITION must have `overview` and `tech stack` narrative keys after `.lower()` (D3).
165
+ - **`task migrate:vbrief` did not migrate my roadmap:** the migration parser recognises task-based (`- \`X.Y.Z\` Title`) and plain (`- Title`) list item formats under `## ` headings. Custom formats fall through to synthetic IDs -- review the generated vBRIEFs and rename / reshape as needed.
166
+ - **My agent hits a missing `deft/skills/deft-*/` path:** that is a stale v0.19 `AGENTS.md` from before the `deft-directive-*` rename. Tell your agent "Read `deft/QUICK-START.md` and follow it" -- QUICK-START refreshes the Deft-managed section of `AGENTS.md` idempotently. See `UPGRADING.md` (present in repositories on v0.20 or later) for the detailed upgrade flow.
167
+ - **I edited `SPECIFICATION.md` by accident:** revert the file to the redirect stub (`<!-- deft:deprecated-redirect -->` + the three-line note), then edit `vbrief/specification.vbrief.json` and run `task spec:render`.
168
+
169
+ ---
170
+
171
+ ## 7. Related Reading
172
+
173
+ - [README.md](../../README.md) -- product overview and greenfield flow.
174
+ - [QUICK-START.md](../QUICK-START.md) -- agent bootstrap (also handles the brownfield AGENTS.md append case).
175
+ - [vbrief/vbrief.md](../vbrief/vbrief.md) -- canonical vBRIEF file taxonomy, lifecycle folders, and status mapping.
176
+ - [commands.md](../commands.md) -- full `run` vs `task` command lifecycle.
177
+ - `skills/deft-directive-build/SKILL.md` -- Pre-Cutover Detection Guard implementation.
178
+ - `skills/deft-directive-setup/SKILL.md` -- greenfield path for comparison.
179
+ - `UPGRADING.md` (repo root, v0.20+) -- version-by-version upgrade guide.
@@ -0,0 +1,137 @@
1
+ # Getting Started with Deft Directive
2
+
3
+ Deft Directive is a Taskfile-first framework for AI-assisted software work. It combines agent guidance, deterministic gates, vBRIEF lifecycle metadata, installer/doctor handoff, and cache-backed backlog workflows. This guide walks through installation, preferences, project setup, and the first scope workflow.
4
+
5
+ > **Note**: This guide is an orientation layer. For current architecture details, see [ARCHITECTURE.md](../../docs/ARCHITECTURE.md); for command behavior, see [commands.md](../commands.md).
6
+
7
+ ## Deft & Directive (naming)
8
+
9
+ **Deft is the company; Directive is the product.** *Deft* names the organization and the on-disk footprint (`.deft/`, `@deftai/*` npm scope, user config under `~/.config/deft/`). *Directive* names the framework you install and run: the npm package is `@deftai/directive`, and the primary CLI is `directive` (`deft` is an alias). Legacy `deft-install` / `deft` paths in this guide refer to the same product during the staged transition ([#423](https://github.com/deftai/directive/issues/423)).
10
+
11
+ ---
12
+
13
+ ## Prerequisites
14
+
15
+ - **Node 20+** and **pnpm** for live gates and the npm distribution channel (see `.nvmrc` in the framework payload).
16
+ - **Go 1.22+** only if you use the bootstrap Go installer or build from source.
17
+ - **Python 3.11+**, **uv**, **task**, **git**, and **gh** for full framework workflows — run `directive toolchain:check` (or `deft toolchain:check`) after install.
18
+
19
+ ---
20
+
21
+ ## Installation
22
+
23
+ ### npm (coming soon — not yet published)
24
+
25
+ > ⚠️ **The `@deftai/directive` npm package is not yet published** to the registry (provisioning tracked by [#1909](https://github.com/deftai/directive/issues/1909)). **Until it goes live, install via the [Go installer](#go-installer-bootstrap) below.** The commands shown here are what the install will become once the package is published.
26
+
27
+ <!-- TODO(#1909): flip to npm-canonical and remove this "coming soon" notice when @deftai/directive is published -->
28
+
29
+ Once published, when Node is already available you will install Directive globally:
30
+
31
+ ```bash
32
+ npm i -g @deftai/directive
33
+ directive --version # primary command
34
+ deft --version # alias — same binary
35
+ ```
36
+
37
+ One-shot without a global install (also once published):
38
+
39
+ ```bash
40
+ npx @deftai/directive doctor
41
+ npx @deftai/directive session:start
42
+ ```
43
+
44
+ This npm path is the emerging primary distribution channel under `@deftai/directive` ([#11](https://github.com/deftai/directive/issues/11)); the Go installer below remains the install/bootstrap option today and during the staged retire window.
45
+
46
+ ### Go installer (bootstrap)
47
+
48
+ Download a platform installer from the [Directive release page](https://github.com/deftai/directive/releases) and run it from the project you want to adopt:
49
+
50
+ ```bash
51
+ deft-install --yes --repo-root . --json
52
+ ```
53
+
54
+ For existing consumer projects, the headless upgrade path is:
55
+
56
+ ```bash
57
+ deft-install --yes --upgrade --repo-root . --json
58
+ ```
59
+
60
+ Those consumer flows intentionally project Deft-managed files into your project
61
+ root (`AGENTS.md`, skills pointers, gitignore entries, vbrief scaffolding, and
62
+ related guard configuration). Framework maintainers working inside a
63
+ `deftai/directive` checkout should instead follow
64
+ [`CONTRIBUTING.md`](../../CONTRIBUTING.md) and use `--maintainer`; maintainer setup
65
+ checks tools without rewriting consumer-managed files.
66
+
67
+ ---
68
+
69
+ ## First Project
70
+
71
+ <!-- TODO: Walk through deft-setup phases: USER.md, PROJECT.md, SPECIFICATION.md -->
72
+
73
+ ---
74
+
75
+ ## Working an existing backlog
76
+
77
+ If you are adopting Deft on a project that already has an issue tracker (existing repo, brownfield migration, an upstream bug list that has been accumulating), you do not have to start from an empty `vbrief/proposed/`. The refinement skill's **Phase 0 triage workflow** lets you walk an existing backlog locally, decide what to keep, and let only the **accepted** items land in `vbrief/proposed/`. Trigger words: **"triage"**, **"work the cache"**, **"pre-ingest"**, **"action menu"**.
78
+
79
+ ### Step 1 — Scoped first populate
80
+
81
+ A real-sized backlog can drain the shared GitHub GraphQL bucket if you fetch everything at once (see [#976](https://github.com/deftai/directive/issues/976) for the recurring symptom). Scope the first populate so it lands in seconds rather than minutes:
82
+
83
+ ```bash
84
+ task triage:bootstrap -- --limit 50 --state open
85
+ ```
86
+
87
+ Flag surface (shared by `task triage:bootstrap` and `task cache:fetch-all`):
88
+
89
+ - `--limit <N>` caps the number of issues fetched (start with `50` and widen as needed).
90
+ - `--state {open|closed|all}` selects the issue state (default `open`).
91
+ - `--batch-size <N>` caps the per-page fetch (default `10`).
92
+ - `--delay-ms <N>` inserts a sleep between batches so a populate against a large repo does not trip the rate limiter (default `500`; a `429` retries automatically using the upstream `Retry-After` header).
93
+ - `--repo OWNER/NAME` is optional; when omitted, the bootstrap infers the slug from `git remote get-url origin`.
94
+
95
+ The unbounded no-flag form remains the default for small backlogs. For real-sized repos, prefer the scoped first run; you can always re-enter triage later to widen the slice.
96
+
97
+ ### Step 2 — Walk the action menu
98
+
99
+ After the cache is populated, ask your agent to triage. For each cached candidate the agent presents a numbered action menu and waits for your decision:
100
+
101
+ ```
102
+ 1. Accept -- task triage:accept <issue> (writes proposed/ vBRIEF + audit-log entry)
103
+ 2. Reject -- task triage:reject <issue> (audit-log entry only; closes the upstream issue)
104
+ 3. Defer -- task triage:defer <issue> (non-terminal; resurfaces on the next pass)
105
+ 4. Needs-AC -- task triage:needs-ac <issue> (non-terminal; flags missing acceptance criteria)
106
+ 5. Mark duplicate -- task triage:mark-duplicate <a> <b> (terminal; cross-links the duplicate target)
107
+ 6. Discuss
108
+ 7. Back
109
+ ```
110
+
111
+ Only **accepted** items become scope vBRIEFs in `vbrief/proposed/`. Rejected, deferred, and duplicate decisions are recorded in the audit log so the backlog stays focused. Bulk verbs (`task triage:bulk-accept` / `bulk-reject` / `bulk-defer` / `bulk-needs-ac`) handle predictable patterns (e.g. "reject every `wontfix`-labelled candidate") without walking the menu N times.
112
+
113
+ ### Step 3 — Understand the three-tier model
114
+
115
+ Phase 0 reads and writes three distinct stores; they never collapse into one:
116
+
117
+ - **Cache** — `.deft-cache/github-issue/<owner>/<repo>/<N>/` is the local mirror of fetched issue bodies, labels, and state. Populated by `task cache:fetch-all`; read via `task cache:get -- github-issue OWNER/NAME/<N>`. The directory is gitignored — your local mirror is private to your machine. The cache is the **read** surface for triage so decisions are reproducible across re-runs (no live `gh issue view` per decision).
118
+ - **Audit log** — `vbrief/.eval/candidates.jsonl` is an append-only JSONL recording every candidate you have ever seen plus the action taken (`accept | reject | defer | needs-ac | mark-duplicate`) and a timestamp. Re-running triage against the same cache short-circuits items that already have a terminal entry, so deferred / Needs-AC items resurface and rejected ones do not.
119
+ - **Accepted backlog** — `vbrief/proposed/` is the standard scope-vBRIEF lifecycle folder. **Writes flow only through `task triage:accept`**, which delegates the actual vBRIEF authoring to `task issue:ingest` so slug, reference, and schema rules stay in one place. Hand-authored proposed/ vBRIEFs are still allowed; what changed is that triage no longer writes there silently.
120
+
121
+ ### Step 4 — Why this avoids the GraphQL drain
122
+
123
+ The shared GitHub GraphQL bucket (5000 points/hour per identity) is the operational bottleneck under multi-agent / shared-identity workflows, not the REST `core` bucket. The triage cache is **REST-backed** (`gh api` reads, not `gh issue view --json`), and the populate uses **batched delays** plus automatic 429 retries with the upstream `Retry-After` header. There is no live `gh issue view` per accept / reject / defer decision — every decision reads from the local cache. This is why the scoped flags exist: they let you keep the populate inside the REST budget and well clear of the GraphQL bottleneck (see [#976](https://github.com/deftai/directive/issues/976) for the recurrence pattern). Refresh the cache on demand with `task cache:fetch-all` (idempotent — fresh entries are skipped) or audit drift against `vbrief/active/*.vbrief.json` with `task triage:refresh-active`.
124
+
125
+ Full command reference for every triage and cache verb lives in [`commands.md` § Backlog triage & cache tasks](../commands.md#backlog-triage--cache-tasks); the canonical agent-facing description of the workflow lives in `skills/deft-directive-refinement/SKILL.md` Phase 0.
126
+
127
+ ---
128
+
129
+ ## Using Strategies
130
+
131
+ <!-- TODO: Introduce strategy selection, chaining gate, and common workflows (interview, rapid, enterprise) -->
132
+
133
+ ---
134
+
135
+ ## Agent Configuration
136
+
137
+ <!-- TODO: Cover AGENTS.md, skill routing, Warp Drive integration, and cloud agent dispatch -->
@@ -0,0 +1,137 @@
1
+ # A good AGENTS.md is a model upgrade. A bad one is worse than no docs at all.
2
+
3
+ **Source**: https://x.com/augmentcode/status/2047164534310494709
4
+ **Author**: Slava Zhenylenko (Member of Technical Staff, Augment Code)
5
+ **Published**: 2026-04-23
6
+
7
+ ---
8
+
9
+ We pulled dozens of AGENTS.md files from across our monorepo and measured their effect on code generation. The best ones gave our coding agent a quality jump equivalent to upgrading from Haiku to Opus. The worst ones made the output worse than having no AGENTS.md at all.
10
+
11
+ That gap was surprising enough that we built a systematic study around it.
12
+
13
+ What we found: most of what people put in AGENTS.md either doesn't help or actively hurts, and the patterns that work are specific and learnable.
14
+
15
+ ## The same file can help one task and hurt another by 30%
16
+
17
+ A single AGENTS.md isn't uniformly good or bad. The same file boosted best_practices by 25% on a routine bug fix and dropped completeness by 30% on a complex feature task in the same module.
18
+
19
+ On the bug fix, a decision table for choosing between two similar data-fetching approaches helped the agent pick the right pattern immediately and stay within codebase standards. On the feature task, the agent read that same file, got pulled into the reference section, opened dozens of other markdown files trying to verify its approach against every guideline, created unnecessary abstractions, and shipped an incomplete solution.
20
+
21
+ Different blocks of the document had opposite effects on different tasks.
22
+
23
+ What follows is which patterns work, which fail, and how to tell which is which for your codebase.
24
+
25
+ ## How we measured this
26
+
27
+ We used AuggieBench, one of our internal eval suites, to evaluate how well agents do our internal dev work. We start with high-quality PRs from a large repo that reflect typical day-to-day agent tasks, set up the environment and prompt, and ask the agent to do the same task. Then we compare its output against the golden PR, the version that actually landed after review by multiple senior engineers. We filtered out PRs with scope creep or known bugs.
28
+
29
+ For this study, we added two more filters: PRs had to be contained within a single module or app, and the scope had to be one where information in an AGENTS.md might plausibly help. We then ran each task twice, with and without the file, and compared scores.
30
+
31
+ ## What works
32
+
33
+ ### 1. Progressive disclosure beats comprehensive coverage
34
+
35
+ Treat your AGENTS.md like a skill. Cover the common cases and workflows at a high level, then push details into reference files the agent can load on demand. Keep each reference's scope clear so the agent knows when to pull it in.
36
+
37
+ The 100–150 line AGENTS.md files with a handful of focused reference documents were the top performers in our study, delivering 10–15% improvements across all metrics in mid-size modules of around 100 core files. Once the main file got longer than that, the gains started reversing.
38
+
39
+ ### 2. Procedural workflows take agents from failing to finishing
40
+
41
+ Describing a task as a numbered, multi-step workflow was one of the strongest patterns we measured. A well-written workflow can move the agent from unable to complete a task to producing a correct solution on the first try.
42
+
43
+ One example from our codebase: a six-step workflow for deploying a new integration. The agent followed it step by step. The share of PRs with missing wiring files dropped from 40% to 10%, and the agent finished faster on average. Correctness went up 25%. Completeness went up 20%.
44
+
45
+ For complex workflows, keep the main file concise and use reference files for branching cases.
46
+
47
+ ### 3. Decision tables resolve ambiguity before the agent writes code
48
+
49
+ When your codebase has two or three reasonable ways to do something, decision tables force the choice up front. This is the pattern that most directly improved adherence to codebase conventions.
50
+
51
+ Example: resolving React Query vs Zustand for state management. PRs in this area scored 25% higher on best_practices. The table resolved the ambiguity before the agent wrote a single line of code.
52
+
53
+ ### 4. Examples from the real codebase improve code reuse
54
+
55
+ Short snippets of 3–10 lines from actual production code improved reuse and pattern adherence. Keep it to a few examples that are most relevant and not duplicative. More than that and the agent starts pattern-matching on the wrong thing.
56
+
57
+ ### 5. Domain-specific rules still matter
58
+
59
+ This is the pattern most people already associate with AGENTS.md: language- or org-specific gotchas. This works when the rule is specific and enforceable. It stops working when you stack dozens of them.
60
+
61
+ ### 6. Pair every "don't" with a "do"
62
+
63
+ Warning-only documentation consistently underperformed documentation that paired prohibitions with a concrete alternative.
64
+
65
+ If you add *Don't instantiate HTTP clients directly*, pair it with *Use the shared apiClient from lib/http with the retry middleware*.
66
+
67
+ The first on its own makes the agent cautious and exploratory. The pair tells it what to do and moves on.
68
+
69
+ AGENTS.md files with 15+ sequential "don'ts" and no "dos" caused the agent to over-explore, stay conservative, and do less work.
70
+
71
+ ### 7. Keep your code modular, and AGENTS.md too
72
+
73
+ The best-performing agent docs described relatively isolated submodules. Mid-size modules, around 100 core files, with a 100–150 line AGENTS.md and a few reference documents, were where we saw the 10–15% cross-metric gains. Examples: UI components of the client, standalone services.
74
+
75
+ Huge, cross-cutting AGENTS.md files at the repo root underperformed module-level ones. But the document itself is only part of the story.
76
+
77
+ In our study, the worst-performing AGENTS.md files were the ones sitting on top of massive surrounding documentation. One module had 37 related docs totaling about 500K characters. Another had 226 docs totaling over 2MB. In both cases, removing just the AGENTS.md barely changed agent behavior. The agent kept finding and reading the surrounding doc sprawl, and the sprawl was the problem.
78
+
79
+ If your AGENTS.md is good but your module has 500K of specs around it, the specs are what the agent is reading. Fix the documentation environment, not just the entry point.
80
+
81
+ ## Where AGENTS.md falls short
82
+
83
+ ### The overexploration trap
84
+
85
+ This is the most common failure mode we observed, and it's essentially context rot.
86
+
87
+ Two patterns cause it:
88
+
89
+ **1. Too much architecture overview.**
90
+
91
+ The agent gets pulled into reading documentation files, sometimes dozens of them, trying to "better understand the architecture." It loads tens or hundreds of thousands of tokens of context, and the output gets worse.
92
+
93
+ **2. Excessive warnings**
94
+
95
+ A big section of "don'ts" without matching "dos" produces a specific failure. The agent reads each instruction, tries to figure out whether it applies to the current task, and starts verifying its solution against every single warning. With 30–50 warnings, that means reading migration scripts, checking API version compatibility, and exploring auth middleware code, even on a task where none of it matters.
96
+
97
+ ### New patterns break old documentation
98
+
99
+ If you're introducing a pattern that doesn't exist in your codebase yet, AGENTS.md can actively steer the agent in the wrong direction.
100
+
101
+ ### Know what you're optimizing for
102
+
103
+ Different patterns move different metrics. Pick the patterns that target the problem you actually have.
104
+
105
+ ## How agents actually find your docs
106
+
107
+ Before deciding how to migrate your existing documentation, it helps to know what the agent actually reads. We traced documentation discovery across hundreds of sessions. The discovery rates are lopsided enough to shape migration priorities.
108
+
109
+ | Discovery method | Rate |
110
+ |---|---|
111
+ | AGENTS.md (auto-loaded from hierarchy) | 100% |
112
+ | References out of AGENTS.md (on demand) | 90%+ |
113
+ | Directory-level README.md (when working in that dir) | 80%+ |
114
+ | Nested READMEs in subdirectories not being worked in | ~40% |
115
+ | Orphan docs in _docs/ folders with no references | <10% |
116
+
117
+ AGENTS.md is the only documentation location with reliable discovery. If something needs to be seen, it either lives there or is directly referenced from there. Moving the content into a referenced location is usually higher leverage than writing more docs.
118
+
119
+ ## Migrating existing docs
120
+
121
+ Every company already has READMEs, architecture docs, and design specs scattered across the repo. Here's how to turn that into something an agent can actually use.
122
+
123
+ **Should you just rename your README.md to AGENTS.md?**
124
+
125
+ READMEs and AGENTS.md serve different audiences, but they can be reused. Agents are good enough at codebase summarization now that human-oriented docs are less necessary than they used to be. You can either write an agentic doc from scratch, or reuse your README. If you reuse it, trim it aggressively. Keep it short, follow the patterns above, and cut any section that's there for humans to skim.
126
+
127
+ **When to keep existing documentation**
128
+
129
+ If the docs are high quality, current, to the point, and have examples, reuse them. Reference them from module- or folder-level AGENTS.md files. Don't put more than 10–15 references in a single AGENTS.md and keep the context lean. And audit the surrounding environment: if the module around your AGENTS.md has dozens of architecture docs and spec files, the agent will find and read them whether you reference them or not. A focused 150-line AGENTS.md sitting on top of 500K of surrounding specs won't save the agent from the specs.
130
+
131
+ **AGENTS.md isn't the only path**
132
+
133
+ Agents find reference material through grep and semantic search too. About half of all search-result hits in our traces came from those tools, not from AGENTS.md references. If you're keeping legacy documentation, make sure the docs include relevant code examples and descriptive text that's searchable. A well-structured AGENTS.md gives you more control over what ends up in the context window, but it isn't the only way in.
134
+
135
+ ## What this study didn't cover
136
+
137
+ We focused on one-shot trajectories and the agent's ability to finish coding tasks without human intervention. We didn't look at best practices for maintaining AGENTS.md over time, though we're exploring that now. We also didn't cover operational, interactive, or analytics tasks. Those are coming in future posts.
@@ -0,0 +1,89 @@
1
+ # Deft Events
2
+
3
+ Unified structural artifact listing every framework event in a single data
4
+ file, partitioned by the required `category` enum.
5
+ Wired under epic [#635](https://github.com/deftai/directive/issues/635) per
6
+ the canonical [#642 workflow comment](https://github.com/deftai/directive/issues/642#issuecomment-4330742436)
7
+ and unified per the Repair Authority [AXIOM] proposal
8
+ ([#709](https://github.com/deftai/directive/issues/709)) and the
9
+ data-file-convention check follow-up
10
+ ([#710](https://github.com/deftai/directive/issues/710)). The prior
11
+ `events/behavioral.yaml` registry has been folded into `registry.json`.
12
+
13
+ ## Files
14
+
15
+ - `registry.json` — single source of truth for every event name, category,
16
+ payload contract, detector / emission pointer, and consumer pointers.
17
+ Lists 5 `detection-bound` events and 4 `behavioral` events (9 total).
18
+ - `registry.schema.json` — schema validating the registry's shape, including
19
+ the required `category` enum (`detection-bound` | `behavioral`).
20
+ - `event-record.schema.json` — schema for individual emitted event records.
21
+
22
+ ## Categories
23
+
24
+ Every entry MUST carry a `category` enum value. Two categories exist today;
25
+ future categories are additive enum extensions per the
26
+ data-file-convention check ([#710](https://github.com/deftai/directive/issues/710)):
27
+
28
+ - **`detection-bound`** — detectable from filesystem state alone (e.g. dirty
29
+ tree, vBRIEF schema invalidity, version drift). Emitted via
30
+ `scripts/_event_detect.py`. Detector lives at the call site documented in
31
+ the entry's `trigger` field.
32
+ - **`behavioral`** — requires runtime instrumentation (paired
33
+ `session:interrupted` / `session:resumed`, `plan:approved`,
34
+ `legacy:detected`). Emitted via `scripts/_events.py`, which manages 1:1
35
+ session-pair invariants and a JSONL append-only log at
36
+ `<project_root>/.deft-cache/events.jsonl`.
37
+
38
+ ## Emission
39
+
40
+ Both helpers consume the same `registry.json` data file and produce records
41
+ conforming to `event-record.schema.json`:
42
+
43
+ ```json
44
+ {
45
+ "event": "<registered name>",
46
+ "detected_at": "<UTC ISO-8601 seconds>",
47
+ "payload": { ...per-event contract... }
48
+ }
49
+ ```
50
+
51
+ `scripts/_event_detect.py::emit(name, payload)` validates against the full
52
+ registry (any registered name is accepted) and is silent by default; when the
53
+ `DEFT_EVENT_LOG` environment variable points to a writable path, each
54
+ emission is appended as a single JSON line.
55
+
56
+ `scripts/_events.py::emit(name, payload)` validates against the
57
+ `category="behavioral"` subset of the registry, generates a sortable event id
58
+ for pairing semantics, enforces required-payload contracts, and persists to
59
+ `<project_root>/.deft-cache/events.jsonl` (or a path injected via `log_path` /
60
+ `DEFT_EVENT_LOG`). The log lives under the already-gitignored `.deft-cache/`
61
+ rather than `.deft/`, which is no longer blanket-gitignored now that
62
+ `.deft/core/` is a committed payload (#11 / #1465). Use this helper when
63
+ emitting behavioral events from
64
+ skills (`python -m scripts._events emit ...`).
65
+
66
+ ## Adding an event
67
+
68
+ 1. Append the entry to `registry.json` with the appropriate `category`,
69
+ payload contract, trigger pointer, and consumer pointers (validate via
70
+ `tests/cli/test_events.py` and `tests/cli/test_behavioral_events.py`).
71
+ 2. Add the detection / emission call site in `scripts/` or the relevant
72
+ surface (use `scripts/_event_detect.py` for detection-bound,
73
+ `scripts/_events.py` for behavioral).
74
+ 3. Reference the event by name from at least one consumer (skill, task,
75
+ script) so the surface stays usable -- the schema requires `consumers`
76
+ to be a non-empty array.
77
+
78
+ The registry's `consumers` array is the single audit trail for who reacts
79
+ to each event — keep it current when wiring or removing call sites.
80
+
81
+ ## Adding a new category
82
+
83
+ New categories are an additive change to the schema's `category` enum:
84
+ update `registry.schema.json` `$defs.Event.properties.category.enum`,
85
+ document the new category in the registry `description` and this README,
86
+ and add corresponding tests asserting the new category is recognized.
87
+ The existing 5 detection-bound + 4 behavioral entries remain stable
88
+ through such extensions per the unification convention agreed in #642 /
89
+ #709 / #710.
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/deftai/directive/events/event-record.schema.json",
4
+ "title": "Deft Event Record",
5
+ "description": "Schema for a single emitted event record produced by scripts/_event_detect.py::emit() (filename is intentionally distinct from the sibling vBRIEF's scripts/_events.py for behavioral events; merge-time consolidation may unify them). The shape is uniform across detection-bound and behavioral events; the per-event payload contract is defined in events/registry.json.",
6
+ "type": "object",
7
+ "required": ["event", "detected_at", "payload"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "event": {
11
+ "type": "string",
12
+ "description": "Canonical event name; MUST match an entry in events/registry.json.",
13
+ "pattern": "^[a-z][a-z0-9-]*(:[a-z][a-z0-9-]*)+$"
14
+ },
15
+ "detected_at": {
16
+ "type": "string",
17
+ "description": "UTC ISO-8601 timestamp (seconds precision) when emit() was called. Format: YYYY-MM-DDTHH:MM:SSZ.",
18
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"
19
+ },
20
+ "payload": {
21
+ "type": "object",
22
+ "description": "Per-event payload object. Keys/types defined in events/registry.json under the matching event's payload contract.",
23
+ "additionalProperties": true
24
+ }
25
+ }
26
+ }