Memory management for AI coding and platform agents

AI coding agents deliver better results when they remember facts about your project and your preferences. Without memory you would have to remind the agent about naming convention…

AI coding agents deliver better results when they remember facts about your project and your preferences. Without memory you would have to remind the agent about naming conventions, build commands and architectural patterns in every session. Different tools implement memory in different ways. This post compares the memory systems in GitHub Copilot, Claude Code, Kiro and Codex and offers guidance on creating and managing them.

Why memory matters

Memory lets agents persist context across interactions. When an agent knows your conventions, preferred tools and design decisions, it can generate more consistent and accurate suggestions. It also enables cross-feature sharing: in GitHub Copilot, facts and preferences captured by one feature can be used by another. The result is fewer repeated prompts and less need for long custom instructions.

GitHub Copilot Memory

GitHub Copilot includes an agentic memory feature that stores repository-level facts and user-level preferences. Repository facts cover conventions, build commands and cross-file dependencies, and are available to any user with access to Copilot Memory in that repository. Such facts are only created in response to actions by users with write access who have memory enabled. User-level preferences capture personal coding style and are visible only to that user's Copilot interactions, although on Business and Enterprise plans an organisation or enterprise administrator can export or delete them.

Copilot memory is currently used by the Copilot coding agent, Copilot code review and the Copilot CLI, and facts captured by one of these can be reused by another. Any stored fact or preference that goes unused is automatically deleted after a period of disuse (28 days at the time of writing), and the timer can reset when Copilot validates and uses an entry. Note the scoping: repository-level facts can only be used in operations on the same repository, while user-level preferences follow the user across their interactions rather than being tied to one repository. Repository owners can review and manually delete the repository-level facts stored for their repository.

Claude Code memory

Claude Code uses two mechanisms: CLAUDE.md files and auto memory. CLAUDE.md is a markdown file you write yourself that contains instructions and context for the agent. You can scope it at the project level (committed to your repository), the user level (~/.claude/CLAUDE.md) or the organisation level through a managed policy file. CLAUDE.md files are loaded in full regardless of length, though Anthropic recommends targeting under 200 lines per file because longer files reduce adherence.

Auto memory is a separate mechanism. Claude maintains a MEMORY.md entrypoint under ~/.claude/projects//memory/ and writes notes there as you work. The first 200 lines of MEMORY.md, or the first 25 KB, whichever comes first, are loaded at the start of every conversation. This load limit applies only to MEMORY.md, not to CLAUDE.md. Auto memory requires a recent version of Claude Code and is on by default; you can manage it with the /memory command. Write CLAUDE.md as clear imperative instructions, such as "Always use pytest" or "Do not use synchronous file operations", and include the reason where it helps.

Kiro steering files

Kiro persists context through steering files. These markdown files live in .kiro/steering/ for workspace-specific guidance or ~/.kiro/steering/ for global conventions. Three foundational files are included: product.md describes the purpose, users and goals, tech.md records frameworks, libraries and technical constraints, and structure.md describes file organisation, naming conventions and architectural decisions. Steering files support inclusion modes: always (the default), fileMatch for conditional loading, manual for on-demand inclusion, and auto. Kiro also recognises AGENTS.md, which is always included and does not use inclusion modes.

To manage steering files well, keep each one focused on a single domain, such as api-standards.md or testing-standards.md, and explain why decisions were made. Review them periodically and treat changes the way you treat code changes, through review and CI checks.

Codex memory

Codex has a memory feature that stores generated facts, preferences and project context across sessions. Memories are stored under ~/.codex/memories/ and you control them with the /memories command in the Codex app and TUI. The feature is generated automatically rather than added through manual commands; it is off by default and you enable it by setting memories = true under the [features] table in config.toml. At launch it is not available in the UK, the EEA or Switzerland. For team-wide instructions, use AGENTS.md rather than memory, and reserve memory for personal preferences such as which package manager to use or where a module lives.

Custom memory management

When customising memory for any agent:

  1. Scope appropriately. Use global files for preferences that apply everywhere and project-specific files for repository rules. In Kiro that means separating .kiro/steering/ from ~/.kiro/steering/. In Claude Code, use project and user CLAUDE.md. In Codex, use memory for personal preferences and AGENTS.md for team policies.
  2. Write clear, actionable instructions. Agents follow explicit commands better than prose. State what to do ("Use pytest, not unittest") and what to avoid.
  3. Review and prune regularly. Memory can grow stale. Copilot memories expire after a period of disuse. For Claude Code and Kiro, schedule periodic reviews to update instructions and delete obsolete guidance.
  4. Protect sensitive data. Never put secrets or credentials in memory files. Copilot memory, CLAUDE.md, steering files and Codex memories all live on disk, so treat them as part of your codebase or dotfiles.

Conclusion

Persistent context is a core part of modern AI coding agents. Copilot stores repository facts and user preferences, Claude Code uses CLAUDE.md and auto memory, Kiro relies on steering files and Codex offers an opt-in memory feature for personal conventions. By understanding and managing these mechanisms, you can make your agents more consistent and productive while keeping your workflows under control.