@knikolov/opencode-plugin-simple-memory 1.0.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 +21 -0
- package/README.md +123 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12637 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Kris
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# OpenCode Simple Memory Plugin
|
|
2
|
+
|
|
3
|
+
A persistent memory plugin for [OpenCode](https://opencode.ai) that enables the AI assistant to remember context across sessions.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Persistent Storage**: Memories stored in logfmt format, organized by date
|
|
8
|
+
- **Memory Types**: Support for decisions, learnings, preferences, blockers, context, and patterns
|
|
9
|
+
- **Scoped Organization**: Organize memories by scope (e.g., user, project, api, auth)
|
|
10
|
+
- **Search & Filtering**: Query memories by scope, type, or free-text search
|
|
11
|
+
- **Audit Trail**: Deletions are logged for accountability
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
Add to your `~/.config/opencode/opencode.json`:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"plugin": [
|
|
20
|
+
"@knikolov/opencode-plugin-simple-memory"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Tools
|
|
26
|
+
|
|
27
|
+
The plugin provides five tools:
|
|
28
|
+
|
|
29
|
+
| Tool | Description |
|
|
30
|
+
|------|-------------|
|
|
31
|
+
| `memory_remember` | Store a new memory |
|
|
32
|
+
| `memory_recall` | Retrieve memories by scope, type, or search query |
|
|
33
|
+
| `memory_update` | Update an existing memory |
|
|
34
|
+
| `memory_forget` | Delete a memory (with audit logging) |
|
|
35
|
+
| `memory_list` | List all scopes and types for discovery |
|
|
36
|
+
|
|
37
|
+
## Memory Types
|
|
38
|
+
|
|
39
|
+
- `decision` - Architectural or design decisions
|
|
40
|
+
- `learning` - Things learned during development
|
|
41
|
+
- `preference` - User or project preferences
|
|
42
|
+
- `blocker` - Current blockers or issues
|
|
43
|
+
- `context` - General context information
|
|
44
|
+
- `pattern` - Recurring patterns or conventions
|
|
45
|
+
|
|
46
|
+
## Storage
|
|
47
|
+
|
|
48
|
+
Memories are stored in `.opencode/memory/` as daily logfmt files:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
.opencode/memory/
|
|
52
|
+
2025-12-15.logfmt
|
|
53
|
+
deletions.logfmt # audit log
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Example Chat
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
User: What do you know about me?
|
|
60
|
+
|
|
61
|
+
AI: I don't have any stored information about you yet. Let me check if there are
|
|
62
|
+
any memories saved in the system.
|
|
63
|
+
|
|
64
|
+
[calls memory_list]
|
|
65
|
+
|
|
66
|
+
Total memories: 2
|
|
67
|
+
Scopes:
|
|
68
|
+
user: 2 (context)
|
|
69
|
+
Types:
|
|
70
|
+
context: 2
|
|
71
|
+
|
|
72
|
+
[calls memory_recall with scope="user"]
|
|
73
|
+
|
|
74
|
+
Found 2 memories:
|
|
75
|
+
[2025-12-15] context/user: User's name is Kris
|
|
76
|
+
[2025-12-15] context/user: Passionate about Software Engineering
|
|
77
|
+
|
|
78
|
+
Based on the stored memories, here's what I know about you:
|
|
79
|
+
1. Name: Kris
|
|
80
|
+
2. Interest: You're passionate about Software Engineering
|
|
81
|
+
|
|
82
|
+
User: My preferred programming language is Erlang
|
|
83
|
+
|
|
84
|
+
AI: [calls memory_remember with type="preference", scope="user",
|
|
85
|
+
content="Preferred programming language is Erlang"]
|
|
86
|
+
|
|
87
|
+
Got it, Kris. I've stored that your preferred programming language is Erlang.
|
|
88
|
+
A solid choice for concurrent, fault-tolerant systems!
|
|
89
|
+
|
|
90
|
+
User: What do you know about me now?
|
|
91
|
+
|
|
92
|
+
AI: [calls memory_recall with scope="user"]
|
|
93
|
+
|
|
94
|
+
Found 3 memories:
|
|
95
|
+
[2025-12-15] context/user: User's name is Kris
|
|
96
|
+
[2025-12-15] context/user: Passionate about Software Engineering
|
|
97
|
+
[2025-12-15] preference/user: Preferred programming language is Erlang
|
|
98
|
+
|
|
99
|
+
Here's everything I know about you:
|
|
100
|
+
1. Name: Kris
|
|
101
|
+
2. Passionate about Software Engineering
|
|
102
|
+
3. Preferred programming language: Erlang
|
|
103
|
+
|
|
104
|
+
User: Actually, I changed my mind. I prefer Elixir now.
|
|
105
|
+
|
|
106
|
+
AI: [calls memory_update with type="preference", scope="user",
|
|
107
|
+
content="Preferred programming language is Elixir"]
|
|
108
|
+
|
|
109
|
+
Updated! Your language preference is now set to Elixir. Makes sense - you
|
|
110
|
+
get the Erlang VM benefits with a more modern syntax.
|
|
111
|
+
|
|
112
|
+
User: Forget my language preference entirely
|
|
113
|
+
|
|
114
|
+
AI: [calls memory_forget with type="preference", scope="user",
|
|
115
|
+
reason="User requested removal of language preference"]
|
|
116
|
+
|
|
117
|
+
Done. I've removed your language preference from memory. The deletion has
|
|
118
|
+
been logged for audit purposes.
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,qBAAqB,CAAA;AAsVvD,eAAO,MAAM,YAAY,EAAE,MAU1B,CAAA;AAED,eAAe,YAAY,CAAA"}
|