akm-cli 0.9.30 → 0.9.32

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 (165) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +10 -10
  3. package/ROADMAP.md +112 -0
  4. package/dist/commands/feedback-cli.js +21 -13
  5. package/dist/commands/improve/improve-cli.js +33 -12
  6. package/dist/core/errors.js +1 -0
  7. package/dist/core/file-lock.js +10 -1
  8. package/dist/indexer/usage/usage-events.js +6 -2
  9. package/dist/llm/client.js +33 -3
  10. package/dist/scripts/akm-migrate-node.js +6 -1
  11. package/dist/scripts/akm-migrate.js +6 -1
  12. package/docs/README.md +42 -41
  13. package/docs/agents/README.md +15 -0
  14. package/docs/agents/agent-install.md +14 -0
  15. package/docs/architecture/README.md +67 -0
  16. package/docs/architecture/adapters.md +272 -0
  17. package/docs/architecture/akm-architecture-decision-history.md +2055 -0
  18. package/docs/architecture/akm-core-principles.md +126 -0
  19. package/docs/architecture/architecture.md +579 -0
  20. package/docs/architecture/comparisons/claude-code-vs-akm-workflows-full.md +550 -0
  21. package/docs/architecture/decisions/0001-no-interpolation-attached-structured-context.md +72 -0
  22. package/docs/architecture/decisions/0002-unit-reuse-and-input-hash-scope.md +142 -0
  23. package/docs/architecture/decisions/0003-child-env-allowlist-and-provenance.md +189 -0
  24. package/docs/architecture/decisions/0004-task-input-contract-and-flag-coercion.md +97 -0
  25. package/docs/architecture/decisions/0005-task-result-vocabulary-and-legacy-read-mapping.md +108 -0
  26. package/docs/architecture/decisions/0006-task-source-version-routing.md +124 -0
  27. package/docs/architecture/decisions/0007-workflow-composition-bounds.md +83 -0
  28. package/docs/architecture/decisions/0008-task-binding-normalization.md +88 -0
  29. package/docs/architecture/decisions/0009-child-run-publication-column-parity.md +80 -0
  30. package/docs/architecture/decisions/0010-driver-protocol-cut.md +36 -0
  31. package/docs/architecture/decisions/0011-engine-run-loop-invariants.md +125 -0
  32. package/docs/architecture/decisions/README.md +62 -0
  33. package/docs/architecture/improvement.md +440 -0
  34. package/docs/architecture/internals/classification.md +154 -0
  35. package/docs/architecture/internals/fresh-host-rebuild-runbook.md +40 -0
  36. package/docs/architecture/internals/functional-contract-patterns.md +340 -0
  37. package/docs/architecture/internals/health-advisories.md +110 -0
  38. package/docs/architecture/internals/improve-workflow.md +713 -0
  39. package/docs/architecture/internals/indexing.md +498 -0
  40. package/docs/architecture/internals/registry-network-boundary.md +57 -0
  41. package/docs/architecture/internals/search.md +249 -0
  42. package/docs/architecture/internals/storage-locations.md +943 -0
  43. package/docs/architecture/persisted-data-compat.md +59 -0
  44. package/docs/architecture/reviews/env-secret-access.md +319 -0
  45. package/docs/architecture/runtime-boundary-design.md +153 -0
  46. package/docs/architecture/specs/0.9.0-close-out-plan.md +361 -0
  47. package/docs/architecture/specs/0.9.0-decisions.md +528 -0
  48. package/docs/architecture/specs/0.9.0-docs-code-drift-register.md +745 -0
  49. package/docs/architecture/specs/0.9.0-open-items-register.md +135 -0
  50. package/docs/architecture/specs/0.9.0-public-api-issue-backlog.md +740 -0
  51. package/docs/architecture/specs/0.9.0-release-surface-review.md +636 -0
  52. package/docs/architecture/specs/agent-command-engine-model-design.md +513 -0
  53. package/docs/architecture/specs/akm-0.9.0-bundle-adapter-spec.md +501 -0
  54. package/docs/architecture/specs/akm-0.9.0-ref-grammar-decision.md +291 -0
  55. package/docs/architecture/specs/akm-format-neutral-bundle-workspace-spec.md +2059 -0
  56. package/docs/architecture/specs/di-seams-plan.md +539 -0
  57. package/docs/architecture/specs/driver-protocol-keep-or-cut.md +275 -0
  58. package/docs/architecture/specs/fact-asset-type.md +142 -0
  59. package/docs/architecture/specs/improve-collapse-churn-detector-design.md +634 -0
  60. package/docs/architecture/specs/okf-support.md +148 -0
  61. package/docs/architecture/specs/ref.md +329 -0
  62. package/docs/architecture/specs/reviews/task-workflow-unification/README.md +72 -0
  63. package/docs/architecture/specs/reviews/task-workflow-unification/findings-consolidated.md +152 -0
  64. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-alternatives.md +352 -0
  65. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-bunqueue.md +300 -0
  66. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-openworkflow.md +402 -0
  67. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-1.md +758 -0
  68. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-2.md +645 -0
  69. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-3.md +602 -0
  70. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-adversarial.md +27 -0
  71. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-architecture.md +27 -0
  72. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-coverage.md +74 -0
  73. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-security.md +15 -0
  74. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-adversarial.md +132 -0
  75. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-verification.md +147 -0
  76. package/docs/architecture/specs/stash-conventions-code-spec.md +275 -0
  77. package/docs/architecture/specs/stash-organization-conventions.md +377 -0
  78. package/docs/architecture/specs/task-workflow-format-unification.md +721 -0
  79. package/docs/architecture/specs/workflow-engine-buy-vs-build.md +231 -0
  80. package/docs/architecture/specs/workflow-format-unification.md +437 -0
  81. package/docs/architecture/testing/manual-testing-checklist.md +3420 -0
  82. package/docs/architecture/testing/okf-v0.2-conformance-runbook.md +924 -0
  83. package/docs/architecture/testing/task-workflow-manual-tests.md +1817 -0
  84. package/docs/architecture/testing/testing-workflow.md +446 -0
  85. package/docs/architecture/workflow-engine.md +274 -0
  86. package/docs/guides/README.md +33 -0
  87. package/docs/guides/author-bundles.md +310 -0
  88. package/docs/guides/author-workflows.md +520 -0
  89. package/docs/guides/bundles.md +321 -0
  90. package/docs/guides/capture-knowledge.md +136 -0
  91. package/docs/guides/claude-code-vs-akm-workflows.md +30 -0
  92. package/docs/guides/concepts.md +93 -0
  93. package/docs/guides/discover-and-load.md +158 -0
  94. package/docs/guides/getting-started.md +240 -0
  95. package/docs/guides/improve-the-library.md +246 -0
  96. package/docs/guides/knowledge-management.md +18 -0
  97. package/docs/guides/recipes/headless-install.md +97 -0
  98. package/docs/guides/recipes/website-source.md +28 -0
  99. package/docs/guides/run-workflows.md +279 -0
  100. package/docs/guides/scheduling.md +123 -0
  101. package/docs/guides/use-with-any-agent.md +129 -0
  102. package/docs/guides/wikis.md +81 -0
  103. package/docs/maintainers/README.md +19 -0
  104. package/docs/maintainers/curate-workmap.md +336 -0
  105. package/docs/maintainers/eval.md +3 -0
  106. package/docs/maintainers/local-development.md +108 -0
  107. package/docs/maintainers/release-checklist.md +103 -0
  108. package/docs/migration/README.md +2 -2
  109. package/docs/migration/release-notes/0.0.13.md +1 -1
  110. package/docs/migration/release-notes/0.1.0.md +1 -1
  111. package/docs/migration/release-notes/0.2.0.md +1 -1
  112. package/docs/migration/release-notes/0.3.0.md +1 -1
  113. package/docs/migration/release-notes/0.5.0.md +1 -1
  114. package/docs/migration/release-notes/0.6.0.md +1 -1
  115. package/docs/migration/release-notes/0.7.0.md +1 -1
  116. package/docs/migration/release-notes/0.7.3.md +2 -2
  117. package/docs/migration/release-notes/0.7.4.md +1 -1
  118. package/docs/migration/release-notes/0.7.5.md +1 -1
  119. package/docs/migration/release-notes/0.8.0.md +1 -1
  120. package/docs/migration/release-notes/0.9.0.md +1 -1
  121. package/docs/migration/release-notes/0.9.14.md +1 -1
  122. package/docs/migration/release-notes/0.9.15.md +1 -1
  123. package/docs/migration/release-notes/0.9.16.md +1 -1
  124. package/docs/migration/release-notes/0.9.17.md +1 -1
  125. package/docs/migration/release-notes/0.9.19.md +1 -1
  126. package/docs/migration/release-notes/0.9.2.md +1 -1
  127. package/docs/migration/release-notes/README.md +27 -31
  128. package/docs/migration/v0.5-to-v0.6.md +759 -0
  129. package/docs/migration/v0.8-to-v0.9.md +1 -1
  130. package/docs/plans/0.9.2-agent-command-workflow-plan.md +423 -0
  131. package/docs/posts/README.md +30 -0
  132. package/docs/posts/akm-command-tour.md +495 -0
  133. package/docs/posts/akm-logo-sized.webp +0 -0
  134. package/docs/posts/belief-aware-memory-12.md +139 -0
  135. package/docs/posts/config-v2-lessons-16.md +191 -0
  136. package/docs/posts/improve-loop-autonomous-10.md +225 -0
  137. package/docs/posts/improve-pipeline-debugging-0803.md +179 -0
  138. package/docs/posts/intro-part-01.md +76 -0
  139. package/docs/posts/intro-part-02.md +221 -0
  140. package/docs/posts/intro-part-03.md +190 -0
  141. package/docs/posts/intro-part-04.md +221 -0
  142. package/docs/posts/llm-mode-reflect-13.md +166 -0
  143. package/docs/posts/openpalm-built-on-akm.md +86 -0
  144. package/docs/posts/progressive-disclosure-06.md +129 -0
  145. package/docs/posts/proposal-safety-net-15.md +112 -0
  146. package/docs/posts/release-0.5.0.md +247 -0
  147. package/docs/posts/release-0.6.0.md +117 -0
  148. package/docs/posts/release-0.7.0.md +159 -0
  149. package/docs/posts/release-0.8.0.md +332 -0
  150. package/docs/posts/scattered-skills-05.md +100 -0
  151. package/docs/posts/task-assets-persistent-workflows-11.md +222 -0
  152. package/docs/posts/team-skills-07.md +198 -0
  153. package/docs/posts/wiki-agent-knowledge-08.md +223 -0
  154. package/docs/posts/workflows-vaults-09.md +321 -0
  155. package/docs/product-surface.md +54 -0
  156. package/docs/reference/README.md +1 -2
  157. package/docs/reference/asset-types.md +168 -0
  158. package/docs/reference/cli.md +5 -6
  159. package/docs/reference/data-and-telemetry.md +6 -0
  160. package/docs/reference/env-and-secrets.md +126 -0
  161. package/docs/reference/memory.md +124 -0
  162. package/docs/reference/refs.md +156 -0
  163. package/docs/reference/registry.md +489 -0
  164. package/docs/reference/website-sources.md +141 -0
  165. package/package.json +12 -15
@@ -0,0 +1,158 @@
1
+ # Discover and Load
2
+
3
+ Load only what the current task needs. Agents rarely know the exact name of
4
+ the asset they need, and front-loading every skill, script, and doc into the
5
+ prompt wastes context on capability the task will never touch. akm keeps the
6
+ full library indexed and searchable, then lets an agent pull a shortlist,
7
+ inspect one candidate, and load exactly the ref (or document section) the
8
+ task requires — nothing more.
9
+
10
+ ## End-to-end example
11
+
12
+ An agent picks up the task "deploy the app to staging." It doesn't know
13
+ whether a script, a workflow, or a skill covers this, so it starts broad,
14
+ narrows to a ref, and loads that ref's content:
15
+
16
+ ```sh
17
+ akm curate "deploy the app to staging" --shape agent
18
+ # → ranked shortlist; top hit: {"type":"script","ref":"scripts/deploy.sh","score":0.91,...}
19
+
20
+ akm show scripts/deploy.sh
21
+ # → {"run": "...", "setup": "...", ...} — ready to execute
22
+ ```
23
+
24
+ That three-step arc — discover, load, and later record how it went — is the
25
+ whole retrieval loop this guide covers.
26
+
27
+ ## 1. When to use search vs. curate
28
+
29
+ Reach for `akm search` when you already know roughly what you're looking for
30
+ — a type, a keyword, a conceptId prefix — and want a ranked list of matches.
31
+ Reach for `akm curate` when you're starting a task and want akm to do the
32
+ narrowing for you: curate runs a search, attaches previews and follow-up
33
+ commands, and returns a small, high-confidence shortlist rather than a long
34
+ results page. In short: search when you know what you're querying for,
35
+ curate when you know what you're trying to do.
36
+
37
+ ## 2. Discover a shortlist
38
+
39
+ `akm search` queries the unified index and ranks hits by relevance — keyword
40
+ (BM25) and semantic (vector) matches fused into one list:
41
+
42
+ ```sh
43
+ akm search "deploy" --type script --shape agent
44
+ # → [{"type":"script","name":"deploy.sh","ref":"scripts/deploy.sh","score":0.0328,...}]
45
+ ```
46
+
47
+ `akm curate` goes further: it takes the top search hits in order and attaches
48
+ a preview, run details and related support refs — all while including a
49
+ direct `akm show <ref>` follow-up on every result:
50
+
51
+ ```sh
52
+ akm curate "review an architecture proposal" --type skill
53
+ # → ranked shortlist with akm show skills/code-review as the top follow-up
54
+ ```
55
+
56
+ Use `--shape agent` on either command to get the `ref`/`path`/`editable`
57
+ fields an agent needs to act on a hit. See [CLI Reference](../reference/cli.md)
58
+ for the full flag tables and exact output-field lists per `--detail` level.
59
+
60
+ ## 3. Load the selected capability
61
+
62
+ Once you have a ref, `akm show` loads its full content. Every asset type
63
+ returns type-specific fields — scripts include `run` and `setup`, skills
64
+ return `content`, workflows return parsed `steps`:
65
+
66
+ ```sh
67
+ akm show scripts/deploy.sh
68
+ # → {"run": "...", "setup": "...", "cwd": "...", ...}
69
+ ```
70
+
71
+ The ref format is `[bundle//]conceptId` — the `bundle//` prefix narrows
72
+ lookup to one installed bundle when a conceptId is ambiguous across bundles.
73
+
74
+ ## 4. Load a document section
75
+
76
+ Knowledge docs and other markdown assets can be large. Append `#fragment` to
77
+ a ref to return one section by heading slug instead of the whole document:
78
+
79
+ ```sh
80
+ akm show knowledge/api-guide#authentication
81
+ # → just the "Authentication" section, not the full document
82
+ ```
83
+
84
+ Search can also return an opaque `#akm-fragment-...` selector for a bounded
85
+ piece of a long document. The exact selector remains the default. For memories
86
+ whose opening context helps interpret a later matching turn, opt into bounded
87
+ lead context:
88
+
89
+ ```sh
90
+ akm show '<ref-from-search>' --context lead --max-tokens 800
91
+ # → indexed-safe document lead, then [Selected matching fragment] and the match
92
+ ```
93
+
94
+ AKM preserves the selected match before lead bytes when the budget is tight and
95
+ reports `contextTruncated` in JSON. The response also distinguishes canonical
96
+ `parentRef` from `selectedRef` and includes fragment position, line bounds,
97
+ neighbors, and separate fragment/parent size estimates.
98
+
99
+ An unmatched fragment lists the available slugs instead of erroring, so a
100
+ guess that misses still tells you what to try next.
101
+
102
+ ## 5. Record the outcome
103
+
104
+ After acting on a loaded asset, close the loop with `akm feedback` so the
105
+ improvement pipeline learns from the outcome:
106
+
107
+ ```sh
108
+ akm feedback scripts/deploy.sh --positive
109
+ akm feedback skills/code-review --negative --reason "references a removed flag"
110
+ ```
111
+
112
+ Record `--negative` only when the asset's content is wrong or stale, and say what
113
+ is wrong and what it should say. A note that simply did not fit your task is not
114
+ negative feedback: record nothing for it.
115
+ `akm feedback <ref> --negative --reason "<what is wrong and what should change>"`
116
+ flags the asset: it ranks lower right away, and the next `akm improve` run may
117
+ repair its description, title or `when_to_use` from your reason. Improve does
118
+ not rewrite an asset's text, so once you have verified the correct fact, attach
119
+ the exact fix: `--replace "<exact current text>" --with "<corrected text>"
120
+ --source "<URL, command or file that shows it>"`. That is how a one-off task
121
+ turns into a durable improvement to the shared library rather than a result
122
+ nobody else benefits from. `--positive` records that an asset helped (it raises
123
+ its ranking) and does not trigger a rewrite.
124
+
125
+ ## 6. Troubleshoot an empty or poor result
126
+
127
+ - **Zero hits on an exact-sounding query** — the search pipeline already
128
+ retries with prefix matching when the exact query returns nothing, so a
129
+ true zero usually means the term genuinely isn't indexed yet. Run `akm
130
+ index` (or `akm index --full` after adding a new source) and search again.
131
+ - **Query looks right but nothing comes back** — check `--type`: it's
132
+ free-form and unvalidated, so a typo'd type (`scrpit` instead of `script`)
133
+ silently returns no hits rather than erroring.
134
+ - **Local results are missing something you know exists** — confirm
135
+ `--from` matches where the asset lives (`local` is the default; use
136
+ `registry` or `all` to include the public registry).
137
+ - **A known-good asset doesn't show up** — session assets and
138
+ `proposed`-quality entries are excluded from default results
139
+ (`--include-sessions` / `--include-proposed` bring them back), and
140
+ `--filter user=...`/`--filter agent=...` scoping can silently exclude
141
+ entries that don't carry a matching scope.
142
+ - **Curate's shortlist feels off-topic** — narrow with `--type` to steer it
143
+ toward workflows, skills, or scripts specifically, or fall back to `akm
144
+ search` for a plain ranked list.
145
+
146
+ ## 7. Reference links
147
+
148
+ - [CLI Reference](../reference/cli.md) — full `--detail`/`--shape` flag
149
+ semantics, complete flag tables, and exact output-field lists for `search`,
150
+ `curate`, `show`, and `index`
151
+ - [Architecture](../architecture/architecture.md) — ranking and search
152
+ implementation detail (Search Pipeline, Show Resolution, Utility Scoring)
153
+ - [Bundles](bundles.md) — where indexed assets come from
154
+ - [Knowledge Management](knowledge-management.md) — capturing and importing
155
+ assets before they're discoverable
156
+ - [Use akm with any agent](use-with-any-agent.md) — how agents reference
157
+ assets by ref in practice
158
+ - [Concepts](concepts.md) — refs, search priority, and the FTS5 index
@@ -0,0 +1,240 @@
1
+ # Getting Started
2
+
3
+ Install akm, connect a capability source, and pull a curated shortlist for a
4
+ real task. This path takes about five to seven minutes end to end.
5
+
6
+ ## Runtime Requirement
7
+
8
+ The npm package requires Node.js >= 22 to bootstrap its command on every
9
+ platform. If a working Bun >= 1.0 is also on `PATH`, the package launcher
10
+ prefers Bun for execution; old, unusable, or absent Bun installations fall back
11
+ to Node.js. The standalone binaries are runtime-free.
12
+
13
+ ## 1. Install
14
+
15
+ **Option 1 — npm package (recommended; requires [Node.js](https://nodejs.org) >= 22):**
16
+
17
+ ```sh
18
+ npm install -g akm-cli
19
+ ```
20
+
21
+ **Option 2 — Prebuilt binary (no runtime required):**
22
+
23
+ ```sh
24
+ # Linux / macOS
25
+ curl -fsSL https://github.com/itlackey/akm/releases/latest/download/install.sh | bash
26
+
27
+ # Windows (PowerShell)
28
+ irm https://github.com/itlackey/akm/releases/latest/download/install.ps1 | iex
29
+ ```
30
+
31
+ Or download a standalone binary directly from the
32
+ [GitHub releases](https://github.com/itlackey/akm/releases) page.
33
+
34
+ Hitting a PowerShell execution-policy error on Windows? See
35
+ [Troubleshooting](#troubleshooting) at the end of this guide.
36
+
37
+ **Success check:**
38
+
39
+ ```sh
40
+ akm --version
41
+ ```
42
+
43
+ ## 2. Run setup
44
+
45
+ Guided, interactive setup is the default:
46
+
47
+ ```sh
48
+ akm setup
49
+ ```
50
+
51
+ `akm setup` walks through bundle location, embedding/LLM settings, semantic
52
+ search asset preparation, registries, sources, and task definitions. It also
53
+ reviews your scheduled task definitions and asks whether to activate them in
54
+ the OS scheduler — that part of the flow, plus how to migrate or repair
55
+ scheduler bindings later, is covered in [Scheduling](scheduling.md).
56
+
57
+ For non-interactive use — scripting, CI, or when you just want a working
58
+ bundle fast — use `--yes`:
59
+
60
+ ```sh
61
+ akm setup --yes
62
+ akm setup --dir ~/custom-bundle # optional: a non-default bundle location
63
+ ```
64
+
65
+ **Success check:** either form creates `~/akm` (or your `--dir` path) — your
66
+ working bundle, the primary directory where your personal assets live — with
67
+ subdirectories for each asset type: `scripts/`, `skills/`, `commands/`,
68
+ `agents/`, `knowledge/`, `instructions/`, `workflows/`, `memories/`, `env/`,
69
+ `secrets/`, `facts/`, `lessons/`, `tasks/`, and `sessions/`. See
70
+ [Filesystem Layout](../architecture/internals/storage-locations.md) for
71
+ platform-specific paths and environment variable overrides.
72
+
73
+ ## Isolated sandbox workflow
74
+
75
+ Need a throwaway install for agent tests, CI repros, or docs verification? Run
76
+ akm inside a temporary HOME/XDG sandbox so nothing touches your normal local
77
+ state:
78
+
79
+ ```sh
80
+ export AKM_SANDBOX="$(mktemp -d /tmp/akm-sandbox.XXXXXX)"
81
+ export HOME="$AKM_SANDBOX/home"
82
+ export XDG_CONFIG_HOME="$HOME/.config"
83
+ export XDG_DATA_HOME="$HOME/.local/share"
84
+ export XDG_CACHE_HOME="$HOME/.cache"
85
+ export XDG_STATE_HOME="$HOME/.local/state"
86
+ mkdir -p "$XDG_CONFIG_HOME" "$XDG_DATA_HOME" "$XDG_CACHE_HOME" "$XDG_STATE_HOME"
87
+ akm setup --yes --dir "$AKM_SANDBOX/bundle"
88
+ ```
89
+
90
+ Delete `$AKM_SANDBOX` when you're done to remove the whole throwaway install.
91
+
92
+ ## 3. Connect a capability source
93
+
94
+ Add something to search. Point akm at a directory you already have, or
95
+ install the official onboarding bundle:
96
+
97
+ ```sh
98
+ akm bundle add ~/.claude/skills # an existing capability directory
99
+ akm bundle add github:itlackey/akm-stash # the official onboarding bundle
100
+ ```
101
+
102
+ Every source materialises files to a directory; akm indexes them locally.
103
+
104
+ **Success check:**
105
+
106
+ ```sh
107
+ akm bundle list
108
+ ```
109
+
110
+ lists the source you just added.
111
+
112
+ ## 4. Index
113
+
114
+ ```sh
115
+ akm index
116
+ ```
117
+
118
+ `akm index` scans every configured source, then builds the search database.
119
+ Run it again whenever you add or change assets. Use `akm index --full` to
120
+ force a complete rebuild instead of an incremental update.
121
+
122
+ **Success check:** the command reports how many assets it indexed. If a
123
+ workflow file is malformed, akm skips that one asset, continues indexing the
124
+ rest of the bundle, and reports the skipped file in `warnings`.
125
+
126
+ ## 5. Curate for a real task
127
+
128
+ Describe what you're trying to do, in plain language, instead of guessing an
129
+ exact asset name:
130
+
131
+ ```sh
132
+ akm curate "deploy a Bun app"
133
+ ```
134
+
135
+ Unlike `akm search`, `akm curate` attaches a preview and run details per hit,
136
+ adds related support refs, and summarizes the set — it's the usual starting
137
+ point for an agent.
138
+
139
+ **Success check:** the response includes a small shortlist; each entry
140
+ carries a `ref` field and a direct follow-up command such as `akm show <ref>`
141
+ or `akm bundle add <ref>`.
142
+
143
+ ## 6. Show one of the results
144
+
145
+ Pick a `ref` from your curate output and load its full payload:
146
+
147
+ ```sh
148
+ akm show <ref> # e.g. akm show workflows/deploy
149
+ ```
150
+
151
+ **Success check:** structured JSON with everything an agent needs to use the
152
+ asset — a `run` command plus optional `cwd` and `setup` for scripts, a
153
+ `prompt` payload for agents, or the document `content` for knowledge (append
154
+ `#<heading-slug>` to a ref for one section).
155
+
156
+ AKM retrieves every supported capability type. It directly orchestrates
157
+ defined execution surfaces such as workflows, agent dispatch, tasks, and
158
+ guarded subprocess injection. It does not blindly execute arbitrary indexed
159
+ content merely because that content appears in search results — `show` hands
160
+ your agent the payload; running it is a deliberate next step.
161
+
162
+ ## 7. Tell your agent about akm
163
+
164
+ ```sh
165
+ akm help agents >> AGENTS.md
166
+ ```
167
+
168
+ **Success check:** `AGENTS.md` now has a block of agent-facing usage
169
+ instructions for the `akm` CLI, so any agent reading that file knows how to
170
+ call it.
171
+
172
+ ## Optional: hand-write a script
173
+
174
+ Curious how classification works on a file you wrote yourself, rather than
175
+ one that came from a bundle? Add a small script and index it:
176
+
177
+ ```sh
178
+ cat > ~/akm/scripts/hello.sh << 'EOF'
179
+ #!/usr/bin/env bash
180
+ # A simple greeting script
181
+ echo "Hello from akm!"
182
+ EOF
183
+ chmod +x ~/akm/scripts/hello.sh
184
+ akm index
185
+ akm show scripts/hello.sh
186
+ ```
187
+
188
+ Any file with a known extension (`.sh`, `.ts`, `.py`, etc.) placed in your
189
+ working bundle is automatically recognized — the `scripts/` directory isn't
190
+ required, it just increases classification confidence. Assets use inline
191
+ metadata, not `.stash.json` sidecars: markdown assets use frontmatter, and
192
+ scripts use structured header comments (a short leading description,
193
+ `@param`, and execution hints like `@run` / `@setup` / `@cwd` when needed).
194
+ See [Concepts](concepts.md) for how classification works.
195
+
196
+ ## What just happened?
197
+
198
+ You ran the retrieval loop end to end: **connect** (added a source),
199
+ **index** (built the search database), **curate** (got a relevance-ranked
200
+ shortlist for a real task), and **show** (loaded one asset's full payload).
201
+ The remaining links in that loop — **use/run** the asset, send **feedback**
202
+ on whether it helped, and let akm turn accumulated signal into a
203
+ **proposal** — are what the guides below cover.
204
+
205
+ ## Next steps
206
+
207
+ - [Discover & Load](discover-and-load.md) — search, curate, and show in depth
208
+ - [Bundles](bundles.md) — sources, registries, and installing more capability
209
+ - [Capture Knowledge](capture-knowledge.md) — memories, imports, and wikis
210
+ - [Improve the Library](improve-the-library.md) — feedback, proposals, and
211
+ the improvement loop
212
+ - [Run Workflows](run-workflows.md) — structured, resumable
213
+ multi-step procedures
214
+
215
+ Scheduling `akm improve` and other background tasks — see
216
+ [Scheduling](scheduling.md).
217
+
218
+ ## Troubleshooting
219
+
220
+ **Windows PowerShell execution policy.** `install.ps1` requires Windows
221
+ PowerShell 5.1 or newer (default on Windows 10 and Windows 11). If
222
+ `irm ... | iex` triggers a SmartScreen prompt or an ExecutionPolicy error, do
223
+ one of:
224
+
225
+ ```powershell
226
+ # Allow scripts in this session only, then re-run the install:
227
+ Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
228
+ irm https://github.com/itlackey/akm/releases/latest/download/install.ps1 | iex
229
+ ```
230
+
231
+ ```powershell
232
+ # Or download the script, unblock the file, and run it:
233
+ Invoke-WebRequest -Uri https://github.com/itlackey/akm/releases/latest/download/install.ps1 -OutFile install.ps1
234
+ Unblock-File .\install.ps1
235
+ .\install.ps1
236
+ ```
237
+
238
+ Windows ARM64 hosts install the x64 binary, which Windows runs via x86_64
239
+ emulation. Native ARM64 support is tracked alongside Bun's ARM64-on-Windows
240
+ progress.
@@ -0,0 +1,246 @@
1
+ # Improve the Library
2
+
3
+ AKM learns from outcomes, but changes remain reviewable. Every time an agent
4
+ uses a capability and reports back whether it helped, AKM folds that signal
5
+ into the asset's utility score; when the report says the content was wrong, it
6
+ proposes a concrete edit. Nothing lands in your bundle automatically: every
7
+ generated change queues as a proposal you (or an explicit policy) accept,
8
+ reject, or revert.
9
+
10
+ ```text
11
+ agent selects capability -> agent records outcome -> AKM updates utility and analyzes evidence ->
12
+ AKM creates a proposal -> human or policy reviews the diff -> accept / reject / revert
13
+ ```
14
+
15
+ ## akm feedback
16
+
17
+ `akm feedback` records a positive or negative signal for any indexed asset.
18
+ The signal updates the asset's utility score immediately, so highly-rated
19
+ assets rank higher and assets flagged wrong or stale surface less often right
20
+ away. See
21
+ [Architecture: The Improvement Loop](../architecture/improvement.md#utility-scoring)
22
+ for how that score is computed.
23
+
24
+ `akm feedback <ref> --negative --reason "<what is wrong and what should change>"`
25
+ flags the asset: it ranks lower right away, and the next improve run may repair
26
+ its description, title or `when_to_use` from your reason. Improve does not
27
+ rewrite an asset's text. Once you have verified the correct fact, attach the
28
+ exact fix: `--replace "<exact current text>" --with "<corrected text>"
29
+ --source "<URL, command or file that shows it>"` (repeat `--replace`/`--with`
30
+ for several edits). akm checks that each `--replace` text appears exactly once,
31
+ records nothing if one does not, and queues the edit as a `feedback` proposal
32
+ for review. `--positive` records that an asset helped (it raises its ranking)
33
+ and does not trigger a rewrite.
34
+
35
+ ```sh
36
+ akm feedback skills/code-review --positive
37
+ akm feedback agents/reviewer --negative --reason "Gave outdated migration steps"
38
+ akm feedback knowledge/opencode-server --negative --reason "the default port is 4096, not 8000" --replace "port 8000" --with "port 4096" --source "https://opencode.ai/docs/server/"
39
+ akm feedback workflows/ship-release --positive --reason "Worked end-to-end on 0.8.0"
40
+
41
+ # With a structured reason slug (consumed by improve/distill prompts):
42
+ akm feedback skills/planner --negative --reason "wrong-default-timeout"
43
+ ```
44
+
45
+ Specify exactly one of `--positive` or `--negative`. The ref must be present in
46
+ the current local index. `--negative` additionally requires `--reason`, and
47
+ omitting it exits 2. Full flag reference:
48
+ [CLI Reference — feedback](../reference/cli.md#feedback---reason).
49
+
50
+ Record feedback about the asset's content: that it helped, or that it turned
51
+ out wrong or stale. Record `--negative` only for content that is wrong or stale,
52
+ and say what is wrong and what it should say. A note that simply did not fit
53
+ your task is not negative feedback: record nothing for it. A failed `akm`
54
+ command, such as an `akm show` that errors on the ref, says nothing about the
55
+ asset, so don't record it as feedback on it: reflect and distill read each
56
+ reason as a report about the asset's content.
57
+
58
+ **Example: flag a skill that gave bad advice**
59
+
60
+ ```sh
61
+ akm feedback skills/deploy --negative \
62
+ --reason "Skips the dry-run step; caused prod incident 2026-05-10"
63
+ ```
64
+
65
+ ## akm log
66
+
67
+ `akm log` is the realtime append-only event stream that every mutating CLI
68
+ verb writes to — the record of what agents selected and what feedback they
69
+ gave.
70
+
71
+ ```sh
72
+ akm log # All events, oldest first
73
+ akm log --type feedback # Filter by event type
74
+ akm log --ref skills/deploy
75
+ akm log --since '@offset:12345' # Resume from a durable cursor
76
+ ```
77
+
78
+ See [CLI Reference — log](../reference/cli.md#log) for the full filter list
79
+ and cursor format.
80
+
81
+ ## akm improve
82
+
83
+ `akm improve` is the main entry point for the self-improvement pass. It reads
84
+ feedback signals and usage patterns, then generates proposals — it never
85
+ writes directly to your bundle. By default, generated proposals always queue
86
+ for review; the underlying autonomy gate and strategy configuration are
87
+ covered in [Architecture: The Improvement Loop](../architecture/improvement.md).
88
+
89
+ ```sh
90
+ akm improve # Full bundle pass
91
+ akm improve memory # Scope to memory assets only
92
+ akm improve skills/code-review # One asset
93
+ akm improve --task "reduce duplication"
94
+ akm improve --dry-run # Show planned refs without generating proposals
95
+ akm improve --limit 10 # Cap the refs the run processes
96
+ ```
97
+
98
+ A run improves one bundle, the one it writes to (`--bundle`, else
99
+ `defaultWriteTarget`, else your working bundle), and leaves assets in your other
100
+ bundles alone even when they are writable. Run `akm improve --bundle team` to
101
+ improve another one. A scheduled run covers the same single bundle, so schedule
102
+ one `akm improve --bundle <name>` run per other bundle you want improved.
103
+ `--dry-run` previews the bundle a live run would improve.
104
+
105
+ A rewrite (reflect) is planned only for assets with negative feedback in the
106
+ last 30 days that is newer than the last time improve tried them, or for an
107
+ explicit ref; a positive or note-only signal never plans one, and neither does a negative whose exact fix (`--replace`, `--outdated`, `--superseded-by`) has since been accepted. Distill reads any
108
+ feedback on a memory in that window, but skips a memory flagged wrong and not
109
+ edited since: a negative feedback in that window judged the body it still has
110
+ (or, recorded without that body's hash, is newer than its file's last write).
111
+ It also skips a memory whose only feedback in that window is a positive with no
112
+ reason or note: say what helped (`--reason`), or the lesson has nothing to
113
+ distil.
114
+ Unless `--require-feedback-signal` is set,
115
+ two fallback lanes pick assets with no such feedback: high-salience assets that
116
+ were never reflected, and, in a strategy that enables proactive maintenance,
117
+ assets due for a revisit. They only select and score assets and plan nothing,
118
+ so improve does not rewrite on a proactive cadence. The planned assets are
119
+ ranked by salience and cut to `--limit`.
120
+ Improve reworks only what gets read: without fresh feedback, a fallback lane
121
+ picks an asset (and a memory is judged for consolidation) only if `search`,
122
+ `curate` or `show` returned it, or feedback named it, in the last 90 days — the
123
+ usage log's retention — or if it is new material no improve stage has processed
124
+ yet. An explicit ref (`akm improve skills/code-review`) is always reworked.
125
+ Full flag reference: [CLI Reference — improve](../reference/cli.md#improve).
126
+
127
+ `--dry-run` is an execution-plan preview, not a raw scope listing. Its
128
+ `plannedRefs` are the final ranked refs after validation, retrieval, signal,
129
+ disk, and limit gates. The accompanying `plan` keeps the pre-gate `rawInScope` count,
130
+ per-gate removal counts and reasons, configured versus effective limits, and
131
+ the selection lane for each final ref. `plan.snapshot` explains whether the
132
+ existing index was readable; a missing or incompatible index produces an
133
+ explicit empty snapshot without creating or migrating it. The plan reports the
134
+ cap as `limits.effective` (`limits.additiveReplayAllowance` is always `0` and
135
+ `limits.totalCeiling` equals the cap, because the replay lane is retired). It
136
+ also reports proactive-maintenance due statistics, consolidation pool gates and
137
+ chunk estimate, extract/memory-inference stage decisions, and proposal-triage
138
+ mode and caps. The plan has
139
+ `mode: "estimate"` and `dispatch: false`; producing it does not acquire the
140
+ improve lock, invoke an LLM, create state, or write proposals, events, assets,
141
+ cache files, or result records.
142
+
143
+ The preview is a best-effort observation assembled during the invocation, not
144
+ an atomic cross-store snapshot or a reservation. A later live run re-inspects
145
+ mutable index, state, filesystem, and session-log inputs before dispatch, so
146
+ concurrent changes can legitimately produce a different plan.
147
+
148
+ **Example: auto-generate lessons from usage patterns**
149
+
150
+ ```sh
151
+ akm improve --dry-run # preview what would be processed
152
+ akm improve --limit 20 # process at most 20 refs
153
+ akm proposal list # review what was generated
154
+ ```
155
+
156
+ ## akm proposal (list, show, diff, accept, reject, reopen, revert)
157
+
158
+ `akm proposal list` lists pending proposals in the queue. Each proposal is an
159
+ AI-generated suggested change — an edit to an existing asset, a new lesson, a
160
+ memory consolidation, or a deprecation. Review the diff, then accept or reject.
161
+
162
+ ```sh
163
+ # List proposals
164
+ akm proposal list
165
+ akm proposal list --status pending
166
+ akm proposal list --ref skills/code-review
167
+
168
+ # Inspect a proposal
169
+ akm proposal show <id>
170
+ akm proposal diff <id> # Preview the change vs. the live asset
171
+
172
+ # Apply or discard
173
+ akm proposal accept <uuid-or-prefix>
174
+ akm proposal accept skills/akm-dream --target team-bundle
175
+ akm proposal reject <uuid-or-prefix> --reason "duplicates existing workflow"
176
+ ```
177
+
178
+ Accepts full UUIDs, 8-character UUID prefixes, or asset refs. `akm proposal accept` runs
179
+ full validation before promoting the proposal into your bundle.
180
+ `akm proposal revert` restores the prior content of an accepted proposal from
181
+ its captured backup, and `akm proposal reopen <id>` undoes a rejection (it puts
182
+ a rejected proposal back to pending unless its target has changed since). Full
183
+ flag reference:
184
+ [CLI Reference — proposal](../reference/cli.md#proposal).
185
+
186
+ **Example: review and accept a memory consolidation**
187
+
188
+ ```sh
189
+ akm proposal list --status pending
190
+ akm proposal diff abc12345 # preview the proposed consolidation
191
+ akm proposal accept abc12345 # write it to the bundle
192
+ ```
193
+
194
+ ## akm proposal new
195
+
196
+ `akm proposal new` asks an engine to author a brand-new asset — useful
197
+ when you want to create something from scratch rather than improving an
198
+ existing asset. Any engine kind works (an LLM engine, an agent CLI or
199
+ `opencode-sdk`): the engine returns the asset as JSON, which akm validates.
200
+ Output always goes to the proposal queue, never directly to the bundle.
201
+
202
+ ```sh
203
+ akm proposal new skill code-review --task "PR-style review skill for TypeScript repos"
204
+ akm proposal new lesson docker-cleanup --file ./prompts/docker-cleanup.md
205
+ ```
206
+
207
+ After the proposal is generated, review it with `akm proposal diff <id>` and apply with
208
+ `akm proposal accept`.
209
+
210
+ ## End-to-end example: from bad experience to a reviewed fix
211
+
212
+ ```sh
213
+ # 1. An agent hits a problem and records it
214
+ akm feedback skills/deploy --negative \
215
+ --reason "Skips the dry-run step; caused prod incident 2026-05-10"
216
+
217
+ # 2. The event lands in the log immediately
218
+ akm log --ref skills/deploy --type feedback
219
+
220
+ # 3. A later improve pass reads the signal and drafts a fix
221
+ akm improve skills/deploy
222
+
223
+ # 4. The fix is a proposal, not a live edit — review it
224
+ akm proposal list --ref skills/deploy
225
+ akm proposal diff <id>
226
+
227
+ # 5. Accept, reject, or revert after acceptance if it doesn't hold up
228
+ akm proposal accept <id>
229
+ akm proposal reject <id> --reason "not the right fix"
230
+ akm proposal revert <id>
231
+ ```
232
+
233
+ Nothing in this loop bypasses review by default: `akm improve` only ever
234
+ queues proposals, and promotion into the bundle happens through an explicit
235
+ `akm proposal accept` (or an explicit opt-in policy) — see
236
+ [Architecture: The Improvement Loop](../architecture/improvement.md) for the
237
+ autonomy gate that governs the few lanes that can act without one.
238
+
239
+ ## See also
240
+
241
+ - [Discover & Load](discover-and-load.md) — finding and loading assets
242
+ - [Knowledge Management](knowledge-management.md) — capturing memories and docs
243
+ - [Agent Integration](use-with-any-agent.md) — wiring feedback into agent workflows
244
+ - [CLI Reference](../reference/cli.md) — full flag documentation for `feedback`, `log`, `improve`, `proposal`
245
+ - [Architecture: The Improvement Loop](../architecture/improvement.md) — utility scoring, strategies, autonomy gates, auto-sync, and session extraction
246
+ - [Concepts](../guides/concepts.md) — bundles, refs and the index
@@ -0,0 +1,18 @@
1
+ # Knowledge Management
2
+
3
+ Capturing and protecting knowledge are two different jobs: `akm remember`,
4
+ `akm import`, `akm bundle add`, and LLM wikis turn what an agent or teammate
5
+ learns into searchable assets any agent can find, while `akm env` and
6
+ `akm secret` hold configuration and credentials under a stricter guarantee —
7
+ values never appear in akm's structured output. This page has moved; the
8
+ content now lives in two focused pages.
9
+
10
+ ## Where things moved
11
+
12
+ - [Capture Knowledge](capture-knowledge.md) — `akm remember`, `akm import`,
13
+ when to reach for each versus `akm bundle add` or a wiki, and how captured
14
+ material becomes available to every agent
15
+ - [Wikis](wikis.md) — the LLM-wiki bundle format for maintained, structured
16
+ knowledge
17
+ - [Environment & Secrets](../reference/env-and-secrets.md) — exact env/secret
18
+ operations, file modes, subprocess residency, and the security guarantee