@deftai/directive-content 0.88.0 → 0.90.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 (38) hide show
  1. package/Taskfile.yml +15 -0
  2. package/UPGRADING.md +10 -0
  3. package/coding/security.md +13 -1
  4. package/commands.md +77 -3
  5. package/contracts/closed-verb-authz.md +117 -0
  6. package/contracts/escalation.md +114 -0
  7. package/contracts/finish-loop.md +121 -0
  8. package/contracts/host-lifecycle-duties.md +96 -0
  9. package/contracts/human-origin-authz.md +109 -0
  10. package/contracts/intent-ceiling.md +44 -0
  11. package/contracts/path-write-fence.md +128 -0
  12. package/contracts/runtime-authority.md +13 -3
  13. package/docs/inter-run-learning.md +27 -0
  14. package/docs/openclaw-agent-host.md +43 -3
  15. package/events/README.md +1 -1
  16. package/events/registry.json +36 -0
  17. package/package.json +1 -1
  18. package/packs/rules/rules-pack-0.1.json +41 -1
  19. package/packs/skills/skills-pack-0.1.json +3 -3
  20. package/patterns/install-trust.md +117 -0
  21. package/patterns/tool-call-taxonomy.md +73 -0
  22. package/scm/github.md +14 -2
  23. package/skills/deft-directive-article-review/SKILL.md +4 -1
  24. package/skills/deft-directive-release/SKILL.md +15 -0
  25. package/skills/deft-directive-setup/SKILL.md +8 -7
  26. package/skills/deft-directive-swarm/references/core-phase-4.md +20 -0
  27. package/skills/deft-directive-swarm/references/host-openclaw.md +27 -0
  28. package/tasks/directive.yml +22 -0
  29. package/tasks/engine.yml +1 -0
  30. package/tasks/lifecycle.yml +14 -1
  31. package/tasks/pr.yml +16 -0
  32. package/tasks/scm.yml +20 -0
  33. package/tasks/session.yml +11 -0
  34. package/tasks/verify.yml +10 -0
  35. package/templates/agent-prompt-preamble.md +12 -0
  36. package/templates/agents-entry.md +6 -2
  37. package/templates/project.md.template +6 -0
  38. package/vbrief/schemas/vbrief-core.schema.json +33 -0
@@ -0,0 +1,96 @@
1
+ # Host lifecycle duty list (#2968 / A3)
2
+
3
+ Stable moments where a **host** (IDE deposit or session-first workspace) must load
4
+ Directive’s portable brain (Skills Index, pins, main.md / AGENTS.md) before freestyle
5
+ tools. Short duty list — not a multi-host platform RFC.
6
+
7
+ Legend (RFC2119): `!`=MUST, `~`=SHOULD, `≉`=SHOULD NOT, `⊗`=MUST NOT, `?`=MAY.
8
+
9
+ Related: OpenClaw cold-start adapter
10
+ [`../skills/deft-directive-swarm/references/host-openclaw.md`](../skills/deft-directive-swarm/references/host-openclaw.md) (A7),
11
+ skill pins [`../docs/skill-pin-policy.md`](../docs/skill-pin-policy.md) (#2508),
12
+ session routing in AGENTS.md (#2176), cold-start algorithm orientation (#609).
13
+
14
+ ## Two host families
15
+
16
+ | Family | Typical hosts | How Directive loads |
17
+ |--------|---------------|---------------------|
18
+ | **1 — IDE / repo deposit** | Cursor, VS Code-class | Open folder → installer rails / deposit → agent already on project root |
19
+ | **2 — Session / workspace / companion** | OpenClaw, Buzz-class | Agent awake in workspace home; host skill list ≠ Directive Skills Index until bridged |
20
+
21
+ ! Directive **writes** host adapters. Host vendors expose extension points; they are not required to ship Directive adapters.
22
+
23
+ ⊗ Wait on Cursor / OpenClaw / Buzz vendors to implement our adapter for cold-start correctness.
24
+
25
+ ## Duty table (stable moments)
26
+
27
+ | Moment | Duty |
28
+ |--------|------|
29
+ | **Session start** | Resolve **project root** (WSL / dual-path SoT when applicable). Know how to reach the **Skills Index** (consumer: `.deft/core/REFERENCES.md`; framework: `content/REFERENCES.md` or root `REFERENCES.md`). Optional session ritual when mutation intent applies (`session:start` / `#1149`). Confirm Deft alignment when USER.md is present (#2176). |
30
+ | **Deft-shaped user intent** | Route via **Skills Index / skill trigger path before freestyle host tools**. Prefer **pinned Directive skills** over same-named host skills (e.g. Cursor `/review` or host “review” ≠ `deft-directive-article-review` / `deft-directive-review-cycle`). |
31
+ | **Tool boundary** (optional) | Classifier hook / write-intent path when installed (#2967 A2 class). Graph append when installed (#2966 A1 class). Not required for this first cut. |
32
+ | **Turn / session end** (optional) | Evidence flush / MEMORY note of which skill path ran, for APE continuity. |
33
+
34
+ ### Deft-shaped intent (examples)
35
+
36
+ Treat as Deft-shaped when the user asks for skills, review, triage, swarm, build, pre-PR, article review, consumer-repo Directive work, xBRIEF lifecycle, or equivalent process verbs.
37
+
38
+ ! On Deft-shaped intent: scan Skills Index (Level-0) → open matching `SKILL.md` (Level-1) **before** freestyle `gh` / shell / host-global skill improvisation.
39
+
40
+ ! Prefer always-pin Directive skills (`deft-directive-build`, `deft-directive-pre-pr`, `deft-directive-review-cycle`, `deft-directive-swarm`) when the work type matches (#2508).
41
+
42
+ ⊗ Answer a Deft-shaped request with only host-global tools or same-named host skills when a Directive skill is in the Skills Index for that intent (2026-07-30 miss class: “use review skill” + URL never entered `deft-directive-article-review`).
43
+
44
+ ## Family-1 reference: Cursor deposit
45
+
46
+ Cursor / project-deposit remains the **family-1 reference adapter**:
47
+
48
+ 1. Open repo at project root.
49
+ 2. Deposit / AGENTS managed section points at Skills Index and pins.
50
+ 3. Session routing loads main → USER → PROJECT-DEFINITION before mutation.
51
+
52
+ ### Cursor parity checklist
53
+
54
+ | Check | Status |
55
+ |-------|--------|
56
+ | Project root = opened workspace folder | **Pass** (host default) |
57
+ | Skills Index reachable from AGENTS managed section | **Pass** when deposit current |
58
+ | Always-pin names for process skills | **Pass** when AGENTS pin section present (#2508) |
59
+ | Plan-mode / product action bypass of skill path | **Known gap** — plan-mode and host product actions can skip skill load (#1708 class); fix on Cursor adapter only when cold-start or skill route still fails |
60
+ | Same-named host skill vs Directive skill | **Known gap** — prefer Directive pin / Skills Index match over host `/review`-class labels |
61
+
62
+ ## Family-2 first ship: OpenClaw (A7)
63
+
64
+ OpenClaw cold-start steps live in the swarm host adapter (source of truth for spawn + cold-start on that host):
65
+
66
+ [`../skills/deft-directive-swarm/references/host-openclaw.md`](../skills/deft-directive-swarm/references/host-openclaw.md) § Cold-start.
67
+
68
+ Operator map (non-authoritative discovery): [`../docs/openclaw-agent-host.md`](../docs/openclaw-agent-host.md).
69
+
70
+ ### OpenClaw pin wire (doctor) (#3001)
71
+
72
+ Session-first hosts still need a **bridge** from the installed content package into the host workspace skills root. On OpenClaw:
73
+
74
+ - ! `deft doctor` detects missing always-pins under `$OPENCLAW_STATE_DIR/workspace/skills` or `~/.openclaw/workspace/skills` when OpenClaw signals are present.
75
+ - ! `deft doctor --fix` deposits/links the four always-pins (build, pre-pr, review-cycle, swarm) into that main skills root (symlink preferred; copy fallback). Non-destructive of other user skills.
76
+ - ⊗ Rewrite every `workspace-*` crew seat by default — multi-seat only with `deft doctor --fix --openclaw-all-agents`.
77
+
78
+ Full operator steps: [`../docs/openclaw-agent-host.md`](../docs/openclaw-agent-host.md) § Wire skills into OpenClaw workspace.
79
+
80
+ ## Extension notes (out of first ship)
81
+
82
+ | Host / class | Note |
83
+ |--------------|------|
84
+ | **Buzz / Pi** | Session-first family-2 peers. Implement a dedicated `host-*.md` adapter when scheduled; reuse this duty table. Do not invent full platform abstraction in this cut. |
85
+ | **Warp / Grok Build** | Family-1-adjacent spawn hosts; deposit + AGENTS still own session orientation. Swarm launch adapters are separate from cold-start Skills Index load. |
86
+
87
+ ## Anti-patterns
88
+
89
+ - ⊗ Freestyle host tools first on Deft-shaped intent, then maybe open a skill.
90
+ - ⊗ Treat host skill inventory (`available_skills`, workspace skill folders) as the Directive Skills Index without a bridge.
91
+ - ⊗ Assume IDE deposit behavior on a session-first host that started outside the project root.
92
+ - ⊗ Abstract multi-host portability RFC with zero OpenClaw (or second-family) behavior change.
93
+
94
+ ## Acceptance pointer
95
+
96
+ Issue [#2968](https://github.com/deftai/directive/issues/2968): A3 = this contract; A7 = OpenClaw cold-start in `host-openclaw.md`. First cut closes when both surfaces land and `task verify:openclaw-tier1` stays green.
@@ -0,0 +1,109 @@
1
+ # Human-origin approval + UAT mutation lease (#2944 / #2948 Wave 1)
2
+
3
+ Layer **L1–L2** of the layered authorization stack (epic #2948). Composes with
4
+ `runtimeAuthority` (L3, #1394 / #2711) and does **not** re-implement Shell push/merge
5
+ matchers.
6
+
7
+ Threat model: **aligned agent** confusion — the agent believes self-authored
8
+ xBRIEF/lifecycle/dispatch state is permission. Credential-compromised local-file
9
+ forgery remains #983-class out of scope.
10
+
11
+ ## Defaults
12
+
13
+ | Surface | Default | Notes |
14
+ | --- | --- | --- |
15
+ | UAT lease | inactive | No Wave 1 denials until operator starts UAT |
16
+ | Human-origin grants | none | Minted only via `deft authz:grant` |
17
+
18
+ ## Human-origin grant
19
+
20
+ Stored under `.deft/authz/grants/<id>.json`.
21
+
22
+ Accepted `origin.kind` values:
23
+
24
+ - `operator-cli` (mint path: `deft authz:grant`)
25
+ - `operator-session` (future interactive approval)
26
+ - `human-event` (external human event ref)
27
+
28
+ **Rejected** (never satisfy an implementation-approval gate):
29
+
30
+ - `agent-lifecycle`, `xbrief-status`, `dispatch-envelope`, `allocation-context`,
31
+ `self-asserted`, `agent-authored`
32
+ - any grant with actor `agent` / `agent:*` / `self`
33
+
34
+ Structural binding (not crypto/HMAC):
35
+
36
+ - `scope.planRef`, `repo`, `branch`, `worktree`
37
+ - `scope.surfaces` — path globs (including user-visible UI)
38
+ - `scope.operations` — `edit` \| `push` \| `pr` \| `merge` \| `settings` \| `deployment` \| `issue_mutation`
39
+ - `scope.storyIds` / `issueIds`
40
+ - `scope.cohortId` — **required** for product mutations while UAT is active
41
+ - `semantics.expiresAt` / `singleUse`
42
+
43
+ ## Fail-closed UAT mutation lease
44
+
45
+ Start: `deft authz:uat-start -- --campaign <id>`
46
+ Suspend: `deft authz:uat-suspend`
47
+ Inspect: `deft authz:show`
48
+
49
+ While UAT is **active** (and was started with human-origin provenance):
50
+
51
+ | Attempt | Result without matching fix-cohort grant |
52
+ | --- | --- |
53
+ | Product / UI direct write | **deny** |
54
+ | `git push` / classifiable push MCP | **deny** |
55
+ | `gh pr create` / ready / edit | **deny** |
56
+ | `gh pr merge` / classifiable merge MCP | **deny** |
57
+ | settings / deploy heuristics | **deny** |
58
+ | Test execution (`vitest`, `pnpm test`, …) | **allow** |
59
+ | Issue filing (`gh issue create`) | **allow** |
60
+ | Evidence / defect capture writes (`xbrief/proposed/**`, `**/evidence/**`, `incidents/**`) | **allow** |
61
+
62
+ Approving one named fix cohort **does not** clear the UAT lock or authorize adjacent
63
+ failures or other operations (e.g. edit grant ≠ push).
64
+
65
+ ## Enforcement order (PreToolUse)
66
+
67
+ 1. Ritual / scope / read-only / spawn gates
68
+ 2. **Authz Wave 1** — UAT lease + human-origin grant (`#2944`)
69
+ 3. Runtime authority path + `scopes.edits` / `scopes.push` / `scopes.merge` (#1394 / #2711)
70
+
71
+ Denials name the missing permission and the human action required (typically
72
+ `deft authz:grant -- --cohort <id> --operations … --surfaces …`).
73
+
74
+ Audit appends to `.deft/authz/audit.jsonl` with:
75
+
76
+ `humanApprovalRef`, `approvedScope`, `attemptedOp`, `path`, `result`, `code`, `campaignId`.
77
+
78
+ ## CLI
79
+
80
+ ```bash
81
+ deft authz:show
82
+ deft authz:uat-start -- --campaign uat-2026-07-30
83
+ deft authz:grant -- --operations edit --surfaces 'apps/web/src/**' --cohort fix-defect-12 --stories 2944
84
+ deft authz:uat-suspend
85
+ deft authz:revoke -- grant-…
86
+ ```
87
+
88
+ ## Explicit non-goals (siblings)
89
+
90
+ | Concern | Owner |
91
+ | --- | --- |
92
+ | Shell/MCP push/merge matchers alone | #2711 |
93
+ | Slash-command intent ceiling / human merge | #1193 |
94
+ | Path write fence schema | #516 / #2443 |
95
+ | AFK session-auth / release verbs | #1095 — see `content/contracts/closed-verb-authz.md` (Wave 4; consumes these grants) |
96
+ | HMAC / hardware-keyed grants | non-goal for MVP |
97
+
98
+ ## Wave 4 consumers
99
+
100
+ Release-class closed verbs (`release-cut`, `release-publish`, `release-rollback`)
101
+ evaluate via `evaluateClosedVerb` and accept only:
102
+
103
+ - `DEFT_ALLOW_<VERB>=1` ephemeral bypass, or
104
+ - a **human-origin** grant from this store (templates: `deft authz:grant -- --template release-publish --target <ver>`)
105
+
106
+ They do not mint grants of their own. Walk-away finish-loop product: #871 (Wave 5) —
107
+ `authz:grant --template finish-loop` and `content/contracts/finish-loop.md`.
108
+
109
+ Refs #2948 #2711 #1394 #1378 #2176 #2402 #1095.
@@ -0,0 +1,44 @@
1
+ # Intent ceiling — slash-command containment, hotfix classifier, human merge (#1193)
2
+
3
+ Wave 2 of the layered authorization stack (#2948). Complements human-origin grants (#2944) and runtimeAuthority (#2711 / #1394).
4
+
5
+ ## R1 — Slash-command intent containment
6
+
7
+ When a session is originated by a slash command, that command is the **only** authorized verb for the session.
8
+
9
+ | Surface | Behavior |
10
+ |---------|----------|
11
+ | Env | `DEFT_SESSION_SLASH_VERB` (e.g. `/github-issue`, `/build`) |
12
+ | Preflight | `task xbrief:preflight` fails when the verb is non-implement |
13
+ | Hooks | PreToolUse denies implement/push/merge for non-implement verbs |
14
+ | Pure API | `evaluateIntentCeiling({ sessionVerb, requestedOp })` in `@deftai/directive-core/policy` |
15
+
16
+ **Implement verbs:** `/build`, `/ship`, `/ship-hotfix`, `/swarm`, `/implement` (plus free-text #810 action verbs when no slash provenance).
17
+
18
+ **Non-implement (contained):** `/github-issue`, `/triage`, `/refine`, `/discuss`, `/research`, and unknown stems (fail closed for lifecycle escalation).
19
+
20
+ ## R2 — Hotfix classifier
21
+
22
+ Typed `plan.policy.hotfixCriteria` (`maxLines` default 10, `maxFiles` default 2, `forbiddenPathGlobs`).
23
+
24
+ Pure `evaluateHotfixEligibility(input)`:
25
+
26
+ - **Eligible → propose `hotfix-candidate` only** (agent never promotes to `hotfix`)
27
+ - Pure revert always qualifies
28
+ - Small fix within limits, restores green, no new deps/exports/schema
29
+ - **Never:** refactor, new handler/route, export surface change, forbidden paths (Dockerfile, fly.toml, `.github/workflows/**`, migrations, auth/secrets)
30
+
31
+ ## R3 — Human merge gate
32
+
33
+ Typed `plan.policy.requireHumanMerge` (default **true** when `autoDeployOnMerge` is true).
34
+
35
+ | Surface | Behavior |
36
+ |---------|----------|
37
+ | Merge preflight | `task pr:wait-mergeable-and-merge` refuses agent merge when ON |
38
+ | `verify:branch` | Advisory note when ON |
39
+ | Branch protection | Setup docs: ≥1 human reviewer when ON |
40
+ | Session-start | Disclosure: `[deft policy] Human merge gate is ON …` |
41
+
42
+ **Override:** `task policy:allow-bot-merge -- --confirm` (capability-cost disclosure + audit log) or `DEFT_ALLOW_BOT_MERGE=1`.
43
+
44
+ Inspect: `task policy:show --field=requireHumanMerge` / `--field=hotfixCriteria`.
@@ -0,0 +1,128 @@
1
+ # Path write fence (#516 / #2443 / #2948 Wave 3)
2
+
3
+ Unified **write-scope** enforcement for agents: project path policy and per-story
4
+ `file_scope` share one evaluation model. There is no third parallel `writeScope`
5
+ schema with its own matcher.
6
+
7
+ ## Source of truth
8
+
9
+ | Layer | Where declared | Role |
10
+ | --- | --- | --- |
11
+ | **Project** | `plan.policy.runtimeAuthority` in `xbrief/PROJECT-DEFINITION.xbrief.json` | Session-level `allowPaths` / `denyPaths` + scopes (`edits` / `push` / `merge`) |
12
+ | **Story** | `plan.metadata.swarm.file_scope` on the active running xBRIEF | Per-story allow globs (swarm readiness already uses this list) |
13
+ | **Legacy alias** | `writeScope` on `plan.metadata` or `plan.metadata.swarm` | Read-time normalize to `file_scope` + deny globs only — **not** a second engine |
14
+
15
+ **Evaluation SoT (code):**
16
+
17
+ 1. `resolveWriteFence(projectPolicy, storyFileScope?)` builds one `RuntimeAuthorityPolicy`
18
+ 2. `evaluateRuntimeAuthorityPath` / `evaluateRuntimeAuthorityDirectWrite` decide allow/deny
19
+
20
+ ## Intersection rules
21
+
22
+ - **Empty project `allowPaths` when enabled** → all paths allowed until a story narrows them
23
+ - **Empty story `file_scope`** → project policy only
24
+ - **Story alone** (project `runtimeAuthority.enabled: false`) → story fence still enables path checks for direct writes
25
+ - **Both non-empty** → path must match **project allow** *and* **story file_scope** (AND)
26
+ - **`denyPaths` always win** (project denys + any denys from normalized `writeScope.deny`)
27
+
28
+ ## Runtime enforcement
29
+
30
+ When a fence is active, PreToolUse direct writes (Write / Edit / StrReplace / …) **fail closed**
31
+ for out-of-fence paths after ritual / scope / read-only / human-origin authz gates.
32
+
33
+ Deny reasons are stable and name the fence source:
34
+
35
+ - `write fence project allowPaths (source: project)` or `project+story`
36
+ - `write fence story file_scope (source: story)` or `project+story`
37
+ - `write-fence denyPaths (source: …)`
38
+
39
+ Inspect project policy:
40
+
41
+ ```bash
42
+ deft policy:show --field=runtimeAuthority
43
+ ```
44
+
45
+ ### Active-story seam
46
+
47
+ The hook dispatcher loads `file_scope` from the implementation-eligible active xBRIEF
48
+ path when `inspectActiveScope` reports one. Residual gaps (document, not silent):
49
+
50
+ - Host / worktree cannot identify the active story → story layer omitted; project fence still applies
51
+ - Multiple active artifacts → first preflight-eligible path wins (same as scope gate)
52
+ - Story JSON unreadable → story layer fail-open; project fence still applies
53
+
54
+ Shell/MCP push/merge scopes remain project-only (`runtimeAuthority.scopes`); they are not
55
+ re-scoped by `file_scope`.
56
+
57
+ ## Skill behavior (build / swarm)
58
+
59
+ When a project or active-story fence is set:
60
+
61
+ - **build** and **swarm** workers MUST treat out-of-fence Write/Edit as refused (PreToolUse deny
62
+ or equivalent product check)
63
+ - Prefer declaring intended paths in `plan.metadata.swarm.file_scope` before autonomous loops
64
+ - ⊗ Do not invent a second write-scope schema or dual matcher beside `resolveWriteFence` +
65
+ `evaluateRuntimeAuthority*`
66
+
67
+ ## writeScope alias (compatibility)
68
+
69
+ ```json
70
+ {
71
+ "plan": {
72
+ "metadata": {
73
+ "writeScope": {
74
+ "allow": ["src/**", "tests/**"],
75
+ "deny": [".env", "secrets/**"]
76
+ }
77
+ }
78
+ }
79
+ }
80
+ ```
81
+
82
+ Loaders map this to `file_scope` + deny globs at read time. If both `file_scope` and
83
+ `writeScope.allow` are present, **`file_scope` wins** for the allow list; `writeScope.deny`
84
+ still merges into denyPaths.
85
+
86
+ ## Example
87
+
88
+ ```json
89
+ // PROJECT-DEFINITION
90
+ {
91
+ "plan": {
92
+ "policy": {
93
+ "runtimeAuthority": {
94
+ "enabled": true,
95
+ "allowPaths": ["packages/**", "src/**", "xbrief/**"],
96
+ "denyPaths": [".env", "secrets/**"],
97
+ "scopes": { "edits": true, "push": false, "merge": false }
98
+ }
99
+ }
100
+ }
101
+ }
102
+
103
+ // Active story swarm block
104
+ {
105
+ "plan": {
106
+ "metadata": {
107
+ "swarm": {
108
+ "file_scope": [
109
+ "packages/core/src/policy/**",
110
+ "content/contracts/path-write-fence.md"
111
+ ]
112
+ }
113
+ }
114
+ }
115
+ }
116
+ ```
117
+
118
+ With both set, a write to `packages/core/src/policy/write-fence.ts` is allowed;
119
+ `src/index.ts` is denied (outside story); `secrets/x` is denied (deny wins).
120
+
121
+ ## Related
122
+
123
+ - Contract: `content/contracts/runtime-authority.md` (#1394 / #2711)
124
+ - Human-origin / UAT: `content/contracts/human-origin-authz.md` (#2944)
125
+ - Intent ceiling: `content/contracts/intent-ceiling.md` (#1193)
126
+ - Program: #2948 Wave 3
127
+
128
+ Refs #516, #2443, #2948, #1394.
@@ -17,11 +17,21 @@ Typed session-level enforcement under `plan.policy.runtimeAuthority` in `xbrief/
17
17
 
18
18
  Gitignore-style globs via the shared `matchPath` helper (`src/**`, `**/AGENTS.md`, etc.). Paths are normalized to project-relative POSIX before matching.
19
19
 
20
+ ## Unified write fence (#516 / #2443 / #2948 Wave 3)
21
+
22
+ Path checks for direct writes go through **one** evaluation SoT:
23
+
24
+ 1. `resolveWriteFence(projectPolicy, storyFileScope?)` intersects this project policy with the active story’s `plan.metadata.swarm.file_scope` (optional `writeScope` alias normalizes at read-time — not a second engine)
25
+ 2. `evaluateRuntimeAuthorityPath` / `evaluateRuntimeAuthorityDirectWrite` decide allow/deny
26
+
27
+ Rules: empty project `allowPaths` when enabled = all paths until story narrows; empty story scope = project only; **denyPaths always win**; when both allow layers are non-empty, a path must match **both**. Full contract: `content/contracts/path-write-fence.md`.
28
+
20
29
  ## Evaluation order (PreToolUse)
21
30
 
22
31
  1. Ritual / scope / read-only / spawn gates (existing #2438 / #1185 stack)
23
- 2. Runtime authority path + `scopes.edits` for direct-write tools
24
- 3. Runtime authority `scopes.push` / `scopes.merge` for Shell/Bash and classifiable MCP tools (#2711)
32
+ 2. **Human-origin authz / UAT lease** (#2944 Wave 1) — when UAT is active, product mutations require a named fix-cohort human-origin grant (see `content/contracts/human-origin-authz.md`). Composes with this policy; does not re-own Shell matchers.
33
+ 3. Runtime authority path + story write fence + `scopes.edits` for direct-write tools (`resolveWriteFence` `evaluateRuntimeAuthorityDirectWrite`)
34
+ 4. Runtime authority `scopes.push` / `scopes.merge` for Shell/Bash and classifiable MCP tools (#2711)
25
35
 
26
36
  Policy load failures fail open (host crash behavior unchanged).
27
37
 
@@ -77,4 +87,4 @@ deft policy:show --field=runtimeAuthority
77
87
 
78
88
  With that shape, a PreToolUse `Bash` / `Shell` invocation of `git push` or `gh pr merge` is denied when the matching scope is `false`.
79
89
 
80
- Refs #2437 Core T1 Wave C residual, #2711, #2948 Wave 0.
90
+ Refs #2437 Core T1 Wave C residual, #2711, #2948 Wave 0; Wave 3 path fence #516 / #2443 — `content/contracts/path-write-fence.md`.
@@ -0,0 +1,27 @@
1
+ # Inter-run learning surface
2
+
3
+ **Load when:** designing or implementing cross-session agent memory, hot/cold budgets, frozen snapshots, or retargeting memory pattern issues under epic #2741.
4
+
5
+ Legend (RFC2119): `!`=MUST, `~`=SHOULD, `⊗`=MUST NOT.
6
+
7
+ ## Pointer
8
+
9
+ Canonical contract (Wave 0 design for [#2742](https://github.com/deftai/directive/issues/2742), epic [#2741](https://github.com/deftai/directive/issues/2741)):
10
+
11
+ **[docs/analysis/2026-07-31-inter-run-learning-surface.md](../../docs/analysis/2026-07-31-inter-run-learning-surface.md)**
12
+
13
+ That note inventories Directive memory SoTs (`USER.md` Personal, lessons/packs, triage cache, session ritual, decision/continue), defines **hot / cold / operator-gated** tiers with freeze and budget rules, lists non-goals, and retargets #688, #978, #832–#835, and #479.
14
+
15
+ ## Rules (discovery only)
16
+
17
+ - ! Prefer the design note vocabulary over free-floating “agent-memory contracts” or Mem0-default RAG for Directive core.
18
+ - ! Attach Wave 1+ pattern work (#832–#834, #835, #479) to the tiers and SoTs in the design note.
19
+ - ⊗ Revive `x-vbrief/agent-memory` / `swarm/agent-memory.md` (#2700 solution shape abandoned).
20
+ - ⊗ Implement mid-session mutable always-in hot memory without freeze-at-session-start.
21
+
22
+ ## Related
23
+
24
+ - Session ritual: `content/commands.md` § Session-start ritual
25
+ - Continue checkpoints: `content/resilience/continue-here.md`
26
+ - Prompt assembly (freeze mechanism): `content/patterns/prompt-assembly-layer-ordering.md`
27
+ - Skills Index: `REFERENCES.md` → When Managing Context or Long Tasks
@@ -111,12 +111,50 @@ OpenClaw agents often act under a **bot / service identity** (e.g. `ape-deft`-cl
111
111
 
112
112
  1. Install / refresh Directive like any other host ([QUICK-START.md](../QUICK-START.md), `directive init` / `directive update`).
113
113
  2. Confirm skills resolve under the deposit (consumer: `.deft/core/.agents/skills/…`; framework checkout: `content/skills/…`).
114
- 3. On first PR shepherding request, open **`deft-directive-review-cycle`** and follow its Review Monitoring section for **your** install. Remember the epic expectation: OpenClaw → Approach 1 via `sessions_spawn` once skill wiring ships (#2875 / #2876).
115
- 4. For multi-story parallel work, follow **`deft-directive-swarm`** do not hand-roll worktree orchestration outside the skill.
116
- 5. Keep CHANGELOG / xBRIEF / branch gates the same as on Cursor or Warp; the host changes the **spawn surface**, not the Directive lifecycle.
114
+ 3. **Wire always-pin skills into the OpenClaw workspace** (see next section) so session `available_skills` can load cold-start paths.
115
+ 4. On first PR shepherding request, open **`deft-directive-review-cycle`** and follow its Review Monitoring section for **your** install. Remember the epic expectation: OpenClaw → Approach 1 via `sessions_spawn` once skill wiring ships (#2875 / #2876).
116
+ 5. For multi-story parallel work, follow **`deft-directive-swarm`** do not hand-roll worktree orchestration outside the skill.
117
+ 6. Keep CHANGELOG / xBRIEF / branch gates the same as on Cursor or Warp; the host changes the **spawn surface**, not the Directive lifecycle.
117
118
 
118
119
  ---
119
120
 
121
+ ## Wire skills into OpenClaw workspace (#3001)
122
+
123
+ OpenClaw is a **session-first** host: installing `@deftai/directive` puts pin skills in the content package / deposit, but the **main** OpenClaw workspace may still only list host-global skills until something bridges them into `~/.openclaw/workspace/skills` (or `$OPENCLAW_STATE_DIR/workspace/skills`).
124
+
125
+ Always-pins required for cold-start / process gates ([skill-pin-policy.md](./skill-pin-policy.md) #2508):
126
+
127
+ - `deft-directive-build`
128
+ - `deft-directive-pre-pr`
129
+ - `deft-directive-review-cycle`
130
+ - `deft-directive-swarm`
131
+
132
+ ### Detect
133
+
134
+ When OpenClaw signals are present (`OPENCLAW` / `DEFT_PROBE_OPENCLAW` / `DEFT_AGENT_RUNTIME=openclaw`, or `~/.openclaw` / `OPENCLAW_STATE_DIR`), `deft doctor` checks the **main** workspace skills root for those four pins.
135
+
136
+ - **Miss:** warning + remediation `deft doctor --fix` (plus pointers to this page and [host-lifecycle-duties.md](../contracts/host-lifecycle-duties.md)).
137
+ - **Hit:** success line — OpenClaw host pins present.
138
+
139
+ ### Fix
140
+
141
+ ```text
142
+ deft doctor --fix
143
+ ```
144
+
145
+ Doctor links (preferred) or copies the four pin directories from the installed content package (`@deftai/directive-content` / `content/skills/…`) into the main OpenClaw skills root. It does **not** delete other user skills (e.g. a local `vbrief` skill stays). Divergent same-named directories are left alone unless you pass `--force` or confirm on a TTY.
146
+
147
+ After a successful wire: **restart the OpenClaw gateway or start a new session** so host `available_skills` refreshes.
148
+
149
+ ### Multi-seat / crew workspaces
150
+
151
+ Default scope is **main only** (`workspace/skills`). Crew seats (`workspace-scotty`, `workspace-pike`, …) are **not** rewritten unless you opt in:
152
+
153
+ ```text
154
+ deft doctor --fix --openclaw-all-agents
155
+ ```
156
+
157
+ ⊗ Silent rewrite of every `workspace-*` seat without that flag.
120
158
 
121
159
  ---
122
160
 
@@ -156,6 +194,8 @@ Full rules: [`skills/deft-directive-swarm/references/host-openclaw.md`](../skill
156
194
  - ⊗ Claiming this doc alone makes `sessions_spawn` a shipped register/matrix primitive — that is epic skill/engine work (#2875 / #2876).
157
195
  - ⊗ Multi-sentence progress-only first response after `subagent_announce` with zero tools / yield (#2943 text-repetition hang).
158
196
  - ⊗ Treating thin DONE (no PR URL / merge evidence) as success (#2943).
197
+ - ⊗ Assuming package install alone populates OpenClaw `available_skills` — wire main workspace pins via `deft doctor --fix` (#3001).
198
+ - ⊗ Auto-enumerating every `workspace-*` seat without `--openclaw-all-agents` (#3001).
159
199
 
160
200
  ---
161
201
 
package/events/README.md CHANGED
@@ -14,7 +14,7 @@ data-file-convention check follow-up
14
14
 
15
15
  - `registry.json` — single source of truth for every event name, category,
16
16
  payload contract, detector / emission pointer, and consumer pointers.
17
- Lists 5 `detection-bound` events and 9 `behavioral` events (14 total).
17
+ Lists 5 `detection-bound` events and 11 `behavioral` events (16 total).
18
18
  - `registry.schema.json` — schema validating the registry's shape, including
19
19
  the required `category` enum (`detection-bound` | `behavioral`).
20
20
  - `event-record.schema.json` — schema for individual emitted event records.
@@ -238,6 +238,42 @@
238
238
  "packages/core/src/events/attribution-ledger.ts",
239
239
  "(deferred) task deft:feedback:file / deft-directive-feedback skill (#1709 child 5)"
240
240
  ]
241
+ },
242
+ {
243
+ "name": "session:start",
244
+ "category": "behavioral",
245
+ "description": "Mutation session:start ceremony finished (cold or re-arm). Local process-cost observability for ceremony wall-clock (#2994 / WWYSYDH pilot). Always-on best-effort local JSONL; not gated on valueFeedback; no remote upload.",
246
+ "trigger": "packages/core/src/session/process-cost.ts::emitSessionStartProcessCost from packages/core/src/session/session-start.ts after cold or re-arm ceremony completes and ritual state is written.",
247
+ "payload": {
248
+ "ceremony_tier": "string enum -- cold | rearm",
249
+ "duration_ms": "integer -- total ceremony wall-clock milliseconds",
250
+ "exit_code": "integer -- 0 when ready, non-zero when a quick step failed",
251
+ "ready": "boolean (optional) -- true when exit_code is 0",
252
+ "optional_network": "boolean (optional) -- whether optional network steps ran (#2991)",
253
+ "steps": "array (optional) -- { name, duration_ms, skipped? } per major phase from session:start --json"
254
+ },
255
+ "consumers": [
256
+ "packages/core/src/session/process-cost.ts -- emit helper",
257
+ "packages/core/src/session/session-start.ts -- cold + re-arm completion call sites",
258
+ "content/commands.md § Process-cost events -- WWYSYDH ceremony label mapping (#2994)"
259
+ ]
260
+ },
261
+ {
262
+ "name": "session:ritual-blocked",
263
+ "category": "behavioral",
264
+ "description": "PreToolUse denied a mutation tool because the gated session ritual was not ready (missing/stale/invalid). Local process-cost / friction signal for ceremony blocks (#2994). Always-on best-effort local JSONL; not gated on valueFeedback; no remote upload.",
265
+ "trigger": "packages/core/src/session/process-cost.ts::emitSessionRitualBlockedProcessCost from packages/core/src/hooks/dispatcher.ts::inspectMutationGates when inspectSessionRitual returns non-zero or throws (ritual-not-ready deny path).",
266
+ "payload": {
267
+ "tool_name": "string -- host tool name that was denied",
268
+ "code": "string -- always ritual-not-ready for this event",
269
+ "recovery_tier": "string enum (optional) -- cold | rearm -- preferred recovery path (#2992)",
270
+ "detail": "string (optional) -- one-line inspect message (not the full recovery instruction)"
271
+ },
272
+ "consumers": [
273
+ "packages/core/src/session/process-cost.ts -- emit helper",
274
+ "packages/core/src/hooks/dispatcher.ts -- PreToolUse ritual deny path",
275
+ "content/commands.md § Process-cost events -- WWYSYDH ceremony label mapping (#2994)"
276
+ ]
241
277
  }
242
278
  ]
243
279
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deftai/directive-content",
3
- "version": "0.88.0",
3
+ "version": "0.90.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
  "license": "MIT",
6
6
  "type": "module",