@christang/keel 5.170.0 → 5.171.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.171.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
@@ -491,8 +491,11 @@ the words Keel states criteria in, so a tier can only ever skip a file that deci
491
491
  what to skip is a declaration rather than the agent's own call on purpose — "do I need this help?" is
492
492
  the judgement a weak executor gets most wrong, and it would be answering it about itself.
493
493
 
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.
494
+ Two skills carry a guidance file today. `keel-run-single-task-goal` was split, and its body is 11%
495
+ smaller for it. `keel-tdd-or-test-first` gained one rather than lost prose to it: a table that picks
496
+ a Verify strategy by what would make the Acceptance false, with right and wrong choices and when each
497
+ evidence form pays (#389). The other four are almost entirely criteria, so splitting them would move
498
+ the half that has to stay.
496
499
 
497
500
  ## How the agent uses these
498
501
 
@@ -1,4 +1,4 @@
1
- <!-- keel:start version=5.170.0 -->
1
+ <!-- keel:start version=5.171.0 -->
2
2
  ## Keel Bootstrap
3
3
 
4
4
  - Start every session with `keel context`; OpenSpec artifacts and Git are the only durable authority — never native memory, goals, or transcripts.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@christang/keel",
3
- "version": "5.170.0",
3
+ "version": "5.171.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.171.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.171.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.171.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.171.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",
@@ -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,6 +27,12 @@ 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
@@ -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.171.0"
55
+ PROTOCOL_VERSION = "5.171.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
@@ -41349,7 +41349,7 @@ def validate_guidance_is_referenced_and_carries_no_criterion_scenario() -> int:
41349
41349
  skills_root = ROOT / "src/skills"
41350
41350
  guidance_files = sorted(skills_root.glob("*/guidance.md"))
41351
41351
 
41352
- # D4 splits exactly one skill today. An empty glob would satisfy every loop
41352
+ # Two skills carry one today (#135, #389). An empty glob would satisfy every loop
41353
41353
  # below without reading anything, so the count is asserted first.
41354
41354
  if not guidance_files:
41355
41355
  report(
@@ -41447,6 +41447,70 @@ def validate_guidance_is_referenced_and_carries_no_criterion_scenario() -> int:
41447
41447
  return 0
41448
41448
 
41449
41449
 
41450
+ def validate_tdd_strategy_guide_scenario() -> int:
41451
+ """Issue #389: the skill an executor loads to plan its checks says how to choose.
41452
+
41453
+ The strategy list is read from the parser, not repeated here, so a strategy
41454
+ added later without a selection row fails this scenario instead of passing
41455
+ a list that was never updated. The clauses are the ones the completion gate
41456
+ enforces; before #389 the skill named two of them and `AGENTS.md` the rest.
41457
+ """
41458
+ label = "tdd-strategy-guide"
41459
+ skill_dir = ROOT / "src/skills/keel-tdd-or-test-first"
41460
+ plugin_dir = ROOT / PLUGIN_ROOT / "skills/keel-tdd-or-test-first"
41461
+ guidance = skill_dir / "guidance.md"
41462
+ if not guidance.is_file():
41463
+ report(f"{label}: keel-tdd-or-test-first has no guidance.md beside its SKILL.md.")
41464
+ return 1
41465
+ contract = (ROOT / "src/core/task-contract.js").read_text(encoding="utf-8")
41466
+ declared = re.search(
41467
+ r"const SUPPORTED_VERIFICATION_STRATEGIES = \[(.*?)\];", contract, re.S
41468
+ )
41469
+ if not declared:
41470
+ report(f"{label}: SUPPORTED_VERIFICATION_STRATEGIES not found in task-contract.js.")
41471
+ return 1
41472
+ strategies = re.findall(r'^\s*"([a-z-]+)",', declared.group(1), re.M)
41473
+ if len(strategies) < 7:
41474
+ report(f"{label}: read {len(strategies)} strategies from the parser; expected at least 7.")
41475
+ return 1
41476
+ rows = [
41477
+ line for line in guidance.read_text(encoding="utf-8").splitlines()
41478
+ if line.startswith("|")
41479
+ ]
41480
+ for strategy in strategies:
41481
+ if not any(f"`{strategy}`" in row for row in rows):
41482
+ report(f"{label}: no selection row for {strategy} in the guidance table.")
41483
+ return 1
41484
+ body = (skill_dir / "SKILL.md").read_text(encoding="utf-8")
41485
+ for clause in (
41486
+ "Fails with:",
41487
+ "Detects:",
41488
+ "Measured:",
41489
+ "(regression)",
41490
+ "deferred to C",
41491
+ "artifact",
41492
+ ):
41493
+ if clause not in body:
41494
+ report(f"{label}: the skill body does not name {clause!r}.")
41495
+ return 1
41496
+ if "what would make" not in body:
41497
+ report(f"{label}: the skill body does not say a strategy is chosen by what would make the Acceptance false.")
41498
+ return 1
41499
+ for name in ("SKILL.md", "guidance.md"):
41500
+ shipped = plugin_dir / name
41501
+ if not shipped.is_file():
41502
+ report(f"{label}: the plugin has no keel-tdd-or-test-first/{name}.")
41503
+ return 1
41504
+ if shipped.read_bytes() != (skill_dir / name).read_bytes():
41505
+ report(f"{label}: the plugin's keel-tdd-or-test-first/{name} diverges from the canonical source.")
41506
+ return 1
41507
+ if label not in {name for name, _ in SCENARIOS}:
41508
+ report(f"{label}: the scenario registry does not include it.")
41509
+ return 1
41510
+ report(f"{label} scenario passed.")
41511
+ return 0
41512
+
41513
+
41450
41514
  def equivalence_task(
41451
41515
  *,
41452
41516
  base: str | None = "HEAD~1",
@@ -43523,6 +43587,7 @@ SCENARIOS: tuple = (
43523
43587
  "guidance-is-referenced-and-carries-no-criterion",
43524
43588
  validate_guidance_is_referenced_and_carries_no_criterion_scenario,
43525
43589
  ),
43590
+ ("tdd-strategy-guide", validate_tdd_strategy_guide_scenario),
43526
43591
  (
43527
43592
  "a-tier-declares-what-is-skipped",
43528
43593
  validate_a_tier_declares_what_is_skipped_scenario,