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,81 @@
1
+ # LLM Wikis
2
+
3
+ akm supports [Andrej Karpathy's LLM
4
+ Wiki](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)
5
+ pattern: a markdown-based knowledge base that an LLM agent maintains
6
+ together with a human, on a filesystem it can read and write directly,
7
+ with no special SDK.
8
+
9
+ **As of 0.9.0 an LLM wiki is a bundle format, not an akm asset type.**
10
+ The `akm wiki` command family was removed with the 0.9.0 bundle-adapter
11
+ architecture; recognition moved into the first-class LLM Wiki adapter.
12
+
13
+ ## The design
14
+
15
+ A wiki is a directory. Full stop.
16
+
17
+ ```
18
+ <wiki-root>/
19
+ schema.md rulebook the agent reads first
20
+ index.md catalog of pages, regenerable
21
+ log.md append-only activity log
22
+ raw/ immutable ingested sources (never edit)
23
+ pages/<page>.md agent-authored pages
24
+ pages/<topic>/<page>.md optional nesting
25
+ ```
26
+
27
+ Three layers, from Karpathy's gist:
28
+
29
+ - **Raw sources** (`raw/`) — what you ingest. Articles, papers,
30
+ transcripts, notes. Immutable.
31
+ - **Wiki pages** (`pages/<page>.md`, optionally nested) — what the agent
32
+ writes. Summaries, entity pages, concept pages, FAQs. Cross-referenced
33
+ via `xrefs:` frontmatter; provenance recorded via `sources:`
34
+ frontmatter pointing at the cited raw files.
35
+ - **Schema** (`schema.md`) — the per-wiki configuration: voice, page
36
+ kinds, contradiction policy, any conventions the agent should follow.
37
+ akm never touches it.
38
+
39
+ ### Principle — akm surfaces, the agent writes
40
+
41
+ Karpathy's workflow is a conversation between a human, an agent, and a
42
+ filesystem. akm is not that agent. Page writes — create, append, xref,
43
+ log — all use the agent's native `Read` / `Write` / `Edit` tools. akm's
44
+ job is recognition and discovery: it mounts the wiki, indexes the pages,
45
+ and makes them searchable alongside every other asset.
46
+
47
+ No LLM calls are made anywhere in the wiki surface. No network access.
48
+
49
+ ## How akm sees a wiki (0.9.0)
50
+
51
+ The LLM Wiki adapter recognizes a wiki **deterministically at install
52
+ time**: a bundle component whose root holds a `schema.md` plus a
53
+ `pages/` directory is mounted as an `llm-wiki` component. From there:
54
+
55
+ - `pages/**.md` are indexed as searchable documents; each page's ref is
56
+ `bundle//conceptId`, where the conceptId is the root-relative path
57
+ minus `.md` (a page at `pages/attention.md` in bundle `research-wiki`
58
+ is `research-wiki//pages/attention`).
59
+ - `raw/**.md` **are** indexed — as first-class, addressable, searchable
60
+ `wiki-source` documents (not `page`-type items; a ref looks like
61
+ `bundle//raw/<slug>`), so citations resolve and raw content is
62
+ discoverable by search too.
63
+ - `schema.md`, `index.md`, and `log.md` are structural and are never
64
+ indexed as a concept.
65
+ - `xrefs:` frontmatter becomes cross-reference edges; `sources:`
66
+ frontmatter becomes citation edges back to raw files.
67
+
68
+ ## Working with a wiki
69
+
70
+ ```sh
71
+ akm bundle add github:team/research-wiki # install a wiki bundle (or point at a local dir)
72
+ akm search "attention" # pages rank alongside all other indexed content
73
+ akm show research-wiki//pages/attention # read a page by ref
74
+ akm show research-wiki//pages/attention#history
75
+ ```
76
+
77
+ To build a new wiki, create the directory shape above by hand (or have
78
+ your agent do it — `schema.md` plus an empty `pages/` is enough for
79
+ recognition), then add it as a bundle. Ingesting raw sources, writing
80
+ pages, and maintaining `index.md`/`log.md` are the agent's job, guided
81
+ by `schema.md`.
@@ -0,0 +1,19 @@
1
+ # Maintainer Docs
2
+
3
+ This is maintainer/contributor documentation, not user-facing. It covers how
4
+ to work on `akm` itself — running it from source, measuring whether changes
5
+ actually improve it, and the current state of the `curate` implementation.
6
+
7
+ - [Local Development](local-development.md) — the explicit launcher for each
8
+ kind of contributor check (live source, built launcher, packed-package
9
+ acceptance, global checkout install) and the verification commands to run
10
+ before pushing.
11
+ - [Release Checklist](release-checklist.md) — local release validation, exact
12
+ candidate-SHA semantic/Docker/native-scheduler gates, and the evidence links
13
+ required before publication.
14
+ - [akm-eval](https://github.com/itlackey/akm-eval) — the evals and benchmarks
15
+ that measure whether `akm improve` and retrieval changes are actually
16
+ working. The old in-repo toolkit is retired: see [eval.md](eval.md).
17
+ - [Curate Workmap](curate-workmap.md) — the current `akm curate` contract,
18
+ where its implementation diverges from intended behavior, and the
19
+ highest-value next fixes.
@@ -0,0 +1,336 @@
1
+ # Curate Workmap
2
+
3
+ > **Implementation note (added later, verified against `src/commands/read/curate.ts`):**
4
+ > much of the "Preferred direction" / "Next Fix Candidates" work below has
5
+ > already shipped. `curateSearchResults` now selects via `selectCuratedStashHits`
6
+ > (score-first ranking through `annotateCurateHit`/`compareCurateHits`/
7
+ > `passesCurateScoreFloor`, not "take the first hit per type"),
8
+ > `collapseCurateFamilies`/`preferBroadRootRepresentative`/`getCurateFamily`
9
+ > implement the asset-family root/child collapsing this document recommends,
10
+ > `shouldRunCurateFallback` triggers fallback on a weak result set (not only
11
+ > on zero hits, reversing the "Fallback Search Behavior" section below), and
12
+ > `appendCurateSupportRef`/`mergeCurateSupportRefs` attach graph-derived
13
+ > support refs (the "Graph Leverage" recommendation). The `orderCuratedTypes`
14
+ > function this document's "Execution Path" section names no longer exists —
15
+ > regex-based type reordering was replaced by the scoring pipeline above. The
16
+ > "Current Behavior" / "Current Curate Contract" sections below were accurate
17
+ > at the time they were written but are now describing the PRE-fix state in
18
+ > several places; re-verify against the functions above before trusting any
19
+ > specific "current behavior" claim in this document. Not fully re-audited
20
+ > line by line — this note flags the drift rather than rewriting the
21
+ > analysis.
22
+
23
+ ## When To Read This
24
+
25
+ Read this before changing `akm curate` ranking, fallback, follow-up generation, or agent-facing output.
26
+
27
+ This page is the shortest path to understanding:
28
+ - how `akm curate` currently works
29
+ - which tests pin that behavior
30
+ - where the current implementation diverges from intended product behavior
31
+ - what fix direction has the strongest support from recent review
32
+
33
+ ## Debate Outcome
34
+
35
+ Recent multi-agent review converged on the same conclusion:
36
+
37
+ - `curate` should be relevance-first, not diversity-first
38
+ - search ranking should remain the backbone of the shortlist
39
+ - type diversity should be a soft preference for later slots, not a hard override
40
+ - fallback search should run when the initial result set is weak or noisy, not only when it is empty
41
+ - `followUp` should become more action-aware over time, but ranking/fallback correctness comes first
42
+
43
+ Recommended fix order:
44
+
45
+ 1. Make curate selection score-first and diversity-second.
46
+ 2. Relax fallback suppression so one weak phrase hit does not block token fallback.
47
+ 3. Revisit follow-up generation after ranking quality improves.
48
+
49
+ Additional debate outcome:
50
+
51
+ - simple type-aware reranking is useful only as a thin post-search correction layer
52
+ - root-vs-derived asset families should usually be collapsed to one representative in the top-level shortlist
53
+ - graph data is better suited for attached support refs or navigation hints than for primary reranking in the first iteration
54
+
55
+ ## Current Curate Contract
56
+
57
+ - CLI entry lives in `src/commands/read/search-cli.ts`.
58
+ - Public entry point is `akmCurate()` in `src/commands/read/curate.ts`.
59
+ - Default curated limit is `4`.
60
+ - Default search source is `stash`.
61
+ - Curate fetches more search hits than it returns: `limit * 4`, minimum `12`.
62
+ - `--type <type>` bypasses diversification and returns top hits of that type.
63
+ - Default multi-type curate currently keeps one best hit per type, then reorders types using regex heuristics.
64
+ - Registry hits only fill leftover slots and are capped at `2`.
65
+ - Bundle items are enriched via `akmShowUnified()` best-effort.
66
+ - Bundle `followUp` is always `akm show <ref>` today.
67
+ - Curate logs both a summary event and per-item retrieval rows for bundle refs.
68
+
69
+ ## Execution Path
70
+
71
+ Read these first:
72
+
73
+ - `src/commands/read/search-cli.ts`
74
+ - `src/commands/read/curate.ts`
75
+ - `src/output/shapes/curate.ts`
76
+ - `src/output/text/helpers.ts`
77
+ - `src/commands/read/search.ts`
78
+ - `src/commands/read/show.ts`
79
+
80
+ Key functions in `src/commands/read/curate.ts` (current names; `orderCuratedTypes()`
81
+ no longer exists — see the implementation note above):
82
+
83
+ - `akmCurate()`
84
+ - `searchForCuration()`
85
+ - `deriveCurateFallbackQueries()`
86
+ - `mergeCurateSearchResponses()`
87
+ - `curateSearchResults()`
88
+ - `selectCuratedStashHits()` / `annotateCurateHit()` / `compareCurateHits()` / `passesCurateScoreFloor()`
89
+ - `collapseCurateFamilies()` / `preferBroadRootRepresentative()` / `getCurateFamily()`
90
+ - `shouldRunCurateFallback()`
91
+ - `appendCurateSupportRef()` / `mergeCurateSupportRefs()`
92
+ - `enrichCuratedStashHit()`
93
+
94
+ ## Ranking And Selection Rules
95
+
96
+ Current behavior:
97
+
98
+ - Search returns scored, ordered hits.
99
+ - Curate then discards most of that ordering by taking the first hit per type.
100
+ - Those per-type winners are reordered using query regex boosts such as `deploy`, `review`, `guide`, `agent`, and `memory`.
101
+ - This can promote obviously lower-score items above much stronger hits.
102
+
103
+ Why this is a problem:
104
+
105
+ - search already has strong ranking tests and should remain the primary relevance signal
106
+ - current curate can surface irrelevant filler to satisfy type variety
107
+ - users experience curate as a flagship shortlist, so wrong top results damage trust more than low variety does
108
+
109
+ Preferred direction:
110
+
111
+ - preserve top-ranked overall hits first
112
+ - allow diversity only when alternatives are close in score and plausibly relevant
113
+ - keep explicit `--type` behavior unchanged
114
+
115
+ Small type-aware corrections that are considered in-bounds:
116
+
117
+ - prefer runnable `script` / concrete `command` over similarly scored `memory` for execution-heavy queries
118
+ - prefer `workflow` / `skill` over adjacent explanation docs for multi-step task queries
119
+ - include `agent` mainly for explicit delegation / persona / prompt-building queries
120
+ - keep `memory` for recall/context queries, not as generic filler
121
+
122
+ Corrections that are currently considered too risky:
123
+
124
+ - hard one-per-type quotas
125
+ - large hand-authored type matrices
126
+ - LLM reranking
127
+ - blanket demotion of `memory` or `agent` as types
128
+
129
+ ## Asset Families
130
+
131
+ Curate should think in terms of asset families, not just isolated types.
132
+
133
+ Practical examples in this repo:
134
+
135
+ - `skills/docker-homelab`
136
+ - `knowledge/skills/docker-homelab/references/compose`
137
+
138
+ Desired behavior:
139
+
140
+ - broad query like `docker homelab` -> prefer the root asset
141
+ - narrow query like `docker compose reference` -> prefer the child reference page
142
+ - if both are useful, attach the weaker sibling as support instead of spending two top-level slots by default
143
+
144
+ This should start as an explicit structural heuristic, not semantic lineage inference.
145
+
146
+ ## Fallback Search Behavior
147
+
148
+ Current behavior:
149
+
150
+ - `searchForCuration()` only runs fallback token searches when the initial query returns zero hits
151
+ - if the initial query returns even one weak or irrelevant hit, fallback does not run
152
+ - fallback token extraction removes filler words, dedupes tokens, drops tokens shorter than 3 chars, and caps the set at 6
153
+ - fallback is also skipped when normalization leaves only one usable token
154
+
155
+ Why this is a problem:
156
+
157
+ - one weak phrase hit can block much better token hits
158
+ - prompt-style queries like `the docker` do not get the obvious one-token fallback
159
+ - meaningful short tokens such as `ai`, `ci`, `cd`, `go`, `js`, or `ts` are lost today
160
+
161
+ Preferred direction:
162
+
163
+ - suppress fallback only when the initial result set is actually strong enough
164
+ - allow one-token fallback when that token is clearly the meaningful residue of a prompt-style query
165
+ - preserve a narrow allowlist of meaningful short tokens
166
+
167
+ ## Enrichment And Follow-Up Fields
168
+
169
+ Current behavior:
170
+
171
+ - curate enriches bundle hits by calling `akmShowUnified({ ref })`
172
+ - if show fails, enrichment silently degrades to raw search-hit data
173
+ - bundle follow-up remains `akm show <ref>` even for runnable scripts with a concrete `run`
174
+ - registry follow-up uses the registry action, usually `akm bundle add ...`
175
+
176
+ Product implication:
177
+
178
+ - output is inspect-first, not act-first
179
+ - this is acceptable for now, but becomes more visible once result quality improves
180
+
181
+ For agent consumers, the desired optimization order is:
182
+
183
+ - actionability
184
+ - relevance
185
+ - low duplication / root-asset preference
186
+ - navigability
187
+ - type diversity
188
+
189
+ ## Output Shape And Formatting
190
+
191
+ Read:
192
+
193
+ - `src/output/shapes/curate.ts`
194
+ - `src/output/text/helpers.ts`
195
+
196
+ Important details:
197
+
198
+ - `curate` has a dedicated output shaper now
199
+ - `brief` still keeps `followUp` and `reason`
200
+ - `--shape agent` trims fields down for agent use
201
+ - `--shape summary` is rejected on `curate`
202
+ - text output prints fixed `Next steps:` guidance that assumes `akm show <ref>` is the next action
203
+
204
+ ## Telemetry And Retrieval Signal
205
+
206
+ Read:
207
+
208
+ - `src/commands/read/curate.ts`
209
+ - `tests/integration/get-retrieval-counts.test.ts`
210
+
211
+ Important detail:
212
+
213
+ - curate writes per-item `usage_events` rows for bundle refs so curated items count as retrieval signal
214
+
215
+ This means ranking changes do not just affect UX. They also affect downstream improvement-loop evidence.
216
+
217
+ ## Graph Leverage
218
+
219
+ > **Retired (0.9.17-alpha.9):** the LLM entity graph this section recommends
220
+ > leveraging is gone — `graph-extraction`, `graph_meta`/`graph_files`/
221
+ > `graph_file_entities`/`graph_file_relations`, and `akm show`'s `related`
222
+ > block it fed are all deleted. It was already superseded before that: #935
223
+ > (0.9.17-alpha.8) added the first-class asset->asset edge table this section
224
+ > says doesn't exist (`asset_links`, declared links), and curate's support
225
+ > refs (`buildCurateSupportRefs` in `src/commands/read/curate.ts`) come from
226
+ > declared links now, not graph data — the implementation note at the top of
227
+ > this document already flags that rename. Kept below for historical context
228
+ > only; do not implement against it.
229
+
230
+ Existing graph signal:
231
+
232
+ - there is no first-class asset->asset edge table
233
+ - asset relatedness is already derivable via shared-entity overlap
234
+ - `listRelatedPathsForFile()` in `src/indexer/graph/graph-boost.ts` returns related assets with `ref`, `type`, `sharedEntities`, and `relationCount`
235
+ - `akm show` already exposes a lightweight `related` block using that signal
236
+
237
+ Limits:
238
+
239
+ - graph coverage depends on graph extraction having run
240
+ - graph is thin or absent on cold bundles
241
+ - graph quality is uneven and generic entities can over-connect assets
242
+ - graph coverage is strongest for `knowledge` / `memory` and should not be assumed for every asset family
243
+
244
+ Recommended first graph-aware use in curate:
245
+
246
+ - do not use graph as a primary reranker yet
247
+ - use graph to attach 1-2 support refs or navigation hints to a top-level curated result
248
+ - prefer hints like `see also`, `related`, or `inspect next` over full graph payloads
249
+ - keep full graph exploration in `akm show`'s `related` block
250
+
251
+ What not to do yet:
252
+
253
+ - no graph-only reranking
254
+ - no graph-required curate path
255
+ - no full graph dumps in curate output
256
+ - no semantic asset-lineage inference from sparse graph data
257
+
258
+ ## Tests That Pin Behavior
259
+
260
+ Start with these:
261
+
262
+ - `tests/integration/curate-command.test.ts`
263
+ - `tests/curate-logic.test.ts`
264
+ - `tests/integration/curate-search-for-curation.test.ts`
265
+
266
+ What they cover:
267
+
268
+ - CLI JSON/text output
269
+ - shape/detail behavior
270
+ - usage logging
271
+ - fallback token derivation
272
+ - merge semantics
273
+ - type ordering
274
+ - diversification logic
275
+ - registry filler cap
276
+ - blank query rejection
277
+ - default limit
278
+ - phrase-hit fallback suppression
279
+ - current quality baselines showing irrelevant filler
280
+
281
+ Search-ranking baselines that curate should respect:
282
+
283
+ - `tests/integration/db-scoring.test.ts` (no `tests/commands/search.test.ts` exists in the current tree; this is the closest surviving search-scoring baseline, not a confirmed direct successor)
284
+ - `tests/integration/ranking-regression.test.ts`
285
+
286
+ ## Known Gaps / Mismatches
287
+
288
+ - `docs/guides/discover-and-load.md` currently says curate prefers one strong match per type; that wording is too strong if curate becomes relevance-first.
289
+ - `docs/reference/cli.md` documents `--type`, `--limit`, and `--source`, but does not currently explain the effective `--detail` and `--shape` behavior alongside curate.
290
+ - Some historical AKM refs about curate output shaping are stale because curate now has a dedicated shape implementation.
291
+
292
+ ## Safe Edit Checklist
293
+
294
+ Before editing curate:
295
+
296
+ 1. Read the three curate-focused test files.
297
+ 2. Read `src/commands/read/curate.ts` top to bottom.
298
+ 3. Confirm whether you are changing:
299
+ - post-search selection
300
+ - fallback triggering
301
+ - fallback token extraction
302
+ - output contract
303
+ - telemetry side effects
304
+ 4. Keep CLI surface and output-shape tests passing unless you intentionally change the public contract.
305
+ 5. If you improve ranking quality, convert current characterization tests that encode bad behavior into regression tests for the new intended behavior.
306
+
307
+ ## Useful AKM Queries And Refs
308
+
309
+ Queries:
310
+
311
+ ```sh
312
+ akm search "curate rerank"
313
+ akm search "curate output shape"
314
+ akm search "search discovery curate"
315
+ akm search "curate telemetry usage_events"
316
+ akm search "curate fallback query"
317
+ akm search "curate quality baseline"
318
+ ```
319
+
320
+ Historical context refs:
321
+
322
+ - `memories/curate-weak-for-ui-test-audit.derived`
323
+ - `knowledge/curate-command-flags-inert`
324
+
325
+ Note: `knowledge/curate-command-flags-inert` is historical context only. It describes an older output-shaping limitation that is no longer current now that `src/output/shapes/curate.ts` exists.
326
+
327
+ ## Next Fix Candidates
328
+
329
+ Highest-value next changes:
330
+
331
+ 1. Replace hard one-per-type selection with score-first shortlist selection plus optional soft diversity.
332
+ 2. Replace empty-only fallback triggering with weak-result fallback triggering.
333
+ 3. Add simple family-aware root/child collapsing for obvious structural bundles.
334
+ 4. Add regression tests asserting that docker-specific curate queries stop surfacing unrelated `commands/release-manager` filler.
335
+ 5. Attach lightweight related-asset hints using existing graph data after ranking quality is fixed.
336
+ 6. Revisit `followUp` generation after ranking quality is fixed.
@@ -0,0 +1,3 @@
1
+ # akm-eval — retired from this repository
2
+
3
+ The `scripts/akm-eval/` toolkit has left akm: its code is kept, to read and not to run, in [`retired/akm-scripts-akm-eval/`](https://github.com/itlackey/akm-eval/tree/main/retired/akm-scripts-akm-eval) of [itlackey/akm-eval](https://github.com/itlackey/akm-eval), where [`reports/retired-evals.md`](https://github.com/itlackey/akm-eval/blob/main/reports/retired-evals.md) says what each retired eval asked, found and why it ended. It is also in this repository's history, at commit `f57a7fd44b37` and in the tag `v0.9.27-alpha.1`.
@@ -0,0 +1,108 @@
1
+ # Local Development
2
+
3
+ Use an explicit launcher for each kind of contributor check. This keeps live
4
+ source, build output, packed-package behavior, and the machine-wide `akm`
5
+ installation from being mistaken for one another.
6
+
7
+ The npm package requires Node.js >= 22 and npm. A working Bun >= 1.0 is optional
8
+ for the installed launcher and remains the repository's primary development and
9
+ test runtime. The standalone binaries are runtime-free.
10
+
11
+ ## Live Source
12
+
13
+ Run the working tree directly for the normal edit-test loop:
14
+
15
+ ```bash
16
+ bun src/cli.ts search "deploy"
17
+ bun src/cli.ts task doctor
18
+ ```
19
+
20
+ This executes current uncommitted source. Tests that spawn the CLI should use
21
+ the same explicit `bun src/cli.ts` form with the repository as their working
22
+ directory rather than resolving `akm` from `PATH`.
23
+
24
+ ## Built Launcher
25
+
26
+ Build first, then invoke the package launcher from `dist/`:
27
+
28
+ ```bash
29
+ bun run build
30
+ node dist/akm search "deploy"
31
+ node dist/akm task doctor
32
+ ```
33
+
34
+ This checks generated imports, copied assets, and launcher behavior while still
35
+ keeping the invocation tied to this checkout. `node dist/akm` is portable across
36
+ Windows, macOS, and Linux; on POSIX systems the executable `./dist/akm` form is
37
+ also available.
38
+
39
+ ## Isolated Package Acceptance
40
+
41
+ Run the repository's package acceptance command. It builds and packs the package,
42
+ installs it under an isolated temporary prefix, and exercises that installed
43
+ launcher without replacing the machine's global `akm`:
44
+
45
+ ```bash
46
+ bun run test:package
47
+ ```
48
+
49
+ The command builds, packs, installs under a temporary npm prefix, and checks the
50
+ installed launchers. It does not run setup or test application-state isolation.
51
+
52
+ ## Intentional Global Checkout Install
53
+
54
+ Only install the checkout globally when you deliberately want the machine-wide
55
+ `akm` command to resolve to this checkout's package:
56
+
57
+ ```bash
58
+ bun run build:install
59
+ command -v akm
60
+ akm --version
61
+ ```
62
+
63
+ This replaces the globally resolved package and can affect agents, shells, and
64
+ scheduled tasks that invoke `akm`. Re-run `akm task sync --rebind` only when you
65
+ intend existing scheduler entries to capture the new installed runtime, then
66
+ verify with `akm task doctor`.
67
+
68
+ ## Transitional Machine-Local Wrapper
69
+
70
+ Some development machines still have a historical machine-local wrapper. Leave
71
+ that file untouched, but treat it as transitional: do not document wrapper
72
+ modes, depend on it in tests, or use it to choose between source and package
73
+ behavior. Invoke `bun src/cli.ts`, `node dist/akm`, or `bun run test:package`
74
+ explicitly instead.
75
+
76
+ ## Inspecting a Live Database
77
+
78
+ `state.db`, `logs.db`, and `index.db` are WAL-mode SQLite databases that akm
79
+ (or a scheduled task) may be writing at any moment. Open a live one only with
80
+ `sqlite3 -readonly`:
81
+
82
+ ```bash
83
+ sqlite3 -readonly ~/.local/share/akm/state.db "PRAGMA integrity_check;"
84
+ sqlite3 -readonly ~/.local/share/akm/state.db ".backup /tmp/state-snapshot.db"
85
+ ```
86
+
87
+ Do not open a live akm database with a plain (read-write) `sqlite3`
88
+ connection, even just to run `.backup`. Through 0.9.17 an akm process could
89
+ silently lose its SQLite file locks (copying the database file inside a
90
+ process that holds it open drops them). An older `sqlite3` (< 3.51, and
91
+ Python's `sqlite3` module on many hosts) opened read-write at that moment
92
+ sees no other reader, takes an exclusive lock when it closes, and deletes the
93
+ `-wal`/`-shm` files akm is still using: that produced a `state.db` with
94
+ colliding rowids and stale index entries. `-readonly` avoids the whole class
95
+ of risk by never taking a write connection.
96
+
97
+ ## Verification
98
+
99
+ Use focused tests while iterating, then the repository gates before pushing:
100
+
101
+ ```bash
102
+ bun test tests/<focused-file>.test.ts
103
+ bun run check:changed
104
+ bun run check
105
+ ```
106
+
107
+ For eval scripts that accept `AKM_BIN`, point it at the exact launcher under
108
+ test rather than relying on `PATH`.
@@ -0,0 +1,103 @@
1
+ # Release Checklist
2
+
3
+ Use this checklist for every release candidate. Local release validation and
4
+ scheduled CI are useful inputs, but neither substitutes for a successful gated
5
+ run of the exact commit that will be published.
6
+
7
+ ## 1. Freeze the candidate
8
+
9
+ 1. Finish the version, changelog, migration-note, and release-PR changes.
10
+ 2. Record `git rev-parse HEAD`. This is the full 40-character release-candidate SHA.
11
+ 3. Run `bun run release:check` locally. If Docker is unavailable, run
12
+ `./tests/release-check.sh --skip-docker` and rely on the gated Docker job
13
+ below for the container matrix.
14
+
15
+ Any commit added after this point creates a new candidate and invalidates the
16
+ gated evidence collected for the previous SHA.
17
+
18
+ ## 2. Collect exact-SHA gated evidence
19
+
20
+ GitHub only offers a scheduled or manually dispatched workflow after its file
21
+ exists on the default branch. When validating the commit that first introduces
22
+ or changes this workflow, create a unique lightweight candidate tag at the
23
+ recorded SHA:
24
+
25
+ ```sh
26
+ candidate_sha="$(git rev-parse HEAD)"
27
+ candidate_short_sha="$(git rev-parse --short=12 HEAD)"
28
+ candidate_version="$(node -p 'require("./package.json").version')"
29
+ candidate_tag="gated-ci/candidate-${candidate_version}-${candidate_short_sha}"
30
+ git tag "$candidate_tag" "$candidate_sha"
31
+ git push origin "refs/tags/$candidate_tag"
32
+ ```
33
+
34
+ Verify that the tag target is the exact candidate commit recorded in step 1.
35
+ The `gated-ci/candidate-*` trigger runs every gated suite from the workflow in
36
+ that tagged commit. The resolver checks that the checkout equals the immutable
37
+ event SHA, and the final evidence job records both that SHA and the tag ref.
38
+ Never force-move or reuse a candidate tag; a changed commit needs a new tag and
39
+ a new run.
40
+
41
+ After **Gated CI** exists on the default branch, manual dispatch is an
42
+ equivalent exact-SHA path. From the repository's Actions page, choose **Run
43
+ workflow** and supply:
44
+
45
+ - `candidate_sha`: the full 40-character SHA recorded above, never a branch or
46
+ tag name.
47
+
48
+ Every suite runs; there is no suite selector.
49
+
50
+ The manual request rejects abbreviated SHAs and checks out that immutable
51
+ commit for every gate. Wait for all of these stable checks to succeed on either
52
+ candidate path:
53
+
54
+ - `Gated / Semantic Search`
55
+ - `Gated / Docker Install`
56
+ - `Gated / Native Scheduler / Linux`
57
+ - `Gated / Native Scheduler / macOS`
58
+ - `Gated / Native Scheduler / Windows`
59
+ - `Gated / Release Candidate Evidence`
60
+
61
+ The final evidence job records the requested and resolved SHA, the trigger ref,
62
+ each suite's result, and a run link in the workflow summary. A weekly run is
63
+ drift detection, not release evidence, because it may cover a different
64
+ commit.
65
+
66
+ Manual and tagged candidate runs are cache restore-only. Only a successful
67
+ scheduled run of the workflow on the repository's default branch may save the
68
+ HuggingFace model cache; its key identifies both the embedding model and the
69
+ source/lock inputs. This prevents candidate-controlled workflow code from
70
+ publishing cache entries while still avoiding repeated model downloads.
71
+
72
+ Copy the successful run URL (for example,
73
+ `https://github.com/itlackey/akm/actions/runs/<run-id>`) and the exact candidate
74
+ SHA into both the release PR and its milestone/parent tracker. Do not publish
75
+ from a candidate whose evidence link names a different SHA, whose final
76
+ evidence job is skipped, or whose run was re-run after the candidate changed.
77
+
78
+ ## 3. Gated CI does not run on pull requests
79
+
80
+ Gated CI runs on three triggers only: the weekly schedule, an exact-SHA
81
+ `workflow_dispatch`, and a `gated-ci/candidate-*` tag. All three run every
82
+ suite.
83
+
84
+ There used to be a `Gated / Detect Changed Paths` job that also ran these on
85
+ PRs, selecting suites by regex-matching the diff against path lists. It was
86
+ deleted in 0.9.8: the patterns had gone stale — they still named test files a
87
+ reorganisation had moved or deleted, so it was silently under-selecting suites
88
+ and nobody noticed. A build-policing job that quietly stops policing is worse
89
+ than no job, because its green status is read as coverage.
90
+
91
+ Nothing about release evidence changes. Step 2 was always the requirement, and
92
+ it never went through the PR path.
93
+
94
+ The candidate-tag trigger is reserved for release evidence and workflow
95
+ rollout: it always runs `all`, because a tag-push workflow is the path available
96
+ before the workflow file reaches the default branch.
97
+
98
+ ## 4. Publish
99
+
100
+ After the exact-SHA gated run and local release check are green, trigger the
101
+ Release workflow with the version already committed in `package.json`. Keep the
102
+ candidate SHA and Gated CI run URL in the release record so the published
103
+ artifact's validation can be audited later.
@@ -9,5 +9,5 @@ Upgrade guides and per-release migration notes.
9
9
  - [v0.9.19 release note](release-notes/0.9.19.md) -- `akm improve` scoped to the bundle it writes to (scheduled runs need one `--bundle` run per other bundle), `akm proposal reopen` and the retire-proposal diff, and fewer repeat consolidate promotions
10
10
  - [v0.8 -> current v0.9 migration guide](v0.8-to-v0.9.md) -- Package upgrade with fresh current config/state and explicit task conversion
11
11
  - [v0.7 -> v0.8 migration guide](v0.7-to-v0.8.md) -- Task schema and 0.8-era changes
12
- - [v0.5 -> v0.6 migration guide](https://github.com/itlackey/akm/blob/main/docs/migration/v0.5-to-v0.6.md) -- Terminology cut, registry schema v3, publisher changes
13
- - [Release notes](release-notes/) -- The short per-release notes `akm help migrate <version>` prints (bundled with the npm package)
12
+ - [v0.5 -> v0.6 migration guide](v0.5-to-v0.6.md) -- Terminology cut, registry schema v3, publisher changes
13
+ - [Release notes index](release-notes/README.md) -- The short per-release notes `akm help migrate <version>` prints, with links to every bundled note
@@ -1,4 +1,4 @@
1
- Migration notes for akm v0.0.13
1
+ # akm v0.0.13 migration notes
2
2
 
3
3
  - Initial public release.
4
4
  - No migration steps are required for earlier akm versions.
@@ -1,4 +1,4 @@
1
- Migration notes for akm v0.1.0
1
+ # akm v0.1.0 migration notes
2
2
 
3
3
  - The package and project were rebranded from Agent-i-Kit to akm.
4
4
  - Update package references from `agent-i-kit` to `akm-cli`.