Episodic memory
Semantic memory
kiwifs init --template memory. It ships episodes/, pages/, log.md, and a playbook for ingest, recall, and consolidation.
Record and retire memories
- MCP
- REST
kiwi_remember writes an episode to episodes/<YYYY-MM-DD>/<episode_id>.md with memory_kind: episodic, a created timestamp, and optional scope and tags. It generates an episode_id when you omit one.kiwi_forget retires a page without deleting it. It sets memory_status: superseded, valid_until to now, and an optional superseded_reason, and keeps the body.Frontmatter conventions
memory_kind: what a page is
memory_kind: what a page is
Any page under the episodes prefix counts as episodic unless it sets
memory_kind: semantic or consolidation.memory_status: where a page is in its lifecycle
memory_status: where a page is in its lifecycle
scope: who a memory belongs to
scope: who a memory belongs to
Partition memories by user, project, or tenant with values such as
user:alice or project:billing. Pass scope to kiwi_search, kiwi_search_semantic, or GET /api/kiwi/search to see only that partition.Time: expires_at, ttl, valid_from, valid_until
Time: expires_at, ttl, valid_from, valid_until
expires_at (RFC3339) or ttl (such as 7d or 24h, counted from created) flag a page for review once it passes. kiwifs janitor reports it as expired-memory; nothing is deleted.valid_from and valid_until record when a fact was true, such as a policy that applied only for a quarter.contradicts: conflicting pages
contradicts: conflicting pages
Set
contradicts to the path or wiki link of a conflicting page, and prefer memory_status: contested over silently overwriting. The link is indexed with relation contradicts and appears in the target’s backlinks. KiwiFS records contradictions you declare; it does not detect them.Production versus consolidation
Two frontmatter lists answer different questions.
Coverage uses only
merged-from. An episode is identified by its episode_id, or id when that is absent.
pages/communication-preferences.md
type: episode with a matching id or path. Entries of type run, session, trace, event, or ingest with the same id also count, so consolidators that key on run IDs match too.
Consolidation workflow
1
Agents write episodes
Use
kiwi_remember, or write under episodes/ with X-Provenance and an episode_id.2
Find what is unmerged
Run the memory report and take the
unmerged list as your queue.3
Consolidate
Read those episodes, merge them into
pages/ with your model or rules, and list them in merged-from. Retire episodes you no longer need with kiwi_forget.4
Verify
Re-run the report until
unmerged is empty or acceptable.Memory report
- CLI
- REST
- MCP
Terminal
limit and offset page episodic_files and unmerged; the total_* fields stay unpaginated.
To use a folder other than episodes/ for the report and episode classification, set it in config. kiwi_remember always writes under episodes/.
.kiwi/config.toml