Memory and history
What kcode remembers between sessions, how to manage it, and how to search every past conversation.
kcode keeps two records. Memory holds short facts that later sessions recall. History holds every conversation as it was written.
Memory
The agent saves a memory when it learns something a later session needs: a preference, a project rule, the cause of a past bug. Later sessions search the store. A memory belongs to the user or to one project.
| Command | Result |
|---|---|
/memory |
Lists the stored memories. |
/memory save |
Opens a form to write one. |
/memory search <query> |
Ranks the matches by relevance, confidence and recency. |
/memory delete <name> |
Removes one. |
Consolidation
A background run reads recent sessions and distils durable facts into new memories, at most three per run. It is on by default and waits for a day and five new sessions between runs.
| Command | Result |
|---|---|
/memory consolidate |
Runs it now. |
/memory consolidate off |
Turns the automatic run off. on turns it back on. |
Automatic recall
With memory.auto_recall = true in ~/.kcode/config.toml, kcode adds the best-matching memories to each turn without a search by the agent. This is off by default.
History
Compaction shortens what the model reads, never the saved conversation. Every message, reply, tool result and image stays saved and searchable.
/search <words>or⌘⇧Fsearches this session, this project or all sessions.Tabchanges the scope, and Return opens the match in its session.- The agent searches and reads past exchanges itself when a task refers to earlier work.
/shareexports the session as Markdown and JSONL to<project>/.kcode/sessions/.