@pinkpixel/memi 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/package.json +56 -4
- package/skills/memi-curate/SKILL.md +89 -0
- package/skills/memi-memory/SKILL.md +141 -0
- package/skills/memi-memory/references/examples.md +50 -0
- package/skills/memi-memory/references/rubrics.md +44 -0
- package/skills/memi-setup/SKILL.md +144 -0
- package/ui/css/controls.css +274 -0
- package/ui/css/dialogs.css +145 -0
- package/ui/css/layout.css +237 -0
- package/ui/css/memories.css +168 -0
- package/ui/css/tokens.css +125 -0
- package/ui/favicon.svg +1 -0
- package/ui/fonts/OFL.txt +192 -0
- package/ui/fonts/geist-latin-wght-normal.woff2 +0 -0
- package/ui/fonts/geist-mono-latin-wght-normal.woff2 +0 -0
- package/ui/index.html +75 -0
- package/ui/js/api.js +30 -0
- package/ui/js/confirm.js +29 -0
- package/ui/js/dom.js +49 -0
- package/ui/js/editor.js +133 -0
- package/ui/js/icons.js +29 -0
- package/ui/js/list.js +66 -0
- package/ui/js/main.js +244 -0
- package/ui/js/sidebar.js +85 -0
- package/ui/js/state.js +61 -0
- package/ui/js/toast.js +10 -0
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pinkpixel/memi",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Local-first memory for AI agents. SQLite, hybrid search, MCP server, and a small local UI.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"author": "Pink Pixel <admin@pinkpixel.dev> (https://pinkpixel.dev)",
|
|
8
|
+
"homepage": "https://pinkpixel.dev",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/pinkpixel-dev/memi.git"
|
|
12
|
+
},
|
|
13
|
+
"bin": {
|
|
14
|
+
"memi": "dist/cli/index.js"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"ui",
|
|
19
|
+
"skills",
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=22"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc -p tsconfig.build.json",
|
|
28
|
+
"dev": "tsx src/cli/index.ts",
|
|
29
|
+
"typecheck": "tsc --noEmit",
|
|
30
|
+
"test": "vitest run"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"mcp",
|
|
34
|
+
"memory",
|
|
35
|
+
"agents",
|
|
36
|
+
"sqlite",
|
|
37
|
+
"embeddings",
|
|
38
|
+
"ollama",
|
|
39
|
+
"openai"
|
|
40
|
+
],
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@hono/node-server": "^2.1.3",
|
|
43
|
+
"@modelcontextprotocol/sdk": "^1.32.0",
|
|
44
|
+
"better-sqlite3": "^13.0.3",
|
|
45
|
+
"commander": "^15.0.0",
|
|
46
|
+
"hono": "^4.13.13",
|
|
47
|
+
"sqlite-vec": "^0.1.9",
|
|
48
|
+
"zod": "^4.6.5"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/better-sqlite3": "^9.6.0",
|
|
52
|
+
"@types/node": "^26.6.4",
|
|
53
|
+
"happy-dom": "^20.14.5",
|
|
54
|
+
"tsx": "^4.23.15",
|
|
55
|
+
"typescript": "^7.0.2",
|
|
56
|
+
"vitest": "^5.0.3"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: memi-curate
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: |
|
|
5
|
+
Review and clean up memories stored in memi: find duplicates, contradictions,
|
|
6
|
+
stale or vague entries, wrong scope or category, inflated importance, and
|
|
7
|
+
accidentally saved secrets, then fix them with the user's approval. Use when
|
|
8
|
+
the user asks to "clean up", "review", "organize", or "audit" memories, when
|
|
9
|
+
recall keeps returning noise or contradictory results, or when list_memories
|
|
10
|
+
shows a large pile of low-value entries.
|
|
11
|
+
license: Apache-2.0
|
|
12
|
+
compatibility: claude-code cursor codex gemini-cli opencode
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Curating memi memories
|
|
16
|
+
|
|
17
|
+
Memories pile up. Over time a store collects near-duplicates, decisions that were later reversed, vague notes nobody can interpret, and categories that drifted. A messy store makes `recall` worse, because contradictory or noisy results waste attention and can lead the next session wrong.
|
|
18
|
+
|
|
19
|
+
This skill is a careful review. The rule that matters most: **deleting is permanent, so you propose first and the user approves.**
|
|
20
|
+
|
|
21
|
+
If the user would rather look through memories themselves, `memi ui` opens a browser view where they can search, edit, and delete.
|
|
22
|
+
|
|
23
|
+
## 1. Survey
|
|
24
|
+
|
|
25
|
+
1. `list_categories` for the shape of the store.
|
|
26
|
+
2. `list_memories` with `scope: "all"` and `limit: 50`, paging with `offset` until `total` is covered. Use `order: "importance"` to see what is loaded at session start first, then `order: "oldest"` for the stale tail.
|
|
27
|
+
3. If the user only cares about one project, use `scope: "project"` with that `project`. Include `scope: "global"` separately.
|
|
28
|
+
|
|
29
|
+
Read everything before you judge anything. A "duplicate" is easy to misjudge from one memory.
|
|
30
|
+
|
|
31
|
+
## 2. Look for these problems
|
|
32
|
+
|
|
33
|
+
| Problem | How to spot it | Fix |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| **Duplicate** | Two memories say the same thing | Keep the clearer one (`update_memory` to merge in any detail from the other), `forget` the rest |
|
|
36
|
+
| **Contradiction** | Two memories disagree | Decide which is current. Check the repo or ask the user if unsure. Update or keep that one, `forget` the other |
|
|
37
|
+
| **Stale** | Names a file, flag, host, or version that may no longer exist | Verify against the repo. If it changed, `update_memory`. If it is gone, `forget` |
|
|
38
|
+
| **Vague** | Cannot be understood without the original conversation ("use the second approach") | Rewrite so it stands alone if you can tell what it meant. Otherwise `forget` |
|
|
39
|
+
| **Wrong category** | Lots of `context` that is really a decision, preference, or fact | `update_memory` with the right `category` |
|
|
40
|
+
| **Wrong scope** | A project memory that is really a global preference, or the reverse | `update_memory` with `scope` (and `project` if moving to a project) |
|
|
41
|
+
| **Inflated importance** | A pile of 4s and 5s, or more than about five pinned memories per scope | Lower importance, unpin the rest |
|
|
42
|
+
| **Category sprawl** | Near-identical custom names (`ci`, `cicd`, `ci-cd`) | Move the memories into one category |
|
|
43
|
+
| **Secret** | An API key, token, password, or private key | Tell the user straight away, `forget` it, and tell them the secret should be rotated since it was stored |
|
|
44
|
+
|
|
45
|
+
Do not fix what is not broken. A short, plain memory that is correct is fine.
|
|
46
|
+
|
|
47
|
+
## 3. Propose before you change anything
|
|
48
|
+
|
|
49
|
+
Present a list the user can approve in one pass. Group by action, and give the id, the reason, and the new wording when you rewrite:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
Delete (3)
|
|
53
|
+
#14 duplicate of #9
|
|
54
|
+
#31 vague: "use the second approach"
|
|
55
|
+
#40 stale: refers to scripts/old-deploy.sh, which no longer exists
|
|
56
|
+
|
|
57
|
+
Update (2)
|
|
58
|
+
#22 fact -> decision; reword: "Auth uses signed cookies, not JWTs, because sessions must be revocable."
|
|
59
|
+
#27 scope project -> global (it is a tooling preference)
|
|
60
|
+
|
|
61
|
+
Lower importance (1)
|
|
62
|
+
#8 5 -> 3
|
|
63
|
+
|
|
64
|
+
Secrets (0)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Then wait. Apply only what the user approves. If they approve some items, do those and leave the rest.
|
|
68
|
+
|
|
69
|
+
A secret is the one case where you should say so immediately and not wait for the end of the review. You still need approval before deleting.
|
|
70
|
+
|
|
71
|
+
## 4. Apply
|
|
72
|
+
|
|
73
|
+
- `update_memory` for rewording, recategorizing, rescoping, importance, tags, pinning. Changing `content` or scope re-embeds the memory.
|
|
74
|
+
- `forget` for deletions, one id at a time.
|
|
75
|
+
- Merging: update the best memory with the combined content, then `forget` the others.
|
|
76
|
+
|
|
77
|
+
Note that `update_memory` with `tags` **replaces** the existing tags. Pass the full list you want.
|
|
78
|
+
|
|
79
|
+
## 5. Report
|
|
80
|
+
|
|
81
|
+
End with plain counts: how many deleted, updated, left alone, and anything you were unsure about and skipped. If you could not check something against the repo, say so.
|
|
82
|
+
|
|
83
|
+
## Rules
|
|
84
|
+
|
|
85
|
+
- Never delete without approval.
|
|
86
|
+
- Never change the meaning of a memory while rewording it. If you are not sure what it meant, ask or leave it.
|
|
87
|
+
- Verify stale-looking details against the repo before calling them stale.
|
|
88
|
+
- Keep the user's own words where they are clear. Do not polish for the sake of it.
|
|
89
|
+
- If a warning like `Saved without a vector` appears while updating, mention it once and carry on.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: memi-memory
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: |
|
|
5
|
+
Use memi, a local long-term memory for AI agents, so knowledge survives between
|
|
6
|
+
sessions. Use whenever the memi MCP tools (get_context, recall, remember,
|
|
7
|
+
update_memory, forget, list_memories, list_categories) are available: at the
|
|
8
|
+
start of a session, before making a decision that earlier sessions may have
|
|
9
|
+
settled, when the user says "remember", "save this", "do you remember", "what
|
|
10
|
+
did we decide", "last time", "forget that", or "don't do that again", and after
|
|
11
|
+
you learn something durable such as a decision, a preference, a fact, or a
|
|
12
|
+
mistake worth avoiding.
|
|
13
|
+
license: Apache-2.0
|
|
14
|
+
compatibility: claude-code cursor codex gemini-cli opencode
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Using memi memory
|
|
18
|
+
|
|
19
|
+
memi stores memories in a local SQLite file and finds them by meaning and by keyword. Memories last across sessions, and the same store is shared by every agent on this machine. That makes you responsible for what goes in. A good memory saves the next session real time. A bad one is noise that someone will have to find and delete.
|
|
20
|
+
|
|
21
|
+
Seven tools do all the work: `get_context`, `recall`, `remember`, `update_memory`, `forget`, `list_memories`, `list_categories`.
|
|
22
|
+
|
|
23
|
+
## The loop
|
|
24
|
+
|
|
25
|
+
1. **Start of a session:** call `get_context` once. It returns the pinned and high-importance (4 or 5) memories for this project plus global ones. Treat them as background. Do not read them back to the user.
|
|
26
|
+
2. **While working:** call `recall` when earlier knowledge might change what you do (see below).
|
|
27
|
+
3. **After you learn something durable:** call `remember`.
|
|
28
|
+
4. **When a memory turns out to be wrong:** call `update_memory` or `forget`. Do not leave known-wrong memories behind.
|
|
29
|
+
|
|
30
|
+
## Recall
|
|
31
|
+
|
|
32
|
+
Recall before you:
|
|
33
|
+
|
|
34
|
+
- choose a library, pattern, or architecture
|
|
35
|
+
- answer a question about how this user or project does things
|
|
36
|
+
- start debugging something that might have been hit before
|
|
37
|
+
- act on something the user refers to from the past ("like we did before", "as I said")
|
|
38
|
+
|
|
39
|
+
Recall tips:
|
|
40
|
+
|
|
41
|
+
- Describe what you want in plain language: `how does the user want commit messages written`. Searching by meaning works, so you do not need to guess exact words.
|
|
42
|
+
- The default scope `both` covers global memories plus the current project. Use `scope: "all"` only when the user asks about another project.
|
|
43
|
+
- Add `min_importance: 4` when you only want what matters most. Add `category` to narrow down.
|
|
44
|
+
- One or two searches per task is normal. Do not search on every message.
|
|
45
|
+
|
|
46
|
+
Reading results: each memory starts with `#id | category | importance N | scope | ...`. The score is only useful for comparing results within one search.
|
|
47
|
+
|
|
48
|
+
**Memories can be stale.** Specific details such as file paths, flags, function names, and versions may have changed since the memory was written. Check against the current code before you act on one. If it is wrong, fix it with `update_memory` or remove it with `forget`.
|
|
49
|
+
|
|
50
|
+
If a result ends with `Note:`, read it. It usually means search fell back to keywords only. See "Warnings" below.
|
|
51
|
+
|
|
52
|
+
## Remember
|
|
53
|
+
|
|
54
|
+
### What belongs
|
|
55
|
+
|
|
56
|
+
- **Decisions and the reason for them.** "Use SQLite, not Postgres, because the app is local-first and the data is small."
|
|
57
|
+
- **User preferences and corrections.** "Prefers tabs. Wants short answers without a summary at the end."
|
|
58
|
+
- **Durable facts that are not obvious from the code.** "Staging deploys need the VPN."
|
|
59
|
+
- **Mistakes worth not repeating, with the fix.** "Running migrations before the seed script fails. Seed first."
|
|
60
|
+
- **Work the user explicitly deferred.** "Add rate limiting to the upload route later."
|
|
61
|
+
|
|
62
|
+
### What does not belong
|
|
63
|
+
|
|
64
|
+
- **Secrets of any kind:** API keys, tokens, passwords, private keys. Never.
|
|
65
|
+
- Anything you can read from the code, the git history, or the docs.
|
|
66
|
+
- Task progress that only matters in this session.
|
|
67
|
+
- Guesses. Save what you verified, or what the user said.
|
|
68
|
+
- Long dumps. One memory is one idea in a few sentences. The hard limit is 8000 characters, and you should rarely come close.
|
|
69
|
+
|
|
70
|
+
### Write it so it stands alone
|
|
71
|
+
|
|
72
|
+
A future session will see the memory without this conversation. So:
|
|
73
|
+
|
|
74
|
+
- Lead with the fact, then the reason.
|
|
75
|
+
- Name things exactly (file, tool, command).
|
|
76
|
+
- Use absolute dates, not "yesterday" or "last week".
|
|
77
|
+
- No pronouns that point back at the conversation ("it", "that approach").
|
|
78
|
+
|
|
79
|
+
Before: `We decided to go with the second option.`
|
|
80
|
+
After: `Auth uses signed cookies, not JWTs, because sessions must be revocable. Decided 2026-10-04.`
|
|
81
|
+
|
|
82
|
+
More examples are in `references/examples.md`.
|
|
83
|
+
|
|
84
|
+
### Choose the fields
|
|
85
|
+
|
|
86
|
+
| Field | How to choose |
|
|
87
|
+
|---|---|
|
|
88
|
+
| `scope` | `project` for things about this codebase. `global` for things about the user or how they work everywhere. If unsure, project. |
|
|
89
|
+
| `category` | `decision`, `preference`, `fact`, `error`, `todo`, or `context`. Run `list_categories` before inventing a new one. |
|
|
90
|
+
| `importance` | 1 to 5, default 3. See `references/rubrics.md`. Most memories are 2 or 3. |
|
|
91
|
+
| `pinned` | Loaded at the start of every session. Use rarely, for rules where forgetting would cost real time or trust. |
|
|
92
|
+
| `tags` | A few keywords you would search for. Optional. |
|
|
93
|
+
|
|
94
|
+
`project` is worked out for you. Do not pass it unless the user is talking about a different project by name.
|
|
95
|
+
|
|
96
|
+
### Handle duplicates
|
|
97
|
+
|
|
98
|
+
`remember` checks for close matches in the same scope. If the result says `Similar memories already exist`:
|
|
99
|
+
|
|
100
|
+
- **Same fact:** keep the better one. Call `update_memory` on the older memory with the improved wording, then `forget` the new id you just created.
|
|
101
|
+
- **Related but different** (a new detail, a changed decision): keep both, or update the old one if the new one replaces it.
|
|
102
|
+
|
|
103
|
+
For anything you suspect is already saved, a quick `recall` first is cheaper than cleaning up later.
|
|
104
|
+
|
|
105
|
+
### Tell the user, briefly
|
|
106
|
+
|
|
107
|
+
When you save a preference or a decision on your own initiative, say so in one short line ("Saved a note that you prefer tabs.") so they can correct you. Do not announce routine facts.
|
|
108
|
+
|
|
109
|
+
## When the user asks directly
|
|
110
|
+
|
|
111
|
+
- **"Remember X"**: save it right away, then confirm with the id.
|
|
112
|
+
- **"Forget X"**: `recall` to find it. If more than one memory matches, show them and ask which. Then `forget`. Deleting is permanent.
|
|
113
|
+
- **"What do you remember about X"**: `recall`, then summarize in your own words.
|
|
114
|
+
|
|
115
|
+
## Projects and scope
|
|
116
|
+
|
|
117
|
+
memi works out the project automatically: the folder name of the git repo you are in. With no git repo, it uses the agent name (`MEMI_AGENT`), stored as `agent:<name>`. With neither, saving a project memory fails with an error that says what to set.
|
|
118
|
+
|
|
119
|
+
If you hit that error, either save the memory as `global` (if it truly is global) or ask the user for a project name or tell them to set `MEMI_AGENT`. Do not make up a project name.
|
|
120
|
+
|
|
121
|
+
## Warnings
|
|
122
|
+
|
|
123
|
+
| You see | What it means | What to do |
|
|
124
|
+
|---|---|---|
|
|
125
|
+
| `Saved without a vector` | Saved, but the embedder was unreachable. It can only be found by keyword for now. | Mention it once. The user can run `memi reindex --missing` when Ollama is back. |
|
|
126
|
+
| `The embedder changed from ...` | The configured embedder no longer matches the stored vectors, so semantic search is off. Keyword search still works. | Tell the user to run `memi reindex`. It asks for confirmation, rebuilds the vectors, and keeps all memories. Do not run it yourself unless asked, because it re-embeds everything. |
|
|
127
|
+
| `No embedder configured` / `No vectors yet` | Keyword search only. | Nothing needed. |
|
|
128
|
+
| Tool error | Bad arguments or a bad id. | Read the message, fix the arguments, retry once. |
|
|
129
|
+
|
|
130
|
+
## If the memi tools are not available
|
|
131
|
+
|
|
132
|
+
If the MCP server is not connected but the `memi` command exists, use it from the shell: `memi search "query"`, `memi add "text" -c fact`, `memi list`. If neither is available, say so. Do not claim to remember something you cannot save.
|
|
133
|
+
|
|
134
|
+
## Quick rules
|
|
135
|
+
|
|
136
|
+
- `get_context` at the start. `recall` before deciding. `remember` after learning.
|
|
137
|
+
- Never save secrets.
|
|
138
|
+
- Write memories that make sense with no context.
|
|
139
|
+
- Update or forget what is wrong. Do not stack contradictions.
|
|
140
|
+
- Verify stale details before acting on them.
|
|
141
|
+
- When unsure whether something is worth saving, ask: would the next session be worse off without it?
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
## Rewriting vague memories
|
|
4
|
+
|
|
5
|
+
| Before | After | What changed |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| `Use the new approach.` | `Search runs FTS5 and vector KNN, merged with reciprocal rank fusion, because either alone missed too much.` | Named the approach and gave the reason. |
|
|
8
|
+
| `User likes it short.` | `Prefers short answers with no closing summary. Said so on 2026-10-04.` | Said what "it" is, added a date. |
|
|
9
|
+
| `Fixed the bug with the thing.` | `Uploads over 10MB failed because the proxy limit is 10MB. Raised it in nginx.conf to 50MB.` | Named the symptom, the cause, and the fix. |
|
|
10
|
+
| `Don't forget to test on mobile.` | `Every UI change must be checked at 375px width. The app is used mostly on phones.` | Made the rule concrete. |
|
|
11
|
+
|
|
12
|
+
## What not to save
|
|
13
|
+
|
|
14
|
+
| Candidate | Why not |
|
|
15
|
+
|---|---|
|
|
16
|
+
| `The project uses TypeScript.` | Visible from the repo. |
|
|
17
|
+
| `Currently refactoring the auth module.` | Session progress. It will be wrong tomorrow. |
|
|
18
|
+
| `The API key is sk-...` | A secret. Never. |
|
|
19
|
+
| `Maybe we should use Redis?` | A guess, not a decision. |
|
|
20
|
+
| A pasted 300-line stack trace | Too long. Save the cause and the fix in two sentences. |
|
|
21
|
+
|
|
22
|
+
## A duplicate, handled
|
|
23
|
+
|
|
24
|
+
You call `remember` with `The user prefers tabs over spaces`. The result says:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
Saved memory #14 (global, preference, importance 3).
|
|
28
|
+
|
|
29
|
+
Similar memories already exist. If one covers this, call update_memory on it and forget #14:
|
|
30
|
+
#9 | preference | importance 4 | global | 2026-09-12
|
|
31
|
+
The user prefers tabs over spaces for indentation
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Memory #9 already says it, and with more detail. So delete the new one:
|
|
35
|
+
|
|
36
|
+
1. `forget` with `{ "id": 14 }`
|
|
37
|
+
|
|
38
|
+
If the new wording were better, you would first call `update_memory` on #9 with the improved `content`, then forget #14.
|
|
39
|
+
|
|
40
|
+
## Session start
|
|
41
|
+
|
|
42
|
+
1. Call `get_context`. It returns, say, four memories: two pinned rules, two important decisions.
|
|
43
|
+
2. Use them silently. If the user asks to change something a decision covers, mention the decision and why it was made.
|
|
44
|
+
3. Later the user says "let's add caching". Call `recall` with `caching decisions and constraints` before proposing anything.
|
|
45
|
+
|
|
46
|
+
## A memory that turned out wrong
|
|
47
|
+
|
|
48
|
+
`recall` returns `#22 | fact | ... | The staging database is at db-staging-1.` While working you find the host is now `db-staging-2`.
|
|
49
|
+
|
|
50
|
+
Call `update_memory` with `{ "id": 22, "content": "The staging database is at db-staging-2 (moved from db-staging-1 on 2026-10-04)." }`. Do not save a second memory next to it.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Rubrics for memi memories
|
|
2
|
+
|
|
3
|
+
Use these when the choice of importance, category, scope, or pinning is not obvious.
|
|
4
|
+
|
|
5
|
+
## Importance
|
|
6
|
+
|
|
7
|
+
| Level | Meaning | Examples |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| 1 | Minor. Nice to know, harmless to forget. | "The old build script is in `scripts/legacy/`." |
|
|
10
|
+
| 2 | Useful detail. | "Dev server runs on port 5174 because 5173 is taken." |
|
|
11
|
+
| 3 | Normal. Default. Worth having next session. | "API errors use the `{ error, code }` shape." |
|
|
12
|
+
| 4 | Important. Getting it wrong costs real time. Loaded by `get_context`. | "Never run migrations on the shared staging database without asking." |
|
|
13
|
+
| 5 | Critical. A rule or fact that must never be missed. Loaded by `get_context`. | "Production deploys are manual. Never trigger one from a script." |
|
|
14
|
+
|
|
15
|
+
Most memories should be 2 or 3. If everything is a 4 or 5, `get_context` stops being useful. Search results are also nudged by importance, so inflating it distorts ranking.
|
|
16
|
+
|
|
17
|
+
## Pinning
|
|
18
|
+
|
|
19
|
+
Pinned memories load at the start of every session whatever their importance. Pin only what would hurt if a session started without it. A reasonable ceiling is about five pinned memories per scope. If you want to pin a sixth, unpin or merge one first.
|
|
20
|
+
|
|
21
|
+
Pinning and importance 4 or 5 do the same job for `get_context`. Use importance for "this matters" and pinning for "this must always be loaded". In practice you rarely need both.
|
|
22
|
+
|
|
23
|
+
## Categories
|
|
24
|
+
|
|
25
|
+
| Category | Use for | Not for |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| `decision` | A choice that was made, with the reason, and ideally what was rejected | Preferences with no trade-off |
|
|
28
|
+
| `preference` | How the user likes things done | Facts about the system |
|
|
29
|
+
| `fact` | Durable truth about the project, system, or user | Anything that will be false next week |
|
|
30
|
+
| `error` | Something that failed, what caused it, and the fix | Bugs that are already fixed and will not recur |
|
|
31
|
+
| `todo` | Work explicitly deferred | Your own in-session task list |
|
|
32
|
+
| `context` | Background that helps orient a future session (the default) | Anything that fits a more specific category |
|
|
33
|
+
|
|
34
|
+
Custom categories are created the first time you use a name. Keep them short and lowercase (letters, numbers, dashes, underscores, up to 32 characters). Run `list_categories` first, because `ci` and `cicd` splitting the same topic helps nobody. Prefer a built-in category unless a custom one will hold several memories.
|
|
35
|
+
|
|
36
|
+
## Scope
|
|
37
|
+
|
|
38
|
+
| Question | If yes |
|
|
39
|
+
|---|---|
|
|
40
|
+
| Is it about the user, how they work, or their tools across projects? | `global` |
|
|
41
|
+
| Would it be wrong or confusing in a different project? | `project` |
|
|
42
|
+
| Is it a coding convention for one repo? | `project` |
|
|
43
|
+
| Is it a personal preference that applies to every repo (tabs, tone, tools)? | `global` |
|
|
44
|
+
| Not sure? | `project`. It is easier to promote later (`update_memory` with `scope: "global"`) than to find a stray global memory. |
|