Expand description
Open Loops — track unresolved tasks / TODOs / open questions.
Distinct from the regular long-term store: an open loop is a memory item the agent flagged as “still in progress”. The agent can list open loops at session-start to remember what was left unfinished, and resolve them when the task completes.
Storage: output/open_loops.bin (magic OPL1)
Entry: 22 bytes header + text bytes
[u8 magic 4 = “OPL1”] (file header only)
[u64 id]
[u64 ts_ms]
[u8 importance]
[u8 status (0=open, 1=resolved, 2=archived)]
[u32 text_len]
[bytes text_len]
The current max id is stored in output/open_loops.idx as plain text
(decimal, with newline). Resolution works by appending a new entry
with the same id and status=resolved — the log stays append-only and
read_open() returns the latest status per id.
Structs§
Constants§
Functions§
- append_
open - Append a new loop. Assigns an id automatically, persists next-id, and returns the assigned id. Status is open by default.
- archive
- Archive a loop (similar to resolve but distinguishable).
- next_id
- Returns the next available id (max+1), starting at 1.
Reads
output/open_loops.idx. If missing, returns 1. - read_
all - Read all entries (raw log). Each id may appear multiple times if it
was resolved/archived — use
read_latestfor current status. - read_
latest - Read current status of all known loops (latest entry per id wins).
- read_
open - Return only currently-open loops (latest status = open), sorted by importance desc, then ts desc.
- resolve
- Mark a loop resolved. Returns Ok(true) if a matching open id was found, Ok(false) if not (already resolved or unknown id).