@awebai/oats 0.22.19 → 0.23.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 (69) hide show
  1. package/README.md +54 -20
  2. package/bin/oats.mjs +24 -10
  3. package/capabilities/oats-okf/agents/memory-harvest/AGENTS.md +18 -24
  4. package/capabilities/oats-okf/agents/memory-harvest/soul.yaml +2 -2
  5. package/capabilities/oats-okf/bin/oats-okf.mjs +105 -517
  6. package/capabilities/oats-okf/injects/okf.md +32 -67
  7. package/capabilities/oats-okf/lib/config.mjs +112 -0
  8. package/capabilities/oats-okf/lib/inspection.mjs +96 -0
  9. package/capabilities/oats-okf/lib/io.mjs +103 -0
  10. package/capabilities/oats-okf/lib/migration.mjs +116 -0
  11. package/capabilities/oats-okf/lib/sources.mjs +238 -0
  12. package/capabilities/oats-okf/lib/stores.mjs +331 -0
  13. package/capabilities/oats-okf/lib/worker.mjs +352 -0
  14. package/capabilities/oats-okf/oats.json +23 -7
  15. package/capabilities/oats-okf/schemas/okf-base.schema.json +46 -0
  16. package/capabilities/oats-okf/schemas/okf-bindings.schema.json +112 -0
  17. package/capabilities/oats-okf/schemas/okf-soul.schema.json +37 -0
  18. package/capabilities/oats-okf/skills/memory-harvest/SKILL.md +263 -140
  19. package/capabilities/oats-okf/skills/okf/SKILL.md +13 -4
  20. package/docs/capabilities.md +14 -3
  21. package/docs/configuration.md +11 -1
  22. package/docs/design/2026-09-08-expert-assisted-deployment-proposal.md +558 -0
  23. package/docs/design/2026-09-13-knowledge-and-memory-direction.md +744 -0
  24. package/docs/design/2026-09-13-knowledge-implementation.md +127 -0
  25. package/docs/design/2026-09-13-knowledge-location-contract.md +340 -0
  26. package/docs/design/okf-mirror-provenance.md +105 -0
  27. package/docs/design/package-runtime-api.md +177 -3
  28. package/docs/desktop-cli-api.md +60 -11
  29. package/docs/execution-targets.md +16 -0
  30. package/docs/first-team-demo.md +6 -1
  31. package/docs/first-team.md +151 -115
  32. package/docs/integrations.md +42 -42
  33. package/docs/knowledge-capability-authoring.md +101 -0
  34. package/docs/knowledge-migration.md +138 -0
  35. package/docs/knowledge-reference/acceptance.md +108 -0
  36. package/docs/knowledge-reference/adoption.md +61 -0
  37. package/docs/knowledge-reference/harvester.md +107 -0
  38. package/docs/knowledge-reference/model.md +84 -0
  39. package/docs/knowledge-reference/package-craft.md +126 -0
  40. package/docs/knowledge-reference/provider-mapping.md +77 -0
  41. package/docs/knowledge-reference/reader-capture.md +87 -0
  42. package/docs/knowledge-theory.md +20 -6
  43. package/docs/knowledge.md +316 -129
  44. package/docs/layers.md +65 -69
  45. package/docs/migration-from-oas.md +7 -1
  46. package/docs/oats-config.schema.json +5 -2
  47. package/docs/packages.md +26 -2
  48. package/docs/release-notes/v0.23.0.md +93 -0
  49. package/docs/release-notes/v0.23.1.md +97 -0
  50. package/docs/schedules.md +42 -3
  51. package/docs/souls-and-instances.md +72 -49
  52. package/injects/work-directory.md +18 -0
  53. package/lib/core.mjs +279 -56
  54. package/lib/schedule.mjs +12 -2
  55. package/package-catalog.json +6 -1
  56. package/package.json +2 -2
  57. package/packages/record/README.md +19 -0
  58. package/packages/record/bin/capture.mjs +96 -48
  59. package/packages/record/bin/recall.mjs +17 -11
  60. package/packages/record/bin/record-native-start.mjs +11 -0
  61. package/packages/record/lib/capture-cc.mjs +82 -27
  62. package/packages/record/lib/capture-lock.mjs +15 -2
  63. package/packages/record/lib/formats.mjs +108 -21
  64. package/packages/record/lib/native-history.mjs +87 -0
  65. package/packages/record/lib/session-roots.mjs +90 -0
  66. package/packages/record/lib/session-snapshot.mjs +61 -0
  67. package/packages/record/lib/sessions-for-home.mjs +88 -56
  68. package/skills/oats/SKILL.md +3 -1
  69. package/capabilities/oats-okf/lib/harvest-branch.mjs +0 -43
@@ -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,105 @@
1
+ # Internal: finalizing the OKF mirror's source provenance
2
+
3
+ The standalone `oats.okf` distribution is authoritative. The framework's
4
+ `capabilities/oats-okf/` and `scripts/okf-source-inventory.json` are generated
5
+ mirrors, not authoring surfaces. This procedure does not publish the source,
6
+ accept a PR, update the catalog, commit, fetch, or change branches.
7
+
8
+ ## Development versus publication
9
+
10
+ - `node scripts/check-okf-mirror.mjs --generate --source <standalone-repository>`
11
+ captures current exported working bytes, including dirty/untracked files.
12
+ It always records `release.status: pending`, null final refs and
13
+ `published: false`, even when HEAD happens to have a published tag.
14
+ - `node scripts/check-okf-mirror.mjs --verify` uses only the checked-in inventory
15
+ and mirror. No Git, clone, credentials or network is needed for either a
16
+ pending or finalized inventory. It checks exact file sets (including empty
17
+ directories), file bytes, portable Git executable modes, literal symlink
18
+ targets, wrapper hashes, and consistent release metadata.
19
+ - `--verify-source --source <standalone-repository>` verifies pending snapshots
20
+ against their exact recorded working state, including branch/dirty metadata.
21
+ For published inventories it rechecks the immutable commit, payload, origin
22
+ tag object and peeled commit, ignoring the recorded local branch name. The
23
+ checkout must still be clean at the recorded accepted commit; renamed
24
+ branches and detached HEAD are supported. This published-source check needs
25
+ origin access. It does not depend on cached remote-tracking refs.
26
+
27
+ Offline verification is an integrity check of a reviewed checked-in inventory,
28
+ not independent proof that a remote still advertises a tag. The explicit source
29
+ check supplies that evidence. No boolean flag is a publication attestation.
30
+
31
+ ## Post-publication command
32
+
33
+ Only after source review/merge and actual publication of `v2.0.0`:
34
+
35
+ 1. Obtain the **accepted full merged commit ID** from the source review/release
36
+ record. Do not substitute a mutable branch name, abbreviated hash, or whatever
37
+ HEAD happens to resolve to. The legacy inventory field `finalMergedCommit`
38
+ records this caller-supplied acceptance; Git cannot prove human PR approval.
39
+ 2. Have a clean standalone checkout at that commit, with the published tag
40
+ available locally and `origin` pointing to `awebai/oats-okf`. Fetch/check out
41
+ deliberately through the parent release procedure; the checker never does it.
42
+ 3. From the framework checkout, run:
43
+
44
+ ```bash
45
+ node scripts/check-okf-mirror.mjs --finalize \
46
+ --source .agents/knowledge-rework/repos/okf \
47
+ --final-tag v2.0.0 \
48
+ --final-commit "${OKF_V2_ACCEPTED_COMMIT:?set the reviewed full merged source commit ID}" &&
49
+ node scripts/check-okf-mirror.mjs --verify-source \
50
+ --source .agents/knowledge-rework/repos/okf &&
51
+ node --test test/okf-mirror-parity.test.mjs
52
+ ```
53
+
54
+ The relative source path above is the existing ignored work-view convention;
55
+ substitute an explicitly resolved standalone repository path in other work
56
+ views. The command must not be run while source acceptance is still changing.
57
+
58
+ 4. Review the resulting payload/inventory diff, run the remaining release gates,
59
+ then advance the catalog through the parent integration process. Finalization
60
+ itself never touches the catalog.
61
+
62
+ `--finalize` requires both `--final-tag` and a full SHA-1/SHA-256 `--final-commit`.
63
+ It replaces only the mirrored capability and inventory, just like `--generate`,
64
+ but stamps `release.status: published` only after all checks succeed:
65
+
66
+ - The version tag is exactly `v<distribution version>`; HEAD is the explicitly
67
+ accepted commit and Git reports a clean source tree. Masked index entries
68
+ (`assume-unchanged`/`skip-worktree`) are not accepted.
69
+ - Actual exported files and wrappers match raw objects at that commit, not just
70
+ Git status or filtered checkout content. Ignored exported extras, untracked
71
+ empty directories, CRLF/filter changes, hidden byte changes, mode drift with
72
+ `core.filemode=false`, and literal symlink-target differences fail closed.
73
+ Git replacement objects are disabled. Published inventories also record and
74
+ hash wrapper file modes; materialization preserves those modes and bytes.
75
+ - Exactly one effective origin fetch URL identifies the official source. The
76
+ usual official GitHub HTTPS/SSH spellings are equivalent. URL rewrites to an
77
+ unrelated repository are rejected. The remote query uses canonical public
78
+ HTTPS with source-local Git configuration disabled, so local upload-pack/SSH
79
+ overrides cannot fabricate its response. Prompts/helpers are disabled and
80
+ Git commands have a bounded timeout.
81
+ - The local tag resolves to the accepted commit. A fresh `ls-remote` query must
82
+ advertise the same tag object and the same peeled commit (or direct commit
83
+ for a lightweight tag). Both annotated and lightweight tags are supported.
84
+ Missing/unreachable origin, unpublished tags or mismatched refs fail closed.
85
+ - The source is checked again after staging the copy, before replacing the
86
+ mirror or inventory. Failed acceptance checks leave both untouched. Ordinary
87
+ filesystem failures during replacement are not a multi-file transaction.
88
+
89
+ The published record retains `source.head`, clean-state metadata, the branch
90
+ observed at generation (informational during immutable verification), the
91
+ accepted final tag/commit, `remote: origin`, and the exact `tagObject`. Thus
92
+ changing an annotated tag object without changing its commit still invalidates
93
+ `--verify-source`. Remote checks attest what was advertised when queried; they
94
+ cannot prevent an upstream tag from being moved later. Do not move released
95
+ tags, and re-run source verification at the release gate.
96
+
97
+ ## Isolated regression coverage
98
+
99
+ `test/okf-mirror-parity.test.mjs` uses temporary source repositories and local bare
100
+ origins only, including tag creation/deletion/movement solely inside fixtures.
101
+ The JavaScript `finalizeOkfMirror`/`verifyOkfSource` APIs accept an explicit
102
+ `repository` expectation for these fixtures and record their real source
103
+ identity; the CLI cannot override the official repository. No tests publish to
104
+ GitHub. Checked-in mirror tests accept consistent pending **or** published
105
+ provenance, so finalizing the source does not require weakening those tests.