opencode-graphiti 0.1.12 → 0.2.0-canary.12dc720.20260319065709
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 +247 -107
- package/esm/_dnt.polyfills.d.ts +17 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +14 -0
- package/esm/deno.d.ts +3 -5
- package/esm/deno.js +5 -7
- package/esm/mod.d.ts +1 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +1 -1
- package/esm/src/config.d.ts +8 -5
- package/esm/src/config.d.ts.map +1 -1
- package/esm/src/config.js +175 -50
- package/esm/src/handlers/chat.d.ts +6 -9
- package/esm/src/handlers/chat.d.ts.map +1 -1
- package/esm/src/handlers/chat.js +50 -206
- package/esm/src/handlers/compacting.d.ts +1 -9
- package/esm/src/handlers/compacting.d.ts.map +1 -1
- package/esm/src/handlers/compacting.js +23 -23
- package/esm/src/handlers/event.d.ts +9 -6
- package/esm/src/handlers/event.d.ts.map +1 -1
- package/esm/src/handlers/event.js +263 -169
- package/esm/src/handlers/messages.d.ts +1 -3
- package/esm/src/handlers/messages.d.ts.map +1 -1
- package/esm/src/handlers/messages.js +58 -59
- package/esm/src/index.d.ts +2 -3
- package/esm/src/index.d.ts.map +1 -1
- package/esm/src/index.js +170 -46
- package/esm/src/services/batch-drain.d.ts +23 -0
- package/esm/src/services/batch-drain.d.ts.map +1 -0
- package/esm/src/services/batch-drain.js +222 -0
- package/esm/src/services/connection-manager.d.ts +11 -4
- package/esm/src/services/connection-manager.d.ts.map +1 -1
- package/esm/src/services/connection-manager.js +138 -52
- package/esm/src/services/context-limit.d.ts +1 -6
- package/esm/src/services/context-limit.d.ts.map +1 -1
- package/esm/src/services/context-limit.js +16 -12
- package/esm/src/services/event-extractor.d.ts +29 -0
- package/esm/src/services/event-extractor.d.ts.map +1 -0
- package/esm/src/services/event-extractor.js +659 -0
- package/esm/src/services/graphiti-async.d.ts +25 -0
- package/esm/src/services/graphiti-async.d.ts.map +1 -0
- package/esm/src/services/graphiti-async.js +297 -0
- package/esm/src/services/{client.d.ts → graphiti-mcp.d.ts} +23 -30
- package/esm/src/services/graphiti-mcp.d.ts.map +1 -0
- package/esm/src/services/{client.js → graphiti-mcp.js} +66 -83
- package/esm/src/services/logger.d.ts.map +1 -1
- package/esm/src/services/logger.js +59 -0
- package/esm/src/services/opencode-warning.d.ts +8 -0
- package/esm/src/services/opencode-warning.d.ts.map +1 -0
- package/esm/src/services/opencode-warning.js +104 -0
- package/esm/src/services/redis-cache.d.ts +27 -0
- package/esm/src/services/redis-cache.d.ts.map +1 -0
- package/esm/src/services/redis-cache.js +228 -0
- package/esm/src/services/redis-client.d.ts +90 -0
- package/esm/src/services/redis-client.d.ts.map +1 -0
- package/esm/src/services/redis-client.js +905 -0
- package/esm/src/services/redis-events.d.ts +47 -0
- package/esm/src/services/redis-events.d.ts.map +1 -0
- package/esm/src/services/redis-events.js +529 -0
- package/esm/src/services/redis-snapshot.d.ts +16 -0
- package/esm/src/services/redis-snapshot.d.ts.map +1 -0
- package/esm/src/services/redis-snapshot.js +184 -0
- package/esm/src/services/render-utils.d.ts +22 -0
- package/esm/src/services/render-utils.d.ts.map +1 -0
- package/esm/src/services/render-utils.js +149 -0
- package/esm/src/services/runtime-teardown.d.ts +23 -0
- package/esm/src/services/runtime-teardown.d.ts.map +1 -0
- package/esm/src/services/runtime-teardown.js +137 -0
- package/esm/src/session.d.ts +46 -48
- package/esm/src/session.d.ts.map +1 -1
- package/esm/src/session.js +694 -196
- package/esm/src/types/index.d.ts +85 -36
- package/esm/src/types/index.d.ts.map +1 -1
- package/esm/src/types/index.js +28 -1
- package/esm/src/utils.d.ts.map +1 -1
- package/esm/src/utils.js +29 -10
- package/package.json +4 -3
- package/script/_dnt.polyfills.d.ts +17 -0
- package/script/_dnt.polyfills.d.ts.map +1 -1
- package/script/_dnt.polyfills.js +14 -0
- package/script/deno.d.ts +3 -5
- package/script/deno.js +5 -7
- package/script/mod.d.ts +1 -1
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +3 -15
- package/script/src/config.d.ts +8 -5
- package/script/src/config.d.ts.map +1 -1
- package/script/src/config.js +177 -51
- package/script/src/handlers/chat.d.ts +6 -9
- package/script/src/handlers/chat.d.ts.map +1 -1
- package/script/src/handlers/chat.js +49 -205
- package/script/src/handlers/compacting.d.ts +1 -9
- package/script/src/handlers/compacting.d.ts.map +1 -1
- package/script/src/handlers/compacting.js +23 -23
- package/script/src/handlers/event.d.ts +9 -6
- package/script/src/handlers/event.d.ts.map +1 -1
- package/script/src/handlers/event.js +263 -169
- package/script/src/handlers/messages.d.ts +1 -3
- package/script/src/handlers/messages.d.ts.map +1 -1
- package/script/src/handlers/messages.js +58 -59
- package/script/src/index.d.ts +2 -3
- package/script/src/index.d.ts.map +1 -1
- package/script/src/index.js +173 -47
- package/script/src/services/batch-drain.d.ts +23 -0
- package/script/src/services/batch-drain.d.ts.map +1 -0
- package/script/src/services/batch-drain.js +226 -0
- package/script/src/services/connection-manager.d.ts +11 -4
- package/script/src/services/connection-manager.d.ts.map +1 -1
- package/script/src/services/connection-manager.js +138 -52
- package/script/src/services/context-limit.d.ts +1 -6
- package/script/src/services/context-limit.d.ts.map +1 -1
- package/script/src/services/context-limit.js +16 -13
- package/script/src/services/event-extractor.d.ts +29 -0
- package/script/src/services/event-extractor.d.ts.map +1 -0
- package/script/src/services/event-extractor.js +669 -0
- package/script/src/services/graphiti-async.d.ts +25 -0
- package/script/src/services/graphiti-async.d.ts.map +1 -0
- package/script/src/services/graphiti-async.js +301 -0
- package/script/src/services/{client.d.ts → graphiti-mcp.d.ts} +23 -30
- package/script/src/services/graphiti-mcp.d.ts.map +1 -0
- package/script/src/services/{client.js → graphiti-mcp.js} +67 -84
- package/script/src/services/logger.d.ts.map +1 -1
- package/script/src/services/logger.js +59 -0
- package/script/src/services/opencode-warning.d.ts +8 -0
- package/script/src/services/opencode-warning.d.ts.map +1 -0
- package/script/src/services/opencode-warning.js +114 -0
- package/script/src/services/redis-cache.d.ts +27 -0
- package/script/src/services/redis-cache.d.ts.map +1 -0
- package/script/src/services/redis-cache.js +232 -0
- package/script/src/services/redis-client.d.ts +90 -0
- package/script/src/services/redis-client.d.ts.map +1 -0
- package/script/src/services/redis-client.js +942 -0
- package/script/src/services/redis-events.d.ts +47 -0
- package/script/src/services/redis-events.d.ts.map +1 -0
- package/script/src/services/redis-events.js +548 -0
- package/script/src/services/redis-snapshot.d.ts +16 -0
- package/script/src/services/redis-snapshot.d.ts.map +1 -0
- package/script/src/services/redis-snapshot.js +189 -0
- package/script/src/services/render-utils.d.ts +22 -0
- package/script/src/services/render-utils.d.ts.map +1 -0
- package/script/src/services/render-utils.js +165 -0
- package/script/src/services/runtime-teardown.d.ts +23 -0
- package/script/src/services/runtime-teardown.d.ts.map +1 -0
- package/script/src/services/runtime-teardown.js +173 -0
- package/script/src/session.d.ts +46 -48
- package/script/src/session.d.ts.map +1 -1
- package/script/src/session.js +694 -196
- package/script/src/types/index.d.ts +85 -36
- package/script/src/types/index.d.ts.map +1 -1
- package/script/src/types/index.js +31 -0
- package/script/src/utils.d.ts.map +1 -1
- package/script/src/utils.js +29 -10
- package/esm/src/services/client.d.ts.map +0 -1
- package/esm/src/services/compaction.d.ts +0 -52
- package/esm/src/services/compaction.d.ts.map +0 -1
- package/esm/src/services/compaction.js +0 -211
- package/esm/src/services/context.d.ts +0 -57
- package/esm/src/services/context.d.ts.map +0 -1
- package/esm/src/services/context.js +0 -178
- package/script/src/services/client.d.ts.map +0 -1
- package/script/src/services/compaction.d.ts +0 -52
- package/script/src/services/compaction.d.ts.map +0 -1
- package/script/src/services/compaction.js +0 -218
- package/script/src/services/context.d.ts +0 -57
- package/script/src/services/context.d.ts.map +0 -1
- package/script/src/services/context.js +0 -195
package/README.md
CHANGED
|
@@ -1,55 +1,105 @@
|
|
|
1
1
|
# opencode-graphiti
|
|
2
2
|
|
|
3
|
-
OpenCode plugin that
|
|
4
|
-
|
|
3
|
+
OpenCode plugin that gives your AI agent **short-term memory** and **long-term
|
|
4
|
+
memory**.
|
|
5
|
+
|
|
6
|
+
**Short-term memory** continuously summarizes and compacts every meaningful
|
|
7
|
+
session event — decisions, active tasks, file edits, errors, and more — into a
|
|
8
|
+
priority-tiered snapshot that is re-injected before every LLM call and every
|
|
9
|
+
compaction. The result is a rolling window of session continuity that
|
|
10
|
+
effectively extends the usable context far beyond the model's native limit: the
|
|
11
|
+
agent always knows what it was doing, even after the conversation is compacted.
|
|
12
|
+
|
|
13
|
+
**Long-term memory** persists knowledge across sessions via a
|
|
14
|
+
[Graphiti](https://github.com/getzep/graphiti) knowledge graph, so the agent can
|
|
15
|
+
recall project facts, past decisions, and learned preferences from earlier work
|
|
16
|
+
— not just the current session.
|
|
5
17
|
|
|
6
18
|
## Motivation
|
|
7
19
|
|
|
8
20
|
Long-running AI coding sessions depend on persistent memory to stay on track.
|
|
9
|
-
Graphiti's MCP server is the intended backbone for this, but in practice it is
|
|
10
|
-
unreliable — connections drop, queries time out, and ingestion silently fails.
|
|
11
21
|
When the context window fills up and OpenCode triggers compaction, the
|
|
12
|
-
summarizer discards details that were never
|
|
13
|
-
rot**: the agent loses track of recent decisions,
|
|
14
|
-
and drifts away from the original goal.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
summarizer discards details that were never captured outside the conversation.
|
|
23
|
+
The result is **context rot**: the agent loses track of recent decisions,
|
|
24
|
+
re-explores solved problems, and drifts away from the original goal.
|
|
25
|
+
|
|
26
|
+
Graphiti's MCP server is a powerful knowledge-graph backend, but calling it on
|
|
27
|
+
every message adds latency and introduces a single point of failure —
|
|
28
|
+
connections drop, queries time out, and ingestion silently fails.
|
|
29
|
+
|
|
30
|
+
This plugin exists to close both gaps.
|
|
31
|
+
|
|
32
|
+
**Short-term memory** captures every meaningful event during the session —
|
|
33
|
+
decisions, task progress, file edits, errors, environment changes — and
|
|
34
|
+
continuously summarizes them into a compact, priority-tiered snapshot. That
|
|
35
|
+
snapshot is re-injected before every LLM call and before every compaction, so
|
|
36
|
+
the agent always retains a coherent picture of the active workstream. Because
|
|
37
|
+
the snapshot is continuously rebuilt from structured events rather than raw
|
|
38
|
+
conversation text, it survives compaction intact: the model picks up exactly
|
|
39
|
+
where it left off, no matter how many times the conversation has been
|
|
40
|
+
summarized. In practice, this creates a rolling session memory that extends the
|
|
41
|
+
effective context window well beyond the model's native limit.
|
|
42
|
+
|
|
43
|
+
**Long-term memory** lives in Graphiti's knowledge graph, which is updated in
|
|
44
|
+
the background so it never slows down your conversation. It provides
|
|
45
|
+
cross-session recall — project facts, past decisions, and learned preferences
|
|
46
|
+
from earlier sessions — cached locally for instant injection alongside the
|
|
47
|
+
short-term snapshot.
|
|
20
48
|
|
|
21
49
|
## Overview
|
|
22
50
|
|
|
23
|
-
This plugin
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
51
|
+
This plugin uses a two-layer memory architecture:
|
|
52
|
+
|
|
53
|
+
**Short-term memory — continuously summarized session continuity:**
|
|
54
|
+
|
|
55
|
+
- Captures every meaningful event (decisions, tasks, file edits, errors,
|
|
56
|
+
environment changes) as structured session events
|
|
57
|
+
- Continuously rebuilds a priority-tiered snapshot from those events, keeping
|
|
58
|
+
the most important context within a tight budget
|
|
59
|
+
- Re-injects the snapshot before every LLM call and every compaction as a
|
|
60
|
+
`<session_memory>` block, so the agent never loses track of the active
|
|
61
|
+
workstream — even after repeated compactions
|
|
62
|
+
- Detects topic drift and schedules a background refresh of cached long-term
|
|
63
|
+
facts when the conversation shifts
|
|
64
|
+
|
|
65
|
+
**Long-term memory — persistent cross-session recall via Graphiti:**
|
|
66
|
+
|
|
67
|
+
- Sends buffered session events to Graphiti as episodes on idle or before
|
|
68
|
+
compaction
|
|
69
|
+
- Refreshes the local memory cache from Graphiti search results in the
|
|
70
|
+
background
|
|
71
|
+
- Provides cross-session recall via vector/graph search, cached locally for
|
|
72
|
+
instant injection alongside the short-term snapshot
|
|
73
|
+
- Saves compaction summaries as episodes so knowledge survives across session
|
|
74
|
+
boundaries
|
|
75
|
+
|
|
76
|
+
Graphiti stays off the steady-state hook path entirely: hook-time injection uses
|
|
77
|
+
only Redis/local cached recall, while fresh Graphiti data arrives through the
|
|
78
|
+
existing background refresh path on later turns.
|
|
37
79
|
|
|
38
80
|
## Prerequisites
|
|
39
81
|
|
|
40
|
-
|
|
82
|
+
Start the
|
|
41
83
|
[Graphiti MCP server](https://github.com/getzep/graphiti/tree/main/mcp_server)
|
|
42
|
-
|
|
84
|
+
with its default [FalkorDB](https://www.falkordb.com/) backend:
|
|
43
85
|
|
|
44
86
|
```bash
|
|
45
|
-
# Clone and start with Docker Compose
|
|
46
87
|
git clone https://github.com/getzep/graphiti.git
|
|
47
88
|
cd graphiti/mcp_server
|
|
48
89
|
docker compose up -d
|
|
49
90
|
```
|
|
50
91
|
|
|
51
|
-
This starts
|
|
52
|
-
|
|
92
|
+
This starts Graphiti at `http://localhost:8000/mcp` and FalkorDB/Redis on
|
|
93
|
+
`localhost:6379`.
|
|
94
|
+
|
|
95
|
+
This plugin reuses that same FalkorDB/Redis storage layer alongside Graphiti: it
|
|
96
|
+
keeps short-term memory locally for every turn, while Graphiti builds the
|
|
97
|
+
long-term knowledge graph on top of the same backend.
|
|
98
|
+
|
|
99
|
+
> **Note:** Graphiti is optional for basic operation. If Graphiti is
|
|
100
|
+
> unavailable, the plugin continues to function with FalkorDB/Redis-sourced
|
|
101
|
+
> session memory; only the `<persistent_memory>` section (long-term
|
|
102
|
+
> cross-session facts) will be absent until Graphiti comes online.
|
|
53
103
|
|
|
54
104
|
## Installation
|
|
55
105
|
|
|
@@ -65,19 +115,14 @@ Add the plugin to your `opencode.json` (or `opencode.jsonc`):
|
|
|
65
115
|
|
|
66
116
|
### Option B: Local build
|
|
67
117
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
cd opencode-graphiti
|
|
73
|
-
deno task build
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Then add to your `opencode.json`:
|
|
118
|
+
Local distributable builds are not a routine local setup step: `deno task
|
|
119
|
+
build`
|
|
120
|
+
requires an explicit `VERSION` via `dnt.ts`. If you already have a built
|
|
121
|
+
artifact, add it to your `opencode.json`:
|
|
77
122
|
|
|
78
123
|
```jsonc
|
|
79
124
|
{
|
|
80
|
-
"plugin": ["file:///absolute/path/to/opencode-graphiti/dist/
|
|
125
|
+
"plugin": ["file:///absolute/path/to/opencode-graphiti/dist/esm/mod.js"]
|
|
81
126
|
}
|
|
82
127
|
```
|
|
83
128
|
|
|
@@ -87,11 +132,11 @@ Copy the built plugin into OpenCode's auto-loaded plugin directory:
|
|
|
87
132
|
|
|
88
133
|
```bash
|
|
89
134
|
# Global (all projects)
|
|
90
|
-
cp dist/
|
|
135
|
+
cp dist/esm/mod.js ~/.config/opencode/plugins/opencode-graphiti.js
|
|
91
136
|
|
|
92
137
|
# Or project-level
|
|
93
138
|
mkdir -p .opencode/plugins
|
|
94
|
-
cp dist/
|
|
139
|
+
cp dist/esm/mod.js .opencode/plugins/opencode-graphiti.js
|
|
95
140
|
```
|
|
96
141
|
|
|
97
142
|
No config entry needed — OpenCode loads plugins from these directories
|
|
@@ -101,95 +146,185 @@ automatically.
|
|
|
101
146
|
|
|
102
147
|
Supported config locations, in lookup order:
|
|
103
148
|
|
|
104
|
-
1. The provided project directory: `package.json#graphiti`, `.graphitirc`, and
|
|
105
|
-
|
|
149
|
+
1. The provided project directory: `package.json#graphiti`, `.graphitirc`, and
|
|
150
|
+
other standard `cosmiconfig` `graphiti` filenames
|
|
151
|
+
2. Standard global/home `graphiti` config locations discovered by `cosmiconfig`
|
|
152
|
+
(for example `~/.graphitirc`)
|
|
106
153
|
3. Legacy fallback: `~/.config/opencode/.graphitirc`
|
|
107
154
|
|
|
108
|
-
|
|
155
|
+
### Nested Config Shape (recommended)
|
|
109
156
|
|
|
110
157
|
```jsonc
|
|
111
158
|
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
159
|
+
"redis": {
|
|
160
|
+
// Redis endpoint used for the plugin hot tier
|
|
161
|
+
"endpoint": "redis://localhost:6379",
|
|
162
|
+
// Max events per drain batch
|
|
163
|
+
"batchSize": 20,
|
|
164
|
+
// Max combined body bytes per drain batch
|
|
165
|
+
"batchMaxBytes": 51200,
|
|
166
|
+
// Session event TTL in seconds (default: 24 h)
|
|
167
|
+
"sessionTtlSeconds": 86400,
|
|
168
|
+
// Memory cache TTL in seconds (default: 10 min)
|
|
169
|
+
"cacheTtlSeconds": 600,
|
|
170
|
+
// Max drain retry attempts before dead-lettering
|
|
171
|
+
"drainRetryMax": 3
|
|
172
|
+
},
|
|
173
|
+
"graphiti": {
|
|
174
|
+
// Graphiti MCP server endpoint
|
|
175
|
+
"endpoint": "http://localhost:8000/mcp",
|
|
176
|
+
// Prefix for project group IDs (e.g. "opencode-my-project")
|
|
177
|
+
"groupIdPrefix": "opencode",
|
|
178
|
+
// Jaccard similarity threshold (0–1) below which cache is refreshed
|
|
179
|
+
"driftThreshold": 0.5
|
|
180
|
+
}
|
|
124
181
|
}
|
|
125
182
|
```
|
|
126
183
|
|
|
127
184
|
All fields are optional — defaults (shown above) are used for any missing
|
|
128
|
-
values.
|
|
185
|
+
values. Canonical nested values take precedence when both forms are supplied.
|
|
186
|
+
|
|
187
|
+
### Retained Compatibility
|
|
188
|
+
|
|
189
|
+
The canonical hot-tier config shape is `redis.*`. Only the original Graphiti
|
|
190
|
+
top-level aliases remain supported for backward compatibility. Precedence is:
|
|
191
|
+
|
|
192
|
+
1. `redis.*` (canonical)
|
|
193
|
+
2. top-level Graphiti aliases such as `endpoint` and `groupIdPrefix`
|
|
194
|
+
|
|
195
|
+
### Legacy Top-Level Keys
|
|
196
|
+
|
|
197
|
+
For backward compatibility, the following original Graphiti top-level keys are
|
|
198
|
+
still accepted and map to their nested equivalents:
|
|
199
|
+
|
|
200
|
+
| Legacy key | Nested equivalent |
|
|
201
|
+
| ---------------- | ------------------------- |
|
|
202
|
+
| `endpoint` | `graphiti.endpoint` |
|
|
203
|
+
| `groupIdPrefix` | `graphiti.groupIdPrefix` |
|
|
204
|
+
| `driftThreshold` | `graphiti.driftThreshold` |
|
|
205
|
+
|
|
206
|
+
Removed top-level Redis aliases are no longer supported.
|
|
129
207
|
|
|
130
208
|
## How It Works
|
|
131
209
|
|
|
132
|
-
###
|
|
210
|
+
### Injection Format
|
|
211
|
+
|
|
212
|
+
The plugin currently injects a `<session_memory>` XML envelope into the last
|
|
213
|
+
user message. This envelope is assembled from short-term memory in Redis and can
|
|
214
|
+
contain structured sections such as `<last_request>`, `<active_tasks>`,
|
|
215
|
+
`<key_decisions>`, `<files_in_play>`, `<project_rules>`, and an optional
|
|
216
|
+
`<session_snapshot>`.
|
|
217
|
+
|
|
218
|
+
When long-term memory is available, a nested `<persistent_memory>` section is
|
|
219
|
+
included with a `node_refs` attribute naming the emitted cached entities. On a
|
|
220
|
+
cold first turn or when Graphiti is unreachable, `<persistent_memory>` is simply
|
|
221
|
+
absent — the rest of the session memory is always available from short-term
|
|
222
|
+
storage in FalkorDB/Redis.
|
|
223
|
+
|
|
224
|
+
```xml
|
|
225
|
+
<session_memory source="graphiti" version="1">
|
|
226
|
+
<last_request>Continue the current task.</last_request>
|
|
227
|
+
<active_tasks><task>Implement the new feature.</task></active_tasks>
|
|
228
|
+
<key_decisions><decision>Use Redis for short-term memory.</decision></key_decisions>
|
|
229
|
+
<files_in_play><file>src/index.ts</file></files_in_play>
|
|
230
|
+
<project_rules><rule>Graphiti runs in the background only.</rule></project_rules>
|
|
231
|
+
<session_snapshot><!-- priority-tiered snapshot --></session_snapshot>
|
|
232
|
+
<persistent_memory node_refs="nodeA">
|
|
233
|
+
<!-- long-term node/episode summaries from Graphiti, optional -->
|
|
234
|
+
</persistent_memory>
|
|
235
|
+
</session_memory>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Session Memory Preparation (`chat.message`)
|
|
133
239
|
|
|
134
|
-
On each user message the plugin
|
|
135
|
-
|
|
136
|
-
(70% / 30% budget), deduplicated, filtered for validity, annotated with
|
|
137
|
-
staleness if older than `factStaleDays`, and formatted as Markdown. The
|
|
138
|
-
formatted context is cached on the session state for the messages transform hook
|
|
139
|
-
to pick up.
|
|
240
|
+
On each user message the plugin assembles the current session memory from three
|
|
241
|
+
sources:
|
|
140
242
|
|
|
141
|
-
|
|
142
|
-
|
|
243
|
+
- Recent structured session events
|
|
244
|
+
- The continuously rebuilt priority-tiered snapshot
|
|
245
|
+
- Cached long-term facts from Graphiti
|
|
143
246
|
|
|
144
|
-
|
|
145
|
-
|
|
247
|
+
These are composed into a `<session_memory>` envelope and staged for the
|
|
248
|
+
transform hook. The hook-time reads are local/cache-backed only; any fresh
|
|
249
|
+
Graphiti lookup remains on the existing background refresh path and benefits the
|
|
250
|
+
next turn instead of blocking the current one.
|
|
146
251
|
|
|
147
252
|
### User Message Injection (`experimental.chat.messages.transform`)
|
|
148
253
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
254
|
+
The transform hook reads the prepared `<session_memory>` envelope and prepends
|
|
255
|
+
it to the last user message. Legacy `<memory data-uuids>` and older
|
|
256
|
+
`<persistent_memory fact_uuids>` blocks are still scrubbed and parsed for
|
|
257
|
+
compatibility, while current `<persistent_memory>` output uses `node_refs`. This
|
|
258
|
+
approach keeps the system prompt static, enabling provider-side prefix caching,
|
|
259
|
+
and avoids influencing session titles. The prepared injection is cleared after
|
|
260
|
+
use so stale context is not re-injected on subsequent LLM calls within the same
|
|
261
|
+
turn.
|
|
157
262
|
|
|
158
|
-
### Drift
|
|
263
|
+
### Drift Detection and Background Cache Refresh
|
|
159
264
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
refreshed
|
|
265
|
+
On each user message, the plugin compares the current query against the query
|
|
266
|
+
that produced the cached memory. When Jaccard similarity between the current
|
|
267
|
+
query text and cached query text drops below `driftThreshold` (default 0.5), a
|
|
268
|
+
background cache refresh is scheduled via Graphiti. The current cached context
|
|
269
|
+
is still injected immediately; the refreshed cache becomes available on the next
|
|
270
|
+
message. This trades one message of staleness for keeping most long-term memory
|
|
271
|
+
refresh work off the response-time path.
|
|
165
272
|
|
|
166
|
-
###
|
|
273
|
+
### Event Extraction and Buffering (`event`)
|
|
167
274
|
|
|
168
|
-
User and assistant messages are
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
275
|
+
User and assistant messages are captured as structured `SessionEvent` objects
|
|
276
|
+
and stored in Redis (`session:{id}:events`). The plugin listens on
|
|
277
|
+
`message.part.updated` to buffer assistant text as it streams, and on
|
|
278
|
+
`message.updated` to finalize completed assistant replies.
|
|
172
279
|
|
|
173
|
-
|
|
174
|
-
bytes of buffered content.
|
|
175
|
-
- **Before compaction** (`session.compacted`): all buffered messages are flushed
|
|
176
|
-
immediately (no minimum size) so nothing is lost.
|
|
280
|
+
Events are also queued for background ingestion into long-term memory:
|
|
177
281
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
282
|
+
- **On idle** (`session.idle`): buffered events are sent to Graphiti and the
|
|
283
|
+
priority-tiered snapshot is rebuilt.
|
|
284
|
+
- **Before compaction** (`session.compacted`): all pending events are sent
|
|
285
|
+
immediately so nothing is lost.
|
|
181
286
|
|
|
182
|
-
### Compaction Preservation
|
|
287
|
+
### Compaction Preservation
|
|
183
288
|
|
|
184
289
|
Compaction is handled entirely by OpenCode's native compaction mechanism. The
|
|
185
|
-
plugin
|
|
290
|
+
plugin ensures session continuity survives each compaction cycle:
|
|
186
291
|
|
|
187
292
|
1. **Before compaction** (`experimental.session.compacting`): The plugin injects
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
293
|
+
the same `<session_memory>` envelope used for chat — including the
|
|
294
|
+
priority-tiered snapshot and cached long-term facts — so the summarizer
|
|
295
|
+
preserves important knowledge. No Graphiti call is made.
|
|
296
|
+
2. **After compaction** (`session.compacted`): The snapshot is rebuilt from
|
|
297
|
+
structured events and the compaction summary is sent to Graphiti in the
|
|
298
|
+
background, ensuring knowledge survives across compaction boundaries.
|
|
299
|
+
|
|
300
|
+
Because the snapshot is rebuilt from structured events rather than raw
|
|
301
|
+
conversation text, the agent retains a coherent picture of the workstream
|
|
302
|
+
regardless of how aggressively the conversation was summarized.
|
|
303
|
+
|
|
304
|
+
### Child / Subagent Session Handling
|
|
305
|
+
|
|
306
|
+
> **Note:** This behavior intentionally diverges from
|
|
307
|
+
> [context-mode](https://github.com/mksglu/context-mode), which records subagent
|
|
308
|
+
> work as summarized tool events. This plugin promotes child sessions to
|
|
309
|
+
> first-class participants in the root session's state so that decisions, file
|
|
310
|
+
> edits, and errors from delegated work are fully visible to the parent session.
|
|
311
|
+
> See `plans/ContextOverhaul.md` §10.1 for the design rationale.
|
|
312
|
+
|
|
313
|
+
When OpenCode spawns a child session (e.g. a subagent or delegated task), the
|
|
314
|
+
plugin resolves the child's `sessionID` to the root/parent session by walking
|
|
315
|
+
the `parentID` chain. All event storage, snapshot builds, and `<session_memory>`
|
|
316
|
+
injection then operate on the canonical root session, so child activity is
|
|
317
|
+
treated identically to parent activity:
|
|
318
|
+
|
|
319
|
+
- Child prompts and responses are recorded in the same event log as the parent.
|
|
320
|
+
- The priority-tiered snapshot includes child-derived events when it is rebuilt.
|
|
321
|
+
- Future `<session_memory>` injections — for both parent and child turns —
|
|
322
|
+
reflect the combined activity of the entire session lineage.
|
|
323
|
+
- Deleting a child session removes only that child's local bookkeeping; the root
|
|
324
|
+
session's state, events, and snapshot are preserved.
|
|
325
|
+
|
|
326
|
+
This means the agent retains full continuity across delegation boundaries
|
|
327
|
+
without any special configuration.
|
|
193
328
|
|
|
194
329
|
### Project Scoping
|
|
195
330
|
|
|
@@ -201,13 +336,18 @@ projects stay isolated.
|
|
|
201
336
|
## Contributing
|
|
202
337
|
|
|
203
338
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and release
|
|
204
|
-
process.
|
|
339
|
+
process. In CI, pushes to `main` publish `latest` releases, while pull requests
|
|
340
|
+
targeting `main` publish canary builds under the `canary` dist-tag.
|
|
205
341
|
|
|
206
342
|
## License
|
|
207
343
|
|
|
208
344
|
MIT
|
|
209
345
|
|
|
210
|
-
##
|
|
346
|
+
## Acknowledgements
|
|
347
|
+
|
|
348
|
+
The structured event extraction, priority-tiered snapshots, and session
|
|
349
|
+
continuity design in this plugin are inspired by
|
|
350
|
+
[context-mode](https://github.com/mksglu/context-mode).
|
|
211
351
|
|
|
212
|
-
|
|
213
|
-
[opencode-openmemory](https://github.com/happycastle114/opencode-openmemory)
|
|
352
|
+
The original plugin concept is inspired by
|
|
353
|
+
[opencode-openmemory](https://github.com/happycastle114/opencode-openmemory).
|
package/esm/_dnt.polyfills.d.ts
CHANGED
|
@@ -47,6 +47,23 @@ declare global {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
export {};
|
|
50
|
+
declare global {
|
|
51
|
+
interface Object {
|
|
52
|
+
/**
|
|
53
|
+
* Determines whether an object has a property with the specified name.
|
|
54
|
+
* @param o An object.
|
|
55
|
+
* @param v A property name.
|
|
56
|
+
*/
|
|
57
|
+
hasOwn(o: object, v: PropertyKey): boolean;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
61
|
+
declare global {
|
|
62
|
+
interface Error {
|
|
63
|
+
cause?: unknown;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
50
67
|
/**
|
|
51
68
|
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
52
69
|
* but instead of using npm to install additional dependencies,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC,CAAC;QACf;;;;;;;;WAQG;QACH,QAAQ,CAAC,CAAC,SAAS,CAAC,EAClB,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC,EACxE,OAAO,CAAC,EAAE,GAAG,GACZ,CAAC,GAAG,SAAS,CAAC;QACjB,QAAQ,CACN,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,OAAO,EACzD,OAAO,CAAC,EAAE,GAAG,GACZ,CAAC,GAAG,SAAS,CAAC;QAEjB;;;;;;;;WAQG;QACH,aAAa,CACX,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,OAAO,EACzD,OAAO,CAAC,EAAE,GAAG,GACZ,MAAM,CAAC;KACX;IACD,UAAU,UAAU;QAClB;;;;;;;;WAQG;QACH,QAAQ,CAAC,CAAC,SAAS,MAAM,EACvB,SAAS,EAAE,CACP,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,UAAU,KAChB,KAAK,IAAI,CAAC,EACf,OAAO,CAAC,EAAE,GAAG,GACZ,CAAC,GAAG,SAAS,CAAC;QACjB,QAAQ,CACJ,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KA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AAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,UAAU,0BAA0B;IAClC,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACxD;AACD,UAAU,0BAA0B;IAClC,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;CACtC;AACD,UAAU,kBACR,SAAQ,0BAA0B,EAAE,0BAA0B;CAC/D;AAiBD,eAAO,IAAI,6BAA6B,EA2BnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,6BAA6B,EA4DnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,oBAAoB,EAoB1B,kBAAkB,CAAC"}
|
package/esm/_dnt.polyfills.js
CHANGED
|
@@ -34,6 +34,20 @@ if (!Uint8Array.prototype.findLast) {
|
|
|
34
34
|
return findLast(this, callbackfn, that);
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
+
// https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js
|
|
38
|
+
if (!Object.hasOwn) {
|
|
39
|
+
Object.defineProperty(Object, "hasOwn", {
|
|
40
|
+
value: function (object, property) {
|
|
41
|
+
if (object == null) {
|
|
42
|
+
throw new TypeError("Cannot convert undefined or null to object");
|
|
43
|
+
}
|
|
44
|
+
return Object.prototype.hasOwnProperty.call(Object(object), property);
|
|
45
|
+
},
|
|
46
|
+
configurable: true,
|
|
47
|
+
enumerable: false,
|
|
48
|
+
writable: true,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
37
51
|
/**
|
|
38
52
|
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
39
53
|
* but instead of using npm to install additional dependencies,
|
package/esm/deno.d.ts
CHANGED
|
@@ -5,12 +5,9 @@ declare namespace _default {
|
|
|
5
5
|
export let license: string;
|
|
6
6
|
export namespace tasks {
|
|
7
7
|
let build: string;
|
|
8
|
-
namespace deploy {
|
|
9
|
-
let command: string;
|
|
10
|
-
let dependencies: string[];
|
|
11
|
-
}
|
|
12
|
-
let dev: string;
|
|
13
8
|
let check: string;
|
|
9
|
+
let deploy: string;
|
|
10
|
+
let dev: string;
|
|
14
11
|
let lint: string;
|
|
15
12
|
let fmt: string;
|
|
16
13
|
}
|
|
@@ -37,6 +34,7 @@ declare namespace _default {
|
|
|
37
34
|
"@opencode-ai/plugin": string;
|
|
38
35
|
"@opencode-ai/sdk": string;
|
|
39
36
|
cosmiconfig: string;
|
|
37
|
+
ioredis: string;
|
|
40
38
|
zod: string;
|
|
41
39
|
};
|
|
42
40
|
export let exports: {
|
package/esm/deno.js
CHANGED
|
@@ -5,12 +5,9 @@ export default {
|
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"tasks": {
|
|
7
7
|
"build": "deno run -A dnt.ts",
|
|
8
|
-
"deploy": {
|
|
9
|
-
"command": "cd dist/ && npm publish",
|
|
10
|
-
"dependencies": ["build"]
|
|
11
|
-
},
|
|
12
|
-
"dev": "deno run --allow-all src/index.ts",
|
|
13
8
|
"check": "deno check src/index.ts",
|
|
9
|
+
"deploy": "deno eval \"throw new Error('Manual publish is disabled. Use the GitHub Actions publish workflow for releases.')\"",
|
|
10
|
+
"dev": "deno run --allow-all src/index.ts",
|
|
14
11
|
"lint": "deno lint",
|
|
15
12
|
"fmt": "deno fmt"
|
|
16
13
|
},
|
|
@@ -30,9 +27,10 @@ export default {
|
|
|
30
27
|
"nodeModulesDir": "auto",
|
|
31
28
|
"imports": {
|
|
32
29
|
"@modelcontextprotocol/sdk": "npm:@modelcontextprotocol/sdk@^1.25.2",
|
|
33
|
-
"@opencode-ai/plugin": "npm:@opencode-ai/plugin
|
|
34
|
-
"@opencode-ai/sdk": "npm:@opencode-ai/sdk
|
|
30
|
+
"@opencode-ai/plugin": "npm:@opencode-ai/plugin@1.2.26",
|
|
31
|
+
"@opencode-ai/sdk": "npm:@opencode-ai/sdk@1.2.26",
|
|
35
32
|
"cosmiconfig": "npm:cosmiconfig@9.0.0",
|
|
33
|
+
"ioredis": "npm:ioredis@^5.7.0",
|
|
36
34
|
"zod": "npm:zod@4.3.6"
|
|
37
35
|
},
|
|
38
36
|
"exports": {
|
package/esm/mod.d.ts
CHANGED
package/esm/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
|
package/esm/mod.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "./_dnt.polyfills.js";
|
|
2
|
-
export
|
|
2
|
+
export { graphiti } from "./src/index.js";
|
package/esm/src/config.d.ts
CHANGED
|
@@ -2,6 +2,14 @@ import type { GraphitiConfig } from "./types/index.js";
|
|
|
2
2
|
type ConfigLoadResult = {
|
|
3
3
|
config: unknown;
|
|
4
4
|
} | null;
|
|
5
|
+
type ConfigLoadErrorCode = "config-discovery-init" | "config-discovery-search" | "config-file-load" | "config-invalid";
|
|
6
|
+
export declare class ConfigLoadError extends Error {
|
|
7
|
+
readonly code: ConfigLoadErrorCode;
|
|
8
|
+
constructor(message: string, options: {
|
|
9
|
+
cause?: unknown;
|
|
10
|
+
code: ConfigLoadErrorCode;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
5
13
|
export interface ConfigExplorerAdapter {
|
|
6
14
|
search(from?: string): ConfigLoadResult;
|
|
7
15
|
load(filePath: string): ConfigLoadResult;
|
|
@@ -9,11 +17,6 @@ export interface ConfigExplorerAdapter {
|
|
|
9
17
|
type ConfigExplorerFactory = () => ConfigExplorerAdapter;
|
|
10
18
|
export declare const setConfigExplorerAdapterForTesting: (factory: ConfigExplorerFactory) => void;
|
|
11
19
|
export declare const resetConfigExplorerAdapterForTesting: () => void;
|
|
12
|
-
/**
|
|
13
|
-
* Load Graphiti configuration via cosmiconfig discovery, with a legacy fallback
|
|
14
|
-
* to `~/.config/opencode/.graphitirc` only when discovery succeeds and returns
|
|
15
|
-
* no result.
|
|
16
|
-
*/
|
|
17
20
|
export declare function loadConfig(directory?: string): GraphitiConfig;
|
|
18
21
|
export {};
|
|
19
22
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/src/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/src/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,kBAAkB,CAAC;AAkB1E,KAAK,gBAAgB,GAAG;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAAC;AAEnD,KAAK,mBAAmB,GACpB,uBAAuB,GACvB,yBAAyB,GACzB,kBAAkB,GAClB,gBAAgB,CAAC;AAErB,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;gBAGjC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,mBAAmB,CAAA;KAAE;CAc1D;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACxC,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAAC;CAC1C;AAED,KAAK,qBAAqB,GAAG,MAAM,qBAAqB,CAAC;AA8KzD,eAAO,MAAM,kCAAkC,GAC7C,SAAS,qBAAqB,KAC7B,IAEF,CAAC;AAEF,eAAO,MAAM,oCAAoC,QAAO,IAEvD,CAAC;AA0EF,wBAAgB,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,cAAc,CAiB7D"}
|