@awebai/oats 0.22.17 → 0.23.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.
Files changed (45) hide show
  1. package/README.md +7 -2
  2. package/bin/oats.mjs +365 -31
  3. package/docs/configuration.md +65 -0
  4. package/docs/design/2026-09-07-mobile-agent-management-proposal.md +228 -0
  5. package/docs/design/2026-09-08-expert-assisted-deployment-proposal.md +558 -0
  6. package/docs/design/2026-09-13-knowledge-and-memory-direction.md +744 -0
  7. package/docs/design/2026-09-13-knowledge-implementation.md +127 -0
  8. package/docs/design/2026-09-13-knowledge-location-contract.md +340 -0
  9. package/docs/design/launch-configurations.md +164 -0
  10. package/docs/design/package-runtime-api.md +177 -3
  11. package/docs/desktop-cli-api.md +68 -2
  12. package/docs/desktop-instance-start.md +39 -3
  13. package/docs/execution-targets.md +16 -0
  14. package/docs/knowledge-capability-authoring.md +98 -0
  15. package/docs/knowledge-reference/acceptance.md +108 -0
  16. package/docs/knowledge-reference/adoption.md +61 -0
  17. package/docs/knowledge-reference/harvester.md +107 -0
  18. package/docs/knowledge-reference/model.md +84 -0
  19. package/docs/knowledge-reference/package-craft.md +126 -0
  20. package/docs/knowledge-reference/provider-mapping.md +77 -0
  21. package/docs/knowledge-reference/reader-capture.md +87 -0
  22. package/docs/knowledge-theory.md +20 -6
  23. package/docs/layers.md +8 -7
  24. package/docs/oats-config.schema.json +33 -2
  25. package/docs/release-notes/v0.22.18.md +101 -0
  26. package/docs/release-notes/v0.22.19.md +115 -0
  27. package/docs/release-notes/v0.23.0.md +93 -0
  28. package/docs/souls-and-instances.md +18 -1
  29. package/injects/work-directory.md +18 -0
  30. package/lib/core.mjs +1109 -187
  31. package/lib/schedule.mjs +12 -2
  32. package/lib/servers.mjs +89 -4
  33. package/package.json +2 -2
  34. package/packages/record/README.md +19 -0
  35. package/packages/record/bin/capture.mjs +144 -53
  36. package/packages/record/bin/recall.mjs +17 -11
  37. package/packages/record/bin/record-native-start.mjs +11 -0
  38. package/packages/record/lib/capture-cc.mjs +82 -27
  39. package/packages/record/lib/capture-lock.mjs +81 -5
  40. package/packages/record/lib/formats.mjs +108 -21
  41. package/packages/record/lib/native-history.mjs +87 -0
  42. package/packages/record/lib/session-roots.mjs +90 -0
  43. package/packages/record/lib/session-snapshot.mjs +61 -0
  44. package/packages/record/lib/sessions-for-home.mjs +88 -56
  45. package/skills/oats/SKILL.md +3 -1
@@ -0,0 +1,127 @@
1
+ # Knowledge implementation plan
2
+
3
+ Status: implementation authorized by the human on 2026-09-13, including main
4
+ pushes and framework/OKF releases. Execute bounded batches with adversarial
5
+ review after approximately every two new commits, including fix commits.
6
+ The [location contract](2026-09-13-knowledge-location-contract.md) and its
7
+ [reference-theory boundary](../../agents/oats-expert/soul/knowledge/decisions/provider-neutral-knowledge-and-harvest.md)
8
+ remain the architectural context. This document resolves implementation choices
9
+ under that authorization; it does not impose OKF policy on other integrations.
10
+
11
+ ## First delivery
12
+
13
+ - Canonical reference theory and injection/skill authoring guidance.
14
+ - An optional, installed-artifact-usable `knowledge-theory-expert`.
15
+ - Default OKF with working Git and ordinary directory custody. Omnigraph is an
16
+ authoring example, not a dependency or a required first implementation.
17
+ - Explicit external base/node ownership and initial reads; independent,
18
+ automatically requested per-source harvest; preserved evidence before
19
+ retirement; Git deliveries always PRs; no Git dependency for directory mode.
20
+ - Explicit migration with preservation and cutover, never silently discarding
21
+ an old soul bundle or treating a missing base as empty knowledge.
22
+
23
+ ## Follow-on phase — after this implementation is complete
24
+
25
+ The human additionally requested a dedicated OATS knowledge Git repository and
26
+ an expertise-oriented soul reorganization. The [accepted follow-on plan](../../agents/oats-expert/soul/knowledge/decisions/expert-souls-and-knowledge-rebuild.md)
27
+ records the intended overall/kernel/Desktop/market/onboarding roles, the ban on
28
+ engineer-role souls, strict audit of existing knowledge and pending notes,
29
+ rejection of obsolete OAS material and code duplication, and safe cutover.
30
+ This is a curated rebuild, not a bulk migration. The human subsequently allowed
31
+ the separate repository shell to be provisioned under temporary personal
32
+ ownership pending organization transfer. Do not migrate the corpus, rename
33
+ live souls, or remove source knowledge before implementation verification.
34
+
35
+ ## Implementation choices
36
+
37
+ 1. **Capability-owned configuration.** Initially accept one absolute
38
+ `bindings-file` setting, avoiding ambiguous relative-setting provenance.
39
+ Paths inside it resolve from that file's directory. The document contains
40
+ version, durable state directory, named Git/directory bases and cadence.
41
+ 2. **Capability-owned soul declarations.** Use `soul/okf.json` rather than
42
+ teaching the kernel an OKF-specific nested YAML schema. It declares stable
43
+ owner identity, `owns` and `reads`. Accepted bases carry matching identity
44
+ and node ownership metadata. No knowledge content resides in the soul.
45
+ 3. **One link namespace per OKF base.** Nodes are owned, nonoverlapping
46
+ subdirectories. Reads are selective, index-first and non-mutating. Every
47
+ configured base is discoverable; `reads` is not an ACL.
48
+ 4. **Durable per-source input.** Keep copied evidence, note hashes, bounded
49
+ record content, frozen destinations and processing receipts outside source
50
+ homes/worktrees and accepted bases. Separate capture, delivered judgment,
51
+ and accepted/reader-visible state. No automatic evidence garbage collection
52
+ in the first implementation.
53
+ 5. **Directory custody is real.** Independent workers must not require a fake
54
+ Git repository. Add only the generic non-Git execution support actually
55
+ needed; preserve work-mode, trust and retirement safety.
56
+ 6. **Delivery.** Git workers edit their own accepted-baseline checkout and
57
+ produce a verified PR receipt. Directory workers stage changes and publish
58
+ with baseline checks, coordination and crash-recoverable receipts. Never
59
+ downgrade Git failures into direct writes. Initial directory coordination
60
+ is single-host/cooperative, not a distributed-lock claim.
61
+ 7. **Automation.** Reuse generic scheduler command jobs for per-source work;
62
+ retain pending work after its source is gone. Source registration is
63
+ automatic; host timer installation is an explicit setup action. Retire
64
+ captures/enqueues, not synchronously waits for model judgment or GitHub.
65
+ 8. **Optional authoring distribution in this repository.** Ship a dedicated
66
+ `oats.knowledge-theory` package under `oats-package/`, using an enumerated
67
+ self-contained capability subtree. This keeps release scope to the two
68
+ authorized repositories and avoids pretending an edit to the bundled
69
+ `oats.authoring` changes its separately released catalog package. The new
70
+ package supplies the expert and authoring skill/reference closure, has no
71
+ knowledge-layer binding or mandatory injection, and does not depend on OKF.
72
+ **Release channel: Git, not npm.** The npm kernel ships public docs and the
73
+ CLI but excludes `oats-package/` entirely: npm omits symlinks and therefore
74
+ cannot carry the canonical source `CLAUDE.md -> AGENTS.md`. Do not ship a
75
+ partial copy, synthesize source aliases on acquisition, weaken the source
76
+ rule, or change generic installed-artifact integrity semantics. Acquire with
77
+ `oats install git:github.com/awebai/oats@v0.23.0`, then explicitly target
78
+ `oats.knowledge-theory` with `oats use ... --soul <author-soul>`. The default
79
+ Git package path selects the self-contained subtree and exact-locks its
80
+ commit. A catalog pin can follow only after that immutable tag exists.
81
+ 9. **Minimal generic fixes.** Hooks must receive the running kernel's absolute
82
+ CLI path; scheduled dispatch must not inherit another instance's identity;
83
+ final record capture must distinguish completion from a skipped/held pass.
84
+ Do not add a knowledge registry or compulsory reference doctrine to core.
85
+
86
+ ## Source and delivery discipline
87
+
88
+ The standalone OKF repository's enumerated runtime subtree is
89
+ `oats-package/capabilities/oats-okf/`. Its published `v1.6.1` is the starting
90
+ baseline; stale unenumerated duplicates are not implementation targets. The
91
+ framework's bundled copy is synchronized only at integration, with parity tests.
92
+ Existing release tags are immutable.
93
+
94
+ Implementation helpers edit explicitly assigned files and do not commit,
95
+ push, change branches or release. The maintainer integrates small commits and
96
+ runs exact-range adversarial review every two commits, closing blocking
97
+ findings before dependent work advances. Reviews cover product boundary,
98
+ correctness, security and release/merge readiness, not just test results.
99
+
100
+ ## Verification and release gates
101
+
102
+ - Standalone tests exercise its actual exported payload, not stale root copies.
103
+ - Framework tests include generic non-Git execution, hook/dispatch identity,
104
+ capture-completeness and alternative-provider isolation.
105
+ - Real temporary Git repositories test embedded/dedicated Git knowledge; real
106
+ directories outside Git test directory custody, concurrent updates and crash
107
+ recovery. Failed/uncertain publication stays recoverable.
108
+ - Source deletion and name reuse cannot lose or misattribute pending evidence.
109
+ - Installed-artifact acquire/lock/trust/activate/scaffold/retire probes validate
110
+ the complete expert curriculum and OKF's real compatibility floor. The kernel
111
+ tarball must exclude the optional Git package while retaining public docs.
112
+ Its installed CLI acquires the exact complete theory Git fixture via direct
113
+ and catalog sources, verifies the tracked alias survives unchanged, removes
114
+ the fixture checkout, and tests local reference closure and alternative-theory
115
+ isolation. Generated instance aliases remain ordinary kernel behavior.
116
+ - A fresh selected-runtime instance must answer from delivered knowledge without
117
+ the source home/transcript. Scaffolding alone is not this learning gate.
118
+ - Run strict knowledge validation, all affected tests, full framework gates,
119
+ tarball smoke, and a final cross-repository adversarial review before release.
120
+
121
+ Version targets are provisional: framework 0.23.0 for generic support, OKF 2.0.0
122
+ for breaking external-knowledge custody, optional theory package 1.0.0, then a
123
+ framework patch for catalog/payload updates if required. The prerequisite
124
+ 0.23.0 keeps bundled OKF and its catalog pin at 1.6.1; standalone OKF 2.0.0
125
+ follows rather than creating a prerequisite release cycle. Publish dependency
126
+ sources before advancing catalog pins; follow actual current release scripts,
127
+ not historical instructions contradicted by the implemented release lane.
@@ -0,0 +1,340 @@
1
+ # Knowledge contracts, integrations, and storage
2
+
3
+ **Status:** architecture proposal for discussion, 2026-09-13. No implementation
4
+ or configuration schema is approved by this document. Accepted direction is
5
+ recorded in [external knowledge custody](../../agents/oats-expert/soul/knowledge/decisions/external-knowledge-custody.md)
6
+ and [provider-neutral knowledge and harvest](../../agents/oats-expert/soul/knowledge/decisions/provider-neutral-knowledge-and-harvest.md).
7
+ This proposal refines the [knowledge and memory direction](2026-09-13-knowledge-and-memory-direction.md).
8
+
9
+ ## 1. Accepted starting points
10
+
11
+ **Scope:** OATS publishes an opinionated reference knowledge theory; default
12
+ OKF follows it, but other knowledge capabilities may choose different models.
13
+ The location/harvest design below is for this default-theory workstream and
14
+ capabilities that choose to adopt it, not extra kernel requirements.
15
+
16
+ - All knowledge leaves the soul, including general expertise.
17
+ - Working instances read knowledge and capture memory; they do not promote
18
+ into the base. For now this is injection guidance, not an OS sandbox.
19
+ - Harvesting is independent of the source instance's execution/work context.
20
+ - Git-committed knowledge updates are PRs.
21
+ - Access rests on users' existing accounts; for GitHub repositories, their
22
+ GitHub permissions apply. Assume all workspace/team agents can access the
23
+ configured bases. No new public/private classification or per-agent ACLs.
24
+ - The first working version must cover Git-backed OKF AND a non-Git knowledge
25
+ store. Non-Git support is not a later optional extension.
26
+ - The reference knowledge/memory theory is independent of concrete storage
27
+ tools. An integration using a graph store and its CLI can adopt that theory,
28
+ or choose a different approach; it owns the resulting runtime behavior.
29
+ - OATS supplies canonical authoring docs for knowledge injections and skills,
30
+ and a `knowledge-theory-expert` agent to help create knowledge capabilities.
31
+ The expert and full authoring material are planned deliverables, not yet built.
32
+ - Every capability provides its own complete runtime instructions, skills,
33
+ memory conventions, harvester and related machinery. The kernel does not
34
+ automatically inject the reference doctrine into every knowledge capability.
35
+
36
+ The mechanisms below are proposed. In particular, which non-Git implementation
37
+ ships first is not yet settled: directory-backed OKF is the simplest candidate;
38
+ Omnigraph is a concrete alternative to investigate, not an already verified
39
+ integration or an agreed initial dependency.
40
+
41
+ ## 2. Separate the model, the integration, and custody
42
+
43
+ ### OATS reference knowledge/memory model — the recommended approach
44
+
45
+ - **Instance memory:** task-local state, observations and captured evidence.
46
+ - **Durable knowledge:** expertise that survives an instance, with explicit
47
+ ownership, provenance, decisions and supersession.
48
+ - **Capture:** preserve observations while doing the work; do not make the
49
+ working instance hold the promotion bar.
50
+ - **Harvest:** judge candidates against the common doctrine; promote, merge,
51
+ supersede or drop; preserve exclusions and one authoritative home per claim.
52
+ - **Consultation:** discover relevant prior knowledge before re-deriving it,
53
+ using progressive disclosure rather than bulk loading.
54
+
55
+ These meanings do not require Markdown, YAML frontmatter, `index.md`, local
56
+ files, a Git branch, or a particular command. The promotion bar, expertise
57
+ rather than code-description doctrine, and capture/judgment separation remain
58
+ consistent when an author chooses to implement this theory with another tool.
59
+ They are not mandatory policy for a capability that chooses a different model.
60
+
61
+ ### Canonical authoring material and knowledge-theory-expert
62
+
63
+ OATS maintains the theory in its repository and supplies canonical documentation
64
+ for turning it into working-agent injections, skills and harvester instructions.
65
+ These references explain the concepts, their rationale, expected behaviors and
66
+ examples. An author can point a coding agent at them without needing a special
67
+ runtime dependency.
68
+
69
+ OATS should also provide `knowledge-theory-expert`. Its job is to:
70
+
71
+ - explain the reference model and the reasons for its distinctions;
72
+ - help map it to a chosen tool's actual read/write and storage behavior;
73
+ - help author a complete capability, including injections, skills and harvesting;
74
+ - identify gaps or deliberate departures and suggest relevant behavioral tests.
75
+
76
+ It assists authors; it does not run every harvest, police every capability,
77
+ serve as a required approval gate, or replace the canonical docs. Its package,
78
+ curriculum and instructions are still to design. No agent has been scaffolded
79
+ or spawned as part of this scoping discussion.
80
+
81
+ ### Knowledge capability — a complete runtime implementation
82
+
83
+ Each capability supplies the complete behavior selected by the deployment:
84
+ its skills, injections, instance memory and capture protocol, native reader
85
+ and writer tools, harvester and judgment instructions where applicable,
86
+ lifecycle contributions, validation and delivery. It is not only an adapter
87
+ under a mandatory OATS-supplied judge.
88
+
89
+ For example:
90
+
91
+ - Default OKF authors use the reference theory and ship concrete OKF injection,
92
+ craft/harvest skills, harvester, hooks and Git/non-Git delivery behavior.
93
+ - An Omnigraph capability author may use the same docs/expert to create the
94
+ equivalent package around the native CLI and data model.
95
+ - An author choosing a different memory or learning model provides and
96
+ documents that capability's own runtime instructions instead.
97
+
98
+ Canonical theory stays in one maintained place, but adopting it does not
99
+ require a mandatory shared runtime injection or harvester skill. Explicit
100
+ resource reuse through supported packaging is fine; mutable documentation is
101
+ not fetched into agents as a hidden policy update. Capability releases own
102
+ changes to the runtime material they supply.
103
+
104
+ The kernel keeps generic capability/layer/configuration/lifecycle/operation
105
+ and trust contracts. It neither chooses the theory nor implements a universal
106
+ harvester. Existing framework/work-mode rules still apply to every capability.
107
+
108
+ ### Custody — how a write becomes accepted knowledge
109
+
110
+ Format and delivery are separate choices. OKF does not imply Git:
111
+
112
+ | Implementation | Read path | Write/delivery path |
113
+ |---|---|---|
114
+ | Git-backed OKF | Accepted revision of an OKF bundle | Independent checkout, validation, PR; accepted after merge |
115
+ | Directory-backed OKF | Configured OKF directory | Coordinated, validated update with an observable durable result; no Git or PR |
116
+ | CLI-backed graph store | Provider-native discovery/query through its CLI | Provider-native writes and confirmation; no invented Git semantics |
117
+
118
+ A dedicated knowledge repository can be Git-backed; moving out of the code
119
+ repo does not make it non-Git. A non-Git store must work without `.git`, GitHub,
120
+ a branch, a remote, or a PR receipt.
121
+
122
+ ## 3. Base, node, binding
123
+
124
+ Sections 3–7 describe the proposed default location/harvest design and offer a
125
+ pattern for authors adopting the reference theory. These nouns and shapes are
126
+ not mandatory schema for every knowledge capability.
127
+
128
+ ### Base
129
+
130
+ A named body of durable knowledge with a canonical provider-resolved location.
131
+ It is not intrinsically an OKF bundle or a repository.
132
+
133
+ An OKF base maps to a bundle root. A different provider can map a base to its
134
+ native database/space/collection identifier. Only that provider interprets
135
+ its locator, storage structure, validation and consistency behavior.
136
+
137
+ General expertise, project decisions and team knowledge all live in bases;
138
+ none live inside souls. A project or workspace may consult several bases.
139
+ The invariant is **one authoritative home per concept**, not one required
140
+ physical storage root for everything relevant to a project.
141
+
142
+ ### Node
143
+
144
+ A logically soul-owned portion of a base, with exactly one owning soul. A soul
145
+ can own nodes in several bases. Ownership is responsibility and harvest
146
+ routing, not an access-control grant. A provider must make the boundary
147
+ addressable; an OKF directory is one representation, not the universal one.
148
+
149
+ `project/oats-desktop-expert` and `team/oats-desktop-expert` are distinct node
150
+ references. Matching leaf names never merge them. Owner identity must also
151
+ distinguish same-named souls in different repositories; its exact syntax is open.
152
+
153
+ ### Binding
154
+
155
+ Workspace/project configuration maps logical references to a selected
156
+ integration's concrete locations. A soul declares what it owns and consults,
157
+ without embedding knowledge, physical paths, remote URLs or credentials.
158
+
159
+ Illustrative soul declarations, not an approved schema:
160
+
161
+ ```yaml
162
+ # oats-desktop-expert/soul.yaml
163
+ knowledge:
164
+ owns: [project/oats-desktop-expert]
165
+ reads: [project/oats-expert]
166
+ ```
167
+
168
+ Here `oats-desktop-expert` consults project direction maintained by `oats-expert`
169
+ and accumulates its own durable Desktop expertise. Binding `project` to an
170
+ embedded OKF bundle, a separate OKF repository, or a non-Git store does not
171
+ change the meaning of those declarations.
172
+
173
+ Aliases are contextual, not global identities. Resolve them before a read or
174
+ harvest; persisted jobs retain the resolved destination so later configuration
175
+ changes cannot redirect pending work. Changing storage providers is an explicit
176
+ migration, not an alias edit that silently converts or copies knowledge.
177
+
178
+ ## 4. Reference-model implementation contract versus concrete location
179
+
180
+ Do not make a tool pretend to have files or Git metadata. The following is a
181
+ checklist for our default implementation and other capabilities adopting this
182
+ model. It is not a new universal knowledge-provider API, mandatory theoretical
183
+ conformance test, or kernel requirement.
184
+
185
+ | Concern | Provider-neutral meaning |
186
+ |---|---|
187
+ | Resolve | Map a logical base/node to an unambiguous provider-owned destination and owner |
188
+ | Discover/consult | Give instances a useful entry point and tools to retrieve relevant accepted knowledge |
189
+ | Prepare harvest | Preserve bounded source evidence and resolved destinations independently of the source home |
190
+ | Apply judgment | Let the harvester maintain knowledge using the provider's native authoring tools |
191
+ | Validate | Check the proposed update against the provider's representation and shared semantic requirements |
192
+ | Deliver | Report a durable proposal, an applied update, a no-change result, or a failure; distinguish these |
193
+ | Refresh/inspect | Explain what readers can see, freshness limitations and pending work without guessing from activity |
194
+
195
+ The resolved descriptor needs a logical reference, provider identity, opaque
196
+ provider locator, node/owner identity, reader/writer instructions or operation
197
+ references, delivery semantics, and binding provenance. A version or receipt
198
+ is provider-native; a Git commit ID is not a required field for every store.
199
+
200
+ ### OKF location examples
201
+
202
+ | Placement/custody | Canonical location | Bundle root | Read baseline |
203
+ |---|---|---|---|
204
+ | Embedded Git | `https://github.com/example/project.git` | `knowledge/` | Configured accepted branch |
205
+ | Dedicated Git | `https://github.com/example/project-knowledge.git` | `.` | Configured accepted branch |
206
+ | Non-Git directory | Explicit workspace-relative directory, e.g. `./team-knowledge` | That directory | Provider-confirmed current contents |
207
+
208
+ Git locators include repository, contained root, accepted ref and PR target/head
209
+ route. Directory locators include a resolved path and direct-update custody.
210
+ A future CLI-backed locator uses the actual identifiers supported by that
211
+ provider; do not invent Omnigraph fields or command flags before investigation.
212
+
213
+ Configuration belongs to the selected knowledge capability's settings and
214
+ existing targeting, not a new mandatory kernel registry. Multiple bases do not
215
+ require multiple active knowledge layers: `oats.okf` can supply both Git and
216
+ directory custody. An Omnigraph integration could replace it in another
217
+ deployment. Simultaneous different integrations in one instance are not assumed
218
+ here; that would need a separate composition decision.
219
+
220
+ ### Resolution and access rules
221
+
222
+ 1. Bind locations explicitly; do not choose from cwd, source work mode, source
223
+ feature branch or whichever checkout happens to be writable.
224
+ 2. Relative paths resolve from their declaring scope, with containment checks.
225
+ 3. Missing required bindings or failed access are visible errors; never create
226
+ an empty substitute or silently choose another base.
227
+ 4. Reads do not scaffold nodes. Creation and ownership changes are explicit writes.
228
+ 5. Use the user's existing account/access for the selected system. GitHub governs
229
+ GitHub access; a local directory uses host filesystem access; another tool
230
+ uses its native authentication. No new OATS permission system is implied.
231
+ 6. All configured workspace/team bases are available to its agents. `reads`
232
+ selects initial context, not an ACL; `owns` selects responsibility/routing.
233
+ Access to other repositories does not auto-bind them.
234
+ 7. A failed Git delivery cannot fall back to direct writes. Tracked knowledge
235
+ cannot be relabelled local merely to bypass its PR contract.
236
+ 8. Defer public/private classification and disclosure routing. Keep the existing
237
+ secret/credential and third-party-verbatim promotion exclusions.
238
+
239
+ ## 5. Independent harvest, provider-specific writing
240
+
241
+ A per-source harvest takes preserved evidence, source/soul identity, bounded
242
+ record provenance, claimed note versions, resolved destinations and a stable
243
+ input identifier. It does not rely on the source staying alive or keeping the
244
+ same worktree/branch. Independent execution does not mean context-free evidence.
245
+
246
+ The reference-model harvester's reasoning is:
247
+
248
+ 1. Consult existing relevant knowledge through the integration's read tools.
249
+ 2. Judge the source candidates under the common doctrine.
250
+ 3. Select each candidate's owned destination; maintain or supersede existing
251
+ knowledge rather than creating duplicate descriptions.
252
+ 4. Apply changes with the integration's authoring tools, validate, and report
253
+ the actual delivery outcome. Advance source processing state only under the
254
+ agreed durable-result protocol.
255
+
256
+ Concrete writing differs:
257
+
258
+ - **Git OKF:** worker-owned destination checkout, starting from the accepted
259
+ branch; knowledge-only PR whether the bundle is embedded or dedicated.
260
+ - **Non-Git OKF candidate:** worker-owned execution context, coordinated edits
261
+ to the configured directory, validation and recoverable publication. A plain
262
+ successful edit command alone is not the whole crash/retry contract.
263
+ - **Omnigraph scenario:** the harvester uses Omnigraph's native CLI to consult
264
+ and write knowledge; working instances use it to retrieve knowledge. How
265
+ logical nodes, supersession, receipts and consistency map to that CLI must
266
+ be verified. No command surface or transaction guarantee is assumed here.
267
+
268
+ The integration manages authenticating through the user's available access;
269
+ credentials do not travel inside harvest evidence. Source retirement preserves
270
+ inputs before removal or reports incomplete retirement. Results are per
271
+ explicit destination; cross-store changes are not assumed atomic.
272
+
273
+ Provider-neutral orchestration does not mean every backend supports identical
274
+ transactions or review states. Do not report a proposal as applied, a queued
275
+ write as queryable, or a process launch as successful harvesting.
276
+
277
+ ## 6. Visibility, concurrency and validation
278
+
279
+ For Git OKF, distinguish PR opened, merged, and visible in a refreshed reader.
280
+ For non-Git, distinguish proposed/staged changes if supported, durable application,
281
+ and reader visibility according to the actual provider. A direct local provider
282
+ can have no pending-review phase; it must not fabricate one.
283
+
284
+ A provider documents its read consistency and available version/freshness
285
+ signals. If it cannot offer snapshots, acknowledge that instead of inventing a
286
+ Git-like revision. Failed or rejected delivery must remain recoverable after
287
+ the source home is gone. Exact watermark and retention mechanics are open.
288
+
289
+ Concurrency has separate units: source input claims, node updates and storage
290
+ publication. Git requires accepted-head validation across PRs; non-Git files
291
+ need coordinated/recoverable publication; a service needs its actual concurrency
292
+ contract. Test concurrent harvests, retries, and failure after a partial write.
293
+
294
+ Validate OKF with the OKF validator, including each base's native link namespace.
295
+ A graph integration validates its own representation and logical ownership;
296
+ it does not run a Markdown validator on a service. Default implementations
297
+ must pass behavioral tests for the reference doctrine, provenance, supersession,
298
+ exclusions, one canonical home and consultation by a fresh instance. Authors
299
+ adopting the theory can reuse these tests; a capability choosing a different
300
+ theory is not rejected merely for differing from that model.
301
+
302
+ ## 7. First working version and remaining decisions
303
+
304
+ There are two related deliverables:
305
+
306
+ 1. **Reference/authoring:** canonical theory and injection/skill guidance plus
307
+ the `knowledge-theory-expert` agent. Useful without a running OKF deployment.
308
+ 2. **Default implementation:** complete capability-owned runtime behavior,
309
+ applying that theory to working Git and non-Git storage.
310
+
311
+ **Required:** working Git-backed OKF AND a working non-Git knowledge store.
312
+ A Git-only release with a non-Git interface stub does not satisfy this scope.
313
+
314
+ Recommendation for the smallest initial implementation: `oats.okf` with Git and
315
+ plain-directory custody. This exercises both paths without introducing an
316
+ unresearched external dependency. The choice is not yet accepted: confirm
317
+ whether the first non-Git implementation should instead be Omnigraph itself.
318
+ An Omnigraph implementation adopting the reference theory should be possible
319
+ without rewriting the theory; this does not oblige every Omnigraph capability
320
+ to adopt it.
321
+
322
+ Acceptance scenarios use `oats-expert` and `oats-desktop-expert`:
323
+
324
+ 1. Git OKF works both inside the code repo and in a dedicated knowledge repo;
325
+ harvest runs independently and opens the appropriate knowledge-only PR.
326
+ 2. The non-Git implementation persists real harvested knowledge with no Git
327
+ repository or GitHub dependency, and reports a verifiable result.
328
+ 3. In each implementation, a fresh instance answers from accepted knowledge
329
+ learned by a retired instance, without its home or transcript.
330
+ 4. Both preserve the same promotion doctrine, provenance and exclusions, and
331
+ handle concurrent updates, failed delivery and safe retirement inputs.
332
+ 5. A workspace using the OKF integration can consult multiple configured bases
333
+ without ambiguous ownership or destination selection.
334
+
335
+ Before implementation, settle the authoring-material and expert delivery shape,
336
+ non-Git backend, binding/schema and ownership identity, delivery/refresh semantics,
337
+ and source input/retention protocol. The kernel stays provider-neutral; each
338
+ capability supplies its complete runtime knowledge behavior. No mandatory shared
339
+ theory-runtime layer, public/private permission model or multi-provider router
340
+ is a prerequisite.
@@ -0,0 +1,164 @@
1
+ # Launch configurations and launch recipes
2
+
3
+ A **launch configuration** is a named way to start a harness, declared per
4
+ scope under `launch-configs:` in `oats-config.yaml` (see
5
+ docs/configuration.md): runtime, an executable, literal arguments,
6
+ environment (literals or `{fromEnv}` references), model, yolo. It is
7
+ independent of any soul; a soul may name one as its default
8
+ (`launch-config:` in soul.yaml, `oats soul set --launch-config`), and a
9
+ spawn, start or restart selects one by name.
10
+
11
+ A **launch recipe** is what a start is made of, recorded in the instance's
12
+ `instance.json` under `launch` beside the rendered `command`:
13
+
14
+ ```json
15
+ {
16
+ "version": 1,
17
+ "runtime": "claude",
18
+ "launchConfig": "personal", "launchConfigSource": "/scope",
19
+ "executable": "/scope/tools/claude-wrapper.sh",
20
+ "executableDeclared": "./tools/claude-wrapper.sh", "executableResolvedFrom": "relative to /scope",
21
+ "args": ["--settings", "/abs/settings.json"],
22
+ "env": { "KEY": { "fromEnv": "SRC" }, "LIT": "plain" },
23
+ "model": "claude-opus-5", "yolo": true,
24
+ "hooks": {
25
+ "launch": { "claude": "--dangerously-load-development-channels plugin:aweb-channel@awebai-marketplace" },
26
+ "env": { "AWEB_DELIVERY": "session" },
27
+ "contributions": [{ "capability": "oats.aweb", "layer": "messaging", "level": "/scope", "settings": { "delivery": "session" }, "trust": { "trusted": true, "integrity": "sha256-..." }, "launch": { "claude": "..." }, "env": ["AWEB_DELIVERY"] }]
28
+ },
29
+ "prompt": { "kind": "task-file", "file": "TASK.md" }
30
+ }
31
+ ```
32
+
33
+ The rendered `command` is produced by one renderer from the recipe. With no
34
+ configuration it is byte-identical to what spawn rendered before recipes
35
+ existed, so an older kernel starts such a home unchanged, and the golden
36
+ matrix freezes that. Configuration `args` go after the runtime's own
37
+ options and before capability launch arguments (for claude and codex the
38
+ `--` separator keeps them from consuming the task; for pi they follow the
39
+ task, like capability arguments). Every argument and literal value is
40
+ single-quoted: spaces, quotes and metacharacters are literal.
41
+
42
+ ## Environment references
43
+
44
+ `{fromEnv: SRC}` renders as `NAME="$SRC"` in the command: the persisted
45
+ command, the pending receipt and every answer carry the reference, never a
46
+ value. At start the execution host checks each source variable is set
47
+ (`E_LAUNCH_ENV_MISSING` before anything is created or stopped) and hands the
48
+ source variables to the pane only (tmux `-e`; a Herdr launch exports them in
49
+ the launched shell). Literal values are non-secret by contract but no answer
50
+ shows them: `list` and `preview` redact every environment value.
51
+
52
+ ## Selection rules
53
+
54
+ - A named configuration is a unit. `--launch-config NAME` with a `--runtime`
55
+ that disagrees with the configuration's runtime is refused
56
+ (`E_LAUNCH_CONFIG_MISMATCH`) before anything happens; the same runtime may
57
+ be repeated; `--model` and `--yolo` override the configuration's fields.
58
+ - Without `--launch-config`: a spawn takes the soul's `launch-config` default
59
+ or none; an existing home keeps its recorded configuration, except that
60
+ `--runtime` alone deliberately leaves it behind and renders the new
61
+ runtime's defaults (no old executable or args are carried).
62
+ - Model: explicit, else the configuration's, else on an existing home the
63
+ recorded model when the runtime is unchanged, else the runtime's native
64
+ default; a spawn without either resolves the soul's preference for the
65
+ runtime. A model never crosses runtimes.
66
+ - Executable: the configuration's (bare name on PATH; a path resolved against
67
+ the declaring scope when relative) or the runtime's default (claude through
68
+ `oats-claude-config`). It must be a regular executable file; it is never
69
+ run to probe it. Capability runtime-package requirements are checked with
70
+ the runtime's default binary, as at spawn.
71
+
72
+ ## Capability boundary
73
+
74
+ Spawn hooks contribute `launch` arguments keyed by runtime and `env` values.
75
+ Launch arguments are runtime-specific by construction; environment is
76
+ runtime-neutral by contract. The recipe records both with per-capability
77
+ provenance (settings and trust at spawn). A later start on the same runtime
78
+ reuses them. A runtime switch reuses the environment and needs the new
79
+ runtime's launch arguments from the same capabilities: a capability that
80
+ answered arguments for the old runtime and none for the new one refuses the
81
+ switch (`E_LAUNCH_PREPARATION`) with the remedy (change that capability's
82
+ setting, or the provider declares a `launch` hook). Spawn hooks are never
83
+ re-run by a start or restart.
84
+
85
+ ## `oats launch-config preview`
86
+
87
+ Read-only; nothing is locked or started. `--home ABS` describes an existing
88
+ home under a selection (`selection.source`: `frozen` when nothing was
89
+ selected, `config` when re-resolved, `frozen-command` for a home that
90
+ predates recipes, whose selection needs the restart conversion);
91
+ `--soul NAME [--dir SCOPE] [--agents-root ABS]` describes a new instance.
92
+ Answer: `{context, selected, selection:{source, launchConfig, runtime,
93
+ model, yolo}, runtime, model, modelSource, yolo, launchConfig,
94
+ launchConfigSource, executable:{path, declared, resolvedFrom}, argv,
95
+ environment:[{name, redacted|fromEnv}], command (redacted rendering),
96
+ prompt:{kind:"task-file", file:"TASK.md"}, hooks (redacted),
97
+ preflight:[{check: executable|environment|model|capabilities, ok, detail}],
98
+ ok}`. The TASK body is never included.
99
+
100
+ ## Starting and restarting an existing home
101
+
102
+ `oats session start --home ABS` runs the recorded recipe as it is (a
103
+ `--model` re-renders the model in place and the recipe follows). With
104
+ `--launch-config`, `--runtime` or `--yolo` the recipe is re-resolved by the
105
+ same planner preview uses, against the home's recorded context, and every
106
+ check runs before anything is observed: the recipe's shape, the executable
107
+ (regular file, executable), the references (set on this host), the
108
+ capabilities' contributions (below), the runtime packages. A recorded
109
+ reference is re-checked on every start path, model-only starts included,
110
+ and the pane receives the source's value under the kernel alias.
111
+
112
+ `oats session restart --home ABS [same flags] [--stop-grace SECONDS]` stops
113
+ the running harness and starts again in place under the one per-home lock:
114
+
115
+ 1. Every preflight above, first. A refusal leaves the harness running.
116
+ 2. The stop: SIGTERM to every process under the pane's launcher (a wrapper
117
+ that does not exec, the harness, their children), then a bounded wait
118
+ (default 20 s) for the signalled processes to be gone and the session to
119
+ read as a bare shell or stopped. Nothing is escalated: a harness still
120
+ there when the wait ends is reported (`E_SESSION_STOP_FAILED`, with the
121
+ processes still running) and nothing is launched. Elapsed time is never
122
+ taken as exit; a turn interruption is never taken as exit.
123
+ 3. The in-place start, with the pending receipt carrying the new recipe,
124
+ runtime and yolo, exactly as a start does; `.oats-restart.json` keeps the
125
+ stop's facts (what was signalled, when, whether exit was observed).
126
+
127
+ What the harnesses do on SIGTERM, from their installed sources and
128
+ documentation as read by the operating lead on 2026-09-07 (no live process
129
+ signalled): pi (@earendil-works/pi-coding-agent 0.84.2) registers
130
+ SIGTERM/SIGHUP handlers that end tracked children, dispose extensions and
131
+ exit; Claude Code's documentation makes Ctrl-C state-dependent (interrupt,
132
+ clear, double-press exit) and does not establish that an external SIGTERM
133
+ runs its SessionEnd hook; Codex's documentation establishes no SIGTERM
134
+ cleanup guarantee. So the contract is the request and the observation, not
135
+ a promise that a harness flushes its latest conversation: OATS preserves
136
+ the home, work, identity and notes; an old native conversation's unsaved
137
+ state is the harness's own. Wrappers should exec the harness or forward
138
+ signals. A longer `--stop-grace` can accommodate hook cleanup.
139
+
140
+ ## Homes that predate recipes
141
+
142
+ A home with a recorded `command` and no `launch` is converted narrowly when
143
+ a start selects something: only the kernel's own generated shapes are
144
+ recognized (identity environment, the binary, the runtime's template
145
+ arguments, `--model`, yolo, the task prompt). Other environment is kept and
146
+ attributed to the capability whose recorded declaration (`environment`,
147
+ `environmentNamespaces` in `capabilityRuntime`) owns it, so a session-delivery
148
+ home switches runtime with its `AWEB_DELIVERY` intact; spawn hooks are never
149
+ re-run. Any other argument is unclassified: the start is refused, naming the
150
+ arguments, unless an active trusted capability declares a `launch` hook that
151
+ prepares the launch anew (then its answer replaces them). The conversion is
152
+ recorded (`launch.legacy`) by the start that uses it.
153
+
154
+ ## The `launch` hook
155
+
156
+ A capability may declare `hooks.launch`. It runs on a start or restart of an
157
+ existing home (never at spawn, never spawn's identity work), side-effect-free
158
+ by contract, with `OATS_RUNTIME` set to the target runtime and
159
+ `OATS_PREVIOUS_RUNTIME` to the recorded one, and answers `{launch:{<runtime>:
160
+ args}, env:{...}}` for that runtime; its answer replaces the capability's
161
+ recorded contribution. Without it, a capability that contributed
162
+ runtime-specific arguments at spawn cannot follow a runtime change
163
+ (`E_LAUNCH_PREPARATION`), and a capability the scope no longer trusts has its
164
+ recorded arguments withheld the same way.