@awebai/oats 0.28.0 → 0.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/bin/oats.mjs +298 -107
  2. package/capabilities/oats-okf/bin/oats-okf.mjs +28 -8
  3. package/capabilities/oats-okf/injects/okf.md +33 -33
  4. package/capabilities/oats-okf/lib/binding-wire.mjs +4 -1
  5. package/capabilities/oats-okf/lib/config.mjs +2 -1
  6. package/capabilities/oats-okf/lib/consult.mjs +1 -5
  7. package/capabilities/oats-okf/lib/harvest-status.mjs +88 -0
  8. package/capabilities/oats-okf/lib/harvest-switch.mjs +81 -0
  9. package/capabilities/oats-okf/lib/okf-validate.mjs +123 -0
  10. package/capabilities/oats-okf/lib/sources.mjs +28 -3
  11. package/capabilities/oats-okf/lib/stores.mjs +9 -4
  12. package/capabilities/oats-okf/lib/worker.mjs +82 -8
  13. package/capabilities/oats-okf/oats.json +14 -8
  14. package/capabilities/oats-okf/skills/okf-consultation/SKILL.md +8 -6
  15. package/capabilities/oats-okf/skills/okf-consultation/references/consult.md +1 -1
  16. package/capabilities/oats-okf/skills/okf-instance-knowledge/SKILL.md +104 -0
  17. package/capabilities/oats-okf-harvest/bin/okf-harvest.mjs +140 -0
  18. package/capabilities/oats-okf-harvest/injects/harvester.md +12 -0
  19. package/capabilities/oats-okf-harvest/oats.json +26 -0
  20. package/capabilities/oats-okf-harvest/skills/knowledge-harvest/SKILL.md +168 -0
  21. package/capabilities/oats-okf-harvest/skills/knowledge-theory/SKILL.md +192 -0
  22. package/capabilities/{oats-okf/skills/okf → oats-okf-harvest/skills/okf-authoring}/SKILL.md +15 -30
  23. package/capabilities/oats-okf-maintenance/bin/okf-maintenance.mjs +149 -0
  24. package/capabilities/oats-okf-maintenance/injects/maintainer.md +12 -0
  25. package/capabilities/oats-okf-maintenance/lib/provenance.mjs +45 -0
  26. package/capabilities/oats-okf-maintenance/oats.json +21 -0
  27. package/capabilities/oats-okf-maintenance/skills/knowledge-review/SKILL.md +144 -0
  28. package/capabilities/oats-okf-maintenance/skills/knowledge-theory/SKILL.md +192 -0
  29. package/capabilities/oats-okf-maintenance/skills/okf-authoring/SKILL.md +151 -0
  30. package/capabilities/oats-okf-maintenance/skills/okf-authoring/scripts/okf-validate.mjs +123 -0
  31. package/capabilities/oats-okf-maintenance/skills/okf-trigger-setup/SKILL.md +146 -0
  32. package/capabilities/oats-review/injects/review.md +3 -2
  33. package/capabilities/oats-review/oats.json +3 -4
  34. package/docs/capabilities.md +41 -9
  35. package/docs/capability-manifest.schema.json +0 -7
  36. package/docs/desktop-cli-api.md +277 -15
  37. package/docs/implementation.md +1 -1
  38. package/docs/knowledge-capability-authoring.md +8 -2
  39. package/docs/knowledge-reference/package-craft.md +8 -5
  40. package/docs/knowledge.md +101 -0
  41. package/docs/oats-local.schema.json +31 -1
  42. package/docs/official-catalog.md +7 -4
  43. package/docs/packages.md +11 -5
  44. package/docs/release-lane.md +1 -1
  45. package/docs/release-notes/v0.29.0.md +240 -0
  46. package/docs/release-notes/v0.29.1.md +79 -0
  47. package/docs/schedules.md +133 -5
  48. package/docs/souls-and-instances.md +4 -6
  49. package/docs/workspaces.md +11 -2
  50. package/lib/automations.mjs +369 -0
  51. package/lib/core.mjs +65 -154
  52. package/lib/instance-git.mjs +30 -1
  53. package/lib/instance-inspect.mjs +12 -4
  54. package/lib/instance-resolution.mjs +31 -182
  55. package/lib/materialize.mjs +5 -7
  56. package/lib/operator-dispatch.mjs +1 -2
  57. package/lib/packages.mjs +17 -0
  58. package/lib/remote.mjs +21 -1
  59. package/lib/resolve.mjs +51 -7
  60. package/lib/schedule.mjs +211 -41
  61. package/lib/triggers.mjs +182 -49
  62. package/lib/workspace.mjs +1 -1
  63. package/package-catalog.json +6 -4
  64. package/package.json +1 -1
  65. package/capabilities/oats-okf/agents/memory-harvest/AGENTS.md +0 -26
  66. package/capabilities/oats-okf/agents/memory-harvest/soul.yaml +0 -5
  67. package/capabilities/oats-okf/skills/memory-harvest/SKILL.md +0 -285
  68. package/capabilities/oats-review/agents/reviewer/AGENTS.md +0 -53
  69. package/capabilities/oats-review/agents/reviewer/soul.yaml +0 -6
  70. /package/capabilities/{oats-okf/skills/okf → oats-okf-harvest/skills/okf-authoring}/scripts/okf-validate.mjs +0 -0
@@ -0,0 +1,146 @@
1
+ ---
2
+ name: okf-trigger-setup
3
+ description: >-
4
+ Set up and verify the OKF harvest-review trigger, which spawns a knowledge
5
+ maintainer for each harvest PR: declare it as a workspace automation
6
+ (`oats-triggers/okf-harvest-review.yaml` in a member repo, `from:
7
+ oats.okf:harvest-review`, with `runsOn` naming the one host and `owner` the
8
+ GitHub account that can merge on the knowledge-base repo), or locally with
9
+ `oats trigger add` for a machine-private setup. Covers the okf team, the
10
+ self-approval limit and `oats trigger test`. Use when setting up knowledge
11
+ operations, when harvest PRs are not being reviewed, when moving the
12
+ reviewer to another host, or when asked whether a host may run the
13
+ maintainer.
14
+ ---
15
+
16
+ # Setting up the harvest-review trigger
17
+
18
+ The trigger makes a harvest PR get reviewed: when a PR labelled `okf-harvest`
19
+ opens on the knowledge-base (KB) repository, the host tick spawns a new
20
+ `oats.okf/knowledge-maintainer` in the `okf` team to review it. It runs on one
21
+ machine, acting as one GitHub account, and that account must be able to
22
+ **merge** on the KB repository.
23
+
24
+ ## 1. Choose the host and the account
25
+
26
+ - **The account (`owner`)** must be able to merge on the KB repository (push,
27
+ maintain or admin). Check from the host:
28
+ `gh api repos/<owner>/<repo> --jq .permissions`.
29
+ - **The host (`runsOn`)** is the one machine that runs the trigger, named by
30
+ its `oats-local.yaml` `host: { name: <slug> }`, and logged in with `gh` as
31
+ that account.
32
+ - **The harvest switch is independent**: a review host need not harvest (its
33
+ `harvest` setting can stay `off`), and a harvesting host need not review.
34
+
35
+ ## 2. The self-approval limit
36
+
37
+ GitHub forbids approving your own account's PR. If the harvester's host and
38
+ the reviewer's account are the same GitHub account, then either:
39
+ - the KB repository's `main` must not require approving reviews (merge
40
+ permission is enough; the maintainer records its verdict as a PR comment,
41
+ not an approval), or
42
+ - the trigger's `owner` is a separate reviewer account or machine user.
43
+
44
+ Say which one applies when you report the setup.
45
+
46
+ ## 3. The okf team
47
+
48
+ The package souls carry `team: okf`. The workspace must declare it, with its
49
+ messaging mapping. Messaging is aweb (`oats.aweb`, the workspace default);
50
+ it needs oats.aweb 1.15.0 or later, which honours the `join=okf` the
51
+ harvester spawn and the trigger's `teams: [okf]` pass:
52
+
53
+ ```yaml
54
+ # oats-workspace.yaml
55
+ teams:
56
+ okf: { description: Knowledge operations }
57
+ defaults:
58
+ messaging: { oats.aweb: { from: package } }
59
+ messaging:
60
+ byTeam:
61
+ okf: { team: aweb:<your-org>.okf }
62
+ ```
63
+
64
+ Another messaging provider works the same way if it honours `join`.
65
+
66
+ Without it, the souls list with `E_TEAM_UNKNOWN`, and the harvester and the
67
+ maintainer cannot message each other.
68
+
69
+ ## 4. Declare it in the workspace (the default)
70
+
71
+ A team relies on the review, so declare it in Git, in a member repository (the
72
+ workspace's host repo), in its `oats-triggers/` folder:
73
+
74
+ ```yaml
75
+ # <member>/oats-triggers/okf-harvest-review.yaml
76
+ kind: oats-trigger
77
+ schemaVersion: 1
78
+ description: Review every OKF harvest PR on the knowledge base
79
+ from: oats.okf:harvest-review
80
+ set: { repo: github.com/<owner>/<kb-repo> } # optional: base, harness, model
81
+ runsOn: <host.name of the one machine>
82
+ owner: github.com/<the merge-capable account>
83
+ ```
84
+
85
+ - `kind: oats-trigger` and `schemaVersion: 1` make the file self-describing; a
86
+ wrong kind is `E_AUTOMATION_SCHEMA`.
87
+ - The id is `id:` if present, else the filename stem (`okf-harvest-review`).
88
+ Two files with the same id in one member are `E_AUTOMATION_DUPLICATE`.
89
+ - A file named `*.oats-trigger.yaml` anywhere in the member works too (never
90
+ under `oats-package/`, `.git/` or `node_modules/`); `oats-triggers/` is the
91
+ canonical place.
92
+
93
+ Or let the CLI write it: `oats trigger add --from oats.okf:harvest-review
94
+ --set repo=github.com/<owner>/<kb-repo> --workspace <member>` (it prints the
95
+ file when that repository is not the current checkout). Commit and merge it
96
+ like any other change.
97
+
98
+ A host runs it only when **both** its `host.name` equals `runsOn` **and** its
99
+ `gh` account equals `owner`. Everywhere else it is listed with the reason:
100
+ `assigned-elsewhere`, `owner-mismatch` or `host-unnamed`. That keeps exactly
101
+ one machine on it, and the operator's consent explicit. A host can opt out
102
+ without a commit: `automations.disabled: [<member>/okf-harvest-review]` in its
103
+ `oats-local.yaml`. Changes reach the host within about ten minutes (after
104
+ `oats sync`, or the tick's refresh).
105
+
106
+ ## 5. Or add it locally (machine-private)
107
+
108
+ For a personal or experimental setup, add it to this deployment only. It runs
109
+ on this host with this host's `gh`, with no `runsOn` or `owner`:
110
+
111
+ ```sh
112
+ oats trigger add --from oats.okf:harvest-review --set repo=github.com/<owner>/<kb-repo>
113
+ # optional: --set base=main --set harness=claude --set model=opus --id okf-harvest-review
114
+ ```
115
+
116
+ Never run the same review from two places: one workspace declaration, or one
117
+ local trigger on one host.
118
+
119
+ ## 6. Test it on the host that runs it
120
+
121
+ ```sh
122
+ oats trigger test <member>/okf-harvest-review # or: oats trigger test okf-harvest-review (local)
123
+ oats schedule host install # the host timer, if the test says it is missing
124
+ oats trigger status
125
+ ```
126
+
127
+ - `oats trigger test` checks gh auth and where its credential comes from, the
128
+ repository and your merge permissions, the soul, its messaging capability,
129
+ the okf team, the host/owner match, and what would fire now. It spawns
130
+ nothing. It must pass before you report the setup done; fix what it names.
131
+ - **Credentials reach the tick through the host timer, not your shell.** A
132
+ `GH_TOKEN` exported in your shell does not reach it; `gh auth login` with the
133
+ keyring or config file does.
134
+ - Pause with `oats trigger disable <id>`; `remove` leaves running maintainers
135
+ alone.
136
+
137
+ ## 7. Labels
138
+
139
+ Harvest PRs carry `okf-harvest` (the harvester's completion creates the label
140
+ if the repository lacks it). The maintainer adds `okf-needs-human` when a PR
141
+ would supersede a human-accepted decision. To pre-create both:
142
+
143
+ ```sh
144
+ gh label create okf-harvest --repo <owner>/<repo> --force --color 0E8A16 --description "OKF harvest PR (oats.okf)"
145
+ gh label create okf-needs-human --repo <owner>/<repo> --force --color D93F0B --description "OKF: needs a human decision"
146
+ ```
@@ -11,8 +11,9 @@ oats spawn reviewer --work attached --work-dir "$PWD/work" \
11
11
  --task "Review commit <sha> on branch <branch>. Report to <your-instance> per your operating loop."
12
12
  ```
13
13
 
14
- - `--purpose "<short-sha>"` gives the reviewer a unique, commit-relevant
15
- instance name (`reviewer-<short-sha>`); attached mode shares your work tree
14
+ - `reviewer` is the oats.dev package's soul (`oats.dev/reviewer`).
15
+ `--purpose "<short-sha>"` gives it a unique, commit-relevant instance name
16
+ (`oats-dev-reviewer-<short-sha>`); attached mode shares your work tree
16
17
  and automatically makes the reviewer your child (attached agents are always
17
18
  children of the work-tree owner — no relation flags needed or allowed).
18
19
  - The reviewer reviews **that commit's diff only** and reports its verdict
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "capability": "oats.review",
3
3
  "private": true,
4
- "version": "1.2.1",
5
- "compatibility": { "oats": ">=0.26.0" },
6
- "description": "Post-commit review discipline: a fresh reviewer agent (defined by this capability) reviews each new commit's diff, reports its verdict to its spawner over the deployment's messaging layer (or in its transcript when there is none), and retires — plus the shared developer delivery discipline.",
4
+ "version": "1.3.0",
5
+ "compatibility": { "oats": ">=0.28.0" },
6
+ "description": "Post-commit review discipline: a fresh reviewer (this package's soul `reviewer`) reviews each new commit's diff, reports its verdict to its spawner over the deployment's messaging layer (or in its transcript when there is none), and retires — plus the shared developer delivery discipline and the reviewer's code-review and security-review skills.",
7
7
  "requires": [],
8
- "agents": ["agents/reviewer"],
9
8
  "skills": ["skills/code-review", "skills/security-review"],
10
9
  "inject": "injects/review.md"
11
10
  }
@@ -72,7 +72,7 @@ A self-contained package has an `oats.json`:
72
72
  - `compatibility.oats` is the kernel range the capability runs on. The kernel
73
73
  refuses to compose a capability whose range does not admit it
74
74
  (`E_CAPABILITY_INCOMPATIBLE`, naming capability, range and kernel) wherever a
75
- soul or capability agent resolves (spawn, `spawn --preview`, `inspect
75
+ soul resolves (spawn, `spawn --preview`, `inspect
76
76
  --soul`, operator commands). `oats inspect` shows each module's
77
77
  `compatibility: { ok, range, kernel }`; a home whose spawned module no longer
78
78
  admits the running kernel reports a `capability-incompatible` problem.
@@ -302,6 +302,19 @@ workspace's decision to trust it. A soul names a package capability with
302
302
  packages is in [packages.md](packages.md). There is no installed
303
303
  copy at a deployment and no `oats install`/`trust`/`update`/`remove`.
304
304
 
305
+ One package can carry capabilities meant for **different souls**. oats.okf
306
+ 4.0.0 ships three:
307
+
308
+ - `oats.okf` fills every working soul's knowledge slot;
309
+ - `oats.okf-harvest` is composed only into its harvester soul;
310
+ - `oats.okf-maintenance` is composed only into its maintainer soul.
311
+
312
+ Each is its own manifest with its own skills, inject and commands. One pin
313
+ versions all three, together with the package's souls
314
+ ([knowledge.md](knowledge.md#who-gets-which-okf-skills)). Split a package this
315
+ way when roles need different instructions: a soul composes only the
316
+ capability it names, so no role carries another's procedure.
317
+
305
318
  ## Member capabilities
306
319
 
307
320
  A capability at `<member repo>/capabilities/<name>/oats.json` is discoverable
@@ -314,13 +327,24 @@ listed (`private: true`, marked "(repo-owned)"), but usable only from its own
314
327
  repo (`E_CAPABILITY_PRIVATE` elsewhere). A member's `oats-package/` is **not** a member capability: it is
315
328
  reported as `publishes` and consumed only as a package.
316
329
 
317
- ## Capability-defined agents
330
+ ## Agents a capability needs
331
+
332
+ A capability declares no agents: `agents:` in a manifest was **removed in
333
+ 0.29.0**. Resolution refuses a module that still declares it with
334
+ `E_CAPABILITY_AGENTS_REMOVED { capability, agents }` (spawn, `spawn --preview`,
335
+ `inspect --soul`, operator commands). Ship the agent as a soul instead:
336
+
337
+ - a **package soul**: `souls/<name>/` beside the package's capabilities, listed
338
+ in `oats-package.json` `souls:`, spawned as `oats spawn <package>/<name>`
339
+ (or the bare name when unique), reading the package's capabilities with
340
+ `from: here` ([packages.md](packages.md#package-souls)). The post-commit
341
+ `reviewer` is one: oats.dev 1.1.0's `oats.dev/reviewer`, beside `oats.review`;
342
+ - or a **member soul**: `souls/<name>/` in a member repository, using a
343
+ member capability `from: here`.
318
344
 
319
- A manifest may declare `agents: ["agents/<name>"]` — package-relative soul
320
- directories (`soul.yaml` + `AGENTS.md` directly inside). *(Open thread: under
321
- the workspace model these are re-based on member souls — a package repo's
322
- expert soul is an ordinary `souls/<name>-expert/` in the member; the classic
323
- lookup still exists for 0.24 layouts.)*
345
+ A home an earlier kernel spawned from a manifest `agents:` soul (its agent
346
+ directory holds only `instances/`) is still listed by `oats status`, may anchor
347
+ a `--parent`, and retires; nothing creates one any more.
324
348
 
325
349
  ## Commands and hooks
326
350
 
@@ -335,7 +359,14 @@ existing manifests load, and change nothing.
335
359
 
336
360
  Hooks receive `OATS_EVENT`, `OATS_CAPABILITY`, `OATS_LAYER`, `OATS_INSTANCE`,
337
361
  `OATS_HOME`, `OATS_AGENT`, `OATS_SOUL`, `OATS_CONTEXT`, `OATS_WORKSPACE`,
338
- `OATS_ROOT`, `OATS_LEVEL`, `OATS_SETTINGS`, and `OATS_META`. A final JSON line may
362
+ `OATS_ROOT`, `OATS_LEVEL`, `OATS_SETTINGS`, `OATS_SETTINGS_ORIGINS`, and
363
+ `OATS_META`. `OATS_SETTINGS_ORIGINS` (0.29.0) says where each leaf of
364
+ `OATS_SETTINGS` came from: a JSON object from a JSON pointer to `{ kind, at }`,
365
+ `kind` being `manifest-default`, `workspace`, `soul`, `host`, `spawn` or
366
+ `anchor` (the last layer that set it), e.g.
367
+ `{"/harvest":{"kind":"soul","at":"soul.yaml#/knowledge"}}`. A provider tells a
368
+ soul-set value from a host-set one there, and never reads `soul.yaml` for it.
369
+ A home spawned before 0.29.0 recorded none: `{}`. A final JSON line may
339
370
  return `meta`, `brief`, `warning`, or harness-specific `launch` arguments. A
340
371
  **spawn hook only** may also return an `env` object for the launched process;
341
372
  returning `env` from retire or soul-scaffold is an explicit contract error.
@@ -482,7 +513,8 @@ passed as arguments; no shell is involved.
482
513
  - Every ambient `OATS_*`, `OAS_*` and `PI_*` variable is removed. Other
483
514
  variables pass through.
484
515
  - The kernel sets:
485
- - `OATS_CAPABILITY` and `OATS_SETTINGS` (the payload as JSON);
516
+ - `OATS_CAPABILITY`, `OATS_SETTINGS` (the payload as JSON) and
517
+ `OATS_SETTINGS_ORIGINS` (where each leaf came from, as hooks get it);
486
518
  - `OATS_CLI_BIN`;
487
519
  - `OATS_WORKSPACE` (the deployment);
488
520
  - the team variables `OATS_TEAM_ID` (the messaging payload's `team`: the
@@ -262,13 +262,6 @@
262
262
  },
263
263
  "additionalProperties": false
264
264
  },
265
- "agents": {
266
- "type": "array",
267
- "items": {
268
- "type": "string"
269
- },
270
- "description": "Package-relative soul directories (soul.yaml + AGENTS.md) \u2014 capability-defined agents; they resolve where the capability is active, souls stay read-only in the package, instances home under <deployment>/agents/<agent>/instances/."
271
- },
272
265
  "settings": {
273
266
  "type": "object",
274
267
  "description": "Declared capability settings: name to { default, values?, description }. Documentation for the values a soul, oats-local.yaml or `oats spawn --provider` supplies; undeclared settings are still accepted.",