Skip to content

Memory

CodeBuddy Code supports persisting key information as "memories", which are automatically provided as context in subsequent conversations and tasks. This reduces the need for repeated explanations and enhances collaboration efficiency.

Memory Scope

  • User-level (user): Stores information related to personal long-term preferences and habits

  • Project-level (project): Stores general information shared across the current project

Corresponding file locations:

  • User-level: ~/.codebuddy/CODEBUDDY.md

  • Project-level: ./CODEBUDDY.md

Memory content is appended to the "## CodeBuddy Added Memories" section in the file.

@import References

Memory files support referencing other file segments via @<path>, allowing you to reuse existing rules or conventions from other documents:

  • Supports both relative and absolute paths

  • Referenced content is expanded and included in the context at runtime

  • Can be used to include team conventions, API contracts, conventional commit rules, etc.

Example:

bash
## CodeBuddy Added Memories
@./docs/team-conventions.md
- The default project branch is main

Suggestion: For large documents, split the conventions into independent Markdown files and use @ references in the memory files for easier maintenance.

How to Add Memories

Method 1: Use the /memory Slash Command

The /memory command allows you to quickly manage memory files:

bash
/memory

Executing this command will open the memory management interface, where you can choose:

  • Project memory: Save to ./CODEBUDDY.md

  • User memory: Save to ~/.codebuddy/CODEBUDDY.md

After choosing, the corresponding memory file will automatically open, and you can directly edit and add memory content.

Method 2: Edit the Memory File Directly

You can also directly edit the memory files mentioned above and append facts as list items under the "CodeBuddy Added Memories" section.

Guidelines:

  • Fact: The fact to be saved. It should be concise, verifiable, and reusable.

  • Scope: user | project (achieved by selecting the corresponding file to edit)

De-duplication: If the same entry already exists, do not add it again.

Usage in Sessions

  • When starting a session, user-level and project-level memories will automatically load as implicit context.

  • The model will reference these memories when generating responses, planning, and making tool calls.

File Format

Memory files are in Markdown format:

bash
## CodeBuddy Added Memories
- The team defaults to using the gpt-5 model
- Test coverage requirement 80%

The system ensures correct line breaks and separations between existing content and the memory section.

Best Practices

  • Write long-term preferences and conventions into user or project memories

  • Keep the granularity of facts "verifiable", "reusable", and "strongly task-related"

Notes

  • Memory writing will create/update the corresponding file in the project root directory or user directory

  • If the file does not exist, it will be created automatically

  • The /memory command supports quick access and editing of memory files