anneal-memory

v0.1.1
io.github.phillipclapham/anneal-memory Checked 1 hour ago Published 8 months ago

Two-layer memory for AI agents with an immune system.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

record

Record a typed episode to memory. Call this when important decisions are made, patterns are noticed, tensions are identified, questions arise, or outcomes are observed. Record the reasoning, not just the fact — 'Chose X because Y' is more valuable than 'using X'. Episodes accumulate during a session and serve as raw material for compression into the continuity file at session end.

ParameterTypeDescription
content *stringThe episode content — what happened, what was observed, decided, or questioned.
episode_type *stringEpisode type. observation=pattern/insight, decision=committed choice, tension=conflict/tradeoff, question=open question, outcome=result of action, context=environmental/state info.
metadataobjectOptional JSON metadata to attach to the episode.
sourcestringAgent or source attribution. Defaults to 'agent'.

recall

Query episodes from memory with filters. Call this to find prior context before making decisions, to locate specific episodes for citation during graduation, or to review recent work. Returns matching episodes ordered by timestamp (newest first). Supports time range, type, source, and keyword filters.

ParameterTypeDescription
episode_typestringFilter by episode type.
keywordstringSearch episode content for this keyword.
limitintegerMaximum episodes to return. Default 100.
offsetintegerSkip first N matching episodes. Default 0.
sincestringISO 8601 timestamp — return episodes after this time.
sourcestringFilter by source/agent attribution.
untilstringISO 8601 timestamp — return episodes before this time.

prepare_wrap

Prepare a compression package for session wrap. Call this at session boundaries — when work is ending, the user says to wrap up, or the session is getting long. Returns all episodes since the last wrap, the current continuity file, stale pattern warnings, and compression instructions. Marks a wrap as in-progress. After calling, follow the returned instructions to compress episodes into an updated continuity file, then save with save_continuity. The compression step is where the real thinking happens — patterns emerge that weren't visible in the raw episodes.

ParameterTypeDescription
max_charsintegerMaximum size of the continuity file in characters. Default 20000.
staleness_daysintegerDays without validation before flagging patterns as stale. Default 7.

save_continuity

Validate and save the compressed continuity file. Call this after compressing your episodes using the instructions from prepare_wrap. The text must contain exactly 4 sections: ## State, ## Patterns, ## Decisions, ## Context. The server validates structure, checks graduation citations against real episodes (cited IDs must exist), checks explanation overlap (evidence must reference actual episode content), detects citation gaming (suspicious reuse of single episodes), and may demote ungrounded graduations. Returns validation results and section sizes.

ParameterTypeDescription
text *stringThe full continuity markdown to save. Must contain all 4 required sections.

status

Get memory health metrics. Call this at session start to understand memory state, or when diagnosing issues. Returns episode counts (total and since last wrap), wrap history, continuity file size, episodes by type, and whether a wrap is currently in progress.