opencode-growth 0.1.59 → 0.1.74

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 CHANGED
@@ -9,13 +9,48 @@ review and withdrawal.
9
9
  >
10
10
  > ```bash
11
11
  > npm i -g opencode-growth # provides the `oc-grow` command
12
- > oc-grow install # writes the host plugin file, registers D/skills/
13
- > oc-grow --store ~/.opencode-growth status
14
- > oc-grow --store ~/.opencode-growth doctor # exits 5 when a capability is missing
12
+ > oc-grow install --dry-run # print the plan; writes nothing
13
+ > oc-grow install # plugin file, D/skills/, three command files
14
+ > oc-grow status # what is in effect, what is pending
15
+ > oc-grow doctor # exits 5 when a capability is missing
15
16
  > ```
16
17
  >
17
- > `install` and `uninstall` only add or remove the host plugin file. Nothing inside the store is
18
- > touched — your Markdown stays yours. Node >= 24.
18
+ > First install creates the two resident libraries as **empty** files (`MEMORY.md`, `USER.md`) so
19
+ > you can edit them straight away; later runs never write their content and never recreate a file
20
+ > you deleted. `install`/`uninstall` add or remove only what they registered — the host plugin,
21
+ > the `D/skills/` path and the command files. Your Markdown stays yours. Node >= 24, and no
22
+ > external memory service is required.
23
+
24
+ ## First run, end to end
25
+
26
+ 1. `oc-grow install --dry-run` — the plan names what will be created, filled in and kept; the
27
+ isolated tree is byte-identical afterwards.
28
+ 2. `oc-grow install` — then **restart OpenCode**: host configuration is not hot-reloaded.
29
+ 3. `oc-grow status` — the store path in use, resident entry counts, pending proposals.
30
+ 4. In a session, say one thing worth keeping ("always use pnpm here"); the `memory` tool writes it.
31
+ 5. Open a **different** project and ask about it — memory is global, so it answers there too.
32
+ 6. `oc-grow doctor` — if a capability is missing it exits 5 and names it, rather than reporting a
33
+ false green.
34
+
35
+ History search is optional and off until you bind a source: `oc-grow session-index status` says
36
+ which state it is in (`not-configured`, `source-missing`, `unsupported-schema`,
37
+ `source-unavailable`, a normal zero-hit result, or a degraded answer that carries `as_of`), and
38
+ `oc-grow session-index sync` / `rebuild` bind or repair the source. Memory and skills work whether
39
+ or not it is configured.
40
+
41
+ ### Reinstall and receipt recovery
42
+
43
+ A store has one current registered host configuration root. Reinstalling through a physical
44
+ alias keeps the original registration; changing to another root is refused before any write,
45
+ including in dry-run. Uninstall the old registration before installing a new root.
46
+
47
+ `oc-grow uninstall` uses the default receipt. For a saved receipt, explicitly use
48
+ `oc-grow uninstall --from /absolute/path/to/install-manifest.json` with the corresponding store.
49
+ Recovery accepts ownership version 2 with normalized absolute paths and valid ownership fields;
50
+ it removes only that receipt's original targets whose recorded contents still match. Modified
51
+ or unreadable files and all store data are kept. An invalid explicit receipt is refused, never
52
+ silently replaced by the default receipt. See `docs/RUNBOOK-agent.md` for the narrower moved-store
53
+ case and partial-uninstall checks.
19
54
 
20
55
  ## What it does
21
56
 
@@ -29,10 +64,27 @@ host.
29
64
  full.
30
65
  - **Retrieval over history.** Ask about something said in another project and get the original
31
66
  wording back — Chinese or English, down to two characters.
32
- - **Learns after your turns.** A background review runs between turns and turns your
33
- corrections into proposals, which are consumed at the session boundary.
67
+ - **Learns after your turns.** A background review runs between turns. When it finishes it
68
+ reports what it did as one line in the conversation you were already in — what it wrote, what
69
+ it staged, what it skipped — so nothing is learned behind your back. The report is part of the
70
+ transcript; it does not start another model turn and is never re-read as something you said.
34
71
  - **Safe when nobody is watching.** Unattended, additions apply directly while edits and
35
72
  removals are staged for your approval.
73
+ - **Pinned means pinned.** `oc-grow skill pin <name>` keeps a skill out of archiving at every
74
+ entry point — the lifecycle pass, the curator and the skill tool — and each refusal names the
75
+ skill and the reason. Editing a pinned skill still works; `oc-grow skill unpin <name>` makes
76
+ it archivable again.
77
+ - **The limits you set are the limits used.** `memory_limit` and `user_limit` under `memory` in
78
+ the store's `config.json` (defaults 2200 and 1375 characters) are read by every write path —
79
+ the tool, a batch, an approved proposal, the CLI and `oc-grow status`. Lowering a limit never
80
+ truncates or deletes what is already stored; raising it lets a write that previously failed
81
+ go through, without a reinstall.
82
+ - **Approval is optional, and off by default.** Turn on `memory.write_approval` or
83
+ `skills.write_approval` and create/patch stage a proposal instead of writing: the target file
84
+ stays byte-identical until you run `oc-grow memory pending` and
85
+ `oc-grow memory approve <id> --as <who-you-are>`, then read the result back. Rejecting means
86
+ deleting the proposal; nothing applies on its own. Background edits and removals are staged
87
+ whether or not the gate is on.
36
88
  - **Two stores.** Memory and user profile live in separate files (`MEMORY.md`, `USER.md`), each
37
89
  with its own limits.
38
90
  - **Addressable.** Edits and removals address an entry by a substring of its text; an ambiguous
@@ -51,9 +103,14 @@ host.
51
103
  - It does not touch OpenCode's source, and it does not assume Hermes is present.
52
104
  - It does not push or export memory to other agents or hosts: the store is plain text, and reading it is the other side's business.
53
105
 
54
- ## Not built yet
106
+ ## What exists, and what stays out of scope
55
107
 
56
- A timeline of what has been learned.
108
+ - A journey view of what has been learned exists (`oc-grow journey`, `oc-grow journey list`); it is
109
+ a timeline over recorded events, not a semantic summary of your sessions.
110
+ - Semantic retrieval over a large history is not claimed: history search is keyword-plus-index,
111
+ bound to an optional `session-index` source.
112
+ - No automatic registration in a skill marketplace, and no third-party distribution channel: the
113
+ package is the distribution, and external skill directories are read-only inputs.
57
114
 
58
115
  ## Platforms
59
116
 
@@ -62,10 +119,11 @@ Run and verified on Windows (native), WSL2, macOS (arm64) and Linux.
62
119
  ## Layout
63
120
 
64
121
  ```
65
- src/core/ storage, candidates, writer, audit, lock, budget, threats, retrieval
66
- src/core/snapshot.mjs the frozen per-session block (MEMORY.md / USER.md)
67
- src/core/skills.mjs skill index (always resident) vs. body (on demand)
68
- src/adapter-opencode/ the host plugin: memory tool, review runner, installer
122
+ src/core/ store, memory, skills, review, lifecycle, approval, audit, lock, index
123
+ src/adapter-opencode/ the host plugin: memory, skill and session tools, review + curator
124
+ runners, installer
125
+ src/provider/ optional semantic provider wiring (OpenViking over REST)
126
+ src/host/ the client used to reach a running host
69
127
  src/learn/ headless consume path (corrections -> candidates)
70
128
  src/cli/ `oc-grow` commands and the single JSON envelope
71
129
  test/contracts/ acceptance tests
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-growth",
3
- "version": "0.1.59",
3
+ "version": "0.1.74",
4
4
  "description": "OpenCode growth kit: cross-project memory (memory / capability / preference / fact) with evidence and withdrawal.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -190,7 +190,10 @@ export function wrapCuratorTrigger({ pipeline, client, root, now = () => new Dat
190
190
  }
191
191
  // 默认:确定性生命周期维护(零宿主零模型),与 `curator run`(无 --consolidate)同一个函数
192
192
  const mechanical = applyLifecycleTransitions({ root, now: now(), origin: "background" })
193
- audit({ mode: "mechanical", sessionId, ok: mechanical.ok, archived: mechanical.archived, error: mechanical.error ?? null })
193
+ audit({ mode: "mechanical", sessionId, ok: mechanical.ok, archived: mechanical.archived,
194
+ // 无人值守通道也要留下「哪些 pinned 被跳过」——否则插件静默运行时这个原因不可见(复核观察 5)
195
+ skipped_pinned: (mechanical.skipped_pinned ?? []).map((x) => x.name),
196
+ error: mechanical.error ?? null })
194
197
  if (typeof onDispatch === "function") onDispatch({ due, skills: null, mode: "mechanical", mechanical })
195
198
  } catch { /* 触发失败不影响复习链 */ }
196
199
  return r
@@ -30,6 +30,7 @@ import { formationGuidanceBlock, SKILL_FORMATION_FENCE } from "../core/skills.mj
30
30
  import { createMemoryStore } from "../core/memories.mjs"
31
31
  import { appendAudit } from "../core/audit.mjs"
32
32
  import { createReviewPipeline } from "./review-runner.mjs"
33
+ import { REVIEW_SURFACE_MARK } from "../core/background-review.mjs"
33
34
  import { wrapCuratorTrigger } from "./curator-runner.mjs"
34
35
  import { registerMemoryTool } from "./memory-tool.mjs"
35
36
  import { registerJourneyTool } from "./journey-tool.mjs"
@@ -252,8 +253,11 @@ export function createAdapter({
252
253
  while (latestTurn.size > TURN_CACHE_MAX) latestTurn.delete(latestTurn.keys().next().value)
253
254
  }
254
255
  /** 用户消息的可见文本(parts 里 type==="text" 的拼起来;拿不到就是空串,不猜)。 */
256
+ // 后台复习浮出的那一行也是 user 消息,但它不是用户说的话(ignored + metadata 标记)⇒
257
+ // 不能成为召回查询段,也不能顶掉上一轮的真实文本。
255
258
  const textFromParts = (parts) => (Array.isArray(parts) ? parts : [])
256
259
  .filter((part) => part && part.type === "text" && typeof part.text === "string")
260
+ .filter((part) => part.ignored !== true && part?.metadata?.ocg !== REVIEW_SURFACE_MARK)
257
261
  .map((part) => part.text)
258
262
  .join("\n")
259
263
  .trim()