perf(skills): cut the tokens and start-up time every agent pays

Requirement 071, from the skeptic audit picks.

Output: radio.py show groups older rows per peer and class into one
line each (7 days 143,520 -> 3,229 bytes); rasci.py show is narrower
(7,081 -> 2,915 bytes) and archives tasks ended over 7 days ago into
rasci-archive.json, still listed by get, --all, artifacts and tools
and revived by any command that names them; make test runs quiet.

Hooks: hooks register as python3 -I -S (site import skipped), the
hook paths of watch, queue, radio, graph and log skip argparse, and
traceback, tempfile, configparser, tomllib, statistics and urllib load
lazily; councilroot.guard() serves watch and radio; the dream
reminder exits before Python when no row can be on. pre-bash 68 ms,
post-bash 50 ms.

Hub: names.json keeps only the entries every lookup needs (11.6 MB ->
11 KB, lookups identical) and phrasing is cached; a state build takes
55 instead of 104 ms.

Context: the commit-chain skills shrink from 3,330 to 1,192 words with
their names kept, details moved to chain.md and reference.md files read
on demand; descriptions capped at 25 words; .ignore and .rgignore keep
state and worktrees out of searches. overhead.py of
kvb-check-efficiency measures hook and script cost per call.

🎯 Fix: 93 %
💥 Break: 5 %
💸 Tokens: 107 %
⏱️ Velocity: –
🛡️ Security: 100 %
🏆 Score: 83
🚦 Gate: ⚠️ tokens 107 % > 100 (on-demand reference files; resident text and daily cost fall): operator approved the commit

Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kevin Veen-BirkenbachandClaude Opus 5.5 committed 2026-11-27 10:49:30 +00:00
1 parent 5c969be21c
commit 9403e17e97
53 files changed
+1219 -522

No files matched your search

+24
View File
@@ -118,6 +118,22 @@ class TestDreamHook(unittest.TestCase):
self.assertEqual(self._run(self._session("a1")), "")
self.assertFalse(self.stamps.exists())
def test_a_row_that_cannot_be_on_starts_no_python(self):
hook = Path(self.tmp.name) / "skills" / "kvb-dream" / "hooks" / "reminder.sh"
hook.parent.mkdir(parents=True)
shutil.copy(HOOK, hook)
marker = Path(self.tmp.name) / "checked"
fake = Path(self.tmp.name) / "skills" / "kvb-org-organize" / "scripts" / "schedules.py"
fake.parent.mkdir(parents=True)
fake.write_text(f"open({str(marker)!r}, 'a').close()\nprint(12)\n", encoding="utf-8")
env = {"PATH": "/usr/bin:/bin", "HOME": self.tmp.name, "DREAM_STAMP_DIR": str(self.stamps)}
for row, started in (({"on": False, "every": 12}, False), (None, False), ({"every": 12, "on": True}, True)):
with self.subTest(row=row):
marker.unlink(missing_ok=True)
self.schedule(row)
subprocess.run(["bash", str(hook)], input=self._session("a1"), capture_output=True, text=True, check=True, env={**env, **self.env})
self.assertEqual(marker.exists(), started)
def test_corrupt_stamp_does_not_crash(self):
self.stamps.mkdir()
(self.stamps / "a1").write_text("not-a-timestamp\n", encoding="utf-8")
@@ -265,6 +281,14 @@ class TestSettingsRegistration(unittest.TestCase):
self.assertEqual([(run.returncode, run.stdout) for run in runs], [(3, "__main__ ['pre-bash'] True\n")] * 2)
self.assertEqual([path.name.split(".")[0] for path in (script.parent / "__pycache__").iterdir()], ["hooks"])
def test_a_hook_registered_with_the_site_import_moves_to_the_start_without_it(self):
data = self._patch()
(gate,) = self._hooks(data, "PreToolUse", "kvb-org-organize/scripts/hooks.py")
gate["command"] = gate["command"].replace("/usr/bin/python3 -I -S ", "/usr/bin/python3 -I ")
self.settings.write_text(json.dumps(data), encoding="utf-8")
(moved,) = self._hooks(self._patch(), "PreToolUse", "kvb-org-organize/scripts/hooks.py")
self.assertIn("/usr/bin/python3 -I -S -c ", moved["command"])
def bash_entries(self, data: dict, event: str) -> list[dict]:
return [entry for entry in data["hooks"].get(event, []) if not entry.get("matcher") or entry["matcher"] == "*" or re.fullmatch(entry["matcher"], "Bash")]