opencode-mempalace 0.1.0 → 0.1.2

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.
Files changed (3) hide show
  1. package/README.md +105 -0
  2. package/dist/index.js +2 -1
  3. package/package.json +3 -2
package/README.md ADDED
@@ -0,0 +1,105 @@
1
+ # opencode-mempalace
2
+
3
+ OpenCode plugin for the [MemPalace](https://github.com/milla-jovovich/mempalace) memory system — a structured, persistent memory architecture for AI agents.
4
+
5
+ Auto-registers the MemPalace MCP server, injects the memory protocol into the system prompt, and loads context on session start.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ # Add to your OpenCode config (~/.config/opencode/opencode.jsonc)
11
+ {
12
+ "plugin": ["opencode-mempalace"]
13
+ }
14
+ ```
15
+
16
+ ## Prerequisites
17
+
18
+ ### 1. ChromaDB
19
+
20
+ The mempalace MCP server requires a running [ChromaDB](https://www.trychroma.com/) instance for vector storage.
21
+
22
+ ```bash
23
+ # Docker (recommended)
24
+ docker run -d --name chromadb \
25
+ -p 127.0.0.1:8000:8000 \
26
+ -v chromadb-data:/chroma/chroma \
27
+ --restart unless-stopped \
28
+ chromadb/chroma:latest
29
+
30
+ # Or pip
31
+ pip install chromadb
32
+ chroma run --host 0.0.0.0 --port 8000
33
+ ```
34
+
35
+ ### 2. mempalace-js
36
+
37
+ Install the [mempalace-js](https://github.com/nguyentamdat/mempalace-js) MCP server:
38
+
39
+ ```bash
40
+ npm install -g @nguyentamdat/mempalace
41
+ # Or clone and build
42
+ git clone https://github.com/nguyentamdat/mempalace-js.git
43
+ cd mempalace-js && bun install
44
+ ```
45
+ ## What it does
46
+
47
+ 1. **MCP auto-registration** — Adds the mempalace MCP server to your OpenCode session automatically (19 tools: search, diary, knowledge graph, entity management, etc.)
48
+ 2. **Memory protocol injection** — Appends `PALACE_PROTOCOL` to the system prompt, instructing the agent to *verify before guessing* by querying the palace for people, projects, and past events.
49
+ 3. **Session context loading** — On the first message of each session, spawns a background explore agent to load recent diary entries, palace status, and key entity facts.
50
+
51
+ ## Configuration
52
+
53
+ Pass options via your OpenCode plugin config:
54
+
55
+ | Option | Type | Default | Description |
56
+ |---|---|---|---|
57
+ | `mcpCommand` | `string[]` | Auto-detected | Command to start the MCP server |
58
+ | `disableMcp` | `boolean` | `false` | Skip auto-registering MCP server |
59
+ | `disableProtocol` | `boolean` | `false` | Skip injecting PALACE_PROTOCOL |
60
+ | `disableAutoLoad` | `boolean` | `false` | Skip auto-loading context on first message |
61
+ | `chromaUrl` | `string` | `http://localhost:8001` | ChromaDB server URL |
62
+ ## MCP Tools
63
+
64
+ The mempalace MCP server exposes 19 tools:
65
+
66
+ | Tool | Description |
67
+ |---|---|
68
+ | `mempalace_search` | Semantic memory search |
69
+ | `mempalace_kg_query` | Query entity facts from knowledge graph |
70
+ | `mempalace_kg_timeline` | Entity fact timeline |
71
+ | `mempalace_kg_add` | Add facts to knowledge graph |
72
+ | `mempalace_kg_invalidate` | Invalidate outdated facts |
73
+ | `mempalace_kg_stats` | Knowledge graph statistics |
74
+ | `mempalace_diary_write` | Write diary entry |
75
+ | `mempalace_diary_read` | Read recent diary entries |
76
+ | `mempalace_status` | Palace overview |
77
+ | `mempalace_list_wings` | List palace wings |
78
+ | `mempalace_list_rooms` | List rooms in a wing |
79
+ | `mempalace_get_taxonomy` | Full wing/room taxonomy |
80
+ | `mempalace_add_drawer` | Store a memory |
81
+ | `mempalace_delete_drawer` | Remove a memory |
82
+ | `mempalace_check_duplicate` | Check for duplicate memories |
83
+ | `mempalace_traverse` | Graph traversal (BFS) |
84
+ | `mempalace_find_tunnels` | Find cross-wing connections |
85
+ | `mempalace_graph_stats` | Graph structure statistics |
86
+ | `mempalace_get_aaak_spec` | AAAK compression dialect spec |
87
+
88
+ ## Environment Variables
89
+
90
+ | Variable | Description | Default |
91
+ |---|---|---|
92
+ | `CHROMA_URL` | ChromaDB server URL | `http://localhost:8000` |
93
+ | `MEMPALACE_PALACE_PATH` | Palace data directory | `~/.mempalace/palace` |
94
+
95
+ ## Related
96
+
97
+ - [mempalace-js](https://github.com/nguyentamdat/mempalace-js) — Full Bun/TypeScript port of the mempalace system (CLI + MCP server)
98
+ - [mempalace](https://github.com/milla-jovovich/mempalace) — Original Python implementation
99
+ ## Acknowledgements
100
+
101
+ This project is a Bun/TypeScript port of the original [mempalace](https://github.com/milla-jovovich/mempalace) by [milla-jovovich](https://github.com/milla-jovovich). The palace architecture, AAAK compression dialect, knowledge graph design, and MCP tool definitions all originate from their work.
102
+
103
+ ## License
104
+
105
+ MIT
package/dist/index.js CHANGED
@@ -50,7 +50,8 @@ var mempalacePlugin = async (_input, options) => {
50
50
  if (!config.mcp.mempalace) {
51
51
  config.mcp.mempalace = {
52
52
  type: "local",
53
- command: mcpCommand
53
+ command: mcpCommand,
54
+ environment: { CHROMA_URL: opts.chromaUrl ?? "http://localhost:8001" }
54
55
  };
55
56
  }
56
57
  },
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "opencode-mempalace",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "OpenCode plugin for MemPalace memory system — auto-registers MCP server, injects memory protocol into system prompt, and loads context on session start",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "type": "module",
8
8
  "files": [
9
- "dist"
9
+ "dist",
10
+ "README.md"
10
11
  ],
11
12
  "scripts": {
12
13
  "build": "bun build src/index.ts --outdir dist --target bun --format esm && tsc -p tsconfig.build.json",