ever-opencode 0.0.0-stage → 0.2.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 +203 -0
- package/README.md +240 -2
- package/dist/everos.d.ts +72 -0
- package/dist/everos.js +118 -0
- package/dist/extract.d.ts +37 -0
- package/dist/extract.js +48 -0
- package/dist/identity.d.ts +28 -0
- package/dist/identity.js +56 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +259 -0
- package/dist/inject.d.ts +18 -0
- package/dist/inject.js +49 -0
- package/dist/log.d.ts +11 -0
- package/dist/log.js +34 -0
- package/dist/tools.d.ts +63 -0
- package/dist/tools.js +155 -0
- package/dist/types.d.ts +83 -0
- package/dist/types.js +6 -0
- package/package.json +41 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
(e) The Work is provided to You on an "AS IS" BASIS, WITHOUT
|
|
124
|
+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
|
125
|
+
including, without limitation, any warranties or conditions
|
|
126
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
127
|
+
PARTICULAR PURPOSE. You are responsible for determining the
|
|
128
|
+
appropriateness of using or redistributing the Work and assume
|
|
129
|
+
any risks associated with Your exercise of permissions under
|
|
130
|
+
this License.
|
|
131
|
+
|
|
132
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
133
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
134
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
135
|
+
this License, without any additional terms or conditions.
|
|
136
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
137
|
+
the terms of any separate license agreement you may have executed
|
|
138
|
+
with Licensor regarding such Contributions.
|
|
139
|
+
|
|
140
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
141
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
142
|
+
except as required for reasonable and customary use in describing the
|
|
143
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
144
|
+
|
|
145
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
146
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
147
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
148
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
149
|
+
implied, including, without limitation, any warranties or conditions
|
|
150
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
151
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
152
|
+
appropriateness of using or redistributing the Work and any harm
|
|
153
|
+
resulting from Your use of the Work.
|
|
154
|
+
|
|
155
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
156
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
157
|
+
unless required by applicable law (such as deliberate and grossly
|
|
158
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
159
|
+
liable to You for damages, including any direct, indirect, special,
|
|
160
|
+
incidental, or consequential damages of any character arising as a
|
|
161
|
+
result of this License or out of the use or inability to use the
|
|
162
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
163
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
164
|
+
other commercial damages or losses), even if such Contributor
|
|
165
|
+
has been advised of the possibility of such damages.
|
|
166
|
+
|
|
167
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
168
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
169
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
170
|
+
or other liability obligations and/or rights consistent with this
|
|
171
|
+
License. However, in accepting such obligations, You may act only
|
|
172
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
173
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
174
|
+
defend, and hold each Contributor harmless for any liability
|
|
175
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
176
|
+
of your accepting any such warranty or additional liability.
|
|
177
|
+
|
|
178
|
+
END OF TERMS AND CONDITIONS
|
|
179
|
+
|
|
180
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
181
|
+
|
|
182
|
+
To apply the Apache License to your work, attach the following
|
|
183
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
184
|
+
replaced with your own identifying information. (Don't include
|
|
185
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
186
|
+
comment syntax for the file format. We also recommend that a
|
|
187
|
+
file or class name and description of purpose be included on the
|
|
188
|
+
same "printed page" as the copyright notice for easier
|
|
189
|
+
identification within third-party archives.
|
|
190
|
+
|
|
191
|
+
Copyright [yyyy] [name of copyright owner]
|
|
192
|
+
|
|
193
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
194
|
+
you may not use this file except in compliance with the License.
|
|
195
|
+
You may obtain a copy of the License at
|
|
196
|
+
|
|
197
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
198
|
+
|
|
199
|
+
Unless required by applicable law or agreed to in writing, software
|
|
200
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
201
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
|
+
See the License for the specific language governing permissions and
|
|
203
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,241 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ever-opencode
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Persistent memory plugin for [OpenCode](https://docs.opencode.ai) V2, backed by a
|
|
4
|
+
local [EverOS](https://pypi.org/project/everos/) server. Capture every turn,
|
|
5
|
+
inject relevant recall into future turns — zero agent discipline required.
|
|
6
|
+
|
|
7
|
+
Local-first, free, provider-neutral: the plugin is an **LLM-free HTTP client**.
|
|
8
|
+
It never loads an SDK, never sees an API key, and makes zero model calls. All
|
|
9
|
+
provider choice lives in the EverOS server config.
|
|
10
|
+
|
|
11
|
+
## How it works
|
|
12
|
+
|
|
13
|
+
- **Capture** — on each completed assistant turn (`session.text.ended`), the
|
|
14
|
+
plugin reads the new transcript messages and posts them to the EverOS server
|
|
15
|
+
with deferred extraction (buffered, no LLM at capture time). Fire-and-forget;
|
|
16
|
+
turn end is never blocked.
|
|
17
|
+
- **Recall** — on each new user message, the plugin searches EverOS for
|
|
18
|
+
relevant episodes and pushes a compact recall block into the system context.
|
|
19
|
+
Deduped per user message so a single search runs per turn.
|
|
20
|
+
- **Flush** — extraction runs when the Nth capture lands (`flushEvery`, default
|
|
21
|
+
3) and always before compaction, so episodes exist before the transcript is
|
|
22
|
+
summarized.
|
|
23
|
+
- **Storage** — episodes land on disk as human-readable Markdown at
|
|
24
|
+
`~/.everos/<app>/<project>/users/<user_id>/episodes/episode-<date>.md`.
|
|
25
|
+
|
|
26
|
+
The agent never has to "remember to save". Server down? Sessions degrade
|
|
27
|
+
gracefully — the plugin logs once and stays a silent no-op.
|
|
28
|
+
|
|
29
|
+
## Quickstart (30 seconds)
|
|
30
|
+
|
|
31
|
+
### 1. Install and start EverOS
|
|
32
|
+
|
|
33
|
+
Requires Python 3.12+.
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
uv tool install everos # or: pip install everos
|
|
37
|
+
everos init # writes ~/.everos/everos.toml
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Point `[llm]` at any OpenAI chat-completions-compatible endpoint, e.g. Ollama
|
|
41
|
+
(local and free):
|
|
42
|
+
|
|
43
|
+
```toml
|
|
44
|
+
[llm]
|
|
45
|
+
model = "openai/llama3.1"
|
|
46
|
+
api_key = "ollama" # ignored by Ollama, but must be set
|
|
47
|
+
base_url = "http://localhost:11434/v1"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Start the server:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
everos server start # serves http://127.0.0.1:8000
|
|
54
|
+
curl http://127.0.0.1:8000/health # → {"status":"ok"}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 2. Install the plugin
|
|
58
|
+
|
|
59
|
+
From GitHub (no npm needed — one command, writes your global config):
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
opencode plugin add github:xeon826/ever-opencode#v0.2.0
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`#v0.2.0` pins the release tag; `#main` tracks the branch (with update
|
|
66
|
+
checks), and a full commit SHA pins exactly. Or add it to your OpenCode
|
|
67
|
+
config's `plugins` array by hand:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"plugins": ["github:xeon826/ever-opencode#v0.2.0"]
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Also available on npm as `ever-opencode`. With options:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"plugins": [
|
|
80
|
+
{
|
|
81
|
+
"package": "github:xeon826/ever-opencode#v0.2.0",
|
|
82
|
+
"options": {
|
|
83
|
+
"everosUrl": "http://127.0.0.1:8000",
|
|
84
|
+
"flushEvery": 3,
|
|
85
|
+
"topK": 5,
|
|
86
|
+
"recallMethod": "keyword",
|
|
87
|
+
"enabled": true,
|
|
88
|
+
"logLevel": "info"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 3. Talk
|
|
96
|
+
|
|
97
|
+
Have a conversation, then check episodes on disk:
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
ls ~/.everos/opencode/<project>/users/<you>/episodes/
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Future sessions in the same project recall what happened in past ones.
|
|
104
|
+
|
|
105
|
+
## Agent tools
|
|
106
|
+
|
|
107
|
+
Beyond passive capture + recall injection, the plugin registers three tools the
|
|
108
|
+
agent can call on demand (same pattern as the mem0 plugin's memory tools):
|
|
109
|
+
|
|
110
|
+
| Tool | What it does |
|
|
111
|
+
| --- | --- |
|
|
112
|
+
| `everos_search` | Query memory on demand — "what did we decide about X last month?" Search runs server-side (BM25/vector); results carry relevance scores and ages. Project scope by default, `scope: "global"` widens to all projects. |
|
|
113
|
+
| `everos_add` | Store a durable fact immediately — add + synchronous extraction. Becomes searchable within a few seconds. |
|
|
114
|
+
| `everos_flush` | Force extraction of the session's buffered conversation. |
|
|
115
|
+
|
|
116
|
+
## EverOS `[llm]` provider matrix
|
|
117
|
+
|
|
118
|
+
Any OpenAI-protocol chat-completions endpoint works. Copy-paste TOML for
|
|
119
|
+
`~/.everos/everos.toml`:
|
|
120
|
+
|
|
121
|
+
| Provider | Notes |
|
|
122
|
+
| --- | --- |
|
|
123
|
+
| OpenAI | The reference endpoint. |
|
|
124
|
+
| OpenRouter | One key, hundreds of models. |
|
|
125
|
+
| Z.ai | GLM coding endpoint. |
|
|
126
|
+
| Ollama | Local, free, no key. |
|
|
127
|
+
|
|
128
|
+
```toml
|
|
129
|
+
# OpenAI
|
|
130
|
+
[llm]
|
|
131
|
+
model = "openai/gpt-4o-mini"
|
|
132
|
+
api_key = "sk-..."
|
|
133
|
+
base_url = "https://api.openai.com/v1"
|
|
134
|
+
|
|
135
|
+
# OpenRouter
|
|
136
|
+
[llm]
|
|
137
|
+
model = "openai/anthropic/claude-3.5-haiku"
|
|
138
|
+
api_key = "sk-or-..."
|
|
139
|
+
base_url = "https://openrouter.ai/api/v1"
|
|
140
|
+
|
|
141
|
+
# Z.ai coding endpoint
|
|
142
|
+
[llm]
|
|
143
|
+
model = "glm-5.3-flash"
|
|
144
|
+
api_key = "..."
|
|
145
|
+
base_url = "https://api.z.ai/api/coding/paas/v4"
|
|
146
|
+
|
|
147
|
+
# Ollama (local, free)
|
|
148
|
+
[llm]
|
|
149
|
+
model = "openai/llama3.1"
|
|
150
|
+
api_key = "ollama"
|
|
151
|
+
base_url = "http://localhost:11434/v1"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Any other OpenAI-compatible `base_url` (llama.cpp, vLLM, DeepInfra, Azure
|
|
155
|
+
OpenAI, …) should work the same way. Non-OpenAI endpoints are
|
|
156
|
+
**reported-working, not guaranteed** — endpoint quirks vary.
|
|
157
|
+
|
|
158
|
+
Requirements: the endpoint must expose OpenAI **chat completions**
|
|
159
|
+
(`/chat/completions`). Responses-API-only endpoints are not supported.
|
|
160
|
+
An optional `[embedding]` section unlocks hybrid search and agentic recall.
|
|
161
|
+
|
|
162
|
+
## Configuration
|
|
163
|
+
|
|
164
|
+
Plugin options (all optional, via the `plugins` entry):
|
|
165
|
+
|
|
166
|
+
| Option | Default | Meaning |
|
|
167
|
+
| ------------- | ----------------------- | ----------------------------------------- |
|
|
168
|
+
| `everosUrl` | `http://127.0.0.1:8000` | EverOS server base URL |
|
|
169
|
+
| `flushEvery` | `3` | Flush memory every N captured turns |
|
|
170
|
+
| `topK` | `5` | Max recall episodes injected |
|
|
171
|
+
| `recallMethod`| `keyword` | `keyword` (no embeddings) / `hybrid` / `agentic` |
|
|
172
|
+
| `enabled` | `true` | Master switch |
|
|
173
|
+
| `logLevel` | `info` | `debug` / `info` / `error` / `silent` |
|
|
174
|
+
|
|
175
|
+
Environment overrides (beat option defaults; explicit options beat env):
|
|
176
|
+
|
|
177
|
+
| Env var | Overrides |
|
|
178
|
+
| ----------------- | -------------------- |
|
|
179
|
+
| `EVEROS_URL` | `everosUrl` |
|
|
180
|
+
| `EVEROS_USER_ID` | user identity |
|
|
181
|
+
| `EVEROS_APP_ID` | app scope (default `opencode`) |
|
|
182
|
+
|
|
183
|
+
## Recall methods
|
|
184
|
+
|
|
185
|
+
| `recallMethod` | Requires | When to use |
|
|
186
|
+
| --- | --- | --- |
|
|
187
|
+
| `keyword` (default) | Nothing | Fresh installs; works before embeddings exist. |
|
|
188
|
+
| `hybrid` | `[embedding]` configured in EverOS | Better semantic matching. |
|
|
189
|
+
| `agentic` | `[embedding]` + a rerank-capable model | Highest quality, slowest. |
|
|
190
|
+
|
|
191
|
+
The default is `keyword` so a fresh install works out of the box.
|
|
192
|
+
|
|
193
|
+
## Troubleshooting
|
|
194
|
+
|
|
195
|
+
- **Nothing is being remembered.** Is the server up? When it's down the plugin
|
|
196
|
+
is a silent no-op (one stderr log per session). Verify:
|
|
197
|
+
`curl http://127.0.0.1:8000/health` → `{"status":"ok"}`.
|
|
198
|
+
- **Inspect what's stored.** Episodes are plain Markdown:
|
|
199
|
+
`~/.everos/opencode/<project>/users/<user_id>/episodes/`.
|
|
200
|
+
- **Just-flushed turns don't show up in recall.** The search index lags
|
|
201
|
+
~10–15 seconds after a flush. Same-session recall of just-captured turns may
|
|
202
|
+
miss; later sessions are fine.
|
|
203
|
+
- **Server comes back mid-session?** Sessions marked degraded retry on the
|
|
204
|
+
next opportunity; restarting the OpenCode session re-arms capture cleanly.
|
|
205
|
+
|
|
206
|
+
## Limitations
|
|
207
|
+
|
|
208
|
+
- **Project identity is the working-directory basename.** OpenCode V2 exposes
|
|
209
|
+
no git remote to the plugin, so two sibling projects with the same folder
|
|
210
|
+
name could collide in EverOS scoping.
|
|
211
|
+
- **Chat-completions endpoints only.** EverOS extraction needs an
|
|
212
|
+
OpenAI-compatible `/chat/completions` endpoint; responses-API-only endpoints
|
|
213
|
+
are unsupported.
|
|
214
|
+
- **~10–15s index lag** after each flush; search may not see just-flushed
|
|
215
|
+
episodes immediately.
|
|
216
|
+
- **No redaction.** Raw transcript text is extracted and stored locally in
|
|
217
|
+
`~/.everos/`. Keep that in mind for sensitive sessions — everything stays on
|
|
218
|
+
your machine, but it is stored verbatim.
|
|
219
|
+
|
|
220
|
+
## FAQ
|
|
221
|
+
|
|
222
|
+
**How is this different from mem0's OpenCode plugin?**
|
|
223
|
+
|
|
224
|
+
- **Local vs cloud.** Everything runs on your machine; transcripts never leave
|
|
225
|
+
it. mem0 routes through its platform.
|
|
226
|
+
- **Free vs metered.** EverOS + your own provider (e.g. Ollama) costs nothing;
|
|
227
|
+
mem0 meters per operation.
|
|
228
|
+
- **Bring any provider vs their allowlist.** EverOS accepts any
|
|
229
|
+
OpenAI-compatible endpoint; mem0 restricts to their supported BYOK list.
|
|
230
|
+
|
|
231
|
+
**How is this different from a curated doc brain (AGENTS.md, Operator, CLAUDE.md)?**
|
|
232
|
+
|
|
233
|
+
Complementary, not competing. Curated docs are **standing truth** you author
|
|
234
|
+
deliberately: conventions, invariants, decisions. This plugin provides
|
|
235
|
+
**episodic recall**: what actually happened in past sessions, captured
|
|
236
|
+
automatically. Standing truth tells the agent what should be true; episodes
|
|
237
|
+
tell it what was.
|
|
238
|
+
|
|
239
|
+
## License
|
|
240
|
+
|
|
241
|
+
Apache-2.0 — matches EverOS.
|
package/dist/everos.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for a local EverOS server.
|
|
3
|
+
*
|
|
4
|
+
* The plugin is LLM-free: it is only an HTTP client. All provider choice
|
|
5
|
+
* lives in the EverOS server config (~/.everos/everos.toml, [llm] section) —
|
|
6
|
+
* the plugin never sees a model API key.
|
|
7
|
+
*
|
|
8
|
+
* API surface (EverOS v2):
|
|
9
|
+
* GET /health (no /api/v2 prefix)
|
|
10
|
+
* POST /api/v2/memory/add {session_id, app_id?, project_id?, messages[], defer_extraction?}
|
|
11
|
+
* POST /api/v2/memory/flush {session_id, app_id?, project_id?}
|
|
12
|
+
* POST /api/v2/memory/search {user_id, query, method, top_k}
|
|
13
|
+
*
|
|
14
|
+
* Errors arrive as {request_id, error:{code, message}} and are unwrapped
|
|
15
|
+
* into EverosError. All requests are bounded by an AbortController timeout.
|
|
16
|
+
*/
|
|
17
|
+
export interface EverosMessage {
|
|
18
|
+
sender_id: string;
|
|
19
|
+
role: "user" | "assistant" | "tool";
|
|
20
|
+
/** Epoch milliseconds. */
|
|
21
|
+
timestamp: number;
|
|
22
|
+
content: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ScopeIds {
|
|
25
|
+
session_id: string;
|
|
26
|
+
app_id?: string;
|
|
27
|
+
project_id?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface EverosEpisode {
|
|
30
|
+
summary: string;
|
|
31
|
+
score: number;
|
|
32
|
+
atomic_facts?: string[];
|
|
33
|
+
timestamp?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface HealthInfo {
|
|
36
|
+
status: string;
|
|
37
|
+
capabilities?: {
|
|
38
|
+
embed?: boolean;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export declare class EverosError extends Error {
|
|
42
|
+
readonly code: string;
|
|
43
|
+
readonly status: number;
|
|
44
|
+
constructor(code: string, message: string, status: number);
|
|
45
|
+
}
|
|
46
|
+
export type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
47
|
+
export declare class EverosClient {
|
|
48
|
+
readonly baseUrl: string;
|
|
49
|
+
private readonly doFetch;
|
|
50
|
+
constructor(baseUrl: string, doFetch?: FetchLike);
|
|
51
|
+
health(timeoutMs?: number): Promise<HealthInfo>;
|
|
52
|
+
addMemory(scope: ScopeIds, messages: EverosMessage[], opts?: {
|
|
53
|
+
deferExtraction?: boolean;
|
|
54
|
+
timeoutMs?: number;
|
|
55
|
+
}): Promise<{
|
|
56
|
+
status: string;
|
|
57
|
+
}>;
|
|
58
|
+
flushMemory(scope: ScopeIds, timeoutMs?: number): Promise<{
|
|
59
|
+
status: string;
|
|
60
|
+
}>;
|
|
61
|
+
searchMemories(userId: string, query: string, opts?: {
|
|
62
|
+
method?: string;
|
|
63
|
+
topK?: number;
|
|
64
|
+
timeoutMs?: number;
|
|
65
|
+
/** Scope narrowing — results never cross scopes (server default is "default"). */
|
|
66
|
+
scope?: {
|
|
67
|
+
appId?: string;
|
|
68
|
+
projectId?: string;
|
|
69
|
+
};
|
|
70
|
+
}): Promise<EverosEpisode[]>;
|
|
71
|
+
private request;
|
|
72
|
+
}
|
package/dist/everos.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for a local EverOS server.
|
|
3
|
+
*
|
|
4
|
+
* The plugin is LLM-free: it is only an HTTP client. All provider choice
|
|
5
|
+
* lives in the EverOS server config (~/.everos/everos.toml, [llm] section) —
|
|
6
|
+
* the plugin never sees a model API key.
|
|
7
|
+
*
|
|
8
|
+
* API surface (EverOS v2):
|
|
9
|
+
* GET /health (no /api/v2 prefix)
|
|
10
|
+
* POST /api/v2/memory/add {session_id, app_id?, project_id?, messages[], defer_extraction?}
|
|
11
|
+
* POST /api/v2/memory/flush {session_id, app_id?, project_id?}
|
|
12
|
+
* POST /api/v2/memory/search {user_id, query, method, top_k}
|
|
13
|
+
*
|
|
14
|
+
* Errors arrive as {request_id, error:{code, message}} and are unwrapped
|
|
15
|
+
* into EverosError. All requests are bounded by an AbortController timeout.
|
|
16
|
+
*/
|
|
17
|
+
export class EverosError extends Error {
|
|
18
|
+
code;
|
|
19
|
+
status;
|
|
20
|
+
constructor(code, message, status) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = "EverosError";
|
|
23
|
+
this.code = code;
|
|
24
|
+
this.status = status;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export class EverosClient {
|
|
28
|
+
baseUrl;
|
|
29
|
+
doFetch;
|
|
30
|
+
constructor(baseUrl, doFetch = fetch) {
|
|
31
|
+
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
32
|
+
this.doFetch = doFetch;
|
|
33
|
+
}
|
|
34
|
+
async health(timeoutMs = 2000) {
|
|
35
|
+
// Health lives at the server root, no /api/v2 prefix.
|
|
36
|
+
return this.request("GET", "/health", undefined, timeoutMs);
|
|
37
|
+
}
|
|
38
|
+
async addMemory(scope, messages, opts = {}) {
|
|
39
|
+
const body = {
|
|
40
|
+
session_id: scope.session_id,
|
|
41
|
+
app_id: scope.app_id,
|
|
42
|
+
project_id: scope.project_id,
|
|
43
|
+
messages,
|
|
44
|
+
...(opts.deferExtraction ? { defer_extraction: true } : {}),
|
|
45
|
+
};
|
|
46
|
+
const data = await this.request("POST", "/api/v2/memory/add", body, opts.timeoutMs ?? 5000);
|
|
47
|
+
return { status: data?.data?.status ?? "ok" };
|
|
48
|
+
}
|
|
49
|
+
async flushMemory(scope,
|
|
50
|
+
// Flush triggers synchronous server-side extraction (an LLM call plus
|
|
51
|
+
// parse + markdown write), so it needs a generous bound. Capture-path
|
|
52
|
+
// callers invoke it fire-and-forget; this only bounds the HTTP wait.
|
|
53
|
+
timeoutMs = 30000) {
|
|
54
|
+
const body = {
|
|
55
|
+
session_id: scope.session_id,
|
|
56
|
+
app_id: scope.app_id,
|
|
57
|
+
project_id: scope.project_id,
|
|
58
|
+
};
|
|
59
|
+
await this.request("POST", "/api/v2/memory/flush", body, timeoutMs);
|
|
60
|
+
return { status: "flushed" };
|
|
61
|
+
}
|
|
62
|
+
async searchMemories(userId, query, opts = {}) {
|
|
63
|
+
const body = {
|
|
64
|
+
user_id: userId,
|
|
65
|
+
query,
|
|
66
|
+
method: opts.method ?? "keyword",
|
|
67
|
+
top_k: opts.topK ?? 5,
|
|
68
|
+
};
|
|
69
|
+
if (opts.scope?.appId)
|
|
70
|
+
body.app_id = opts.scope.appId;
|
|
71
|
+
if (opts.scope?.projectId)
|
|
72
|
+
body.project_id = opts.scope.projectId;
|
|
73
|
+
const data = await this.request("POST", "/api/v2/memory/search", body, opts.timeoutMs ?? 2000);
|
|
74
|
+
// Success envelope: {request_id, data:{episodes:[...]}} — episodes never
|
|
75
|
+
// sit at the top level.
|
|
76
|
+
return Array.isArray(data?.data?.episodes) ? data.data.episodes : [];
|
|
77
|
+
}
|
|
78
|
+
async request(method, path, body, timeoutMs) {
|
|
79
|
+
const controller = new AbortController();
|
|
80
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
81
|
+
let res;
|
|
82
|
+
try {
|
|
83
|
+
res = await this.doFetch(this.baseUrl + path, {
|
|
84
|
+
method,
|
|
85
|
+
headers: body === undefined ? undefined : { "content-type": "application/json" },
|
|
86
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
87
|
+
signal: controller.signal,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
clearTimeout(timer);
|
|
92
|
+
const cause = err instanceof Error ? err : new Error(String(err));
|
|
93
|
+
const aborted = cause.name === "AbortError";
|
|
94
|
+
throw new EverosError(aborted ? "timeout" : "connection_failed", aborted
|
|
95
|
+
? `EverOS request timed out after ${timeoutMs}ms: ${method} ${path}`
|
|
96
|
+
: `EverOS request failed: ${method} ${path}: ${cause.message}`, aborted ? 408 : 0);
|
|
97
|
+
}
|
|
98
|
+
clearTimeout(timer);
|
|
99
|
+
const text = await res.text();
|
|
100
|
+
let json = undefined;
|
|
101
|
+
try {
|
|
102
|
+
json = text.length > 0 ? JSON.parse(text) : undefined;
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
// fall through: non-JSON body
|
|
106
|
+
}
|
|
107
|
+
if (!res.ok) {
|
|
108
|
+
// Error envelope: {request_id, error:{code, message}}
|
|
109
|
+
const code = json?.error?.code;
|
|
110
|
+
const message = json?.error?.message;
|
|
111
|
+
if (typeof code === "string" || typeof message === "string") {
|
|
112
|
+
throw new EverosError(typeof code === "string" ? code : "http_error", typeof message === "string" ? message : `HTTP ${res.status}`, res.status);
|
|
113
|
+
}
|
|
114
|
+
throw new EverosError("http_error", `HTTP ${res.status} ${method} ${path}`, res.status);
|
|
115
|
+
}
|
|
116
|
+
return json;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transcript extraction: OpenCode session messages → EverOS messages.
|
|
3
|
+
*
|
|
4
|
+
* The transcript from `ctx.session.context({sessionID})` is a list of
|
|
5
|
+
* OpenCode `SessionMessageInfo` discriminated by `type`. We keep:
|
|
6
|
+
* - type "user": has a flat `text` field
|
|
7
|
+
* - type "assistant": `content` is a tagged-union list; keep `type:"text"`
|
|
8
|
+
* parts (skip reasoning/tool parts), joined with "\n"
|
|
9
|
+
* and skip everything else (system, synthetic, compaction, shell, skill, …).
|
|
10
|
+
*
|
|
11
|
+
* Offset tracking: the caller passes in the number of transcript entries
|
|
12
|
+
* already consumed (cursor), we return only NEW messages plus the updated
|
|
13
|
+
* cursor. The transcript is append-ordered by creation time, so the index
|
|
14
|
+
* cursor is stable. The cursor is passed in/out and never stored here.
|
|
15
|
+
*/
|
|
16
|
+
import type { EverosMessage } from "./everos.js";
|
|
17
|
+
/** Internal view of an OpenCode session message (subset). */
|
|
18
|
+
export interface TranscriptMessage {
|
|
19
|
+
id?: string;
|
|
20
|
+
type: string;
|
|
21
|
+
time?: {
|
|
22
|
+
created?: number;
|
|
23
|
+
};
|
|
24
|
+
text?: string;
|
|
25
|
+
content?: Array<{
|
|
26
|
+
type: string;
|
|
27
|
+
text?: string;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
export interface ExtractResult {
|
|
31
|
+
messages: EverosMessage[];
|
|
32
|
+
/** Updated cursor: number of transcript entries consumed. */
|
|
33
|
+
offset: number;
|
|
34
|
+
}
|
|
35
|
+
export declare function extractTranscript(transcript: TranscriptMessage[], offset: number, opts?: {
|
|
36
|
+
senderId?: string;
|
|
37
|
+
}): ExtractResult;
|