accrete-kit 0.0.0-stage → 0.1.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 (134) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/LICENSE +21 -0
  3. package/README.md +148 -2
  4. package/bin/accrete-kit.mjs +4 -0
  5. package/dist/kernel/darwin-arm64/LICENSE +21 -0
  6. package/dist/kernel/darwin-arm64/THIRD-PARTY-NOTICES +5780 -0
  7. package/dist/kernel/darwin-arm64/accrete +0 -0
  8. package/dist/kernel/darwin-arm64/licenses/RUST-COPYRIGHT-library.html +7038 -0
  9. package/dist/kernel/darwin-arm64/licenses/musl-COPYRIGHT +193 -0
  10. package/dist/kernel/darwin-arm64/licenses/rust/Apache-2.0.txt +73 -0
  11. package/dist/kernel/darwin-arm64/licenses/rust/BSD-2-Clause.txt +9 -0
  12. package/dist/kernel/darwin-arm64/licenses/rust/CC-BY-SA-4.0.txt +427 -0
  13. package/dist/kernel/darwin-arm64/licenses/rust/GCC-exception-3.1.txt +30 -0
  14. package/dist/kernel/darwin-arm64/licenses/rust/GPL-2.0-only.txt +133 -0
  15. package/dist/kernel/darwin-arm64/licenses/rust/GPL-3.0-or-later.txt +202 -0
  16. package/dist/kernel/darwin-arm64/licenses/rust/ISC.txt +7 -0
  17. package/dist/kernel/darwin-arm64/licenses/rust/LLVM-exception.txt +15 -0
  18. package/dist/kernel/darwin-arm64/licenses/rust/MIT.txt +9 -0
  19. package/dist/kernel/darwin-arm64/licenses/rust/NCSA.txt +29 -0
  20. package/dist/kernel/darwin-arm64/licenses/rust/OFL-1.1.txt +43 -0
  21. package/dist/kernel/darwin-arm64/licenses/rust/Unicode-3.0.txt +39 -0
  22. package/dist/kernel/darwin-x64/LICENSE +21 -0
  23. package/dist/kernel/darwin-x64/THIRD-PARTY-NOTICES +5780 -0
  24. package/dist/kernel/darwin-x64/accrete +0 -0
  25. package/dist/kernel/darwin-x64/licenses/RUST-COPYRIGHT-library.html +7038 -0
  26. package/dist/kernel/darwin-x64/licenses/musl-COPYRIGHT +193 -0
  27. package/dist/kernel/darwin-x64/licenses/rust/Apache-2.0.txt +73 -0
  28. package/dist/kernel/darwin-x64/licenses/rust/BSD-2-Clause.txt +9 -0
  29. package/dist/kernel/darwin-x64/licenses/rust/CC-BY-SA-4.0.txt +427 -0
  30. package/dist/kernel/darwin-x64/licenses/rust/GCC-exception-3.1.txt +30 -0
  31. package/dist/kernel/darwin-x64/licenses/rust/GPL-2.0-only.txt +133 -0
  32. package/dist/kernel/darwin-x64/licenses/rust/GPL-3.0-or-later.txt +202 -0
  33. package/dist/kernel/darwin-x64/licenses/rust/ISC.txt +7 -0
  34. package/dist/kernel/darwin-x64/licenses/rust/LLVM-exception.txt +15 -0
  35. package/dist/kernel/darwin-x64/licenses/rust/MIT.txt +9 -0
  36. package/dist/kernel/darwin-x64/licenses/rust/NCSA.txt +29 -0
  37. package/dist/kernel/darwin-x64/licenses/rust/OFL-1.1.txt +43 -0
  38. package/dist/kernel/darwin-x64/licenses/rust/Unicode-3.0.txt +39 -0
  39. package/dist/kernel/kernel.json +17 -0
  40. package/dist/kernel/linux-arm64/LICENSE +21 -0
  41. package/dist/kernel/linux-arm64/THIRD-PARTY-NOTICES +5780 -0
  42. package/dist/kernel/linux-arm64/accrete +0 -0
  43. package/dist/kernel/linux-arm64/licenses/RUST-COPYRIGHT-library.html +7038 -0
  44. package/dist/kernel/linux-arm64/licenses/musl-COPYRIGHT +193 -0
  45. package/dist/kernel/linux-arm64/licenses/rust/Apache-2.0.txt +73 -0
  46. package/dist/kernel/linux-arm64/licenses/rust/BSD-2-Clause.txt +9 -0
  47. package/dist/kernel/linux-arm64/licenses/rust/CC-BY-SA-4.0.txt +427 -0
  48. package/dist/kernel/linux-arm64/licenses/rust/GCC-exception-3.1.txt +30 -0
  49. package/dist/kernel/linux-arm64/licenses/rust/GPL-2.0-only.txt +133 -0
  50. package/dist/kernel/linux-arm64/licenses/rust/GPL-3.0-or-later.txt +202 -0
  51. package/dist/kernel/linux-arm64/licenses/rust/ISC.txt +7 -0
  52. package/dist/kernel/linux-arm64/licenses/rust/LLVM-exception.txt +15 -0
  53. package/dist/kernel/linux-arm64/licenses/rust/MIT.txt +9 -0
  54. package/dist/kernel/linux-arm64/licenses/rust/NCSA.txt +29 -0
  55. package/dist/kernel/linux-arm64/licenses/rust/OFL-1.1.txt +43 -0
  56. package/dist/kernel/linux-arm64/licenses/rust/Unicode-3.0.txt +39 -0
  57. package/dist/kernel/linux-x64/LICENSE +21 -0
  58. package/dist/kernel/linux-x64/THIRD-PARTY-NOTICES +5780 -0
  59. package/dist/kernel/linux-x64/accrete +0 -0
  60. package/dist/kernel/linux-x64/licenses/RUST-COPYRIGHT-library.html +7038 -0
  61. package/dist/kernel/linux-x64/licenses/musl-COPYRIGHT +193 -0
  62. package/dist/kernel/linux-x64/licenses/rust/Apache-2.0.txt +73 -0
  63. package/dist/kernel/linux-x64/licenses/rust/BSD-2-Clause.txt +9 -0
  64. package/dist/kernel/linux-x64/licenses/rust/CC-BY-SA-4.0.txt +427 -0
  65. package/dist/kernel/linux-x64/licenses/rust/GCC-exception-3.1.txt +30 -0
  66. package/dist/kernel/linux-x64/licenses/rust/GPL-2.0-only.txt +133 -0
  67. package/dist/kernel/linux-x64/licenses/rust/GPL-3.0-or-later.txt +202 -0
  68. package/dist/kernel/linux-x64/licenses/rust/ISC.txt +7 -0
  69. package/dist/kernel/linux-x64/licenses/rust/LLVM-exception.txt +15 -0
  70. package/dist/kernel/linux-x64/licenses/rust/MIT.txt +9 -0
  71. package/dist/kernel/linux-x64/licenses/rust/NCSA.txt +29 -0
  72. package/dist/kernel/linux-x64/licenses/rust/OFL-1.1.txt +43 -0
  73. package/dist/kernel/linux-x64/licenses/rust/Unicode-3.0.txt +39 -0
  74. package/dist/scaffold/assets/contract/cli-v1.json +296 -0
  75. package/dist/scaffold/assets/contract/example-inputs.json +38 -0
  76. package/dist/scaffold/assets/contract/input-drafts.schema.json +654 -0
  77. package/dist/scaffold/assets/generated/cli-commands.md +288 -0
  78. package/dist/scaffold/assets/generated/release.json +11 -0
  79. package/dist/scaffold/assets/skills/accrete-data/SKILL.md +73 -0
  80. package/dist/scaffold/assets/skills/accrete-data/references/commands.md +193 -0
  81. package/dist/scaffold/assets/skills/accrete-data/references/objects-and-native-work.md +123 -0
  82. package/dist/scaffold/assets/skills/accrete-data/references/remote-and-retention.md +98 -0
  83. package/dist/scaffold/assets/skills/accrete-memory/SKILL.md +61 -0
  84. package/dist/scaffold/assets/skills/accrete-memory/references/commands.md +124 -0
  85. package/dist/scaffold/assets/skills/accrete-memory/references/handovers-and-remote-work.md +78 -0
  86. package/dist/scaffold/assets/skills/accrete-memory/references/writing-and-continuity.md +101 -0
  87. package/dist/scaffold/assets/skills/accrete-models/SKILL.md +46 -0
  88. package/dist/scaffold/assets/skills/accrete-models/references/cli.md +117 -0
  89. package/dist/scaffold/assets/skills/accrete-models/references/objects.md +67 -0
  90. package/dist/scaffold/assets/skills/accrete-models/references/working-practice.md +48 -0
  91. package/dist/scaffold/assets/skills/accrete-results/SKILL.md +69 -0
  92. package/dist/scaffold/assets/skills/accrete-results/references/activities-and-relations.md +116 -0
  93. package/dist/scaffold/assets/skills/accrete-results/references/commands.md +191 -0
  94. package/dist/scaffold/assets/skills/accrete-results/references/scientific-practice.md +89 -0
  95. package/dist/scaffold/assets/skills/accrete-tools/SKILL.md +51 -0
  96. package/dist/scaffold/assets/skills/accrete-tools/references/cli.md +87 -0
  97. package/dist/scaffold/assets/skills/accrete-tools/references/objects.md +66 -0
  98. package/dist/scaffold/assets/skills/accrete-tools/references/working-practice.md +51 -0
  99. package/dist/scaffold/assets/template/.accrete/PROJECT.md +31 -0
  100. package/dist/scaffold/assets/template/.accrete/config-examples/local-compute.toml.example +27 -0
  101. package/dist/scaffold/assets/template/.accrete/config-examples/local-workstation.toml.example +21 -0
  102. package/dist/scaffold/assets/template/.accrete/config-examples/project.toml.example +27 -0
  103. package/dist/scaffold/assets/template/.accrete/docs/cli-contract.md +393 -0
  104. package/dist/scaffold/assets/template/.accrete/docs/configuration.md +117 -0
  105. package/dist/scaffold/assets/template/.accrete/docs/coordinator.md +102 -0
  106. package/dist/scaffold/assets/template/.accrete/docs/long-term-work.md +108 -0
  107. package/dist/scaffold/assets/template/.accrete/docs/overview.md +118 -0
  108. package/dist/scaffold/assets/template/.accrete/docs/remote-work.md +125 -0
  109. package/dist/scaffold/assets/template/.accrete/docs/subagents.md +78 -0
  110. package/dist/scaffold/assets/template/.accrete/examples/README.md +78 -0
  111. package/dist/scaffold/assets/template/.accrete/examples/data-register.json +19 -0
  112. package/dist/scaffold/assets/template/.accrete/examples/iteration-close.json +5 -0
  113. package/dist/scaffold/assets/template/.accrete/examples/iteration-open.json +8 -0
  114. package/dist/scaffold/assets/template/.accrete/examples/memory-entry.md +10 -0
  115. package/dist/scaffold/assets/template/.accrete/examples/model-register.json +7 -0
  116. package/dist/scaffold/assets/template/.accrete/examples/observation.md +9 -0
  117. package/dist/scaffold/assets/template/.accrete/examples/result-amend.json +5 -0
  118. package/dist/scaffold/assets/template/.accrete/examples/result-record.json +11 -0
  119. package/dist/scaffold/assets/template/.accrete/examples/tool-admit.json +8 -0
  120. package/dist/scaffold/assets/template/.accrete/examples/tool-retire.json +3 -0
  121. package/dist/scaffold/assets/template/.accrete/examples/tool-update.json +3 -0
  122. package/dist/scaffold/assets/template/.gitattributes +17 -0
  123. package/dist/scaffold/assets/template/AGENTS.md +23 -0
  124. package/dist/scaffold/assets/template/CLAUDE.md +5 -0
  125. package/dist/scaffold/assets/template/_gitignore +12 -0
  126. package/dist/scaffold/config/defaults.toml +20 -0
  127. package/dist/scaffold/manifest.json +622 -0
  128. package/lib/cli.mjs +188 -0
  129. package/lib/fsutil.mjs +135 -0
  130. package/lib/install.mjs +439 -0
  131. package/lib/kernel.mjs +76 -0
  132. package/lib/scaffold.mjs +129 -0
  133. package/lib/workspace.mjs +278 -0
  134. package/package.json +18 -4
@@ -0,0 +1,393 @@
1
+ # CLI contract and publication semantics
2
+
3
+ ## Contents
4
+
5
+ - [This release](#this-release)
6
+ - [Project selection and inputs](#project-selection-and-inputs)
7
+ - [Caller input shapes](#caller-input-shapes)
8
+ - [Mutation receipts and incomplete outcomes](#mutation-receipts-and-incomplete-outcomes)
9
+ - [Revisions, amendments and retries](#revisions-amendments-and-retries)
10
+ - [Workspace creation and template upgrades](#workspace-creation-and-template-upgrades)
11
+ - [Native reading and remote work](#native-reading-and-remote-work)
12
+
13
+ ## This release
14
+
15
+ `accrete` is the native Kernel. It works inside an existing Workspace. The npm generator
16
+ `accrete-kit` creates that Workspace and installs these Skills and manuals; see
17
+ [below](#workspace-creation-and-template-upgrades).
18
+
19
+ Each Workspace holds this host's Kernel as a plain native executable. Run
20
+ `.accrete/bin/accrete` from the Workspace root, and
21
+ `<workspace>/.accrete/bin/accrete --project <workspace>` from anywhere else, such as an
22
+ external Model checkout or a run directory. It is ignored by Git, so a clone or another
23
+ machine restores its own; see [remote work](remote-work.md). Every manual writes `accrete`
24
+ as shorthand for whichever of these applies.
25
+
26
+ Read [the generated command map](cli-commands.md) for every command form. The
27
+ installed `.accrete/contracts/cli-v1.json` is the same catalog in JSON, and
28
+ `accrete COMMAND --help` prints the same flags at the terminal. `.accrete/release.json`
29
+ states which template installed these files and which Kernel it declares. `accrete
30
+ interface --json` states the running Kernel's versions and exit codes.
31
+
32
+ Do not emulate a command by writing a descriptor or SQLite row from a script.
33
+ Where the binary is absent on a host, native coding, computation and analysis
34
+ continue, and drafts wait for a host that has it.
35
+
36
+ The CLI deliberately has no general query language, Model-content editor, Agent
37
+ scheduler, experiment launcher, or replacement for Git. Foundation Skills explain
38
+ the meaning and consequences of the operations.
39
+
40
+ ## Project selection and inputs
41
+
42
+ The owning project is chosen in this order: `--project DIRECTORY`,
43
+ `ACCRETE_PROJECT`, then the nearest `.accrete/project.toml` in the current
44
+ directory's ancestors. An external Model checkout is a valid command working
45
+ directory; explicitly select its owning project. Never infer that the current Git
46
+ repository is the intended ACCRETE project merely because Git is available there.
47
+
48
+ ```sh
49
+ accrete --project "/work/research project" --json result record \
50
+ --from "/work/run area/result-draft.json"
51
+ ```
52
+
53
+ Global options can appear before or after the subcommand:
54
+
55
+ | Option | Meaning |
56
+ | --- | --- |
57
+ | `--project DIRECTORY` | Project root. |
58
+ | `--state-dir DIRECTORY` | Host-local state base for this invocation. |
59
+ | `--host LABEL` | Label for this machine in local bindings and location observations. It does not select an agent; `--agent` does. |
60
+ | `--json` | One JSON response on stdout; progress, diagnostics and errors on stderr. |
61
+
62
+ Paths are passed as single arguments, so spaces are ordinary characters. JSON is
63
+ UTF-8 and prose is UTF-8 Markdown. `--from -` reads stdin for object creation,
64
+ amendments, Data locations and Memory. `import` and `migrate` need real
65
+ paths. Configuration never runs shell expressions.
66
+
67
+ | Path | Relative to |
68
+ | --- | --- |
69
+ | `--from`, `--text-file`, `--links-from`, `export --to`, `import --from` | The invoking directory |
70
+ | Model checkout or worktree, Tool source, export or exposure destination, Data `--path`, `result capture --to`, and paths inside drafts | The selected project root |
71
+ | Data location path naming a configured filesystem root | That root |
72
+ | `data materialize --to` | Not a path: a configured location name |
73
+
74
+ Use [the input drafts](../examples/README.md) as editable starting material.
75
+ Object arguments accept a stable ID, a name or an alias. IDs take priority and an
76
+ ambiguous alias is a conflict. Create commands accept an optional `id` when stable
77
+ retries are useful: 1-180 ASCII letters, digits, dots, underscores or hyphens, and
78
+ not `.` or `..`. Otherwise the Kernel generates a UUID. Creation commands also
79
+ accept `--name` and `--description`, which override matching fields in `--from`.
80
+ The Kernel supplies the persisted envelope, timestamps, document format,
81
+ publication path and receipt. Drafts are not replacement persisted descriptors.
82
+ Use stable IDs when constructing relationships; unresolved locations or locally
83
+ absent referenced objects do not invalidate a meaningful association.
84
+
85
+ ## Caller input shapes
86
+
87
+ These fields are what the commands accept. Free domain descriptions and
88
+ `extensions` can carry additional project content, and unknown fields are preserved.
89
+
90
+ ### Models and iterations
91
+
92
+ | Operation | Input fields and meaning |
93
+ | --- | --- |
94
+ | `model register` | `name`, `description`, optional `aliases`, optional top-level `source_scope` (repository-relative program paths), and `repository`. `repository.checkout` is the same as `--checkout`: it creates the host-local binding and is not stored in the portable descriptor; `--checkout` wins if both are given. `repository.locator` and `arrangement` are portable hints. Supply a checkout or a `repository`. Registration never clones or fetches. |
95
+ | `model bind MODEL_ID --checkout PATH` | Bind this host to a known Model's checkout; do not clone, change branches or create a second identity. |
96
+ | `model update MODEL_ID --from FILE --expect REVISION` | JSON Merge Patch of descriptor fields. Source history stays in Git. |
97
+ | `model retire MODEL_ID --expect REVISION [--from FILE]` | Ends current use; identity and earlier associations remain. The optional JSON may carry `reason`. |
98
+ | `model iteration open MODEL_ID` | `name`, `purpose`, `branch`, `worktree`, `start`, `existing`, `id`, as flags or the same fields in `--from FILE`; flags override. `--worktree` creates a worktree of the Model's repository, unless `--existing` attaches one already there. Without `--worktree` no storage is allocated. `--branch` names a new branch; without it Git creates a detached worktree. `--start` defaults to `HEAD`. The Model needs a checkout binding on this host. |
99
+ | `model iteration close ITERATION_ID --expect REVISION` | `outcome`, optional `summary`, optional `commits`, in `--from FILE` or through `--outcome` and repeatable `--commit`. Outcome is required from one or the other and is authored text; `integrated`, `retained_separately`, and `abandoned` are examples. |
100
+ | `model iteration remove-worktree ITERATION_ID [--force]` | Removes the iteration's bound worktree through Git. Git's refusal to remove changed work stands unless `--force` is given. |
101
+
102
+ The Model Skill explains repository arrangements, dirty content and retained
103
+ refs. Closing an iteration does not merge code or remove its worktree; every
104
+ closing commit is kept under `refs/accrete/retained/`. If a Git operation succeeds
105
+ before a descriptor can be published, the receipt identifies the surviving
106
+ checkout and `accrete recover` attaches it. An outer project worktree is not a
107
+ separate checkout of every embedded or external Model.
108
+
109
+ ### Tools
110
+
111
+ `tool admit` accepts `name`, `description` and
112
+ `source: {path, mode, revision?}`, or `--source`, `--source-mode` and `--revision`.
113
+ `mode` is `live` (the default) or `retained`. A retained selection requires
114
+ corresponding actual source material; its selection cannot freeze a mutable source
115
+ by relabeling it. A Git-backed retained revision uses the commit ID.
116
+ Project-relative source associations can travel with the project; a source outside
117
+ the project stays in local bindings. `tool bind TOOL_ID --source PATH` sets this
118
+ host's binding.
119
+
120
+ `tool update` accepts a JSON Merge Patch of editable fields and `--expect`.
121
+ Native tools edit and version the implementation. `tool expose` selects
122
+ `--agent codex` or `--agent claude`, an optional discovery `--name`, an optional
123
+ `--destination`, and `--mode wrapper` or `symlink`. The default wrapper names the
124
+ actual source `SKILL.md` and explains that all its relative references resolve from
125
+ the source directory. This is a discovery binding to one Tool, not a second retained
126
+ implementation. `tool expose` excludes it from Git through the repository-local
127
+ `.git/info/exclude`, because a wrapper can hold this host's absolute source path.
128
+
129
+ `tool refresh` regenerates existing managed exposures for one `--agent`, or for
130
+ all of them on this machine. An unavailable source remains pending.
131
+ `tool retire --expect REVISION` preserves source content, earlier Results and
132
+ running work; an optional `--from FILE` may carry `{reason: "..."}`. Other machines
133
+ reconcile exposures when they receive the descriptor and refresh. `tool export
134
+ --to PATH` creates a new local directory containing `tool.json` and `source/`;
135
+ registry publication is a separate owner-directed action.
136
+
137
+ ### Data
138
+
139
+ | Field | Meaning |
140
+ | --- | --- |
141
+ | `name`, `description` | Human purpose of this retained input or product. |
142
+ | `content` | `{kind, mode, format?, edition?, size_bytes?, sha256?}`. `kind` is `file`, `directory`, `collection` or `external`. `mode` is `closed` (the default) or `live`. Additional domain details stay explicit. |
143
+ | `origin` | `{description, result_id?, uri?}` describing how the content arose. A generating Result is an origin, not a download locator. `--result` sets `origin.result_id`. |
144
+ | `replaces` | Earlier Data ID that a corrected edition replaces. |
145
+ | `locations[]` | `{name?, kind?, host?, path, ...}`; `kind` is `filesystem`, `rclone` or `external`. All are borrowed; `managed: true` is refused. A location gets its own ID. |
146
+
147
+ `content.sha256` identifies a regular file's bytes. `content.edition` describes the
148
+ intended edition in words. Backend ETags and version selectors stay opaque: a
149
+ location may carry `version`, `version_id` or `s3_version_at`, but `data materialize`
150
+ refuses a source that has one rather than silently fetching current bytes. Use a
151
+ version-specific exported locator, or retrieve that version with the provider's tool
152
+ and register the local copy.
153
+
154
+ Registration does not require hashing, walking, archiving or transferring payload
155
+ bytes. A structured input can describe an external product without any local
156
+ replica. The convenience `--path` form records the available path without claiming
157
+ that it created or owns those bytes, and `--hash` computes SHA-256 for one regular
158
+ file. `--live` sets `content.mode` to `live`. A symlink cannot be registered through
159
+ `--path`.
160
+
161
+ `data location add` adds a locator for the same content. A location name in the
162
+ shared/local configuration resolves a filesystem root or rclone remote. An `external`
163
+ location is a locator the Kernel records and never transfers. A repeated matching
164
+ location is a no-op. Only `data materialize` makes a replica managed.
165
+
166
+ `data amend DATA_ID --from FILE --expect REVISION` changes descriptive metadata. It
167
+ cannot redefine closed content or replace the locations array. `data retire DATA_ID
168
+ --expect REVISION [--from FILE]` changes status, may carry `reason`, and removes no
169
+ bytes.
170
+
171
+ `data materialize DATA_ID [--to LOCATION]` selects a usable source and publishes a
172
+ completed managed replica at a configured filesystem location, by default `working`.
173
+ Use `--source SOURCE_LOCATION` to resolve an ambiguity. The adapters copy local files
174
+ and directories or download through configured rclone. Uploading is a native rclone
175
+ operation followed by `data location add`.
176
+
177
+ `data evict DATA_ID --location LOCATION` names exactly one managed replica by location
178
+ ID or name; an ambiguous name is a conflict. It preserves identity, relationships and
179
+ other locations. Registered borrowed directories remain under their existing owner's
180
+ control. Content revised after an earlier closed product normally receives another
181
+ Data ID; an added replica does not retroactively change earlier Results.
182
+
183
+ ### Results
184
+
185
+ `result record` accepts optional `name` and `activity` (a useful human description;
186
+ the index shows `name`, falling back to `activity`), and optional `models`, `tools`,
187
+ `inputs`, `outputs`, `execution`, `observations`, `related_results`, and `extensions`:
188
+
189
+ | Field | Shape |
190
+ | --- | --- |
191
+ | `models[]` | `{model_id, role?, commit: null\|string, dirty: null\|boolean}`; omit unavailable observations or leave them null. |
192
+ | `tools[]` | `{tool_id, revision: null\|string}`, describing the material actually used. |
193
+ | `inputs[]`, `outputs[]` | `{data_id, role?}`. |
194
+ | `execution` | Free-form domain object with useful execution conditions and optional start/end/outcome descriptions. |
195
+ | `observations[]` | Array of observations, each a free-form object, conventionally with `text`. |
196
+ | `related_results[]` | `{result_id, role?}` for attempts, legs, comparisons or continuations. |
197
+
198
+ Empty association arrays are legitimate. A Result can be useful even when some
199
+ details or locally referenced objects are unavailable. Today's checkout commit does
200
+ not fill a retrospective execution revision. `--observe-checkout PATH` records the
201
+ current checkout as a separately labelled recording-time observation, apart from the
202
+ execution description. A `commit` given for a Model with a local checkout is kept
203
+ under `refs/accrete/retained/`; the receipt names the ref or says why it could not.
204
+
205
+ `result amend` applies an explicit JSON Merge Patch with `--expect REVISION`.
206
+ `result observe --text-file FILE` appends independent authored content to
207
+ `observations` without a caller revision requirement; `--operation-id ID` makes an
208
+ uncertain append retryable. An amended description or observation does not launch
209
+ any computation. Later interpretation can also become linked Memory.
210
+
211
+ `result capture --checkout PATH --path SOURCE_PATH --to DIRECTORY` writes a selected
212
+ binary Git diff and selected nonignored untracked files to a new directory, with a
213
+ manifest of the captured scope. Repeat `--path`. Ignored products, external
214
+ dependencies and runtime state stay outside it, so it is not a complete executable
215
+ environment. Register the directory as Data if it should be retained.
216
+
217
+ ### Memory
218
+
219
+ `memory append --from FILE` consumes a complete Markdown draft. Do not reserve a
220
+ permanent empty entry or invent its ID/date filename. Repeat `--model`, `--tool`,
221
+ `--data`, `--result` and `--supersedes` for each associated object ID. `--links-from
222
+ FILE` adds a JSON array of further links, each `{kind, id, relation?}`. `--title` and
223
+ `--authored-at` (an RFC 3339 instant) are optional. `--id` selects a stable entry ID;
224
+ repeating the same ID and body returns the same entry, which is how to retry. Ordinary
225
+ prose authoring requires none of these.
226
+
227
+ The Kernel inserts its managed frontmatter, publishes the complete entry, and
228
+ returns the allocated path. The shared project timezone determines the default
229
+ `memory/yyyy/mm/dd/NNN.md` organization. Stable identity survives imported filename
230
+ collisions and renumbering. A later correction uses `--supersedes` and explains the
231
+ changed interpretation. Retain the useful history of reasoning.
232
+
233
+ ### Metadata exchange
234
+
235
+ `accrete export --to PATH [--id ID]` writes a JSON bundle of the selected or all
236
+ managed documents. Repeat `--id` for a subset. It omits scientific payloads, Git
237
+ objects, Tool source and machine bindings. `accrete import --from PATH` reads such a
238
+ bundle object by object and reports each outcome. A bundle from another project needs
239
+ `--allow-foreign`. The remote guide says how to use them.
240
+
241
+ ## Mutation receipts and incomplete outcomes
242
+
243
+ A successful single-object mutation returns:
244
+
245
+ ```json
246
+ {
247
+ "object_id": "79c3a895-6c75-4ecd-bbd5-7f6c452ec8db",
248
+ "path": "/resolved/project/results/79c3a895-6c75-4ecd-bbd5-7f6c452ec8db.json",
249
+ "revision": "sha256-of-the-actual-file-bytes",
250
+ "committed": true,
251
+ "published": true,
252
+ "durability": "durable",
253
+ "index_pending": false,
254
+ "unchanged": false
255
+ }
256
+ ```
257
+
258
+ These are illustrative values. Consume the actual returned values. Multi-effect
259
+ operations add written paths, native side effects and pending exposures. Commands
260
+ without an object, such as `index refresh`, return their affected view and paths
261
+ instead.
262
+
263
+ | Outcome | Meaning | Continuation |
264
+ | --- | --- | --- |
265
+ | `committed: true`, `index_pending: false` | Primary document and local projection completed | Continue from the returned identity and paths. |
266
+ | `committed: true`, `index_pending: true`, exit 0 | Primary publication succeeded | Run `accrete index refresh` when needed. Keep the existing object and computation. |
267
+ | `published: true`, `durability: "uncertain"`, exit 8 | Destination became visible; synchronization did not establish the normal durability guarantee | Keep the ID and path, and run `accrete recover`. |
268
+ | External side effect complete, descriptor pending, exit 7 | A worktree or completed replica may already exist | Run `accrete recover`, which finishes from the receipt. An incomplete transfer is reported with its paths for explicit retry. |
269
+ | Rejected before publication | No primary object change | Correct the stated input/configuration/revision issue and retry as appropriate. |
270
+
271
+ | Exit code | Meaning |
272
+ | --- | --- |
273
+ | `0` | Success, including a committed document whose index refresh is pending. |
274
+ | `2` | Invalid invocation, input, or unsupported format. |
275
+ | `3` | Unresolved configuration or project, or absent object. |
276
+ | `4` | Revision, identity, ownership, or destination conflict. |
277
+ | `5` | Native dependency unavailable. |
278
+ | `6` | Storage failure before the requested publication completes. |
279
+ | `7` | Incomplete external operation or partially failed import. |
280
+ | `8` | Publication is visible but durability is uncertain. |
281
+
282
+ Inspect structured state before interpreting any nonzero exit as "nothing happened."
283
+ `accrete recover` reconciles Data transfers and evictions, worktree creation and
284
+ uncertain publications from their receipts; `--operation OPERATION_ID` limits it to
285
+ one Data operation. It never relaunches scientific computation.
286
+
287
+ ## Revisions, amendments and retries
288
+
289
+ A revision is the lowercase SHA-256 of the document's actual current bytes, including
290
+ external edits. It is not a small counter that can coincide on divergent hosts. Use a
291
+ returned revision while current, or compute it with any SHA-256 tool. Preserve the expected
292
+ revision from the version you read; on conflict, read the current document and combine
293
+ the intended changes.
294
+
295
+ For `result amend`, `tool update`, `model update` and `data amend`, JSON Merge Patch
296
+ means object members merge, arrays replace in full, and `null` removes a member. The
297
+ fields `format`, `kind`, `id`, `project_id`, `created_at` and `updated_at` are not
298
+ editable. Keep existing association array members that should survive. On create, a
299
+ null revision can represent unknown information; in a patch, removing that member
300
+ leaves it unspecified. Neither means the newest revision should be inferred. This
301
+ follows the standard [JSON Merge Patch semantics](https://www.rfc-editor.org/rfc/rfc7396).
302
+
303
+ A supplied ID with identical submitted content is an idempotent create. The Kernel
304
+ compares the caller content independently of fields it allocated. An existing ID with
305
+ differing content requires amendment or produces a conflict. A `result observe`
306
+ operation ID with the same text appends once; changed text under the same operation
307
+ ID is a conflict. Retain the original submitted draft when retrying; regenerating
308
+ timestamps or observations makes a different payload.
309
+
310
+ A lost terminal acknowledgment is not a reason to create another identity or rerun the
311
+ scientific calculation. Inspect the known object path, or retry with the same ID.
312
+
313
+ ## Workspace creation and template upgrades
314
+
315
+ These are npm commands, not `accrete` commands:
316
+
317
+ ```sh
318
+ npx accrete-kit@latest create my-project
319
+ npx accrete-kit@latest create my-project --timezone Asia/Shanghai --agents claude --no-git --no-install
320
+ npx accrete-kit@latest create .
321
+ npx accrete-kit@latest upgrade
322
+ npx accrete-kit@latest upgrade --dry-run --project PATH
323
+ npx accrete-kit@latest upgrade --accept PATH
324
+ npx accrete-kit@<version> install
325
+ ```
326
+
327
+ Creating writes `.accrete/project.toml` with a new identity, installs the guidance, and
328
+ installs this host's Kernel at `.accrete/bin/accrete` unless `--no-install` is given. No root
329
+ `package.json` or `node_modules/` is added, and an existing `package.json` is untouched. `.` adds to an existing
330
+ directory or repository, preserving what is there. `--agents` selects `codex,claude` (the
331
+ default), `codex`, `claude` or `none`; `none` leaves the shared manuals usable without a
332
+ host discovery interface. `--name`, `--id` and `--timezone` set the marker's fields. Git is
333
+ initialized unless `--no-git` is given or the directory is already in a repository;
334
+ committing and selecting a remote remain ordinary Git work. Store directories appear on
335
+ first use. Repeating creation preserves the existing identity.
336
+
337
+ `upgrade` refreshes this guidance independently of a project-format migration. Without
338
+ `--project` it uses the nearest ancestor Workspace. It compares current content with the
339
+ installed base. Unchanged managed content updates. An edited file stays as it is, a
340
+ candidate holding the incoming content is written under
341
+ `.accrete/template-upgrades/<version>/`, and the rest of the upgrade continues; the run
342
+ still exits 0, lists the path as `pending` and warns. A locally deleted file stays deleted,
343
+ and removing the markers from a block file counts as deleting it. Owner content outside
344
+ managed blocks and the seeded `.accrete/PROJECT.md` remains owned by the project.
345
+ `--dry-run` reports the decisions without writing. `--accept PATH` acknowledges the
346
+ owner/Agent's resolved content for a pending candidate; it advances the base to that
347
+ incoming version while preserving the resolution, and never copies the candidate over the
348
+ current file.
349
+
350
+ The inventory and retained small bases make later updates possible when the old generator
351
+ is gone. `--agents` on upgrade changes the selection and is otherwise kept. Newly selected
352
+ agents install their own real Skill directories; a dropped agent's unchanged files are
353
+ removed and edited ones preserved.
354
+
355
+ `upgrade` also moves the Kernel binary and the recorded `kernel_version` to the version that
356
+ `accrete-kit` carries; a binary that already runs as that version is left alone. `upgrade`
357
+ refuses, changing nothing, when the Workspace's template is newer than that `accrete-kit`.
358
+ A Kernel binary that cannot be installed leaves the Workspace in place, names the command to
359
+ retry, and exits nonzero. Replacing a Kernel alone changes no project guidance.
360
+
361
+ `install` restores this host's Kernel in an existing Workspace, for a fresh clone or another
362
+ machine. It takes `--project` as `upgrade` does. It must match the Workspace's recorded
363
+ `kernel_version`; otherwise it changes nothing and prints the exact
364
+ `npx accrete-kit@<version> install` that matches.
365
+
366
+ `accrete migrate [--dry-run]` handles persisted format changes while preserving object
367
+ identities and associations. Format 1 is the only one so far, so it reports the
368
+ project is current and changes nothing. `accrete migrate --from LEGACY [--dry-run]`
369
+ converts the old scaffold's metadata and keeps its originals.
370
+
371
+ ## Native reading and remote work
372
+
373
+ Read portable descriptors with file tools and `jq`, code/history with Git, scientific
374
+ bytes with their format readers, and Memory with `rg`. `accrete config resolve --json`
375
+ reports resolved roots, host, metadata view, index path and state directory, without
376
+ credentials. Read the projection with `sqlite3 -readonly` at the path in
377
+ `.local_state.index`, and ask SQLite for `.schema` before assuming columns. A brief "database is locked" during a concurrent refresh means retry.
378
+
379
+ ```sh
380
+ sqlite3 -readonly "$(accrete config resolve --json | jq -r .local_state.index)" .schema
381
+ ```
382
+
383
+ Each independent metadata view has a host-local lock/index/recovery binding.
384
+ Different branches can carry different documents despite sharing a project ID.
385
+ Quiet managed writers before structural Git operations on that metadata worktree,
386
+ then run `accrete index refresh`. Exchange durable JSON/Markdown through ordinary Git
387
+ or `export` and `import`. Do not exchange a live SQLite projection as the durable
388
+ project state.
389
+
390
+ An unavailable remote payload can still have a valid description. Live job state
391
+ comes from its scheduler, process, log or domain launcher. Recovery handles the
392
+ described metadata/native side effect; scientific execution remains an explicit
393
+ domain action. Read [remote work](remote-work.md) for practical context.
@@ -0,0 +1,117 @@
1
+ # Project configuration and host bindings
2
+
3
+ Shared configuration describes the project. Local configuration binds that
4
+ description to this host. Native tools retain their own environments,
5
+ credentials, and settings. The Kernel resolves these inputs when an invocation
6
+ needs them; reading configuration does not execute shell code or activate an
7
+ environment.
8
+
9
+ ## Configuration ownership
10
+
11
+ | File or layer | Intended contents | Handling |
12
+ |---|---|---|
13
+ | `.accrete/project.toml` | Project ID, name, format, timezone, logical roots, named locations and environment labels | Generated by `npx accrete-kit@latest create`, then shared with project documents |
14
+ | `.accrete/local.toml` | Host alias, absolute checkouts, local state base, storage roots, interpreter/tool paths | Ordinary owner-edited ignored file on each host |
15
+ | Invocation arguments | Owning project, a one-time destination or supported option | Applies to that command only |
16
+ | SSH, rclone, environment manager, scheduler configuration | Their native access and runtime arrangements | Managed by those tools |
17
+
18
+ The installed examples are not project identities. `npx accrete-kit@latest create` creates the
19
+ actual project marker and configuration. Do not copy an
20
+ example's identity over an existing project or create a Workspace separately in
21
+ each clone to obtain the same project. A clone carries the shared project ID and
22
+ receives its own host bindings.
23
+
24
+ Precedence is invocation arguments, local overrides, shared values, then
25
+ Kernel defaults. Tables merge by key; arrays and scalar values replace.
26
+ `project_id` and `format` belong to the shared marker and cannot be changed locally.
27
+
28
+ ## Resolve the project explicitly when needed
29
+
30
+ The discovery order is explicit `--project DIRECTORY`, `ACCRETE_PROJECT`, then the
31
+ nearest marker in the current directory's ancestors. No global inventory chooses a
32
+ project on your behalf.
33
+
34
+ Use `--project` when working from a Model repository, Tool directory, or run
35
+ directory outside the project. This selects the owning metadata without
36
+ relocating or redefining that Model or Tool. Relative configured paths resolve
37
+ against the selected project root, independently of the shell's working
38
+ directory. Use quoted path arguments when paths contain spaces.
39
+
40
+ ## Defaults and examples
41
+
42
+ | Configuration purpose | Relative default |
43
+ |---|---|
44
+ | Object descriptors | `.accrete/objects` |
45
+ | Results | `results` |
46
+ | Dated Memory | `memory` |
47
+ | Editable Tool sources | `tools` |
48
+ | Ongoing Scratch | `scratch` |
49
+
50
+ Read the examples under `.accrete/config-examples/` for a shared configuration,
51
+ a workstation binding, and a compute-host binding. Unknown sections are retained
52
+ and reported by `config resolve`. Keep actual Model aliases and location names
53
+ aligned with the project's registered objects. The default `working` location is
54
+ `.accrete/data` under the project root, which the installed `.gitignore` block
55
+ ignores; give it another `root` in local configuration for large data.
56
+
57
+ Choose the project timezone deliberately because it selects future Memory date
58
+ directories. It is independent of the host's clock display and of scientific
59
+ simulation time. Historical imported dates remain as authored.
60
+
61
+ ## Local operation state
62
+
63
+ The local state base holds this host's locks, SQLite projections, and incomplete
64
+ operation receipts. It is chosen by `--state-dir`, `ACCRETE_STATE_DIR`,
65
+ `[local_state].base`, `$XDG_STATE_HOME/accrete`, then `$HOME/.local/state/accrete`,
66
+ so it sits outside the project by default. The Kernel partitions it by the project ID
67
+ and canonical managed metadata roots. Different branch worktrees have different
68
+ metadata views even when their Git object database is shared. The host label comes
69
+ from `--host`, `ACCRETE_HOST`, `host` in configuration, then the OS hostname. It is an
70
+ observation label and does not imply that a machine is reachable.
71
+
72
+ Select a host-local filesystem for this state. A home directory or project root
73
+ on NFS/Lustre is not automatically a suitable place for a live SQLite database.
74
+ Several hosts must not use one index as a shared database. Use a
75
+ selected host for writes to a shared metadata view, or separate checkouts that
76
+ exchange portable documents.
77
+
78
+ The projection is disposable and can be rebuilt. An incomplete-operation receipt
79
+ may still explain a surviving worktree or transferred payload, so do not treat
80
+ all local state as a cache to delete indiscriminately. Run `accrete recover` before
81
+ cleaning it up.
82
+
83
+ ## Model and environment bindings
84
+
85
+ A Model identity can point to a checkout on this host through an alias such as
86
+ `target`; that alias is project-defined. The model can be the project repository,
87
+ an external repository, an optional submodule, or a worktree. Use native Git to
88
+ obtain it and `accrete model bind` to associate the known Model with the actual
89
+ checkout. `accrete tool bind` does the same for a Tool's source. Both write ID-based
90
+ entries to `.accrete/local.toml`, preserving unknown values; reserializing can
91
+ normalize its formatting and comments.
92
+
93
+ An environment label carries instructions and host paths for the capability that
94
+ uses it. One Model revision can run in several environments. The Kernel does not
95
+ create a Python environment or install scientific dependencies because a binding
96
+ or branch changed. Domain Tools manage language-specific setup and describe the
97
+ runtime actually used in a Result when useful.
98
+
99
+ Place current machine restrictions in `.accrete/PROJECT.md` or the relevant Tool
100
+ reference. A configured GPU preference or scheduler name is informative; it does
101
+ not reserve hardware across projects.
102
+
103
+ ## Changes and missing bindings
104
+
105
+ Configuration is normal editable TOML with plain paths. `~`, `${NAME}` and shell
106
+ expressions in values remain data and are not expanded; use absolute paths.
107
+
108
+ If a checkout or source is absent, retain the shared object identity and repair
109
+ that host's binding. Do not retire the object or substitute an unrelated path.
110
+ An unavailable remote locator can remain useful historical context. A Result
111
+ received from another host may contain references that are intentionally
112
+ unresolved locally.
113
+
114
+ Use `accrete --project DIRECTORY config resolve --json` to inspect effective roots,
115
+ host, state directory and index path (`.local_state.index`) before a managed write when placement is
116
+ uncertain. Read descriptors, code, and scientific data with their native tools after
117
+ resolution.
@@ -0,0 +1,102 @@
1
+ # Coordinator guidance
2
+
3
+ The Coordinator is the primary Agent holding the owner's objective and the
4
+ relationship between ongoing actions. Use the host's normal reasoning,
5
+ terminal, and delegation mechanisms. ACCRETE supplies durable objects through
6
+ the CLI; it does not supply a second agent runtime or task system.
7
+
8
+ ## Maintain direction
9
+
10
+ Understand what the owner is trying to obtain and how the next action advances
11
+ it. Read the relevant Model history, Tool instructions, Results, and Memory.
12
+ Prior work is trusted in the circumstances and revisions it describes. A changed
13
+ question or changed implementation may justify further work; the mere arrival
14
+ of a new Agent does not.
15
+
16
+ Distinguish intended work, work that has started, and observations actually
17
+ returned. A plan is useful context. A source commit describes code. A Result
18
+ can describe a failed, partial, or completed activity. Explain each in its own
19
+ scope when reporting progress.
20
+
21
+ Keep current constraints close to the work that depends on them. A chosen
22
+ baseline, a shared GPU allocation, a sequential restart chain, or an integration
23
+ branch can remain under the Coordinator's control while independent preparation
24
+ or analysis proceeds elsewhere. Do not assume that a project configuration file
25
+ enforces reservations on other users or projects.
26
+
27
+ ## Delegate when it helps
28
+
29
+ Separate independent actions that can proceed with a useful question and a
30
+ concrete working context. Keep short dependent work in the main session when
31
+ that is more natural. The owner may specify another arrangement. Worker count,
32
+ model choice, and host features belong to that arrangement rather than the
33
+ ACCRETE object model.
34
+
35
+ A useful brief carries the following information in plain prose, only as needed:
36
+
37
+ - The purpose and the object or material to work on.
38
+ - The owning ACCRETE project, actual repository/checkout, base revision, and
39
+ assigned editable path.
40
+ - Relevant inputs, a Tool Skill when useful, and any machine or resource limits.
41
+ - Dependencies on other work and the concrete material the Coordinator needs
42
+ back.
43
+
44
+ Give workers enough context to act intelligently. A worker may discover that a
45
+ path is missing or the proposed explanation does not fit; its brief should
46
+ permit investigation within the delegated scope. Avoid copying the whole
47
+ conversation or all project Memory into every assignment.
48
+
49
+ ## Keep editable work independent
50
+
51
+ When source changes can overlap, use separate Model worktrees or disjoint paths.
52
+ Name the actual Model repository and its base revision. An isolated worktree of
53
+ the outer project does not allocate independent worktrees for every nested or
54
+ external Model.
55
+
56
+ Shared read-only input data and documentation can remain shared. Coordinate
57
+ changes to the integration branch and branch switches in a metadata checkout
58
+ with workers writing that same checkout. Kernel locks handle concurrent managed
59
+ mutations in one supported local view; they cannot serialize native Git switches
60
+ or writes made from another host to the same shared files.
61
+
62
+ ## Integrate outcomes
63
+
64
+ Read returned locations, revisions, observations, and unresolved questions in
65
+ the context of the task. Use native Git for merging or cherry-picking source
66
+ changes. Preserve a useful unmerged line of work with an appropriate Git ref or
67
+ bundle when needed. Closing an ACCRETE iteration describes its outcome and
68
+ retained revisions; it does not choose an integration strategy or remove the
69
+ worktree. `accrete model iteration remove-worktree` is the separate explicit step
70
+ for an iteration's worktree, and it keeps Git's refusal to remove changed work.
71
+
72
+ Decide whether the combined work should enter Results or Memory. Independent
73
+ workers can publish their delegated Results or Memory through the Kernel. The
74
+ Coordinator can instead combine several drafts when the interpretation benefits
75
+ from their relationship. Neither route requires a universal approval token.
76
+
77
+ Retain selected code, notes, or outputs before removing a worker's temporary
78
+ location. A Result naming a deleted pathname cannot restore its bytes. Keep the
79
+ material that future work will use, while ordinary Scratch remains freely
80
+ organized.
81
+
82
+ ## Respond to partial managed operations
83
+
84
+ Read the CLI's outcome before retrying. If a Result or Memory entry committed
85
+ but the local index is pending, refresh the index and use the returned object ID.
86
+ If a native side effect survived but descriptor publication did not, or durability
87
+ was reported uncertain, run `accrete recover` on the host that performed it. It
88
+ reconciles from the receipts and never relaunches work. Do not repeat a scientific
89
+ computation to repair object organization.
90
+
91
+ For a revision conflict, read the current document and preserve the incoming
92
+ draft. Combine the intended changes, then submit the appropriate narrow update.
93
+ Do not resolve a semantic disagreement by selecting whichever file has the
94
+ latest timestamp.
95
+
96
+ ## Close a useful unit of work
97
+
98
+ Return the result the owner requested, with the locations needed to continue it.
99
+ State consequential remaining uncertainty and distinguish a completed product
100
+ from an intended continuation. When useful, retain an explanation of why a
101
+ choice was made, which observations matter, and what the next action could
102
+ resolve. There is no compulsory end-of-session report or store traversal.