Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(agent): drop the todos adapter in favour of the session store

Steven Enamakelbdea6fb1abf6
diff --git a/crates/openhuman-core/src/agent/mod.rs b/crates/openhuman-core/src/agent/mod.rs
index 3d00d7cbe1..8c27bdb64b 100644
--- a/crates/openhuman-core/src/agent/mod.rs
+++ b/crates/openhuman-core/src/agent/mod.rs
@@ -71,7 +71,6 @@ pub mod stop_hooks;
/// definitions, prompts, tools, policy, checkpoints and progress remain here.
pub mod subagent_host;
pub mod tinyagents;
-pub mod todos;
pub mod tools;
pub mod triage;
/// Explicit per-turn host environment handed to the session an entry point runs.
diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rs
index 7a7087b332..73ea687087 100644
--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs
@@ -54,7 +54,6 @@ pub(crate) mod replay;
mod routes;
mod steering_forwarder;
pub(crate) mod stop_hooks;
-pub mod todos;
pub(crate) mod tool_registration;
mod turn_exec;
mod turn_middleware;
diff --git a/crates/openhuman-core/src/agent/tinyagents/todos.rs b/crates/openhuman-core/src/agent/tinyagents/todos.rs
deleted file mode 100644
index 3822d4a7d9..0000000000
--- a/crates/openhuman-core/src/agent/tinyagents/todos.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-//! The persisted store behind the session todo list.
-//!
-//! Todos are session state, the way Claude Code and Codex keep them: one list
-//! per conversation thread. Persisted in the
-//! agent's key-value store — the one thread goals use
-//! (`agent::goals::store`) — so a list survives a core restart instead of resetting with the old
-//! process-global `InMemoryStore`. The transcript still records every list
-//! the model wrote, and the frontend renders the latest one from the turn's
-//! `todo` tool call.
-
-use std::path::Path;
-use std::sync::Arc;
-
-use tinyagents_harness::store::Store;
-
-/// The store every session's list lives in, keyed by session/thread id: the
-/// current agent's key-value store in the storage backend. Resolved per call
-/// so it always reflects the caller's current workspace and tenant.
-pub fn session_todos_store(workspace_dir: &Path) -> Arc<dyn Store> {
- crate::agent::session_store::stores_or_ephemeral(workspace_dir).kv
-}
-
-/// Synthetic key for a tool call that has no session at all (a bare
-/// `Tool::execute` in a test).
-pub const SCRATCH_SESSION_ID: &str = "_scratch_";
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
index 8721cb8c73..d5130f9b02 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec.rs
@@ -542,7 +542,9 @@ async fn drive_turn(
.parent
.as_ref()
.filter(|_| todo_registered)
- .map(|parent| crate::agent::todos::ops::store(&parent.workspace_dir)),
+ .map(|parent| {
+ crate::agent::session_store::stores_or_ephemeral(&parent.workspace_dir).kv
+ }),
},
);
if let Some(scope) = run_context.response_shape.clone() {
diff --git a/crates/openhuman-core/src/agent/todos/mod.rs b/crates/openhuman-core/src/agent/todos/mod.rs
deleted file mode 100644
index 7d3d7fe314..0000000000
--- a/crates/openhuman-core/src/agent/todos/mod.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-//! OpenHuman adapters around the TinyAgents todo store.
-//!
-//! Design notes:
-//! - **Per-session scoped.** The list belongs to the agent session the turn
-//! runs in; there is no cross-session or app-wide list.
-//! - **In-memory scratch.** When no session context is available the
-//! process-global scratch store is used (tool invocations outside a chat
-//! session, tests).
-//! - **Markdown output.** Tool results include a rendered representation for
-//! the agent transcript.
-
-pub mod ops;
diff --git a/crates/openhuman-core/src/agent/todos/ops.rs b/crates/openhuman-core/src/agent/todos/ops.rs
deleted file mode 100644
index a3647dc057..0000000000
--- a/crates/openhuman-core/src/agent/todos/ops.rs
+++ /dev/null
@@ -1,78 +0,0 @@
-//! OpenHuman host adapter over TinyAgents' `todos`.
-//!
-//! A todo list is scoped to one agent session ([`TodoScope::Session`]) or,
-//! when a tool runs with no session at all, to a scratch list
-//! ([`TodoScope::Scratch`]). Both live in the workspace-scoped [`store`];
-//! validation, the whole-list write and rendering are TinyAgents'. This file
-//! only maps a scope onto a store key. `clear` is for tests and cleanup.
-
-use std::path::Path;
-use std::sync::Arc;
-
-use tinyagents_graph::todos::store as todos;
-use tinyagents_harness::store::Store;
-
-use crate::agent::tinyagents::todos::{session_todos_store, SCRATCH_SESSION_ID};
-use tinyagents_graph::todos::TodoItem;
-use tinyagents_graph::todos::TodosSnapshot;
-
-#[derive(Debug, Clone, PartialEq, Eq)]
-pub enum TodoScope {
- Session { id: String },
- Scratch,
-}
-
-impl TodoScope {
- pub fn session_id(&self) -> Option<&str> {
- match self {
- Self::Session { id } => Some(id),
- Self::Scratch => None,
- }
- }
-
- /// The store key this scope's list lives under.
- pub fn key(&self) -> &str {
- self.session_id().unwrap_or(SCRATCH_SESSION_ID)
- }
-}
-
-/// The workspace-scoped store every session's list lives in.
-pub fn store(workspace_dir: &Path) -> Arc<dyn Store> {
- session_todos_store(workspace_dir)
-}
-
-pub async fn replace(
- workspace_dir: &Path,
- scope: &TodoScope,
- items: Vec<TodoItem>,
-) -> Result<TodosSnapshot, String> {
- todos::replace(&store(workspace_dir), scope.key(), items)
- .await
- .map_err(|error| error.to_string())
-}
-
-pub async fn clear(workspace_dir: &Path, scope: &TodoScope) -> Result<TodosSnapshot, String> {
- todos::clear(&store(workspace_dir), scope.key())
- .await
- .map_err(|error| error.to_string())
-}
-
-pub async fn list(workspace_dir: &Path, scope: &TodoScope) -> Result<TodosSnapshot, String> {
- todos::list(&store(workspace_dir), scope.key())
- .await
- .map_err(|error| error.to_string())
-}
-
-#[cfg(test)]
-pub(crate) fn scratch_test_lock() -> tokio::sync::MutexGuard<'static, ()> {
- SCRATCH_TEST_LOCK.blocking_lock()
-}
-
-/// Async form for `#[tokio::test]` bodies, so the guard may be held across `.await`.
-#[cfg(test)]
-pub(crate) async fn scratch_test_lock_async() -> tokio::sync::MutexGuard<'static, ()> {
- SCRATCH_TEST_LOCK.lock().await
-}
-
-#[cfg(test)]
-static SCRATCH_TEST_LOCK: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(());
diff --git a/crates/openhuman-core/src/agent/tools/todo.rs b/crates/openhuman-core/src/agent/tools/todo.rs
index e23bd13573..555d8b7b2d 100644
--- a/crates/openhuman-core/src/agent/tools/todo.rs
+++ b/crates/openhuman-core/src/agent/tools/todo.rs
@@ -18,7 +18,6 @@
//! dropped by the rekey.
use crate::agent::harness::fork_context::ParentExecutionContext;
-use crate::agent::tools::todo::TodoScope;
use async_trait::async_trait;
use std::path::PathBuf;
use std::sync::Arc;