@jesdi/skills 0.0.67 → 0.0.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/package.json +1 -1
  2. package/skills/implement-spec/ARCHITECTURE.md +5 -5
  3. package/skills/implement-spec/README.md +12 -12
  4. package/skills/implement-spec/SKILL.md +1 -1
  5. package/skills/implement-spec/driver_agents.py +3 -1
  6. package/skills/implement-spec/driver_final.py +38 -10
  7. package/skills/implement-spec/driver_fixloop.py +91 -17
  8. package/skills/implement-spec/driver_report.py +9 -1
  9. package/skills/implement-spec/driver_review.py +1 -0
  10. package/skills/implement-spec/driver_state.py +1 -1
  11. package/skills/implement-spec/driver_tickets.py +2 -0
  12. package/skills/implement-spec/models.json +1 -1
  13. package/skills/implement-spec/prompts/correctness.md +4 -2
  14. package/skills/implement-spec/prompts/final-fixer.md +4 -1
  15. package/skills/implement-spec/prompts/final-reviewer.md +7 -4
  16. package/skills/implement-spec/prompts/final-scoped.md +1 -1
  17. package/skills/implement-spec/prompts/rereview.md +1 -1
  18. package/skills/implement-spec/prompts/reviewer.md +5 -3
  19. package/skills/implement-spec/tests/test_cli.py +44 -0
  20. package/skills/implement-spec/tests/test_decisions.py +1 -39
  21. package/skills/implement-spec/tests/test_driver.py +2 -0
  22. package/skills/implement-spec/tests/test_final.py +54 -1
  23. package/skills/implement-spec/tests/test_fixloop.py +57 -39
  24. package/skills/implement-spec/tests/test_models.py +1 -1
  25. package/skills/implement-spec/tests/test_review.py +104 -20
  26. package/skills/implement-spec/tests/test_stops.py +10 -39
  27. package/skills/implement-spec/tests/test_walk.py +4 -4
  28. package/skills-manifest.json +3 -3
@@ -5,8 +5,8 @@ reviewer, correctness, fixer, conflict and a second test-writer call; a role it
5
5
 
6
6
  Interface choices (ticket 04):
7
7
  - the runner replaces the CLI, so a model entry is observed in the ledger: the line of a call names its role and entry.
8
- - a fix round runs the role `fixer` (report `fixer-<round>.json`) on the implementer's model list: entry 0 in rounds
9
- 1-2, entry 1 in rounds 3-4. `state.json` `round` counts fix rounds only. The review that follows round K writes
8
+ - a fix round runs the role `fixer` (report `fixer-<round>.json`) on the implementer's model list: entry 0 in round
9
+ 1, entry 1 in round 2. `state.json` `round` counts fix rounds only. The review that follows round K writes
10
10
  `reviewer-K.json` (the first review `reviewer-0.json`); a correctness pass writes `correctness-K.json`.
11
11
  - `mutations[].test` is `<locked file>::test_x`; a re-review prompt names each mutation proof to repeat as
12
12
  `<file>:<line>`, with the line number it has at the new tip.
@@ -164,6 +164,90 @@ def test_a_review_with_only_minor_findings_passes_and_writes_them_to_the_ledger(
164
164
  assert plain.led("M-ONE", "minor") and plain.led("M-TWO", "minor")
165
165
 
166
166
 
167
+ def test_unrelated_important_observation_waits_for_final_review(tmp_path):
168
+ rig = Review(tmp_path)
169
+ step = review("01")
170
+ step["report"]["observations"] = [finding("DUPLICATED-HELPER")]
171
+
172
+ rig.run(plan(**{"01/reviewer": [step]}))
173
+
174
+ assert rig.code == 0, rig.output()
175
+ assert not rig.calls("01", "fixer")
176
+ assert rig.state()["tickets"]["01"]["phase"] == "merged"
177
+ assert "DUPLICATED-HELPER" in rig.calls("final", "final-reviewer")[0]["prompt"]
178
+
179
+
180
+ def test_rereview_defers_newly_noticed_issue_outside_its_open_findings(tmp_path):
181
+ rig = Review(tmp_path)
182
+ steps = plan(**{"01/reviewer": [review("01", [finding("HEADER-MISSING")]),
183
+ review("01", [finding("PREEXISTING-NAME")])],
184
+ "01/fixer": [fix("01", 1)]})
185
+
186
+ rig.run(steps)
187
+
188
+ assert rig.code == 0, rig.output()
189
+ assert len(rig.calls("01", "fixer")) == 1
190
+ assert "PREEXISTING-NAME" in rig.calls("final", "final-reviewer")[0]["prompt"]
191
+
192
+
193
+ def test_rereview_can_open_a_regression_introduced_by_the_fix(tmp_path):
194
+ rig = Review(tmp_path)
195
+ after_first = review("01")
196
+ after_first["report"]["regressions"] = [finding("QUOTING-BROKEN")]
197
+ steps = plan(**{"01/reviewer": [review("01", [finding("HEADER-MISSING")]), after_first, review("01")],
198
+ "01/fixer": [fix("01", 1), fix("01", 2)]})
199
+
200
+ rig.run(steps)
201
+
202
+ assert rig.code == 0, rig.output()
203
+ assert len(rig.calls("01", "fixer")) == 2
204
+ assert "findings-1.json" in rig.calls("01", "fixer")[1]["prompt"]
205
+ assert "QUOTING-BROKEN" in (rig.folder() / "findings-1.json").read_text()
206
+
207
+
208
+ def test_unmet_criterion_blocks_after_two_fixes_while_independent_ticket_continues(tmp_path):
209
+ rig = Review(tmp_path, three(), {"implementer": [OPUS, FABLE]})
210
+ steps = plan(**{"01/reviewer": [review("01", [finding("HEADER-MISSING")])] * 3,
211
+ "01/fixer": [fix("01", 1), fix("01", 2)]})
212
+
213
+ rig.run(steps)
214
+
215
+ assert rig.code == 1, rig.output()
216
+ assert rig.state()["tickets"]["01"]["phase"] == "blocked"
217
+ assert rig.state()["tickets"]["03"]["phase"] == "merged"
218
+ assert len(rig.calls("01", "fixer")) == 2
219
+ assert rig.led("fixer", FABLE)
220
+ assert not rig.state()["run"]["questions"]
221
+
222
+
223
+ def test_new_criterion_failure_caused_by_first_fix_blocks_at_cap(tmp_path):
224
+ rig = Review(tmp_path, models={"implementer": [OPUS, FABLE]})
225
+ after_first = review("01")
226
+ after_first["report"]["regressions"] = [{**finding("FOOTER-MISSING"), "basis": "criterion"}]
227
+ steps = plan(**{"01/reviewer": [review("01", [finding("HEADER-MISSING")]), after_first,
228
+ review("01", [finding("FOOTER-MISSING")])],
229
+ "01/fixer": [fix("01", 1), fix("01", 2)]})
230
+
231
+ rig.run(steps)
232
+
233
+ assert rig.code == 1, rig.output()
234
+ assert rig.state()["tickets"]["01"]["phase"] == "blocked"
235
+ assert not rig.state()["run"]["final"]["must_fix"]
236
+
237
+
238
+ def test_red_gate_after_second_fix_blocks_the_ticket(tmp_path):
239
+ rig = Review(tmp_path, models={"implementer": [OPUS, FABLE]}, gate={"subjects": ["fix: 01 round 2"]})
240
+ steps = plan(**{"01/reviewer": [review("01", [finding("HEADER-MISSING")])] * 2,
241
+ "01/fixer": [fix("01", 1), fix("01", 2)]})
242
+
243
+ rig.run(steps)
244
+
245
+ assert rig.code == 1, rig.output()
246
+ assert rig.state()["tickets"]["01"]["phase"] == "blocked"
247
+ assert len(rig.calls("01", "fixer")) == 2
248
+ assert any(record["exit"] == 1 for record in rig.gates())
249
+
250
+
167
251
  # ---------------------------------------------------------------- fix loop
168
252
 
169
253
  STUCK = finding("STUCK")
@@ -171,29 +255,29 @@ STUCK = finding("STUCK")
171
255
 
172
256
  @pytest.fixture(scope="module")
173
257
  def escalated(tmp_path_factory):
174
- """One important finding survives the re-reviews after rounds 1 and 2; round 3 is clean."""
258
+ """One important finding survives round 1; round 2 on the next model closes it."""
175
259
  rig = Review(tmp_path_factory.mktemp("esc"), ONE, {"implementer": [OPUS, FABLE]})
176
260
  bad = review("01", [STUCK])
177
- return rig.run(plan(**{"01/reviewer": [bad, bad, bad, review("01")],
178
- "01/fixer": [fix("01", n) for n in (1, 2, 3)]}))
261
+ return rig.run(plan(**{"01/reviewer": [bad, bad, review("01")],
262
+ "01/fixer": [fix("01", n) for n in (1, 2)]}))
179
263
 
180
264
 
181
- def test_round_3_starts_a_fresh_implementer_on_the_next_model(escalated):
265
+ def test_round_2_starts_a_fresh_implementer_on_the_next_model(escalated):
182
266
  assert escalated.code == 0, escalated.output()
183
- assert escalated.led("01 round 3: escalated to claude-fable-5-1@high")
184
- assert not escalated.led("round 1: escalated") and not escalated.led("round 2: escalated")
185
- assert len(escalated.led("fixer", OPUS)) == 2 and len(escalated.led("fixer", FABLE)) == 1
186
- assert escalated.state()["tickets"]["01"]["round"] == 3
267
+ assert escalated.led("01 round 2: escalated to claude-fable-5-1@high")
268
+ assert not escalated.led("round 1: escalated")
269
+ assert len(escalated.led("fixer", OPUS)) == 1 and len(escalated.led("fixer", FABLE)) == 1
270
+ assert escalated.state()["tickets"]["01"]["round"] == 2
187
271
 
188
272
 
189
273
  def test_each_round_ends_with_one_gate_record_and_a_re_review_scoped_to_the_fix(escalated):
190
274
  tips = [escalated.sha("01", "implementer")] + [c["sha"] for c in escalated.calls("01", "fixer")]
191
275
  commits = [g["commit"] for g in escalated.gates()]
192
- assert len(tips) == 4 and all(commits.count(t) == 1 for t in tips), commits
276
+ assert len(tips) == 3 and all(commits.count(t) == 1 for t in tips), commits
193
277
  assert all((escalated.folder() / f"gate-{t[:7]}.log").exists() for t in tips)
194
278
  reviews = escalated.calls("01", "reviewer")
195
- assert len(reviews) == 4
196
- for k in (1, 2, 3):
279
+ assert len(reviews) == 3
280
+ for k in (1, 2):
197
281
  assert tips[k - 1][:7] in reviews[k]["prompt"] and tips[k][:7] in reviews[k]["prompt"], k
198
282
 
199
283
 
@@ -207,28 +291,28 @@ def gate_rule(prompt, gate):
207
291
  def test_the_implementer_and_each_fixer_get_the_gate_command_and_run_it_before_they_report(escalated):
208
292
  gate = str(escalated.rig / "gate")
209
293
  agents = escalated.calls("01", "implementer") + escalated.calls("01", "fixer")
210
- assert len(agents) == 4, "the implementer and the fixers of rounds 1, 2 and 3 (the next model)"
294
+ assert len(agents) == 3, "the implementer and the fixers of rounds 1 and 2 (the next model)"
211
295
  for call in agents:
212
296
  gate_rule(call["prompt"], gate)
213
297
 
214
298
 
215
299
  def test_reports_are_named_by_role_and_round(escalated):
216
- for name in ("reviewer-0", "reviewer-1", "reviewer-2", "reviewer-3", "fixer-1", "fixer-2", "fixer-3"):
300
+ for name in ("reviewer-0", "reviewer-1", "reviewer-2", "fixer-1", "fixer-2"):
217
301
  assert (escalated.folder() / f"{name}.json").exists(), name
218
302
 
219
303
 
220
304
  @pytest.fixture(scope="module")
221
305
  def capped(tmp_path_factory):
222
- """The three-ticket default; 01's reviewer keeps the same finding through round 4."""
306
+ """The three-ticket default; 01's reviewer keeps the same criterion finding through round 2."""
223
307
  rig = Review(tmp_path_factory.mktemp("cap"), three(), {"implementer": [OPUS, FABLE]})
224
- return rig.run(plan(**{"01/reviewer": [review("01", [STUCK])] * 5,
225
- "01/fixer": [fix("01", n) for n in (1, 2, 3, 4)]}))
308
+ return rig.run(plan(**{"01/reviewer": [review("01", [STUCK])] * 3,
309
+ "01/fixer": [fix("01", n) for n in (1, 2)]}))
226
310
 
227
311
 
228
- def test_a_finding_open_after_round_4_blocks_the_ticket_and_the_run_goes_on(capped):
312
+ def test_a_criterion_open_after_round_2_blocks_the_ticket_and_the_run_goes_on(capped):
229
313
  assert capped.code == 1, capped.output()
230
314
  assert capped.led("01", "BLOCKED", "STUCK")
231
- assert len(capped.calls("01", "fixer")) == 4 and len(capped.calls("01", "reviewer")) == 5
315
+ assert len(capped.calls("01", "fixer")) == 2 and len(capped.calls("01", "reviewer")) == 3
232
316
  assert not capped.calls("02"), "02 is blocked by 01"
233
317
  assert capped.state()["tickets"]["01"]["phase"] == "blocked"
234
318
  assert capped.state()["tickets"]["03"]["phase"] == "merged" and "feat: 03 rows" in capped.pr_subjects()
@@ -11,8 +11,8 @@ Interface choices (ticket 05):
11
11
  - evidence strings are file pointers: `.agent/implement/<NN>/implementer.json` and `.agent/implement/ledger.md:<line>`,
12
12
  the line being a ledger line that names the ticket and BLOCKED.
13
13
  - question ids are `<NN>-locked-test-<n>` with n counting per run (the first is 1, a second stop on the ticket is 2),
14
- and `<NN>-finding-<n>` for an open finding after round 4. Options: `overrule-test` / `overrule-implementer`
15
- (recommended: overrule-implementer), and `accept` / `split` / `redesign`.
14
+ and a capped ticket with unmet criteria blocks without a finding question. Options for `locked-test` are
15
+ `overrule-test` / `overrule-implementer` (recommended: overrule-implementer).
16
16
  - an implementer is BLOCKED with a `locked-test` stop only when a `concerns` entry starts with "locked test
17
17
  contradicts spec:"; any other BLOCKED report is an `implementer-stopped` stop (issue #123).
18
18
  - the answers file is `.agent/implement-answers.json` in the schema.md shape: `v`, `stage: "implement"`, `submitted`
@@ -201,45 +201,16 @@ def test_a_blocked_report_that_is_not_a_contradicted_locked_test_is_an_implement
201
201
  assert rig.state()["tickets"]["01"]["phase"] == "blocked"
202
202
 
203
203
 
204
- # ---------------------------------------------------------------- open findings after round 4
204
+ # ---------------------------------------------------------------- capped ticket
205
205
 
206
- A, B = finding("STUCK-A", line=98), finding("STUCK-B", line=99)
207
-
208
-
209
- def round4(tmp, *extra):
210
- rig = Review(tmp)
211
- bad = review("01", [A, B])
212
- return rig.run(plan(**{"01/reviewer": [bad] * 5, "01/fixer": [fix("01", n) for n in (1, 2, 3, 4)]}), *extra)
213
-
214
-
215
- def finding_ids(rig):
216
- questions = decisions(rig)["questions"]
217
- return {name: next(q["id"] for q in questions if name in q["title"] + q["why"]) for name in ("STUCK-A", "STUCK-B")}
218
-
219
-
220
- def test_open_findings_after_round_4_make_one_question_each_and_accept_closes_them(tmp_path):
221
- rig = round4(tmp_path)
222
- assert rig.code == 1, rig.output()
223
- questions = decisions(rig)["questions"]
224
- assert len(questions) == 2 and rig.state()["tickets"]["01"]["phase"] == "blocked"
225
- assert all({o["id"] for o in q["options"]} == {"accept", "split", "redesign"} for q in questions)
226
- check_page((rig.repo / ".agent/implement-review.html").read_text(), decisions(rig))
227
- ids = finding_ids(rig)
228
- rig.run({}, "--answer", f"{ids['STUCK-A']}=accept", "--answer", f"{ids['STUCK-B']}=accept")
229
- assert rig.code == 0, rig.output()
230
- assert rig.led("Ruling", "STUCK-A", "accept") and rig.led("Ruling", "STUCK-B", "accept")
231
- assert rig.state()["tickets"]["01"]["phase"] == "merged" and "feat: 01 rows" in rig.pr_subjects()
232
- assert len(rig.calls("01", "fixer")) == 4
233
-
234
-
235
- def test_split_and_redesign_keep_the_ticket_blocked_with_the_ruling(tmp_path):
236
- rig = round4(tmp_path)
237
- ids = finding_ids(rig)
238
- rig.run({}, "--answer", f"{ids['STUCK-A']}=split", "--answer", f"{ids['STUCK-B']}=redesign")
206
+ def test_unmet_criteria_at_cap_block_without_a_finding_question(tmp_path):
207
+ rig = Review(tmp_path)
208
+ bad = review("01", [finding("STUCK-A", line=98), finding("STUCK-B", line=99)])
209
+ rig.run(plan(**{"01/reviewer": [bad] * 3, "01/fixer": [fix("01", n) for n in (1, 2)]}))
239
210
  assert rig.code == 1, rig.output()
240
- assert rig.led("Ruling", "STUCK-A", "split") and rig.led("Ruling", "STUCK-B", "redesign")
241
- assert rig.state()["tickets"]["01"]["phase"] == "blocked" and "feat: 01 rows" not in rig.pr_subjects()
242
- assert len(rig.calls("01", "fixer")) == 4
211
+ assert rig.state()["tickets"]["01"]["phase"] == "blocked"
212
+ assert not rig.state()["run"]["questions"]
213
+ assert len(rig.calls("01", "fixer")) == 2
243
214
 
244
215
 
245
216
  # ---------------------------------------------------------------- unattended
@@ -271,8 +271,8 @@ def std(tmp_path_factory):
271
271
 
272
272
  @pytest.fixture(scope="module")
273
273
  def blocked(tmp_path_factory):
274
- """The default scenario with a red gate on ticket/feat%2Fcsv/01 that four fix rounds do not make green."""
275
- fixes = [fix("01", n) for n in (1, 2, 3, 4)]
274
+ """The default scenario with a red gate on ticket/feat%2Fcsv/01 that two fix rounds do not make green."""
275
+ fixes = [fix("01", n) for n in (1, 2)]
276
276
  return Rig(tmp_path_factory.mktemp("blocked"), gate={"red": ["ticket/feat%2Fcsv/01"]}).run(plan(**{"01/fixer": fixes}))
277
277
 
278
278
 
@@ -339,7 +339,7 @@ def test_gate_environment_names_the_pr_branch_and_a_pycache_prefix_under_agent_i
339
339
  assert os.path.realpath(gate["pycache"]).startswith(str((rig.repo / ".agent/implement").resolve()) + os.sep)
340
340
 
341
341
 
342
- def test_red_gate_blocks_the_ticket_after_round_4_names_the_record_and_launches_no_review(blocked):
342
+ def test_red_gate_blocks_the_ticket_after_round_2_names_the_record_and_launches_no_review(blocked):
343
343
  assert blocked.code == 1, blocked.output()
344
344
  a1 = blocked.sha("01", "implementer")
345
345
  finding = f"Ticket 01: critical finding of kind code from the gate at .agent/implement/01/gate-{a1[:7]}.log:0: "
@@ -347,7 +347,7 @@ def test_red_gate_blocks_the_ticket_after_round_4_names_the_record_and_launches_
347
347
  assert re.search(r"exit\D*1", (blocked.repo / f".agent/implement/01/gate-{a1[:7]}.log").read_text())
348
348
  last = blocked.calls("01", "fixer")[-1]["sha"]
349
349
  assert [l for l in blocked.ledger() if "01" in l and "BLOCKED" in l and f"gate-{last[:7]}.log" in l], blocked.ledger()
350
- assert [c["role"] for c in blocked.calls("01")] == ["test-writer", "implementer"] + ["fixer"] * 4
350
+ assert [c["role"] for c in blocked.calls("01")] == ["test-writer", "implementer"] + ["fixer"] * 2
351
351
  assert blocked.state()["tickets"]["01"]["phase"] == "blocked"
352
352
  assert "ticket/feat%2Fcsv/01" in blocked.branches() and "feat: 01 rows" not in blocked.pr_subjects()
353
353
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-10-27T14:34:07.257Z",
3
+ "generatedAt": "2026-10-28T10:05:57.289Z",
4
4
  "skills": [
5
5
  {
6
6
  "name": "agents-wayfinder",
@@ -58,8 +58,8 @@
58
58
  },
59
59
  {
60
60
  "name": "implement-spec",
61
- "version": "0.1.41",
62
- "hash": "sha256-f3752a9867215a59270a63d59d62922d7b312fd1f3a3c63c09c256fa84ce31a8",
61
+ "version": "0.1.43",
62
+ "hash": "sha256-9e15bd7b59af1ddf79e6383af92a2b7d579a54c9f861b8b8300f73e31d82c72d",
63
63
  "description": "Implement a specification in code."
64
64
  },
65
65
  {