@naveenadi/mnemonic 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -7
- package/SKILL.md +64 -104
- package/package.json +4 -2
- package/references/link-graph.md +25 -0
- package/references/pi-integration.md +117 -0
- package/references/setup.md +86 -0
- package/src/pi-extension/package.json +11 -0
package/README.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
On-device hybrid search for markdown knowledge bases. BM25 + vector + LLM reranking with link graphs, time decay, and HyDE. Designed for [pi](https://github.com/earendil-works/pi) coding agent.
|
|
4
4
|
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
### Global mode (default)
|
|
8
|
+
|
|
9
|
+
All collections share one index at `~/.cache/mnemonic/index.sqlite`. Search everything at once.
|
|
10
|
+
|
|
5
11
|
```bash
|
|
6
12
|
npm install -g @naveenadi/mnemonic
|
|
7
13
|
mne init
|
|
@@ -11,6 +17,18 @@ mne embed
|
|
|
11
17
|
mne query "what was the Q4 planning discussion"
|
|
12
18
|
```
|
|
13
19
|
|
|
20
|
+
### Project-local mode
|
|
21
|
+
|
|
22
|
+
Use `--db` for a per-repo index. Keeps project docs separate.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
mne --db .mnemonic/index.sqlite init
|
|
26
|
+
mne --db .mnemonic/index.sqlite collection add . --name myproject
|
|
27
|
+
mne --db .mnemonic/index.sqlite index
|
|
28
|
+
mne --db .mnemonic/index.sqlite embed
|
|
29
|
+
mne --db .mnemonic/index.sqlite query "deploy steps"
|
|
30
|
+
```
|
|
31
|
+
|
|
14
32
|
## Features
|
|
15
33
|
|
|
16
34
|
- **Hybrid search** — BM25 (FTS5) + Vector embeddings + RRF fusion
|
|
@@ -27,17 +45,31 @@ mne query "what was the Q4 planning discussion"
|
|
|
27
45
|
|
|
28
46
|
## Pi Integration
|
|
29
47
|
|
|
30
|
-
Three layers
|
|
48
|
+
Three layers plus an interactive setup command, each installable **globally** (all projects) or **per project**.
|
|
49
|
+
|
|
50
|
+
| Layer | What | Global path | Per-project path |
|
|
51
|
+
|---|---|---|---|
|
|
52
|
+
| **Interactive** | `/mne init` walks through setup | — | — |
|
|
53
|
+
| **MCP server** | Typed tools: `query`, `get`, `multi_get`, `status` | `~/.pi/agent/mcp.json` | `.pi/mcp.json` |
|
|
54
|
+
| **Pi skill** | Bash commands via `SKILL.md` | `~/.pi/agent/skills/mnemonic/` | `.pi/skills/mnemonic/` |
|
|
55
|
+
| **Pi extension** | 4 tools + `/mne` command via `pi.registerTool/Command` | `~/.pi/agent/extensions/mnemonic/` | `.pi/extensions/mnemonic/` |
|
|
31
56
|
|
|
32
|
-
|
|
33
|
-
|---|---|---|
|
|
34
|
-
| **Pi Skill** | `SKILL.md` | Bash commands via `mne search`, `mne query`, `mne get` |
|
|
35
|
-
| **MCP Server** | `mne mcp` | Stdio + HTTP, typed tools: `query`, `get`, `multi_get`, `status` |
|
|
36
|
-
| **Pi Extension** | `src/pi-extension/index.ts` | 4 custom tools registered with `pi.registerTool()` |
|
|
57
|
+
### Interactive setup (extension required)
|
|
37
58
|
|
|
38
|
-
|
|
59
|
+
After installing the extension and running `/reload`, type:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
/mne init
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
This walks through: scope (global vs project) → add directories → index → embed → configure MCP → install skill.
|
|
66
|
+
|
|
67
|
+
Other commands: `/mne add <path>`, `/mne status`, `/mne help`.
|
|
68
|
+
|
|
69
|
+
### MCP — global
|
|
39
70
|
|
|
40
71
|
```json
|
|
72
|
+
// ~/.pi/agent/mcp.json
|
|
41
73
|
{
|
|
42
74
|
"mcpServers": {
|
|
43
75
|
"mnemonic": {
|
|
@@ -49,6 +81,38 @@ Configure MCP in `~/.pi/agent/mcp.json`:
|
|
|
49
81
|
}
|
|
50
82
|
```
|
|
51
83
|
|
|
84
|
+
### MCP — per project
|
|
85
|
+
|
|
86
|
+
Same config in `.pi/mcp.json` (project root).
|
|
87
|
+
|
|
88
|
+
### Skill — global
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
mkdir -p ~/.pi/agent/skills/mnemonic
|
|
92
|
+
cp SKILL.md ~/.pi/agent/skills/mnemonic/
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Skill — per project
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
mkdir -p .pi/skills/mnemonic
|
|
99
|
+
cp SKILL.md .pi/skills/mnemonic/
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Extension — global
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
mkdir -p ~/.pi/agent/extensions/mnemonic
|
|
106
|
+
cp src/pi-extension/index.ts ~/.pi/agent/extensions/mnemonic/
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Extension — per project
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
mkdir -p .pi/extensions/mnemonic
|
|
113
|
+
cp src/pi-extension/index.ts .pi/extensions/mnemonic/
|
|
114
|
+
```
|
|
115
|
+
|
|
52
116
|
## Architecture
|
|
53
117
|
|
|
54
118
|
```
|
|
@@ -88,6 +152,14 @@ mne orphans Find orphan documents
|
|
|
88
152
|
mne mcp Start MCP server
|
|
89
153
|
```
|
|
90
154
|
|
|
155
|
+
## References
|
|
156
|
+
|
|
157
|
+
- `SKILL.md` — Pi skill for agentic workflows (dig loop, cross-reference, setup)
|
|
158
|
+
- `references/setup.md` — Detailed CLI setup and diagnostics
|
|
159
|
+
- `references/pi-integration.md` — Pi integration: MCP, skill, extension (both modes)
|
|
160
|
+
- `references/link-graph.md` — Cross-reference commands and usage
|
|
161
|
+
- `src/pi-extension/` — Pi extension source + standalone package.json
|
|
162
|
+
|
|
91
163
|
## License
|
|
92
164
|
|
|
93
165
|
MIT
|
package/SKILL.md
CHANGED
|
@@ -1,158 +1,118 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mnemonic
|
|
3
|
-
description: Search local markdown knowledge bases
|
|
3
|
+
description: Search local indexed markdown knowledge bases. Use when the user asks to find notes, dig up a concept from personal docs, cross-reference ideas across wikis, or answer from indexed local files. Triggers on "look up in notes", "search my docs", "what did I write about", "find in my vault", "check my index", "retrieve from mne".
|
|
4
4
|
license: MIT
|
|
5
|
-
compatibility: Requires mnemonic CLI. Install via `npm install -g @naveenadi/mnemonic`.
|
|
5
|
+
compatibility: Requires `@naveenadi/mnemonic` CLI. Install via `npm install -g @naveenadi/mnemonic`.
|
|
6
6
|
metadata:
|
|
7
7
|
version: "0.1.0"
|
|
8
8
|
allowed-tools: Bash(mne:*)
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
# mnemonic —
|
|
11
|
+
# mnemonic — dig your local index
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
mnemonic runs searches against a local SQLite index of markdown files — notes, docs, wikis, vaults. Three branches: **dig** (the loop), **setup** (add collections), **cross-reference** (follow links between documents). Most runs only need the dig loop.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
knowledge bases. Use it before web search when the answer may already be in
|
|
17
|
-
indexed local files.
|
|
15
|
+
## Dig loop
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
1. Check what's indexed with `mne status`.
|
|
22
|
-
2. Search for candidate documents.
|
|
23
|
-
3. Retrieve the full source with `mne get` or `mne multi-get`.
|
|
24
|
-
4. Answer from retrieved text, citing paths or docids.
|
|
25
|
-
|
|
26
|
-
Do not answer from snippets alone when the user needs facts, decisions, quotes,
|
|
27
|
-
or nuance. Snippets are only leads.
|
|
28
|
-
|
|
29
|
-
Typical loop:
|
|
17
|
+
Run through every time. Every **dig** completes when the answer cites the documents it came from — **docid** and **line numbers** on every claim.
|
|
30
18
|
|
|
31
19
|
```bash
|
|
20
|
+
# 1. Check what's indexed
|
|
32
21
|
mne status
|
|
33
|
-
mne query "merchant reality support interviews" -n 5
|
|
34
|
-
# leads: #abc123 concepts/customer-proximity.md; #def432 sources/merchant-call.md
|
|
35
|
-
mne get "#abc123" --no-line-numbers
|
|
36
22
|
```
|
|
37
23
|
|
|
38
|
-
## Pick the right search mode
|
|
39
|
-
|
|
40
|
-
Use **BM25 lexical search** when you know exact words, titles, names, code
|
|
41
|
-
symbols, or rare phrases:
|
|
42
|
-
|
|
43
24
|
```bash
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
25
|
+
# 2. Find candidates
|
|
26
|
+
# Exact terms? Use BM25:
|
|
27
|
+
mne search "cockpit OKR Goodhart" -n 5
|
|
47
28
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Write the fields yourself rather than leaning on query expansion. Combine exact
|
|
51
|
-
anchors with semantic recall:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
mne query $'intent: Find the concept note about metrics as instruments without letting OKRs replace judgment.\nlex: cockpit instruments OKR Goodhart metrics judgment\nvec: data informed not metric driven product judgment\nhyde: A concept note says metrics are useful like cockpit instruments, but leaders should remain data-informed rather than metric-driven because OKRs and dashboards can Goodhart product judgment.'
|
|
29
|
+
# Concept, vague wording, or the user paraphrases? Use hybrid with structured fields:
|
|
30
|
+
mne query $'intent: Find the concept note about metrics as instruments without replacing judgment.\nlex: cockpit instruments OKR Goodhart metrics\nvec: data informed not metric driven product judgment\nhyde: A concept note explains metrics are cockpit instruments that should inform, not drive, product judgment.'
|
|
55
31
|
```
|
|
56
32
|
|
|
57
|
-
Structured query fields
|
|
33
|
+
Structured query fields:
|
|
34
|
+
- `intent:` what you're trying to find **and what to avoid**
|
|
35
|
+
- `lex:` exact terms, titles, code symbols, rare words
|
|
36
|
+
- `vec:` paraphrase of the idea in natural language
|
|
37
|
+
- `hyde:` a hypothetical document that would answer the request
|
|
58
38
|
|
|
59
|
-
|
|
60
|
-
supply this.
|
|
61
|
-
- `lex:` exact terms, aliases, titles, code symbols, and rare words.
|
|
62
|
-
- `vec:` paraphrases the idea in natural language.
|
|
63
|
-
- `hyde:` a hypothetical document that would answer the request.
|
|
64
|
-
|
|
65
|
-
You do not need all four every time, but always supply at least `intent:` plus
|
|
66
|
-
one of `lex:`/`vec:`.
|
|
67
|
-
|
|
68
|
-
## Retrieve sources
|
|
69
|
-
|
|
70
|
-
Search results include docids like `#abc123` and `mne://` paths. Fetch them:
|
|
39
|
+
Always write `intent:` plus at least one of `lex:`/`vec:`. You know the domain and what to dodge — do not delegate this to the expansion model.
|
|
71
40
|
|
|
72
41
|
```bash
|
|
42
|
+
# 3. Retrieve matched documents
|
|
43
|
+
# Results carry a docid (#abc123) and mne:// path
|
|
73
44
|
mne get "#abc123"
|
|
74
|
-
mne get
|
|
45
|
+
mne get "#abc123:120:40" # 40 lines from line 120
|
|
75
46
|
mne multi-get "#abc123,#def432" --json
|
|
76
|
-
mne get "#abc123:120:40" # 40 lines starting at line 120
|
|
77
|
-
mne get mne://concepts/note.md -l 80 --from 200
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
Output is line-numbered by default and carries the docid:
|
|
81
|
-
|
|
82
|
-
```text
|
|
83
|
-
mne://concepts/note.md #abc123
|
|
84
|
-
---
|
|
85
47
|
|
|
86
|
-
|
|
87
|
-
2:
|
|
88
|
-
3: Treat dashboards like cockpit instruments...
|
|
48
|
+
# Output is line-numbered by default; cite line numbers with every claim
|
|
89
49
|
```
|
|
90
50
|
|
|
91
|
-
|
|
92
|
-
only when you need raw content to copy verbatim.
|
|
93
|
-
|
|
94
|
-
## Discover what is indexed
|
|
51
|
+
**Completion criterion**: every claim backed by a docid and line numbers. Do not answer from snippets alone — fetch the source.
|
|
95
52
|
|
|
96
53
|
```bash
|
|
97
|
-
|
|
98
|
-
mne
|
|
99
|
-
mne
|
|
100
|
-
mne ls concepts # List files in a collection
|
|
54
|
+
# 4. Scope collections when results drift
|
|
55
|
+
mne query "headcount autonomous agents" -c concepts -n 10
|
|
56
|
+
mne ls concepts # List files in a collection
|
|
101
57
|
```
|
|
102
58
|
|
|
103
|
-
|
|
59
|
+
## Cross-reference
|
|
60
|
+
|
|
61
|
+
After digging, follow links between documents to find connected context.
|
|
104
62
|
|
|
105
63
|
```bash
|
|
106
|
-
mne
|
|
107
|
-
mne
|
|
64
|
+
mne links #abc123 # Outgoing wikilinks
|
|
65
|
+
mne backlinks #abc123 # Incoming (what links here)
|
|
66
|
+
mne orphans # Documents with no links at all
|
|
67
|
+
mne query "deploy" --boost-links # Prefer well-linked docs
|
|
108
68
|
```
|
|
109
69
|
|
|
110
|
-
|
|
70
|
+
See [references/link-graph.md](references/link-graph.md) for full cross-reference commands.
|
|
111
71
|
|
|
112
|
-
##
|
|
72
|
+
## Setup
|
|
113
73
|
|
|
114
|
-
|
|
74
|
+
Never mutate the index unprompted. Only do this when the user asks to add a collection, index a new directory, or run diagnostics.
|
|
115
75
|
|
|
116
|
-
|
|
117
|
-
mne links #abc123 # Outgoing links
|
|
118
|
-
mne backlinks #abc123 # Incoming links (what links to this)
|
|
119
|
-
mne orphans # Documents with no links at all
|
|
120
|
-
```
|
|
76
|
+
### Quick setup via pi
|
|
121
77
|
|
|
122
|
-
|
|
78
|
+
If the pi extension is loaded, type `/mne init` — it asks questions interactively:
|
|
123
79
|
|
|
124
|
-
```
|
|
125
|
-
mne
|
|
80
|
+
```
|
|
81
|
+
/mne init
|
|
82
|
+
→ Choose global or project-local scope
|
|
83
|
+
→ Enter directories to index
|
|
84
|
+
→ Index + embed (if Ollama available)
|
|
85
|
+
→ Optionally configure MCP, copy skill
|
|
126
86
|
```
|
|
127
87
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
Only mutate indexes when the user asked for setup or maintenance.
|
|
88
|
+
### Manual setup
|
|
131
89
|
|
|
132
90
|
```bash
|
|
133
91
|
npm install -g @naveenadi/mnemonic
|
|
134
92
|
mne init
|
|
135
93
|
mne collection add ~/notes --name notes
|
|
136
|
-
mne
|
|
137
|
-
mne
|
|
138
|
-
mne embed
|
|
94
|
+
mne index # Scan files, build FTS5
|
|
95
|
+
mne embed # Generate vector embeddings
|
|
139
96
|
```
|
|
140
97
|
|
|
141
|
-
|
|
98
|
+
See [references/setup.md](references/setup.md) for project-local `--db` mode, diagnostics, and maintenance.
|
|
142
99
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
100
|
+
### Pi integration
|
|
101
|
+
|
|
102
|
+
mnemonic integrates at three pi layers — MCP, skill, and extension. Each can be installed globally (all projects) or project-local (per repo).
|
|
103
|
+
|
|
104
|
+
| Layer | Global | Per project |
|
|
105
|
+
|---|---|---|
|
|
106
|
+
| MCP | `~/.pi/agent/mcp.json` | `.pi/mcp.json` |
|
|
107
|
+
| Skill | `~/.pi/agent/skills/mnemonic/` | `.pi/skills/mnemonic/` |
|
|
108
|
+
| Extension | `~/.pi/agent/extensions/mnemonic/` | `.pi/extensions/mnemonic/` |
|
|
109
|
+
|
|
110
|
+
Full instructions at [references/pi-integration.md](references/pi-integration.md).
|
|
147
111
|
|
|
148
112
|
## Pitfalls
|
|
149
113
|
|
|
150
|
-
- **
|
|
151
|
-
- **Do not slice files
|
|
152
|
-
|
|
153
|
-
- **
|
|
154
|
-
|
|
155
|
-
- **Do not overuse semantic search.** If you know exact titles or terms,
|
|
156
|
-
`mne search` (BM25) is faster and often better.
|
|
157
|
-
- **Do not mutate indexes casually.** `mne index` and `mne embed` change local
|
|
158
|
-
state and can be expensive.
|
|
114
|
+
- **Fetch before claiming.** Snippets are leads, not sources.
|
|
115
|
+
- **Do not shell-slice files.** Use `:from:count` suffix (e.g. `#abc123:120:40`) — never `sed`, `head`, `tail`.
|
|
116
|
+
- **Do not lean on auto-expansion.** Write `intent:`/`lex:`/`vec:`/`hyde:` yourself. A bare `mne query "user sentence"` discards context only you have.
|
|
117
|
+
- **Prefer BM25 for exact terms.** Semantic search is slower and drifts. If you know the title, `mne search "title"` is better.
|
|
118
|
+
- **Do not mutate indexes casually.** `mne index` and `mne embed` are expensive.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naveenadi/mnemonic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "On-device hybrid search for markdown knowledge bases. BM25 + vector + LLM reranking with link graphs, time decay, and HyDE. Designed for pi coding agent.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"bin/",
|
|
13
13
|
"dist/",
|
|
14
14
|
"SKILL.md",
|
|
15
|
-
"pi-extension/"
|
|
15
|
+
"pi-extension/",
|
|
16
|
+
"references/",
|
|
17
|
+
"src/pi-extension/package.json"
|
|
16
18
|
],
|
|
17
19
|
"scripts": {
|
|
18
20
|
"build": "tsc -p tsconfig.build.json",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Cross-Reference Reference
|
|
2
|
+
|
|
3
|
+
mnemonic tracks wikilinks (`[[target]]`) and markdown links (`[text](target.md)`) between documents in the `links` table.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
mne links #abc123 # Outgoing — what this doc links to
|
|
9
|
+
mne backlinks #abc123 # Incoming — what links to this doc
|
|
10
|
+
mne orphans # Documents with zero links (no incoming or outgoing)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Link boosting in search
|
|
14
|
+
|
|
15
|
+
Pass `--boost-links` to `mne query` to boost results proportional to their backlink count. Documents with more incoming links rank higher:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
mne query "deployment strategy" --boost-links
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Use cases
|
|
22
|
+
|
|
23
|
+
- **Discover connected context**: after `mne get`, run `mne backlinks` to find related docs.
|
|
24
|
+
- **Surface hubs**: `mne query "..." --boost-links` promotes widely cited documents.
|
|
25
|
+
- **Find dead ends**: `mne orphans` surfaces disconnected notes that may need linking.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Pi Integration Setup
|
|
2
|
+
|
|
3
|
+
mnemonic integrates with pi at three layers. Each can be installed **globally** (all projects) or **project-local** (per-repo).
|
|
4
|
+
|
|
5
|
+
## Interactive setup — /mne init
|
|
6
|
+
|
|
7
|
+
If the extension is loaded, type `/mne init` in pi to walk through everything:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
/mne init
|
|
11
|
+
→ Choose global or project-local scope
|
|
12
|
+
→ Enter directories to index
|
|
13
|
+
→ Index files, embed (if Ollama available)
|
|
14
|
+
→ Optionally configure MCP in mcp.json
|
|
15
|
+
→ Optionally install skill (SKILL.md)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Other commands:
|
|
19
|
+
- `/mne add <path>` — quick-add a collection
|
|
20
|
+
- `/mne status` — index health summary
|
|
21
|
+
|
|
22
|
+
## MCP Server
|
|
23
|
+
|
|
24
|
+
Exposes typed tools (`query`, `get`, `multi_get`, `status`) over stdio.
|
|
25
|
+
|
|
26
|
+
### Global (all sessions)
|
|
27
|
+
|
|
28
|
+
Add to `~/.pi/agent/mcp.json`:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"mcpServers": {
|
|
33
|
+
"mnemonic": {
|
|
34
|
+
"command": "mne",
|
|
35
|
+
"args": ["mcp"],
|
|
36
|
+
"lifecycle": "keep-alive"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Project-local (per repo)
|
|
43
|
+
|
|
44
|
+
Add to `.pi/mcp.json` in the project root (same format). Only active when pi is in that directory.
|
|
45
|
+
|
|
46
|
+
## Pi Skill
|
|
47
|
+
|
|
48
|
+
Lets the agent run `mne search`, `mne query`, `mne get` etc. via bash.
|
|
49
|
+
|
|
50
|
+
### Global (all sessions)
|
|
51
|
+
|
|
52
|
+
Copy the skill directory:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
cp -r /path/to/mnemonic/skills/mnemonic ~/.pi/agent/skills/mnemonic
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or link the npm package's skill for auto-updates:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
ln -s $(npm root -g)/@naveenadi/mnemonic/SKILL.md ~/.pi/agent/skills/mnemonic/SKILL.md
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Project-local (per repo)
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
mkdir -p .pi/skills
|
|
68
|
+
cp -r /path/to/mnemonic/skills/mnemonic .pi/skills/mnemonic
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Or via `settings.json`:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"skills": ["../.pi/skills"]
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Via npm package
|
|
80
|
+
|
|
81
|
+
The skill ships in the npm tarball (`SKILL.md`). If you install `@naveenadi/mnemonic` as a project dependency, reference it in `.pi/settings.json`:
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"skills": ["node_modules/@naveenadi/mnemonic"]
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Pi Extension
|
|
90
|
+
|
|
91
|
+
Registers 4 custom tools (`mnemonic_search`, `mnemonic_query`, `mnemonic_get`, `mnemonic_status`) with `pi.registerTool()`.
|
|
92
|
+
|
|
93
|
+
### Global (all sessions)
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
mkdir -p ~/.pi/agent/extensions/mnemonic
|
|
97
|
+
cp src/pi-extension/index.ts ~/.pi/agent/extensions/mnemonic/index.ts
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Project-local (per repo)
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
mkdir -p .pi/extensions/mnemonic
|
|
104
|
+
cp src/pi-extension/index.ts .pi/extensions/mnemonic/index.ts
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Via npm package (as pi package)
|
|
108
|
+
|
|
109
|
+
Can be installed as a pi package for auto-discovery. See [pi packages docs](https://pi.dev/docs/packages).
|
|
110
|
+
|
|
111
|
+
## Quick reference
|
|
112
|
+
|
|
113
|
+
| Layer | Global path | Project-local path |
|
|
114
|
+
|---|---|---|
|
|
115
|
+
| MCP config | `~/.pi/agent/mcp.json` | `.pi/mcp.json` |
|
|
116
|
+
| Skill | `~/.pi/agent/skills/mnemonic/` | `.pi/skills/mnemonic/` |
|
|
117
|
+
| Extension | `~/.pi/agent/extensions/mnemonic/` | `.pi/extensions/mnemonic/` |
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Setup Reference
|
|
2
|
+
|
|
3
|
+
## Global mode (default)
|
|
4
|
+
|
|
5
|
+
All collections share one index at `~/.cache/mnemonic/index.sqlite`. Search everything at once.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @naveenadi/mnemonic
|
|
9
|
+
mne init
|
|
10
|
+
mne collection add ~/notes --name notes
|
|
11
|
+
mne collection add ~/Documents --name docs --mask "**/*.md"
|
|
12
|
+
mne index
|
|
13
|
+
mne embed
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Project-local mode
|
|
17
|
+
|
|
18
|
+
Use `--db` for a per-repo index. Index and data stay in the repo.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
mne --db .mnemonic/index.sqlite init
|
|
22
|
+
mne --db .mnemonic/index.sqlite collection add . --name myproject
|
|
23
|
+
mne --db .mnemonic/index.sqlite index
|
|
24
|
+
mne --db .mnemonic/index.sqlite query "something in this repo"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Pi integration (all three layers)
|
|
28
|
+
|
|
29
|
+
Each layer — MCP server, skill, extension — can be installed globally or per project.
|
|
30
|
+
|
|
31
|
+
### MCP server
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Global: add to ~/.pi/agent/mcp.json
|
|
35
|
+
{
|
|
36
|
+
"mcpServers": {
|
|
37
|
+
"mnemonic": {
|
|
38
|
+
"command": "mne",
|
|
39
|
+
"args": ["mcp"],
|
|
40
|
+
"lifecycle": "keep-alive"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
# Per project: same format in .pi/mcp.json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Skill
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Global
|
|
52
|
+
mkdir -p ~/.pi/agent/skills/mnemonic
|
|
53
|
+
cp SKILL.md ~/.pi/agent/skills/mnemonic/
|
|
54
|
+
|
|
55
|
+
# Per project (auto-discovered after trust)
|
|
56
|
+
mkdir -p .pi/skills/mnemonic
|
|
57
|
+
cp SKILL.md .pi/skills/mnemonic/
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Extension
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Global
|
|
64
|
+
mkdir -p ~/.pi/agent/extensions/mnemonic
|
|
65
|
+
cp src/pi-extension/index.ts ~/.pi/agent/extensions/mnemonic/
|
|
66
|
+
|
|
67
|
+
# Per project
|
|
68
|
+
mkdir -p .pi/extensions/mnemonic
|
|
69
|
+
cp src/pi-extension/index.ts .pi/extensions/mnemonic/
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Full reference: [pi-integration.md](pi-integration.md)
|
|
73
|
+
|
|
74
|
+
## Diagnostics
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
mne doctor # Check models, Ollama, DB health
|
|
78
|
+
mne status # Index health, collection stats, vector status
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Maintenance
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
mne index # Re-scan all files, update FTS5 (safe to re-run)
|
|
85
|
+
mne embed # Generate vectors for unembedded documents (-f to force redo)
|
|
86
|
+
```
|