Memory Type | Position | Purpose | Example Usage Scenario | Sharing Scope |
User Memory | ~/.codebuddy/CODEBUDDY.md | Personal preferences applicable to all projects | Code style preferences and personal tool shortcuts | Personal only (all projects) |
User Rules | ~/.codebuddy/rules/*.md | Modular personal rules | Personal coding habits and common workflows | Personal only (all projects) |
Project Memory | ./CODEBUDDY.md or ./.codebuddy/CODEBUDDY.md | Team-shared instructions for the project | Project architecture, coding standards, and common workflows | Shared with team members through source code management |
Project Rules | ./.codebuddy/rules/*.md | Modular project instructions organized by topic | Language-specific guidelines, testing specifications, and API standards | Shared with team members through source code management |
Project Memory (Local) | ./CODEBUDDY.local.md | Personal project-specific preferences | Your sandbox URL and preferred test data | Personal only (current project) |
~/.codebuddy/CODEBUDDY.md and all rules under ~/.codebuddy/rules/.CODEBUDDY.md and CODEBUDDY.local.md files are recursively loaded upward from the current working directory..codebuddy/rules/ in the current working directory (rules in parent directories are not loaded).CODEBUDDY.md file in that subdirectory is dynamically loaded../CODEBUDDY.local.md.@path/to/import syntax. The following example imports 3 files:Check @README for a project overview and @package.json for available npm commands.# Additional Notes- Git workflow @docs/git-instructions.md
# Personal Preferences- @~/.codebuddy/my-project-instructions.md
This code span is not treated as an import: `@tencent-ai/codebuddy-code`
/memory command to view the loaded memory files./) and reads any CODEBUDDY.md or CODEBUDDY.local.md files it finds. This is especially convenient in large repositories when you run CodeBuddy Code in the foo/bar/ directory and have memory in both foo/CODEBUDDY.md and foo/bar/CODEBUDDY.md./memory/memory slash command in a session to open the memory management panel. In this panel, you can:MEMORY.md index file../CODEBUDDY.md or ./.codebuddy/CODEBUDDY.md.> /init
.codebuddy/rules/.codebuddy/rules/ directory to organize instructions into multiple files. This allows teams to maintain focused, well-organized rule files instead of a single large CODEBUDDY.md..codebuddy/rules/ directory:your-project/├── .codebuddy/│ ├── CODEBUDDY.md # Main project instructions│ └── rules/│ ├── code-style.md # Code style guide│ ├── testing.md # Testing standards│ └── security.md # Security requirements
.md files in .codebuddy/rules/ are automatically loaded as project memory with the same priority as .codebuddy/CODEBUDDY.md..codebuddy/rules/ in the current working directory (workDir), and rules in parent directories are not loaded. This ensures that the scope of rules is clear and unambiguous.Field | Type | Default Value | Description |
enabled | boolean | true | Whether to load this rule. When set to false, the rule is not loaded at all. |
alwaysApply | boolean | true | Whether to always apply this rule |
paths | string/string[] | - | glob pattern of file paths that trigger the rule |
alwaysApply and paths:alwaysApply | paths | Rule Type | Behavior |
true (default) | Any | ALWAYS | Always inject into the context. |
false | Has a value | MANUAL (conditional trigger) | Triggers only when an operation matches a file. |
false | None | Not supported | The rule is not loaded. |
---# alwaysApply defaults to true and can be omitted.---# General code standards- Use 2-space indentation- Keep a blank line at the end of the file.
---alwaysApply: falsepaths: src/api/**/*.ts---# API Development Rules- All API endpoints must include input validation.- Use the standard error response format.- Include OpenAPI documentation comments.
---enabled: false---# Rules not currently in use
paths field is not limited to the .codebuddy/rules/ directory. It can be used in all memory files, including CODEBUDDY.md and CODEBUDDY.local.md.paths field supports standard glob patterns and has the matchBase option enabled:Mode | Match |
**/*.ts | All TypeScript files in any directory |
*.ts | All TypeScript files in any directory (matchBase mode) |
src/**/* | All files in the src/ directory |
*.md | Markdown files in any directory |
src/components/*.tsx | React components in a specific directory |
*.ts) match files in any directory. For example, *.ts can match src/utils/helper.ts.---paths: src/**/*.{ts,tsx}---# TypeScript/React Rules
src/**/*.ts and src/**/*.tsx. You can also combine multiple patterns with commas:---paths: {src,lib}/**/*.ts, tests/**/*.test.ts---
.codebuddy/rules/├── frontend/│ ├── react.md│ └── styles.md├── backend/│ ├── api.md│ └── database.md└── general.md
.md files are discovered recursively..codebuddy/rules/ directory supports symbolic links, allowing you to share common rules across multiple projects:# Sharing Rule Directories via Symbolic Linksln -s ~/shared-codebuddy-rules .codebuddy/rules/shared# Symbolically Linking a Single Rule Fileln -s ~/company-standards/security.md .codebuddy/rules/security.md
~/.codebuddy/rules/:~/.codebuddy/rules/├── preferences.md # Your personal coding preferences└── workflows.md # Your preferred workflows
testing.md or api-design.md).paths frontmatter only when a rule genuinely applies to specific file types.frontend/ or backend/)./config command to configure the preferred response language (see Settings Configuration for details), which is the simplest and most direct method:> /config# Select Language and enter your preferred language, such as "Simplified Chinese".
## CodeBuddy Added Memories### Language Preferences- Write code comments in Chinese.- Write commit messages in Chinese.
~/.codebuddy/CODEBUDDY.md)## CodeBuddy Added Memories### Tool Preferences- Use pnpm instead of npm### Code Preferences- Prefer a functional programming style- Prioritize code readability.
/config rather than configuring it in the memory file../CODEBUDDY.md)## CodeBuddy Added Memories### Project Architecture- Use a microservices architecture.- Frontend: React + TypeScript- Backend: Node.js + Express### Team Conventions- A PR requires review by two people.- Follow Conventional Commits.
./CODEBUDDY.local.md)## CodeBuddy Added Memories### Local Development Configuration- Database port: 5433- Use debug mode.- Skip CI quick tests.
~/.codebuddy/memories/{project-id}/~/.codebuddy/memories/global/MEMORY.md index file, and its first 200 lines are automatically loaded into the session context. Detailed memory content should be stored in separate topic files (such as preferences.md and decisions.md) and linked from MEMORY.md./config panel./memory command panel.settings.json: "memory": { "autoMemoryEnabled": false }CODEBUDDY_DISABLE_AUTO_MEMORY=1Type | Purpose | Example |
user | User roles, goals, preferences, and knowledge background | The user is a senior backend engineer and is proficient in Go. |
feedback | User corrections and guidance for CodeBuddy behavior | Do not mock the database in tests. |
project | Work, goals, and decisions in ongoing projects | Freeze non-critical merges starting next Wednesday. |
reference | References to external systems and resources | bug tracking is in the Linear project INGEST. |
---name: User roledescription: The user's professional background and technical expertisetype: user---The user is a senior backend engineer with 10 years of Go experience, but is new to the React frontend of the project.
settings.json: "memory": { "typedMemory": false }CODEBUDDY_TYPED_MEMORY_ENABLED=falseOperation | Reload | Description |
Process Restart | Yes | Cache Cleared |
Edit via /memory | Yes | Automatically Clear Cache |
/clear Command | No | Clear Message History Only |
Manually Modify Files | No | Manual Restart Required |
Add/Delete Rule Files | No | Manual Restart Required |
CODEBUDDY.md file exists in the project, project-level memory uses CODEBUDDY.md. Otherwise, AGENTS.md is used.AGENTS.md to CODEBUDDY.md. The system detects it automatically, and CODEBUDDY.md is loaded with priority.@path/to/file/memory to view the list of loaded rules.--- delimiter).@import syntax to reference them instead of including them directly.Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback