An `out` message widens to every worker on the same provider only when it
states a reset time or names a shared quota (quota, usage window, usage limit,
subscription); a crash, timeout or lost connection takes off just the one.
Resets written as dates ("resets Dec 2, 2pm (America/Denver)") are read.
sisi/ is back at the 3264-line cap: `sisi help` is shorter (README explains each
command), module docstrings keep their first sentence, and dead or single-use
wrappers are gone (rules.delivered, models.speeds/qualities/pools,
install._hooks).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
65 lines
4.0 KiB
Python
65 lines
4.0 KiB
Python
"""sisi: hooks that force a retro and turn what it finds into rules, and a models table to delegate by."""
|
|
import os, sys, time
|
|
|
|
HELP = """sisi: a self-improvement loop for AI coding agents. README.md beside the code explains each command.
|
|
|
|
sisi done --goal G --check C [--check C ...] --next N record what done means; nothing starts before
|
|
sisi done [--pass N EVIDENCE | --fail N WHY] give a check its verdict; alone shows it
|
|
sisi fault [TEXT | --started|--blocked|--fixed N NOTE] open faults in this project; alone lists them
|
|
sisi retro [--gap G --cause C --improve I --term T --problem N|NAME --level core|user|project]
|
|
sisi retro --no-gap TEXT --term T --better B | --later TEXT
|
|
sisi learn --level core|user|project TEXT [--means HOW] the person's own words become a rule at once
|
|
sisi rules [organize [--record FILE] | revert] the learned rules; have them organized; undo a change
|
|
sisi rules move "<start>" core|user|project|canon [--project PATH]
|
|
sisi models [research|offered [--record FILE]] the workers; rebuild the table; save the host's model list
|
|
sisi plan [brief | --record FILE | --done ID EVIDENCE | --fail ID WHY]
|
|
sisi chore show ID print the chore brief under this one-time id
|
|
sisi pick --node ID | routine|ordinary|hard|deep [--branch NAME] the wheel gives one worker for one delegation
|
|
[--review-of WORKER] [--not WORKER ...] [--limit MINUTES]
|
|
sisi pick --node ID --started WORKER a job already running (sent a message) does this node
|
|
sisi judge WORKER good|bad|out WHY [--minutes N] [--newest] [--node ID | --chore ID]
|
|
how it went; `out`: WHY is the provider's own message
|
|
sisi judge WORKER extend MINUTES WHY give a running job more time
|
|
sisi direct REASON allow yourself more direct tool calls this turn
|
|
sisi install | uninstall | doctor rulebook and hooks into the agent tools here; show them
|
|
sisi release | rollback | update make this copy the one in use; go back; fetch the newest
|
|
sisi tick | prompt | watch | gate the hooks the agent tool calls
|
|
|
|
Your rules, models table and retro log are in ~/.local/share/sisi ($SISI_DATA), a project's rules in its .sisi/rules.md."""
|
|
|
|
|
|
def main(argv):
|
|
from . import hooks, models, rules, store
|
|
cmd, args = (argv[0] if argv else "help"), argv[1:]
|
|
if cmd in ("tick", "prompt", "watch", "gate"):
|
|
try:
|
|
p = hooks.payload()
|
|
if cmd == "gate":
|
|
return hooks.gate(p, "--subagent" in args)
|
|
return {"tick": hooks.tick, "prompt": hooks.prompt, "watch": hooks.watch}[cmd](p)
|
|
except Exception as e: # a hook must never break the agent's session
|
|
store.append(os.path.join(store.STATE, "core-errors.log"), "%s %s: %r" % (time.strftime("%Y-%m-%dT%H:%M:%S"), cmd, e))
|
|
return 0
|
|
if cmd in ("retro", "done"):
|
|
from . import retro
|
|
return (retro.run if cmd == "retro" else retro.done)(args)
|
|
if cmd in ("plan", "chore"):
|
|
from . import plan
|
|
return plan.run(args) if cmd == "plan" else plan.chore(args)
|
|
if cmd == "fault":
|
|
from . import faults
|
|
return faults.run(args)
|
|
one = {"rules": rules.run, "pick": models.pick, "learn": rules.learn, "models": models.run, "judge": models.judge,
|
|
"direct": hooks.direct}
|
|
if cmd in one:
|
|
return one[cmd](args)
|
|
if cmd in ("install", "uninstall", "release", "update", "rollback", "doctor"):
|
|
from . import install
|
|
cmd == "release" and models.sync_shared()
|
|
return install.update(auto="--auto" in args) if cmd == "update" else getattr(install, cmd)()
|
|
if cmd in ("rulebook", "version"):
|
|
print(rules.build_rulebook() if cmd == "rulebook" else store.read(os.path.join(store.ROOT, "VERSION")).strip())
|
|
return 0
|
|
print(HELP)
|
|
return 0 if cmd in ("help", "--help", "-h") else 1
|