Skip to content

Memory

SQLite-backed memory: action_log and memory_summary.

All reads and writes use the stdlib sqlite3 module directly — no ORM, no mocks. Tests must use a real temp-file or in-memory database.

CLASS DESCRIPTION
MemoryStore

Persistent action memory backed by a SQLite database.

Classes

MemoryStore

MemoryStore(db_path: Path)

Persistent action memory backed by a SQLite database.

Creates the database file and schema on first use. The connection is kept open for the lifetime of the instance; call :meth:close (or use as a context manager) when done.

PARAMETER DESCRIPTION
db_path

Filesystem path to the SQLite database file. Intermediate directories are created automatically.

TYPE: Path

METHOD DESCRIPTION
__enter__

Return self for use as a context manager.

__exit__

Close the connection on context exit.

close

Close the database connection.

get_last_polled

Return the last-polled timestamp for repo, or None if never polled.

get_memory_summary

Return the stored summary for a (repo, issue_id) pair, or None.

log_action

Append a decision record to action_log.

set_last_polled

Persist the last-polled timestamp for repo.

upsert_memory_summary

Insert or replace the memory summary for a (repo, issue_id) pair.

Functions

__enter__
__enter__() -> MemoryStore

Return self for use as a context manager.

__exit__
__exit__(*_: object) -> None

Close the connection on context exit.

close
close() -> None

Close the database connection.

get_last_polled
get_last_polled(repo: str) -> datetime | None

Return the last-polled timestamp for repo, or None if never polled.

PARAMETER DESCRIPTION
repo

Repository in owner/repo format.

TYPE: str

RETURNS DESCRIPTION
datetime | None

The stored :class:~datetime.datetime (timezone-aware UTC), or

datetime | None

None if no poll has been recorded for this repo.

get_memory_summary
get_memory_summary(repo: str, issue_id: int) -> str | None

Return the stored summary for a (repo, issue_id) pair, or None.

PARAMETER DESCRIPTION
repo

Repository in owner/repo format.

TYPE: str

issue_id

GitHub issue number.

TYPE: int

RETURNS DESCRIPTION
str | None

The LLM-generated summary string, or None if absent.

log_action
log_action(repo: str, issue_id: int, task_type: str, decision: DecisionType, rationale: str | None, actions: list[ActionItem]) -> None

Append a decision record to action_log.

PARAMETER DESCRIPTION
repo

Repository in owner/repo format.

TYPE: str

issue_id

GitHub issue number.

TYPE: int

task_type

Task type string (e.g. issue.triage).

TYPE: str

decision

The agent's decision.

TYPE: DecisionType

rationale

Human-readable explanation, or None.

TYPE: str | None

actions

Ordered list of actions the harness will execute.

TYPE: list[ActionItem]

set_last_polled
set_last_polled(repo: str, timestamp: datetime) -> None

Persist the last-polled timestamp for repo.

PARAMETER DESCRIPTION
repo

Repository in owner/repo format.

TYPE: str

timestamp

The datetime at which the poll completed.

TYPE: datetime

upsert_memory_summary
upsert_memory_summary(repo: str, issue_id: int, summary: str) -> None

Insert or replace the memory summary for a (repo, issue_id) pair.

PARAMETER DESCRIPTION
repo

Repository in owner/repo format.

TYPE: str

issue_id

GitHub issue number.

TYPE: int

summary

LLM-generated summary of prior actions on this issue.

TYPE: str