Expand description
Timeline — chronological memory log with time-window queries.
Every store appends a TimelineEntry alongside the main append.bin, giving the agent the ability to recall “what happened today/yesterday/ last session” without relying on similarity ranking.
Binary format: output/timeline.bin (magic TML1)
Entry: 25 bytes header + text bytes
[u8 magic 4 = “TML1”]
[u64 ts_ms]
[u8 layer_id]
[u8 importance]
[u8 depth]
[u8 status (0=open, 1=resolved, 2=archived, 3=normal)]
[u32 text_len]
[bytes text_len]
Magic is written only once (file header). Subsequent entries are concatenated. Resolved/archived status flips are written as new entries so the log stays append-only.
Structs§
- Timeline
Entry - One chronological memory entry.
Enums§
- Time
Window - A time window descriptor used for filtering.
Constants§
- MAX_
TEXT_ LEN - STATUS_
ARCHIVED - STATUS_
NORMAL - Status byte in TimelineEntry.
- STATUS_
OPEN - STATUS_
RESOLVED
Functions§
- append_
entry - Append a TimelineEntry. Thread-safe-ish via O_APPEND on POSIX; on Windows the append mode also appends, but we serialize via FileLock at the caller.
- filter
- Filter entries by time window. For
LastSession, finds the last gap - filter_
at - Same as
filterbut with explicitnow_msfor deterministic testing. - format_
ts - Format an epoch_ms into “YYYY-MM-DD HH:MM” using a small pure-Rust calendar (UTC). Good enough for human display in tool output.
- now_
epoch_ ms - Current epoch in milliseconds.
- parse_
iso8601_ to_ epoch_ ms - Minimal ISO-8601 parser. Accepts: YYYY-MM-DD YYYY-MM-DDTHH:MM YYYY-MM-DDTHH:MM:SS YYYY-MM-DD HH:MM:SS Returns epoch_ms (UTC) or None.
- read_
all - Read all entries from the timeline log. Returns them in append order (oldest first) so the caller can sort/filter by window.