@awebai/oats 0.23.0 → 0.23.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 (38) hide show
  1. package/README.md +48 -18
  2. package/capabilities/oats-okf/agents/memory-harvest/AGENTS.md +18 -24
  3. package/capabilities/oats-okf/agents/memory-harvest/soul.yaml +2 -2
  4. package/capabilities/oats-okf/bin/oats-okf.mjs +105 -517
  5. package/capabilities/oats-okf/injects/okf.md +32 -67
  6. package/capabilities/oats-okf/lib/config.mjs +112 -0
  7. package/capabilities/oats-okf/lib/inspection.mjs +96 -0
  8. package/capabilities/oats-okf/lib/io.mjs +103 -0
  9. package/capabilities/oats-okf/lib/migration.mjs +116 -0
  10. package/capabilities/oats-okf/lib/sources.mjs +238 -0
  11. package/capabilities/oats-okf/lib/stores.mjs +331 -0
  12. package/capabilities/oats-okf/lib/worker.mjs +352 -0
  13. package/capabilities/oats-okf/oats.json +23 -7
  14. package/capabilities/oats-okf/schemas/okf-base.schema.json +46 -0
  15. package/capabilities/oats-okf/schemas/okf-bindings.schema.json +112 -0
  16. package/capabilities/oats-okf/schemas/okf-soul.schema.json +37 -0
  17. package/capabilities/oats-okf/skills/memory-harvest/SKILL.md +263 -140
  18. package/capabilities/oats-okf/skills/okf/SKILL.md +13 -4
  19. package/docs/capabilities.md +14 -3
  20. package/docs/configuration.md +11 -1
  21. package/docs/design/okf-mirror-provenance.md +105 -0
  22. package/docs/desktop-cli-api.md +59 -10
  23. package/docs/first-team-demo.md +6 -1
  24. package/docs/first-team.md +151 -115
  25. package/docs/integrations.md +42 -42
  26. package/docs/knowledge-capability-authoring.md +10 -7
  27. package/docs/knowledge-migration.md +138 -0
  28. package/docs/knowledge.md +316 -129
  29. package/docs/layers.md +57 -62
  30. package/docs/migration-from-oas.md +7 -1
  31. package/docs/packages.md +26 -2
  32. package/docs/release-notes/v0.23.1.md +97 -0
  33. package/docs/release-notes/v0.23.2.md +49 -0
  34. package/docs/schedules.md +42 -3
  35. package/docs/souls-and-instances.md +55 -48
  36. package/package-catalog.json +6 -1
  37. package/package.json +1 -1
  38. package/capabilities/oats-okf/lib/harvest-branch.mjs +0 -43
package/docs/knowledge.md CHANGED
@@ -1,139 +1,326 @@
1
1
  # Knowledge — layer 2
2
2
 
3
- Specialization is accumulated judgment. A specialist remembers what worked,
4
- what failed, what was decided, and which procedures are worth repeating.
3
+ Specialization is accumulated judgment: decisions and rationale, rejected
4
+ alternatives, discovered limits, and maintained context that changes what a
5
+ future instance does. It is not a second description of the code.
5
6
 
6
- OATS treats knowledge as a pluggable layer. The kernel does not choose a
7
- memory format. The default integration, `oats-okf`, uses markdown OKF bundles
8
- for soul knowledge and simple files for instance state.
7
+ OATS keeps knowledge pluggable. The kernel supplies lifecycle, configuration,
8
+ trusted command dispatch and independent execution; each knowledge capability
9
+ owns its format, reader/capture instructions, judgment and delivery. The
10
+ [reference theory](knowledge-theory.md) and [authoring guide](knowledge-capability-authoring.md)
11
+ are optional author resources, not mandatory runtime policy.
9
12
 
10
- > **Status and relationship to the turn record (2026-08-21).** This layer is
11
- > current and stays. It is the *semantic* memory of an agent team — reviewed,
12
- > de-indexicalized truths that travel with the soul — and is distinct from the
13
- > *episodic* memory provided by the turn record (`packages/record`: every
14
- > session captured verbatim, automatically). Today the harvester's input is
15
- > `notes/*.md`, the working agent's own in-session notes; the planned upgrade
16
- > (epic `aweb-abfz`) feeds the harvester from the captured record as well, so
17
- > lessons reach the soul even when an agent wrote no notes and never ran
18
- > harvest. The judgment machinery described here — the promotion bar, the
19
- > capture/judge split, the routing between knowledge and skills — is unchanged
20
- > by that upgrade; only the input channel widens.
13
+ > **Version scope:** this guide describes published **oats.okf 2.0.0**, requiring
14
+ > the published OATS >=0.23.0 kernel. Framework v0.23.1 integrates its catalog
15
+ > and mirror; publishing packages does not activate or deploy them automatically.
16
+ > See [release notes](release-notes/v0.23.1.md).
17
+ > V1 soul-contained knowledge needs [explicit migration](knowledge-migration.md).
21
18
 
22
- ## What the kernel does not own
19
+ ## What lives where
23
20
 
24
- The kernel is memory-agnostic. It provides lifecycle events:
25
-
26
- - `soul-scaffold`
27
- - `spawn`
28
- - `retire`
29
-
30
- A knowledge integration decides what to do with those events. If config
31
- resolves `knowledge: none`, the kernel creates no `STATE.md`, no `notes/`, no
32
- knowledge bundle, and no harvest flow.
33
-
34
- The ideas behind any of this — what belongs in a soul vs an instance,
35
- capture vs judgment, consolidation stages — are format-independent and live
36
- in [knowledge theory](knowledge-theory.md).
37
-
38
- ## The default: oats-okf
39
-
40
- With `knowledge: okf`, the integration creates two memory spaces.
41
-
42
- | Space | Files | Purpose |
43
- |---|---|---|
44
- | Soul memory | `soul/knowledge/` | Long-term OKF bundle: lessons, decisions, playbooks, references, role-grown sections. |
45
- | Instance memory | `STATE.md`, `log.md`, `notes/` | Current task state, dated history, and captured insights. |
46
-
47
- The instance does not promote its own notes. It captures them, and after
48
- committing with pending notes it runs `oats okf harvest` (its okf injection
49
- carries this instruction), which spawns a **memory-harvest** agent. That
50
- harvester judges the notes and updates the soul; the delivery matches the
51
- soul's custody — a commit on the instance's branch for repo-resident souls,
52
- a PR to the soul's home repo for workspace-mode souls, and **direct edits
53
- with no commit** for local souls (their `local-agents/` home is
54
- uncommitted by contract). Then it retires.
55
-
56
- ## Capture and judgment
57
-
58
- OATS splits memory work into two roles.
59
-
60
- **The working instance captures.** It keeps `STATE.md` current, appends
61
- milestones to `log.md`, and writes every non-obvious insight to `notes/`.
62
- It does not decide whether an insight is "important enough" for the soul.
63
- Capture should be cheap and in-flow.
64
-
65
- **The memory-harvest agent judges.** It reads pending notes and applies the
66
- promotion bar:
67
-
68
- > Promote only what is durable and would change what a future instance of
69
- > this soul does.
70
-
71
- For each note it chooses one outcome:
72
-
73
- | Outcome | Meaning |
21
+ | Surface | Purpose |
74
22
  |---|---|
75
- | Promote | Move it into the right soul knowledge section, or into a soul skill if it is procedural. |
76
- | Merge | Fold it into an existing concept or skill. |
77
- | Drop | Delete it and log why it failed the bar. |
78
-
79
- This separation keeps working agents from overthinking memory, and gives
80
- promotion the deliberate attention it deserves.
81
-
82
- ## Why instance memory and soul memory differ
83
-
84
- Instance memory is indexical. It talks about this task, this branch, this
85
- moment, this blocker. That is why it lives in `STATE.md`, `log.md`, and
86
- `notes/`.
87
-
88
- Soul memory must be incarnation-invariant. It should remain true for future
89
- instances, future models, and future sessions. A future instance should be
90
- able to read a concept and act differently because of it.
91
-
92
- Harvest is the conversion between the two. Notes are where an instance tries
93
- to phrase what it learned without "I, here, now". The harvester checks
94
- whether that conversion succeeded.
95
-
96
- ## OKF concept types
97
-
98
- OKF itself does not prescribe one vocabulary. OATS conventions use these
99
- common types:
100
-
101
- | Type | Usual home | Meaning |
102
- |---|---|---|
103
- | `Instance State` | `STATE.md` | Current working state. Rewritten, not superseded. |
104
- | `Finding` | `notes/` | A captured observation whose durability is unproven. |
105
- | `Lesson` | Soul knowledge | A durable behavior-changing conclusion. |
106
- | `Decision` | `notes/` or soul knowledge | A decision and its rationale. Task-local decisions stay in `STATE.md` or `log.md`. |
107
- | `Playbook` | Soul knowledge or soul skills | Repeatable steps. Procedure-shaped notes usually become skills. |
108
- | `Reference` | Soul knowledge | External truth or stable internal reference. |
109
-
110
- Souls start with core knowledge sections:
111
-
112
- - `lessons/`
113
- - `decisions/`
114
- - `playbooks/`
115
- - `references/`
116
-
117
- Souls can grow role-specific sections such as `architecture/`, `codebase/`, or
118
- `roadmap/`. Add a section when future instances of that soul need to navigate
119
- that kind of knowledge.
120
-
121
- ## What a working instance should do
122
-
123
- As you work:
124
-
125
- 1. Keep `STATE.md` accurate. A fresh session should be able to resume from
126
- its `# Next` section.
127
- 2. Append dated milestones and decisions to `log.md`.
128
- 3. Write non-obvious insights to `notes/` as one concept per file.
129
- 4. Before every commit, bring memory up to date.
130
- 5. Commit, then run `oats okf harvest` to send your notes to the soul.
131
-
132
- Do not hold back a note because you are unsure it is soul-grade. Capture
133
- first. The harvester judges.
23
+ | `soul/AGENTS.md`, `soul/skills/` | Curated specialist identity and procedures, reviewed as soul artifacts. |
24
+ | `soul/okf.json` | Stable owner ID and external `owns`/`reads` node references; no knowledge bytes. |
25
+ | External accepted bases | Durable OKF knowledge, either Git PR-only or a recoverable plain directory. |
26
+ | Instance `knowledge/` | Immutable accepted reader snapshot with `view.json` and `bases/<alias>/`. |
27
+ | Instance `STATE.md`, `log.md`, `notes/` | Rewritable task state, append-only milestones and captured insights. |
28
+ | External `stateDir` | Durable per-source evidence, frozen descriptors, runs, proposals and receipts. |
29
+ | Worker `work/` | Independent directory execution with staged bases and explicit judgment. |
30
+
31
+ The turn record is episodic evidence, not accepted expertise. OKF captures both
32
+ notes **and** attributed record content, then judges them separately from capture.
33
+ V2 never automatically edits soul skills; a procedure candidate may become an
34
+ external Playbook for separate human review.
35
+
36
+ ## Acquire, bind and provision explicitly
37
+
38
+ The authoritative distribution is [awebai/oats-okf](https://github.com/awebai/oats-okf),
39
+ whose `oats-package/oats-package.json` exports exactly
40
+ `oats-package/capabilities/oats-okf/`. The framework's `capabilities/oats-okf/`
41
+ is a bundled mirror, **not a self-contained Git distribution in the npm
42
+ artifact**: npm drops the source worker's `CLAUDE.md -> AGENTS.md` symlink.
43
+ Acquire the catalog Git payload; do not install a copied npm mirror as a local
44
+ package or repair missing aliases in installed artifacts.
45
+
46
+ With a released OATS >=0.23.0 kernel, acquire published OKF 2.0.0 from the
47
+ intended deployment configuration context in an operator shell without inherited
48
+ instance identity (an explicit `--soul` does not override an invoking instance's
49
+ saved settings). The explicit Git source works before and after the v0.23.1
50
+ framework catalog integration:
51
+
52
+ ```bash
53
+ oats install git:github.com/awebai/oats-okf@v2.0.0
54
+ oats trust oats.okf
55
+ oats use oats.okf --soul domain-expert --settings bindings-file=/absolute/config/okf-bindings.json
56
+ oats doctor --soul domain-expert --json
57
+ ```
58
+
59
+ Acquisition activates nothing. An existing lock remains exact until an explicit
60
+ `oats update oats.okf`; v1 operators must plan migration before that update.
61
+ Executable changes need review and renewed trust. Target only configured source
62
+ souls; the service worker need not itself receive the knowledge layer.
63
+
64
+ ### Bindings document
65
+
66
+ `bindings-file` must be an **absolute path**. Its capability-owned JSON is not a
67
+ new kernel configuration schema. Paths inside it resolve relative to the file's
68
+ directory, not the current working directory:
69
+
70
+ ```json
71
+ {
72
+ "version": 1,
73
+ "stateDir": "../durable-okf-state",
74
+ "cron": "*/15 * * * *",
75
+ "tz": "UTC",
76
+ "bases": {
77
+ "project": {
78
+ "id": "project-knowledge",
79
+ "kind": "git",
80
+ "repository": "https://github.com/example/project.git",
81
+ "root": "knowledge",
82
+ "acceptedBranch": "main",
83
+ "pr": {"repository": "example/project"}
84
+ },
85
+ "team": {
86
+ "id": "team-knowledge",
87
+ "kind": "directory",
88
+ "path": "../team-knowledge"
89
+ }
90
+ }
91
+ }
92
+ ```
93
+
94
+ - Git supports HTTPS, SSH and durable local repositories. `root: "."` selects
95
+ a dedicated knowledge repository. Initial PR delivery uses same-repository
96
+ branches with native `git`, `gh` and ordinary operator credentials. There is
97
+ no fork-routing or direct-write fallback.
98
+ - Directory custody needs no Git, `gh`, `.git` or fabricated repository.
99
+ A directory inside **any Git working tree**, even ignored, is rejected:
100
+ relabeling Git custody cannot bypass review.
101
+ - Use physical, non-symlinked, nonoverlapping paths. Keep state outside bases and
102
+ source homes/worktrees; keep the bindings file outside state and bases. Local
103
+ Git locators must not be disposable linked worktrees. Directory lock/journal
104
+ artifacts also must not overlap state, sources or another base.
105
+ - Settings are `bindings-file`, `harvest-runtime` (`pi`, `claude`, `codex`,
106
+ default `pi`), and optional `harvest-model`. Choose an installed, authenticated
107
+ worker runtime independently of the source; omitted models use that runtime's
108
+ configured default. V1 record-window settings are not v2 settings.
109
+
110
+ ### Owner and base descriptors
111
+
112
+ Each persistent soul declares `soul/okf.json`:
113
+
114
+ ```json
115
+ {"version":1,"owner":"domain-expert-stable-id","owns":["project/expert"],"reads":["project/steward","team/operations"]}
116
+ ```
117
+
118
+ The accepted project base declares `okf-base.json`:
119
+
120
+ ```json
121
+ {"version":1,"id":"project-knowledge","nodes":{"expert":{"path":"expert","owner":"domain-expert-stable-id"},"steward":{"path":"steward","owner":"steward-stable-id"}}}
122
+ ```
123
+
124
+ The team base similarly declares its ID and `operations` node. Nodes are
125
+ nonoverlapping subdirectories with an `index.md` and `log.md`; each has one stable
126
+ owner. Base roots have their own index and append-only log. Stable owner IDs must
127
+ not ambiguously identify different souls within one state namespace.
128
+
129
+ `owns` means responsibility and write routing; `reads` means initial context.
130
+ **Neither is an ACL.** All configured bases are discoverable/readable. Missing
131
+ bindings, owner declarations, base metadata or indexes fail required spawn rather
132
+ than silently bootstrapping empty knowledge.
133
+
134
+ Provisioning is an explicit operator action. Prepare node-map files (the
135
+ `nodes` object above, without its wrapper), then:
136
+
137
+ ```bash
138
+ # New directory base: refuses an existing destination.
139
+ oats okf init --base team --nodes /absolute/config/team-nodes.json --confirm --soul domain-expert --json
140
+ # Git: writes an operator proposal, never pushes or claims acceptance.
141
+ oats okf init --base project --nodes /absolute/config/project-nodes.json --output /absolute/new-bundle-stage --soul domain-expert --json
142
+ ```
143
+
144
+ Put the Git proposal at the configured root in an operator-owned checkout and
145
+ review/merge it through a PR before spawning working sources. Existing ownership
146
+ changes require an explicit reviewed operator change, not harvest. The standalone
147
+ capability includes JSON Schemas; filesystem containment, ownership and full OKF
148
+ validation remain additional runtime checks.
149
+
150
+ ## Working-agent reads and capture
151
+
152
+ At session start, after compaction and on resume, read `STATE.md` and the relevant
153
+ knowledge indexes. `knowledge/view.json` identifies each base's relative path,
154
+ digest and Git accepted head. Content lives under `knowledge/bases/<alias>/`.
155
+ Follow relevant links only; do not bulk-load bases. A link `/expert/decision.md`
156
+ is rooted in **that base**, not filesystem `/`. Consult prior decisions before
157
+ re-deriving them and cite base/node/concept paths.
158
+
159
+ **Working agents never write accepted knowledge or soul knowledge.** This is an
160
+ instruction boundary, not an OS sandbox; tools still have the operator's access.
161
+ Snapshots are immutable by protocol, not live mounts. For current accepted text:
162
+
163
+ ```bash
164
+ # From the source home:
165
+ oats okf read --base project --path expert/index.md --json
166
+ oats okf refresh --json
167
+ # From the deployment context, even after source retirement:
168
+ oats okf read --source /absolute/state/sources/UUID/source.json --base project --path expert/index.md --soul domain-expert --json
169
+ oats okf refresh --source /absolute/state/sources/UUID/source.json --soul domain-expert --json
170
+ ```
171
+
172
+ Home-selected commands create a new `knowledge-view-<uuid>/` in that home.
173
+ **Every `--source` read/refresh** places its view under
174
+ `<stateDir>/sources/<source-id>/views/`, even while the source is live. It never
175
+ writes a cache into the invoking repository, a retired home or a replacement
176
+ home. Results identify the actual path and provider receipts. Choose `--home`
177
+ or `--source`, not both. `read` returns full Markdown text; it has no preview cap.
178
+
179
+ A Git PR is not accepted until its merge is visible on the accepted branch.
180
+ Directory reads hold the cooperative publication lock while copying; a pending
181
+ journal blocks fresh views, not existing snapshots. All bases and references
182
+ validate before a view is published. Old views remain available; there is no
183
+ automatic garbage collection.
184
+
185
+ Working agents keep state current, append milestones and capture non-obvious
186
+ insights as Markdown notes with provenance. They are not instructed to run a
187
+ harvest after commits or taught worker mechanics. Capture should be cheap;
188
+ importance is the independent judge's decision.
189
+
190
+ ## Durable evidence and retirement
191
+
192
+ Required spawn registers a random source ID outside the home; the home retains
193
+ only a pointer. The durable descriptor freezes bindings, owner destinations,
194
+ source role and allowlisted provenance, not credentials or wholesale launch
195
+ metadata. State includes:
196
+
197
+ ```text
198
+ <stateDir>/owners.json
199
+ <stateDir>/sources/<uuid>/source.json
200
+ <stateDir>/sources/<uuid>/status.json
201
+ <stateDir>/sources/<uuid>/inputs/<hash>.json
202
+ <stateDir>/sources/<uuid>/runs/<uuid>/
203
+ <stateDir>/sources/<uuid>/views/
204
+ <stateDir>/migrations/<uuid>/
205
+ ```
206
+
207
+ Every capture includes content-versioned **notes AND record**. Changed live notes
208
+ remain untouched. Through the supported `OATS_CLI_BIN` boundary, capture uses
209
+ native `capture --home`, then `recall --ids-only` byte metadata to plan bounded
210
+ windows before fetching full text. Full returned record text is copied into
211
+ custody, not saved as commands that still need the source home. Privacy-excluded
212
+ sessions remain excluded; raw excluded transcripts are not copied.
213
+
214
+ Final capture drains the visible backlog before certifying custody. The capture
215
+ budget is 85 seconds; timeouts, holds, skips, malformed/incomplete records or a
216
+ single turn over 1 MiB fail closed and retain the source home for retry rather
217
+ than truncate evidence. A genuinely empty record is reported honestly.
218
+ Retirement captures/enqueues; **it does not wait for a model or GitHub**.
219
+ After successful custody transfer the home may disappear while judgment and
220
+ publication continue. Unexpected disappearance leaves existing evidence usable
221
+ but reports `finalCaptureUncertified`, not fictitious final capture success.
222
+ Durable evidence has no automatic deletion.
223
+
224
+ One scheduler **command job per source** runs from stable deployment context,
225
+ using the durable descriptor and source soul selector. Dispatch remains activation
226
+ and trust gated after retirement, without inheriting another instance's identity.
227
+ Registration idempotently creates/verifies the job; setup failures are retryable,
228
+ and disabled jobs are not silently re-enabled. No host timer is installed without
229
+ explicit operator consent. See [schedules](schedules.md#okf-v2-source-jobs).
230
+
231
+ ## Independent judgment and delivery
232
+
233
+ A worker uses **`work: directory`**, never an attached source tree. It stages
234
+ `work/bases/<alias>/` independently of the source branch, runtime and lifetime.
235
+ It reads durable `input.json` and `staging.json`, edits only owned staged nodes
236
+ and allowed navigation, and writes `judgment.json`. A scaffold-only request
237
+ stops before any model launch. Service agents do not register/capture themselves;
238
+ no-launch sources cannot cause scheduled model launches.
239
+
240
+ OKF's two-part promotion test is: would a future instance act differently, **and**
241
+ could it not discover this by reading the repository? Decisions and rationale,
242
+ rejected alternatives, discovered limits and owned/freshness-marked slow state
243
+ qualify. Code descriptions, task residue, secrets and verbatim third-party
244
+ messages do not. Preserve explicit human acceptance evidence instead of
245
+ re-judging accepted decisions. These are OKF choices, not kernel-wide doctrine.
246
+
247
+ Each input gets `promote`, `merge` or `drop`, a reason and actual concept paths.
248
+ Concepts cite input hashes and record turn IDs. Completion validates ownership,
249
+ base navigation/history, full OKF conformance, baseline, provenance and explicit
250
+ judgment; credential-shaped output checks do not replace human/model judgment.
251
+ Deleting a staged concept requires an explicit removal reason. Workers never
252
+ edit live notes, accepted bases or soul skills themselves.
253
+
254
+ | Provider | Successful delivery |
255
+ |---|---|
256
+ | Git | Verified content delta, real commit/push and same-repository PR through native `git`/`gh`. No force push, source-branch commit or direct fallback. Merge-visible acceptance is separate from PR delivery. |
257
+ | Directory | Durable proposal, cooperative base lock, baseline comparison, publication journal, file-by-file atomic replacement and full validation/digest receipt. Pending publication blocks fresh reads. No Git dependency. |
258
+
259
+ Directory recovery is single-host cooperative recovery, not a distributed
260
+ transaction. Multiple destinations can be partially delivered with separate
261
+ receipts. Inputs are processed only when required destinations resolve. All-drop
262
+ or no-change judgment can be successful without inventing a PR. Enqueue, worker
263
+ spawn and command exit alone are not successful learning.
264
+
265
+ ## Inspection and operator commands
266
+
267
+ Run home-local commands from that source home. For cross-source or retired-source
268
+ commands, use the durable deployment context in a clean operator shell without
269
+ another instance's `OATS_*`/`PI_*` identity; select the configured source soul.
270
+
271
+ ```bash
272
+ # Read-only; no capture, refresh, scheduling or worker launch:
273
+ oats okf inspect --home /absolute/instance-home --json
274
+ oats operation run knowledge:inspect --home /absolute/instance-home --json
275
+ # Durable source selection after the home disappears:
276
+ oats okf inspect --source /absolute/state/sources/UUID/source.json --soul domain-expert --json
277
+ # Explicit manual request; --no-launch still captures and creates a worker scaffold:
278
+ oats okf harvest --no-launch --json
279
+ oats okf run-source --source /absolute/state/sources/UUID/source.json --manual --no-launch --soul domain-expert --json
280
+ ```
281
+
282
+ `inspect` reports frozen `owns`, `reads`, `bases`, the registered `acceptedView`
283
+ (not a fresh accepted-branch read), durable capture/processing/delivery/acceptance
284
+ receipts and scheduler health. `status.lastCapture` is the last attempt, not
285
+ proof the source is still present.
286
+
287
+ For a **live identity-matching source**, `documents` includes labeled Markdown:
288
+ `Working state (STATE.md)`, `Log (log.md)` and sorted `Pending note: <name>`
289
+ entries, including nested notes. Missing documents are omitted. A
290
+ `Durable processing receipts` text document follows. `liveMemory` supplies
291
+ `available`, `reason` and `observedAt`. Retired, missing, reused or unverified
292
+ homes expose only durable documents, with an explicit reason. Inspection checks
293
+ the source pointer and any instance metadata before and after reading; it rejects
294
+ unsafe live files/symlinks/hard links instead of returning a partial success.
295
+ Unsafe home identity withholds live memory but retains durable inspection. This
296
+ is a best-effort live observation, not a locked multi-file snapshot.
297
+
298
+ Inspection retains the **explicit 256 KiB per-document preview cap**. Larger
299
+ documents report `truncated: true` and original `bytes`; smaller documents are
300
+ byte-exact. The **whole JSON envelope drains through stdout**, even with large
301
+ receipts or multiple Markdown documents. Do not confuse this labeled preview
302
+ with evidence capture or `read`: those preserve full returned text.
303
+
304
+ Completion uses the worker's generated, safely quoted command:
305
+
306
+ ```bash
307
+ oats okf complete --source /absolute/state/sources/UUID/source.json --run RUN_UUID --judgment /absolute/worker/work/judgment.json --soul domain-expert --json
308
+ oats okf retry --source /absolute/state/sources/UUID/source.json --soul domain-expert --json
309
+ ```
310
+
311
+ Retry preserves uncertain delivery. `--launch` explicitly starts a ready worker;
312
+ `--rejudge` preserves old proposals and refreshes only outstanding destinations,
313
+ never redelivering settled ones. A pending directory journal must recover, not
314
+ be removed to force rejudgment. After a PR merges, repeat `complete` for the
315
+ same source/run without `--judgment` to reconcile acceptance. If launch status
316
+ is unknown, inspect the worker session before retrying. See the
317
+ [standalone runtime guide](https://github.com/awebai/oats-okf#independent-worker-and-completion)
318
+ for exact recovery, adoption and lock-release procedures.
134
319
 
135
320
  ## Without a knowledge integration
136
321
 
137
- `knowledge: none` is valid. The agent gets no OATS memory files, no memory
138
- briefing, no harvest agent, and no OKF skills. It may still use whatever
139
- memory conventions the repo or harness already provides.
322
+ `capabilities.layers.knowledge: none` is valid. The kernel creates no OKF state,
323
+ notes, bundle or harvest flow. Other capabilities may adopt, adapt or replace
324
+ the reference model; they do not inherit OKF's directories or judge. Native
325
+ record capture remains a separate surface. Selecting `none` is not a data
326
+ migration and does not erase existing memory.
package/docs/layers.md CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  Status: contracts on paper (migration step 2 of
4
4
  [the 2026-09-03 architecture proposal](2026-09-03-architecture-proposal.md)).
5
- Every section says what is **shipped** today and what is **proposed**. A
5
+ Sections distinguish **shipped**, **prepared** and **proposed** behavior.
6
+ The knowledge section describes the prepared OKF v2 integration; its release
7
+ gates are explicit in [v0.23.1 notes](release-notes/v0.23.1.md). A
6
8
  proposed clause describes the contract the kernel will be refactored toward;
7
9
  it is not a claim about current behavior, and the shipped documents
8
10
  ([souls and instances](souls-and-instances.md),
@@ -127,65 +129,58 @@ kernel's code has no branch that names either.
127
129
 
128
130
  ## The knowledge contract
129
131
 
130
- **Shipped.** The `knowledge` slot. The bundled implementation is `oats.okf`:
131
- an OKF bundle under `soul/knowledge/`, per-instance `STATE.md`, `log.md`, and
132
- `notes/`, the `okf` and `memory-harvest` skills, and `oats okf harvest`, which
133
- spawns the capability-defined `memory-harvest` soul attached to the source
134
- instance's work tree. `knowledge: none` is valid and yields no memory files
135
- and no harvest.
136
-
137
- **Contract.** Two sides.
138
-
139
- *Read.* An instance can find and consult organizational knowledge,
140
- index-first and selectively, and is told how by the implementation's injected
141
- block and skill. Prior decisions, lessons, and playbooks in scope are binding
142
- context; re-deriving what the soul already knows is a bug. **Proposed:** the
143
- scope of what an instance may read is decided by its soul type, which needs
144
- `OATS_SOUL_TYPE` (step 7) before an implementation can act on it.
145
-
146
- *Write.* A permitted soul (a harvester type) can promote into the store. The
147
- format is the implementation's. Delivery matches the soul's custody: a commit
148
- on the instance's branch for repository-resident souls, a pull request to
149
- the soul's home repository for workspace-mode souls, direct edits for local
150
- souls.
151
-
152
- *Custody, shipped.* Delivery custody is keyed by where the soul resides: a
153
- commit on the instance's branch for repository-resident souls, a pull request
154
- to the soul's home repository for workspace-mode souls, direct edits for local
155
- souls. That is the only custody the kernel and `oats.okf` implement today.
156
-
157
- *Custody scoping, proposed.* The requirement is that repository-specific
158
- facts never move into a broader scope by default and that a cross-repository
159
- soul never reads another repository's specifics. The design that meets it
160
- belongs to the knowledge package, not the kernel. Custody layers (soul-shared,
161
- workspace overlay, repository overlay) are one candidate; scoping by soul
162
- type plus residency is another. Nothing here is settled or shipped.
163
-
164
- *Promotion doctrine.* What the write side accepts is a decision, not a
165
- format question. The line is decision versus description. Descriptions of
166
- how the code fits together go stale and compete with the code; the write
167
- side rejects them. Decisions, what was chosen, what was rejected, and why,
168
- cannot be derived from code and are accepted, as are inspiration genealogy
169
- ("took this from X, rejected Y because Z"), process lessons, and maintained,
170
- timestamped, superseded-on-change slow state about an area. Slow state is
171
- accepted only with its maintenance discipline: a named owner and an
172
- update-on-change rule; a slow-state concept nobody maintains is
173
- indistinguishable from residue and is rejected as such. Task residue
174
- (pull-request numbers, half-done plans, point-in-time environment facts) dies
175
- with the instance. One home per decision; split-brain comes from copies. The
176
- homing rule: architecture facts that several roles need go in repository-
177
- visible docs and souls point to them; craft decisions scoped to one role go
178
- in that role's soul; product direction goes in the steward's bundle,
179
- consulted and never copied. For non-coding specialists none of their
180
- knowledge is re-derivable from a repository, so those souls are almost pure
181
- knowledge. See [knowledge theory](knowledge-theory.md) for the derivation.
182
-
183
- **Proposed.** The harvester's input widens from the agent's own notes to the
184
- capture contract (below), so lessons reach the soul even when an agent wrote
185
- no notes; the promotion doctrine is unchanged, only the input channel widens.
186
-
187
- **Test.** A plain-Markdown or wiki-backed implementation beside `oats.okf`,
188
- each with its own harvester; a soul's `AGENTS.md` unchanged between them.
132
+ **Shipped kernel contract.** Zero or one knowledge capability per soul,
133
+ selected under `capabilities.layers.knowledge`. `none` creates no
134
+ provider memory or harvest flow and does not delete existing state. The kernel
135
+ owns neither the format nor a mandatory promotion doctrine.
136
+
137
+ **Prepared reference implementation: oats.okf 2.0.0 / framework v0.23.1.**
138
+ All accepted knowledge is external. Explicit bindings name Git or non-Git
139
+ bases; `soul/okf.json` declares stable ownership and read references, while
140
+ `okf-base.json` identifies accepted nodes. Missing configuration or knowledge
141
+ fails working-source spawn, never creates an empty substitute.
142
+
143
+ *Read.* Sources consult immutable accepted views, index-first and selectively.
144
+ Prior rationale should be consulted rather than re-derived. OKF's `owns` routes
145
+ responsibility and `reads` chooses starting context: neither is an ACL, and all
146
+ configured bases are discoverable/readable. Cannot-write is instruction, not an
147
+ OS sandbox. A directory publication journal blocks fresh views; Git readers see
148
+ only the accepted branch, not an open PR.
149
+
150
+ *Capture and judgment.* Working agents capture state/log/notes; durable source
151
+ custody also copies full native record windows through the public CLI. A separate
152
+ worker judges from frozen input without needing the source home, worktree or
153
+ model. Source retirement waits for certified capture, not a model or GitHub.
154
+ Workers use independent `directory` execution and never edit source notes or
155
+ soul skills. Existing hooks and per-source command schedules supply this flow;
156
+ the proposed generic `harvest` event above is not implemented or required.
157
+
158
+ *Delivery custody.* Knowledge placement, not soul residency or work mode,
159
+ determines delivery. All Git bases use verified PR-only delivery with separate
160
+ merge-visible acceptance. Genuine non-Git directories use cooperative locks,
161
+ baseline comparison, journalled publication and validated receipts, without Git
162
+ or gh. There is no direct Git fallback and no cross-base distributed transaction.
163
+ Source descriptors, proposals and processing/delivery/acceptance receipts outlive
164
+ source retirement. Inspection can show matching live Markdown plus durable
165
+ receipts; missing/reused homes cannot supply live memory for an old source.
166
+
167
+ *Reference promotion doctrine.* OKF accepts durable behavior-changing judgment
168
+ that is not recoverable merely by reading code: rationale, rejected alternatives,
169
+ discovered limits and maintained slow state. It rejects code descriptions, task
170
+ residue, secrets and verbatim third-party messages. Human-accepted decisions keep
171
+ acceptance evidence; maintained state needs an owner and freshness discipline.
172
+ One canonical concept is preferable to copied claims. These are the default
173
+ capability's choices, not a compulsory judge for every knowledge implementation.
174
+
175
+ See [the runtime guide](knowledge.md) and [v1 migration](knowledge-migration.md)
176
+ for current commands and constraints. The [reference theory](knowledge-theory.md)
177
+ and [authoring curriculum](knowledge-capability-authoring.md) are optional;
178
+ capabilities may adopt, adapt or replace them and own their complete runtime.
179
+
180
+ **Test.** OKF's Git and directory providers exercise independent custody within
181
+ one capability. A second knowledge capability with a different model remains a
182
+ separate replaceability test; two OKF providers do not prove that test by
183
+ renaming them as two integrations.
189
184
 
190
185
  ## The tasks contract
191
186
 
@@ -260,8 +255,8 @@ them.
260
255
  `packages/record` captures Claude Code, Pi, and Codex transcripts plus aw
261
256
  client logs. It skips sources matched by the local record's ignore list. It
262
257
  stores captured turns in an append-only, content-addressed record with a search
263
- index (`oats setup`, `oats capture`, `oats recall`). It is not a capability and
264
- no lifecycle hook knows about it.
258
+ index (`oats setup`, `oats capture`, `oats recall`). It is not a capability. A knowledge capability may consume source-targeted
259
+ capture/recall through the supported CLI boundary, as OKF v2 does.
265
260
 
266
261
  **Contract.** The format of ephemeral state. Two kinds satisfy it: an agent's
267
262
  own notes (its report of what mattered, today created by the knowledge
@@ -11,6 +11,12 @@ kernel does not read `oas-*` configuration names or `oas.*` capability IDs.
11
11
  An unchanged agent-directory layout can make an old scope look familiar
12
12
  while its knowledge and messaging configuration remains unmigrated.
13
13
 
14
+ > **Separate knowledge cutover:** OAS/package name migration does not migrate
15
+ > soul knowledge, source memory or v1 watermarks to OKF v2. If the selected
16
+ > catalog update acquires OKF 2.0.0, plan [knowledge preservation and cutover](knowledge-migration.md)
17
+ > before activation/spawn. The v2 integration is [prepared](release-notes/v0.23.1.md),
18
+ > not a claim that those dependencies or any deployment have already changed.
19
+
14
20
  ## Upgrade one scope
15
21
 
16
22
  Finish or preserve active work before changing a daily-use deployment.
@@ -83,4 +89,4 @@ requirement to wait for OATS publication.
83
89
 
84
90
  See the [0.22.0 release notes](release-notes/v0.22.0.md) for the rename,
85
91
  package versions, and compatibility changes, and the
86
- [first-team qualification](first-team-demo.md) for current operating evidence.
92
+ [first-team qualification](first-team-demo.md) for historical v1 operating evidence.