@christang/keel 5.170.0 → 5.172.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.170.0",
3
+ "version": "5.172.0",
4
4
  "description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "TanglmChris",
package/README.md CHANGED
@@ -174,14 +174,10 @@ successful update, Keel restores its overlays for every target installed in the
174
174
  repository. `keel --doctor` also reports overlay health for the other installed
175
175
  targets, so healthy Claude coverage cannot hide missing Codex overlays.
176
176
 
177
- Subagent use is the model's execution choice, subject to the host's policy.
178
- `keel project --event subagent-start --change <change> --task <id>` produces a
179
- read-only helper brief without extra activation. Add `--subagent-mode implementation`
180
- for a delegate inside the task's Touch boundary; it requires an implementation
181
- task and a matching active guard, while `delegation.tier` is optional metadata.
182
- The current agent reviews returns, re-runs verification, and owns completion.
183
- This CLI projects a brief; it does not spawn an agent or prove hook enforcement.
184
- Native goal activation still requires explicit authorization.
177
+ A subagent is the model's choice and is treated as the main agent is: the gates, the
178
+ `Touch` write guard, and the evidence rules apply to whoever runs a step. Keel asks for
179
+ no brief, activation, or second agent's rerun before one acts, and does not nudge the
180
+ model toward or away from using one (#414).
185
181
 
186
182
  Do the spec work through OpenSpec's commands (`/opsx:propose`, `/opsx:apply`, `/opsx:sync`,
187
183
  `/opsx:archive`). Keel's gates run at the task boundaries. The whole loop:
@@ -219,13 +215,13 @@ A task that authors no `Autonomy boundary:` inherits the declaration, and the co
219
215
  names `keel/config.yaml` as that entry's source so an inherited authorization is never mistaken
220
216
  for one the task decided. A task that authors its own boundary keeps it.
221
217
 
222
- `continuation`, the fifth name, is the between-task one: it covers exactly the boundary between a
223
- durably complete task and the next unchecked task of the same change, inside a change whose
224
- `tasks.md` you approved — the stop that re-asks for an approval already given. It removes only that
225
- confirmation: the next task still starts through `keel gate task-start` with its own recorded
226
- fingerprint, every gate, evidence requirement, semantic Review, and the write guard run unchanged,
227
- and a stop with its own trigger — a blocker, fingerprint drift, an out-of-scope need, an unresolved
228
- question — still stops. It authorizes no repository action and schedules nothing. On an older Keel
218
+ `continuation`, the fifth name, is accepted and changes nothing. Moving from a durably complete
219
+ task to the next unchecked task of the same change, inside a change whose `tasks.md` you approved,
220
+ needs no confirmation by default (#414). The next task still starts through `keel gate task-start`
221
+ with its own recorded fingerprint, every gate, evidence requirement, semantic Review, and the write
222
+ guard run unchanged, and a stop with its own trigger — a blocker, fingerprint drift, an out-of-scope
223
+ need, an unresolved question — still stops. Continuing authorizes no repository action and
224
+ schedules nothing. On an older Keel
229
225
  whose vocabulary predates the word, the entry is unrecognized and the whole declaration authorizes
230
226
  nothing until corrected — fail-closed, never a silent grant.
231
227
 
@@ -491,8 +487,11 @@ the words Keel states criteria in, so a tier can only ever skip a file that deci
491
487
  what to skip is a declaration rather than the agent's own call on purpose — "do I need this help?" is
492
488
  the judgement a weak executor gets most wrong, and it would be answering it about itself.
493
489
 
494
- One skill is split today, `keel-run-single-task-goal`, and its body is 11% smaller for it. The other
495
- five are almost entirely criteria, so splitting them would move the half that has to stay.
490
+ Two skills carry a guidance file today. `keel-run-single-task-goal` was split, and its body is 11%
491
+ smaller for it. `keel-tdd-or-test-first` gained one rather than lost prose to it: a table that picks
492
+ a Verify strategy by what would make the Acceptance false, with right and wrong choices and when each
493
+ evidence form pays (#389). The other four are almost entirely criteria, so splitting them would move
494
+ the half that has to stay.
496
495
 
497
496
  ## How the agent uses these
498
497
 
package/README.zh-CN.md CHANGED
@@ -144,12 +144,10 @@ keel --doctor # 检查各部分是否就位
144
144
  中所有已安装的 target 恢复 overlay。`keel --doctor` 也会逐项报告其他已安装 target 的
145
145
  overlay 状态,避免 Claude 检查正常时漏掉 Codex 的缺失。
146
146
 
147
- 是否使用 subagent 由模型选择,仍须遵守宿主政策。运行
148
- `keel project --event subagent-start --change <change> --task <id>` 可生成只读 helper
149
- brief,无须额外激活许可。加 `--subagent-mode implementation` 可生成实现委派 brief,
150
- 要求当前任务为 implementation,且有效 guard 匹配任务、指纹和 Touch;`delegation.tier`
151
- 只是可选能力元数据。主 agent 审查返回结果、独立重跑验证并负责完成判定。CLI 只生成
152
- brief,不启动 agent,也不证明 hook 实际执行;native goal 仍须明确授权激活。
147
+ 用不用 subagent 由模型自己决定,subagent 与主 agent 同等对待:门禁、`Touch` 写入
148
+ guard 和证据规则对谁执行都一样。Keel 不要求 brief、额外激活或另一个 agent 复跑,
149
+ 也不鼓励或劝阻使用(#414)。在已批准的 `tasks.md` 里,默认按顺序一个接一个做下去,
150
+ 每个任务照样过 `keel gate task-start` 与 `keel gate task-complete`,遇到停止条件照样停。
153
151
 
154
152
  spec 相关的活走 OpenSpec 的命令(`/opsx:propose`、`/opsx:apply`、`/opsx:sync`、`/opsx:archive`),
155
153
  Keel 的门禁在任务边界处运行。整个回路:
@@ -1,9 +1,9 @@
1
- <!-- keel:start version=5.170.0 -->
1
+ <!-- keel:start version=5.172.0 -->
2
2
  ## Keel Bootstrap
3
3
 
4
- - Start every session with `keel context`; OpenSpec artifacts and Git are the only durable authority — never native memory, goals, or transcripts.
4
+ - Start every session with `keel context`; OpenSpec artifacts and Git are the durable authority, and memory or transcripts may only inform.
5
5
  - Obey the selected task capsule: `keel gate task-start` before implementing, `--record` its fingerprint to Evidence `Contract`, which `task-complete` requires, before checking complete. Touch bounds product writes; the change's own dir is exempt. On Claude a passing `task-start` guards it by default (`--no-guard` opts out).
6
- - One agent owns decisions; model-chosen helpers return read-only report/evidence, delegates need task Touch and a matching active guard. No commit, sync, or archive without explicit authorization.
6
+ - Work through an approved `tasks.md` in order, each task through its own gates. A subagent is the model's choice and is treated as the main agent is. No commit, sync, or archive without explicit authorization.
7
7
  - Route Full (the OpenSpec flow) for new features, interface or protocol changes, cross-module work, or over ~3 files / 100 lines; Lite for local fixes with no interface change. No gate checks routing; a project corrects the size bar with `full_mode_paths:` in `keel/config.yaml`, which `keel context` reports.
8
8
  - Native plugin projections (SessionStart context) are disposable views, never authority; without the plugin or hook, run the commands manually.
9
9
  - Keel skills and hooks come from the `keel` native plugin (`codex plugin add` / `claude plugin install`); `keel --init` owns only the OpenSpec schema, overlays, and this bootstrap.
@@ -122,10 +122,9 @@ artifacts:
122
122
  required real-task evidence. Portable source authority and declared target
123
123
  projections must also be named when they affect Touch or Commands.
124
124
 
125
- Execution recommendation and Rationale are advisory notes for the current
126
- Keel agent. Keel-managed work executes in the current agent conversation;
127
- retain task decisions in the current agent; bounded helpers and guarded
128
- implementation delegates are model choices, subject to host policy.
125
+ Execution recommendation and Rationale are advisory notes for whoever
126
+ executes the task. A subagent is the model's choice and is treated as the
127
+ main agent is; the gates and the `Touch` write guard bind every step.
129
128
  Autonomy boundary defaults to hard-stop for every action the repository
130
129
  has not standing-authorized in `keel/config.yaml`; a declared action is
131
130
  inherited only by a task that authored no boundary of its own, and the
@@ -192,8 +191,8 @@ apply:
192
191
  4. Run the Slice Start Gate: every selected current slice must name source expectations and compile to a complete keel-task-capsule/v1 contract from its compact Covers, Touch, Verify, and Evidence fields plus any declared exceptional Mode, Read, Acceptance delta, Autonomy boundary, Coupling/Candidate Boundary, or Stop if clauses.
193
192
  5. If a selected task lacks an execution contract, source expectations, or accepted hidden-knowledge assumptions raised by risk-triggered deep alignment or a domain lens, update OpenSpec first instead of dispatching implementation.
194
193
  6. Rough future slices may remain non-executable drafts, but they cannot be selected for implementation or marked complete.
195
- 7. The current Keel agent remains task owner and executor. Treat any Execution recommendation as an advisory implementation note, not as a completion gate.
196
- 8. Keep task decisions in the current agent; model-chosen helpers are read-only and implementation delegates require task write authority and a matching active guard. Host policy remains authoritative. Keep task selection, implementation, verification, and failure recovery in the current agent conversation.
194
+ 7. Treat any Execution recommendation as an advisory implementation note, not as a completion gate.
195
+ 8. Work through the unchecked tasks of an approved `tasks.md` in order, each through its own `keel gate task-start` and `keel gate task-complete`; every stop trigger still halts. A subagent is the model's choice and is treated as the main agent is.
197
196
  9. Use the current checkout and selected task contract. Verification failure or context pressure preserves the checkout; continue from evidence, record a blocker, or explicitly roll back to last-green only when authorized.
198
197
  10. When `Coupling: required`, verify design.md contains a Coupled Iteration Contract and that the task defines a complete candidate, completion gate, and evidence. If not, update OpenSpec instead of execution.
199
198
  11. The current agent may read any repository file needed for the selected task, but repository-wide read authority is read-only and does not expand write authority.
package/bin/keel.js CHANGED
@@ -89,6 +89,10 @@ const OPENSPEC_SURFACE_OVERLAY_START =
89
89
  `<!-- keel:openspec-surface-overlay version=${PACKAGE_JSON.version} -->`;
90
90
  const OPENSPEC_SURFACE_OVERLAY_END =
91
91
  "<!-- keel:openspec-surface-overlay:end -->";
92
+ // The one thing a gated surface says about subagents (#414): neither a rule
93
+ // nor a nudge, because the gates and the Touch guard already bind whoever runs.
94
+ const SUBAGENT_SENTENCE =
95
+ "- A subagent is the model's choice and is treated as the main agent is: the gates, the `Touch` write guard, and the evidence rules apply to whoever runs a step.";
92
96
  const OPENSPEC_SURFACE_OVERLAY_RE =
93
97
  /<!--\s*keel:openspec-surface-overlay(?:\s+[^>]*)?\s*-->[\s\S]*?<!--\s*keel:openspec-surface-overlay:end\s*-->/;
94
98
 
@@ -1745,18 +1749,17 @@ function keelOpenSpecOverlay(action) {
1745
1749
  ];
1746
1750
  return lines.join("\n");
1747
1751
  }
1748
- // Sync mirrors archive's structure and not its content: the two are gated and
1749
- // owned identically, so the ownership, subagent, and delegation-language
1750
- // rules are the same statements with `sync` in them. What differs is the
1751
- // artifact consequence — archive warns about re-applying a promoted delta,
1752
- // and sync is the thing that promotes it, so it says so from its own side. A
1753
- // reader who only ever sees one of the two surfaces still learns the pairing.
1752
+ // Sync mirrors archive's structure and not its content: the two are gated
1753
+ // identically, so the gate and the subagent sentence are the same statements
1754
+ // with `sync` in them. What differs is the artifact consequence — archive
1755
+ // warns about re-applying a promoted delta, and sync is the thing that
1756
+ // promotes it, so it says so from its own side. A reader who only ever sees
1757
+ // one of the two surfaces still learns the pairing.
1754
1758
  const syncBody = [
1755
- "- The current agent owns the sync decision and must verify task evidence, follow-up ownership, and completion gates before proceeding.",
1759
+ "- Verify task evidence, follow-up ownership, and completion gates before syncing.",
1756
1760
  "- Sync completion is gated by `keel gate change-close --action sync` plus `keel-review-checklist`; there is no runtime hook for it, so running the gate is the agent's own step.",
1757
1761
  "- Before syncing, each related critical expectation must have behavior evidence, a durable follow-up owner, or an explicit discard reason.",
1758
- "- Target-native subagents may help with bounded assessment or evidence production only; they cannot sync, change acceptance, or bypass completion gates.",
1759
- "- Do not treat generic OpenSpec sync delegation language as authority to transfer Keel ownership.",
1762
+ SUBAGENT_SENTENCE,
1760
1763
  "- Invoke OpenSpec through `keel openspec` (for example `keel openspec validate`); a bare `openspec` command may not be on PATH.",
1761
1764
  "- Syncing promotes the change's spec delta into `openspec/specs/`. A later archive of the same change must use `--skip-specs`, because archive is not idempotent over an already-promoted delta.",
1762
1765
  ];
@@ -1777,13 +1780,11 @@ function keelOpenSpecOverlay(action) {
1777
1780
  const actionBody =
1778
1781
  action === "apply"
1779
1782
  ? [
1780
- "- The current agent remains the Keel task owner and selects one unchecked task or a small contiguous task group from `tasks.md`.",
1783
+ "- Work through the unchecked tasks of an approved `tasks.md` in order, each started by `keel gate task-start` and completed by `keel gate task-complete`; every stop trigger still halts.",
1781
1784
  "- Run the Task Authoring Gate: each relevant critical expectation must be covered by a slice, deferred to a durable owner, or explicitly discarded.",
1782
1785
  "- Run the Slice Start Gate: selected current slices must name source expectations and include Read, Touch, Acceptance, Commands, and Stop/Autonomy boundaries before implementation.",
1783
1786
  "- Rough future slices may remain drafts, but cannot be selected for implementation or marked complete.",
1784
1787
  "- Obey the selected task contract: Read is required starting context, Touch is the write boundary, Commands prove Acceptance, and the Autonomy boundary controls fallback decisions.",
1785
- "- A target-native helper returns report/evidence only, and a model-chosen guarded delegate may write inside `Touch`; both cannot mark tasks complete, update OpenSpec state, commit, sync, archive, or change Acceptance.",
1786
- "- The current agent reviews all subagent output, command evidence, and diffs before marking any task complete.",
1787
1788
  "- When implementation exposes a material expectation, acceptance boundary, or user-owned decision absent from durable authority, stop before implementing that choice, rerun `keel-align-expectations`, and reauthor the affected proposal/design/spec/task authority first.",
1788
1789
  "- A discovered repository fact that does not change accepted behavior or scope may be recorded and execution continues inside the existing task boundary without a product interview.",
1789
1790
  "- Invoke OpenSpec through `keel openspec` (for example `keel openspec validate`); a bare `openspec` command may not be on PATH.",
@@ -1791,11 +1792,8 @@ function keelOpenSpecOverlay(action) {
1791
1792
  "- A standing authorization covers the action and never substitutes for a gate, evidence, or Review; it removes the confirmation, not the record, and it is not a trigger to perform the action.",
1792
1793
  ]
1793
1794
  : [
1794
- "- The current agent owns final sync/archive decisions and must verify task evidence, follow-up ownership, and completion gates before proceeding.",
1795
+ "- Archive completion is gated by `keel gate change-close --action archive` plus `keel-review-checklist`; verify task evidence, follow-up ownership, and completion gates before proceeding.",
1795
1796
  "- Before final sync/archive, each related critical expectation must have behavior evidence, a durable follow-up owner, or an explicit discard reason.",
1796
- "- Target-native subagents may help with bounded assessment or evidence production only; they cannot archive, sync, change acceptance, or bypass completion gates.",
1797
- "- The current agent reviews any subagent report before running `openspec-sync-specs`, `/opsx:sync`, or `/opsx:archive`.",
1798
- "- Do not treat generic OpenSpec archive delegation language as authority to transfer Keel ownership.",
1799
1797
  "- Invoke OpenSpec through `keel openspec` (for example `keel openspec validate`); a bare `openspec` command may not be on PATH.",
1800
1798
  "- When `/opsx:sync` has already promoted the change's spec delta, run the archive with `--skip-specs` so the promoted delta is not re-applied; archive is not idempotent over an already-synced delta.",
1801
1799
  "- After archiving, run `keel guard clear` to drop the change's guard manifest; the read-only gate never clears it for you.",
@@ -1811,15 +1809,7 @@ function keelOpenSpecOverlay(action) {
1811
1809
  "",
1812
1810
  "- Invoke the OpenSpec CLI as `keel openspec …` throughout this file. The commands below are written as a bare `openspec`, which resolves only where OpenSpec is separately installed on PATH; `keel openspec` resolves either way, and `keel --doctor` reports which case this repository is.",
1813
1811
  "",
1814
- "### Target-native subagent gate",
1815
- "",
1816
- "- The current agent remains responsible for Keel ownership, task/archive decisions, scope control, and final reporting.",
1817
- "- Use a target-native subagent when the current agent decides it is useful for a bounded helper step, or as a delegate implementing the selected task using existing task write authority when a guard manifest is active and matches the task, fingerprint and Touch; optional `delegation:` tiers are metadata.",
1818
- "- Target-native subagents acting as helpers return report/evidence only. A delegate may write, and only inside `Touch`; its reported command results are a claim, and the current agent re-runs each `M<n>` check itself before recording Evidence.",
1819
- "- Delegation is refused with no active guard manifest, because an absent manifest passes every write through silently and looks identical to a checked one.",
1820
- "- Neither may mark tasks complete, update OpenSpec state, commit, sync, archive, or change Acceptance; the current agent reviews all output before acting.",
1821
- "- The subagent brief must name the selected change/task, required read context, allowed write boundary or read-only diagnostic scope, expected commands/evidence, and prohibited actions. Compile it with `keel project --event subagent-start` for a read-only helper or add `--subagent-mode implementation` for a guarded delegate; no extra user activation is required. Host policy remains authoritative; Keel adds no separate carrier because the host already has one.",
1822
- "- Prohibited actions include scope expansion, Acceptance changes, completion marking, sync/archive decisions, commits, handoff changes, and cross-runtime delegation unless the selected task or user explicitly authorizes them.",
1812
+ SUBAGENT_SENTENCE,
1823
1813
  ...actionBody,
1824
1814
  OPENSPEC_SURFACE_OVERLAY_END,
1825
1815
  "",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@christang/keel",
3
- "version": "5.170.0",
3
+ "version": "5.172.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.170.0",
9
+ "version": "5.172.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@fission-ai/openspec": "^1.4.1"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@christang/keel",
3
3
  "displayName": "Keel",
4
4
  "description": "Keel OpenSpec execution discipline CLI for Claude Code, Codex, and OpenCode.",
5
- "version": "5.170.0",
5
+ "version": "5.172.0",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.170.0",
3
+ "version": "5.172.0",
4
4
  "description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "TanglmChris",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.170.0",
3
+ "version": "5.172.0",
4
4
  "description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "TanglmChris",
@@ -80,7 +80,7 @@ so the two surfaces cannot drift against each other.
80
80
 
81
81
  ## Domain lenses
82
82
 
83
- When the change signals a specific domain, look in `keel/lenses/` for a lens whose `Applies when:` header matches, and read only that lens before asking domain questions; do not load unrelated lenses. When no lens matches, or the repo defines none, proceed on the domain-agnostic path. Lenses are user-authored; scaffold the bundled starting points with `keel lenses add` (web, hardware, hardware-dsl).
83
+ When the change signals a specific domain, look in `keel/lenses/` for a lens whose `Applies when:` header matches, and read it before asking domain questions. When no lens matches, or the repo defines none, proceed on the domain-agnostic path. Lenses are user-authored; scaffold the bundled starting points with `keel lenses add` (web, hardware, hardware-dsl).
84
84
 
85
85
  ## Boundaries
86
86
 
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: keel-debug-failure
3
- description: Debug Keel agent command or validation failures under Keel's selected OpenSpec task contract. Use when `/opsx:apply` or a selected task reports failed commands, failing tests, validation errors, retry-fuse decisions, or needs an evidence-bound failure report.
3
+ description: Debug Keel agent command or validation failures under Keel's selected OpenSpec task contract. Use when `/opsx:apply` or a selected task reports failed commands, failing tests, validation errors, stop decisions, or needs an evidence-bound failure report.
4
4
  ---
5
5
 
6
6
  # keel-debug-failure
7
7
  ## Purpose
8
8
 
9
- Use this skill when a command or validation path fails. Keep the investigation tied to the selected OpenSpec task. This skill owns the retry fuse, the task-contract binding, checkout preservation, and the failure-report shape; generic diagnosis mechanics (how to reproduce, minimise, or instrument) belong to the host runtime and are not restated here.
9
+ Use this skill when a command or validation path fails. Keep the investigation tied to the selected OpenSpec task. This skill owns when to stop, the task-contract binding, checkout preservation, and the failure-report shape; generic diagnosis mechanics (how to reproduce, minimise, or instrument) belong to the host runtime and are not restated here.
10
10
 
11
11
  ## Context to read
12
12
 
@@ -14,15 +14,15 @@ Read the selected OpenSpec task's Commands, Acceptance, Coupling, Candidate Boun
14
14
 
15
15
  ## Domain lenses
16
16
 
17
- When the change's artifacts or the failing surface signal a domain, consult the matching lens's `Execution and review checks` section from `keel/lenses/` — the lens whose `Applies when:` header matches — before locking a root-cause hypothesis, and load only that one. When no lens matches, load nothing.
17
+ When the change's artifacts or the failing surface signal a domain, consult the matching lens's `Execution and review checks` section from `keel/lenses/` — the lens whose `Applies when:` header matches — before locking a root-cause hypothesis. When no lens matches, load nothing.
18
18
 
19
- ## Fuse
19
+ ## Stopping
20
20
 
21
- Try the same failure at most 2 attempts. If it still fails, stop and report the original key error plus what changed during each attempt.
21
+ There is no fixed attempt count: keep going while each attempt adds evidence, and stop when one does not. When you stop, report the original key error plus what changed during each attempt.
22
22
 
23
- For `Coupling: required`, an allowed provisional failure inside a candidate does
24
- not count as an attempt. Count one attempt only when the same final assertion
25
- fails at the candidate completion gate. Follow the task's immediate task-stop
23
+ For `Coupling: required`, an allowed provisional failure inside a candidate is
24
+ not a failed attempt; what counts is the same final assertion failing at the
25
+ candidate completion gate. Follow the task's immediate task-stop
26
26
  rules for scope breach, missing design authority, non-reproducible evidence,
27
27
  or a baseline or acceptance change during a candidate.
28
28
 
@@ -11,7 +11,7 @@ Use this skill only when `keel context` is ambiguous or blocked because human in
11
11
 
12
12
  ## Context to read
13
13
 
14
- Run `keel context --json`, then read only the returned paths and the intended durable OpenSpec owner under `openspec/changes/<change>/`.
14
+ Run `keel context --json`, then read the returned paths and the intended durable OpenSpec owner under `openspec/changes/<change>/`.
15
15
 
16
16
  ## Override contract
17
17
 
@@ -53,7 +53,7 @@ The Review remains in tasks.md. A user-facing Report summarizes delivery but is
53
53
 
54
54
  ## Domain lenses
55
55
 
56
- When the change's artifacts or Touch extensions signal a domain, consult the matching lens's `Execution and review checks` section from `keel/lenses/` — the lens whose `Applies when:` header matches — before concluding the review, and load only that one. When no lens matches, load nothing.
56
+ When the change's artifacts or Touch extensions signal a domain, consult the matching lens's `Execution and review checks` section from `keel/lenses/` — the lens whose `Applies when:` header matches — before concluding the review. When no lens matches, load nothing.
57
57
 
58
58
  ## Expectation and follow-up ownership
59
59
 
@@ -14,7 +14,7 @@ Read the selected task's compiled capsule: resolved Acceptance, Verify strategy
14
14
 
15
15
  ## Strategy selection
16
16
 
17
- `Verify` names one supported strategy chosen at authoring time as the least-cost proof of the resolved Acceptance:
17
+ `Verify` names one supported strategy chosen at authoring time as the least-cost proof of the resolved Acceptance. Choose it by what would make the Acceptance false: the task's size, its apparent risk, the model executing it, and the cost of running a red do not choose it. Read `guidance.md` beside this file before choosing, unless `keel/config.yaml` declares `executor_tier: high` — it holds a selection table, right and wrong choices, and when each evidence form pays. Every criterion is here, so an absent or unreadable declaration costs a read and nothing else.
18
18
 
19
19
  - `vertical-tdd`: new independently testable deterministic behavior; one check red then green at a time.
20
20
  - `regression-first`: an observable defect; reproduce it through the public interface first, then prove the fix with the same check.
@@ -27,11 +27,17 @@ Red-green strategies (`vertical-tdd`, `regression-first`) must record concrete p
27
27
 
28
28
  A check's `Fails with:` declares one literal its red must show. Declare one that every red of the check shares — the scenario or test label the check prints, a stable message prefix — rather than one exception type: a first red is often mixed, mostly one error with a few others, and a literal only some of them carry forces a re-record that predicts nothing new.
29
29
 
30
+ A check's `Detects:` names, as two inline-code literals joined by `->`, a mutation that puts a defect in and the failure it must produce; `keel gate task-complete` requires that failure literal in the check's `.detects` Evidence. It answers what a red cannot — a red shows the feature was absent, not that the check notices it broken — and a `(regression)` check, which has no red, may carry one. Keel neither runs nor judges the mutation.
31
+
32
+ A check's `Measured:` names one inline-code literal that `keel gate task-complete` requires in the check's own `M<n>` Evidence, binding a number to the output it came from. A number nobody declared is not checked.
33
+
34
+ A `(regression)` check asserts that something already green stays green; it owes bare Evidence and no `.red`/`.green`, and a red-green strategy keeps at least one untagged check. Its Evidence may read `deferred to C<n>`, naming a check declared once under `## Change Verify` and recorded under `## Change Evidence` before the change closes.
35
+
30
36
  A check's Evidence may read `artifact <path> sha256:<digest>` instead of retelling the output. `keel gate task-complete` checks the file exists and the digest matches, and refuses a path outside the change's own directory — archiving moves that directory, so a pointer outside it breaks. Keel hashes the bytes and reads nothing inside them: the claim the artifact supports stays yours.
31
37
 
32
38
  ## Domain lenses
33
39
 
34
- When the change's proposal/design/specs or the task's Touch extensions signal a domain, consult the matching lens's `Execution and review checks` section from `keel/lenses/` — the lens whose `Applies when:` header matches — before finalizing the strategy and the first check, and load only that one. When no lens matches, load nothing.
40
+ When the change's proposal/design/specs or the task's Touch extensions signal a domain, consult the matching lens's `Execution and review checks` section from `keel/lenses/` — the lens whose `Applies when:` header matches — before finalizing the strategy and the first check. When no lens matches, load nothing.
35
41
 
36
42
  ## Coupled-task preflight
37
43
 
@@ -43,7 +49,7 @@ and design disagree, stop and report the gap; do not infer the missing decision.
43
49
 
44
50
  ## TASK boundary
45
51
 
46
- Align every test or check with the selected OpenSpec task's acceptance criteria or verification evidence. Prove behavior through the public interface: evidence that only shows build success or internal shape does not satisfy a behavioral Acceptance, and mocking your own modules invalidates the proof — mock only at true system boundaries.
52
+ Align every test or check with the selected OpenSpec task's acceptance criteria or verification evidence. Prove behavior through the public interface: evidence that only shows build success or internal shape does not satisfy a behavioral Acceptance, and mocking your own modules invalidates the proof — mock only at true system boundaries. A green shows the code matches the check; whether the check matches the Acceptance stays Review's to judge, and a red-green pass does not stand in for timing, CDC, reset, or security evidence a domain lens names.
47
53
 
48
54
  ## Standalone use
49
55
 
@@ -0,0 +1,77 @@
1
+ # keel-tdd-or-test-first — guidance
2
+
3
+ How to pick a strategy and which evidence form fits it. Every criterion is in `SKILL.md`; nothing here
4
+ decides whether a task may start, pass, or complete.
5
+
6
+ ## Choosing from the Acceptance
7
+
8
+ Read the resolved Acceptance and ask what observation would make it false. The answer names the
9
+ strategy:
10
+
11
+ | The Acceptance says… | Strategy | What the first check shows |
12
+ |---|---|---|
13
+ | a defect someone observed is gone | `regression-first` | the defect, reproduced through the public interface before the fix |
14
+ | a new behavior exists that a check can call | `vertical-tdd` | one behavior absent, then present; the next check starts once this one is green |
15
+ | a generated or deterministic output stays as it is | `characterization` | the current output captured, then compared byte for byte |
16
+ | a large or structured output stays as it is | `snapshot-characterization` | a stored snapshot, compared on every run |
17
+ | a measured result does not move — a refactor, a move, a flow upgrade | `equivalence` | the A/B against `Base:` on the declared `Fields:` |
18
+ | an interactive surface behaves | `rendered-behavior` | the real rendered interface, driven the way a user drives it |
19
+ | a document, configuration, or diagnosis exists and says something checkable | `evidence-first` | the artifact or finding itself, named precisely enough to be wrong |
20
+
21
+ Right choices:
22
+
23
+ - "`keel lock release` frees a lease even when its notice cannot be posted" — a release failed in
24
+ front of someone, so `regression-first`, and M1 replays that release.
25
+ - "`keel triage` admits an issue whose number is listed under `issues:`" — new behavior, so
26
+ `vertical-tdd`.
27
+ - "the README names the new flag" — `evidence-first`, with a check that searches the README for the
28
+ flag; there is no earlier state of it that a red would teach anything about.
29
+ - "the moved constraint file gives the same WNS, TNS, and cell count" — `equivalence` against the
30
+ commit before the move.
31
+
32
+ Wrong choices, and why:
33
+
34
+ - `evidence-first` for a new CLI option because a red is slow to run. The option is new behavior; a
35
+ slow red is a cost, and the strategy is about what can fail, not what it costs.
36
+ - `equivalence` for a change that also adds a scenario. New behavior is not unchanged behavior: the
37
+ added part goes in a sibling red-green task, and `equivalence` covers what is meant to stay put.
38
+ - A lighter strategy because the change looks low-risk. Risk sets how many checks are worth writing,
39
+ not whether the ones written can fail.
40
+ - A lighter strategy because a strong model is running the task. A strong executor produces
41
+ confident work; a check that can contradict it is worth more there, not less.
42
+
43
+ ## When a red adds information
44
+
45
+ A red tells you two things a green cannot: the check reaches the behavior at all, and the failure
46
+ it showed is the one the task exists to remove. Both matter most when the code and the check come
47
+ from the same reading of the requirement — a misreading shared by both passes green every time.
48
+
49
+ A red adds nothing when there is no honest one to show: a guard over behavior that is already
50
+ green, a version marker, an output fixed before the task. Those have their own forms below; a red
51
+ staged by breaking the code on purpose and then restoring it records the staging, not the check.
52
+
53
+ ## Which evidence form pays
54
+
55
+ - `Fails with:` — when the red's text is predictable. Declare a literal every red of the check
56
+ shares, such as the scenario label it prints.
57
+ - `Detects:` `mutation` -> `failure` — when a plausible wrong implementation exists that the check
58
+ might not notice: an off-by-one at a boundary, a swapped condition, a guard that reads the wrong
59
+ field. Apply the mutation by hand, run the check, record the failure as `M<n>.detects`, and revert.
60
+ It is the one form a `(regression)` check can use to show it is not vacuous.
61
+ - `Measured:` — when Evidence quotes a number someone will rely on: a count, a size, a timing, a
62
+ slack. The literal ties the number to the output it came from.
63
+ - `(regression)` with `deferred to C<n>` — when several tasks would each rerun the same full suite.
64
+ Declare it once under `## Change Verify` and record it once under `## Change Evidence`.
65
+ - `artifact <path> sha256:<digest>` — when the output is too long to retell. Keep the file inside
66
+ the change directory; the claim it supports is still written in the Evidence.
67
+
68
+ ## A hardware example
69
+
70
+ A synchronous FIFO gains simultaneous read and write at full and at empty. That is new behavior, so
71
+ `vertical-tdd`; the boundary check carries `Detects:` with the mutation "full is computed before the
72
+ read pointer advances" and the failure "the full-and-read case drops a word". A later rename of the
73
+ same FIFO's signals and a move of its pipeline register, keeping cycle behavior, is `equivalence`
74
+ against the commit before it, with the testbench transaction log as `Fields:`.
75
+
76
+ Neither proves timing closure, CDC, reset, or security properties. Those are separate evidence, and
77
+ a matching lens under `keel/lenses/` names them.
@@ -51,8 +51,8 @@ REQUIRED_SCRIPTS = [
51
51
  "scripts/validate_plugin.py",
52
52
  ]
53
53
 
54
- PACKAGE_VERSION = "5.170.0"
55
- PROTOCOL_VERSION = "5.170.0"
54
+ PACKAGE_VERSION = "5.172.0"
55
+ PROTOCOL_VERSION = "5.172.0"
56
56
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
57
57
  OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
58
58
  # Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
@@ -142,7 +142,8 @@ RESIDENT_BLOCKS = [
142
142
  # Touch and a `bound…` word in one statement. The other prose
143
143
  # entries stay literal until one of them needs the same freedom.
144
144
  re.compile(r"Touch\b[^\n]*\bbound", re.IGNORECASE),
145
- "read-only report/evidence",
145
+ # #414: subagents are the model's choice, treated as the main agent.
146
+ "treated as the main agent is",
146
147
  "native plugin",
147
148
  "keel --init",
148
149
  # Routing is the one durable rule with no gate behind it, so the
@@ -260,7 +261,7 @@ SKILL_DOC_REQUIREMENTS = [
260
261
  "required": [
261
262
  "Follow-ups are limited to directly observed blockers, risks, missing scope, or escalation needs",
262
263
  "Do not include roadmap suggestions, new feature suggestions, unrelated architecture critique, or opportunistic refactor suggestions",
263
- "same failure at most 2 attempts",
264
+ "There is no fixed attempt count",
264
265
  "## Context to read",
265
266
  "## Standalone use",
266
267
  "candidate completion gate",
@@ -770,8 +771,8 @@ def validate_openspec_schema(errors: list[str]) -> None:
770
771
  "Report",
771
772
  "Execution recommendation",
772
773
  "Autonomy boundary",
773
- "current Keel agent remains task owner and executor",
774
- "Keep task decisions in the current agent",
774
+ "A subagent is the model's choice and is treated as the main agent is",
775
+ "approved `tasks.md` in order",
775
776
  "Modify only files listed under Touch",
776
777
  "repository-wide read authority is read-only",
777
778
  "Out-of-scope Need",
@@ -10148,7 +10149,7 @@ def validate_expectation_completion_gates_scenario() -> int:
10148
10149
  "reason:",
10149
10150
  ]
10150
10151
  archive_overlay_snippets = [
10151
- "owns final sync/archive decisions",
10152
+ "keel gate change-close --action archive",
10152
10153
  "critical expectation",
10153
10154
  "behavior evidence",
10154
10155
  "durable follow-up owner",
@@ -10809,22 +10810,20 @@ def assert_openspec_overlay(path: Path, action: str) -> str | None:
10809
10810
  if content.count(OPENSPEC_SURFACE_OVERLAY_END) != 1:
10810
10811
  return f"{path} must contain exactly one Keel overlay end marker"
10811
10812
 
10813
+ # Since #414 the overlay says one neutral thing about subagents and assigns
10814
+ # no ownership; apply continues through an approved task list.
10812
10815
  required = [
10813
10816
  "Keel rules below take precedence",
10814
- "Target-native subagent gate",
10815
- "current agent remains",
10816
- "return report/evidence only",
10817
- "Keel ownership",
10817
+ "A subagent is the model's choice and is treated as the main agent is",
10818
10818
  ]
10819
10819
  if action == "apply":
10820
10820
  required.extend(
10821
10821
  [
10822
- "Keel task owner",
10822
+ "approved `tasks.md` in order",
10823
10823
  "Task Authoring Gate",
10824
10824
  "Slice Start Gate",
10825
10825
  "source expectations",
10826
10826
  "Rough future slices",
10827
- "cannot mark tasks complete",
10828
10827
  # A confirmation the owner already declared is routed to the
10829
10828
  # declaration; one they did not declare is still asked for, and
10830
10829
  # neither case touches the proof.
@@ -10836,12 +10835,12 @@ def assert_openspec_overlay(path: Path, action: str) -> str | None:
10836
10835
  else:
10837
10836
  required.extend(
10838
10837
  [
10839
- "owns final sync/archive decisions",
10838
+ "keel gate change-close --action archive",
10839
+ "keel-review-checklist",
10840
10840
  "critical expectation",
10841
10841
  "behavior evidence",
10842
10842
  "durable follow-up owner",
10843
10843
  "explicit discard reason",
10844
- "cannot archive, sync, change acceptance, or bypass completion gates",
10845
10844
  "standing-authorizes `archive`",
10846
10845
  "completion gate and follow-up ownership checks still run",
10847
10846
  ]
@@ -13930,10 +13929,9 @@ def validate_the_spec_names_the_managed_set_scenario() -> int:
13930
13929
  created. It is therefore the location most likely to drift and the one
13931
13930
  least likely to be noticed, which is why it is checked by name here.
13932
13931
 
13933
- Two named locations, not a scan. Three statements in the published specs
13934
- name a proper subset of the managed set and are correct — the doctor's
13935
- command-surface label, which excludes the authoring action on purpose;
13936
- `sync/archive decisions`, which names what the current agent owns; and
13932
+ Two named locations, not a scan. Statements in the published specs name a
13933
+ proper subset of the managed set and are correct — the doctor's
13934
+ command-surface label, which excludes the authoring action on purpose, and
13937
13935
  `authoring/apply/archive/sync`, which spells `propose` as authoring. A
13938
13936
  check that refused those would cost more than the drift it catches.
13939
13937
  """
@@ -14057,11 +14055,14 @@ def validate_the_spec_names_the_managed_set_scenario() -> int:
14057
14055
  "move with it rather than be dropped."
14058
14056
  )
14059
14057
  return 1
14060
- if "sync/archive decisions" not in published:
14058
+ # `sync/archive decisions` left the overlay spec with the ownership
14059
+ # requirements (#414); `authoring/apply/archive/sync` is the correct subset
14060
+ # spelling that remains in it.
14061
+ if "authoring/apply/archive/sync" not in published:
14061
14062
  report(
14062
- f"{label}: the overlay spec no longer carries `sync/archive "
14063
- "decisions`, the third correct subset spelling this check must "
14064
- "not refuse."
14063
+ f"{label}: the overlay spec no longer carries "
14064
+ "`authoring/apply/archive/sync`, the correct subset spelling this "
14065
+ "check must not refuse."
14065
14066
  )
14066
14067
  return 1
14067
14068
 
@@ -23847,7 +23848,8 @@ SESSION_START_DISCLOSURE = "to the user in your first reply"
23847
23848
  RESIDENT_SESSION_START_REQUIRED = (
23848
23849
  SESSION_START_DISCLOSURE,
23849
23850
  "keel context",
23850
- "never infer continuity from native memory",
23851
+ # #414: memory and transcripts may inform; `keel context` still decides.
23852
+ "`keel context` decides the current task",
23851
23853
  )
23852
23854
 
23853
23855
 
@@ -29686,14 +29688,14 @@ def validate_delegation_resident_text_scenario() -> int:
29686
29688
  def flat(path: Path) -> str:
29687
29689
  return re.sub(r"\s+", " ", path.read_text(encoding="utf-8"))
29688
29690
 
29689
- # M1 — the resident protocol carries the condition and the model limit.
29691
+ # M1 — the resident protocol carries the subagent rule and the model limit.
29692
+ # Since #414 a subagent is the model's choice and is treated as the main
29693
+ # agent is; the gates and the Touch guard are what bind it.
29690
29694
  agents = ROOT / "AGENTS.md"
29691
29695
  text = flat(agents)
29692
29696
  for needle in (
29693
- "implementation delegates use the selected task write authority inside",
29694
- "a guard manifest is active",
29695
- "re-runs each",
29696
- "check itself before recording Evidence",
29697
+ "is the model's choice and is treated as the main agent is",
29698
+ "the evidence rules apply to whoever runs a step",
29697
29699
  "never a model name",
29698
29700
  "declared rather than inferred from a task's size",
29699
29701
  ):
@@ -29701,18 +29703,19 @@ def validate_delegation_resident_text_scenario() -> int:
29701
29703
  report(f"delegation-resident-text: AGENTS.md omits: {needle}")
29702
29704
  return 1
29703
29705
 
29704
- # M1 — the consumer bootstrap deliberately does NOT carry the delegation
29705
- # clause. Its block has a byte budget (BOOTSTRAP_BLOCK_BYTE_BUDGET) with
29706
- # little headroom, and delegation is inert until declared, so an installing
29707
- # repository that declares nothing is fully served by the sentence already
29708
- # there. What the check enforces is that the sentence stays true by default,
29709
- # and that the budget is not quietly spent later — the budget moved once, in
29710
- # 5.63.0 for the routing rule (#131), with the argument recorded at the
29711
- # constant; a raise with no reason beside it is the drift this guards.
29706
+ # M1 — the consumer bootstrap carries the subagent sentence, not the
29707
+ # delegation clause. Its block has a byte budget (BOOTSTRAP_BLOCK_BYTE_BUDGET)
29708
+ # with little headroom, and delegation is inert until declared, so an
29709
+ # installing repository that declares nothing is fully served by the
29710
+ # sentence already there. What the check enforces is that the sentence stays
29711
+ # true by default, and that the budget is not quietly spent later — the
29712
+ # budget moved once, in 5.63.0 for the routing rule (#131), with the argument
29713
+ # recorded at the constant; a raise with no reason beside it is the drift
29714
+ # this guards.
29712
29715
  bootstrap = ROOT / "assets/bootstrap/AGENTS.md"
29713
29716
  boot = flat(bootstrap)
29714
- if re.sub(r"\s+", " ", "One agent owns decisions") not in boot:
29715
- report("delegation-resident-text: the bootstrap lost its single-writer default.")
29717
+ if re.sub(r"\s+", " ", "is the model's choice and is treated as the main agent is") not in boot:
29718
+ report("delegation-resident-text: the bootstrap lost its subagent sentence.")
29716
29719
  return 1
29717
29720
  block = bootstrap.read_text(encoding="utf-8")
29718
29721
  body = block.split("<!-- keel:start", 1)[1].split("<!-- keel:end -->", 1)[0]
@@ -29796,16 +29799,13 @@ def validate_delegation_overlay_scenario() -> int:
29796
29799
  report(f"delegation-overlay: missing generated surface {path.relative_to(ROOT)}")
29797
29800
  return 1
29798
29801
 
29799
- # M1 — the gate states the delegate's condition, its boundary, and what
29800
- # its results are worth. Asserted on every generated copy, because the
29801
- # overlay is what a subagent on that surface actually reads.
29802
+ # M1 — the surface says what binds a subagent and nothing else (#414): it
29803
+ # is the model's choice and is treated as the main agent is. Asserted on
29804
+ # every generated copy, because the overlay is what a subagent on that
29805
+ # surface actually reads.
29802
29806
  needles = (
29803
- "using existing task write authority",
29804
- "a guard manifest is active",
29805
- "only inside `Touch`",
29806
- "re-runs each `M<n>` check itself before recording Evidence",
29807
- "Delegation is refused with no active guard manifest",
29808
- "may mark tasks complete",
29807
+ "A subagent is the model's choice and is treated as the main agent is",
29808
+ "the `Touch` write guard, and the evidence rules apply to whoever runs a step",
29809
29809
  )
29810
29810
  for path in generated:
29811
29811
  text = re.sub(r"\s+", " ", path.read_text(encoding="utf-8"))
@@ -29822,6 +29822,8 @@ def validate_delegation_overlay_scenario() -> int:
29822
29822
  for stale in (
29823
29823
  "Target-native subagents return report/evidence only; the current agent reviews the output before acting.",
29824
29824
  "Target-native subagents return report/evidence only; they cannot mark tasks complete",
29825
+ "Delegation is refused with no active guard manifest",
29826
+ "re-runs each `M<n>` check itself before recording Evidence",
29825
29827
  ):
29826
29828
  if re.sub(r"\s+", " ", stale) in text:
29827
29829
  report(f"delegation-overlay: {path.relative_to(ROOT)} still carries an unconditional sentence: {stale[:60]}")
@@ -31613,9 +31615,11 @@ def validate_continuation_docs_scenario() -> int:
31613
31615
  return 1
31614
31616
 
31615
31617
  readme = (ROOT / "README.md").read_text(encoding="utf-8")
31618
+ # Since #414 crossing the boundary needs no confirmation by default, and the
31619
+ # README says so where it names the word.
31616
31620
  for needle in (
31617
31621
  "next unchecked task of the same change",
31618
- "the stop that re-asks for an approval already given",
31622
+ "needs no confirmation by default",
31619
31623
  ):
31620
31624
  if needle not in readme:
31621
31625
  report(f"{label}: README.md lacks: {needle}")
@@ -31665,8 +31669,8 @@ def validate_continuation_docs_scenario() -> int:
31665
31669
  return 1
31666
31670
  section = parts[1].split("\n## ", 1)[0]
31667
31671
  for needle in (
31668
- "standing `continuation` authorization",
31669
- "next unchecked task of the same change",
31672
+ "declared `continuation` is accepted and changes nothing",
31673
+ "next unchecked task of the same approved change needs no confirmation",
31670
31674
  "its own recorded fingerprint",
31671
31675
  ):
31672
31676
  if needle not in section:
@@ -34823,7 +34827,7 @@ def validate_domain_execution_references_scenario() -> int:
34823
34827
  for needle in (
34824
34828
  "keel/lenses/",
34825
34829
  "Execution and review checks",
34826
- "load only that one",
34830
+ "the lens whose `Applies when:` header matches",
34827
34831
  "no lens matches",
34828
34832
  ):
34829
34833
  if needle not in text:
@@ -41349,7 +41353,7 @@ def validate_guidance_is_referenced_and_carries_no_criterion_scenario() -> int:
41349
41353
  skills_root = ROOT / "src/skills"
41350
41354
  guidance_files = sorted(skills_root.glob("*/guidance.md"))
41351
41355
 
41352
- # D4 splits exactly one skill today. An empty glob would satisfy every loop
41356
+ # Two skills carry one today (#135, #389). An empty glob would satisfy every loop
41353
41357
  # below without reading anything, so the count is asserted first.
41354
41358
  if not guidance_files:
41355
41359
  report(
@@ -41447,6 +41451,147 @@ def validate_guidance_is_referenced_and_carries_no_criterion_scenario() -> int:
41447
41451
  return 0
41448
41452
 
41449
41453
 
41454
+ NATIVE_CAPABILITY_SUPPRESSIONS = (
41455
+ "unbounded subagent",
41456
+ "bounded helpers return read-only",
41457
+ "Implementation delegation is refused",
41458
+ "Delegation is refused with no active guard",
41459
+ "Target-native subagent gate",
41460
+ "One agent owns decisions",
41461
+ "may help with bounded assessment",
41462
+ "goal/task-view projection requires explicit authorization",
41463
+ "small contiguous task group",
41464
+ "in the current agent conversation",
41465
+ "inside the current agent session",
41466
+ "never infer continuity",
41467
+ "never native memory",
41468
+ "at most 2 attempts",
41469
+ "Read only the documents needed",
41470
+ "minimal read list",
41471
+ "load only that one",
41472
+ "do not load unrelated lenses",
41473
+ "read only the returned paths",
41474
+ )
41475
+ NATIVE_SUBAGENT_SENTENCE = "the model's choice and is treated as the main agent is"
41476
+ NATIVE_CONTINUATION_SENTENCE = "approved `tasks.md` in order"
41477
+
41478
+
41479
+ def validate_native_capabilities_unrestricted_scenario() -> int:
41480
+ """Issue #414: Keel neither suppresses nor steers the host's native capabilities.
41481
+
41482
+ The owner reviewed each sentence that told the model to stay in one session,
41483
+ take one task, keep subagents to a read-only role, read a minimal list, or
41484
+ stop after two attempts, and removed them. This holds every one of them out
41485
+ of every model-facing surface, and requires the two sentences that replaced
41486
+ the subagent and continuation rules where the agent reads them first.
41487
+ """
41488
+ label = "native-capabilities-unrestricted"
41489
+ surfaces = [
41490
+ ROOT / "AGENTS.md",
41491
+ ROOT / "assets/bootstrap/AGENTS.md",
41492
+ ROOT / "assets/openspec/schemas/keel-spec-driven/schema.yaml",
41493
+ ROOT / "openspec/schemas/keel-spec-driven/schema.yaml",
41494
+ ]
41495
+ for action in ("apply", "archive", "sync", "propose"):
41496
+ surfaces.append(ROOT / f".claude/commands/opsx/{action}.md")
41497
+ for name in ("apply-change", "archive-change", "sync-specs", "propose"):
41498
+ surfaces.append(ROOT / f".claude/skills/openspec-{name}/SKILL.md")
41499
+ surfaces.append(ROOT / f".codex/skills/openspec-{name}/SKILL.md")
41500
+ surfaces.extend(sorted((ROOT / "src/skills").glob("*/SKILL.md")))
41501
+ surfaces.extend(sorted((ROOT / PLUGIN_ROOT / "skills").glob("*/SKILL.md")))
41502
+ for surface in surfaces:
41503
+ if not surface.is_file():
41504
+ report(f"{label}: {surface.relative_to(ROOT)} is missing, so it cannot be checked.")
41505
+ return 1
41506
+ text = surface.read_text(encoding="utf-8")
41507
+ for phrase in NATIVE_CAPABILITY_SUPPRESSIONS:
41508
+ if phrase in text:
41509
+ report(f"{label}: {surface.relative_to(ROOT)} still says {phrase!r}.")
41510
+ return 1
41511
+ for first_read in (
41512
+ ROOT / "AGENTS.md",
41513
+ ROOT / "assets/bootstrap/AGENTS.md",
41514
+ ROOT / ".claude/commands/opsx/apply.md",
41515
+ ROOT / ".codex/skills/openspec-apply-change/SKILL.md",
41516
+ ):
41517
+ text = first_read.read_text(encoding="utf-8")
41518
+ if NATIVE_SUBAGENT_SENTENCE not in text:
41519
+ report(f"{label}: {first_read.relative_to(ROOT)} does not say a subagent is {NATIVE_SUBAGENT_SENTENCE!r}.")
41520
+ return 1
41521
+ if NATIVE_CONTINUATION_SENTENCE not in text:
41522
+ report(f"{label}: {first_read.relative_to(ROOT)} does not say the agent works through an {NATIVE_CONTINUATION_SENTENCE!r}.")
41523
+ return 1
41524
+ if label not in {name for name, _ in SCENARIOS}:
41525
+ report(f"{label}: the scenario registry does not include it.")
41526
+ return 1
41527
+ report(f"{label} scenario passed.")
41528
+ return 0
41529
+
41530
+
41531
+ def validate_tdd_strategy_guide_scenario() -> int:
41532
+ """Issue #389: the skill an executor loads to plan its checks says how to choose.
41533
+
41534
+ The strategy list is read from the parser, not repeated here, so a strategy
41535
+ added later without a selection row fails this scenario instead of passing
41536
+ a list that was never updated. The clauses are the ones the completion gate
41537
+ enforces; before #389 the skill named two of them and `AGENTS.md` the rest.
41538
+ """
41539
+ label = "tdd-strategy-guide"
41540
+ skill_dir = ROOT / "src/skills/keel-tdd-or-test-first"
41541
+ plugin_dir = ROOT / PLUGIN_ROOT / "skills/keel-tdd-or-test-first"
41542
+ guidance = skill_dir / "guidance.md"
41543
+ if not guidance.is_file():
41544
+ report(f"{label}: keel-tdd-or-test-first has no guidance.md beside its SKILL.md.")
41545
+ return 1
41546
+ contract = (ROOT / "src/core/task-contract.js").read_text(encoding="utf-8")
41547
+ declared = re.search(
41548
+ r"const SUPPORTED_VERIFICATION_STRATEGIES = \[(.*?)\];", contract, re.S
41549
+ )
41550
+ if not declared:
41551
+ report(f"{label}: SUPPORTED_VERIFICATION_STRATEGIES not found in task-contract.js.")
41552
+ return 1
41553
+ strategies = re.findall(r'^\s*"([a-z-]+)",', declared.group(1), re.M)
41554
+ if len(strategies) < 7:
41555
+ report(f"{label}: read {len(strategies)} strategies from the parser; expected at least 7.")
41556
+ return 1
41557
+ rows = [
41558
+ line for line in guidance.read_text(encoding="utf-8").splitlines()
41559
+ if line.startswith("|")
41560
+ ]
41561
+ for strategy in strategies:
41562
+ if not any(f"`{strategy}`" in row for row in rows):
41563
+ report(f"{label}: no selection row for {strategy} in the guidance table.")
41564
+ return 1
41565
+ body = (skill_dir / "SKILL.md").read_text(encoding="utf-8")
41566
+ for clause in (
41567
+ "Fails with:",
41568
+ "Detects:",
41569
+ "Measured:",
41570
+ "(regression)",
41571
+ "deferred to C",
41572
+ "artifact",
41573
+ ):
41574
+ if clause not in body:
41575
+ report(f"{label}: the skill body does not name {clause!r}.")
41576
+ return 1
41577
+ if "what would make" not in body:
41578
+ report(f"{label}: the skill body does not say a strategy is chosen by what would make the Acceptance false.")
41579
+ return 1
41580
+ for name in ("SKILL.md", "guidance.md"):
41581
+ shipped = plugin_dir / name
41582
+ if not shipped.is_file():
41583
+ report(f"{label}: the plugin has no keel-tdd-or-test-first/{name}.")
41584
+ return 1
41585
+ if shipped.read_bytes() != (skill_dir / name).read_bytes():
41586
+ report(f"{label}: the plugin's keel-tdd-or-test-first/{name} diverges from the canonical source.")
41587
+ return 1
41588
+ if label not in {name for name, _ in SCENARIOS}:
41589
+ report(f"{label}: the scenario registry does not include it.")
41590
+ return 1
41591
+ report(f"{label} scenario passed.")
41592
+ return 0
41593
+
41594
+
41450
41595
  def equivalence_task(
41451
41596
  *,
41452
41597
  base: str | None = "HEAD~1",
@@ -43523,6 +43668,8 @@ SCENARIOS: tuple = (
43523
43668
  "guidance-is-referenced-and-carries-no-criterion",
43524
43669
  validate_guidance_is_referenced_and_carries_no_criterion_scenario,
43525
43670
  ),
43671
+ ("tdd-strategy-guide", validate_tdd_strategy_guide_scenario),
43672
+ ("native-capabilities-unrestricted", validate_native_capabilities_unrestricted_scenario),
43526
43673
  (
43527
43674
  "a-tier-declares-what-is-skipped",
43528
43675
  validate_a_tier_declares_what_is_skipped_scenario,