Skip to main content
Core concepts

How Memory Works

Overview

Qoder CLI CN reconstructs its context for every session — it does not automatically remember what was discussed in the previous session unless that information is explicitly saved. Understanding the mechanisms by which Qoder remembers information helps you solidify knowledge that should be kept long-term, while keeping irrelevant content from filling up the context. The information Qoder relies on comes mainly from three layers, each with a different lifecycle and purpose:
LayerLifecycleMaintained byTypical content
Conversation contextWithin the current sessionAccumulated automatically by QoderMessage history, tool calls, results
Project instructionsLong-term, with the projectYou or your teamAGENTS.md, rules
Long-term memoryLong-term, across sessionsTeam conventions + optional auto-memoryPreferences, project background, locations of external references

Conversation context

Conversation context is the history accumulated within the current session — your inputs, Qoder's replies, and every tool call with its result. It keeps Qoder coherent within a session, remembering what you discussed minutes ago. Conversation context has a few key characteristics:
  • Session-scoped: it exists only in the current session. When you start a new session, previous conversation context does not carry over automatically.
  • Limited capacity: the context window is finite. The longer the conversation, the more it consumes.
  • Manageable: you can actively clear or compact the context.

Managing conversation context

  • /clear: clears the conversation history context and starts a new session, letting you "start from scratch." Useful when switching to a completely unrelated new task.
  • /compact: summarizes and compresses the current session's history context into a leaner form, freeing context space while retaining key information. Good for the middle of a long session when context starts getting tight.
When the conversation is very long and context pressure is high, Qoder also compacts when needed. For related performance and context troubleshooting, see Performance, Context, and Long-Session Issues.

Project instructions

Project instructions are static memory explicitly written by you or your team to tell Qoder about the project's structure, development standards, and collaboration conventions. They are provided to the model as context in every session, so Qoder follows team conventions. There are two main forms:
  • AGENTS.md: Qoder CLI CN's default context file name, suited for overall project descriptions and stable conventions. Common locations include the user-level ~/.qoder-cn/AGENTS.md, project-level <project>/AGENTS.md, and local project-level <project>/AGENTS.local.md.
  • Rules: Markdown rule files under <project>/.qoder/rules/, split by topic or file scope — a good replacement for a single bloated AGENTS.md.
You can run /init in a project to generate AGENTS.md automatically, or use /memory to manage memory files at all levels. See Memory for the full description.
Project instructions are context provided to the model, not enforced policy. If you need to hard-block certain commands, tools, or paths, use Permissions and Directory Trust or Hooks.

Long-term memory

Long-term memory is information retained across sessions. Besides the static memory maintained by the team above (AGENTS.md, rules), Qoder CLI CN also supports auto-memory: when enabled, Qoder saves information learned from conversations that remains useful later into local Markdown memory files — for example your preferences, feedback, project background, and the locations of external reference material. Where to view and manage auto-memory:
  • Open the auto-memory folder from the /memory panel.
  • Run /memory manage to manage automatically saved memory topic files.
Auto-memory is likewise provided to the model as context, helping Qoder carry forward previously accumulated understanding in new sessions. See Memory.

How the three work together

When a session starts, Qoder loads the applicable project instructions and long-term memory and injects them into the context as background; as the conversation progresses, conversation context keeps accumulating. Together they form the complete background Qoder relies on for decisions:
  • Conversation context answers "where are we in this session."
  • Project instructions answer "what conventions must be followed in this project."
  • Long-term memory answers "what preferences and background should be remembered across sessions."
To make a piece of knowledge last, write it into the project instructions or save it as long-term memory; temporary information relevant only to the current task can stay in the conversation context, cleaned up with /clear or /compact when needed.