forked from hikari716/agent-handover
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathend_of_session.py
More file actions
36 lines (26 loc) · 1.03 KB
/
Copy pathend_of_session.py
File metadata and controls
36 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
"""End-of-session handover for OpenCode.
Run at the end of an OpenCode session (manually, from a command, or a git
pre-push hook). It records what happened and publishes `memory/` so the next
session can resume from `memory/layer2/current-state.md`.
python examples/opencode/end_of_session.py "refactored the parser; tests green"
Set AH_PUSH=0 to keep everything local (no git push).
"""
from __future__ import annotations
import os
import sys
from agent_handover.adapters.opencode import build_opencode_handover_engine
def main(argv: list[str] | None = None) -> int:
argv = argv if argv is not None else sys.argv[1:]
note = argv[0] if argv else "(no note provided)"
push = os.environ.get("AH_PUSH", "1") != "0"
engine = build_opencode_handover_engine(
session_note=note,
current_state=note,
push=push,
)
executed = engine.run()
print("handover steps executed:", ", ".join(executed) or "(none)")
return 0
if __name__ == "__main__":
raise SystemExit(main())