Documentation
¶
Overview ¶
Package todos exposes per-(agent, session) TODO management as ADK tools. The list is stored under the session-state key "todos", which is the same key the contextguard plugin from adk-utils-go inspects on every summarisation pass: it forwards the items to the summariser prompt and asks the resuming model to restore them. The net effect is that a task list authored by the model survives context compaction without baifo doing anything beyond writing to the well-known key.
Scope follows session scope:
- root agent → SQLite-backed session → todos survive restart (thanks to AppendEvent now merging StateDelta into the persisted session state; see internal/sessions/sqlite.go).
- workers → InMemoryService session → todos die with the worker, which is what we want for a one-shot worker.
We intentionally don't share state across agents. Each agent's session has its own "todos" key and the contextguard plugin keys its summary cache by agent name as well.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClearResult ¶
type ClearResult struct {
OK bool `json:"ok"`
}
ClearResult acknowledges the wipe.
type ListResult ¶
type ListResult struct {
Todos []TodoItem `json:"todos"`
}
ListResult is the response of todos_list. We wrap the slice in a struct so functiontool can describe the JSON shape; a bare slice would also work but loses the field name in the schema.
type TodoItem ¶
type TodoItem struct {
Content string `json:"content"`
Status string `json:"status"`
ActiveForm string `json:"active_form,omitempty"`
}
TodoItem mirrors the shape contextguard expects so we serialise straight into the session state without an intermediate type.
Fields:
- Content: the task in imperative form ("Run the tests").
- Status: one of "pending", "in_progress", "completed". The summariser's prompt assumes these three; arbitrary strings work but disable the "you have N pending tasks" framing.
- ActiveForm: present continuous form shown while the task is in_progress ("Running the tests"). Optional, but encouraged because it makes the resumed prompt readable.
type Tools ¶
type Tools struct {
// contains filtered or unexported fields
}
Tools is the per-instance dependency bag. Today it carries just a mutex to serialise read-modify-write across concurrent tool calls (ADK can batch function_calls within one model turn). The type stays a struct so future deps (audit, rate-limits) slot in without churn at the call sites.
type UpdateArgs ¶
type UpdateArgs struct {
Index int `json:"index"`
Status string `json:"status,omitempty"`
Content string `json:"content,omitempty"`
ActiveForm string `json:"active_form,omitempty"`
}
UpdateArgs patches a single item by index. Empty string fields mean "leave the existing value alone"; this matches the way the model naturally thinks about an update ("mark item 2 completed") without forcing it to re-emit the whole list.
type UpdateResult ¶
type UpdateResult struct {
OK bool `json:"ok"`
}
UpdateResult acknowledges the patch.
type WriteArgs ¶
type WriteArgs struct {
Todos []TodoItem `json:"todos"`
}
WriteArgs is the input of todos_write. The whole list is replaced — there's no append semantics — because Claude-style "rewrite the plan" gives the model the simplest mental model and avoids ordering bugs across parallel tool calls.
type WriteResult ¶
type WriteResult struct {
Count int `json:"count"`
}
WriteResult reports how many items were stored, mainly for the LLM's own sanity check after a write.