Skip to main content

Module db

Module db 

Source

Structs§

TaskMetadata
Read-only metadata bundle used by pack rendering (and TUI list teasers in v0.4.0+). Returns None for unknown tasks.
TaskRow
One row of the task list rendered by the TUI: enough to render the list view without round-tripping for each task. event_count joins events_index so we don’t need a second query per row.

Functions§

add_task_external
Append an external reference to tasks.external. The column is stored as a comma-separated list — small, append-mostly, no uniqueness constraint. Acceptable shapes (loose, not enforced): beads:claude-memory-rsw, github:#42, jira:PROJ-1234.
index_event
ingest_new_events
Read only the tail of the JSONL log since the last call. The cheap path for hot loops (every MCP tool invocation): scan to the marker, ingest the rest, update the marker.
list_all_projects
list_tasks_by_project
All tasks for a project, ordered with open ones first (by recency) then closed ones. The TUI list view binds directly to this — there is no other consumer, so the shape is tuned for that callsite.
open
rebuild_state
set_task_goal
Set or replace tasks.goal for an existing task. Caller is expected to have validated the task exists (via task_exists); we don’t error on no-op rows so the upsert pattern is uniform.
set_task_outcome
Set or replace the closure metadata. Pass None for outcome_tag to leave it unset; pass Some("done"|"abandoned"|"superseded") for a structured tag. Free-text outcome is the primary field.
task_exists
Returns whether a task with this id has been recorded in the derived state. Cheap O(1) lookup against the tasks primary key. Callers should run ingest_new_events first if they want to see the latest JSONL state.
task_metadata
task_status
Status string for an existing task (e.g. “open”, “closed”). Returns None when the task is unknown — caller decides whether that’s a hard error or a route-to-pending case.
upsert_task_from_event