Item 1: a unit is bound to the session that works on it; sisi unit continue | park | resume; stale_hours; contract init names the three ways on. done / next: item 2 (the before-tool refusal)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-23 14:12:46 -07:00
1 parent 2ecbfea7e9
commit 275f0b43b2
7 files changed
+1130 -9

No files matched your search

+12 -3
View File
@@ -26,9 +26,11 @@ def cmd_contract(args):
old = None
from . import unit as _U
if not _U.is_closed(old):
print("sisi: %s already exists and the unit %s is still open. Close it first with "
"`sisi unit close`, or record why it stopped with "
"`sisi unit close --abandon \"<reason>\"`." % (p, (old or {}).get("id", "?")))
print("sisi: %s already exists and the unit %s (%s) is still open. Three ways on: "
"`sisi unit continue` if it is this work; `sisi unit park \"<why>\"` to set it aside, "
"kept, and start new work; or `sisi unit close --abandon \"<reason>\"` if it was dropped. "
"Then `sisi contract init` again for new work."
% (p, (old or {}).get("id", "?"), ((old or {}).get("goal") or "no goal")[:80]))
return 1
# A closed unit is replaced. Its archive should already exist; if a hand-edited
# contract claims closed with none, archive it now so nothing is ever lost.
@@ -50,6 +52,13 @@ def cmd_contract(args):
json.dump(skel, f, indent=2)
f.write("\n")
trust.add(os.getcwd())
try:
from . import unitguard as _G
_sid = _G.cli_session()
if _sid:
_G.bind(_sid, project, skel, "init")
except Exception as e:
store.log_error("contract-init-bind", e)
print("created %s as a SKELETON, not a contract yet: replace the placeholder check with a real command "
"(rung 1-4) and add every check that shows the work is done. Until then `sisi verify` fails and "
"the end-of-turn gate ignores it." % p)