@jesdi/skills 0.0.64 → 0.0.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jesdi/skills",
3
- "version": "0.0.64",
3
+ "version": "0.0.66",
4
4
  "description": "jesdi's agent skills (content package consumed by @jesdi/skills-cli)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -7,4 +7,3 @@ interfaces, auth, money, data loss, anything hard to revert, or a block that und
7
7
 
8
8
  Answer with one JSON object and nothing else:
9
9
  {"verdict": "agree" | "disagree", "reason": "<one short sentence>"}
10
-
@@ -177,7 +177,7 @@ Every report has `status` (`DONE`, `DONE_WITH_CONCERNS`, `NEEDS_CONTEXT`, `BLOCK
177
177
 
178
178
  | Role | Template | More fields | Checks after the schema |
179
179
  |---|---|---|---|
180
- | test-writer | `prompts/test-writer.md` | `locked` (test file paths), `red` (`test`, `line`), optional `fixtures` (each locked file that holds no test, as a fake `gh`) | The driver reads a test node id `<file>::<test>` in `locked` as its file. Each fixture is in `locked`; the ticket record keeps it a fixture until a later correction lists the file again. With DONE: one commit, one locked file and one red line or more. Each locked path is in a commit that the role made, and is a file at the tip: a correction that deletes a locked file leaves it out of `locked`. Each `line` is in the log. A locked file of a merged ticket that the role changed is in `locked`. A correction (after `overrule-test`, or for a review finding) changes only the files that it lists in `locked` and the files that the driver restored before it. When the gate is red on the restore commit, a DONE correction lists a restored file in `locked`. Each `not_addressed[].finding` is the title of a finding of the correction; a DONE correction with each of its findings there needs no commit. |
180
+ | test-writer | `prompts/test-writer.md` | `locked` (test file paths), `red` (`test`, `line`), optional `fixtures` (each locked file that holds no test, as a fake `gh`) | The driver reads a test node id `<file>::<test>` in `locked` as its file. Each fixture is in `locked`; the ticket record keeps it a fixture until a later correction lists the file again. With DONE: one commit, one locked file and one red line or more. A correction's test can be green on the implementer's code, so its red line comes from a production edit that the correction makes and reverts. Each locked path is in a commit that the role made and is a file at the tip: a correction that deletes a locked file leaves it out of `locked`. Each `line` is in the log. A locked file of a merged ticket that the role changed is in `locked`. A correction (after `overrule-test`, or for a review finding) changes only the files that it lists in `locked` and the files that the driver restored before it. When the gate is red on the restore commit, a DONE correction lists a restored file in `locked`. Each `not_addressed[].finding` is the title of a finding of the correction, or after `overrule-test` an overruled concern as its prompt lists it (the driver logs its reason, and the implementer runs again); a DONE correction with each of its findings there needs no commit. |
181
181
  | implementer | `prompts/implementer.md` | `green` | With DONE and no commit: no new commit on the branch, no uncommitted change, and a concern that says why the start needs no change. The driver then gates and reviews the start commit. |
182
182
  | reviewer | `prompts/reviewer.md` | `findings` (`severity`, `file`, `line`, `title`, `evidence`, `kind`), `mutations` (`test`, `file`, `line`, `red`) | In a full review (one with no fix range: round 1, and the review after a test-writer correction): `mutations` is required, with a proof for each locked test file (`test` is `<locked file>::<test name>`). A locked fixture needs no proof: it holds no test that a proof could name, and the locked-file check protects it. Neither does a locked file that is not at the reviewed tip. Each `red` is in the log. |
183
183
  | correctness | `prompts/correctness.md` | the same as the reviewer | `mutations` is optional. |
@@ -195,7 +195,7 @@ A question is a bounded choice for the operator. `driver_decisions.py` `KINDS` h
195
195
 
196
196
  | Kind | Question id | Asked when | Run exit | Options |
197
197
  |---|---|---|---|---|
198
- | `locked-test` | `<NN>-locked-test-<n>` | An implementer or a fixer reports BLOCKED with a concern that starts with `locked test contradicts spec:`. | 2 | `overrule-test`: the test-writer corrects the test from that report, then the implementer runs again, and the fix rounds count from 0: the corrected tests are a new contract. `overrule-implementer` (recommended): the implementer runs again. |
198
+ | `locked-test` | `<NN>-locked-test-<n>` | An implementer or a fixer reports BLOCKED with a concern that starts with `locked test contradicts spec:`. Asked again on the same test, from the same report, when the driver refuses the report of the correction after `overrule-test` and its rerun, or the correction reports BLOCKED. | 2 | `overrule-test`: the test-writer corrects the test from that report, then the implementer runs again, and the fix rounds count from 0: the corrected tests are a new contract. `overrule-implementer` (recommended): the implementer runs again. |
199
199
  | `finding` | `<NN>-finding-<n>` | A finding is open after fix round 4. One question for each finding. | 1 | `accept`: close the finding; the ticket merges when each of its findings is accepted. `split` (recommended) and `redesign`: the ticket stays BLOCKED, with the ruling in the ledger. |
200
200
  | `locked-test-again` | `<NN>-locked-test-again-<n>` | A finding for a test-writer correction is open in the review right after a correction, or the driver rejects the correction's report (for example, it changes a file that it does not list in `locked`). One question for each finding. | 2 | `correct-again` (recommended): the ticket resumes from the review, and that review's findings get one more correction. `accept`: no more correction runs for the ticket, its locked tests stay as they are, and the ticket goes on to its fix rounds with its other findings; a changed locked file is still restored. `redesign`: the ticket stays BLOCKED, with the ruling in the ledger. After two `correct-again` stops on a ticket, its next question offers only `accept` (recommended) and `redesign`, so a test-writer and a reviewer that never agree cannot loop. |
201
201
  | `review-stopped` | `<NN>-review-stopped-<n>` | The reviewer or the correctness pass reports `BLOCKED` or `NEEDS_CONTEXT`. One question for each agent that stopped. | 2 | `retry` (recommended): the ticket resumes from the review, and each agent of the review runs again. `accept`: the same, and for the rest of the ticket a `BLOCKED` or `NEEDS_CONTEXT` report of that agent does not stop it: the review goes on with that report's findings and those of the other reports. `redesign`: the ticket stays BLOCKED, with the ruling in the ledger. |
@@ -75,11 +75,22 @@ def _check_out_ticket(ticket: Ticket, slot_number: int, entry: dict, run: Run) -
75
75
  return driver_slots.head(slot)
76
76
 
77
77
 
78
+ def _locked_test_stop(number: str, run: Run) -> dict:
79
+ """The last `locked-test` question of the ticket; {} when it has none."""
80
+ asked = [q for q in run.state.read()["run"]["questions"] if (q["ticket"], q["kind"]) == (number, "locked-test")]
81
+ return asked[-1] if asked else {}
82
+
83
+
78
84
  def _blocked_report(number: str, run: Run) -> str:
79
85
  """The report of the last `locked-test` stop of the ticket: an implementer's or a fixer's."""
80
- asked = [q["evidence"][0] for q in run.state.read()["run"]["questions"]
81
- if (q["ticket"], q["kind"]) == (number, "locked-test")]
82
- return asked[-1] if asked else str(OUT / number / "implementer-0.json")
86
+ return _locked_test_stop(number, run).get("evidence", [str(OUT / number / "implementer-0.json")])[0]
87
+
88
+
89
+ def _overruled(number: str, run: Run) -> list[str]:
90
+ """The concerns of that report that the operator overruled: what an overrule correction names in
91
+ `not_addressed` (issue #134)."""
92
+ concerns = json.loads(Path(_blocked_report(number, run)).read_text())["concerns"]
93
+ return [concern for concern in concerns if concern.startswith(driver_decisions.CONTRADICTS)]
83
94
 
84
95
 
85
96
  def _prompt_values(ticket: Ticket, slot: str, run: Run) -> dict[str, str]:
@@ -114,11 +125,23 @@ def _run_roles(ticket: Ticket, slot_number: int, run: Run) -> None:
114
125
  values.update(start_sha=start, gate_record=os.path.relpath(driver_gate.record_path(OUT / number, start), slot))
115
126
  # A test-writer on a ticket that has locked tests is the correction after a ruling.
116
127
  check = {"correction": role == "test-writer" and bool(entry["test_writer_sha"])}
128
+ if check["correction"]:
129
+ check["findings"] = _overruled(number, run)
130
+ values["overruled"] = "".join(f"- {concern}\n" for concern in check["findings"])
117
131
  if check["correction"] and (restored := run.restore_locked_files(number, slot)):
118
132
  values.update(start_sha=driver_slots.head(slot), restored=" ".join(restored))
119
133
  notes, check["restored"] = [*notes, "restored"], restored
120
134
  with during(f"the {role}"):
121
- report = run.agent(role, number, slot, values, notes=notes, check=check)
135
+ try:
136
+ report = run.agent(role, number, slot, values, notes=notes, check=check)
137
+ except Blocked:
138
+ if check["correction"]:
139
+ # The ruling did not take: the operator rules on the same locked test again (issue #134).
140
+ run.ask(number, "locked-test", [_locked_test_stop(number, run)["subject"]],
141
+ _blocked_report(number, run))
142
+ raise
143
+ for item in report.get("not_addressed", []):
144
+ ledger(f"Ticket {number}: the test-writer correction did not correct {item['finding']}: {item['reason']}.")
122
145
  facts = {"tip": driver_slots.head(slot)}
123
146
  if role == "test-writer":
124
147
  facts.update(driver_review.written(slot, entry, report["locked"], report.get("fixtures", []),
@@ -2,4 +2,6 @@
2
2
  This call is a correction after a ruling, not a new test set. The implementer or the fixer reported that a locked test contradicts the spec or the ticket, and the operator ruled that the test is wrong: read `concerns` in {blocked_report}.
3
3
  Correct only the tests that those concerns name, so that they state what the spec and the ticket require. Keep each other test as it is.
4
4
  The branch can hold commits of the implementer, and the tree can hold its uncommitted work: change neither, and commit only the test files you correct.
5
- A corrected test fails because the behavior is missing: run it and print that failing output. In `locked`, list each test file you corrected.
5
+ A corrected test fails because the behavior is missing: run it, print that failing output, and give its failure line in `red`. A corrected test can be green, because the implementer's code is there: then break the production line that the test protects, run the test, print its failing output, give that line in `red`, and revert the edit. In `locked`, list each test file you corrected.
6
+ When a concern needs no test change, leave the test as it is and add the concern to `not_addressed`: `finding` is its text, copied exactly from this list, and `reason` is why the test stands:
7
+ {overruled}
@@ -15,7 +15,7 @@ from test_fixloop import Inside, inside # noqa: F401 (the autouse fixture puts
15
15
  from test_tidy import Inside as Pushing, tools # noqa: F401 (an unattended run pushes: the rig with an origin and a fake gh)
16
16
  from test_review import ONE, STUCK, finding, fix, review
17
17
  from test_stops import CONTRA, NEW_TEST, Q1, UNATTENDED, blocked, correction, decisions, stage, steps, write_answers
18
- from test_walk import impl, plan, tw
18
+ from test_walk import COST, impl, plan, tw
19
19
 
20
20
  PAGE = ".agent/implement-review.html"
21
21
 
@@ -218,15 +218,49 @@ def test_a_correction_that_commits_more_than_the_files_it_lists_is_rejected(tmp_
218
218
  scenario = plan(**{"01/test-writer": [two_locked(), correction(), correction()], "01/implementer": [dirty, impl("01")]})
219
219
  rig = Inside(tmp_path, ONE).run(scenario)
220
220
  rig.run(scenario, "--answer", f"{Q1}=overrule-test")
221
- assert rig.code == 1, rig.ledger()
221
+ assert rig.code == 2, rig.ledger()
222
222
  assert rig.led("Ticket 01: BLOCKED at the test-writer: a correction may change only the files it lists in "
223
223
  "`locked`: its commits also change demo/export.py.")
224
+ # Issue #134: the refused correction asks the locked-test question again, from the same blocked report.
225
+ (again,) = decisions(rig)["questions"]
226
+ asked_again = rig.state()["run"]["questions"][-1]
227
+ assert again["id"] == "01-locked-test-2" and asked_again["subject"] == "tests/test_01.py::test_x"
228
+ assert asked_again["evidence"][0] == ".agent/implement/01/implementer-0.json"
224
229
  assert rig.led(restored(OTHER)) and git(rig.repo, "show", f"ticket/feat%2Fcsv/01:{OTHER}") == OTHER_TEST
225
230
  assert len(rig.calls("01", "test-writer")) == 3 and len(rig.calls("01", "implementer")) == 1, "one rerun, no implementer"
226
231
  assert "its commits also change demo/export.py" in rig.prompt("test-writer-0")
227
232
  assert "feat: 01 rows" not in rig.pr_subjects() and rig.state()["tickets"]["01"]["held"] == {}
228
233
 
229
234
 
235
+ MUTATION = "FAILED tests/test_01.py::test_x - AssertionError: fn_01 deleted"
236
+
237
+
238
+ def test_an_overrule_correction_whose_test_is_green_against_the_tip_reaches_the_review(tmp_path, capsys):
239
+ # Issue #134: the corrected test is green on the implementer's code, so its red line comes from a reverted mutation.
240
+ green = {**correction(), "stdout": MUTATION + "\n" + COST}
241
+ green["report"] = {**green["report"], "red": [{"test": "tests/test_01.py::test_x", "line": MUTATION}]}
242
+ scenario = plan(**{"01/test-writer": [tw("01"), green, green], "01/implementer": [partial(), impl("01")]})
243
+ rig = Inside(tmp_path, ONE).run(scenario)
244
+ rig.run(scenario, "--answer", f"{Q1}=overrule-test")
245
+ assert rig.code == 0, rig.ledger()
246
+ assert len(rig.calls("01", "test-writer")) == 2, "the green correction is accepted with no rerun"
247
+ assert "break the production line that the test protects" in rig.prompt("test-writer-0")
248
+ assert rig.state()["tickets"]["01"]["phase"] == "merged"
249
+
250
+
251
+ def test_an_overrule_correction_may_leave_the_overruled_concern_not_addressed(tmp_path, capsys):
252
+ keeps = {**correction(), "files": {}, "commit": None, "stdout": COST}
253
+ del keeps["files"], keeps["commit"]
254
+ keeps["report"] = {**keeps["report"], "commits": [], "files": [], "locked": [], "red": [],
255
+ "not_addressed": [{"finding": CONTRA, "reason": "the test is right"}]}
256
+ scenario = plan(**{"01/test-writer": [tw("01"), keeps, keeps], "01/implementer": [blocked(), impl("01")]})
257
+ rig = Inside(tmp_path, ONE).run(scenario)
258
+ rig.run(scenario, "--answer", f"{Q1}=overrule-test")
259
+ assert rig.code == 0, rig.ledger()
260
+ assert len(rig.calls("01", "test-writer")) == 2, "the concern is a target the correction can name"
261
+ assert f"- {CONTRA}" in rig.prompt("test-writer-0")
262
+ assert rig.led(f"Ticket 01: the test-writer correction did not correct {CONTRA}: the test is right.")
263
+
230
264
  def test_a_correction_of_its_own_file_leaves_the_work_in_the_tree_to_the_implementer(tmp_path, capsys):
231
265
  dirty = {**blocked(), "files": {"demo/export.py": "half = 1\n"}}
232
266
  # This correction commits only its test file: the implementer's file is out of the reach of `git add -A`.
@@ -27,8 +27,9 @@ The target repo provides the make targets `test`, `mutation`, `mutation-check`,
27
27
  python3 "<skill-dir>/prune.py" <command> [--state DIR] [--date YYYY-MM-DD]
28
28
  ```
29
29
 
30
- Run it from inside the target repo. State lives in `<git dir>/test-prune/` (outside the working
31
- tree); each command reads what the previous one wrote there. Exit 0 is done (including nothing to
30
+ Run it from inside the target repo. State lives in `<repo root>/.test-prune/`, which prune.py keeps
31
+ out of git through `info/exclude`; each command reads what the previous one wrote there. Subagents
32
+ write their JSON files there too. Never put it under `.git/`: Claude Code refuses agent writes there. Exit 0 is done (including nothing to
32
33
  do), 1 is a failed make target, gate or guard, 2 is bad input or an unmet precondition; the
33
34
  message names the offending ids or files. On exit 2 fix the input and rerun the same command; on
34
35
  exit 1 stop and report the output.
@@ -35,7 +35,7 @@ class Parser(argparse.ArgumentParser):
35
35
 
36
36
  def _common():
37
37
  common = Parser(add_help=False)
38
- common.add_argument("--state", help="run state directory (default: <git dir>/test-prune)")
38
+ common.add_argument("--state", help="run state directory (default: <repo root>/.test-prune, git-ignored)")
39
39
  common.add_argument("--date", help="branch date YYYY-MM-DD (default: today, UTC)")
40
40
  return common
41
41
 
@@ -65,7 +65,7 @@ class Context:
65
65
  def __init__(self, args):
66
66
  self.args = args
67
67
  self.repo = Repo(Path.cwd())
68
- self.state = State(Path(args.state).resolve() if args.state else self.repo.git_dir() / "test-prune")
68
+ self.state = State(Path(args.state).resolve() if args.state else self.repo.default_state())
69
69
  self.date = args.date or datetime.now(timezone.utc).strftime("%Y-%m-%d")
70
70
  self.finished = False # the run is complete: the strengthen loop ended (set by its commands)
71
71
 
@@ -177,7 +177,7 @@ def _record_bad_arguments(argv, exc: BadInput) -> None:
177
177
  command = next((a for a in argv if a in COMMANDS), None)
178
178
  state = _state_arg(argv)
179
179
  try:
180
- path = Path(state).resolve() if state else Repo(Path.cwd()).git_dir() / "test-prune"
180
+ path = Path(state).resolve() if state else Repo(Path.cwd()).default_state()
181
181
  except BadInput:
182
182
  return
183
183
  if command:
@@ -25,6 +25,9 @@ class BadInput(Exception):
25
25
  """Invalid input or an unmet precondition: exit 2."""
26
26
 
27
27
 
28
+ STATE_DIR = ".test-prune" # the default run state, under the repo root
29
+ STATE_EXCLUDE = f"/{STATE_DIR}/" # its info/exclude line
30
+
28
31
  LIMIT = 60_000 # characters per PR body or summary block; GitHub refuses a PR body over 65,536
29
32
 
30
33
 
@@ -86,8 +89,13 @@ class Repo:
86
89
  raise Fail(f"git {' '.join(args)} failed: {proc.stderr.strip()}")
87
90
  return proc.stdout
88
91
 
89
- def git_dir(self) -> Path:
90
- return Path(self.git("rev-parse", "--absolute-git-dir").strip())
92
+ def default_state(self) -> Path:
93
+ exclude = self.root / self.git("rev-parse", "--git-path", "info/exclude").strip()
94
+ lines = exclude.read_text().splitlines() if exclude.exists() else []
95
+ if STATE_EXCLUDE not in lines:
96
+ exclude.parent.mkdir(parents=True, exist_ok=True)
97
+ exclude.write_text("".join(f"{line}\n" for line in [*lines, STATE_EXCLUDE]))
98
+ return self.root / STATE_DIR
91
99
 
92
100
  def head(self) -> str:
93
101
  return self.git("rev-parse", "HEAD").strip()
@@ -3,10 +3,11 @@ import json
3
3
  import shutil
4
4
  import subprocess
5
5
  import sys
6
+ from pathlib import Path
6
7
 
7
8
  import pytest
8
9
 
9
- from prune_harness import PRUNE, PRUNE_BRANCH, arg, REFERENCE, STRENGTHEN_BRANCH, R, cand, case, lines_with
10
+ from prune_harness import DATE, PRUNE, PRUNE_BRANCH, arg, REFERENCE, STRENGTHEN_BRANCH, R, cand, case, lines_with
10
11
  from prune_repo import Fail, Repo
11
12
  from prune_review import cap
12
13
  from test_prune_strengthen import (COMPUTE, COMPUTE_TEST, DRIFT, DRIFT_TEST, EQUIVALENT_ID, HERFINDAHL, IDS_7_9,
@@ -379,6 +380,28 @@ def test_a_malformed_date_is_recorded_in_the_status(target):
379
380
  assert proc.returncode == 2 and status["exit"] == 2 and "--date must be YYYY-MM-DD" in status["reason"]
380
381
 
381
382
 
383
+ def test_the_default_state_is_an_ignored_dir_the_agents_can_write(target):
384
+ """Claude Code refuses an agent's writes under .git/, and the fixer and reviewer write into the state."""
385
+ def run(*args):
386
+ return subprocess.run([sys.executable, str(PRUNE), *args], cwd=target.root / "backend", env=target.env(),
387
+ capture_output=True, text=True)
388
+ target.set_candidates([cand(case(1))])
389
+
390
+ for _ in range(2):
391
+ proc = run("collect", "--unattended", "--date", DATE)
392
+ assert proc.returncode == 0, proc.stderr
393
+
394
+ state = target.root / ".test-prune"
395
+ assert json.loads((state / "status.json").read_text())["commands"][0]["command"] == "collect"
396
+ assert not (Path(target.git("rev-parse", "--absolute-git-dir").strip()) / "test-prune").exists()
397
+ assert target.git("status", "--porcelain", "--untracked-files=all") == ""
398
+ exclude = target.root / target.git("rev-parse", "--git-path", "info/exclude").strip()
399
+ assert exclude.read_text().splitlines().count("/.test-prune/") == 1
400
+
401
+ assert run("batch").returncode == 2 # an argument error, recorded before any Context exists
402
+ assert "--reviews" in json.loads((state / "status.json").read_text())["reason"]
403
+
404
+
382
405
  def test_the_cap_skips_a_family_that_does_not_fit_and_takes_later_ones():
383
406
  singles = [{"test_id": f"tests/t.py::test_{i}", "into": "x"} for i in range(9)]
384
407
  family = [{"test_id": f"tests/t.py::test_f[{i}]", "into": "x"} for i in range(3)]
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "generatedAt": "2026-10-22T11:14:54.556Z",
3
+ "generatedAt": "2026-10-23T18:30:59.604Z",
4
4
  "skills": [
5
5
  {
6
6
  "name": "babysit-pr",
7
- "version": "0.1.0",
8
- "hash": "sha256-6da121d1648ed363c265dcf9b3faa6ca79f1a3e639050b52643a6867f71e8370",
7
+ "version": "0.1.1",
8
+ "hash": "sha256-bf09318dcaf40422f9c2433698b4f1c6f8e10b8893f84b1e81ee9f04f7d6cad9",
9
9
  "description": "Babysit an open pull request until it is merged or handed to a human. Started by the PostToolUse hook after `gh pr create`, or by hand with `/babysit-pr <pr-url>`."
10
10
  },
11
11
  {
@@ -52,8 +52,8 @@
52
52
  },
53
53
  {
54
54
  "name": "implement-spec",
55
- "version": "0.1.39",
56
- "hash": "sha256-303cb5ea3c05a8f5e3b127780d772e8aa808de618801f468093a6d7f40781259",
55
+ "version": "0.1.40",
56
+ "hash": "sha256-b55e19f156025a0a30d2a6ba6a28eb66c0d890163a29b3a813e49c3eb8be7ca4",
57
57
  "description": "Implement a specification in code."
58
58
  },
59
59
  {
@@ -94,8 +94,8 @@
94
94
  },
95
95
  {
96
96
  "name": "test-prune",
97
- "version": "0.1.0",
98
- "hash": "sha256-84743bfc41613291debeacd1ef47a1d3982df7635efa39fc727f5525659761cd",
97
+ "version": "0.1.1",
98
+ "hash": "sha256-d488bcfbe73b8ed13b6743eacd2c85ad65236fb60a9df95f6b3e8a76f10c0bc2",
99
99
  "description": "Mutation-guided test pruning: a fixer proposes deleting redundant tests and strengthening weak ones, an independent reviewer accepts or rejects each proposal, and prune.py applies the accepted batch behind a cold mutation run and the ratchet. Use when the user says \"prune tests\", \"test-prune\", \"mutation test pruning\" or \"strengthen weak tests\", or when a scheduled job runs it with `--unattended`."
100
100
  },
101
101
  {