# CLAUDE.md โ Project Contract (Auto-Updated)
# CLAUDE.md โ Project Memory Contract
**Purpose**: Follow this in every session for this repo. Keep memory sharp. Keep outputs concrete. Cut rework.
## ๐ง Project Memory (Chroma)
Use server `chroma`. Collection `smart_mcp_memory`.
Log after any confirmed fix, decision, gotcha, or preference.
**Schema:**
- **documents**: 1โ2 sentences. Under 300 chars.
- **metadatas**: `{ "type":"decision|fix|tip|preference", "tags":"comma,separated", "source":"file|PR|spec|issue" }`
- **ids**: stable string if updating the same fact.
### Chroma Calls
```javascript
// Create once:
mcp__chroma__chroma_create_collection { "collection_name": "smart_mcp_memory" }
// Add:
mcp__chroma__chroma_add_documents {
"collection_name": "smart_mcp_memory",
"documents": ["<text>"],
"metadatas": [{"type":"<type>","tags":"a,b,c","source":"<src>"}],
"ids": ["<stable-id>"]
}
// Query (start with 5; escalate only if <3 strong hits):
mcp__chroma__chroma_query_documents {
"collection_name": "smart_mcp_memory",
"query_texts": ["<query>"],
"n_results": 5
}
```
## ๐ Retrieval Checklist Before Coding
1. Query Chroma for related memories.
2. Check repo files that match the task.
3. List open PRs or issues that touch the same area.
4. Only then propose changes.
## ๐ Memory Checkpoint Rules
**Every 5 interactions or after completing a task**, pause and check:
- Did I discover new decisions, fixes, or patterns?
- Did the user express any preferences?
- Did I solve tricky problems or learn about architecture?
If yes โ Log memory IMMEDIATELY using the schema above.
**During long sessions (>10 interactions)**:
- Stop and review: Have I logged recent learnings?
- Check for unrecorded decisions or fixes
- Remember: Each memory helps future sessions
## โก Activation
Read this file at session start.
Announce: **Contract loaded. Using Chroma project_memory.**
## ๐งน Session Hygiene
Prune to last 20 turns if context gets heavy. Save long outputs in `./backups/` and echo paths.
## ๐ Output Policy
For code, return unified diff or patchable files. For scripts, include exact commands and paths.
## ๐ก๏ธ Safety
No secrets in `.chroma` or transcripts. Respect rate limits. Propose batching if needed.
<!-- Auto-updated collection to smart_mcp_memory at 2025-10-16 16:45:28 -->