akm-cli 0.10.261015-beta → 0.10.261017-beta

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 (124) hide show
  1. package/CHANGELOG.md +173 -0
  2. package/README.md +8 -10
  3. package/SECURITY.md +7 -99
  4. package/STABILITY.md +58 -98
  5. package/dist/assets/hints/cli-hints-full.md +6 -4
  6. package/dist/assets/hints/cli-hints-short.md +4 -2
  7. package/dist/assets/opencode/akm-plugin.js +16 -8
  8. package/dist/assets/prompts/workflow-unit-preamble.md +3 -1
  9. package/dist/assets/stash-skeleton/facts/conventions/backlinks.md +2 -2
  10. package/dist/assets/stash-skeleton/facts/conventions/organization.md +11 -17
  11. package/dist/cli.js +32 -41
  12. package/dist/commands/feedback-cli.js +5 -4
  13. package/dist/commands/health/plugin-staleness.js +86 -22
  14. package/dist/commands/health.js +15 -16
  15. package/dist/commands/proposal/proposal-cli.js +1 -1
  16. package/dist/commands/read/registry-search.js +4 -1
  17. package/dist/commands/read/search-cli.js +2 -2
  18. package/dist/commands/read/search.js +6 -6
  19. package/dist/commands/read/show.js +15 -3
  20. package/dist/commands/sources/self-update.js +9 -5
  21. package/dist/commands/tasks/tasks.js +12 -13
  22. package/dist/core/adapter/adapters/agent-skills-adapter.js +7 -7
  23. package/dist/core/adapter/adapters/akm-task-adapter.js +1 -1
  24. package/dist/core/adapter/adapters/akm-workflow-adapter.js +1 -1
  25. package/dist/core/adapter/adapters/claude-adapter.js +1 -1
  26. package/dist/core/adapter/adapters/dotenv-adapter.js +1 -1
  27. package/dist/core/adapter/adapters/generic-files-adapter.js +1 -1
  28. package/dist/core/adapter/adapters/llm-wiki-adapter.js +1 -1
  29. package/dist/core/adapter/adapters/opencode-adapter.js +1 -1
  30. package/dist/core/adapter/adapters/website-snapshot-adapter.js +1 -1
  31. package/dist/core/asset/markdown.js +9 -0
  32. package/dist/core/bundle-rename.js +17 -7
  33. package/dist/core/config/config-walker.js +35 -32
  34. package/dist/core/config/schema/connections.js +6 -3
  35. package/dist/core/config/schema/harnesses.js +8 -1
  36. package/dist/core/config/schema/primitives.js +12 -1
  37. package/dist/core/config/schema/sources-bundles.js +2 -2
  38. package/dist/core/npm-package.js +48 -13
  39. package/dist/indexer/bundle-identity-guard.js +6 -6
  40. package/dist/indexer/index-written-assets.js +3 -3
  41. package/dist/indexer/indexer.js +12 -8
  42. package/dist/indexer/materialize-embeddings.js +12 -2
  43. package/dist/indexer/passes/metadata.js +103 -46
  44. package/dist/indexer/search/ranking.js +7 -3
  45. package/dist/indexer/search/search-fields.js +1 -1
  46. package/dist/indexer/usage/usage-events.js +30 -8
  47. package/dist/indexer/walk/walker.js +1 -1
  48. package/dist/output/renderers.js +2 -2
  49. package/dist/output/shapes/helpers.js +5 -3
  50. package/dist/output/text/command-format.js +5 -6
  51. package/dist/output/text/show-format.js +7 -0
  52. package/dist/registry/semver.js +12 -0
  53. package/dist/scripts/akm-migrate-node.js +21653 -5734
  54. package/dist/scripts/akm-migrate.js +21661 -5742
  55. package/dist/sources/providers/git-provider.js +2 -4
  56. package/dist/sources/providers/provider-utils.js +8 -13
  57. package/dist/sources/snapshot-fetchers/website-ingest.js +6 -7
  58. package/dist/storage/repositories/events-repository.js +15 -0
  59. package/dist/storage/repositories/improve-ledger-repository.js +13 -0
  60. package/dist/storage/repositories/index-entries-repository.js +43 -5
  61. package/dist/storage/repositories/outcome-repository.js +12 -0
  62. package/dist/storage/repositories/proposals-repository.js +5 -5
  63. package/dist/storage/repositories/salience-repository.js +13 -0
  64. package/dist/storage/repositories/task-history-repository.js +8 -7
  65. package/dist/storage/repositories/workflow-runs-repository.js +10 -8
  66. package/dist/tasks/backends/cron.js +19 -0
  67. package/docs/README.md +24 -60
  68. package/docs/agents/README.md +3 -8
  69. package/docs/architecture/README.md +18 -20
  70. package/docs/architecture/adapters.md +40 -43
  71. package/docs/architecture/architecture.md +171 -151
  72. package/docs/architecture/improvement.md +95 -91
  73. package/docs/architecture/internals/classification.md +101 -119
  74. package/docs/architecture/internals/fresh-host-rebuild-runbook.md +33 -35
  75. package/docs/architecture/internals/health-advisories.md +59 -46
  76. package/docs/architecture/internals/improve-workflow.md +166 -693
  77. package/docs/architecture/internals/indexing.md +65 -465
  78. package/docs/architecture/internals/storage-locations.md +301 -848
  79. package/docs/architecture/persisted-data-compat.md +6 -6
  80. package/docs/architecture/specs/okf-support.md +67 -95
  81. package/docs/architecture/specs/ref.md +67 -124
  82. package/docs/architecture/testing/testing-workflow.md +114 -175
  83. package/docs/architecture/workflow-engine.md +34 -33
  84. package/docs/guides/README.md +5 -5
  85. package/docs/guides/author-bundles.md +72 -98
  86. package/docs/guides/author-workflows.md +11 -18
  87. package/docs/guides/bundles.md +91 -123
  88. package/docs/guides/capture-knowledge.md +10 -9
  89. package/docs/guides/concepts.md +45 -30
  90. package/docs/guides/discover-and-load.md +51 -36
  91. package/docs/guides/getting-started.md +27 -26
  92. package/docs/guides/improve-the-library.md +98 -80
  93. package/docs/guides/recipes/headless-install.md +4 -4
  94. package/docs/guides/recipes/website-source.md +9 -5
  95. package/docs/guides/run-workflows.md +10 -11
  96. package/docs/guides/scheduling.md +11 -17
  97. package/docs/guides/use-with-any-agent.md +15 -11
  98. package/docs/guides/wikis.md +6 -9
  99. package/docs/integration/bundling-akm.md +21 -26
  100. package/docs/maintainers/README.md +2 -2
  101. package/docs/maintainers/local-development.md +3 -16
  102. package/docs/maintainers/release-checklist.md +15 -8
  103. package/docs/migration/README.md +2 -1
  104. package/docs/migration/release-notes/0.10.0.md +167 -22
  105. package/docs/migration/release-notes/README.md +2 -2
  106. package/docs/migration/v0.9-to-v0.10.md +47 -7
  107. package/docs/product-surface.md +10 -8
  108. package/docs/reference/README.md +26 -15
  109. package/docs/reference/asset-types.md +11 -12
  110. package/docs/reference/bundle-types.md +6 -5
  111. package/docs/reference/cli.md +74 -31
  112. package/docs/reference/configuration.md +46 -60
  113. package/docs/reference/data-and-telemetry.md +204 -421
  114. package/docs/reference/env-and-secrets.md +80 -83
  115. package/docs/reference/memory.md +1 -1
  116. package/docs/reference/refs.md +23 -36
  117. package/docs/reference/registry.md +138 -348
  118. package/docs/reference/supported-formats.md +8 -8
  119. package/docs/reference/tasks.md +13 -19
  120. package/docs/reference/website-sources.md +23 -15
  121. package/docs/reference/workflow-schema.md +28 -47
  122. package/docs/reference/workflows.md +33 -37
  123. package/package.json +4 -4
  124. package/schemas/akm-config.json +535 -302
package/STABILITY.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Stability policy
2
2
 
3
3
  `akm-cli` follows [Semantic Versioning](https://semver.org/) on the 0.x line
4
- **with one caveat**: until 1.0, minor releases (0.x → 0.x+1) may include
5
- breaking changes.
4
+ **with one caveat**: while the version is 0.x, minor releases (0.x → 0.x+1)
5
+ may include breaking changes.
6
6
 
7
7
  **0.9.x series exception.** The 0.9.x releases are a deliberate refactoring
8
8
  and clean-up series: the goal is to pay off all remaining technical debt and
@@ -87,23 +87,15 @@ please file it.
87
87
  | --- | --- |
88
88
  | **Stable** | Scripted use is supported. Changes are additive within a minor release; breaking changes are called out in the CHANGELOG with a migration note. |
89
89
  | **Evolving** | Available across minor releases, but flag names, prompts, and payload shapes may shift. Breaking changes are flagged in the CHANGELOG. |
90
- | **Experimental** | Subject to change without notice. Not recommended for scripted use. Some experimental surfaces additionally require an explicit opt-in — see [`akm improve` autonomy](#akm-improve-autonomy--opt-in-in-090). |
90
+ | **Experimental** | Subject to change without notice. Not recommended for scripted use. Some experimental surfaces additionally require an explicit opt-in — see [`akm improve` autonomy](#akm-improve-autonomy). |
91
91
  | **Internal** | Not a public interface. May change or disappear in any release, without a CHANGELOG note. Listed here only so you can recognize it. |
92
92
 
93
93
  ## Command tier index
94
94
 
95
95
  The canonical index: every command and subcommand group in the current tree
96
96
  (enumerated from `main.subCommands` in `src/cli.ts` and each group's own
97
- `subCommands`), with its tier. The prose sections below remain the detailed
98
- explanation of *why*; this table is the lookup. Two spots have no single
99
- explicit sentence naming their tier and were resolved by reading neighbors:
100
- `akm bundle show` is assigned Evolving because it is discussed only inside
101
- the Evolving "Bundles & the workspace model" bullet, alongside the still-
102
- shifting adapter set, unlike its sibling `akm bundle list`, which the Stable
103
- section names explicitly; and `akm proposal list` is assigned Stable — the
104
- Stable section names it explicitly ("list filters"), which takes precedence
105
- over its incidental mention inside the Evolving "Improvement loop" bullet's
106
- enumeration of the whole `proposal` noun group.
97
+ `subCommands`), with its tier. The sections below explain what each tier
98
+ covers beyond the table.
107
99
 
108
100
  | Command | Tier | Notes |
109
101
  | --- | --- | --- |
@@ -116,10 +108,11 @@ enumeration of the whole `proposal` noun group.
116
108
  | `akm bundle create` | Stable | |
117
109
  | `akm bundle add` | Stable | |
118
110
  | `akm bundle list` | Stable | |
119
- | `akm bundle show` | Evolving | See note above. |
111
+ | `akm bundle show` | Evolving | |
112
+ | `akm bundle rename` | Stable | |
120
113
  | `akm bundle remove` | Stable | |
121
114
  | `akm bundle update` | Stable | |
122
- | `akm upgrade` | Stable | Including the plugin step and `--next` (0.9.28), verified on real hosts, in empty containers and on failure paths (#1099). |
115
+ | `akm upgrade` | Stable | Including the plugin step and `--next`. Checksum verification is not optional; the recovery hatch is the `AKM_UPGRADE_SKIP_CHECKSUM` environment variable (Internal), not a flag. |
123
116
  | `akm search` | Stable | |
124
117
  | `akm curate` | Stable | |
125
118
  | `akm show` | Stable | |
@@ -137,14 +130,14 @@ enumeration of the whole `proposal` noun group.
137
130
  | `akm registry list` | Evolving | |
138
131
  | `akm registry add` | Evolving | |
139
132
  | `akm registry remove` | Evolving | |
140
- | `akm migrate status` | Internal | Forwards to the standalone `akm-migrate` tool; renders its result through the normal `--format` pipeline (not exempt — see below). Listed (not hidden) in `--help`/completions. |
141
- | `akm migrate apply` | Internal | Forwards to the standalone `akm-migrate` tool; renders its result through the normal `--format` pipeline (not exempt — see below). Listed (not hidden) in `--help`/completions. |
133
+ | `akm migrate status` | Internal | Forwards to the standalone `akm-migrate` tool and renders its result through the normal `--format` pipeline. |
134
+ | `akm migrate apply` | Internal | Forwards to the standalone `akm-migrate` tool and renders its result through the normal `--format` pipeline. |
142
135
  | `akm config path` | Stable | |
143
136
  | `akm config list` | Stable | |
144
- | `akm config get` | Stable | Default bare-value shape unchanged; `--show-source` (0.9.15, opt-in) wraps it as `{ value, source }`. |
137
+ | `akm config get` | Stable | Default bare-value shape unchanged; `--show-source` (opt-in) wraps it as `{ value, source }`. |
145
138
  | `akm config set` | Stable | |
146
139
  | `akm config unset` | Stable | |
147
- | `akm config diff` | Evolving | New in 0.9.15; compares effective (post-`extends`) configs, secrets redacted. |
140
+ | `akm config diff` | Evolving | Compares effective (post-`extends`) configs. |
148
141
  | `akm feedback` | Stable | |
149
142
  | `akm log` | Evolving | |
150
143
  | `akm agent` | Evolving | |
@@ -154,12 +147,12 @@ enumeration of the whole `proposal` noun group.
154
147
  | `akm improve` | Evolving | Review-first by default; mutating lanes require `experimental.improveAutonomy` — see below. |
155
148
  | `akm improve report` | Evolving | Subcommand since 0.10 (was a magic `scope` value); owns `--run` and `--since`. |
156
149
  | `akm improve judge` | Evolving | Subcommand since 0.10 (was a magic `scope` value); reads one revision as JSON on stdin and writes nothing. |
157
- | `akm proposal list` | Stable | See reconciliation note above. |
150
+ | `akm proposal list` | Stable | |
158
151
  | `akm proposal show` | Evolving | |
159
152
  | `akm proposal diff` | Evolving | |
160
153
  | `akm proposal accept` | Evolving | |
161
154
  | `akm proposal reject` | Evolving | |
162
- | `akm proposal reopen` | Evolving | New in 0.9.19; undoes a rejection. |
155
+ | `akm proposal reopen` | Evolving | Undoes a rejection. |
163
156
  | `akm proposal revert` | Evolving | |
164
157
  | `akm proposal drain` | Evolving | |
165
158
  | `akm proposal extract` | Evolving | Former top-level `akm extract`. Promoted from Experimental in 0.10 (#1133): the extract eval measures it. Evolving, not Stable, because 0.10 is still settling the improve defaults. |
@@ -178,9 +171,12 @@ enumeration of the whole `proposal` noun group.
178
171
  | `akm secret run` | Stable | Read-and-inject surface. |
179
172
  | `akm secret set` | Experimental | Write verb. |
180
173
  | `akm task add` | Evolving | |
174
+ | `akm task enable` | Evolving | |
175
+ | `akm task disable` | Evolving | |
181
176
  | `akm task run` | Evolving | |
182
177
  | `akm task history` | Evolving | |
183
178
  | `akm task sync` | Evolving | |
179
+ | `akm task prune` | Evolving | |
184
180
  | `akm task doctor` | Evolving | |
185
181
  | `akm task explain` | Evolving | New in 0.9.2; secret-shaped values in provenance output are redacted on a best-effort heuristic basis (not a guarantee). |
186
182
 
@@ -201,12 +197,12 @@ enumeration of the whole `proposal` noun group.
201
197
  - `#fragment` is **input-only** and never stored. On markdown-document items
202
198
  the core resolves it as a section selector — `akm show <ref>#<heading-slug>`
203
199
  returns that one section, no fragment returns the whole item, and an
204
- unmatched fragment lists the available slugs. Elsewhere it is an
205
- adapter-owned selector opaque to the core. See
200
+ unmatched fragment lists the available slugs. A whole document's `show`
201
+ carries `toc`, every heading with the slug that selects it. On any other item
202
+ `akm show` ignores the fragment with a warning and shows the whole item. See
206
203
  [`docs/architecture/specs/ref.md`](https://github.com/itlackey/akm/blob/main/docs/architecture/specs/ref.md).
207
204
  - **Refs in prose** must be fully qualified (`bundle//conceptId`) or a native
208
- adapter link form. A bare conceptId in prose is ordinary text, not a ref,
209
- and no akm tool rewrites it.
205
+ adapter link form. A bare conceptId in prose is ordinary text, not a ref.
210
206
  - **ConceptId-prefix enumeration** — `akm search "memories/"`,
211
207
  `"memories/projecta/"`, `"bundle//"`, `"bundle//skills/"`. A trailing `/` is
212
208
  required. The prefix matches the **conceptId** — the spelling every emitted
@@ -227,16 +223,11 @@ enumeration of the whole `proposal` noun group.
227
223
  `akm bundle create`, `akm setup`, `akm remember`, `akm feedback`,
228
224
  `akm config set`, `akm config unset`.
229
225
  - **Renames are delete + create** — moving or renaming an item gives it a new
230
- identity; learned state does not follow it. Cross-bundle movement is
231
- copy/import plus delete. The procedure is a plain filesystem move, then
226
+ identity; learned state (feedback, usage, salience) does not follow it.
227
+ Cross-bundle movement is copy/import plus delete. Move the file, then run
232
228
  `akm index`, then `akm lint` to catch inbound refs the move left dangling.
233
- `akm mv` was **removed in 0.9.0**: it claimed to preserve identity across a
234
- rename, but its inbound-ref rewriting targeted bare conceptIds rather than
235
- the anchored `bundle//conceptId` prose form, so it could rewrite non-refs
236
- while leaving real refs dangling. To carry an asset's earned signal
237
- (feedback, usage, salience/outcome history) across a rename, the maintainer
238
- script `scripts/rekey-asset-ref.ts` re-keys those rows old -> new; it is
239
- Internal tooling, not a supported command surface.
229
+ There is no `akm mv`; `scripts/rekey-asset-ref.ts` re-keys earned signal from
230
+ an old ref to a new one and is Internal tooling.
240
231
  - **Asset `type` is a free-form, open string** — `--type` filtering is an
241
232
  exact match against an open set and is deliberately **not validated**: an
242
233
  unrecognized type returns zero hits, not an error. Adapters emit types
@@ -287,14 +278,11 @@ enumeration of the whole `proposal` noun group.
287
278
  | `2` | Usage / bad input |
288
279
  | `4` | Health warning (`akm health` only) |
289
280
  | `70` | Internal / unclassified |
290
- | `75` | Transient — retry shortly (`TransientError`, sysexits `EX_TEMPFAIL`); another akm process holds a lock or is writing `state.db` right now |
281
+ | `75` | Transient — retry shortly (`TransientError`, sysexits `EX_TEMPFAIL`); another akm process holds a lock or is writing `state.db` or `index.db` right now |
291
282
  | `78` | Configuration error |
292
283
 
293
- **From 0.9.12**, every success envelope produced by the passthrough stamp
294
- (`config`, `clone`, `models`, `task-*`, `workflow-*`, `registry-*`, …) also
295
- carries `ok: true`; a command that already computes its own `ok` keeps it.
296
- - **Install scripts** — `install.sh` and `install.ps1` URLs; the `--prefix`
297
- / `AKM_INSTALL_DIR` environment override.
284
+ - **Install scripts** — the `install.sh` and `install.ps1` URLs and the
285
+ `AKM_INSTALL_DIR` environment override.
298
286
  - **Runtime** — the npm package requires Node.js >= 22 as its bootstrap and
299
287
  prefers a working Bun >= 1.0 for execution when both are available; old,
300
288
  unusable, or absent Bun installations fall back to Node.js. Standalone
@@ -322,7 +310,7 @@ CHANGELOG with a migration note.
322
310
  options or tighten validation across releases. `akm improve` stays on by
323
311
  default and is **review-first**: the lanes that mutate assets without review
324
312
  require `experimental.improveAutonomy` — see
325
- [`akm improve` autonomy](#akm-improve-autonomy--opt-in-in-090).
313
+ [`akm improve` autonomy](#akm-improve-autonomy).
326
314
  `--auto-accept` was removed in 0.9.0 and is an unknown flag (a usage error,
327
315
  exit 2) since 0.10. The replacement is
328
316
  `akm improve && akm proposal drain --promote --yes`, or a `triage` block
@@ -332,9 +320,9 @@ CHANGELOG with a migration note.
332
320
  routine sessions left empty, planted instructions refused) is its gate. It
333
321
  is Evolving, not Stable, because 0.10 is still settling the improve
334
322
  defaults; what it extracts and its output may still be tuned.
335
- - **Tasks** — `akm task` subcommand surface (`add | run | sync | doctor |
336
- history | explain | validate`; no alias, no
337
- `list`/`remove`/`init`/`enable`/`disable`); task source v4 YAML (typed
323
+ - **Tasks** — `akm task` subcommand surface (`add | enable | disable | run |
324
+ explain | history | sync | prune | doctor`; no alias, no
325
+ `list`/`remove`/`init`/`validate`); task source v4 YAML (typed
338
326
  `inputs:`, optional `schedule:`) is the only accepted version — task v3 and
339
327
  task v2 sources are converted by `akm migrate apply`. Command tasks use
340
328
  a named connection or harness, and task history metadata is versioned. Schema additions in
@@ -366,7 +354,7 @@ CHANGELOG with a migration note.
366
354
  `akm bundle list` / `akm bundle show <name>` and enumerated through
367
355
  `akm search "bundle//"`. (An earlier `akm bundle items` noun group was
368
356
  removed in 0.9.0 as duplicative of `akm search`; the current `akm bundle`
369
- group — `create | add | list | show | remove | update` — is the
357
+ group — `create | add | list | show | rename | remove | update` — is the
370
358
  lifecycle-management surface consolidated from the former top-level
371
359
  `init`/`add`/`list`/`remove`/`update` commands, not a revival of that one.)
372
360
  OKF is the
@@ -396,11 +384,6 @@ CHANGELOG with a migration note.
396
384
  `akm search --from registry` (0.9.0: `registry search` was folded into
397
385
  `search`). Building a registry index is maintainer tooling (Internal) and
398
386
  lives outside the CLI, in `scripts/build-registry-index.ts`.
399
- - **Upgrade** — `akm upgrade`. Checksum verification is not optional; the
400
- recovery hatch is the `AKM_UPGRADE_SKIP_CHECKSUM` environment variable
401
- (Internal), not a flag. The harness plugin step and `--next` (new in 0.9.28)
402
- are targeted to become Stable before the 0.9 series ends, once verified on
403
- real hosts.
404
387
  - **Lint** — `akm lint`. The rule set and finding shapes iterate; the
405
388
  `--fail-on-flagged` CI contract and the exit codes are stable.
406
389
  - **Health** — `akm health` and its exit codes (0 pass / 4 warn / 1 fail) are
@@ -456,8 +439,8 @@ for scripted use.
456
439
  **write** verbs (`create`, `set`, `unset`, `remove`) are Experimental; the
457
440
  `list` / `path` / `run` / `export` read-and-inject surface is Stable.
458
441
  - **Memory belief-state transitions** — `captureMode`, `beliefState`,
459
- contradiction edges, and the consolidate journal are observable but
460
- the algorithm that writes them is tuning across patch releases.
442
+ contradiction edges, and the consolidate journal are observable, but the
443
+ algorithm that writes them is tuning across patch releases.
461
444
  - **Improve built-in strategies and lanes** — the built-in strategies other
462
445
  than `default` and `consolidate` and the proactive-maintenance lane. 0.10 measures each and keeps, folds or removes it
463
446
  (#1094). `quick`, `reflect-distill`, `thorough` and `catchup` were removed
@@ -469,17 +452,18 @@ for scripted use.
469
452
  added, renamed, or dropped in any 0.9.x or 0.10.x release**. The `akm
470
453
  improve` *command* surface is Evolving (above); its tuning config is not.
471
454
 
472
- ### `akm improve` autonomy — opt-in in 0.9.0
455
+ ### `akm improve` autonomy
473
456
 
474
- **`akm improve` is review-first by default in 0.9.0.** The command itself is ON
475
- — its schedules and reflect/distill proposals all run — but the lanes that
476
- mutate assets *without* review require an explicit opt-in:
457
+ `akm improve` is review-first by default. The command is on — its schedules and
458
+ reflect/distill proposals all run — but the lanes that change assets *without*
459
+ review require an explicit opt-in:
477
460
 
478
461
  ```sh
479
462
  akm config set experimental.improveAutonomy true
480
463
  ```
481
464
 
482
- Without it, these three lanes are downgraded (the triage lane only when its
465
+ An absent `experimental` section, an absent key and an explicit `false` all
466
+ read as off. Without the opt-in, these three lanes are downgraded (the triage lane only when its
483
467
  judgment tier is on), and each downgrade is **reported,
484
468
  not silent**: it warns on stderr naming the lane and the key, appends an
485
469
  `improve_skipped` event with `reason: "autonomy_gated"`, is counted in
@@ -516,39 +500,28 @@ Because the gate is applied before the LLM preflight, a review-first workspace
516
500
  also needs fewer connections or harnesses configured: a strategy whose only
517
501
  model-backed process is a gated lane resolves without one at all.
518
502
 
519
- **Three direct writes are deliberately NOT gated**, because they are additive or
520
- already independently controlled:
503
+ Reflect, distill, extract candidates, validation and proactive-maintenance
504
+ selection only stage proposals. These writes are not gated by the opt-in:
521
505
 
522
- | Write | Why it stays ungated |
506
+ | Write | What it does |
523
507
  | --- | --- |
524
- | `extract` session indexing | Additive `sessions/**` writes; nothing is overwritten or deleted |
525
- | distill's encoding-salience stamp | Frontmatter metadata only |
526
- | `sync.push` | Publishes already-committed content to a remote the user configured for that purpose, and has its own `improve.strategies.<name>.sync.push: false` and `--no-push` |
527
-
528
- Autonomy is never inferred: an absent `experimental` section, an absent key, and
529
- an explicit `false` all read as off, so a partially-written or older config is
530
- review-first rather than accidentally permissive.
531
-
532
- Reflect, distill, extract candidates, validation, and proactive-maintenance
533
- selection are proposal-only and never write assets directly. Two further
534
- direct writes are ungated by design: `extract`'s session
535
- indexing (additive `sessions/**` writes,
536
- `processes.extract.indexSessions`, default on) and distill's
537
- encoding-salience frontmatter stamp (metadata only).
508
+ | `extract` session indexing | Writes `sessions/**` assets (`processes.extract.indexSessions`, default on) |
509
+ | distill's encoding-salience stamp | Writes a salience score to asset frontmatter |
510
+ | Graced archive purge | At the start of every improve run, removes retirement archives past the grace period |
511
+ | Accept commits | Accepting a proposal commits its paths when the bundle is a git repository |
512
+ | `sync.push` | Pushes already-committed content to the configured remote; turn it off with `improve.strategies.<name>.sync.push: false` or `--no-push` |
538
513
 
539
514
  ## Internal
540
515
 
541
516
  Not public interfaces. Listed so you can recognize them, not so you can rely
542
517
  on them.
543
518
 
544
- - **Migration surfaces** — the standalone `akm-migrate` tool owns the one-time
545
- 0.8→0.9 cutover, storage migration, and recovery backups (`akm-migrate
546
- backup` / `restore`). `akm migrate` is a thin process forwarder; `akm backup`
547
- and `akm config migrate` are removed. `akm help migrate <version>` is Stable
548
- and only renders release notes.
519
+ - **Migration surfaces** — the standalone `akm-migrate` tool (`status`,
520
+ `apply`) rewrites config, `state.db`, task files and old on-disk residue to
521
+ the current shape, taking a backup first. `akm migrate` is a thin process
522
+ forwarder for it.
549
523
  - **`bun scripts/build-registry-index.ts`** — maintainer tooling for building a
550
- registry index. It is a repository script, not a CLI command (the former
551
- `akm registry build-index` subcommand was removed).
524
+ registry index. It is a repository script, not a CLI command.
552
525
  - **Environment variables** — see the table below.
553
526
 
554
527
  ### Environment variables
@@ -559,10 +532,9 @@ on them.
559
532
  | --- | --- |
560
533
  | `AKM_BUNDLE_DIR`, `AKM_CONFIG_DIR`, `AKM_DATA_DIR`, `AKM_CACHE_DIR` | Filesystem layout overrides |
561
534
  | `AKM_VERBOSE`, `AKM_DEBUG` | Diagnostics |
562
- | `AKM_REGISTRY_URL` | akm registry mirror override |
563
- | `AKM_NPM_REGISTRY` | npm mirror override — redirects BOTH the trusted-tarball host allowlist and package metadata lookups (`npm view`-equivalent resolution) to the given registry base, replacing `registry.npmjs.org` wholesale rather than merging with it |
535
+ | `AKM_REGISTRY_URL` | Comma-separated registry URL override; replaces the configured registries in every registry search akm performs (`akm registry list` and `akm info` still show the configured list) |
536
+ | `AKM_NPM_REGISTRY` | npm mirror base URL; replaces `registry.npmjs.org` for package lookups |
564
537
  | `AKM_SQLITE_JOURNAL_MODE` | SQLite journal mode (network filesystems) |
565
- | `AKM_BIN` | Absolute `akm` path for scheduler registration |
566
538
  | `AKM_INSTALL_DIR` | Install-script prefix |
567
539
  | `AKM_UPGRADE_SKIP_CHECKSUM` | Recovery hatch for a broken upgrade checksum |
568
540
 
@@ -571,18 +543,6 @@ on them.
571
543
  `AKM_EMBED_DETERMINISTIC`, `AKM_CLAUDE_PROJECTS_DIR`,
572
544
  `AKM_FORCE_INIT_TMP_STASH`, `AKM_STATE_DIR`.
573
545
 
574
- Anything matching `AKM_TEST_*` is test-only fault injection. Never set it.
575
- `AKM_VERSION` is the only variable actually stripped from release builds, via
576
- `bun build --define` (see `.github/workflows/release.yml`); no `src/` code
577
- reads an `AKM_TEST_*` variable, so the compiled `akm` binary itself carries
578
- none. That said, three fault-injection hooks are NOT compiled out and DO ship
579
- in every install: `AKM_TEST_MIGRATION_FAIL_INDEX_QUARANTINE`,
580
- `AKM_TEST_MIGRATION_FAIL_WORKFLOW_DELETE`, and
581
- `AKM_TEST_MIGRATION_FAIL_RESTORE_AFTER` (`scripts/akm-migrate/`). The migration
582
- tool ships separately from the compiled `akm` binary, so these throw-only hooks
583
- remain physically present. At rest they are runtime-guarded no-ops unless the
584
- exact internal test value is set. Never set them.
585
-
586
546
  ## On the horizon
587
547
 
588
548
  These changes are planned and will land in a known future release. They
@@ -618,8 +578,8 @@ worth fixing.
618
578
  ## See also
619
579
 
620
580
  - [`CHANGELOG.md`](./CHANGELOG.md) — every release's behavior changes.
621
- - [`SECURITY.md`](./SECURITY.md) — security supported-version policy
622
- (independent of the feature-stability policy above).
581
+ - [`SECURITY.md`](./SECURITY.md) — supported versions and how to report a
582
+ vulnerability.
623
583
  - [`docs/architecture/specs/ref.md`](https://github.com/itlackey/akm/blob/main/docs/architecture/specs/ref.md) — the
624
584
  normative ref grammar.
625
585
  - [`docs/reference/data-and-telemetry.md`](./docs/reference/data-and-telemetry.md) — what
@@ -49,7 +49,9 @@ akm curate "review architecture" --type workflow # Restrict to one asset type
49
49
  ## Show
50
50
 
51
51
  Display an asset by ref from the local index and materialized bundle files only.
52
- On a markdown document `#fragment` selects one section by heading slug.
52
+ On a markdown document `#fragment` selects one section by heading slug. For a
53
+ large document, `akm show <ref> --detail brief` returns its outline (`toc`, no
54
+ body); then `akm show <ref>#<slug>` reads only the sections you need.
53
55
 
54
56
  ```sh
55
57
  akm show scripts/deploy.sh # Show script (returns run command)
@@ -57,9 +59,9 @@ akm show skills/code-review # Show skill (returns full content
57
59
  akm show commands/release # Show command (returns template)
58
60
  akm show agents/architect # Show agent (returns system prompt)
59
61
  akm show workflows/ship-release # Show parsed workflow steps
60
- akm show knowledge/guide # Whole document
62
+ akm show knowledge/guide # Whole document, plus its `toc`
63
+ akm show knowledge/guide --detail brief # Outline only: `toc` (level, text, slug, startLine), no body
61
64
  akm show knowledge/guide#auth # Just the "Auth" section
62
- akm show knowledge/guide#nope # Lists the available fragment slugs
63
65
  akm show knowledge/my-doc # Show materialized local content
64
66
  ```
65
67
 
@@ -69,7 +71,7 @@ akm show knowledge/my-doc # Show materialized local content
69
71
  | skill | `content` (full SKILL.md) |
70
72
  | command | `template`, `description`, `parameters` |
71
73
  | agent | `prompt`, `description`, `modelHint` |
72
- | knowledge | `content` (whole document, or one section via `#fragment`) |
74
+ | knowledge | `content` (whole document, or one section via `#fragment`); `toc` (each heading's `slug`) on a whole document |
73
75
  | workflow | `workflowTitle`, `workflowParameters`, `steps` |
74
76
  | memory | `content` (recalled context) |
75
77
  | env | `keys` (key names only — values and comment text never returned) |
@@ -6,7 +6,7 @@ You have access to a searchable library of scripts, skills, commands, agents, kn
6
6
 
7
7
  For any task, follow this loop:
8
8
  1. `akm curate "<task>"` — find the best matching asset
9
- 2. `akm show <ref>` — read the schema (field names and structure)
9
+ 2. `akm show <ref>` — read the schema (field names and structure). For a large document, `akm show <ref> --detail brief` returns its outline (`toc`, no body); then `akm show <ref>#<slug>` reads only the sections you need.
10
10
  3. Edit the workspace file using schema field names + task-specific values from your README
11
11
  4. `akm feedback <ref> --positive` — record that the asset helped (it raises its ranking and does not trigger a rewrite). Record negative feedback only when the asset's content is wrong or stale, and say what is wrong and what it should say. `akm feedback <ref> --negative --reason "<what is wrong and what should change>"` flags it: the next improve run may repair its description, title or `when_to_use` from your reason, but not its text. A note that simply did not fit your task is not negative feedback: record nothing for it. Once you have verified the correct fact, add the exact fix: `--replace "<exact current text>" --with "<corrected text>" --source "<URL, command or file>"`. A note that is outdated can be marked with `--outdated`, or `--superseded-by <ref>` when another note replaces it. A failed akm command (e.g. `akm show` erroring) is not feedback on the asset — don't record it.
12
12
 
@@ -27,6 +27,8 @@ akm search "<query>" --type workflow # Filter to workflow assets
27
27
  akm search "memories/projectA/" # List a subtree (conceptId prefix; trailing slash required)
28
28
  akm search "<query>" --from all # Also search registries
29
29
  akm show <ref> # View asset details
30
+ akm show <ref> --detail brief # Outline only: a document's `toc` (each heading's slug), no body
31
+ akm show <ref>#<slug> # One section of a document
30
32
  akm help <command> # Show a command's options and subcommands
31
33
  akm workflow run <ref> # Start a new run and execute it
32
34
  akm remember "Deployment needs VPN access" # Record a memory in your bundle
@@ -58,7 +60,7 @@ akm search "<query>" --from registry # Search all registries (registry
58
60
  | skill | Instructions to follow (read the full content) |
59
61
  | command | A prompt template with placeholders to fill in |
60
62
  | agent | A system prompt with model and tool hints |
61
- | knowledge | A reference doc (append `#<heading-slug>` to the ref to read one section) |
63
+ | knowledge | A reference doc; `toc` lists its sections and `<ref>#<slug>` reads one |
62
64
  | workflow | Parsed steps plus workflow-specific execution commands |
63
65
  | memory | Recalled context (read the content for background information) |
64
66
  | env | A `.env` file of configuration an app loads together (many vars; sensitive or not — all protected); key names only. Inject with `akm env run <ref> -- <cmd>` (the agent-safe path — values stay on disk). |
@@ -6,11 +6,11 @@
6
6
  // it in the inline config's `plugins` list (src/integrations/harnesses/opencode/runtime/). It runs inside OpenCode, so
7
7
  // it imports no package: only Node's own child_process, to call back into akm.
8
8
  //
9
- // - akm's three read tools, each a run of the akm that started OpenCode, with `--detail agent --format json`. akm
10
- // passes the argv that runs it in `AKM_OPENCODE_CLI`, a JSON array: the executable alone for a compiled akm, the
11
- // runtime and the script for one run as a script (Node and `dist/akm`, say), so no shebang or shell is needed on
12
- // any platform. The run's environment is the call's, so a stamped run's reads (`AKM_EVENT_SOURCE`) are recorded as
13
- // that run's.
9
+ // - akm's three read tools, each a run of the akm that started OpenCode, with `--detail agent --format json`
10
+ // (`--detail brief` when akm_show asks for a document's outline). akm passes the argv that runs it in
11
+ // `AKM_OPENCODE_CLI`, a JSON array: the executable alone for a compiled akm, the runtime and the script for one
12
+ // run as a script (Node and `dist/akm`, say), so no shebang or shell is needed on any platform. The run's
13
+ // environment is the call's, so a stamped run's reads (`AKM_EVENT_SOURCE`) are recorded as that run's.
14
14
  // - The environment of the commands the agent runs: the variables akm set for the OpenCode process (its roots and
15
15
  // its OpenCode settings) are put back to what akm runs in, or removed, so the agent's shell sees the environment a
16
16
  // harness's child would.
@@ -59,8 +59,16 @@ const TOOLS = [
59
59
  name: "akm_show",
60
60
  command: "show",
61
61
  positional: "ref",
62
- description: "Read one akm asset by its ref, as returned by akm_curate or akm_search.",
63
- input: { type: "object", properties: { ref: { type: "string" } }, required: ["ref"] },
62
+ description:
63
+ 'Read one akm asset by its ref, as returned by akm_curate or akm_search. For a large document, call it with detail "brief" for its outline (toc, no body), then with ref#<slug> for only the sections you need.',
64
+ input: {
65
+ type: "object",
66
+ properties: {
67
+ ref: { type: "string" },
68
+ detail: { type: "string", enum: ["brief"], description: "brief: the outline (toc) without the body" },
69
+ },
70
+ required: ["ref"],
71
+ },
64
72
  },
65
73
  ];
66
74
 
@@ -78,7 +86,7 @@ function cliArguments(tool, input) {
78
86
  ...(type && tool.positional !== "ref" ? ["--type", type] : []),
79
87
  ...(limit && tool.positional !== "ref" ? ["--limit", limit] : []),
80
88
  "--detail",
81
- "agent",
89
+ tool.positional === "ref" && input?.detail === "brief" ? "brief" : "agent",
82
90
  "--format",
83
91
  "json",
84
92
  ];
@@ -9,7 +9,9 @@ Ground rules for this unit:
9
9
 
10
10
  1. Pull knowledge on demand instead of guessing: `akm search '<query>'` to find
11
11
  relevant assets, `akm show <ref>` to read one, `akm curate '<query>'` to let
12
- akm select the best match. Only pull what this unit actually needs.
12
+ akm select the best match. Only pull what this unit actually needs: for a
13
+ large document, `akm show <ref> --detail brief` returns its outline (`toc`,
14
+ no body), then `akm show <ref>#<slug>` reads one section.
13
15
  2. Environment values and secrets are provided through your process
14
16
  environment when the workflow declares them. Never print secret values to
15
17
  stdout or embed them in your answer. If you need an env file path, use
@@ -72,8 +72,8 @@ xrefs:
72
72
  ## Self-situating headers and canonical naming
73
73
 
74
74
  Put the one-line orientation in `description:` and the trigger conditions in
75
- `when_to_use:` — those remain the higher-weight indexed fields. Bounded body
76
- prose is indexed in the lowest-weight `content` field, so
75
+ `when_to_use:`; both are indexed, and search weighs every indexed field
76
+ equally. Bounded body prose is indexed in the `content` field.
77
77
  `description:`/`when_to_use:` remain the primary orientation channel. Then
78
78
  open the body with a plain title plus a one-line
79
79
  orientation naming what it is, its scope/domain, and its key entities in
@@ -23,11 +23,10 @@ path is therefore the one facet you **cannot express twice and cannot change
23
23
  without breaking the ref** — so spend it deliberately, on exactly one axis.
24
24
 
25
25
  Retrieval is search, not browse: no one walks these folders at query time. A
26
- subdirectory buys you three things: its tokens are indexed as part of the
27
- asset's **name** (the highest-weighted search field), they are auto-added to
28
- `tags` (even when you set `tags` explicitly), and for scope-born types a slug
29
- matching the current repo's name earns an automatic in-project ranking boost.
30
- Every other facet belongs in frontmatter, where the index can actually read it.
26
+ subdirectory buys you two things: its tokens are indexed as part of the
27
+ asset's **name**, and they are auto-added to `tags` (even when you set `tags`
28
+ explicitly). Search weighs every indexed field equally. Every other facet
29
+ belongs in frontmatter, where the index can actually read it.
31
30
 
32
31
  ## Choose the partition axis by asset TYPE, not per-asset judgment
33
32
 
@@ -38,9 +37,8 @@ differently and bake the wrong guess into an immutable ref. Decide by type:
38
37
  `memory`, `lesson`, `task`, `env`, `secret`. These are born bound to the work
39
38
  in front of you, so the working context *is* the answer — no judgment needed.
40
39
  When the scope is a single repo, use its repo/package name as the slug (as
41
- `git remote`/package.json spell it) — ranking auto-boosts assets whose name
42
- or tags match the current repo. Client/team slugs get no such boost; just
43
- reuse the existing spelling.
40
+ `git remote`/package.json spell it). For a client or team slug, reuse the
41
+ existing spelling.
44
42
  - `memories/projectA/auth-token-refresh`
45
43
  - `lessons/clientX/migration-rollback-gotcha`
46
44
  - `secrets/clientX/api-key`
@@ -58,11 +56,8 @@ differently and bake the wrong guess into an immutable ref. Decide by type:
58
56
  the type root — if any single project would break when it changes, it is
59
57
  scope-born.
60
58
 
61
- **Why reuse types don't take the project axis:** project relevance is already
62
- recovered at query time — AKM blends a per-project usage signal into ranking
63
- (scoped utility, keyed off the current repo, not the asset's path). Free the
64
- scarce path segment for the domain — the *only* handle that co-locates
65
- cross-project reuse.
59
+ **Why reuse types don't take the project axis:** free the scarce path segment
60
+ for the domain — the *only* handle that co-locates cross-project reuse.
66
61
 
67
62
  ## Placement rules
68
63
 
@@ -86,16 +81,15 @@ cross-project reuse.
86
81
  (`acme` vs `acme-corp`) so the prefix does not fragment. Keep the domain
87
82
  vocabulary in `facts/conventions/domains`.
88
83
  - **Off-axis facets go in `tags:`, not a bare field.** The indexed FTS fields are
89
- name, description, tags, hints, and bounded low-weight body content — there is **no `project`
84
+ name, description, tags, hints, and bounded body content — there is **no `project`
90
85
  field**, so `project: projectA` in
91
86
  frontmatter is invisible to search. Put the off-axis facet in `tags` instead
92
87
  (a project-scoped memory adds `tags: [auth]`; a domain-scoped asset genuinely
93
88
  tied to a project adds `tags: [projectA]` sparingly).
94
89
  - **Directory tokens join `tags` on their own.** The scope/domain segments of
95
90
  the path are always auto-added to `tags` — even when you set `tags`
96
- explicitly — so there is no need to restate them; the tag-match ranking
97
- boost fires for the scope token either way. Filename tokens are auto-added
98
- only when `tags` is empty.
91
+ explicitly — so there is no need to restate them. Filename tokens are
92
+ auto-added only when `tags` is empty.
99
93
 
100
94
  ## Renames and evolution
101
95