@zilliz/memsearch-opencode 0.1.0 → 0.1.1
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 +27 -13
- package/index.ts +1 -1
- package/package.json +1 -1
- package/scripts/capture-daemon.py +3 -3
- package/skills/memory-recall/SKILL.md +3 -5
package/README.md
CHANGED
|
@@ -21,11 +21,20 @@ uv tool install 'memsearch[onnx]'
|
|
|
21
21
|
# or: pip install 'memsearch[onnx]'
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
### Install
|
|
24
|
+
### Install from npm (recommended)
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
// In ~/.config/opencode/opencode.json
|
|
28
|
+
{
|
|
29
|
+
"plugin": ["@zilliz/memsearch-opencode"]
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Install from Source (development)
|
|
25
34
|
|
|
26
35
|
```bash
|
|
27
|
-
# Clone the repo
|
|
28
|
-
git clone https://github.com/
|
|
36
|
+
# Clone the repo
|
|
37
|
+
git clone https://github.com/zilliztech/memsearch.git
|
|
29
38
|
cd memsearch
|
|
30
39
|
|
|
31
40
|
# Run the installer
|
|
@@ -44,15 +53,6 @@ mkdir -p ~/.agents/skills
|
|
|
44
53
|
ln -sf /path/to/memsearch/plugins/opencode/skills/memory-recall ~/.agents/skills/memory-recall
|
|
45
54
|
```
|
|
46
55
|
|
|
47
|
-
### npm Install (coming soon)
|
|
48
|
-
|
|
49
|
-
```json
|
|
50
|
-
// In ~/.config/opencode/opencode.json
|
|
51
|
-
{
|
|
52
|
-
"plugin": ["memsearch-opencode"]
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
56
|
## Architecture
|
|
57
57
|
|
|
58
58
|
```
|
|
@@ -73,6 +73,20 @@ OpenCode Session
|
|
|
73
73
|
└── memory_transcript ──→ parse-transcript.py (SQLite reader)
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
+
## Recall Memories
|
|
77
|
+
|
|
78
|
+
**Manual invocation** — explicitly invoke the skill with a query:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
/memory-recall what was the auth approach we discussed?
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Auto invocation** — just ask naturally, the LLM auto-invokes memory tools when it senses the question needs history:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
We discussed the authentication flow before, what was the approach?
|
|
88
|
+
```
|
|
89
|
+
|
|
76
90
|
## Tools
|
|
77
91
|
|
|
78
92
|
| Tool | Description |
|
|
@@ -100,7 +114,7 @@ Each file contains timestamped entries with bullet-point summaries:
|
|
|
100
114
|
## Session 14:30
|
|
101
115
|
|
|
102
116
|
### 14:30
|
|
103
|
-
<!-- session:ses_abc123
|
|
117
|
+
<!-- session:ses_abc123 db:~/.local/share/opencode/opencode.db -->
|
|
104
118
|
- User asked about the authentication flow.
|
|
105
119
|
- Assistant explained the OAuth2 implementation in auth.ts.
|
|
106
120
|
- Assistant modified the token refresh logic in refresh.ts.
|
package/index.ts
CHANGED
|
@@ -281,7 +281,7 @@ const MemsearchPlugin: Plugin = async ({ project, directory, worktree }) => {
|
|
|
281
281
|
description:
|
|
282
282
|
"Retrieve the original conversation from a past OpenCode session. " +
|
|
283
283
|
"Use after memory_get when the expanded result contains a session anchor " +
|
|
284
|
-
"(<!-- session:ID
|
|
284
|
+
"(<!-- session:ID db:PATH -->). Returns the formatted " +
|
|
285
285
|
"dialogue with [Human] and [Assistant] labels.",
|
|
286
286
|
args: {
|
|
287
287
|
session_id: tool.schema.string().describe("The session ID from the anchor comment"),
|
package/package.json
CHANGED
|
@@ -208,7 +208,7 @@ def _extract_msg_text(conn, msg_id, msg_json):
|
|
|
208
208
|
return "\n".join(text_parts)
|
|
209
209
|
|
|
210
210
|
|
|
211
|
-
def write_capture(memory_dir, turn_text, session_id):
|
|
211
|
+
def write_capture(memory_dir, turn_text, session_id, db_path=""):
|
|
212
212
|
"""Write a captured turn to the daily memory file."""
|
|
213
213
|
os.makedirs(memory_dir, exist_ok=True)
|
|
214
214
|
|
|
@@ -220,7 +220,7 @@ def write_capture(memory_dir, turn_text, session_id):
|
|
|
220
220
|
with open(memory_file, "w") as f:
|
|
221
221
|
f.write(f"# {today}\n\n## Session {now}\n\n")
|
|
222
222
|
|
|
223
|
-
anchor = f"<!-- session:{session_id}
|
|
223
|
+
anchor = f"<!-- session:{session_id} db:{db_path} -->\n" if session_id else ""
|
|
224
224
|
entry = f"### {now}\n{anchor}{turn_text}\n\n"
|
|
225
225
|
|
|
226
226
|
with open(memory_file, "a") as f:
|
|
@@ -280,7 +280,7 @@ def main():
|
|
|
280
280
|
if turn_text and len(turn_text) > 10:
|
|
281
281
|
# Summarize with LLM, fallback to raw text
|
|
282
282
|
summary = summarize_with_llm(turn_text, small_model)
|
|
283
|
-
write_capture(memory_dir, summary if summary else turn_text, session_id)
|
|
283
|
+
write_capture(memory_dir, summary if summary else turn_text, session_id, db_path)
|
|
284
284
|
if msg_time > last_msg_time:
|
|
285
285
|
last_msg_time = msg_time
|
|
286
286
|
try:
|
|
@@ -24,11 +24,9 @@ Search for memories relevant to: $ARGUMENTS
|
|
|
24
24
|
|
|
25
25
|
3. **Expand**: For each relevant result, run `memsearch expand <chunk_hash> --collection <collection name above>` to get the full markdown section with surrounding context.
|
|
26
26
|
|
|
27
|
-
4. **Deep drill (optional)**: If an expanded chunk contains
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
to retrieve the original conversation turns from the OpenCode SQLite database.
|
|
27
|
+
4. **Deep drill (optional)**: If an expanded chunk contains transcript anchors (HTML comments with session info), and the original conversation seems critical:
|
|
28
|
+
- If the anchor contains `db:`, run `python3 __INSTALL_DIR__/scripts/parse-transcript.py <session_id> --limit 10` to retrieve the original conversation turns from the SQLite database.
|
|
29
|
+
- If the anchor format is unfamiliar (e.g. `transcript:`, `rollout:` instead of `db:`), try reading the referenced file directly to explore its structure and locate the relevant conversation by the session or turn identifiers in the anchor.
|
|
32
30
|
|
|
33
31
|
5. **Return results**: Output a curated summary of the most relevant memories. Be concise — only include information that is genuinely useful for the user's current question.
|
|
34
32
|
|