Persist session workspace context#19154
Conversation
90a93bb to
dfc8383
Compare
|
Rebased on the latest main and resolved the merge conflicts from the recent lazy session creation changes. Re-ran the focused checks:\n\n- |
dfc8383 to
5a0adbf
Compare
|
Rebased again on the latest main after the branch drifted into conflicts. The only manual conflict this time was in Re-ran:
GitHub now reports the PR as mergeable again. |
|
Thanks for the PR! The idea — persist session workspace so dashboards/resume flows can restore it — is sound, but right now the change writes two columns to If you resubmit alongside a consumer — e.g. |
Hi! Context: I’m a Korean developer and a heavy user of Codex and Claude Code-style agentic coding workflows. In those tools, persisted workspace context is part of what makes session resume feel reliable; I noticed Hermes doesn’t currently persist that context.
Hermes can restore transcript history, but it doesn’t persist which workspace/directories a session was associated with. For local CLI use this is often implicit, but for dashboards, remote clients, resume flows, and multi-repo workflows, it would be useful to persist at least the primary workspace and last cwd.
Summary
This PR adds a small first step toward persisted workspace context for sessions:
workspace_pathandlast_cwdcolumns to the session store.create_session()andensure_session()to persist those values.TERMINAL_CWD/os.getcwd()context for CLI-created sessions and fallback session creation.update_session_cwd()as a small SessionDB helper for callers that can observe cwd changes.tests/test_hermes_state.py.I kept this intentionally narrow. A richer follow-up could track multiple referenced workspaces/directories per session, but this gives clients a stable primary workspace and current/last cwd field without changing existing session behavior.
Tests
python3 -m py_compile hermes_state.py cli.py run_agent.pyuv run --extra dev pytest tests/test_hermes_state.py -qgit diff --check