diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-30 21:48:13 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-30 21:48:13 -0500 |
| commit | 143feda0644d2289954b694f3ce4cee2fc74b808 (patch) | |
| tree | 539452f3e7a47b24b2e9a0dd9a98e1e9c67f30a3 /.ai/workflows/wrap-it-up.org | |
| parent | 9a1bea9bfc066312bf9743dc23c88f191a36cc16 (diff) | |
| download | rulesets-143feda0644d2289954b694f3ce4cee2fc74b808.tar.gz rulesets-143feda0644d2289954b694f3ce4cee2fc74b808.zip | |
feat(session-context): resolve the active path per AI_AGENT_ID
A single .ai/session-context.org races when two agents share a project: each agent's writes clobber the other's session log. I added .ai/scripts/session-context-path, which resolves the active path from AI_AGENT_ID: unset gives the legacy .ai/session-context.org singleton (so every existing one-agent session is unchanged), set gives .ai/session-context.d/<id>.org with the id sanitized to filename-safe characters. This is Codex's Phase 1 slice from the runtime-neutral spec: the race fix on its own, no broader refactor.
startup.org's existence check and wrap-it-up.org's rename now resolve through the helper, each with a singleton fallback so older checkouts that haven't synced the script still work. Wrap folds the agent id into the archive name so two agents wrapping in the same minute don't collide. protocols.org documents the rule. Verified with 5 bats cases and a two-agent simulation showing distinct paths per id.
Diffstat (limited to '.ai/workflows/wrap-it-up.org')
| -rw-r--r-- | .ai/workflows/wrap-it-up.org | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/.ai/workflows/wrap-it-up.org b/.ai/workflows/wrap-it-up.org index a55f475..7fc86e4 100644 --- a/.ai/workflows/wrap-it-up.org +++ b/.ai/workflows/wrap-it-up.org @@ -63,10 +63,16 @@ Get current time and rename: #+begin_src bash mkdir -p .ai/sessions now=$(date +%Y-%m-%d-%H-%M) -mv .ai/session-context.org .ai/sessions/${now}-DESCRIPTION.org +# Resolve the AI_AGENT_ID-aware source path (see protocols.org "Agent-scoped +# path"); fall back to the singleton if the helper isn't present. +sc=$(.ai/scripts/session-context-path 2>/dev/null || echo .ai/session-context.org) +# Under multi-agent, fold the agent id into the archive name so two agents +# wrapping in the same minute don't collide. Single-agent: no segment. +idseg="${AI_AGENT_ID:+${AI_AGENT_ID}-}" +mv "$sc" ".ai/sessions/${now}-${idseg}DESCRIPTION.org" #+end_src -Replace =DESCRIPTION= with your picked slug. +Replace =DESCRIPTION= with your picked slug. (=AI_AGENT_ID= should be filename-safe; the recommended =host.project.runtime.shortid= shape already is.) ** Step 3: todo.org cleanup (hygiene + archive completed work) |
