Skip to content

resolve agent restoration (#1898) - #3235

Open
Rayatcoding wants to merge 1 commit into
dimensionalOS:mainfrom
Rayatcoding:yiming_#1898
Open

resolve agent restoration (#1898)#3235
Rayatcoding wants to merge 1 commit into
dimensionalOS:mainfrom
Rayatcoding:yiming_#1898

Conversation

@Rayatcoding

Copy link
Copy Markdown

Contribution path

Problem

Agent conversation state lives only in memory (McpClient._history). After dimos stop / process exit, the agent forgets prior turns. There is no way to resume a previous chat by session id.

Solution

  • Persist _history to STATE_DIR/agent_sessions/<UUID>.json
  • New dimos run assigns a fresh session UUID; restore only with --restore-session=<UUID>
  • CLI helpers: dimos agent sessions / update-summary / delete
  • Auto summary from first user message; optional user_summary for a custom display name

How to Test

Assumes a normal DimOS install (uv sync --extra all / see AGENTS.md) with dimos on PATH and OPENAI_API_KEY exported. Use two terminals if needed (one for dimos run, one for dimos agent-send).
Manual:

# Terminal 1 — start an agentic blueprint; note the printed session UUID
dimos run demo-skill
# Terminal 2 — send any chat message to the running agent
dimos agent-send "<your message>"
# Stop the run, then list saved sessions
dimos stop
dimos agent sessions
# expect: your UUID appears with a short summary and message count > 0
# Start again with the same UUID to restore history
dimos run demo-skill --restore-session=<UUID>
# Ask something that only makes sense if prior turns were restored
# (e.g. "What did I just ask you?")
dimos agent-send "<follow-up that depends on earlier context>"
# expect: agent continues from restored history, not a blank new session

Automated:
uv run pytest dimos/agents/mcp/test_session_store.py dimos/robot/cli/test_dimos.py::test_apply_agent_session_cli_assigns_new_id dimos/robot/cli/test_dimos.py::test_apply_agent_session_cli_restore dimos/robot/cli/test_dimos.py::test_apply_agent_session_cli_ignored_without_mcpclient dimos/robot/cli/test_dimos.py::test_apply_agent_session_cli_rejects_bad_id -q

## AI assistance

Cursor (assisted implementation). I reviewed and understand the changes.

## Checklist

- [x ] I have read and approved the [CLA](https://github.com/dimensionalOS/dimos/blob/main/CLA.md).

@github-actions github-actions Bot added the first-time-contributor PR opened by an author who had not previously committed to this repository label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first-time-contributor PR opened by an author who had not previously committed to this repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants