opencode-engram 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 +1 -1
- package/README.zh.md +1 -1
- package/README.zht.md +1 -1
- package/package.json +9 -4
- package/src/common/history-prompt.ts +21 -22
- package/src/common/plugin.ts +4 -4
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[简体中文](./README.zh.md) | [繁體中文](./README.zht.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
An [OpenCode](https://github.com/opencode-ai/opencode) plugin that gives agents on-demand access to full conversation history — replacing lossy context compression with structured navigation, and bridging context gaps in multi-agent workflows.
|
|
6
6
|
|
|
7
7
|
Internet information is public-tier experience, local environment information is project-tier experience, and the conversation history agents accumulate during their work — reasoning chains, rejected paths, user constraints — is task-tier experience. Yet this history, the closest to actual work, almost always sinks into storage right after it's produced, never reused by subsequent agents. Engram treats conversation history as an equally important **third information source**, letting agents pull on demand during execution — at the moment of maximum information, the role that best understands the need autonomously decides what it needs.
|
|
8
8
|
|
package/README.zh.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# opencode-engram
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[OpenCode](https://github.com/opencode-ai/opencode) 插件,让代理按需访问完整的对话历史——以结构化导航替代有损上下文压缩,弥合多代理工作流中的上下文缺口。
|
|
4
4
|
|
|
5
5
|
互联网信息是公共级的经验,本地环境信息是项目级的经验,而代理在工作中积累的对话历史——推理链、否决路径、用户约束——是任务级的经验。然而这些最贴近实际工作的历史几乎在产生后就沉入存储,从未被后续代理重新利用。Engram 将对话历史视作拥有同等地位的**第三信息源**,让代理在执行过程中按需拉取(Pull),在信息最充分的时刻,由最了解需求的角色自主决定需要什么。
|
|
6
6
|
|
package/README.zht.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# opencode-engram
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[OpenCode](https://github.com/opencode-ai/opencode) 插件,讓代理按需存取完整的對話歷史——以結構化導航取代有損上下文壓縮,彌合多代理工作流中的上下文缺口。
|
|
4
4
|
|
|
5
5
|
網際網路資訊是公共層級的經驗,本地環境資訊是專案層級的經驗,而代理在工作中累積的對話歷史——推理鏈、否決路徑、使用者約束——則是任務層級的經驗。然而這些最貼近實際工作的歷史幾乎在產生後就沉入儲存空間,從未被後續代理重新利用。Engram 將對話歷史視作同等重要的**第三資訊來源**,讓代理在執行過程中按需拉取(Pull),在資訊最充分的時刻,由最了解需求的角色自主決定需要什麼。
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-engram",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "OpenCode plugin that gives agents on-demand access to full conversation history, replacing lossy compression with structured navigation.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -13,11 +13,16 @@
|
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"opencode",
|
|
16
|
+
"opencode-plugin",
|
|
16
17
|
"plugin",
|
|
18
|
+
"agent",
|
|
19
|
+
"context",
|
|
17
20
|
"history",
|
|
18
21
|
"retrieval",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
22
|
+
"conversation",
|
|
23
|
+
"multi-agent",
|
|
24
|
+
"context-compression",
|
|
25
|
+
"context-window"
|
|
21
26
|
],
|
|
22
27
|
"type": "module",
|
|
23
28
|
"main": "./src/common/plugin.ts",
|
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
export const builtInHistoryPromptBody = `## Session History
|
|
2
2
|
|
|
3
|
-
Conversation history is the only authoritative source of past state: what was
|
|
4
|
-
done, why, what was decided, and what remains. Treat it as a first-class source
|
|
5
|
-
alongside the local workspace.
|
|
3
|
+
Conversation history is the only authoritative source of past state: what was done, why, what was decided, and what remains. Treat it as a first-class source alongside the local workspace.
|
|
6
4
|
|
|
7
5
|
Retrieve from history when the consequence of NOT having the information is:
|
|
8
|
-
- Wrong direction: acting on a requirement, constraint, or decision you can't
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
prior work
|
|
12
|
-
- Missing substance: plans, specs, schemas, or analyses not present in current
|
|
13
|
-
context
|
|
6
|
+
- Wrong direction: acting on a requirement, constraint, or decision you can't verify from current context
|
|
7
|
+
- Wrong context: user corrections, rejections, or hard constraints that shaped prior work
|
|
8
|
+
- Missing substance: plans, specs, schemas, or analyses not present in current context
|
|
14
9
|
|
|
15
10
|
### Efficiency
|
|
16
11
|
|
|
17
|
-
- Prefer search over manual browse-window scanning when you do not already know
|
|
18
|
-
the approximate location of the answer.
|
|
12
|
+
- Prefer search over manual browse-window scanning when you do not already know the approximate location of the answer.
|
|
19
13
|
- Do not call pull unless the preview or search snippet is clearly insufficient.
|
|
20
|
-
- Parallel independent calls — multiple searches or pulls that don't depend on
|
|
21
|
-
|
|
14
|
+
- Parallel independent calls — multiple searches or pulls that don't depend on each other should run in the same round.
|
|
15
|
+
- Browse in small window (e.g., 3) initially.
|
|
22
16
|
|
|
23
|
-
###
|
|
17
|
+
### Technique
|
|
24
18
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
\`message_id\`, with \`before_message_id\` and \`after_message_id\` for
|
|
31
|
-
extending the window.
|
|
32
|
-
- Use history_pull_message for full message content.`;
|
|
19
|
+
#### Browse (Turns & Messages)
|
|
20
|
+
- **Recent items**: Set \`num_before\`, omit \`num_after\` and ID/index.
|
|
21
|
+
- **From start (turns)**: Set \`turn_index=1\`, omit \`num_before\`.
|
|
22
|
+
- **Nearby context**: Set a specific ID/index and a small window to explore around a search result.
|
|
23
|
+
- **Full turn (messages)**: Set \`message_id=user.message_id\` and \`num_after=assistant.total_messages\`.
|
|
33
24
|
|
|
25
|
+
#### Search (history_search)
|
|
26
|
+
- **Precise**: Set \`literal=true\` for exact substring matches (e.g., unique identifiers, paths). Avoid for common terms.
|
|
27
|
+
- **Minimal**: Filter by type to reduce noise:
|
|
28
|
+
- \`type=[text]\`: Find specific communications/messages.
|
|
29
|
+
- \`type=[tool]\`: Locate paths, errors, or identifiers.
|
|
30
|
+
- \`type=[reasoning]\`: Find decision rationales.
|
|
31
|
+
- **Maximal**: Set \`type=[text,tool,reasoning]\` to verify the existence of a fact across all layers. Ineffective for retrieving detailed context.
|
|
32
|
+
`
|
|
34
33
|
// =============================================================================
|
|
35
34
|
// State Management
|
|
36
35
|
// =============================================================================
|
package/src/common/plugin.ts
CHANGED
|
@@ -123,7 +123,7 @@ function normalizeSearchLiteral(literal?: boolean): boolean {
|
|
|
123
123
|
|
|
124
124
|
function normalizeSearchTypes(value?: string[]): SearchPartType[] {
|
|
125
125
|
if (value === undefined) {
|
|
126
|
-
return ["text"];
|
|
126
|
+
return ["text", "tool"];
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
if (!Array.isArray(value) || value.length === 0) {
|
|
@@ -322,7 +322,7 @@ RETURNS: turn summaries in ascending turn_index order. Each turn includes user p
|
|
|
322
322
|
turn_index: tool.schema
|
|
323
323
|
.number()
|
|
324
324
|
.optional()
|
|
325
|
-
.describe("Target turn_index. Omit to
|
|
325
|
+
.describe("Target turn_index (starting from 1, not 0) for returning. Omit to automatically set the newest visible turn_index"),
|
|
326
326
|
num_before: tool.schema
|
|
327
327
|
.number()
|
|
328
328
|
.optional()
|
|
@@ -380,7 +380,7 @@ RETURNS: messages[] plus before_message_id / after_message_id anchors for extend
|
|
|
380
380
|
message_id: tool.schema
|
|
381
381
|
.string()
|
|
382
382
|
.optional()
|
|
383
|
-
.describe("Anchor message_id. Omit to
|
|
383
|
+
.describe("Anchor message_id. Omit to automatically set the newest visible message_id"),
|
|
384
384
|
num_before: tool.schema
|
|
385
385
|
.number()
|
|
386
386
|
.optional()
|
|
@@ -555,7 +555,7 @@ RETURNS: Matching messages grouped by relevance. Each message includes role, tur
|
|
|
555
555
|
type: tool.schema
|
|
556
556
|
.array(tool.schema.string())
|
|
557
557
|
.optional()
|
|
558
|
-
.describe("Searchable content types to include. One or more of text, tool, reasoning. Default [text]"),
|
|
558
|
+
.describe("Searchable content types to include. One or more of text, tool, reasoning. Default [text, tool]"),
|
|
559
559
|
},
|
|
560
560
|
async execute(args, ctx) {
|
|
561
561
|
return runCall(
|