Add session name/ID persistence to runtime/pids/#11
Open
craftyc0der wants to merge 3 commits into
Open
Conversation
Each agent now records a {agent_id}.session.json file in
.orchestrator/runtime/pids/ when spawned, capturing:
- agent_id and cli_command (for resume flag selection)
- session_name (tmux session name, stable across restarts)
- session_id (null for now; populated later when extraction is wired up)
- spawned_at timestamp
AgentState gains session_name and session_id fields (serialized to
state.json). ProjectConfig gains a pids_dir field. Both spawn paths
(standalone and worker-group) write the file.
https://claude.ai/code/session_01BLqWThMChaJesFahQmYVuQ
Introduces a SessionAdapter trait with per-vendor implementations
(Claude, Gemini, Codex, Copilot, Cursor) that handle the differences
in spawn naming and resume command structure for each CLI tool.
A master OrchestratorSession record (runtime/sessions/<name>.json)
maps a single human-readable name to every agent's vendor session ID,
enabling all agents to be resumed with one flag.
New CLI flags on `orchestrator run`:
--session <name> Name this run; saves the session file after startup
--resume <name> Load a saved session; each agent starts with its
vendor resume flag (--resume, codex resume, etc.)
restoring prior context
How each vendor is handled:
claude --name <session_name> on spawn; --resume <name> to restore
gemini session ID extracted from ~/.gemini/tmp/*/chats/ (newest)
codex session ID from ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl
copilot session ID from ~/.copilot/session-state/ (newest dir)
cursor UUID extraction deferred (pane-capture step, future work)
https://claude.ai/code/session_01BLqWThMChaJesFahQmYVuQ
- Simplified the logic for checking agent command warnings in `check_agent_command_warnings` by consolidating conditions. - Updated the `open_terminal_window` function to improve readability. - Enhanced the handling of session-related commands in the `supervisor` module, introducing a new `command_with_session_mode` function to differentiate between fresh and resumed commands. - Improved error handling in session loading and saving functions to streamline the process. - Added new runtime paths for session management in tests to ensure proper directory structure. This refactor aims to enhance code clarity and maintainability while ensuring robust session management across agents.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Each agent now records a {agent_id}.session.json file in
.orchestrator/runtime/pids/ when spawned, capturing:
AgentState gains session_name and session_id fields (serialized to
state.json). ProjectConfig gains a pids_dir field. Both spawn paths
(standalone and worker-group) write the file.
https://claude.ai/code/session_01BLqWThMChaJesFahQmYVuQ