211 lines
4.8 KiB
Markdown
211 lines
4.8 KiB
Markdown
|
|
# LLM Memory System
|
||
|
|
|
||
|
|
## Purpose
|
||
|
|
|
||
|
|
This vault maintains **persistent knowledge** that helps the LLM understand:
|
||
|
|
|
||
|
|
1. **Who you are** — Your expertise, goals, working style
|
||
|
|
2. **How you want to collaborate** — Feedback, preferences, constraints
|
||
|
|
3. **Project context** — Ongoing work, decisions, deadlines
|
||
|
|
4. **External resources** — Tools, links, references
|
||
|
|
|
||
|
|
## Why This Matters
|
||
|
|
|
||
|
|
Without persistent memory, each conversation starts from scratch. This system allows the LLM to:
|
||
|
|
- Remember your preferences across sessions
|
||
|
|
- Build on previous decisions
|
||
|
|
- Avoid repeating mistakes
|
||
|
|
- Provide context-aware assistance
|
||
|
|
|
||
|
|
## How It Works
|
||
|
|
|
||
|
|
### File-Based Storage
|
||
|
|
|
||
|
|
All memories are stored as **Markdown files** with YAML frontmatter:
|
||
|
|
|
||
|
|
```yaml
|
||
|
|
---
|
||
|
|
name: example_memory
|
||
|
|
description: Short description
|
||
|
|
type: feedback
|
||
|
|
created: 2026-05-15
|
||
|
|
---
|
||
|
|
```
|
||
|
|
|
||
|
|
### Bi-directional Linking
|
||
|
|
|
||
|
|
Memories link to related notes using `[[wikilinks]]`:
|
||
|
|
|
||
|
|
```markdown
|
||
|
|
See also: [[tier2-setup-retro]], [[bumakopania-research]]
|
||
|
|
```
|
||
|
|
|
||
|
|
### Tagging System
|
||
|
|
|
||
|
|
Use tags for filtering and querying:
|
||
|
|
- `#type/user`
|
||
|
|
- `#type/feedback`
|
||
|
|
- `#type/project`
|
||
|
|
- `#type/reference`
|
||
|
|
|
||
|
|
## Memory Types
|
||
|
|
|
||
|
|
### User Memories (`memories/user/`)
|
||
|
|
|
||
|
|
About **you** — your role, expertise, goals, preferences.
|
||
|
|
|
||
|
|
**When to create:**
|
||
|
|
- Learning about your background
|
||
|
|
- Understanding your goals
|
||
|
|
- Noting your expertise level
|
||
|
|
|
||
|
|
**Example:**
|
||
|
|
```markdown
|
||
|
|
---
|
||
|
|
name: senior-kdb-developer
|
||
|
|
description: Senior developer working with KDB/time-series data
|
||
|
|
type: user
|
||
|
|
---
|
||
|
|
```
|
||
|
|
|
||
|
|
### Feedback Memories (`memories/feedback/`)
|
||
|
|
|
||
|
|
**Guidance** on how the LLM should work with you.
|
||
|
|
|
||
|
|
**When to create:**
|
||
|
|
- After corrections ("no, not that")
|
||
|
|
- After confirmations ("yes, exactly")
|
||
|
|
- When establishing preferences
|
||
|
|
|
||
|
|
**Structure:**
|
||
|
|
- **The Rule** — What to do/avoid
|
||
|
|
- **Why** — Reason behind it
|
||
|
|
- **How to Apply** — When it matters
|
||
|
|
|
||
|
|
**Example:**
|
||
|
|
```markdown
|
||
|
|
---
|
||
|
|
name: no-summary-responses
|
||
|
|
description: Keep responses terse, no trailing summaries
|
||
|
|
type: feedback
|
||
|
|
---
|
||
|
|
|
||
|
|
## The Rule
|
||
|
|
Don't summarize what you just did at the end of every response.
|
||
|
|
|
||
|
|
## Why
|
||
|
|
User can read the diff; summaries are redundant.
|
||
|
|
|
||
|
|
## How to Apply
|
||
|
|
After making code changes, just show the diff. No "I've updated X, Y, Z" summary.
|
||
|
|
```
|
||
|
|
|
||
|
|
### Project Memories (`memories/project/`)
|
||
|
|
|
||
|
|
**Ongoing work** — decisions, context, deadlines.
|
||
|
|
|
||
|
|
**When to create:**
|
||
|
|
- Starting new initiatives
|
||
|
|
- Recording decisions
|
||
|
|
- Noting deadlines/constraints
|
||
|
|
|
||
|
|
**Structure:**
|
||
|
|
- **Fact/Decision** — What's happening
|
||
|
|
- **Why** — Motivation
|
||
|
|
- **How to Apply** — Impact on work
|
||
|
|
- **Timeline** — Dates, status
|
||
|
|
|
||
|
|
**Example:**
|
||
|
|
```markdown
|
||
|
|
---
|
||
|
|
name: tier2-setup-2026-05-14
|
||
|
|
description: Setting up local knowledge database (kiwix-serve + zim-llm)
|
||
|
|
type: project
|
||
|
|
status: active
|
||
|
|
---
|
||
|
|
```
|
||
|
|
|
||
|
|
### Reference Memories (`memories/reference/`)
|
||
|
|
|
||
|
|
**External resources** — tools, links, documentation.
|
||
|
|
|
||
|
|
**When to create:**
|
||
|
|
- Finding useful resources
|
||
|
|
- Recording tool configurations
|
||
|
|
- Noting where to find information
|
||
|
|
|
||
|
|
**Example:**
|
||
|
|
```markdown
|
||
|
|
---
|
||
|
|
name: offline-docs-sources
|
||
|
|
description: Sources for offline documentation (Kiwix, LibGen, etc.)
|
||
|
|
type: reference
|
||
|
|
url: https://download.kiwix.org/
|
||
|
|
---
|
||
|
|
```
|
||
|
|
|
||
|
|
## Workflow
|
||
|
|
|
||
|
|
### Adding New Memories
|
||
|
|
|
||
|
|
1. **Identify type** — user, feedback, project, or reference
|
||
|
|
2. **Create note** — Use appropriate template
|
||
|
|
3. **Fill frontmatter** — Name, description, type
|
||
|
|
4. **Add content** — Rule/fact, why, how to apply
|
||
|
|
5. **Link related** — Add `[[wikilinks]]` to connected notes
|
||
|
|
|
||
|
|
### Finding Memories
|
||
|
|
|
||
|
|
1. **Graph view** — Visualize connections
|
||
|
|
2. **Search** — Ctrl/Cmd + Shift + F
|
||
|
|
3. **Tag pane** — Filter by type
|
||
|
|
4. **Backlinks** — See what links here
|
||
|
|
5. **Smart Connections** (plugin) — Semantic search
|
||
|
|
|
||
|
|
### Maintaining Quality
|
||
|
|
|
||
|
|
- **Be specific** — Clear rules, concrete examples
|
||
|
|
- **Include why** — Context helps with edge cases
|
||
|
|
- **Update regularly** — Remove outdated info
|
||
|
|
- **Link generously** — Build knowledge graph
|
||
|
|
|
||
|
|
## Integration with LLM
|
||
|
|
|
||
|
|
### Automatic Loading
|
||
|
|
|
||
|
|
The LLM loads `MEMORY.md` and all `.md` files in this directory at the start of each session.
|
||
|
|
|
||
|
|
### Manual Recall
|
||
|
|
|
||
|
|
Ask the LLM to:
|
||
|
|
- "Check memory for X"
|
||
|
|
- "What do you know about Y?"
|
||
|
|
- "Remember that Z"
|
||
|
|
|
||
|
|
### LLM Plugins
|
||
|
|
|
||
|
|
For advanced features:
|
||
|
|
- **Smart Connections** — Vector search
|
||
|
|
- **ObsidianLLM** — AI-assisted writing
|
||
|
|
- **Templater** — Dynamic templates
|
||
|
|
|
||
|
|
## Best Practices
|
||
|
|
|
||
|
|
1. **Save immediately** — Don't wait to add feedback
|
||
|
|
2. **Be concise** — One idea per note
|
||
|
|
3. **Use templates** — Consistent structure
|
||
|
|
4. **Link everything** — Build the knowledge graph
|
||
|
|
5. **Review regularly** — Archive outdated memories
|
||
|
|
|
||
|
|
## Migration from Previous System
|
||
|
|
|
||
|
|
This system builds on the existing file-based structure:
|
||
|
|
- Existing `.md` files remain in root
|
||
|
|
- New memories go in `memories/{type}/`
|
||
|
|
- Templates ensure consistency
|
||
|
|
- Obsidian adds linking, search, visualization
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
**Related:** [[MEMORY.md]], [[README.md]]
|