@deftai/directive-content 0.83.0 → 0.85.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Taskfile.yml +13 -0
- package/UPGRADING.md +43 -0
- package/commands.md +24 -4
- package/docs/product-signal.md +3 -0
- package/docs/task-cache.md +37 -0
- package/package.json +1 -1
- package/packs/skills/skills-pack-0.1.json +4 -4
- package/skills/deft-directive-build/SKILL.md +30 -8
- package/skills/deft-directive-pre-pr/SKILL.md +13 -3
- package/skills/deft-directive-review-cycle/SKILL.md +7 -1
- package/skills/deft-directive-swarm/SKILL.md +22 -7
- package/tasks/agent.yml +15 -0
- package/tasks/docs.yml +37 -0
- package/tasks/policy.yml +10 -0
- package/tasks/review-monitor.yml +11 -1
- package/tasks/verify.yml +10 -0
- package/templates/agent-prompt-preamble.md +7 -0
- package/tools/package-manager-network.md +3 -2
package/Taskfile.yml
CHANGED
|
@@ -69,6 +69,9 @@ env:
|
|
|
69
69
|
UV_PROJECT: '{{.TASKFILE_DIR}}'
|
|
70
70
|
|
|
71
71
|
includes:
|
|
72
|
+
docs:
|
|
73
|
+
taskfile: ./tasks/docs.yml
|
|
74
|
+
optional: true
|
|
72
75
|
ts:
|
|
73
76
|
taskfile: ./tasks/ts.yml
|
|
74
77
|
optional: true
|
|
@@ -93,6 +96,9 @@ includes:
|
|
|
93
96
|
review-monitor:
|
|
94
97
|
taskfile: ./tasks/review-monitor.yml
|
|
95
98
|
optional: true
|
|
99
|
+
agent:
|
|
100
|
+
taskfile: ./tasks/agent.yml
|
|
101
|
+
optional: true
|
|
96
102
|
architecture:
|
|
97
103
|
taskfile: ./tasks/architecture.yml
|
|
98
104
|
optional: true
|
|
@@ -380,6 +386,13 @@ tasks:
|
|
|
380
386
|
cmds:
|
|
381
387
|
- task: ts:test
|
|
382
388
|
|
|
389
|
+
check:merge:
|
|
390
|
+
desc: "Merge chokepoint gate — explicit alias for check:framework-source (#1704). CI and PR gates SHOULD invoke this (or task check) as the single SoT so discrete workflow steps cannot drift."
|
|
391
|
+
deps:
|
|
392
|
+
- task: engine:_ts-build
|
|
393
|
+
cmds:
|
|
394
|
+
- task: check:framework-source
|
|
395
|
+
|
|
383
396
|
check:framework-source:
|
|
384
397
|
desc: "Run all framework source-repo pre-commit checks (TS-only after #1860). Sole wired consumer of maintainer-only core:build / core:clean."
|
|
385
398
|
deps:
|
package/UPGRADING.md
CHANGED
|
@@ -80,6 +80,49 @@ From v0.55.1 onwards `@deftai/directive` is published on npm. The canonical cons
|
|
|
80
80
|
|
|
81
81
|
Ensure pnpm's global bin directory is on your `PATH` (`pnpm setup` configures `PNPM_HOME`). A project-local `pnpm add -D @deftai/directive@latest` (run via `pnpm exec directive …`) is equivalent for pnpm-managed repos that avoid global installs. `deft update` / `deft migrate` / `deft doctor` all work identically regardless of which package manager installed the engine.
|
|
82
82
|
|
|
83
|
+
### Corporate or mirrored npm registry
|
|
84
|
+
|
|
85
|
+
Corporate npm proxies can lag the public registry. The visible failure may be an
|
|
86
|
+
`E404` / `ETARGET`, or it may fail silently: `@latest` resolves successfully
|
|
87
|
+
but installs an older Directive release.
|
|
88
|
+
|
|
89
|
+
Check npm's effective routing without contacting a registry:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm config get @deftai:registry
|
|
93
|
+
npm config get registry
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The scoped value wins when `@deftai:registry` is set; otherwise npm uses the
|
|
97
|
+
default `registry`. If either effective value is not
|
|
98
|
+
`https://registry.npmjs.org/`, choose a recovery path allowed by your
|
|
99
|
+
organization policy:
|
|
100
|
+
|
|
101
|
+
- **One command:** request the required release directly from public npm:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm i -g @deftai/directive@<version> --registry=https://registry.npmjs.org/
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- **Durable scoped routing:** add this line to the user or project `.npmrc` so
|
|
108
|
+
only the `@deftai` scope bypasses the default mirror:
|
|
109
|
+
|
|
110
|
+
```ini
|
|
111
|
+
@deftai:registry=https://registry.npmjs.org/
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
If direct public-registry access is prohibited, do not bypass the policy. Ask
|
|
115
|
+
IT or the registry administrator to synchronize all Directive packages:
|
|
116
|
+
`@deftai/directive`, `@deftai/directive-core`,
|
|
117
|
+
`@deftai/directive-content`, and `@deftai/directive-types`.
|
|
118
|
+
|
|
119
|
+
`directive doctor` checks this routing with offline `npm config get` reads. A
|
|
120
|
+
non-public effective registry produces an advisory warning but does not make
|
|
121
|
+
doctor fail; configured registry URLs are not printed because they can contain
|
|
122
|
+
internal hostnames or credentials. With `--network`, the release-availability
|
|
123
|
+
probe always queries the canonical public registry explicitly, independent of
|
|
124
|
+
the configured mirror.
|
|
125
|
+
|
|
83
126
|
2. **Refresh the project deposit** from your project root:
|
|
84
127
|
|
|
85
128
|
```bash
|
package/commands.md
CHANGED
|
@@ -170,10 +170,22 @@ Current status: the validation, extractor, provider, registry, generated MAP, an
|
|
|
170
170
|
|
|
171
171
|
## Quality And Verification Commands
|
|
172
172
|
|
|
173
|
-
- `task check` -- primary directive repo pre-commit gate.
|
|
173
|
+
- `task check` -- primary directive repo pre-commit gate (merge chokepoint — #1704).
|
|
174
|
+
- `task check:merge` -- explicit merge-chokepoint alias for `check:framework-source` in the framework source repo (#1704).
|
|
174
175
|
- `task check:framework-source` -- framework-source lane.
|
|
175
176
|
- `task check:consumer` -- consumer-shape lane.
|
|
176
177
|
- `task check:slow` -- slower/full checks.
|
|
178
|
+
|
|
179
|
+
### Gate throughput — iteration fast lane (#1704)
|
|
180
|
+
|
|
181
|
+
> **Invariant:** every change MUST pass the full gate at least once before merge.
|
|
182
|
+
|
|
183
|
+
- ! **Iteration lane (agents + humans):** during implementation, use affected/static gates — targeted tests on changed paths, relevant static `verify:*` gates, `task coverage:hotspots` / `task verify:forward-coverage` — not full `task check` on every commit.
|
|
184
|
+
- ! **Merge chokepoint:** full `task check` (or `task check:merge` in framework source) before push/PR and in CI via the monolith merge-gate job (`.github/workflows/ci.yml` runs `check:merge`, not cached `deft check`, until `#1713` can invoke internal Taskfile shims).
|
|
185
|
+
- ! **Escape-rate safety:** consume `#1703` Tier-1 telemetry (`helped/crud-metrics.jsonl`) and `task eval:health` (Tier 0) before tightening fast-lane defaults — do not invent a separate metric surface.
|
|
186
|
+
- ~ **In-engine incrementality (#1713):** content-hash cache + runner-delegated affected selection are delivered separately.
|
|
187
|
+
- ~ **Merge queue:** deferred — GitHub merge queue adoption waits until the CI monolith + escape-rate signal are stable; batch merge throughput is the next lever after `#1713` cache lands (#1704 ROI order).
|
|
188
|
+
- ⊗ Skip the merge chokepoint because the iteration lane passed.
|
|
177
189
|
- `task verify:session-ritual` -- validate session-start ritual state.
|
|
178
190
|
- `task verify:branch` -- enforce default-branch protection.
|
|
179
191
|
- `task verify:hooks-installed` -- ensure local git hooks are configured; use `deft verify:hooks-installed --scope=agent` for agent-host hooks.
|
|
@@ -185,17 +197,25 @@ Current status: the validation, extractor, provider, registry, generated MAP, an
|
|
|
185
197
|
|
|
186
198
|
Use `task --list` for the exact current verify namespace.
|
|
187
199
|
|
|
200
|
+
### Review-monitor ownership on Cursor (#2797 / #2814)
|
|
201
|
+
|
|
202
|
+
Use `task pr:watch -- <N>` as the blocking terminal-verdict wait for a `drive-to: merge-ready` Cursor `Task` leaf. A Cursor leaf cannot reliably spawn a nested `Task` review-monitor; do not replace the blocking wait with a background shell process or claim that it is monitoring.
|
|
203
|
+
|
|
204
|
+
When the workflow needs an Approach 1 monitor, scope the Cursor leaf `stop-at: pr-open`. The orchestrator that owns the Task primitive must spawn the sibling review-monitor and claim the PR-anchored lease with `task review-monitor:register -- --pr <N> --monitor-agent-id <id> --platform-primitive cursor-task`; `task verify:review-monitor -- --pr <N>` remains the fail-closed proof of active GitHub ownership (sticky `<!-- deft:review-owner -->` comment — not local JSON). Release with `task review-monitor:release -- --pr <N>` when done. See `skills/deft-directive-review-cycle/SKILL.md` Review Monitoring and `skills/deft-directive-swarm/SKILL.md` Phase 3.
|
|
205
|
+
|
|
206
|
+
**Worker liveness (#2824):** For in-flight `drive-to: merge*` Cursor leaves, monitors run `task verify:subagent-alive -- --require-agent <agent-id> [--scratch-dir <worktree>/.deft-scratch/subagent-status]` each poll iteration. Exit `1` prints `REDISPATCH_OK` — authorize takeover when the host still reports running but heartbeats are missing/STALE. Raw heartbeat sweep: `task agent:monitor`. See `docs/subagent-heartbeat.md` § Cursor false-alive.
|
|
207
|
+
|
|
188
208
|
### Agent-host direct-write hooks (#2438, #2596)
|
|
189
209
|
|
|
190
|
-
`directive init` and `deft update` idempotently merge Directive-owned entries into `.claude/settings.json`, `.grok/hooks/deft.json`, `.cursor/hooks.json`, and `.codex/hooks.json` while preserving unrelated settings. `SessionStart` refreshes resume bookkeeping on a non-blocking path. `PreToolUse`
|
|
210
|
+
`directive init` and `deft update` idempotently merge Directive-owned entries into `.claude/settings.json`, `.grok/hooks/deft.json`, `.cursor/hooks.json`, and `.codex/hooks.json` while preserving unrelated settings. `SessionStart` refreshes resume bookkeeping on a non-blocking path. `PreToolUse` uses the lightweight `deft-hook` entrypoint rather than booting the full CLI router, reducing cold hook latency while retaining the same fail-closed ritual, scope, and runtime-authority decisions. Cursor `ApplyPatch` shares the direct-write registration, so each matched edit invokes one hook process. Cursor `preToolUse` deposits set `failClosed: true`, so allow decisions emit `{"permission":"allow"}` — empty stdout is treated as hook failure and would block Write tools. A second `PreToolUse` matcher covers spawn/Task tools (`Task`, `SubagentStart`, `spawn_subagent`, `start_agent`, `CreateAgent`) with the same pre-`start_agent` gate stack; explore spawns (`subagent_type: explore`) pass without implementation gates.
|
|
191
211
|
|
|
192
212
|
- **Read-only explore (#1185):** Prefer Grok role deposit `default_capability_mode = "read-only"` (see [issue #1185](https://github.com/deftai/directive/issues/1185)). Hooks also deny direct writes when `DEFT_HOOK_READ_ONLY=1` or the host payload signals read-only capability. Implementation spawns remain blocked in read-only posture unless explicitly marked explore.
|
|
193
213
|
|
|
194
214
|
- Verify registration: `deft verify:hooks-installed --scope=agent` (or `--scope=all` for git + agent hooks).
|
|
195
215
|
- Repair missing/drifted entries: `deft update`.
|
|
196
|
-
- **
|
|
216
|
+
- **Refresh and opt-out (#2790, #2752):** Upgrade `@deftai/directive`, then run `deft update` to refresh all four deposits to the fast path; do not hand-edit host hook files. Set `plan.policy.hostHooks.<host>` to `false` only when you deliberately need to disable a host's Tier-1 enforcement — it is not the performance fix. When a host is opted out, `deft update` / `directive init` skip creating or re-merging Directive-managed hook entries for that host; if a prior deposit left managed entries in the file, the next update strips only those entries and preserves unrelated settings. Inspect with `deft policy:show --field=hostHooks`. Doctor and `verify:hooks-installed --scope=agent` treat opted-out hosts as healthy — they do not recommend `deft update` to repair them.
|
|
197
217
|
- **Claude matcher scope:** Once `.claude/settings.json` hooks are loaded, Claude's `PreToolUse` matcher keys on tool names (`Edit`, `Write`, …), not target paths — matched tools can be gated for the whole session, including writes outside the project tree. Opt out of Claude hook deposit when that posture is unwanted.
|
|
198
|
-
- **Compact re-arm (#2113):** Cursor `preCompact` and Claude/Grok `PreCompact`/`PostCompact` call `deft
|
|
218
|
+
- **Compact re-arm (#2113):** Cursor `preCompact` and Claude/Grok `PreCompact`/`PostCompact` call `deft-hook --event session.compact` to mark the gated session ritual stale after context compaction/resume; the existing PreToolUse gate then denies direct writes until `deft session:start` and `deft verify:session-ritual -- --tier=gated`. Codex has no native compact hook — operators must re-run the mutation ritual manually after compaction.
|
|
199
219
|
- Codex project hooks are trust-gated by Codex. Directive verifies only that the registrations are structurally current; after an install or changed hook hash, open `/hooks` in Codex and review/approve the project hook commands. Runtime trust cannot be inferred from the file alone.
|
|
200
220
|
- Directive writes only `.codex/hooks.json`; it does not parse or modify `.codex/config.toml`. Codex can also load inline hooks from `config.toml`, so avoid defining duplicate Directive commands there or they may run more than once. See the [Codex hooks documentation](https://learn.chatgpt.com/docs/hooks).
|
|
201
221
|
- The P0 hook slice does not classify shell-mediated writes, MCP mutations, richer unified-exec calls, or WebSearch by default. **Runtime authority (#1394)** adds opt-in path allow/deny lists and graduated `scopes` (`edits`, `push`, `merge`) under `plan.policy.runtimeAuthority` — inspect with `deft policy:show --field=runtimeAuthority`. When `enabled: true`, PreToolUse denies classifiable direct-write targets outside `allowPaths` or matching `denyPaths` after ritual/scope/read-only gates; `scopes.edits` gates all direct writes. `push` / `merge` scopes are schema-only until Shell/MCP matchers land (host gap — TODO).
|
package/docs/product-signal.md
CHANGED
|
@@ -4,9 +4,12 @@ Phase 1 consented product-improvement signal under epic #2603 (#2693). Defaults
|
|
|
4
4
|
|
|
5
5
|
## Enable (project)
|
|
6
6
|
|
|
7
|
+
Trusted-org repos (`deftai/*`, plus `DEFT_VALUE_AUTOENABLE_ORGS`) receive a **one-time** install/upgrade force-on (#2822): local value feedback and product-signal enable flip ON on the next `directive update`, with a durable `.deft-cache/org-force-on-v2822.json` marker so later intentional opt-out is not fought forever. Outbound product signal still requires personal consent (D17).
|
|
8
|
+
|
|
7
9
|
```bash
|
|
8
10
|
task product-signal:enable -- --confirm
|
|
9
11
|
task policy:show -- --field=productSignal
|
|
12
|
+
task policy:clear-value-feedback # remove typed valueFeedback key → org-auto resolution
|
|
10
13
|
```
|
|
11
14
|
|
|
12
15
|
Capability-cost disclosure prints before `--confirm` applies `plan.policy.productSignal.enabled=true`.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# In-engine content-hash task cache (#1713)
|
|
2
|
+
|
|
3
|
+
Legend (from RFC2119): !=MUST, ~=SHOULD, ⊗=MUST NOT.
|
|
4
|
+
|
|
5
|
+
**See also**: [Issue #1713](https://github.com/deftai/directive/issues/1713) | [Issue #1704](https://github.com/deftai/directive/issues/1704) (process face) | [Issue #2784](https://github.com/deftai/directive/issues/2784) (public types follow-up)
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
`deft check` can skip unchanged cacheable gates by replaying prior exit-0 results from a local content-hash cache. The cache ships inside the CLI — zero extra install for consumers — and directive dogfoods the same layer for its own gate stack.
|
|
10
|
+
|
|
11
|
+
Cache entries live under `.deft/cache/task/` (gitignored, local-only).
|
|
12
|
+
|
|
13
|
+
## Correctness guards
|
|
14
|
+
|
|
15
|
+
- ! Cache only passes (exit `0`). Failures always re-run.
|
|
16
|
+
- ! `codeVersion` (installed directive version) is part of every cache key.
|
|
17
|
+
- ! Volatile gates opt out via `cacheable: false` on the internal registry.
|
|
18
|
+
- ! Fail open to running when inputs cannot be enumerated — never fail open to passing.
|
|
19
|
+
- Escape hatches: `deft check --no-cache`, `deft cache:clear`.
|
|
20
|
+
|
|
21
|
+
## Runner affected-test delegation
|
|
22
|
+
|
|
23
|
+
Affected-test **selection** stays with the consumer test runner. Directive detects the runner and documents the fast-lane convention; the merge gate still runs the full suite (#1704).
|
|
24
|
+
|
|
25
|
+
| Runner | Detection | Fast-lane convention |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| vitest | `package.json` lists `vitest`, or `plan.policy.testRunner = vitest` | `vitest --changed` |
|
|
28
|
+
| jest | `package.json` lists `jest` / `@jest/core`, or policy override | `jest --onlyChanged` |
|
|
29
|
+
| go | `go.mod` present, or policy override | `go test` (native package cache) |
|
|
30
|
+
| pytest | `pytest.ini` / `pyproject.toml` / `requirements.txt`, or policy override | `pytest --testmon` |
|
|
31
|
+
| none | No match after config + heuristics | Full suite at merge gate |
|
|
32
|
+
|
|
33
|
+
Override: set `plan.policy.testRunner` in `PROJECT-DEFINITION.xbrief.json` to `vitest`, `jest`, `go`, `pytest`, or `none`.
|
|
34
|
+
|
|
35
|
+
## Internal registry (v1)
|
|
36
|
+
|
|
37
|
+
Gate contracts (`inputs`, `outputs`, `cacheable`, `codeVersion`) are **internal** to `@deftai/directive-core` until #2784 promotes a public `@deft/types` shape. Under-declaration lint runs over known read sets; incomplete enumeration disables caching for that task.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deftai/directive-content",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.0",
|
|
4
4
|
"description": "Shippable Directive framework content in the consumer .deft/core/ layout (C1 flatten), plus the engine surfaces (.githooks/, Taskfile.yml, tasks/) the deposit wires. Python-free per #2022 Phase 3. Refs #11, #1669, #1967.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|