feat(hook): add spawn_id correlation to amc-hook

Read AMC_SPAWN_ID env var and include spawn_id in session JSON when
present. This enables deterministic spawn correlation: the server
generates a UUID, passes it via env to the spawned agent, and then
polls for a session file containing that specific spawn_id.

Closes: bd-1zy
This commit is contained in:
teernisse
2026-02-26 16:58:02 -05:00
parent 1bece476a4
commit e4a0631fd7

View File

@@ -249,6 +249,11 @@ def main():
"zellij_pane": os.environ.get("ZELLIJ_PANE_ID", ""), "zellij_pane": os.environ.get("ZELLIJ_PANE_ID", ""),
} }
# Include spawn_id if present in environment (for spawn correlation)
spawn_id = os.environ.get("AMC_SPAWN_ID")
if spawn_id:
state["spawn_id"] = spawn_id
# Turn timing: track working time from user prompt to completion # Turn timing: track working time from user prompt to completion
if event == "UserPromptSubmit": if event == "UserPromptSubmit":
# New turn starting - reset turn timing # New turn starting - reset turn timing