diff --git a/skills/kvb-org-artefacts/SKILL.md b/skills/kvb-org-artefacts/SKILL.md index cc0f48c..19a36d5 100644 --- a/skills/kvb-org-artefacts/SKILL.md +++ b/skills/kvb-org-artefacts/SKILL.md @@ -13,11 +13,14 @@ and takes status and worker from its task. The script is ```bash rasci.py set --artifact : rasci.py set --drop-artifact : -rasci.py artifacts [--ended] [--task ] +rasci.py artifacts [--ended] [--task ] [--worker ] ``` Kinds: `image:`, `container:`, `volume:`, `network:`, `stack:`, `worktree:`, -`dir:`, `log:`. `artifacts` lists each task's workdir and branch beside them. +`dir:`, `log:`. `artifacts` lists each task's workdir and branch beside them; +`--worker` keeps the tasks whose worker contains the text. A drop names the +artifact with its kind, or is refused; one not recorded drops nothing and +says so on stderr. ## Rules diff --git a/skills/kvb-org-rasci/SKILL.md b/skills/kvb-org-rasci/SKILL.md index 7549b6b..e7c5c55 100644 --- a/skills/kvb-org-rasci/SKILL.md +++ b/skills/kvb-org-rasci/SKILL.md @@ -20,7 +20,7 @@ rasci.py get rasci.py rm rasci.py show [--all] rasci.py show --wide [--all] -rasci.py artifacts [--ended] [--task ] +rasci.py artifacts [--ended] [--task ] [--worker ] rasci.py estimate "" --value --complexity rasci.py estimate Operator --value rasci.py wsjf [--all] diff --git a/skills/kvb-org-rasci/scripts/rasci.py b/skills/kvb-org-rasci/scripts/rasci.py index 7376f0c..5a1594b 100755 --- a/skills/kvb-org-rasci/scripts/rasci.py +++ b/skills/kvb-org-rasci/scripts/rasci.py @@ -382,7 +382,7 @@ def cmd_set(args: argparse.Namespace) -> int: if args.unpin and args.prio is not None: fail("--unpin removes the pin; it cannot go with --prio") times = {f: stamp(getattr(args, f)) for f in ("start", "end") if getattr(args, f)} - for ref in args.artifact: + for ref in (*args.artifact, *args.drop_artifact): if not ARTIFACT.match(ref): fail(f"invalid artifact {ref!r}; use :, e.g. image::") with database() as tasks: @@ -409,6 +409,10 @@ def cmd_set(args: argparse.Namespace) -> int: entry.pop(field, None) if args.after and follows(tasks, args.task, args.task): fail(f"{args.task}: --after {', '.join(args.after)} closes a cycle; drop one with --drop-after") + recorded = [a["ref"] for a in entry.get("artifacts", [])] + absent = [ref for ref in dict.fromkeys(args.drop_artifact) if ref not in recorded] + if absent: + print(f"{args.task}: {', '.join(absent)} not recorded, nothing to drop; recorded: {', '.join(recorded) or 'none'}", file=sys.stderr) kept = [a for a in entry.get("artifacts", []) if a["ref"] not in args.drop_artifact] known = {a["ref"] for a in kept} kept += [{"ref": r, "added": stamp()} for r in dict.fromkeys(args.artifact) if r not in known] @@ -531,7 +535,7 @@ def cmd_artifacts(args: argparse.Namespace) -> int: rows = merged(True) for task in sorted(rows): row = rows[task] - if task.startswith(RECORDS) or (args.task and task != args.task): + if task.startswith(RECORDS) or (args.task and task != args.task) or (args.worker and args.worker not in (row.get("worker") or "")): continue if args.ended and row["status"] not in (*ENDED, "stale"): continue @@ -649,6 +653,7 @@ def main() -> int: p = sub.add_parser("artifacts") p.add_argument("--ended", action="store_true") p.add_argument("--task") + p.add_argument("--worker") p.set_defaults(func=cmd_artifacts) sub.add_parser("tools").set_defaults(func=cmd_tools) p = sub.add_parser("agents") diff --git a/skills/kvb-org-swarm/teardown.md b/skills/kvb-org-swarm/teardown.md index f1b727f..a7c381b 100644 --- a/skills/kvb-org-swarm/teardown.md +++ b/skills/kvb-org-swarm/teardown.md @@ -23,7 +23,8 @@ assuming it: freed slot and the released claims go to the chair and the peers as one `${CLAUDE_SKILL_DIR}/../kvb-org-radio/scripts/radio.py post ""`, not as wakes. Drop each removed item from the `kvb-org-rasci` register - with `--drop-artifact` and set the subagent's task `done` or `stopped`. + with `--drop-artifact :` and set the subagent's task `done` or + `stopped`. 7. **Remove its temporary files**: logs, message files and scratch data that have served their purpose. Keep only the evidence the report cites, until the report is delivered. diff --git a/tests/test_rasci.py b/tests/test_rasci.py index 99b0aa4..f319033 100644 --- a/tests/test_rasci.py +++ b/tests/test_rasci.py @@ -263,6 +263,27 @@ class TestRasci(unittest.TestCase): ) self.assertIn("tool: council.py", self._out("get", "work/a")) + def test_artifacts_filter_by_worker_and_a_drop_without_kind_is_refused(self): + self._run("set", "work/a", "--worker", "session 44f0eff7", "--artifact", "dir:/tmp/a") + self._run("set", "work/b", "--worker", "subagent general-purpose (opus)", "--artifact", "log:/tmp/b.log") + self.assertEqual([line.split("\t")[1] for line in self._out("artifacts", "--worker", "44f0eff7")], ["work/a"]) + self.assertEqual(self._out("artifacts", "--worker", "nobody"), []) + register = self.root / "rasci.json" + before = register.read_text(encoding="utf-8") + refused = self._run("set", "work/a", "--drop-artifact", "/tmp/a", "--title", "kept") + self.assertEqual(refused.returncode, 2) + self.assertIn("invalid artifact '/tmp/a'; use :", refused.stderr) + self.assertEqual(register.read_text(encoding="utf-8"), before) + absent = self._run("set", "work/a", "--drop-artifact", "dir:/tmp/other", "--title", "kept") + self.assertEqual(absent.returncode, 0) + self.assertIn("work/a: dir:/tmp/other not recorded, nothing to drop; recorded: dir:/tmp/a", absent.stderr) + self.assertIn("title: kept", self._out("get", "work/a")) + self._run("set", "work/c", "--workdir", "/w/x", "--branch", "feat/x") + self.assertEqual(self._run("set", "work/c", "--drop-artifact", "worktree:/w/x", "--branch", "").returncode, 0) + self.assertNotIn("branch: feat/x", self._out("get", "work/c")) + self.assertEqual(self._run("set", "work/a", "--drop-artifact", "dir:/tmp/a").returncode, 0) + self.assertEqual(self._out("artifacts", "--task", "work/a"), []) + def test_claims_join_the_matrix_with_holder_as_ra(self): self._claim("work/live", "s1", "One", "Gamma") self._claim("cluster/dead", "s9", "Gone", "Delta")