@deftai/directive-content 0.96.0 → 0.98.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/.agents/skills/deft-directive-portfolio-priority/SKILL.md +11 -0
  2. package/Taskfile.yml +6 -0
  3. package/UPGRADING.md +9 -6
  4. package/commands.md +17 -2
  5. package/contracts/test-boundary.md +18 -0
  6. package/docs/consumer-check-contract.md +64 -0
  7. package/docs/deft-directive-disable.md +6 -0
  8. package/docs/delivery-attempt.md +173 -0
  9. package/docs/openclaw-agent-host.md +36 -1
  10. package/docs/operator-log-hygiene-checklist.md +57 -0
  11. package/docs/operator-log-hygiene-consumer-pack-stub.md +75 -0
  12. package/docs/scope-provenance.md +54 -0
  13. package/docs/test-boundary.md +43 -0
  14. package/main.md +46 -0
  15. package/meta/philosophy.md +10 -0
  16. package/package.json +1 -1
  17. package/packs/patterns/patterns-pack-0.1.json +10 -0
  18. package/packs/skills/skills-pack-0.1.json +22 -5
  19. package/patterns/operator-log-hygiene.md +130 -0
  20. package/scm/github.md +26 -0
  21. package/skills/deft-directive-article-review/SKILL.md +17 -6
  22. package/skills/deft-directive-build/SKILL.md +41 -0
  23. package/skills/deft-directive-portfolio-priority/SKILL.md +144 -0
  24. package/skills/deft-directive-release/SKILL.md +22 -5
  25. package/skills/deft-directive-review-cycle/SKILL.md +150 -0
  26. package/skills/deft-directive-swarm/SKILL.md +14 -0
  27. package/skills/deft-directive-swarm/references/core-ops.md +14 -2
  28. package/skills/deft-directive-swarm/references/core-phase-0.md +34 -1
  29. package/skills/deft-directive-swarm/references/core-phase-3.md +6 -0
  30. package/skills/deft-directive-swarm/references/core-phase-4.md +21 -2
  31. package/skills/deft-directive-swarm/references/core-phase-5-6.md +17 -0
  32. package/skills/deft-directive-swarm/references/host-openclaw.md +4 -0
  33. package/tasks/engine-invoke.cjs +22 -17
  34. package/tasks/engine-invoke.test.cjs +30 -0
  35. package/tasks/verify.yml +30 -0
  36. package/templates/agent-prompt-preamble.md +8 -0
  37. package/templates/agents-entry.md +10 -0
  38. package/templates/swarm-greptile-poller-prompt.md +4 -2
@@ -0,0 +1,43 @@
1
+ # Test / source boundary (`verify:test-boundary`)
2
+
3
+ Refs: #3145 · Related: #1310 forward-coverage, testing layout guidance
4
+
5
+ ## Problem
6
+
7
+ Directive accepted test harnesses, fixtures, and smoke orchestration under production-owned roots (`src/**`, `infra/**`, `Tools/**`, …) while gates stayed green. Placement guidance was prose-only.
8
+
9
+ ## Contract
10
+
11
+ `task verify:test-boundary` / `deft verify:test-boundary` enforces a typed policy:
12
+
13
+ | Field | Meaning |
14
+ | --- | --- |
15
+ | `sourceRoots` | Production-owned path globs |
16
+ | `testRoots` | Allowed test roots |
17
+ | `fixtureRoots` | Fixture roots |
18
+ | `testFilePatterns` | Conventional test basenames (`test_*.py`, `*Tests.cs`, `*.test.ts`, `*.spec.ts`, …) |
19
+ | `productionMayReferenceTestRoots` | Default `false` — production must not reference test/fixture roots |
20
+ | `allow` | Narrow exceptions (`kind: exception` or `production-liveness`) |
21
+ | `enforcementMode` | `warn` (migration/discovery) or `enforce` |
22
+
23
+ ## Policy sources (first wins)
24
+
25
+ 1. `--policy <path>`
26
+ 2. `.deft/test-boundary.policy.json`
27
+ 3. `plan.policy.testBoundary` in `xbrief/PROJECT-DEFINITION.xbrief.json`
28
+ 4. **Defaults** (conventional roots + patterns, `enforcementMode: warn`)
29
+
30
+ ## Migration path
31
+
32
+ 1. Run with defaults (warn-only): `task verify:test-boundary`
33
+ 2. Review findings; move test artifacts under declared test roots or classify production liveness/canaries in `allow`
34
+ 3. Persist reviewed policy under `.deft/test-boundary.policy.json` or `plan.policy.testBoundary` with `enforcementMode: "enforce"`
35
+ 4. Wire stays green via `task check` / consumer deposit
36
+
37
+ ## Production liveness carve-out
38
+
39
+ Health probes, canaries, and operational evidence collectors may live under production roots when listed in `allow` with `kind: "production-liveness"` and a recorded reason. Do not use the word “smoke” alone as classification.
40
+
41
+ ## Remediation
42
+
43
+ Failures name the path, violated boundary, and next step (move under test root, allow entry, or reclassify). See `content/contracts/test-boundary.md`.
package/main.md CHANGED
@@ -58,6 +58,22 @@ Legend (from RFC2119): !=MUST, ~=SHOULD, ≉=SHOULD NOT, ⊗=MUST NOT, ?=MAY.
58
58
 
59
59
  See #634, #642. See [ADR-001](./docs/decisions/ADR-001.md) for the token-economics rationale behind this ordering (vBRIEF-as-canonical for the agentic-consumed surface).
60
60
 
61
+ ## Self-Improving, Not Self-Editing (#3164)
62
+
63
+ **Stance:** Directive is **self-improving**, not **self-editing**. Improvement goes through formal gates (**propose-not-apply**).
64
+
65
+ Continual-Harness-class hosts may rewrite prompts, skills, and memory mid-run. Directive does not. A running session must not mutate live operating rules in place.
66
+
67
+ - ! Directive MUST NOT self-edit live operating rules mid-run (managed AGENTS.md, pinned skills, policy flags, and other constitution-tier content)
68
+ - ! Refine and meta-loops **propose** changes; issues, PRs, and quality gates **dispose**
69
+ - ! Learn between merges — not by mid-session rewrite of the constitution
70
+ - ? Prose lessons (`meta/lessons.md`; Continuous Improvement below) MAY stay agent-writable. They sit at the bottom of the Rule Authority ladder and cannot override structural rules
71
+ - ⊗ Treat mid-run self-edit of constitution, skills, or policy as the default learning model
72
+
73
+ This is not timidity; it is identity. It follows from the Rule Authority ladder above and from safety via formal gates, not alignment (#1200). A framework whose value is that the gates sit outside the agent cannot let a session rewrite the gates' substrate and stay coherent.
74
+
75
+ Parent epic: #3179 (self-improving under gates). Trajectory / refine constraint: #2741 — refine proposes; gates dispose. Proposer runtime (SkillOpt / skill-variant) is tracked on #2436 / #1307 and is out of scope for this stance naming.
76
+
61
77
  **Decision Making:**
62
78
  - ! Follow established patterns in current context
63
79
  - ~ Question assumptions and probe for clarity
@@ -71,6 +87,35 @@ See #634, #642. See [ADR-001](./docs/decisions/ADR-001.md) for the token-economi
71
87
  - ⊗ Continue executing a skill past its explicit instruction boundary — when a skill's steps are complete, stop and return to the calling context; do not drift into adjacent work (#198)
72
88
  - ! The end of a skill's final step is an exit condition — do not continue into adjacent work, even if it seems related or trivial
73
89
 
90
+ ## Dual Stop Rule (#2442)
91
+
92
+ Loop engineering requires **two** stop conditions on multi-iteration autonomous work: a **success stop** (goal / AC / checker met) and a **failure or budget stop** (retries exhausted, no progress, or time/token budget). Directive already has strong success-shaped gates (`task check`, acceptance criteria, STOP on plan precondition mismatch -- #1613). This section requires the complementary failure envelope so agents escalate instead of thrashing forever.
93
+
94
+ **Applies to:** multi-iteration autonomous loops -- build quality / implement-fix loops, pre-PR polish cycles, swarm repair and monitor loops, research fan-out, review fix cycles, and similar retrying work.
95
+
96
+ **Does not apply to:** single-turn tasks (one shot answer, one file edit, one status probe). Not every task is a loop; do not invent iteration caps where there is no multi-step retry envelope.
97
+
98
+ **Required stops on every multi-iteration loop:**
99
+
100
+ 1. ! **Success stop** -- goal, acceptance criteria, or checker is met; exit the loop and continue the skill or report done.
101
+ 2. ! **Failure stop** -- at least one of:
102
+ - **max iterations** (task-class default; e.g. a short quality-fix class vs a longer research class)
103
+ - **no-progress** (same outcome or same failure fingerprint N times in a row with no material change)
104
+ - **explicit budget** (time, tool-call, or token budget when the host exposes it)
105
+
106
+ **On failure stop:**
107
+
108
+ - ! Halt the loop. Do not silently continue, re-dispatch, or open a new identical attempt without an operator decision.
109
+ - ! Emit an **operator-visible halt report** that states: (a) what was tried, (b) what is still missing or failing, (c) what human decision is needed next (scope change, unblock, override, or abandon).
110
+ - ⊗ Keep iterating after the failure envelope is exhausted because "one more try" might work.
111
+ - ⊗ Reset iteration counters solely by creating a new revision, swapping workers, or compacting context when the same failure class remains.
112
+
113
+ **Relation to other rules:**
114
+
115
+ - #1613 covers STOP when plan **preconditions** fail (reality mismatch). Dual stop covers the case where the plan is still "valid" but the agent must quit after N failed attempts, N identical no-progress outcomes, or a budget limit.
116
+ - Skills name concrete defaults: `skills/deft-directive-build/SKILL.md` (implement / pre-PR loops), `skills/deft-directive-swarm/SKILL.md` and its Phase 4 / core-ops references (repair / monitor loops).
117
+ - **Delivery / acceptance mechanical enforcement** (durable attempt ledger, material-progress circuit breaker, cross-revision budgets) is **#3143** — library: `packages/core/src/delivery-attempt/` (`evaluatePreDispatch`, unit ledger under `.deft/delivery-attempts/`). Docs: `content/docs/delivery-attempt.md`. #2442 is the principle + skill defaults; #3143 is the deterministic pre-dispatch gate. Route delivery/acceptance loops through that surface rather than inventing a parallel ledger.
118
+
74
119
  **Adaptive Teaching:**
75
120
  - ~ When a recommendation is accepted without question, be concise
76
121
  - ! When a recommendation is questioned or overridden, explain the reasoning
@@ -248,6 +293,7 @@ See [`skills/deft-directive-refinement/SKILL.md`](./content/skills/deft-directiv
248
293
  - ~ When repeated correction or better approach found, codify in `./lessons.md`
249
294
  - ? Modify `./lessons.md` without prior approval
250
295
  - ~ When using codified instruction, inform user which rule was applied
296
+ - ! Promote constitution-tier improvements (skills, policy, managed AGENTS rules) through issue / PR / quality gate — not mid-run self-edit (see [Self-Improving, Not Self-Editing (#3164)](#self-improving-not-self-editing-3164))
251
297
 
252
298
  **Observation:**
253
299
  - ~ Think beyond immediate task
@@ -8,6 +8,16 @@ Legend (from RFC2119): !=MUST, ~=SHOULD, ≉=SHOULD NOT, ⊗=MUST NOT, ?=MAY.
8
8
 
9
9
  ---
10
10
 
11
+ ## Self-Improving, Not Self-Editing (#3164)
12
+
13
+ Directive improves **across merges** through issues, PRs, and quality gates. It does not rewrite live constitution rules mid-run (**propose-not-apply**).
14
+
15
+ Constitution (managed AGENTS.md, pinned skills, policy) stays gated. Playbook-tier prose (e.g. lessons) may stay agent-writable because it sits at the bottom of the Rule Authority ladder.
16
+
17
+ Full stance and MUST/MAY bullets: [main.md § Self-Improving, Not Self-Editing](../../main.md#self-improving-not-self-editing-3164). Parent epic #3179; safety-via-gates #1200; trajectory/refine #2741.
18
+
19
+ ---
20
+
11
21
  ## Deterministic > Probabilistic
12
22
 
13
23
  Prefer deterministic components for repeatable actions over probabilistic ones.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deftai/directive-content",
3
- "version": "0.96.0",
3
+ "version": "0.98.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",
@@ -35,6 +35,16 @@
35
35
  "path": "patterns/llm-app.md",
36
36
  "body": null
37
37
  },
38
+ {
39
+ "id": "operator-log-hygiene",
40
+ "title": "Operator-log hygiene (#1940)",
41
+ "description": "Consumer guidance for structured, operator-facing logs: six failure modes, anti-patterns, positive rules, explicit non-goals (no core schema, no default-on, not Insights/LLM telemetry). SLizard is external reference only. Checklist and optional consumer pack stub under docs/.",
42
+ "triggers": [
43
+ "operator-log-hygiene"
44
+ ],
45
+ "path": "patterns/operator-log-hygiene.md",
46
+ "body": null
47
+ },
38
48
  {
39
49
  "id": "multi-agent",
40
50
  "title": "Multi-agent identity separation pattern (#983)",