@deftai/directive-content 0.98.0 → 0.99.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 +4 -0
- package/coding/coding.md +2 -3
- package/commands.md +20 -1
- package/context/tool-design.md +116 -0
- package/contracts/host-lifecycle-duties.md +9 -0
- package/docs/agent-docs.md +1 -0
- package/docs/consumer-check-contract.md +26 -3
- package/docs/decision-log.md +114 -0
- package/docs/delivery-attempt.md +17 -1
- package/docs/gate-integrity.md +112 -0
- package/docs/host-surface-assumptions.md +149 -0
- package/docs/inter-run-learning.md +4 -0
- package/docs/scope-provenance.md +68 -9
- package/docs/skill-pin-policy.md +9 -0
- package/main.md +11 -0
- package/meta/philosophy.md +8 -0
- package/meta/security.md +16 -2
- package/package.json +1 -1
- package/packs/patterns/patterns-pack-0.1.json +53 -15
- package/packs/rules/rules-pack-0.1.json +730 -914
- package/packs/skills/skills-pack-0.1.json +27 -27
- package/packs/strategies/strategies-pack-0.1.json +1 -1
- package/packs/swarm-spec/swarm-spec-pack-0.1.json +1 -1
- package/patterns/goal-gate-determinism.md +146 -0
- package/patterns/llm-app.md +9 -0
- package/skills/deft-directive-build/SKILL.md +30 -0
- package/skills/deft-directive-portfolio-priority/SKILL.md +3 -3
- package/skills/deft-directive-pre-pr/SKILL.md +14 -0
- package/skills/deft-directive-refinement/SKILL.md +8 -0
- package/skills/deft-directive-review-cycle/SKILL.md +22 -0
- package/skills/deft-directive-swarm/SKILL.md +24 -0
- package/skills/deft-directive-swarm/references/core-ops.md +6 -1
- package/skills/deft-directive-swarm/references/core-phase-0.md +2 -0
- package/skills/deft-directive-swarm/references/core-phase-3.md +18 -0
- package/skills/deft-directive-swarm/references/core-phase-4.md +29 -3
- package/skills/deft-directive-swarm/references/core-phase-5-6.md +6 -2
- package/skills/deft-directive-swarm/references/host-claude-code.md +7 -0
- package/skills/deft-directive-swarm/references/host-cursor.md +7 -0
- package/skills/deft-directive-swarm/references/host-generic.md +6 -0
- package/skills/deft-directive-swarm/references/host-grok-build.md +7 -0
- package/skills/deft-directive-swarm/references/host-openclaw.md +7 -0
- package/skills/deft-directive-swarm/references/host-warp.md +6 -0
- package/skills/deft-directive-write-skill/SKILL.md +2 -0
- package/strategies/rapid.md +2 -0
- package/swarm/swarm.md +54 -0
- package/tasks/decision.yml +30 -0
- package/tasks/scope.yml +16 -0
- package/tasks/swarm.yml +16 -0
- package/templates/agent-prompt-preamble.md +9 -5
- package/templates/agents-entry.md +18 -0
- package/templates/swarm-greptile-poller-prompt.md +48 -4
- package/vbrief/schemas/vbrief-core.schema.json +5 -0
- package/vbrief/schemas/xbrief-core-0.8.schema.json +5 -0
- package/vbrief/vbrief.md +37 -0
- package/verification/verification.md +2 -1
package/Taskfile.yml
CHANGED
|
@@ -344,6 +344,10 @@ includes:
|
|
|
344
344
|
value:
|
|
345
345
|
taskfile: ./tasks/value.yml
|
|
346
346
|
optional: true
|
|
347
|
+
# Structured agent decision log (#1396). Inner tasks write/list → decision:write / decision:list.
|
|
348
|
+
decision:
|
|
349
|
+
taskfile: ./tasks/decision.yml
|
|
350
|
+
optional: true
|
|
347
351
|
product-signal:
|
|
348
352
|
taskfile: ./tasks/product-signal.yml
|
|
349
353
|
optional: true
|
package/coding/coding.md
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
<!-- Regenerate with: task packs:render -->
|
|
5
5
|
<!-- Edit the source, not this file. Slice instead of loading every coding doc: task packs:slice rules by-tier --tier <TIER> (or by-domain, list) -->
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
# Coding Guidelines
|
|
9
8
|
|
|
10
9
|
Software development specific guidelines for AI agents.
|
|
@@ -126,7 +125,7 @@ See [../scm/git.md](../scm/git.md) for:
|
|
|
126
125
|
|
|
127
126
|
The failure mode is the agent stating completion at the level of **intent** ("I ran the migration", "the tests pass", "the feature works") rather than at the level of **outcome verification** ("all 167 records migrated, 0 skipped", "42 tests collected, 42 passed, 0 skipped, 0 xfailed", "the edge case asked about was reproduced and now returns the expected value"). Outcome-blind completion claims hide silent skips, swallowed exceptions, suppressed errors, and unverified edge cases behind successful-sounding language. The example from the source: a database migration that completed "successfully" had silently skipped 14% of records on a constraint violation; the skip was logged but not surfaced; the bad reports were discovered 11 days later.
|
|
128
127
|
|
|
129
|
-
This rule is the OPERATIONAL complement to the EPISTEMIC honesty rules elsewhere in the framework (`main.md` morals section: don't present speculation as fact; label unverified claims). Morals.md says "don't lie". Fail-loud says "count the records, check the logs, run the edge case, **then** claim completion." It is also the output-side complement to goal-gate-determinism (the gate specifies what evidence is required) and machine-verifiable-spec (verification commands prevent silent skips) -- without fail-loud, an agent can satisfy the letter of a gate ("tests pass") while hiding the gap ("some tests were skipped").
|
|
128
|
+
This rule is the OPERATIONAL complement to the EPISTEMIC honesty rules elsewhere in the framework (`main.md` morals section: don't present speculation as fact; label unverified claims). Morals.md says "don't lie". Fail-loud says "count the records, check the logs, run the edge case, **then** claim completion." It is also the output-side complement to [goal-gate-determinism](../patterns/goal-gate-determinism.md) (#852 — the gate specifies what evidence is required) and machine-verifiable-spec (verification commands prevent silent skips) -- without fail-loud, an agent can satisfy the letter of a gate ("tests pass") while hiding the gap ("some tests were skipped").
|
|
130
129
|
|
|
131
130
|
- ! Before claiming a batch operation succeeded, MUST verify the record count and surface it in the claim ("migrated 167/167 records, 0 skipped, 0 errored" -- not "migration completed")
|
|
132
131
|
- ! Before claiming "tests pass", MUST report the count of collected / passed / skipped / xfailed / errored tests ("42 collected, 42 passed, 0 skipped" -- not "tests pass"). A skipped or xfailed test is NOT a passing test for the purpose of this claim
|
|
@@ -144,7 +143,7 @@ This rule is the OPERATIONAL complement to the EPISTEMIC honesty rules elsewhere
|
|
|
144
143
|
|
|
145
144
|
The rule applies to agent completion claims during task execution. It applies equally to claims to the user, claims in commit messages, claims in PR bodies, claims in CHANGELOG entries, and claims in status messages to a parent agent. A short, honest "the migration completed; I did not verify the per-record count" is strictly preferred over a confident "migration completed successfully" that hides the gap.
|
|
146
145
|
|
|
147
|
-
**Cross-references:** strategies discuss/probe Graduation dual-path locks (#2899); `## Quality Standards` above (`⊗ Claim checks passed without running them` -- the sibling rule that this expands from process to outcome); `hygiene.md` `## Error Handling: No Hiding` (the same hiding pattern at the code-write level, not the claim level); `skills/deft-directive-pre-pr/SKILL.md` (pre-PR verification claims); `skills/deft-directive-build/SKILL.md` Step 4 Quality Gates (task-completion claims); `skills/deft-directive-review-cycle/SKILL.md` (Greptile adapter; universal review principles in [review.md](review.md); the adapter explicitly checks for hidden incompleteness in fix-batch completion claims).
|
|
146
|
+
**Cross-references:** strategies discuss/probe Graduation dual-path locks (#2899); `## Quality Standards` above (`⊗ Claim checks passed without running them` -- the sibling rule that this expands from process to outcome); `hygiene.md` `## Error Handling: No Hiding` (the same hiding pattern at the code-write level, not the claim level); [`patterns/goal-gate-determinism.md`](../patterns/goal-gate-determinism.md) (#852 — rigid goals/gates, flexible path); `skills/deft-directive-pre-pr/SKILL.md` (pre-PR verification claims); `skills/deft-directive-build/SKILL.md` Step 4 Quality Gates (task-completion claims); `skills/deft-directive-review-cycle/SKILL.md` (Greptile adapter; universal review principles in [review.md](review.md); the adapter explicitly checks for hidden incompleteness in fix-batch completion claims).
|
|
148
147
|
|
|
149
148
|
## Calling LLM APIs (#481)
|
|
150
149
|
|
package/commands.md
CHANGED
|
@@ -183,6 +183,25 @@ flowchart TD
|
|
|
183
183
|
|
|
184
184
|
---
|
|
185
185
|
|
|
186
|
+
## Structured decision log (#1396)
|
|
187
|
+
|
|
188
|
+
Lightweight intent-debt records for **significant** choices (architecture, product behavior, security, public/private boundary, data model, runtime topology, hard-to-reverse process). Not every trivial scope. Not ADR migration; leave `docs/decisions/ADR-*.md` alone. Split from lessons (#1513).
|
|
189
|
+
|
|
190
|
+
| Command | Purpose |
|
|
191
|
+
|---------|---------|
|
|
192
|
+
| `task decision:write` | Validate and write `xbrief/decisions/YYYY-MM-DD-<slug>.decision.json`; optional `--scope` appends a pointer under `plan.narratives.Decisions` |
|
|
193
|
+
| `task decision:list` | List/filter records (`--query`, `--scope`, `--issue`, `--json`) |
|
|
194
|
+
|
|
195
|
+
Required fields: decision, governing rule/constraint, alternatives considered, why winner, confidence, timestamp, revisit trigger; active scope ref(s) when applicable.
|
|
196
|
+
|
|
197
|
+
! For significant choices during build / pre-PR / portfolio dispose, record via `task decision:write` (or `--body-file` on Windows for multi-line fields).
|
|
198
|
+
⊗ Require a decision record before every `scope:complete` in v1 (guidance only; no deterministic complete-hook yet).
|
|
199
|
+
⊗ Store chat transcripts or replace git history with this surface.
|
|
200
|
+
|
|
201
|
+
Docs: [docs/decision-log.md](./docs/decision-log.md) · layout: `xbrief/decisions/README.md`. Consumers: portfolio dispose (#3198/#3201), process dogfood (#1423).
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
186
205
|
## Generated Document Commands
|
|
187
206
|
|
|
188
207
|
Edit the xBRIEF source, then render the markdown view.
|
|
@@ -554,7 +573,7 @@ flowchart TD
|
|
|
554
573
|
- `task release:*` -- release, publish, rollback, and e2e release rehearsal.
|
|
555
574
|
- Step 3 (`Pre-flight vBRIEF lifecycle sync`) fetches GitHub issue states via REST. On HTTP 403 rate-limit exhaustion it sleeps once (capped at 120s) and retries before failing.
|
|
556
575
|
- When Step 3 still fails with rate-limit exhaustion, stderr includes a `gh api rate_limit` probe (`core.remaining`, reset time) and recovery guidance. After local `task vbrief:validate` (or `task xbrief:validate`) exits 0, operators may pass `--allow-vbrief-drift` to skip Step 3 for that cut — reserved for transient SCM bucket stalls, not unreviewed lifecycle drift.
|
|
557
|
-
- `task swarm:*` -- readiness, launch, review-clean verification, and cohort completion.
|
|
576
|
+
- `task swarm:*` -- readiness, launch, pre-dispatch deny gate (#3228), review-clean verification, and cohort completion.
|
|
558
577
|
- `task slice:*` -- feature-slice helpers.
|
|
559
578
|
- `task policy:*` and `task capacity:*` -- policy inspection and allocation helpers.
|
|
560
579
|
|
package/context/tool-design.md
CHANGED
|
@@ -4,6 +4,16 @@ Legend (from RFC2119): !=MUST, ~=SHOULD, ≉=SHOULD NOT, ⊗=MUST NOT, ?=MAY.
|
|
|
4
4
|
|
|
5
5
|
Principles for designing tools that agents can use effectively.
|
|
6
6
|
|
|
7
|
+
**Load when:** authoring host tools, MCP/server tool schemas, skill-facing
|
|
8
|
+
task surfaces, or any agent-callable parameter shape. Also load when a
|
|
9
|
+
tool call fails in ways that look like "the model is dumb" but may be
|
|
10
|
+
dialect sampling cost.
|
|
11
|
+
|
|
12
|
+
**⚠️ See also**:
|
|
13
|
+
- [patterns/llm-app.md](../patterns/llm-app.md) `## Tool / function calling` — security, least privilege, validation (confused deputy)
|
|
14
|
+
- [patterns/tool-call-taxonomy.md](../patterns/tool-call-taxonomy.md) — explore / commit / verify activity buckets (orthogonal)
|
|
15
|
+
- [deterministic-split.md](./deterministic-split.md) — what must not be an LLM step at all
|
|
16
|
+
|
|
7
17
|
---
|
|
8
18
|
|
|
9
19
|
## Minimal, Non-Overlapping Tool Sets
|
|
@@ -12,6 +22,110 @@ Principles for designing tools that agents can use effectively.
|
|
|
12
22
|
- ≉ Offering multiple tools that do the same thing with slight variations
|
|
13
23
|
- ~ Each tool should have a **single, clear purpose**
|
|
14
24
|
|
|
25
|
+
## Tool-surface grammar (#3085)
|
|
26
|
+
|
|
27
|
+
A tool "call" is **dialect sampling** in the token stream. The model does
|
|
28
|
+
not decide to call a tool as a special act. It continues the completion
|
|
29
|
+
loop under a harness dialect (`function_calls` / `invoke` / JSON args /
|
|
30
|
+
provider-specific tags). Schema design is a first-order **reliability and
|
|
31
|
+
cost** surface, not cosmetics.
|
|
32
|
+
|
|
33
|
+
**Rule of thumb:** reliability degrades with
|
|
34
|
+
**nesting × heterogeneity × cleverness**.
|
|
35
|
+
|
|
36
|
+
Source framing (practitioner ablation, not product UI): Can Bölük
|
|
37
|
+
([@_can1357](https://x.com/_can1357/status/2084104053651317140), 2026-08-03).
|
|
38
|
+
The post's emoji / plaintext "control group" is **not** a product
|
|
39
|
+
recommendation. At roughly ten or more tools, native tool-calls win on
|
|
40
|
+
ergonomics; still design the **thinnest grammar** you can get away with.
|
|
41
|
+
|
|
42
|
+
### Prefer flat, homogeneous params
|
|
43
|
+
|
|
44
|
+
- ~ Prefer **flat scalar/string parameters** over nested objects and
|
|
45
|
+
arrays-as-escaped-JSON inside a single parameter value
|
|
46
|
+
- ~ Prefer a **homogeneous** parameter set (similar types, predictable
|
|
47
|
+
names) over mixed clever packing (object + freeform JSON string +
|
|
48
|
+
parallel batch bag in one tool)
|
|
49
|
+
- ~ When the host owns the tools, prefer a **vector / flat** shape (one
|
|
50
|
+
named field per logical input) over "batch JSON in a string" when that
|
|
51
|
+
batch only exists to save parallel tool-call round-trips
|
|
52
|
+
- ≉ Nested argument bags that force the model to emit valid escaped JSON
|
|
53
|
+
for complex objects when plain scalar parameters would suffice
|
|
54
|
+
- ≉ Heterogeneous mega-tools that pack unrelated concerns into one clever
|
|
55
|
+
payload "for flexibility"
|
|
56
|
+
- ! Treat provider schema fields (`minimum`, `maximum`, `enum`, long
|
|
57
|
+
descriptions) as **documentation the harness may show**. Validation is
|
|
58
|
+
the application's job unless the harness (or provider) actually rejects
|
|
59
|
+
invalid args — do not assume the model "must" obey schema mins/maxes
|
|
60
|
+
- ! Validate tool arguments in the harness before side effects
|
|
61
|
+
(`patterns/llm-app.md` tool-call rules). A flat grammar still needs a
|
|
62
|
+
validator and common dialect failure handling (leaked call text,
|
|
63
|
+
truncated invoke blocks, wrong tool name tokens)
|
|
64
|
+
|
|
65
|
+
### Good vs bad shapes (sketch)
|
|
66
|
+
|
|
67
|
+
Bad — nested / heterogeneous / JSON-in-string:
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
apply_batch({
|
|
71
|
+
"ops": "[{\"path\":\"a.ts\",\"edits\":[{\"start\":1,\"end\":2,\"text\":\"...\"}]}]"
|
|
72
|
+
})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The model must sample valid escaped JSON for a nested array. One quote
|
|
76
|
+
or brace error fails the turn. High nesting × high cleverness.
|
|
77
|
+
|
|
78
|
+
Better — flat / homogeneous (host-owned tools):
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
edit_file(path="a.ts", start_line=1, end_line=2, text="...")
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Scalars and strings after named parameters. The dialect delimiter ends
|
|
85
|
+
the value; no JSON escape maze for the common case. Repeat the tool or
|
|
86
|
+
use parallel invokes when multiple edits are needed.
|
|
87
|
+
|
|
88
|
+
When composition is large (many steps, dynamic graphs), **do not** invent
|
|
89
|
+
deeper nested tool packs. Prefer fewer tools via code abstraction / Code
|
|
90
|
+
Mode / a host-side program (related: #1167, #2593) and multi-step token
|
|
91
|
+
breakpoints (#1170). Those reduce **how many** tools exist; this section
|
|
92
|
+
shapes **how each remaining tool looks** at the dialect layer.
|
|
93
|
+
|
|
94
|
+
### Authoring checklist (Directive + consumers)
|
|
95
|
+
|
|
96
|
+
Use for Directive-owned task/skill tool surfaces, documented host schemas,
|
|
97
|
+
and consumer MCP / product-agent schemas:
|
|
98
|
+
|
|
99
|
+
| Prefer | Avoid |
|
|
100
|
+
|--------|--------|
|
|
101
|
+
| Flat named scalars/strings | Nested object trees as required args |
|
|
102
|
+
| One clear purpose per tool | Mega-tools with optional clever branches |
|
|
103
|
+
| Homogeneous repeated fields | Mixed types + freeform JSON bags |
|
|
104
|
+
| Host validation + repair | Trusting provider schema as enforcement |
|
|
105
|
+
| Code / DSL for multi-step | Deeper nesting to "express workflows" |
|
|
106
|
+
|
|
107
|
+
- ~ Document constraints in parameter descriptions for human and model
|
|
108
|
+
readers, then **enforce in code**
|
|
109
|
+
- ≉ Shipping emoji/plaintext tool channels as a product default (control
|
|
110
|
+
group only in the source post)
|
|
111
|
+
- ≉ Migrating every existing tool in one pass — land the principle first;
|
|
112
|
+
reshape high-failure surfaces when measured failure rates justify it
|
|
113
|
+
- ? Keep a short failure catalog of dialect errors for your harness
|
|
114
|
+
(sibling track: #3086) so "won't fix" provider quirks become harness
|
|
115
|
+
duties
|
|
116
|
+
|
|
117
|
+
### Complementarity
|
|
118
|
+
|
|
119
|
+
| Concern | Where it lives |
|
|
120
|
+
|---------|----------------|
|
|
121
|
+
| **How each tool's args sample** (this doc) | Flat grammar, low nesting tax |
|
|
122
|
+
| **How many tools** exist | Code Mode / DSL / abstraction (#1167, #2593) |
|
|
123
|
+
| **When multi-step burns tokens** | Breakpoints / long-horizon (#1170) |
|
|
124
|
+
| **Security of tool use** | `patterns/llm-app.md` (schema validate, least privilege) |
|
|
125
|
+
| **Protocol / model-tier cost after shape** | Cost-envelope notes (e.g. #3078) |
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
15
129
|
## Token-Efficient Outputs
|
|
16
130
|
|
|
17
131
|
- ~ Support **filtering** — let the caller request only the fields they need
|
|
@@ -25,6 +139,8 @@ Principles for designing tools that agents can use effectively.
|
|
|
25
139
|
- ! **Tool descriptions** should state what the tool does, when to use it, and what it returns
|
|
26
140
|
- ~ **Parameters** should be self-documenting — use descriptive names and include constraints in descriptions
|
|
27
141
|
- ≉ Relying on the agent to infer parameter semantics from names alone
|
|
142
|
+
- ~ Keep descriptions short enough to load on demand; put deep examples in
|
|
143
|
+
linked docs, not in every tool definition (token tax — see also #865)
|
|
28
144
|
|
|
29
145
|
## Error Messages
|
|
30
146
|
|
|
@@ -84,12 +84,21 @@ Full operator steps: [`../docs/openclaw-agent-host.md`](../docs/openclaw-agent-h
|
|
|
84
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
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
86
|
|
|
87
|
+
## Content-surface honesty (#3162)
|
|
88
|
+
|
|
89
|
+
Session start records a **host content-surface class** (`file-first` / `repl-first` / `self-mutating` / `unknown`) and managed AGENTS section drift. Operators set `DEFT_HOST_CONTENT_SURFACE` (or REPL / self-mutate env flags) when the host is not file-first.
|
|
90
|
+
|
|
91
|
+
! Do not assume file gates or agent-only pins see host-kernel work product or host refine CRUDs.
|
|
92
|
+
|
|
93
|
+
Full honesty matrix and Tier-1 hook home: [`../docs/host-surface-assumptions.md`](../docs/host-surface-assumptions.md). Stance #3164 unchanged.
|
|
94
|
+
|
|
87
95
|
## Anti-patterns
|
|
88
96
|
|
|
89
97
|
- ⊗ Freestyle host tools first on Deft-shaped intent, then maybe open a skill.
|
|
90
98
|
- ⊗ Treat host skill inventory (`available_skills`, workspace skill folders) as the Directive Skills Index without a bridge.
|
|
91
99
|
- ⊗ Assume IDE deposit behavior on a session-first host that started outside the project root.
|
|
92
100
|
- ⊗ Abstract multi-host portability RFC with zero OpenClaw (or second-family) behavior change.
|
|
101
|
+
- ⊗ Assume file/git gates saw REPL-kernel or mid-run host-refine work product (#3162).
|
|
93
102
|
|
|
94
103
|
## Acceptance pointer
|
|
95
104
|
|
package/docs/agent-docs.md
CHANGED
|
@@ -43,6 +43,7 @@ These are the specific blocks the study measured *hurting* agent quality — tre
|
|
|
43
43
|
|
|
44
44
|
When a workflow skill must not be skipped on trigger miss (implementation, pre-PR, review-cycle, swarm), name it in AGENTS.md as an **always-pin** — not by pasting the skill body. Tier definitions, default pin list, and anti-patterns (do not pin entire language packs): [`skill-pin-policy.md`](./skill-pin-policy.md).
|
|
45
45
|
|
|
46
|
+
On REPL-first or self-mutating hosts, pins and file gates have honest limits — see [`host-surface-assumptions.md`](./host-surface-assumptions.md) (#3162).
|
|
46
47
|
## Relationship to directive's own dogfooding
|
|
47
48
|
|
|
48
49
|
Directive holds its own AGENTS.md to this bar via the `verify:agents-md-budget` ratchet (#645) and the consumer-side advisory signal (`agentsMdAdvisory`, #2155). The doc-sprawl awareness step in the `deft-directive-sync` skill (#647) surfaces reachable-doc-volume drift before it silently degrades agent quality. This doc is the "how to structure it well" companion to those "keep it from bloating" guards.
|
|
@@ -16,11 +16,34 @@ A consumer could omit Directive enforcement gates from its `check` task and CI w
|
|
|
16
16
|
|
|
17
17
|
It fails with a concrete repair path when definitions or explicit check deps omit them. CI workflows that neither invoke the gates nor a composing entrypoint (`task check` / `deft check`) produce **warnings** by default (migration).
|
|
18
18
|
|
|
19
|
+
### Greenfield include-only Taskfile (#3218)
|
|
20
|
+
|
|
21
|
+
After `directive init`, the consumer root `Taskfile.yml` is often **include-only**:
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
includes:
|
|
25
|
+
deft:
|
|
26
|
+
taskfile: ./.deft/core/Taskfile.yml
|
|
27
|
+
optional: true
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Operators run `task deft:check` (namespaced include). Composition lives in the **included** framework `Taskfile.yml` + `.deft/core/tasks/verify.yml`, not in root `check` deps.
|
|
31
|
+
|
|
32
|
+
`verify:consumer-check-contract` **trusts that included graph** when:
|
|
33
|
+
|
|
34
|
+
1. The root Taskfile declares the canonical `.deft/core/Taskfile.yml` include, and
|
|
35
|
+
2. No local `check` / `check:consumer` / `check:framework-source` aggregate is defined at the root, and
|
|
36
|
+
3. The included framework Taskfile defines the required gates in `tasks/verify.yml` and composes them (deps or check orchestrator body).
|
|
37
|
+
|
|
38
|
+
A **partial local** root check aggregate still fails closed — the include must not conceal incomplete root deps.
|
|
39
|
+
|
|
40
|
+
Root cause of red `greenfield-python-free-smoke` after #3145: the gate only inspected the root Taskfile, treated include-only greenfield as “no check composition,” and hard-failed (`exit 201` via #3188). That was a **gate false positive** for the intentional deposit shape, not a missing deposit wiring bug.
|
|
41
|
+
|
|
19
42
|
## Repair path
|
|
20
43
|
|
|
21
|
-
1. Restore deposit Taskfiles: `deft update` (includes `tasks/verify.yml`)
|
|
22
|
-
2. Ensure `check:consumer` / `check:framework-source` deps list the three gates (framework source already ships this wiring)
|
|
23
|
-
3. Prefer CI that runs `task check`
|
|
44
|
+
1. Restore deposit Taskfiles: `deft update` (includes `tasks/verify.yml` under `.deft/core/`)
|
|
45
|
+
2. Ensure `check:consumer` / `check:framework-source` deps list the three gates (framework source already ships this wiring), **or** keep the include-only greenfield shape so the gate follows the canonical include
|
|
46
|
+
3. Prefer CI that runs `task check` / `task deft:check` / `deft check` rather than a partial custom graph (installer-only workflows such as `deft-core-guard` stay warn-only for CI composition)
|
|
24
47
|
|
|
25
48
|
## Relation to #3070
|
|
26
49
|
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Structured agent decision log (#1396)
|
|
2
|
+
|
|
3
|
+
Durable **intent-debt** records for significant agent and operator choices.
|
|
4
|
+
|
|
5
|
+
Git history records *what* changed. Decision records capture *why* A won over B, under which rule, and when a later agent should re-open the choice.
|
|
6
|
+
|
|
7
|
+
Legend (from RFC2119): !=MUST, ~=SHOULD, ≉=SHOULD NOT, ⊗=MUST NOT, ?=MAY.
|
|
8
|
+
|
|
9
|
+
## When to record
|
|
10
|
+
|
|
11
|
+
! Record a decision when the choice is **significant**:
|
|
12
|
+
|
|
13
|
+
- architecture
|
|
14
|
+
- product behavior
|
|
15
|
+
- security
|
|
16
|
+
- public / private boundary
|
|
17
|
+
- data model
|
|
18
|
+
- runtime topology
|
|
19
|
+
- hard-to-reverse process
|
|
20
|
+
|
|
21
|
+
⊗ Record a decision for every trivial scope or routine bugfix.
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Write (flags and/or --body-file JSON)
|
|
27
|
+
task decision:write -- \
|
|
28
|
+
--decision "Prefer dual location for decision records" \
|
|
29
|
+
--governing-rule "Significant choices leave durable rationale" \
|
|
30
|
+
--governing-path "content/docs/decision-log.md" \
|
|
31
|
+
--governing-rfc MUST \
|
|
32
|
+
--alternative "scope-only narratives" \
|
|
33
|
+
--alternative "ADR-only" \
|
|
34
|
+
--why-winner "Covers scope-bound and cross-cutting without ADR noise" \
|
|
35
|
+
--confidence high \
|
|
36
|
+
--revisit-trigger "If list/find is painful, revisit folder layout" \
|
|
37
|
+
--scope xbrief/active/2026-08-09-example.xbrief.json \
|
|
38
|
+
--related-issue 1396 \
|
|
39
|
+
--tag process
|
|
40
|
+
|
|
41
|
+
# List / filter
|
|
42
|
+
task decision:list --
|
|
43
|
+
task decision:list -- --query mirror --json
|
|
44
|
+
task decision:list -- --issue 1423
|
|
45
|
+
task decision:list -- --scope xbrief/active/
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
On Windows, prefer `--body-file` for multi-line fields (UTF-8 no BOM temp file).
|
|
49
|
+
|
|
50
|
+
Invalid schema fails closed (exit 2).
|
|
51
|
+
|
|
52
|
+
## Schema (lightweight, not xBRIEF lifecycle)
|
|
53
|
+
|
|
54
|
+
| Field | Required | Notes |
|
|
55
|
+
|-------|----------|--------|
|
|
56
|
+
| `schemaVersion` | yes | `deft.decision.v1` |
|
|
57
|
+
| `id` | yes | kebab slug (derived from decision if omitted) |
|
|
58
|
+
| `decision` | yes | what was decided |
|
|
59
|
+
| `governingRule` | yes | `{ description, path?, rfc2119? }` or string |
|
|
60
|
+
| `alternativesConsidered` | yes | non-empty array of `{ option, whyNot? }` |
|
|
61
|
+
| `whyWinner` | yes | why the chosen path won |
|
|
62
|
+
| `confidence` | yes | `low` \| `medium` \| `high` |
|
|
63
|
+
| `activeScopeRefs` | no | relative scope xBRIEF path(s) |
|
|
64
|
+
| `timestamp` | yes | ISO-8601 UTC |
|
|
65
|
+
| `revisitTrigger` | yes | when/why to re-open |
|
|
66
|
+
| `tags` / `relatedIssues` | no | list filters |
|
|
67
|
+
|
|
68
|
+
Files: `xbrief/decisions/YYYY-MM-DD-<slug>.decision.json` (committed; not gitignored).
|
|
69
|
+
|
|
70
|
+
## Dual location
|
|
71
|
+
|
|
72
|
+
1. **Always** write the JSON file under `xbrief/decisions/`.
|
|
73
|
+
2. When `--scope` points at a scope xBRIEF, also append a pointer line under `plan.narratives.Decisions` (string narrative; validators accept extra narrative keys).
|
|
74
|
+
3. Use `--standalone` to skip scope attach even if scope refs are present.
|
|
75
|
+
|
|
76
|
+
Cross-cutting process/architecture decisions often have empty `activeScopeRefs`.
|
|
77
|
+
|
|
78
|
+
## Enforcement (v1)
|
|
79
|
+
|
|
80
|
+
! Guidance only in build / pre-pr / portfolio (and related) skills for **significant** choices.
|
|
81
|
+
|
|
82
|
+
⊗ Do **not** require a decision record before every `scope:complete` in v1 (deterministic complete-hook is later work).
|
|
83
|
+
|
|
84
|
+
## Split from other surfaces
|
|
85
|
+
|
|
86
|
+
| Surface | Role |
|
|
87
|
+
|---------|------|
|
|
88
|
+
| This decision log (#1396) | Single durable rationale events |
|
|
89
|
+
| Lessons / compound memory (#1513) | Reusable patterns and anti-patterns |
|
|
90
|
+
| `docs/decisions/ADR-*.md` | Heavyweight architecture ADRs — leave alone |
|
|
91
|
+
| Portfolio brief (#3198/#3201) | Propose-not-apply; **dispose** into `decision:write` |
|
|
92
|
+
| Chat / transcripts | Non-goal |
|
|
93
|
+
| Full inter-run memory (#2741) | Related consumer later; not owned by this surface |
|
|
94
|
+
|
|
95
|
+
## Consumers
|
|
96
|
+
|
|
97
|
+
- Portfolio dispose (#3198 / #3201 / pilot #3200)
|
|
98
|
+
- Process policy dogfood (SCM label-mirror first mass-apply #1423)
|
|
99
|
+
- Multi-agent handoff continuity (related #2741 class)
|
|
100
|
+
|
|
101
|
+
## Dogfood seeds
|
|
102
|
+
|
|
103
|
+
- `xbrief/decisions/2026-08-08-scm-label-mirror-first-mass-apply.decision.json`
|
|
104
|
+
- `xbrief/decisions/2026-08-09-portfolio-dispose-into-decision-log.decision.json`
|
|
105
|
+
|
|
106
|
+
## Cold-path discovery (#3211)
|
|
107
|
+
|
|
108
|
+
! Always-on AGENTS managed pointer (via `content/templates/agents-entry.md` + `task agents:refresh`), Level-0 `REFERENCES.md` under context/long tasks, and [`inter-run-learning.md`](./inter-run-learning.md) link this surface so a fresh session can name `decision:list` without loading build or pre-pr skills.
|
|
109
|
+
|
|
110
|
+
## See also
|
|
111
|
+
|
|
112
|
+
- [`xbrief/decisions/README.md`](../../xbrief/decisions/README.md)
|
|
113
|
+
- `task decision:write` / `task decision:list` in [`commands.md`](../commands.md)
|
|
114
|
+
- [`inter-run-learning.md`](./inter-run-learning.md) (cold memory SoTs; this log is the durable *why* lane)
|
package/docs/delivery-attempt.md
CHANGED
|
@@ -90,13 +90,29 @@ and tool-call budgets still apply.
|
|
|
90
90
|
`allowedAttempts`, and optional expiry. Overrides do **not** erase attempt
|
|
91
91
|
history.
|
|
92
92
|
|
|
93
|
+
## Swarm implement-leaf wiring (#3228)
|
|
94
|
+
|
|
95
|
+
Portable CLI gate on the swarm re-dispatch path (not library-only):
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
task swarm:pre-dispatch -- --scope-id <story|issue|xbrief-id> --target-id <worktree|branch>
|
|
99
|
+
# exit 0 allow (beginAttempt) / 1 DENY_DUPLICATE_ACTIVE or other gate block / 2 config
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Default unit key: `scopeId` + `targetId` + `workflowId=drive-to:merge-ready`.
|
|
103
|
+
Actions: `begin` (default), `complete` (`--status succeeded|failed|cancelled|blocked`), `cancel` (takeover step 1).
|
|
104
|
+
Monitors MUST run begin before any peer implement spawn; spawn only on exit 0.
|
|
105
|
+
Takeover: cancel prior attempt, then begin again — never concurrent dual active.
|
|
106
|
+
Implementation: `packages/core/src/swarm/pre-dispatch.ts` + `task swarm:pre-dispatch`.
|
|
107
|
+
|
|
93
108
|
## Skill routing
|
|
94
109
|
|
|
95
110
|
| Surface | Role |
|
|
96
111
|
|---------|------|
|
|
97
112
|
| `main.md` Dual Stop Rule (#2442) | Principle; points here for delivery/acceptance |
|
|
98
113
|
| build / swarm / review-cycle skills | Behavioral dual-stop defaults; point here for mechanical gate |
|
|
99
|
-
| swarm `core-ops` / `core-phase-4` | Prompt + monitor envelopes; do not invent a second ledger |
|
|
114
|
+
| swarm `core-ops` / `core-phase-4` | Prompt + monitor envelopes; pre-dispatch CLI pointer (#3228); do not invent a second ledger |
|
|
115
|
+
| `task swarm:pre-dispatch` | Authoritative implement-leaf gate (#3228); wires `DENY_DUPLICATE_ACTIVE` |
|
|
100
116
|
|
|
101
117
|
## Typical call shape
|
|
102
118
|
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Gate integrity — a failing gate must not be fixed by editing the gate (#3156)
|
|
2
|
+
|
|
3
|
+
General product and process rule for Directive fix loops, refine loops, and quality-gate repair: **when a gate is red, clear red by fixing the work under test — not by mutating the gate.**
|
|
4
|
+
|
|
5
|
+
Legend (RFC2119): `!`=MUST, `~`=SHOULD, `≉`=SHOULD NOT, `⊗`=MUST NOT, `?`=MAY.
|
|
6
|
+
|
|
7
|
+
Parent epic: [#3179](https://github.com/deftai/directive/issues/3179) (self-improving under gates). Stance: [#3164](https://github.com/deftai/directive/issues/3164) (**shipped** — constitution-tier changes go through issue/PR + review; this doc does not re-litigate that stance). Extends verification independence [#782](https://github.com/deftai/directive/issues/782) / [#1499](https://github.com/deftai/directive/issues/1499) and scope self-auth themes [#3145](https://github.com/deftai/directive/issues/3145).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## The rule (sharp form)
|
|
12
|
+
|
|
13
|
+
- ⊗ A self-modification, refine, fix, or pre-PR loop **MUST NOT** clear a failing gate by editing the **gate definition**, **verifier**, **reward**, **required check**, coverage floor, policy flag, eval fixture, or other evaluator surface that is currently failing — solely so the loop can report green.
|
|
14
|
+
- ! When a gate fails, fix the **product, process, test, or documentation under test**.
|
|
15
|
+
- ! Deliberate **gate definition** changes (raise/lower thresholds, rewrite verify scripts, change required checks) go through the normal **issue → PR → review** path with explicit rationale — same disposal model as constitution-tier content under [#3164](https://github.com/deftai/directive/issues/3164).
|
|
16
|
+
- ~ If the gate itself is wrong (false positive, obsolete check, wrong floor), open or amend an issue/PR that **names the gate change as the change**, not as a silent sibling edit inside a product fix.
|
|
17
|
+
|
|
18
|
+
One-line form:
|
|
19
|
+
|
|
20
|
+
> When a gate fails, the fix MUST NOT be an edit to the gate.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## What counts as a “gate” here
|
|
25
|
+
|
|
26
|
+
Any deterministic pass/fail surface that adjudicates work quality, including but not limited to:
|
|
27
|
+
|
|
28
|
+
| Surface | Examples |
|
|
29
|
+
|---------|----------|
|
|
30
|
+
| Aggregate quality | `task check`, CI required checks |
|
|
31
|
+
| Coverage / thresholds | coverage floors, hotspot floors, `--allow-coverage-debt` misuse |
|
|
32
|
+
| Verify scripts | `verify:*` tasks, content contracts, schema validators |
|
|
33
|
+
| Policy flags | `plan.policy.*` that weaken or skip enforcement |
|
|
34
|
+
| Eval / fixtures | golden eval cells, reward definitions, required fixture assertions |
|
|
35
|
+
| Scope / process | active xBRIEF `file_scope` self-expansion that self-authorizes (#3145) |
|
|
36
|
+
|
|
37
|
+
The **evaluator lives outside the editable surface under test** (#782 agent-loop / fixed evaluator). Moving the goalposts is not a valid fix.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Separation from #2436 (refine-internal SkillOpt)
|
|
42
|
+
|
|
43
|
+
| Layer | Owner | What it protects |
|
|
44
|
+
|-------|-------|------------------|
|
|
45
|
+
| **Refine-loop-internal** | [#2436](https://github.com/deftai/directive/issues/2436) SkillOpt / control stack | Proposer cannot edit its own reward / slow-update / validator **region inside the refine runtime** (bounded patch algebra, reject buffer, protected region) |
|
|
46
|
+
| **General product/process gate integrity** | **This issue (#3156)** | Agents and fix loops must not clear **Directive product/process gates** (check, coverage, verify, policy, eval fixtures, scope) by mutating those gates |
|
|
47
|
+
|
|
48
|
+
- ⊗ Re-implement SkillOpt, proposer runtime, or refine-internal protected regions under this rule’s delivery.
|
|
49
|
+
- ! Treat #2436 as complementary machinery for self-improvement loops; treat **#3156 as the general behavioral rule** for every fix/pre-PR path that hits a red gate.
|
|
50
|
+
- ~ Host honesty limits when the **runtime** self-mutates or is REPL-first: [host-surface-assumptions.md](./host-surface-assumptions.md) (#3162). That doc names what file gates cannot see; it does not reverse this rule or #3164.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Motivating evidence (Factorio / Continual Harness)
|
|
55
|
+
|
|
56
|
+
Prime Agent / Continual-Harness-class refine loops have packaged reward hacks as reusable skills. A concrete case study: in Factorio, a refine loop found a resource-spawn exploit and codified the exploit the same way it codifies good tactics — “self-improvement has no moral compass, only reward.”
|
|
57
|
+
|
|
58
|
+
That failure mode is exactly what #782 / #1499 / #2436 argue against, observed in a shipped MIT harness rather than only hypothesized. Directive’s answer at the **general product/process** layer is this gate-integrity rule; refine-internal machinery remains on #2436.
|
|
59
|
+
|
|
60
|
+
Field notes and parent framing: issue [#3156](https://github.com/deftai/directive/issues/3156); related safety-via-gates [#1200](https://github.com/deftai/directive/issues/1200).
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Legitimate gate change vs cheating the evaluator
|
|
65
|
+
|
|
66
|
+
| Allowed | Forbidden in a fix/refine loop |
|
|
67
|
+
|---------|--------------------------------|
|
|
68
|
+
| Fix product code so tests/coverage pass honestly | Lower coverage floor or delete failing tests only to go green |
|
|
69
|
+
| Fix a broken product test that asserts wrong behavior (with rationale) | Weaken the assert until anything passes |
|
|
70
|
+
| PR that **is** “raise coverage floor to 90%” with review | Same PR as a feature fix that silently drops the floor |
|
|
71
|
+
| Issue + PR changing a verify script with explicit AC | Edit verify script mid-loop because it failed your change |
|
|
72
|
+
| Scoped `#N` coverage-debt allow with tracked issue | Blanket skip of required checks without policy path |
|
|
73
|
+
|
|
74
|
+
- ! Gate-definition PRs MUST state the intended standard change in the PR body and issue link.
|
|
75
|
+
- ⊗ Bundle silent gate weakening with an unrelated product fix to “make CI green.”
|
|
76
|
+
- ? Temporary operator-approved debt (`--allow-coverage-debt=#N`, policy override with audit) MAY exist when the framework already defines that escape hatch — still not a free rewrite of the gate.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Discoverability
|
|
81
|
+
|
|
82
|
+
- Pre-PR Diff phase checklist: [deft-directive-pre-pr](../skills/deft-directive-pre-pr/SKILL.md) (gate-integrity bullet).
|
|
83
|
+
- Stance / propose-not-apply: [main.md § Self-Improving, Not Self-Editing (#3164)](../../main.md#self-improving-not-self-editing-3164), [philosophy.md](../meta/philosophy.md).
|
|
84
|
+
- Verification outcomes: [verification.md](../verification/verification.md).
|
|
85
|
+
- Goal/gate rigidity: [goal-gate-determinism.md](../patterns/goal-gate-determinism.md) (#852).
|
|
86
|
+
- Scope self-auth instance: [scope-provenance.md](./scope-provenance.md) (#3145).
|
|
87
|
+
|
|
88
|
+
Full CI automation that blocks “diff touches a gate that just failed” without operator acknowledgment is an **optional follow-up** — this story ships the sharp rule and pre-PR discoverability, not a new verify binary.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Cross-links
|
|
93
|
+
|
|
94
|
+
| Topic | Where |
|
|
95
|
+
|-------|--------|
|
|
96
|
+
| Parent epic | [#3179](https://github.com/deftai/directive/issues/3179) |
|
|
97
|
+
| Stance (propose-not-apply) | [#3164](https://github.com/deftai/directive/issues/3164), [main.md](../../main.md#self-improving-not-self-editing-3164) |
|
|
98
|
+
| Refine-internal SkillOpt | [#2436](https://github.com/deftai/directive/issues/2436) |
|
|
99
|
+
| Fixed evaluator / agent-loop | [#782](https://github.com/deftai/directive/issues/782) |
|
|
100
|
+
| Verification independence | [#1499](https://github.com/deftai/directive/issues/1499) |
|
|
101
|
+
| Scope self-authorization | [#3145](https://github.com/deftai/directive/issues/3145), [scope-provenance.md](./scope-provenance.md) |
|
|
102
|
+
| Host self-mutate honesty | [#3162](https://github.com/deftai/directive/issues/3162), [host-surface-assumptions.md](./host-surface-assumptions.md) |
|
|
103
|
+
| Safety via formal gates | [#1200](https://github.com/deftai/directive/issues/1200) |
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Non-goals (#3156)
|
|
108
|
+
|
|
109
|
+
- ⊗ Implementing full SkillOpt / proposer runtime (#2436)
|
|
110
|
+
- ⊗ Host hook enforcement for self-mutating hosts (#3162)
|
|
111
|
+
- ⊗ Replacing design-principle docs under #1200 (complementary)
|
|
112
|
+
- ⊗ Shipping full “gate-diff-when-red” CI automation in this story
|