Memory
Memory in ka agent is two systems with one rule between them: nothing becomes durable knowledge without an operator act.
Stable memory (ka-agent-memory)
Section titled “Stable memory (ka-agent-memory)”-
Format: Markdown files under
<data>/memory/:profile.md,persona.md,preferences.md,environment.md,conventions.md,facts.md,projects/<slug>.md. Each entry is one bullet plus a provenance comment:- prefers concise Spanish answers in Telegram<!-- id: mem_1a2b…; source: operator; accepted: 2026-10-15T14:03:11Z --> -
Git backing:
<data>/memory/is a git repository. Every accepted change is a commit (memory: accept <id>,memory: forget <id>);git logis the memory audit trail. The compiledMEMORY.mdis gitignored derived state. -
Compilation: files concatenate in priority order (profile → persona → preferences → environment → conventions → projects → facts) under a
# Ka Agent memoryheader, provenance stripped, capped at a 6 KB budget; files that do not fit are truncated entry by entry. The result lands at<engine-home>/.config/ka/MEMORY.md, which ka re-reads per prompt: memory updates need no worker restart.
Commands (console and Telegram)
Section titled “Commands (console and Telegram)”| Command | Effect |
|---|---|
/remember <fact> |
Explicit operator acceptance: appends to facts.md, recompiles, commits. |
/forget <id> |
Removes the entry, recompiles, commits. |
/memory |
Report: files, bytes, budget %, truncated flag; /status carries a memory line (memory 4.1/6 KB · 2 to review); on the web panel, entries and the exact compiled text. |
/memory files |
The per-file report (what each file holds and how full it is). |
/memory log |
The last 10 memory commits: the git history is the memory audit trail. |
/memory undo |
Reverts the last memory commit (the git history is the undo). |
/memory review |
Pending candidates as bullet diffs: target file, the + <text> line, the entry it lands after, and the dry-run compile impact (compiled N/B, and whether the budget would then truncate). |
/memory accept <id> / /memory reject <id> |
Settle a candidate into stable memory (or reject it). |
On the CLI, ka-agent memory show | edit | path [file] inspects and edits the Markdown files directly (file: facts by default, or profile, persona, preferences, environment, conventions); an edit recompiles and commits.
Candidates
Section titled “Candidates”The model can propose memories through the kagent__memory_propose MCP tool (1-300 chars, third person, no secrets). A proposal names its target file: facts (default), preferences, environment, or profile. Proposals are screened, land in SQLite as pending candidates, and surface three ways: the /memory review queue, the web review inbox, and one-tap cards on the phone (✅ Remember / ✖ Discard); the press accepts or rejects and the card edits to its outcome. There is no conversational auto-promotion: the only paths into stable memory are your explicit /remember and your acceptance of a candidate. Conversational noise, tool results and error output never reach it. A candidate records the acting user; acceptance lands it in that user’s memory root, so team members never write into each other’s memory.
Acceptance is screen, then snapshot, then apply with rollback: the stored text is re-screened at accept time (rules may have tightened since filing, and a candidate that fails today’s screen is refused), the target file is snapshotted, and any failure (git missing, compile error) restores the snapshot byte-for-byte and refuses, so memory never lands half-applied.
Proposals are refused at the gate for: private conversations; scheduled turns (cron, briefing and trigger turns can neither read personal memory nor propose it); a budget verdict at 80% of a cap or exceeded; a rate-limit error on the user’s newest turn inside 30 minutes; and a live session with fewer than [memory] extraction_min_turns recorded turns (default 5; 0 = off). Removal and edit proposals stay a non-goal: /forget is the only removal path.
Scheduled turns run on machine facts
Section titled “Scheduled turns run on machine facts”A turn sourced from cron, the briefing or a trigger runs against an automation compile of memory: only environment.md and conventions.md (machine facts) are kept; profile, persona, preferences, projects and facts are dropped. The daemon installs the lean compile right before the scheduled submit and restores the full compile at every exit of that bracket: the cycle’s terminal points (before any drain) and the error paths of the submit itself. A cron can therefore neither read nor feed on personal memory, and the cron-to-memory feedback loop is closed at both ends.
Limits: only daemon death inside a scheduled span leaves the lean compile installed (until the next boot or memory change), and that degrades answers, never a leak: variants compile from the same per-user root. Two processes refreshing mid-span race benignly; the worst case is a scheduled turn seeing full memory.
Switching in from another agent
Section titled “Switching in from another agent”ka-agent import hermes (also openclaw, claude, codex; --dry-run lists without writing) reads the other agent’s memory and skills. The rules hold on the way in: another agent’s memory arrives as candidates you accept one by one, and skills land in the shared library (~/.ka-agent/skills/).
Episodic memory (history)
Section titled “Episodic memory (history)”Every completed turn is indexed into SQLite FTS5 at the idle boundary: one row for the inbound text, one for the final answer.
| Command | Effect |
|---|---|
/history <query> |
Full-text search, top 5 results with turn id and snippet. Leading-position filters narrow it: model:<id>, after:<YYYY-MM-DD> (parsed in the profile timezone) and status:<queued|submitted|running|done|error|aborted|interrupted|killed>; a filter token mid-query is ordinary searchable text. With a filter and no text, the command lists newest-first turns under the same predicates (the caller’s own; the admin’s listing spans users). |
/history show <turn_id> |
The stored exchange: your message and the answer. |
The model has the same recall: the kagent__history_search and kagent__history_show bridge tools (read-only, bounded snippets, no grant needed) let an answer cite what was actually said before.
History is an index, not instruction: episodic content never becomes stable memory without acceptance.
Private conversations
Section titled “Private conversations”A private conversation (/new private, see sessions) writes nothing: memory_propose and skill_propose are refused for the session’s turns, /remember and notes_append answer with a refusal, no episode rows are indexed, and every scheduling path (/remind, /cron, the cron_manage tool) refuses. Usage accounting (model, tokens, cost) still records, with no text. When the conversation ends, its queued messages and approval cards are deleted from the store with secure_delete and a WAL checkpoint, so the text leaves the database file.