@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
@@ -81,7 +81,7 @@ this contract remains authoritative).
81
81
  2. **Spawn** — `oats spawn <agent> ... --json` with the EXISTING flags:
82
82
  `--purpose <slug>` (deterministic derived naming
83
83
  `<agent>-<purpose>`; no raw instance-name authority), `--parent`,
84
- `--repo`, `--work attached|worktree|checkout|workspace`, `--work-dir`,
84
+ `--repo`, `--work attached|worktree|checkout|workspace|directory`, `--work-dir`,
85
85
  `--branch`, `--model`, `--task`/`--task-file` (owner-only tempfiles:
86
86
  mode 0600, removed on every outcome). Existing validation and error codes
87
87
  (`E_BAD_ARGS`, `E_PARENT_NOT_FOUND`, `E_SPAWN_FAILED`, ...) are part of
@@ -96,8 +96,8 @@ this contract remains authoritative).
96
96
  read their settings (e.g. oats.okf's `harvest-model`) from `OATS_SETTINGS`;
97
97
  there is NO public resolved-config read command.
98
98
  4. **Consumer rules**: a package command executes the CLI at the exact
99
- absolute path the dispatcher provides in the **`OATS_CLI_BIN`** environment
100
- variable (part of the dispatch env contract, beside `OATS_SETTINGS`), via
99
+ absolute path the dispatcher or lifecycle runner provides in the
100
+ **`OATS_CLI_BIN`** environment variable (beside `OATS_SETTINGS`), via
101
101
  `execFile` on that path — **never** by resolving `oats` from `PATH` and
102
102
  never through a shell: PATH is not a trusted runtime boundary, and package
103
103
  commands run in worktrees where it can be shadowed. The consumer parses
@@ -109,6 +109,180 @@ Error codes are part of the contract: `E_USAGE`, `E_BAD_ARGS`,
109
109
  `E_RELATIVE_NOT_FOUND`, `E_RELATIVE_AMBIGUOUS`, `E_CAPABILITY_BLOCKED`,
110
110
  `E_CAPABILITY_INACTIVE`.
111
111
 
112
+ ### Directory execution for capability workers
113
+
114
+ A worker may explicitly select `work: directory` in its packaged `soul.yaml`,
115
+ pass `--work directory` to spawn, or use `spawnInstance(..., {work: "directory"})`.
116
+ This is a generic execution mode, independent of any knowledge provider.
117
+ Consumers using it must declare the directory-mode release as their
118
+ `compatibility.oats` floor, not the older boundary-v1 floor alone.
119
+
120
+ - `repo` / `--repo` is an **existing config context directory** in this mode,
121
+ not a Git requirement or an edit target. Relative paths resolve from the
122
+ agents root's parent; absent a selector it defaults to that deployment scope.
123
+ The CLI does not substitute its ambient Git checkout. A configured workspace
124
+ can discover and spawn declared package agents before it has an `agents/` or
125
+ `local-agents/` directory. Laptop config alone does not declare a deployment.
126
+ - `<home>/work` is a new, owned directory, not a symlink and not a fake Git
127
+ repository. The kernel creates no branch, copies no source tree, and does not
128
+ require Git in a non-Git deployment. Git-owned deployment placement still
129
+ requires readable Git metadata to establish the canonical home location.
130
+ - `--work-dir` / `workDir` and `--branch` / `branch` are contradictory and
131
+ rejected with `E_BAD_ARGS`, even if empty or inherited from a caller bug.
132
+ Directory execution never takes ownership of a caller-selected filesystem
133
+ path. Existing modes retain their Git/context requirements and semantics;
134
+ failed Git operations never implicitly fall back to directory execution.
135
+ - Canonical `AGENTS.md` / `CLAUDE.md`, skill composition, provider trust,
136
+ lifecycle hooks, frozen launch recipes, runtime preflight and no-launch
137
+ metadata are unchanged. Hooks receive `OATS_WORK=directory`, an empty
138
+ `OATS_BRANCH`, and the context in `OATS_REPO` / `OATS_CONTEXT` at spawn.
139
+ Worktree-only setup scripts are not run in this mode.
140
+ - Retirement authenticates directory ownership against the independent spawn
141
+ baseline. Nonempty execution work is preserved in verified recovery custody
142
+ (`workRecovery.path/work`, with home bytes under `home/`) before removal;
143
+ post-hook changes produce another verified snapshot. No work is designated
144
+ disposable in this initial mode, including hook-created work. Symlinks inside
145
+ work are copied as links, never followed; an exchanged work-root symlink,
146
+ unsupported filesystem entry, or unverifiable copy fails closed. Recovery is
147
+ not provider delivery or publication, and retains the existing single-host,
148
+ quiesced-runtime safety model rather than a hostile-filesystem atomicity claim.
149
+
150
+ ### Lifecycle and scheduled-command context
151
+
152
+ Lifecycle hooks receive `OATS_CLI_BIN` as the real, absolute `bin/oats.mjs`
153
+ path belonging to the **running kernel**. This is authored by
154
+ `runLifecycleHooks` itself, including direct core callers; neither ambient
155
+ `OATS_CLI_BIN` nor a caller's `extraEnv.OATS_CLI_BIN` can override it. Spawn
156
+ hooks also receive the known agents root as `OATS_ROOT`, rather than an empty
157
+ value or the ambient caller's root.
158
+
159
+ Scheduled command execution starts without the invoking instance's identity:
160
+ `OATS_INSTANCE`, `OATS_INSTANCE_HOME`, legacy `OATS_HOME`, the `PI_AGENT_*`
161
+ aliases and `PI_AGENTS_ROOT`, plus kernel-authored soul, root, context, work,
162
+ team, capability, operation, settings and lifecycle metadata are removed.
163
+ The command's explicit cwd and selectors (for example `--soul`) determine
164
+ its dispatch; a scheduler invoked from another home must not select that
165
+ home's frozen capabilities/settings. Host configuration (`HOME`,
166
+ `OATS_HOME_DIR`, package catalog configuration) and ordinary credentials are
167
+ preserved. No job schema or knowledge-provider policy is implied by this
168
+ isolation.
169
+
170
+ ### Native record capture result
171
+
172
+ `oats capture --home <dir>` (also `turn-record capture --home <dir>` and the
173
+ standalone `capture.mjs`) answers **native JSON**, not a Desktop schema-v1
174
+ `{ok,result}` envelope. Do not add `--json`: `--home` already selects JSON.
175
+ Diagnostics go to stderr, including lock contention without `--quiet`.
176
+ Existing home/owner/appended/session boundary fields remain; the outcome adds:
177
+
178
+ - `status`: `complete`, `skipped`, `held`, `incomplete`, or `failed` (failure
179
+ takes priority, then skip/held/incomplete).
180
+ - `complete`: true only for a performed pass with no holds, incomplete source
181
+ records, unattributed candidates or reported errors.
182
+ An unchanged performed pass may be complete with `appended: 0`.
183
+ - `skipped`: true when another pass owns the capture lock. `lock` then carries
184
+ holder/liveness/recovery details; no capture or indexing was performed.
185
+ - `held`: count of sessions the underlying pass held pending a timestamp.
186
+ - `incomplete`: count of source files with pending torn, oversized, invalid
187
+ UTF-8 or otherwise incomplete records; later complete input can recover.
188
+ - `issues`: optional metadata-only diagnostics identifying source paths and
189
+ reasons; no record bodies are embedded. `unattributed` candidates also make
190
+ the pass incomplete rather than silently certifying missing source evidence.
191
+ - `failed`: zero on success, nonzero for a capture/read/index/lock-release
192
+ failure; `error` describes the failure. `appended: null` on a thrown failure
193
+ means the number appended before the failure is unknown, not zero.
194
+ - `ignored`: count excluded by configured privacy rules, distinct from a
195
+ whole-pass skip. Home capture pins exactly attributed source files; sharing
196
+ a Codex day directory does not authorize capturing unrelated records.
197
+
198
+ Lock skips, held sessions and incomplete input retain exit status 0 (background reconciliation
199
+ must stay nonfatal on contention); errors and failed lock release exit 1.
200
+ Previously captured visible boundaries may still be returned on a skipped or
201
+ held pass. They are **not** evidence that final capture ran. Consumers requiring
202
+ a final pass must check `complete === true`, not exit status or the presence of
203
+ boundaries alone; older results lacking that field cannot certify a pass.
204
+
205
+ **Snapshot boundary:** completion describes a performed pass over the exact
206
+ attributed source files, not a promise about future appends. Discovery carries
207
+ an open-descriptor-derived identity and content witness through capture-lock
208
+ acquisition. Capture stages bytes from one descriptor and validates that witness
209
+ and source stability **before appending**: replacement, truncation and prefix
210
+ rewrites fail without appending the replacement's bytes. Same-inode append
211
+ growth is allowed only when the witnessed prefix is unchanged. Discovery/read
212
+ failures and files disappearing during the pass fail closed; pending trailing
213
+ records and unattributed candidates cannot certify completion. A retirement
214
+ consumer must first quiesce its writers and then preserve the captured evidence
215
+ under its own durable-input protocol. `complete:true` alone does not mean a
216
+ harvest was delivered or that a consumer stored those inputs. Configured privacy
217
+ exclusions remain exclusions, not an invitation to copy excluded source bytes.
218
+
219
+ **Native roots:** managed `--home` capture uses independent execution history,
220
+ not the observer's environment or the latest relaunch recipe. New scaffolds
221
+ initialize `<instances>/.oats-native-record/<sha256(canonical-home)>/history.json`.
222
+ Each managed spawn/start/restart writes a separate pending receipt before
223
+ backend dispatch. Inside the backend shell, under the exact environment prefix
224
+ and cwd that will exec the harness, the native recorder atomically replaces
225
+ that receipt with the effective absolute **record locations** and runtime. Only
226
+ these allowlisted locations, home, start id/time and custody state are saved;
227
+ no environment map, credential reference value, task or argv is persisted.
228
+ The saved `instance.json` command/recipe remains a relaunch **template**, not
229
+ execution evidence: use `oats session start`, not a manual shell replay of it.
230
+
231
+ Location rules at execution are `CLAUDE_CONFIG_DIR/projects` (default exactly
232
+ `$HOME/.claude/projects`), `PI_CODING_AGENT_DIR/sessions` (default
233
+ `$HOME/.pi/agent/sessions`), and `CODEX_HOME/sessions` (default
234
+ `$HOME/.codex/sessions`). Pi's `--session-dir` wins over
235
+ `PI_CODING_AGENT_SESSION_DIR`, which wins over its agent-dir location; Pi tilde
236
+ paths expand against the effective HOME. Relative paths resolve from the source
237
+ home. Existing symlinks resolve at recording time, including existing ancestors
238
+ of not-yet-created roots. Inherited overrides and resolved `fromEnv` location
239
+ inputs are thereby retained **after backend shell startup**, independently of
240
+ later observer/config/reference changes. The recorder runs before the native
241
+ exec; unsupported explicit Pi `--session` or a receipt write failure refuses
242
+ that exec and leaves pending custody, rather than claiming a default root.
243
+ Wrappers must preserve this native storage contract: arbitrary scripts which
244
+ change storage internally cannot be inferred from their executable name.
245
+
246
+ History is never replaced by a newer runtime selection, truncated with the
247
+ bounded restart log, or deleted with the source home. Capture unions all
248
+ historically recorded locations for each runtime and still attributes every
249
+ file by its own cwd. Missing/unreadable historical roots, unreadable/invalid
250
+ receipts, and pending/unfinished launches fail closed. A newly scaffolded home
251
+ with no managed launches has an authoritative empty managed-launch inventory.
252
+ A legacy home without that scaffold authority cannot acquire proof of its
253
+ **earlier** roots merely by restarting: later starts retain new locations but
254
+ its history remains incomplete. Do not remove pending/history receipts just
255
+ to get a green capture; recovery requires establishing the source inventory.
256
+
257
+ Standalone fixtures and explicit legacy inventories can opt into
258
+ `capture --home <dir> --current-roots` (`sourceRoots: "current-env"` in JSON),
259
+ or use `sessionsForHome(home, {roots: {cc: [...], pi: [...], codex: [...]}})`.
260
+ Explicit API roots exclude unspecified formats, and every supplied root must
261
+ exist. The CLI fallback uses current environment plus recorded hook/config
262
+ location overrides; `fromEnv` resolves from that **current** base environment.
263
+ Its `complete:true` certifies only that chosen observer-time inventory, **not**
264
+ all historical roots; do not enable it implicitly for final-capture consumers.
265
+ Normal managed reports say `sourceRoots: "launch-history"`. Background capture
266
+ without `--home` retains observer-time discovery (including `.claude*` profiles)
267
+ and optional absent native defaults. Neither fallback introduces knowledge
268
+ policy into the kernel.
269
+
270
+ **Claude children:** discovery also enumerates the native
271
+ `<project>/<sessionId>/subagents/*.jsonl` layout, including children whose parent
272
+ transcript is absent. Each child requires its own cwd attribution; neither its
273
+ parent's cwd nor its directory supplies missing attribution. Child streams use
274
+ `cc.<sessionId>.<child-file-stem>` (threads
275
+ `cc:session:<sessionId>.<child-file-stem>`) so identical child filenames under
276
+ different sessions cannot collide. Complete native lines are preserved verbatim;
277
+ torn, unstamped or unattributed child evidence blocks certification, and child
278
+ read/discovery failures fail the pass. Ignore rules run before child opens and
279
+ can match its path, filename, qualified id, native child id or parent session id.
280
+
281
+ **Piped recall:** native `oats recall` JSON responses drain stdout before process
282
+ termination, including large thread windows and individual `--show` records.
283
+ Consumers must still bound their own reads/buffers (use `--ids-only` for sizing);
284
+ a successful producer does not imply an unbounded consumer buffer.
285
+
112
286
  ### Consumer fixture
113
287
 
114
288
  The engine ships a consumer fixture driving the full oats.okf pattern
@@ -20,6 +20,14 @@ prints exactly one JSON object on stdout:
20
20
  `version` is the installed package's exact semver (e.g. `0.20.0`).
21
21
  Desktop 0.22 accepts `desktopApi === 1` and semver `>=0.22.0 <0.23.0`.
22
22
 
23
+ Optional features are negotiated from the probe's `features` array. Starting
24
+ an existing home requires `session-start`; named launch configurations and
25
+ runtime/permission overrides require `launch-config`; restarting a running
26
+ home also requires `session-restart`. Desktop checks the corresponding
27
+ `remote` entries before offering these operations for a server. The router
28
+ then probes the execution host before sending a mutation. An absent feature
29
+ means an update is needed; it is not inferred from the version number.
30
+
23
31
  The band is widened one kernel minor at a time, after confirming this v1
24
32
  surface is unchanged, and always admits the kernel published by the same
25
33
  release — Desktop and the CLI are built from one tag, so a band excluding its
@@ -36,7 +44,65 @@ no progress prose (progress goes to stderr):
36
44
 
37
45
  ## Mutations exposed to Desktop v1
38
46
 
39
- Only two:
47
+ The commands below use the same envelope. Additional capability operations
48
+ are described in [the operations contract](design/operations-contract.md).
49
+
50
+ ### Existing-home launch and restart
51
+
52
+ ```text
53
+ oats session start --home /absolute/home [--server id] \
54
+ [--launch-config name] [--runtime pi|claude|codex] \
55
+ [--model id] [--yolo|--no-yolo] --json
56
+ oats session restart --home /absolute/home [the same options] --json
57
+ ```
58
+
59
+ Desktop addresses the exact existing home from the selected workspace's
60
+ roster. Restart is one kernel command. The kernel owns configuration
61
+ validation, stop observation, the lifecycle lock, launch recovery and session
62
+ metadata. Desktop does not implement restart by retiring and spawning.
63
+ Failure or timeout requires a fresh status check before retrying: a lost
64
+ response does not establish that launch failed.
65
+
66
+ For a remote home, its saved route supplies the execution host even if its
67
+ registration has subsequently changed. The remote kernel validates the new
68
+ configuration before stopping the current harness. A missing feature fails
69
+ before any stop/start command is sent.
70
+
71
+ ### Launch configurations
72
+
73
+ ```text
74
+ oats launch-config list [--dir /scope | --home /home | --soul name --agents-root /scope/agents] --json
75
+ oats launch-config set name --file /private/definition.json [--keep-env] --dir /scope --json
76
+ oats launch-config remove name --dir /scope --json
77
+ oats launch-config preview (--home /home | --soul name --agents-root /scope/agents --dir /scope) \
78
+ [--launch-config name] [--runtime runtime] [--model id] [--yolo|--no-yolo] --json
79
+ ```
80
+
81
+ All accept `--server id`. Scope edits follow the registration; inspection and
82
+ preview of an existing home follow its saved route. A local definition file
83
+ is serialized to SSH stdin and read on the host with `--file -`; the local
84
+ filename is never passed to the server as though it existed there.
85
+
86
+ The list result supplies `context`, `selected` and `configurations`. Each
87
+ configuration has a name, runtime, executable, literal argument array,
88
+ environment, model, permission choice and declaring `source`. Environment
89
+ literals appear as `{ "redacted": true }`; references appear as
90
+ `{ "fromEnv": "VARIABLE_NAME" }`. Optional executable/model/yolo fields can be
91
+ null. An editor must not write redaction markers back. `--keep-env`, with
92
+ `env` omitted from the replacement definition, copies the effective named
93
+ configuration's environment once into the complete replacement.
94
+
95
+ Preview is read-only and returns a redacted invocation plus `preflight`
96
+ checks. A successful inspection envelope can contain `result.ok: false`:
97
+ the selected launch is not ready. Desktop displays the failed checks rather
98
+ than treating successful inspection as permission to launch. Environment
99
+ references resolve on the execution host at launch, including subsequent
100
+ starts of the saved recipe. Editing a named definition does not change a
101
+ running instance or silently update its frozen launch recipe. Select the
102
+ configuration explicitly on a later start/restart to apply the new definition.
103
+
104
+ See [launch configuration syntax](configuration.md) and
105
+ [the Desktop start/restart workflow](desktop-instance-start.md).
40
106
 
41
107
  ### `oats spawn <agent> … --json`
42
108
 
@@ -47,7 +113,7 @@ Only two:
47
113
  | `instance` | string | new instance name |
48
114
  | `agent` | string | soul/agent name |
49
115
  | `home` | string | absolute instance home path |
50
- | `work` | string | work mode (worktree/checkout/attached/workspace) |
116
+ | `work` | string | work mode (worktree/checkout/attached/workspace/directory) |
51
117
  | `branch` | string \| null | work branch when applicable |
52
118
  | `launched` | boolean | whether a tmux window was started |
53
119
  | `warnings` | string[] | non-fatal warnings (always an array) |
@@ -5,25 +5,61 @@ The Desktop roster is the place to return to it:
5
5
 
6
6
  - A running row opens its terminal.
7
7
  - A stopped row offers **Start…**. Clicking the row opens the same dialog.
8
+ - A running row's action menu offers **Restart with…** to change harness or launch configuration in the same home.
8
9
  - The hierarchy's action popover offers **Start…** for a stopped instance.
9
10
  - An unknown status is shown as unknown, not as permission to launch another process.
10
11
 
11
- The Start dialog names the existing instance, runtime and host. Enter a model
12
- or leave the field blank to retain its recorded choice. Available local model
12
+ The Start/Restart dialog names the existing instance, runtime and host. Choose
13
+ a named launch configuration or keep the recorded launch. Without a selected
14
+ configuration, the harness can also be changed directly. A named configuration
15
+ fixes its harness; model and permission choices can override its defaults.
16
+ Enter a model or leave the field blank to use the selected launch's default.
17
+ An old harness's model is not carried to a different harness. Available local model
13
18
  suggestions are advisory; a model ID can also be typed. Start uses the saved
14
19
  briefing and state in a new harness conversation; it does not resume an old
15
20
  harness conversation ID. After the launch appears in the roster, Desktop
16
21
  opens the instance's terminal.
17
22
 
18
- If the instance is already running when the dialog checks, its action becomes
23
+ If an ordinary Start dialog finds the instance already running, its action becomes
19
24
  **Open terminal**. A failed or timed-out start requires **Refresh status** before
20
25
  another attempt, because the launch may have succeeded before the reply was
21
26
  lost. Changing workspaces dismisses the dialog and prevents a delayed launch
22
27
  reply from opening a terminal in the wrong workspace.
23
28
 
29
+ **Restart with…** is explicit: after validating the new configuration, the
30
+ kernel stops the current harness and starts the selected one. It does not
31
+ retire the instance, rerun identity creation or replace its worktree. A stop
32
+ that cannot be confirmed does not authorize another launch. Save in-progress
33
+ work before restarting; the old harness conversation is not transferred to
34
+ another harness.
35
+
36
+ Restart requests termination and waits for the current process to stop before
37
+ launching its replacement. If stopping times out, it leaves the instance for
38
+ inspection instead of forcing a kill or launching a second harness. OATS
39
+ preserves the home and work; it cannot guarantee that a harness or custom
40
+ wrapper saves all of its in-flight conversation state. Wrappers should
41
+ `exec` the harness or forward termination signals correctly.
42
+
43
+ **Preview invocation** asks the execution host for the resolved command and
44
+ displays it as text, with environment values redacted. It never launches an
45
+ agent. **Manage launch configurations** in the dialog creates or updates named
46
+ configurations at the displayed scope, including executable/wrapper, a JSON
47
+ argument list, environment references, model and permissions. Saving a
48
+ configuration changes its definition; applying it to an existing home requires
49
+ an explicit Start or Restart. When editing redacted environment values, keep
50
+ **Preserve the saved environment** selected or enter a complete replacement.
51
+ Use the server's workspace to manage configurations defined on that server.
52
+
24
53
  Desktop sends `POST /api/start/<instance>?ws=…&home=…` (and `server=…` for a
25
54
  remote instance). The backend resolves that exact roster identity and calls
26
55
  `oats session start --home <absolute-home> [--server <id>] [--model <model>] --json`.
56
+ Launch choices add `--launch-config`, `--runtime` or `--yolo`/`--no-yolo`.
57
+ Restart uses `POST /api/restart/<instance>?ws=…&home=…` and the single kernel
58
+ command `oats session restart` with the same selectors and choices.
59
+ Configuration inspection and editing use `POST /api/launch-configs?ws=…`,
60
+ routed through `oats launch-config list/set/remove/preview`. These features
61
+ require the CLI's `launch-config` and `session-restart` capabilities; old
62
+ clients/hosts receive an update explanation instead of unsupported arguments.
27
63
  The installed CLI must advertise `session-start`; remote starting also needs
28
64
  the remote operation. The execution host checks the actual saved session
29
65
  before launch. Desktop does not scaffold a home or execute a launcher itself.
@@ -148,6 +148,22 @@ and never silently applies a new model to an
148
148
  already-running harness. A never-launched legacy Herdr home without a saved
149
149
  server endpoint requires that endpoint to be configured before it can start;
150
150
  it does not fall back to tmux.
151
+ Directory-mode starts and restarts also authenticate the home and owned work
152
+ root against the independent spawn receipt (mode, canonical home, device/inode
153
+ identities). Checks run before resolving mutable home contents, after **each**
154
+ launch hook/preparation and immediately before backend observations, stops,
155
+ allocations and launch-state writes. A missing/file/symlink/exchanged root or
156
+ mode disagreement fails with `E_WORK_INSPECTION_FAILED`; substituted targets
157
+ are neither followed for launch nor removed for lock cleanup. Restore the
158
+ original owned roots before retrying; pending receipts remain with them.
159
+ These pathname checks are not OS-level exclusion against a concurrent hostile
160
+ filesystem mutation between validation and use.
161
+
162
+ Managed execution also records independent native transcript-location history;
163
+ the recipe remains a template, not provenance. See
164
+ [Native roots](design/package-runtime-api.md)
165
+ for the exact source and standalone-fallback semantics.
166
+
151
167
  The start opens a new harness conversation on the instance's `TASK.md`; the
152
168
  instance resumes its work from its own `STATE.md`, as the knowledge protocol
153
169
  prescribes.
@@ -0,0 +1,98 @@
1
+ # Authoring a knowledge capability
2
+
3
+ This is the canonical source for the optional `oats.knowledge-theory` authoring
4
+ curriculum. Its linked reference documents form a self-contained local set.
5
+ The released skill includes checked copies of this set; authors and the
6
+ `knowledge-theory-expert` can use it without a framework checkout or network.
7
+
8
+ ## Authority and scope
9
+
10
+ OATS offers an opinionated reference knowledge theory. Default OKF follows it;
11
+ other capabilities may adopt, adapt, or replace it. The kernel owns generic
12
+ layer selection, configuration, composition, lifecycle, work-mode boundaries
13
+ and executable trust, not a compulsory memory ontology or universal judge.
14
+
15
+ This guide distills the approved 2026-09-13 knowledge scoping session. The
16
+ reference derivation comes from OATS's knowledge theory; its historical
17
+ references to physical soul bundles are replaced here by external knowledge
18
+ custody. The approved implementation plan settles plain-directory OKF as the
19
+ first non-Git path and keeps Omnigraph an uninvestigated authoring scenario.
20
+ Earlier drafts' open choices are not implementation facts. The curriculum is
21
+ a design/authoring reference, not a claim that all default runtime behavior
22
+ has already shipped. Verify the capability version actually being evaluated.
23
+
24
+ Every implementing capability supplies its full runtime package: reader tools,
25
+ injections, capture conventions, judgment instructions, harvester if any,
26
+ lifecycle/scheduling machinery, validation, delivery and diagnostics. Reuse
27
+ may be explicit and versioned, never a hidden fetch of mutable doctrine.
28
+ The theory expert advises authors; it does not operate their stores or approve
29
+ their compatibility. Installing the theory package activates nothing.
30
+
31
+ ## Install the optional authoring package
32
+
33
+ The kernel's npm package ships this public guide and the CLI, **not** the
34
+ optional expert payload. `oats.knowledge-theory` 1.0.0 is distributed through
35
+ this repository's Git `oats-package/` subtree. Git preserves the canonical
36
+ source `CLAUDE.md -> AGENTS.md` symlink; npm omits symlinks, so a partial npm
37
+ copy is not a supported distribution. Acquisition does not repair source
38
+ aliases or relax installed-artifact integrity checks.
39
+
40
+ Once the immutable framework `v0.23.0` tag is published, select a deployment
41
+ scope explicitly and acquire, then opt in for an author soul:
42
+
43
+ ```bash
44
+ oats install git:github.com/awebai/oats@v0.23.0 --dir /path/to/scope
45
+ oats use oats.knowledge-theory --soul <author-soul> --dir /path/to/scope
46
+ ```
47
+
48
+ Git sources select `oats-package/` by default and lock the resolved commit.
49
+ The official catalog shortcut may follow after the immutable tag exists; do
50
+ not assume an unpublished catalog pin. For local development, use an explicit
51
+ complete source package path instead. Activation exposes the expert and targets
52
+ the authoring skill, without selecting or replacing a knowledge integration.
53
+ There are no executable surfaces to trust in this package. Installed experts
54
+ use their materialized local curriculum, not this repository at runtime.
55
+
56
+ ## A bounded authoring session
57
+
58
+ 1. **Choose a model.** Read the [reference model](knowledge-reference/model.md)
59
+ and [adoption choices](knowledge-reference/adoption.md). Record what the
60
+ author is choosing, not what the kernel supposedly requires.
61
+ 2. **Establish real custody.** Fill the [provider map](knowledge-reference/provider-mapping.md)
62
+ from tool/version evidence. A Git-backed knowledge repository is still Git;
63
+ a directory implementation must work without Git/GitHub. Do not invent
64
+ native graph operations to fill gaps in the table.
65
+ 3. **Author working behavior.** Use the [reader/capture pattern](knowledge-reference/reader-capture.md).
66
+ Keep every-session instructions short; load detailed native operations from
67
+ that capability's own skills.
68
+ 4. **Author deliberate judgment.** Use the [harvester pattern](knowledge-reference/harvester.md)
69
+ if adopting this model. Freeze inputs and destinations before execution,
70
+ separate semantic outcomes from delivery outcomes, and define recovery.
71
+ 5. **Deliver an independently usable package.** Follow [package craft](knowledge-reference/package-craft.md).
72
+ No path in a released soul or skill may depend on an author's checkout.
73
+ 6. **Verify observable outcomes.** Run the relevant [acceptance cases](knowledge-reference/acceptance.md).
74
+ Structural success is not proof that an agent learned or that a store is safe
75
+ under crashes. State the limit of each test.
76
+
77
+ ## Hand-off template
78
+
79
+ - Model: adopt / adapt / alternative; rationale and deliberate departures.
80
+ - Provider and version: verified tools, evidence, unknown guarantees.
81
+ - Responsibility map: who supplies reader, capture, judgment, delivery,
82
+ lifecycle, scheduling and diagnostics; no unowned runtime step.
83
+ - Custody: named destinations, owner identity, accepted state, concurrency,
84
+ retry and reader-refresh semantics. No credentials in the report.
85
+ - Proposed artifacts: capability manifest, local resources, instructions,
86
+ skills, optional agent, hooks/operations and declared trust surface.
87
+ - Verification: tests run, actual receipts/visibility, failures, untested claims
88
+ and the next required approvals. Do not call scaffold-only an agent trial.
89
+
90
+ ## Maintaining these references
91
+
92
+ Edit this file and `docs/knowledge-reference/` in the framework source, then
93
+ run `node scripts/check-knowledge-theory-package.mjs --write` from that checkout.
94
+ Run `node scripts/check-knowledge-theory-package.mjs` and
95
+ `node --test test/knowledge-theory-package.test.mjs` to verify parity and the
96
+ installed artifact. These are maintainer commands, not tools required in an
97
+ installed expert's work tree. The copies belong to a package release; edits to
98
+ repository docs do not change any installed capability at runtime.
@@ -0,0 +1,108 @@
1
+ # Acceptance cases and evidence
2
+
3
+ These are reusable authoring cases for the [reference model](model.md), plus
4
+ generic package isolation checks. They are not compulsory theoretical
5
+ conformance tests for an [alternative model](adoption.md). The default OKF
6
+ workstream must exercise both Git and real non-Git custody; Omnigraph is not a
7
+ required dependency. Record provider/kernel versions and checks actually run.
8
+
9
+ ## Package and policy isolation
10
+
11
+ 1. **Acquire without activating.** Install the enumerated payload in a temporary
12
+ scope. Check exact locks and contained materialized resources. Acquisition
13
+ alone must not select a layer, create memory, schedule work or expose an
14
+ undeclared agent. Apply executable trust only if surfaces require it.
15
+ 2. **Activate deliberately.** Select only the additive authoring capability,
16
+ with knowledge/messaging/tasks explicitly disabled. Discover the packaged
17
+ expert and scaffold without a runtime launch. It gets the authoring skill
18
+ and complete local references, but no OKF bundle, capture flow or harvester.
19
+ 3. **Remove source crutches.** Copy the distribution to a clean source fixture,
20
+ acquire it, delete that source copy, and scaffold the expert. Follow every
21
+ local skill/reference link from the installed/materialized artifact. No
22
+ author checkout, network docs or symlink escaping the capability may be
23
+ required. Compare the installed bytes with the source release curriculum.
24
+ 4. **Respect an alternative.** Activate the authoring aid beside a minimal
25
+ alternative knowledge capability. Scaffold a working agent: the alternative
26
+ retains its own injection and layer; no reference doctrine is forcibly added.
27
+ Remove the authoring activation and verify the alternative still works.
28
+ 5. **Retire the probe.** Inspect the created layout and retire only the fixture
29
+ instance. Packaged soul bytes remain unchanged. Keep fixture HOME, OATS and
30
+ runtime state isolated; no host timer or real launch is allowed, even when
31
+ a no-launch spawn runs capability hooks.
32
+
33
+ Static checks verify manifest shape, symlinks, references and parity. Acquisition,
34
+ composition and retirement tests verify actual kernel behavior. Neither proves
35
+ the expert's reasoning quality or a knowledge store's learning behavior.
36
+
37
+ ## Judgment examples
38
+
39
+ Use exact supplied evidence and inspect the resulting knowledge, not just
40
+ whether an instruction contains “promotion bar.”
41
+
42
+ | Evidence | Expected reference-model judgment |
43
+ |---|---|
44
+ | Current task TODO or branch blocker | Drop from durable knowledge; keep task state as appropriate |
45
+ | File inventory or code paraphrase available in seconds | Drop; no expertise added |
46
+ | Verified non-obvious failure mechanism plus durable remedy | Promote scoped lesson, or merge into existing authoritative concept |
47
+ | Existing claim with confirming evidence | Merge provenance; do not create duplicate authority |
48
+ | Verified new behavior contradicts accepted claim | Supersede explicitly with scope/rationale and provenance |
49
+ | Correction to a reusable runbook | Maintain the existing procedure through its approval path |
50
+ | Unverified single observation | Do not strengthen; retain uncertainty or decline promotion |
51
+ | Secret, credential, or third-party message transcript | Exclude; never promote verbatim |
52
+ | Project decision versus task decision with identical wording | Route by jurisdiction; only the future-binding decision may promote |
53
+ | Project-slow roadmap change | Date and maintain under its responsible owner, not a universal expert |
54
+
55
+ Check both notes and bounded record inputs. Capture everything non-obvious
56
+ without making the source apply the bar; judgment must still be selective.
57
+ Test hostile source text that asks the worker to widen scope or leak secrets:
58
+ only the assigned trusted instructions govern execution.
59
+
60
+ ## Consultation and location
61
+
62
+ - With two bases, the desktop expert consults its own node and the framework
63
+ expert's node selectively before answering. Other configured bases remain
64
+ discoverable; ownership/initial reads are not an ACL. Reading makes no edits.
65
+ - Same leaf names in different bases or repositories remain distinct owners.
66
+ - Missing binding, base or access fails visibly, without an empty substitute.
67
+ A read never scaffolds a node. A feature-branch change never selects custody.
68
+ - Migration preserves old knowledge and pending inputs until verified cutover;
69
+ a changed alias cannot redirect a frozen job to another base.
70
+
71
+ ## Real custody and failure
72
+
73
+ For every applicable row inspect native outputs and receipts, not only exit 0:
74
+
75
+ | Case | Required observable result |
76
+ |---|---|
77
+ | Embedded Git bundle and dedicated Git repository | Independent accepted-baseline work; validated knowledge-only PR to correct target |
78
+ | PR opened, rejected or failed | Report actual proposal/failure state; no claim of accepted visibility or direct-write fallback |
79
+ | PR merged | Fresh reader after refresh can retrieve accepted knowledge; not merely PR text |
80
+ | Directory outside Git | Real durable native update without `.git`, GitHub, branch or PR dependencies |
81
+ | Concurrent destination writers | Baseline conflict/coordination prevents silent loss; receipts identify outcomes |
82
+ | Failure before publication | Preserved input and retryable staged work, no successful applied receipt |
83
+ | Crash after partial/publication write | Recovery establishes actual state; no duplicated claims or lost input |
84
+ | Retry the same input | Idempotent processing or explicit reconciliation; not duplicate knowledge |
85
+ | All candidates dropped | Durable completed-no-change judgment, not an endless pending input |
86
+ | Truncated, skipped or held capture/window | Incomplete/pending, never a completed watermark |
87
+ | Multiple destinations, one failed | Per-destination truthful results, no fabricated cross-store atomicity |
88
+
89
+ ## Source-independent learning gate
90
+
91
+ 1. Let source instance A encounter a genuinely new, verified, behavior-changing
92
+ fact or decision absent from the accepted base. Capture notes and/or records.
93
+ 2. Preserve bounded evidence and frozen destinations outside A's home/worktree.
94
+ Remove A through safe retirement before the independent harvest finishes.
95
+ 3. Reuse A's display name for a distinct incarnation. Verify A's pending evidence
96
+ stays attributed to A, not consumed by the new incarnation's job.
97
+ 4. Run the independent harvest and inspect its semantic judgment and native
98
+ delivery result. For Git, merge through the authorized review process; for
99
+ non-Git, verify durable application and consistency/freshness semantics.
100
+ 5. Launch fresh reader B in the selected real runtime with no A home, transcript
101
+ or hidden conversation context. Ask a task whose answer needs the new fact.
102
+ Require an answer traceable to accepted knowledge through native retrieval.
103
+ 6. Record the evidence, failures and limits. A scaffold-only expert probe or an
104
+ agent reading the captured input directly does not satisfy this gate.
105
+
106
+ Live agent trials require separate authorization and an isolated test deployment.
107
+ This curriculum's package tests deliberately never launch a runtime or install
108
+ host timers; maintainers must not report them as successful learning trials.
@@ -0,0 +1,61 @@
1
+ # Adoption, adaptation and alternative theories
2
+
3
+ The [reference model](model.md) is OATS's recommendation, not mandatory kernel
4
+ policy. Choosing another model is a supported architectural choice.
5
+
6
+ | Choice | Author's obligation |
7
+ |---|---|
8
+ | Adopt | Implement and test the reference distinctions using the provider's real native tools |
9
+ | Adapt | Name which distinctions change, why, and what readers/writers can now rely on |
10
+ | Alternative | Describe the replacement model, its own learning/retention/consistency contract and tests |
11
+
12
+ A graph store can adopt the reference promotion bar without Markdown, YAML,
13
+ `index.md`, branches or a universal harvester API. A capability using continuous
14
+ retrieval without a separate judge might instead choose an alternative model.
15
+ Neither storage choice decides theory. Alternative capabilities still honor
16
+ framework work-mode, package containment, explicit configuration and executable
17
+ trust rules, plus applicable repository governance and credential safety.
18
+
19
+ ## Responsibility boundary
20
+
21
+ OATS maintains canonical theory and authoring references, plus an optional
22
+ expert. The selected capability supplies *all* runtime behavior: complete
23
+ injections, skills, memory conventions, retrieval, capture, judgment if any,
24
+ lifecycle effects, scheduling, native persistence, validation and diagnostics.
25
+ There is no invisible shared theory layer underneath it. It must be usable
26
+ without the expert running or reference documentation fetched over the network.
27
+
28
+ The default-theory rework chooses external bases/nodes, instructional
29
+ read/capture-only workers, independent harvesting, PR-only Git delivery and
30
+ real non-Git custody. These are adoption choices, not new mandatory kernel
31
+ fields. OKF-specific files, schemas and validator calls stay in OKF. A
32
+ capability choosing another approach is not rejected for failing an OKF or
33
+ reference-doctrine test that does not apply to it.
34
+
35
+ ## Record the choice
36
+
37
+ Write a short decision before implementing:
38
+
39
+ - Which model and whose future behavior it serves.
40
+ - What is memory, knowledge, evidence and accepted state in that model.
41
+ - Which reference distinctions are retained, changed or absent, and why.
42
+ - Who owns runtime instructions and changes to them.
43
+ - Native storage guarantees, known limitations and observable failure states.
44
+ - Behavioral tests for the chosen model plus generic package/lifecycle tests.
45
+
46
+ Do not label a broken implementation as a deliberate alternative after a test
47
+ fails. Conversely, do not force a genuine alternative to mimic files, PRs or a
48
+ judge it never promised. Evaluate the contract the author actually chose.
49
+
50
+ ## Switching an existing deployment
51
+
52
+ Installing this authoring package performs no migration and selects no layer.
53
+ A storage or model change in an existing deployment is a separate explicit
54
+ migration: inventory source knowledge and pending evidence, preserve both,
55
+ verify the destination, define translation and exclusions, validate reader
56
+ behavior, then cut over with an observable result. Do not silently discard an
57
+ old soul bundle, let alias edits redirect pending evidence, or initialize an
58
+ empty substitute because a required base cannot be found.
59
+
60
+ For generic packaging and activation isolation see [package craft](package-craft.md).
61
+ For the reference-model migration and isolation tests see [acceptance](acceptance.md).