feat(skills): add qmd skill for vault search and memory, deprecate SQLite memory
- Add skills/qmd/SKILL.md: qmd-based knowledge retrieval and memory system - Search workflows: BM25, vector semantic, hybrid+rerank modes - Memory write patterns via direct filesystem writes to ~/CODEX/80-memory/ - Session summary workflow for capturing work at session end - Auto-recall pattern for context injection at session start - Deprecate skills/memory/SKILL.md: SQLite-based memory replaced by qmd - qmd provides superior hybrid search over entire vault - No external OpenAI embedding dependency - Uses local GPU (7900 XTX) for embeddings and reranking - Update skills/obsidian/SKILL.md: remove memory search sections - Memory search now handled by qmd skill - Keep CRUD operations and daily notes functionality - Update integration table to reference qmd Related: CODEX vault updated with memory template, session-summary template, and sessions directory. qmd collections and context annotations configured.
This commit is contained in:
@@ -218,7 +218,8 @@ curl -X POST "http://127.0.0.1:27124/create-note" \
|
|||||||
| Research note | research | Save research findings with tags |
|
| Research note | research | Save research findings with tags |
|
||||||
| Project note | task-management | Link tasks to project notes |
|
| Project note | task-management | Link tasks to project notes |
|
||||||
| Plan document | plan-writing | Save generated plan to vault |
|
| Plan document | plan-writing | Save generated plan to vault |
|
||||||
| Memory note | memory | Create/read memory notes in 80-memory/ |
|
| Vault search | qmd | Search vault content via qmd hybrid search |
|
||||||
|
| Memory note | qmd | Create/read memory notes in 80-memory/ |
|
||||||
|
|
||||||
## Best Practices
|
## Best Practices
|
||||||
|
|
||||||
@@ -232,97 +233,15 @@ curl -X POST "http://127.0.0.1:27124/create-note" \
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Memory Folder Conventions
|
## Memory System
|
||||||
|
|
||||||
The `80-memory/` folder stores dual-layer memories synced with Mem0.
|
Memory storage and retrieval is handled by the **qmd skill** (`skills/qmd/SKILL.md`).
|
||||||
|
|
||||||
### Structure
|
- **Search**: Use qmd for searching vault content (hybrid BM25 + vector + reranking)
|
||||||
|
- **Write**: Use this skill's REST API or direct filesystem writes for creating/updating notes
|
||||||
|
- **Structure**: `80-memory/` folder with subdirectories (preferences, facts, decisions, entities, other, sessions)
|
||||||
|
|
||||||
```
|
See the qmd skill for memory workflows, session summaries, and auto-recall patterns.
|
||||||
80-memory/
|
|
||||||
├── preferences/ # Personal preferences (UI, workflow, communication)
|
|
||||||
├── facts/ # Objective information (role, tech stack, constraints)
|
|
||||||
├── decisions/ # Choices with rationale (tool selections, architecture)
|
|
||||||
├── entities/ # People, organizations, systems, concepts
|
|
||||||
└── other/ # Everything else
|
|
||||||
```
|
|
||||||
|
|
||||||
### Naming Convention
|
|
||||||
|
|
||||||
Memory notes use kebab-case: `prefers-dark-mode.md`, `uses-typescript.md`
|
|
||||||
|
|
||||||
### Required Frontmatter
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
---
|
|
||||||
type: memory
|
|
||||||
category: # preference | fact | decision | entity | other
|
|
||||||
mem0_id: # Mem0 memory ID (e.g., "mem_abc123")
|
|
||||||
source: explicit # explicit | auto-capture
|
|
||||||
importance: # critical | high | medium | low
|
|
||||||
created: 2026-02-12
|
|
||||||
updated: 2026-02-12
|
|
||||||
tags:
|
|
||||||
- memory
|
|
||||||
sync_targets: []
|
|
||||||
---
|
|
||||||
```
|
|
||||||
|
|
||||||
### Key Fields
|
|
||||||
|
|
||||||
| Field | Purpose |
|
|
||||||
|-------|---------|
|
|
||||||
| `mem0_id` | Links to Mem0 entry for semantic search |
|
|
||||||
| `category` | Determines subfolder and classification |
|
|
||||||
| `source` | How memory was captured (explicit request vs auto) |
|
|
||||||
| `importance` | Priority for recall ranking |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Memory Note Workflows
|
|
||||||
|
|
||||||
### Create Memory Note
|
|
||||||
|
|
||||||
When creating a memory note in the vault:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Using REST API
|
|
||||||
curl -X POST "http://127.0.0.1:27124/create-note" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{
|
|
||||||
"path": "80-memory/preferences/prefers-dark-mode.md",
|
|
||||||
"content": "---\ntype: memory\ncategory: preference\nmem0_id: mem_abc123\nsource: explicit\nimportance: medium\ncreated: 2026-02-12\nupdated: 2026-02-12\ntags:\n - memory\nsync_targets: []\n---\n\n# Prefers Dark Mode\n\n## Content\n\nUser prefers dark mode in all applications.\n\n## Context\n\nStated during UI preferences discussion on 2026-02-12.\n\n## Related\n\n- [[UI Settings]]\n"
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Read Memory Note
|
|
||||||
|
|
||||||
Read by path with URL encoding:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl -X GET "http://127.0.0.1:27124/read-note?path=80-memory%2Fpreferences%2Fprefers-dark-mode.md"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Search Memories
|
|
||||||
|
|
||||||
Search within memory folder:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl -X GET "http://127.0.0.1:27124/search?q=dark%20mode&path=80-memory"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Update Memory Note
|
|
||||||
|
|
||||||
Update content and frontmatter:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
curl -X PUT "http://127.0.0.1:27124/update-note" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{
|
|
||||||
"path": "80-memory/preferences/prefers-dark-mode.md",
|
|
||||||
"content": "# Updated content..."
|
|
||||||
}'
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
191
skills/qmd/SKILL.md
Normal file
191
skills/qmd/SKILL.md
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
---
|
||||||
|
name: qmd
|
||||||
|
description: "Knowledge retrieval and memory system via qmd (Query Markup Documents). Use when: (1) Searching knowledge vault for relevant context, (2) Storing memories, decisions, preferences from sessions, (3) Auto-recall of relevant context at session start, (4) Writing session summaries, (5) Querying past decisions or project context. Triggers: 'remember', 'recall', 'search vault', 'what did we decide', 'session summary', 'qmd', 'knowledge', 'memory', 'context'."
|
||||||
|
compatibility: opencode
|
||||||
|
---
|
||||||
|
|
||||||
|
# qmd
|
||||||
|
|
||||||
|
Primary retrieval + memory workflow using qmd v2.0.1 over the already-indexed `qmd://CODEX/` vault.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- `qmd` installed globally and available in `PATH`
|
||||||
|
- `CODEX` collection configured and indexed
|
||||||
|
- Vault at `~/CODEX/` with memory folders under `80-memory/`
|
||||||
|
|
||||||
|
Verify runtime state:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
qmd status
|
||||||
|
```
|
||||||
|
|
||||||
|
## Search Workflows
|
||||||
|
|
||||||
|
Default to `qmd query` unless a narrower mode is clearly better.
|
||||||
|
|
||||||
|
### 1) BM25 Keyword Search (Fast)
|
||||||
|
|
||||||
|
Use when exact terms, filenames, tags, or known phrases are likely present.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
qmd search "query"
|
||||||
|
qmd search "query" --md --full -n 5
|
||||||
|
qmd search "query" --json -n 10
|
||||||
|
qmd search "query" -c memory --md -n 5
|
||||||
|
qmd search "query" --min-score 0.3 --all --files
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2) Vector Semantic Search
|
||||||
|
|
||||||
|
Use when the concept is known but wording is uncertain.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
qmd vsearch "query"
|
||||||
|
qmd vsearch "query" --md --full -n 5
|
||||||
|
qmd vsearch "query" --json -n 10
|
||||||
|
qmd vsearch "query" -c memory --md -n 5
|
||||||
|
qmd vsearch "query" --min-score 0.3 --all --files
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3) Hybrid + Rerank (Best Quality, Default)
|
||||||
|
|
||||||
|
Use for high-confidence retrieval, ambiguous queries, and session bootstrap.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
qmd query "query"
|
||||||
|
qmd query "query" --md --full -n 5
|
||||||
|
qmd query "query" --json -n 10
|
||||||
|
qmd query "query" -c memory --md -n 5
|
||||||
|
qmd query "query" --min-score 0.3 --all --files
|
||||||
|
```
|
||||||
|
|
||||||
|
## Document Retrieval
|
||||||
|
|
||||||
|
Use retrieval commands after search to pull exact documents.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
qmd get "path/to/file.md"
|
||||||
|
qmd get "#docid"
|
||||||
|
qmd multi-get "80-memory/sessions/*.md"
|
||||||
|
qmd multi-get "file1.md, file2.md"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Memory Write Workflows
|
||||||
|
|
||||||
|
qmd is read-only. Write memory notes directly to filesystem, then re-index.
|
||||||
|
|
||||||
|
Memory note file pattern:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/CODEX/80-memory/{category}/{slug}.md
|
||||||
|
```
|
||||||
|
|
||||||
|
Required frontmatter:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
type: memory
|
||||||
|
category: preference # preference | fact | decision | entity | other
|
||||||
|
source: opencode # opencode | manual
|
||||||
|
importance: medium # critical | high | medium | low
|
||||||
|
session: # opencode session ID for traceability (optional)
|
||||||
|
project: # [[Project Name]] if project-specific (optional)
|
||||||
|
created: YYYY-MM-DD
|
||||||
|
updated: YYYY-MM-DD
|
||||||
|
tags:
|
||||||
|
- memory
|
||||||
|
- preference
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
Content template:
|
||||||
|
|
||||||
|
- `# {Title}`
|
||||||
|
- `## Content` → concise factual memory
|
||||||
|
- `## Context` → when/why captured
|
||||||
|
- `## Related` → WikiLinks to related notes
|
||||||
|
|
||||||
|
Category decision guide:
|
||||||
|
|
||||||
|
| Signal | Category | Example |
|
||||||
|
|--------|----------|---------|
|
||||||
|
| "I prefer...", "I like...", "Always use..." | preference | Prefers Nix over Docker |
|
||||||
|
| "We use...", "The stack is...", "My role is..." | fact | Tech stack is NixOS + TypeScript |
|
||||||
|
| "Let's go with...", "We decided...", reasoning about choices | decision | Chose qmd for memory retrieval |
|
||||||
|
| Person name, org, system, API | entity | Tobi Lütke - Shopify CEO |
|
||||||
|
| Doesn't fit above | other | |
|
||||||
|
|
||||||
|
## Session Summary Workflow
|
||||||
|
|
||||||
|
Write at session end or when explicitly requested.
|
||||||
|
|
||||||
|
Session file pattern:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/CODEX/80-memory/sessions/YYYY-MM-DD-{slug}.md
|
||||||
|
```
|
||||||
|
|
||||||
|
Frontmatter:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
type: session-summary
|
||||||
|
created: YYYY-MM-DD
|
||||||
|
session: # opencode session ID
|
||||||
|
project: # [[Project Name]]
|
||||||
|
duration: # approximate
|
||||||
|
tags:
|
||||||
|
- memory
|
||||||
|
- session
|
||||||
|
---
|
||||||
|
```
|
||||||
|
|
||||||
|
Content template:
|
||||||
|
|
||||||
|
- `# Session: {Brief Description}`
|
||||||
|
- `## What Was Done` → completed work bullets
|
||||||
|
- `## Decisions Made` → decision + short rationale (+ WikiLink if significant)
|
||||||
|
- `## Open Questions` → unresolved items
|
||||||
|
- `## Files Changed` → key file list + one-line deltas
|
||||||
|
- `## Next Steps` → next executable actions
|
||||||
|
|
||||||
|
## Auto-Recall Workflow
|
||||||
|
|
||||||
|
At session start, proactively retrieve context before deep work.
|
||||||
|
|
||||||
|
1. Determine project/task context from working directory, git repo, and user goal.
|
||||||
|
2. Retrieve general relevant knowledge:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
qmd query "{relevant context}" --md --full -n 3 -c CODEX
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Retrieve project memory context:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
qmd query "{project name}" --md -n 3 -c memory
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Inject only relevant excerpts; cap recall to ~2000 tokens.
|
||||||
|
|
||||||
|
This workflow is advisory and should be run proactively by the agent.
|
||||||
|
|
||||||
|
## Re-indexing
|
||||||
|
|
||||||
|
After creating or editing memory/session files, update index for immediate recall.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
qmd update
|
||||||
|
```
|
||||||
|
|
||||||
|
Indexing also runs periodically; use manual update when immediate searchability is required.
|
||||||
|
|
||||||
|
## Integration with Other Skills
|
||||||
|
|
||||||
|
| From | To | Pattern |
|
||||||
|
|------|----|---------|
|
||||||
|
| qmd search | Any skill | Retrieve relevant context before starting work |
|
||||||
|
| brainstorming | qmd write | Save brainstorm decisions as memory notes |
|
||||||
|
| Any session | qmd write | Capture session summaries at session end |
|
||||||
|
| qmd search | obsidian | Find note to update, then use Obsidian skill for CRUD |
|
||||||
Reference in New Issue
Block a user