diff --git a/canon/harnesses.json b/canon/harnesses.json index 117ab07..cc89c19 100644 --- a/canon/harnesses.json +++ b/canon/harnesses.json @@ -1,5 +1,5 @@ [ - {"name": "claude", "detect": "~/.claude", "env": "CLAUDE_CONFIG_DIR", "rules": "CLAUDE.md", "import": true, "hooks": {"file": "settings.json", "tick": "SessionStart", "prompt": "UserPromptSubmit", "watch": "PreToolUse", "gate": "Stop"}, "limits": "The built-in Explore and Plan subagents do not load CLAUDE.md."}, + {"name": "claude", "detect": "~/.claude", "env": "CLAUDE_CONFIG_DIR", "here": "CLAUDE_CODE_ENTRYPOINT","rules": "CLAUDE.md", "import": true, "hooks": {"file": "settings.json", "tick": "SessionStart", "prompt": "UserPromptSubmit", "watch": "PreToolUse", "gate": "Stop"}, "limits": "The built-in Explore and Plan subagents do not load CLAUDE.md."}, {"name": "codex", "detect": "~/.codex", "env": "CODEX_HOME", "rules": "AGENTS.md", "hooks": {"file": "hooks.json", "tick": "SessionStart", "prompt": "UserPromptSubmit", "watch": "PreToolUse", "gate": "Stop"}, "limits": "Hooks run only after the person trusts them once in Codex's /hooks; AGENTS.override.md shadows the rulebook; hosted web search is not metered."}, {"name": "qwen", "detect": "~/.qwen", "rules": "QWEN.md", "hooks": {"file": "settings.json", "tick": "SessionStart", "prompt": "UserPromptSubmit", "watch": "PreToolUse", "gate": "Stop"}, "limits": "A tool Qwen names differently from canon/tools.json is not metered."}, {"name": "grok", "detect": "~/.grok", "rules": "AGENTS.md", "limits": "Grok already runs the hooks in ~/.claude/settings.json; its session-start and prompt output is discarded, though it reads the project's AGENTS.md note."}, diff --git a/sisi/store.py b/sisi/store.py index d240fdb..5e1ee52 100644 --- a/sisi/store.py +++ b/sisi/store.py @@ -26,7 +26,8 @@ GIT_ERROR = "" # why the last git call that failed did: the first line of its s DEFAULTS = {"gate": True, "meter": True, "direct_calls": 8, "direct_extension": 8, "rules_lines": 30, "rules_chars": 4000, "organize_after": 8, "audit_after": 12, "research_days": 3, "shell_workers": False, "enforce": True, "worker_minutes": 90, "retro_minutes": 5, "disk_free_percent": 20, "disk_drop_percent": 5, "checkouts": 8, - "auto_update": True, "update_hours": 24, "update_url": "https://github.com/swaits/sisi"} + "auto_update": True, "update_hours": 24, "update_url": "https://github.com/swaits/sisi", + "offered_hours": 24} def config(): cfg = dict(DEFAULTS) @@ -38,6 +39,19 @@ def config(): return cfg +def harness(): + """Name of the tool running this: the first canon entry whose "here" env var is set, else unknown.""" + try: + table = json.loads(read(os.path.join(ROOT, "canon", "harnesses.json")) or "[]") + except ValueError: + table = [] + for h in table: + value = os.environ.get(h.get("here") or "") + if value: + return re.sub(r"[^a-z0-9._-]+", "-", (h["name"] + "-" + value).lower())[:60] + return "unknown" + + def data(*parts): path = os.path.join(DATA, *parts) os.makedirs(os.path.dirname(path), exist_ok=True)