@jesdi/skills 0.0.74 → 0.0.76

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 (35) hide show
  1. package/package.json +1 -1
  2. package/skills/implement-spec/README.md +27 -22
  3. package/skills/implement-spec/SKILL.md +1 -1
  4. package/skills/implement-spec/driver.py +75 -44
  5. package/skills/implement-spec/driver_final.py +60 -34
  6. package/skills/implement-spec/driver_fixloop.py +65 -17
  7. package/skills/implement-spec/driver_gate.py +25 -12
  8. package/skills/implement-spec/driver_legacy.py +19 -7
  9. package/skills/implement-spec/driver_merge.py +20 -2
  10. package/skills/implement-spec/driver_report.py +10 -3
  11. package/skills/implement-spec/driver_run.py +17 -13
  12. package/skills/implement-spec/driver_state.py +17 -7
  13. package/skills/implement-spec/driver_summary.py +1 -1
  14. package/skills/implement-spec/driver_tidy.py +2 -8
  15. package/skills/implement-spec/prompts/final-fixer.md +1 -1
  16. package/skills/implement-spec/prompts/final-reviewer.md +2 -2
  17. package/skills/implement-spec/prompts/fixer.md +1 -1
  18. package/skills/implement-spec/prompts/implementer.md +1 -1
  19. package/skills/implement-spec/prompts/landing-merge.md +1 -0
  20. package/skills/implement-spec/prompts/landing-red.md +2 -0
  21. package/skills/implement-spec/tests/test_agents.py +2 -2
  22. package/skills/implement-spec/tests/test_amendments.py +1 -1
  23. package/skills/implement-spec/tests/test_cli.py +4 -4
  24. package/skills/implement-spec/tests/test_driver.py +73 -30
  25. package/skills/implement-spec/tests/test_final.py +41 -7
  26. package/skills/implement-spec/tests/test_fixloop.py +172 -21
  27. package/skills/implement-spec/tests/test_landing.py +1 -1
  28. package/skills/implement-spec/tests/test_merge.py +8 -0
  29. package/skills/implement-spec/tests/test_report.py +2 -2
  30. package/skills/implement-spec/tests/test_review.py +16 -8
  31. package/skills/implement-spec/tests/test_state.py +6 -6
  32. package/skills/implement-spec/tests/test_summary.py +3 -2
  33. package/skills/implement-spec/tests/test_tidy.py +16 -13
  34. package/skills/implement-spec/tests/test_walk.py +55 -36
  35. package/skills-manifest.json +3 -3
@@ -1,15 +1,16 @@
1
1
  """Ticket 03 acceptance tests: walk the graph with slots, gate by the driver, merge, resume.
2
2
 
3
- All through `sh run.sh --runner <script> --parallel N [--prepare <cmd>] --gate <cmd>` on the three-ticket fixture
3
+ All through `sh run.sh --runner <script> --parallel N [--prepare <cmd>] --gate <cmd> --fast-gate <cmd>` on the
4
+ three-ticket fixture
4
5
  repository. The fake runner plays test-writer and implementer per ticket; it logs, per call, its cwd, branch, HEAD,
5
- start and end time into `<rig>/calls/`. The gate is a small script that logs its commit, status, branch and
6
- environment into `<rig>/gates/`. Concurrency is steered with signal files (`touch` / `wait` plan keys), never sleeps.
6
+ start and end time into `<rig>/calls/`. The gate is a small script that logs its tier, commit, status, branch and
7
+ environment into `<rig>/gates/`: both tiers run it, with `TIER=fast` or `TIER=full` in front. Concurrency is steered with signal files (`touch` / `wait` plan keys), never sleeps.
7
8
 
8
9
  Interface choices (ticket 03):
9
- - gate record: `.agent/implement/<NN>/gate-<first 7 hex of the commit>.log`.
10
+ - gate record: `.agent/implement/<NN>/gate-<tier>-<first 7 hex of the commit>.log`.
10
11
  - `summary.md` sits in `.agent/implement/` and its table is repeated on stdout.
11
12
  - `state.json` is `{"tickets": {"NN": {phase, round, tip, test_writer_sha, locked, green_gates, slot}}}`;
12
- `green_gates` holds full SHAs (a dict with a `commit` key is accepted too).
13
+ `green_gates` holds full SHAs per tier: `{"fast": [...], "full": [...]}`.
13
14
 
14
15
  Ticket 08: this fixture has no `origin`, and a run that merges every ticket now ends with the tidy, one gate on the
15
16
  tidied tip and the final review. The history as the walk made it is at `refs/implement-spec/feat%2Fcsv/recovery`: `Rig.walked()` is
@@ -103,9 +104,14 @@ conf = json.loads((rig / "gate.json").read_text())
103
104
  (rig / "gates").mkdir(exist_ok=True)
104
105
  branch = git("rev-parse", "--abbrev-ref", "HEAD")
105
106
  subject = git("log", "-1", "--format=%s")
106
- code = 1 if conf.get("all") or branch in conf.get("red", []) or subject in conf.get("subjects", []) else 0
107
- rec = dict(t0=time.time(), cwd=os.path.realpath(os.getcwd()), commit=git("rev-parse", "HEAD"), branch=branch,
108
- status=git("status", "--short"), base=os.environ.get("IMPLEMENT_SPEC_BASE"),
107
+ unbranched = branch == "HEAD" and not git("for-each-ref", "--points-at", "HEAD", "refs/heads") # a commit that no branch holds
108
+ tiered = conf.get(os.environ.get("TIER"), {{}}) # red on this tier only: the subject of HEAD, or of a merge's ticket side
109
+ merged = git("log", "-1", "--format=%s", "HEAD^2") if git("rev-parse", "-q", "--verify", "HEAD^2") else ""
110
+ code = 1 if (conf.get("all") or branch in conf.get("red", []) or subject in conf.get("subjects", [])
111
+ or (conf.get("unbranched") and unbranched)
112
+ or {{subject, merged}} & set(tiered.get("subjects", []))) else 0
113
+ rec = dict(t0=time.time(), tier=os.environ.get("TIER"), cwd=os.path.realpath(os.getcwd()), commit=git("rev-parse", "HEAD"), branch=branch,
114
+ status=git("status", "--short"), base=os.environ.get("IMPLEMENT_SPEC_BASE"), locked=os.environ.get("IMPLEMENT_SPEC_LOCKED"),
109
115
  pycache=os.environ.get("PYTHONPYCACHEPREFIX"), exit=code)
110
116
  print("GATE-OUTPUT-MARK", rec["commit"])
111
117
  (rig / "gates" / f"{{time.time_ns()}}-{{os.getpid()}}.json").write_text(json.dumps(rec))
@@ -159,7 +165,9 @@ def make_env(tmp):
159
165
  for cli in ("claude", "codex"):
160
166
  (bin_dir / cli).write_text("#!/bin/sh\nexit 1\n")
161
167
  (bin_dir / cli).chmod(0o755)
162
- return dict(os.environ, PATH=str(bin_dir))
168
+ # The driver's own commits are signed when commit.gpgsign is on: a test opts in, the operator's config does not.
169
+ return dict(os.environ, PATH=str(bin_dir), GIT_CONFIG_COUNT="1", GIT_CONFIG_KEY_0="commit.gpgsign",
170
+ GIT_CONFIG_VALUE_0="false")
163
171
 
164
172
 
165
173
  class Rig:
@@ -188,7 +196,8 @@ class Rig:
188
196
  def run(self, steps, *extra, parallel="2", watch=False):
189
197
  """Run the driver once; with `watch`, read state.json in a tight loop meanwhile (torn reads, snapshots)."""
190
198
  (self.rig / "plan.json").write_text(json.dumps(steps))
191
- args = ["--tickets", ".agent/tickets", "--gate", str(self.rig / "gate"), "--spec", "specs/csv/spec.md",
199
+ args = ["--tickets", ".agent/tickets", "--gate", f"TIER=full {self.rig / 'gate'}",
200
+ "--fast-gate", f"TIER=fast {self.rig / 'gate'}", "--spec", "specs/csv/spec.md",
192
201
  "--models", str(self.models), "--runner", str(self.rig / "run-agent"), "--parallel", parallel, *extra]
193
202
  out, err = self.tmp / "out.txt", self.tmp / "err.txt"
194
203
  with out.open("w") as o, err.open("w") as e:
@@ -220,10 +229,10 @@ class Rig:
220
229
  def sha(self, nn, role):
221
230
  return self.calls(nn, role)[0]["sha"]
222
231
 
223
- def gates(self):
232
+ def gates(self, tier=None):
224
233
  folder = self.rig / "gates"
225
234
  rows = [json.loads(p.read_text()) for p in folder.glob("*.json")] if folder.exists() else []
226
- return sorted(rows, key=lambda r: r["t0"])
235
+ return sorted([r for r in rows if tier in (None, r["tier"])], key=lambda r: r["t0"])
227
236
 
228
237
  def ledger(self):
229
238
  path = self.repo / ".agent/implement/ledger.md"
@@ -253,12 +262,9 @@ class Rig:
253
262
  return f"exit {self.code}\n{self.out}{self.err}"
254
263
 
255
264
 
256
- def commit_of(entry):
257
- return entry if isinstance(entry, str) else entry["commit"]
258
-
259
-
260
265
  def green(state, nn):
261
- return {commit_of(e) for e in state["tickets"][nn]["green_gates"]}
266
+ """The green gates of the ticket as (tier, commit) pairs."""
267
+ return {(tier, commit) for tier, commits in state["tickets"][nn]["green_gates"].items() for commit in commits}
262
268
 
263
269
 
264
270
  @pytest.fixture(scope="module")
@@ -317,36 +323,45 @@ def test_failing_prepare_exits_3_before_any_agent_naming_slot_and_command(tmp_pa
317
323
  assert not rig.calls() and not rig.gates()
318
324
 
319
325
 
320
- def test_fast_forward_merge_has_exactly_one_gate_record_and_no_merge_gate(tmp_path):
326
+ def test_a_fast_forward_merge_has_one_fast_and_one_full_record_of_the_ticket_tip(tmp_path):
321
327
  rig = Rig(tmp_path, {"01-export-rows.md": ticket("01", "Export rows")}).run(plan())
322
328
  assert rig.code == 0, rig.output()
323
329
  a1 = rig.sha("01", "implementer")
324
330
  assert rig.walked() == a1
325
331
  records = sorted((rig.repo / ".agent/implement/01").glob("gate-*.log"))
326
- assert [p.name for p in records] == [f"gate-{a1[:7]}.log"]
327
- text = records[0].read_text()
328
- assert a1[:7] in text and "GATE-OUTPUT-MARK" in text and len(re.findall(r"\d\d:\d\d:\d\d", text)) >= 2
329
- assert re.search(r"exit\D*0", text) and not re.search(r"^(\?\?| M|M |A )", text, re.M)
330
- (gate,) = rig.walk_gates()
331
- assert (gate["commit"], gate["status"], gate["cwd"]) == (a1, "", str(rig.repo.resolve()))
332
+ assert [p.name for p in records] == [f"gate-fast-{a1[:7]}.log", f"gate-full-{a1[:7]}.log"]
333
+ for tier, record in zip(("fast", "full"), records):
334
+ text = record.read_text()
335
+ assert f"tier: {tier}\ncommit: {a1}\n" in text and "GATE-OUTPUT-MARK" in text
336
+ assert len(re.findall(r"\d\d:\d\d:\d\d", text)) >= 2
337
+ assert re.search(r"exit\D*0", text) and not re.search(r"^(\?\?| M|M |A )", text, re.M)
338
+ fast, full = rig.walk_gates()
339
+ assert (fast["tier"], fast["commit"], fast["branch"]) == ("fast", a1, "ticket/feat%2Fcsv/01")
340
+ assert (full["tier"], full["commit"], full["branch"]) == ("full", a1, "HEAD") # the commit that lands, detached
341
+ assert {gate["status"] for gate in (fast, full)} == {""}
342
+ assert {gate["cwd"] for gate in (fast, full)} == {str(rig.repo.resolve())}
332
343
 
333
344
 
334
345
  def test_gate_environment_names_the_pr_branch_and_a_pycache_prefix_under_agent_implement(tmp_path):
335
346
  rig = Rig(tmp_path, {"01-export-rows.md": ticket("01", "Export rows")}).run(plan())
336
347
  assert rig.code == 0, rig.output()
337
- (gate,) = rig.walk_gates()
338
- assert gate["base"] == "feat/csv" and gate["pycache"]
339
- assert os.path.realpath(gate["pycache"]).startswith(str((rig.repo / ".agent/implement").resolve()) + os.sep)
348
+ gates = rig.walk_gates()
349
+ assert [gate["tier"] for gate in gates] == ["fast", "full"]
350
+ for gate in gates:
351
+ assert gate["base"] == "feat/csv" and gate["pycache"]
352
+ assert os.path.realpath(gate["pycache"]).startswith(str((rig.repo / ".agent/implement").resolve()) + os.sep)
340
353
 
341
354
 
342
355
  def test_red_gate_blocks_the_ticket_after_round_2_names_the_record_and_launches_no_review(blocked):
343
356
  assert blocked.code == 1, blocked.output()
344
357
  a1 = blocked.sha("01", "implementer")
345
- finding = f"Ticket 01: critical finding of kind code from the gate at .agent/implement/01/gate-{a1[:7]}.log:0: "
358
+ finding = f"Ticket 01: critical finding of kind code from the gate at .agent/implement/01/gate-fast-{a1[:7]}.log:0: "
346
359
  assert [l for l in blocked.ledger() if l.startswith(finding)], blocked.ledger()
347
- assert re.search(r"exit\D*1", (blocked.repo / f".agent/implement/01/gate-{a1[:7]}.log").read_text())
360
+ assert re.search(r"exit\D*1", (blocked.repo / f".agent/implement/01/gate-fast-{a1[:7]}.log").read_text())
348
361
  last = blocked.calls("01", "fixer")[-1]["sha"]
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()
362
+ assert [l for l in blocked.ledger() if "01" in l and "BLOCKED" in l and f"gate-fast-{last[:7]}.log" in l], blocked.ledger()
363
+ assert not [gate for gate in blocked.gates("full") if gate["branch"] == "ticket/feat%2Fcsv/01"]
364
+ assert not list((blocked.repo / ".agent/implement/01").glob("gate-full-*.log")), "no full gate on a blocked ticket"
350
365
  assert [c["role"] for c in blocked.calls("01")] == ["test-writer", "implementer"] + ["fixer"] * 2
351
366
  assert blocked.state()["tickets"]["01"]["phase"] == "blocked"
352
367
  assert "ticket/feat%2Fcsv/01" in blocked.branches() and "feat: 01 rows" not in blocked.pr_subjects()
@@ -369,8 +384,10 @@ def test_non_fast_forward_merge_is_a_plumbing_merge_commit_gated_once(tmp_path):
369
384
  a01, a03 = rig.sha("01", "implementer"), rig.sha("03", "implementer")
370
385
  tip = rig.walked()
371
386
  assert len(git(rig.repo, "rev-list", "--parents", "-n1", tip).split()) == 3, "tip is a merge commit"
372
- commits = [g["commit"] for g in rig.walk_gates()]
373
- assert sorted(commits) == sorted([a01, a03, tip]), commits
387
+ fast = [g["commit"] for g in rig.walk_gates() if g["tier"] == "fast"]
388
+ full = [g["commit"] for g in rig.walk_gates() if g["tier"] == "full"]
389
+ # 03 lands first, as a fast-forward; 01 lands as the merge commit. No full gate runs on 01's own tip.
390
+ assert sorted(fast) == sorted([a01, a03]) and full == [a03, tip], (fast, full)
374
391
  waited = rig.calls("01", "implementer")[0]
375
392
  assert waited["after_wait"]["branch"] == "ticket/feat%2Fcsv/01" and waited["after_wait"]["head"] == waited["head"]
376
393
  assert waited["after_wait"]["status"] == ""
@@ -404,7 +421,7 @@ def test_state_json_is_atomic_and_no_transition_is_lost_with_two_tickets_in_flig
404
421
  for nn in ("01", "02", "03"):
405
422
  entry = final["tickets"][nn]
406
423
  assert entry["phase"] == "merged" and entry["round"] == 0
407
- assert std.sha(nn, "implementer") in green(final, nn)
424
+ assert ("fast", std.sha(nn, "implementer")) in green(final, nn)
408
425
  assert entry["test_writer_sha"] == std.sha(nn, "test-writer") and entry["locked"] == [f"tests/test_{nn}.py"]
409
426
 
410
427
 
@@ -431,7 +448,7 @@ def test_resume_returns_a_ticket_with_an_unverifiable_tip_to_implement_from_the_
431
448
  state, fake = rig.state(), "1" * 40
432
449
  tw_sha = rig.sha("01", "test-writer")
433
450
  assert state["tickets"]["01"]["test_writer_sha"] == tw_sha
434
- state["tickets"]["01"].update(phase="review", tip=fake, green_gates=[])
451
+ state["tickets"]["01"].update(phase="review", tip=fake, green_gates={"fast": [], "full": []})
435
452
  (rig.repo / ".agent/implement/state.json").write_text(json.dumps(state))
436
453
  before = rig.ledger()
437
454
  rig.gate_conf()
@@ -447,7 +464,7 @@ def test_resume_returns_a_ticket_with_an_unverifiable_tip_to_implement_from_the_
447
464
  def test_resume_keeps_a_settled_gate_and_runs_no_gate_again(tmp_path):
448
465
  rig = single_blocked(tmp_path)
449
466
  a1, state = rig.sha("01", "implementer"), rig.state()
450
- state["tickets"]["01"].update(phase="merge", tip=a1, green_gates=[a1])
467
+ state["tickets"]["01"].update(phase="merge", tip=a1, green_gates={"fast": [a1], "full": [a1]})
451
468
  (rig.repo / ".agent/implement/state.json").write_text(json.dumps(state))
452
469
  gates_before = len(rig.gates())
453
470
  rig.gate_conf(red=["ticket/feat%2Fcsv/01"]) # any gate run on the ticket would block it; the end of run gates feat/csv
@@ -463,7 +480,9 @@ def test_summary_md_and_stdout_carry_the_measurement_table(std):
463
480
  assert rows and all(row in std.out for row in rows), summary
464
481
  lines = summary.splitlines()
465
482
  line = lambda *words: [l for l in lines if all(w in l.lower() for w in words)]
466
- assert [l for l in line("gate") if re.search(rf"\b{len(std.gates())}\b", l)], summary
483
+ for tier in ("fast", "full"):
484
+ assert f"| {tier} gates run | {len(std.gates(tier))} |" in lines, summary
485
+ assert not line("| gates run |"), summary
467
486
  for role in ("test-writer", "implementer"):
468
487
  assert [l for l in line(role) if "anthropic/claude-opus-5@medium" in l and re.search(r"\b3\b", l)], summary
469
488
  assert [l for l in line(role) if re.search(r"\d+(\.\d+)?\s*s\b", l)], summary
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-10-29T00:14:15.372Z",
3
+ "generatedAt": "2026-10-29T07:54:23.516Z",
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.44",
62
- "hash": "sha256-aad49a1a588a184db8c0d46e229075808a2989eb89287e1049c24819a3bb730f",
61
+ "version": "0.1.46",
62
+ "hash": "sha256-fc47dd018aeb520ba6db5196f2487bdf126c1c447d250462767f2a1fd72d6664",
63
63
  "description": "Implement a specification in code."
64
64
  },
65
65
  {