Hawa Code supports memory functionality that can remember user preferences across sessions, such as development language, project architecture, code style, etc. The memory system automatically injects this information into every conversation to help Hawa Code better understand your needs.
Memory Types
Hawa Code’s memory system is divided into 5 types, arranged by priority from high to low:
| Priority | Memory Type | File Path | Scope |
|---|---|---|---|
| 1 | Enterprise Policy | macOS: /Library/Application Support/hawacode/HAWA.mdLinux: /etc/hawacode/HAWA.mdWindows: C:\ProgramData\hawacode\HAWA.md |
System-level global policy for enterprise deployments |
| 2 | User Memory | ~/.hcode/HAWA.md |
User-level global memory applicable to all projects |
| 3 | User Rules | ~/.hcode/rules/**/*.md |
User-level rule files with path matching support |
| 4 | Project Memory | {project_path}/HAWA.md{project_path}/.hcode/HAWA.md |
Project-level memory files |
| 5 | Project Rules | {project_path}/.hcode/rules/**/*.md |
Project-level rule files with path matching support |
Memory File Format
Memory files use Markdown format and can contain any text content:
# My Preferences |
Path Matching Rules (Rules)
Rule files support defining matching patterns through the paths field in YAML frontmatter, enabling personalized rules for specific files or directories.
Rule File Format
--- |
Path Matching Syntax
The paths field supports glob pattern matching:
| Pattern | Description | Example |
|---|---|---|
* |
Matches any characters (except path separators) | *.js matches all JS files |
** |
Matches any directory level | src/**/*.ts matches all ts files in src and its subdirectories |
? |
Matches a single character | file?.txt matches file1.txt, fileA.txt, etc. |
! |
Exclusion pattern | !**/*.test.ts excludes test files |
Multiple Path Patterns
Multiple path patterns can be defined simultaneously:
--- |
Comma-separated string format is also supported:
--- |
Rule Triggering Mechanism
- Global Memory (Enterprise Policy, User Memory, Project Memory, Rules without paths): Automatically loaded at the start of each conversation
- Path-specific Rules (Rules with paths): Loaded on-demand and automatically triggered.
Usage Recommendations
1. User Memory (~/.hcode/HAWA.md)
Suitable for storing personal general preferences:
- Personal code style preferences
- Commonly used tech stacks
- Personal development habits
2. Project Memory (project_path/HAWA.md)
Suitable for storing project-specific information:
- Project architecture descriptions
- Project technical specifications
- Project directory structure conventions
3. Rule Files (rules/*.md)
Suitable for storing rules for specific file types:
- API development specifications
- Component writing specifications
- Test file specifications
- Configuration file specifications
Examples
User Memory Example
File: ~/.hcode/HAWA.md
# My Development Preferences |
Project Memory Example
File: project_path/HAWA.md
# Project Guidelines |
Path Rule Examples
File: .hcode/rules/api.md
--- |
File: .hcode/rules/react.md
--- |
Notes
- File Encoding: Memory files must use UTF-8 encoding
- File Format: Must be valid Markdown format
- Path Matching: The
pathsfield in rule files is optional; if not defined, rules are loaded as global rules - Performance: Avoid storing excessive content in memory files; only keep key preferences and rules