akm-cli 0.9.29 → 0.9.31

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 (162) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +10 -10
  3. package/ROADMAP.md +112 -0
  4. package/dist/commands/improve/improve-cli.js +33 -12
  5. package/dist/commands/sources/plugin-upgrade.js +46 -23
  6. package/dist/core/file-lock.js +10 -1
  7. package/dist/llm/client.js +33 -3
  8. package/dist/scripts/akm-migrate-node.js +5 -1
  9. package/dist/scripts/akm-migrate.js +5 -1
  10. package/docs/README.md +42 -41
  11. package/docs/agents/README.md +15 -0
  12. package/docs/agents/agent-install.md +14 -0
  13. package/docs/architecture/README.md +67 -0
  14. package/docs/architecture/adapters.md +272 -0
  15. package/docs/architecture/akm-architecture-decision-history.md +2055 -0
  16. package/docs/architecture/akm-core-principles.md +126 -0
  17. package/docs/architecture/architecture.md +579 -0
  18. package/docs/architecture/comparisons/claude-code-vs-akm-workflows-full.md +550 -0
  19. package/docs/architecture/decisions/0001-no-interpolation-attached-structured-context.md +72 -0
  20. package/docs/architecture/decisions/0002-unit-reuse-and-input-hash-scope.md +142 -0
  21. package/docs/architecture/decisions/0003-child-env-allowlist-and-provenance.md +189 -0
  22. package/docs/architecture/decisions/0004-task-input-contract-and-flag-coercion.md +97 -0
  23. package/docs/architecture/decisions/0005-task-result-vocabulary-and-legacy-read-mapping.md +108 -0
  24. package/docs/architecture/decisions/0006-task-source-version-routing.md +124 -0
  25. package/docs/architecture/decisions/0007-workflow-composition-bounds.md +83 -0
  26. package/docs/architecture/decisions/0008-task-binding-normalization.md +88 -0
  27. package/docs/architecture/decisions/0009-child-run-publication-column-parity.md +80 -0
  28. package/docs/architecture/decisions/0010-driver-protocol-cut.md +36 -0
  29. package/docs/architecture/decisions/0011-engine-run-loop-invariants.md +125 -0
  30. package/docs/architecture/decisions/README.md +62 -0
  31. package/docs/architecture/improvement.md +440 -0
  32. package/docs/architecture/internals/classification.md +154 -0
  33. package/docs/architecture/internals/fresh-host-rebuild-runbook.md +40 -0
  34. package/docs/architecture/internals/functional-contract-patterns.md +340 -0
  35. package/docs/architecture/internals/health-advisories.md +110 -0
  36. package/docs/architecture/internals/improve-workflow.md +713 -0
  37. package/docs/architecture/internals/indexing.md +498 -0
  38. package/docs/architecture/internals/registry-network-boundary.md +57 -0
  39. package/docs/architecture/internals/search.md +249 -0
  40. package/docs/architecture/internals/storage-locations.md +943 -0
  41. package/docs/architecture/persisted-data-compat.md +59 -0
  42. package/docs/architecture/reviews/env-secret-access.md +319 -0
  43. package/docs/architecture/runtime-boundary-design.md +153 -0
  44. package/docs/architecture/specs/0.9.0-close-out-plan.md +361 -0
  45. package/docs/architecture/specs/0.9.0-decisions.md +528 -0
  46. package/docs/architecture/specs/0.9.0-docs-code-drift-register.md +745 -0
  47. package/docs/architecture/specs/0.9.0-open-items-register.md +135 -0
  48. package/docs/architecture/specs/0.9.0-public-api-issue-backlog.md +740 -0
  49. package/docs/architecture/specs/0.9.0-release-surface-review.md +636 -0
  50. package/docs/architecture/specs/agent-command-engine-model-design.md +513 -0
  51. package/docs/architecture/specs/akm-0.9.0-bundle-adapter-spec.md +501 -0
  52. package/docs/architecture/specs/akm-0.9.0-ref-grammar-decision.md +291 -0
  53. package/docs/architecture/specs/akm-format-neutral-bundle-workspace-spec.md +2059 -0
  54. package/docs/architecture/specs/di-seams-plan.md +539 -0
  55. package/docs/architecture/specs/driver-protocol-keep-or-cut.md +275 -0
  56. package/docs/architecture/specs/fact-asset-type.md +142 -0
  57. package/docs/architecture/specs/improve-collapse-churn-detector-design.md +634 -0
  58. package/docs/architecture/specs/okf-support.md +148 -0
  59. package/docs/architecture/specs/ref.md +329 -0
  60. package/docs/architecture/specs/reviews/task-workflow-unification/README.md +72 -0
  61. package/docs/architecture/specs/reviews/task-workflow-unification/findings-consolidated.md +152 -0
  62. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-alternatives.md +352 -0
  63. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-bunqueue.md +300 -0
  64. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-openworkflow.md +402 -0
  65. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-1.md +758 -0
  66. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-2.md +645 -0
  67. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-3.md +602 -0
  68. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-adversarial.md +27 -0
  69. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-architecture.md +27 -0
  70. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-coverage.md +74 -0
  71. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-security.md +15 -0
  72. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-adversarial.md +132 -0
  73. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-verification.md +147 -0
  74. package/docs/architecture/specs/stash-conventions-code-spec.md +275 -0
  75. package/docs/architecture/specs/stash-organization-conventions.md +377 -0
  76. package/docs/architecture/specs/task-workflow-format-unification.md +721 -0
  77. package/docs/architecture/specs/workflow-engine-buy-vs-build.md +231 -0
  78. package/docs/architecture/specs/workflow-format-unification.md +437 -0
  79. package/docs/architecture/testing/manual-testing-checklist.md +3420 -0
  80. package/docs/architecture/testing/okf-v0.2-conformance-runbook.md +924 -0
  81. package/docs/architecture/testing/task-workflow-manual-tests.md +1817 -0
  82. package/docs/architecture/testing/testing-workflow.md +446 -0
  83. package/docs/architecture/workflow-engine.md +274 -0
  84. package/docs/guides/README.md +33 -0
  85. package/docs/guides/author-bundles.md +310 -0
  86. package/docs/guides/author-workflows.md +520 -0
  87. package/docs/guides/bundles.md +321 -0
  88. package/docs/guides/capture-knowledge.md +136 -0
  89. package/docs/guides/claude-code-vs-akm-workflows.md +30 -0
  90. package/docs/guides/concepts.md +93 -0
  91. package/docs/guides/discover-and-load.md +158 -0
  92. package/docs/guides/getting-started.md +240 -0
  93. package/docs/guides/improve-the-library.md +246 -0
  94. package/docs/guides/knowledge-management.md +18 -0
  95. package/docs/guides/recipes/headless-install.md +97 -0
  96. package/docs/guides/recipes/website-source.md +28 -0
  97. package/docs/guides/run-workflows.md +279 -0
  98. package/docs/guides/scheduling.md +123 -0
  99. package/docs/guides/use-with-any-agent.md +129 -0
  100. package/docs/guides/wikis.md +81 -0
  101. package/docs/maintainers/README.md +19 -0
  102. package/docs/maintainers/curate-workmap.md +336 -0
  103. package/docs/maintainers/eval.md +3 -0
  104. package/docs/maintainers/local-development.md +108 -0
  105. package/docs/maintainers/release-checklist.md +103 -0
  106. package/docs/migration/README.md +2 -2
  107. package/docs/migration/release-notes/0.0.13.md +1 -1
  108. package/docs/migration/release-notes/0.1.0.md +1 -1
  109. package/docs/migration/release-notes/0.2.0.md +1 -1
  110. package/docs/migration/release-notes/0.3.0.md +1 -1
  111. package/docs/migration/release-notes/0.5.0.md +1 -1
  112. package/docs/migration/release-notes/0.6.0.md +1 -1
  113. package/docs/migration/release-notes/0.7.0.md +1 -1
  114. package/docs/migration/release-notes/0.7.3.md +2 -2
  115. package/docs/migration/release-notes/0.7.4.md +1 -1
  116. package/docs/migration/release-notes/0.7.5.md +1 -1
  117. package/docs/migration/release-notes/0.8.0.md +1 -1
  118. package/docs/migration/release-notes/0.9.0.md +1 -1
  119. package/docs/migration/release-notes/0.9.14.md +1 -1
  120. package/docs/migration/release-notes/0.9.15.md +1 -1
  121. package/docs/migration/release-notes/0.9.16.md +1 -1
  122. package/docs/migration/release-notes/0.9.17.md +1 -1
  123. package/docs/migration/release-notes/0.9.19.md +1 -1
  124. package/docs/migration/release-notes/0.9.2.md +1 -1
  125. package/docs/migration/release-notes/README.md +27 -31
  126. package/docs/migration/v0.5-to-v0.6.md +759 -0
  127. package/docs/migration/v0.8-to-v0.9.md +1 -1
  128. package/docs/plans/0.9.2-agent-command-workflow-plan.md +423 -0
  129. package/docs/posts/README.md +30 -0
  130. package/docs/posts/akm-command-tour.md +495 -0
  131. package/docs/posts/akm-logo-sized.webp +0 -0
  132. package/docs/posts/belief-aware-memory-12.md +139 -0
  133. package/docs/posts/config-v2-lessons-16.md +191 -0
  134. package/docs/posts/improve-loop-autonomous-10.md +225 -0
  135. package/docs/posts/improve-pipeline-debugging-0803.md +179 -0
  136. package/docs/posts/intro-part-01.md +76 -0
  137. package/docs/posts/intro-part-02.md +221 -0
  138. package/docs/posts/intro-part-03.md +190 -0
  139. package/docs/posts/intro-part-04.md +221 -0
  140. package/docs/posts/llm-mode-reflect-13.md +166 -0
  141. package/docs/posts/openpalm-built-on-akm.md +86 -0
  142. package/docs/posts/progressive-disclosure-06.md +129 -0
  143. package/docs/posts/proposal-safety-net-15.md +112 -0
  144. package/docs/posts/release-0.5.0.md +247 -0
  145. package/docs/posts/release-0.6.0.md +117 -0
  146. package/docs/posts/release-0.7.0.md +159 -0
  147. package/docs/posts/release-0.8.0.md +332 -0
  148. package/docs/posts/scattered-skills-05.md +100 -0
  149. package/docs/posts/task-assets-persistent-workflows-11.md +222 -0
  150. package/docs/posts/team-skills-07.md +198 -0
  151. package/docs/posts/wiki-agent-knowledge-08.md +223 -0
  152. package/docs/posts/workflows-vaults-09.md +321 -0
  153. package/docs/product-surface.md +54 -0
  154. package/docs/reference/README.md +1 -2
  155. package/docs/reference/asset-types.md +168 -0
  156. package/docs/reference/cli.md +5 -6
  157. package/docs/reference/env-and-secrets.md +126 -0
  158. package/docs/reference/memory.md +124 -0
  159. package/docs/reference/refs.md +156 -0
  160. package/docs/reference/registry.md +489 -0
  161. package/docs/reference/website-sources.md +141 -0
  162. package/package.json +12 -15
@@ -0,0 +1,126 @@
1
+ # Environment & Secrets
2
+
3
+ Reference for `akm env` and `akm secret` — the two protected-value asset
4
+ types. For task-oriented guidance on capturing knowledge in general, see
5
+ [Capture Knowledge](../guides/capture-knowledge.md); this page states exact
6
+ contract, defaults, and security behavior.
7
+
8
+ ## env vs secret
9
+
10
+ `akm env` manages a `.env`-backed group of configuration (a whole `.env` file
11
+ loaded wholesale). `akm secret` manages a single standalone sensitive value —
12
+ one value per file, mirroring Docker's secret model. There is no `akm vault`
13
+ command; use `env` or `secret`.
14
+
15
+ | | `env` | `secret` |
16
+ | --- | --- | --- |
17
+ | Purpose | configuration — related settings for an app/service | authentication — one sensitive value |
18
+ | Holds | a `.env` file of many `KEY=value` pairs | one value per file |
19
+ | Discoverable | key *names* (not values) | name only (the whole file is the value) |
20
+ | Injects | many vars at once (`env run`) | one var (`secret run <ref> <VAR>`) |
21
+
22
+ ## Core security guarantee
23
+
24
+ Values never appear in akm's structured output. `env list` and `akm show
25
+ env/<name>` surface key names only — comment text is never surfaced either,
26
+ since comments routinely contain commented-out credentials and are treated
27
+ like values. `secret list` surfaces the secret's name only; the file content
28
+ is never shown. Values reach a process only through the safe injection
29
+ paths, `akm env run` and `akm secret run`, which pass values directly into
30
+ the child process — never through akm's own stdout, the index, or `akm
31
+ show`.
32
+
33
+ ```sh
34
+ akm env create prod # create an empty .env group
35
+ akm env create prod --from-file ./.env # or ingest an existing .env
36
+
37
+ # akm does not manage individual keys — edit the whole file with your own editor:
38
+ $EDITOR "$(akm env path env/prod --quiet)"
39
+
40
+ akm env list
41
+ akm show env/prod # key names only
42
+
43
+ # Inject the whole .env into a subprocess (never onto stdout):
44
+ akm env run env/prod -- ./deploy.sh
45
+ akm env run env/prod -- $SHELL # interactive session with the env loaded
46
+ akm env run env/prod --only DATABASE_URL -- ./migrate
47
+
48
+ # Store a single credential as a secret:
49
+ printf '%s' "$TOKEN" | akm secret set secrets/deploy-token
50
+ akm secret run secrets/deploy-token GITHUB_TOKEN -- gh release create v1.0.0
51
+
52
+ # Write into a specific source instead of the working bundle:
53
+ akm secret set secrets/deploy-token --target team --from-file ./token
54
+ ```
55
+
56
+ `env export --out <file>` writes a safe, sourceable `export KEY='value'`
57
+ script (re-serialised single-quoted, so shell substitutions in the source
58
+ `.env` become literal strings) — it requires `--out` and never prints values
59
+ to stdout.
60
+
61
+ ## File modes and storage
62
+
63
+ `.env` files are stored at mode 0600 under `env/` in the target bundle;
64
+ standalone secrets are stored at mode 0600 under `secrets/`. A secret write
65
+ is atomic under an exclusive per-secret lock held in akm's data directory;
66
+ maximum secret size is 5 MB.
67
+ Values never cross argv (no `/proc/cmdline` exposure). An `env` file or
68
+ secret can carry a sibling `.sensitive` marker that excludes it from `list`
69
+ output and from the search index entirely; the value remains usable via
70
+ `run`.
71
+
72
+ ## Write-target resolution
73
+
74
+ Env/secret **mutations** (`env create`, `env remove`, `secret set`) choose
75
+ their write destination like every other write command: an explicit
76
+ `--target <source>` wins, else `defaultWriteTarget`, else the working
77
+ bundle. The chosen source must be writable — a non-writable target fails
78
+ with a `ConfigError` before anything is written — and a git-backed writable
79
+ target commits the mutation at a single operation boundary. Reads (`list`,
80
+ `show`, `path`, `run`, `export`) still span all configured sources.
81
+
82
+ ## Subprocess residency
83
+
84
+ `akm env run` and `akm secret run` inject values directly into the child
85
+ process — never through a shell — but the child controls its own
86
+ stdout/stderr, so a command that prints its own environment will still leak
87
+ values into your terminal or agent transcript. Injected values live in the
88
+ child process environment for its entire lifetime and are visible to every
89
+ subprocess the child spawns.
90
+
91
+ - Prefer `akm secret run secrets/<name> <VAR> -- <command>` over `akm env
92
+ run` when a command only needs one value.
93
+ - Avoid `env run` / `secret run` for long-lived daemon or server processes;
94
+ for those, point the process at the secret file directly
95
+ (`<bundle>/secrets/<name>`) so the value never sits in a process
96
+ environment variable at all.
97
+ - Avoid running commands that print the environment (`env`, `printenv`,
98
+ shell tracing, verbose diagnostics) in agent contexts unless you
99
+ explicitly intend to expose the child environment.
100
+ - Before spawning, injected key names are scanned for known
101
+ process-hijacking variables (`LD_PRELOAD`, `PATH`, `GIT_CONFIG_*`, ...): a
102
+ first-party bundle warns and proceeds, a third-party-sourced bundle is
103
+ refused.
104
+
105
+ ## Stability
106
+
107
+ `env list`, `env path`, `env export`, `env run`, `secret list`, and `secret
108
+ run` — the read-and-inject surface — are Stable. `env create`, `env remove`,
109
+ and `secret set` — the write verbs — are Experimental. Check
110
+ [STABILITY.md](../../STABILITY.md) for the current tier of any command
111
+ before depending on its exact output shape.
112
+
113
+ ## What this page does not cover
114
+
115
+ This page documents akm's own guarantees for these two asset types, not the
116
+ broader threat model (what a compromised bundle or malicious script could
117
+ still do, what filesystem-level exposure remains, how this compares to a
118
+ dedicated secrets manager). See [SECURITY.md](../../SECURITY.md) for that
119
+ fuller picture, including plaintext-at-rest scope and rotation guidance.
120
+
121
+ ## See also
122
+
123
+ - [Capture Knowledge](../guides/capture-knowledge.md) — `remember`, `import`,
124
+ and when to reach for each
125
+ - [CLI Reference](cli.md) — full flag documentation for `env` and `secret`
126
+ - [SECURITY.md](../../SECURITY.md) — full threat model
@@ -0,0 +1,124 @@
1
+ # Memory
2
+
3
+ Reference for the `memory` asset type: capture, belief states, and derived
4
+ memories.
5
+
6
+ ## Contract
7
+
8
+ Memories are context fragments — observations, decisions, snippets —
9
+ captured as markdown files. Capture one directly in your working bundle with
10
+ `akm remember "..."`, or point akm at any directory of memory files written
11
+ by another tool:
12
+
13
+ ```sh
14
+ # File-based memory store from another tool
15
+ akm bundle add ~/my-agent/memories
16
+ ```
17
+
18
+ Memory assets appear in search results with the `memory` type, giving agents
19
+ access to recalled context from previous sessions.
20
+
21
+ ## Schema
22
+
23
+ Memories captured with `akm remember` can carry optional YAML frontmatter
24
+ that the indexer records:
25
+
26
+ | Field | Purpose |
27
+ | --- | --- |
28
+ | `tags` | Free-form categorization |
29
+ | `source` | Where the memory came from (also used as the derived-memory parent backref — see below) |
30
+ | `observed_at` | When the observation happened |
31
+ | `expires` | When the memory should stop being considered current |
32
+ | `subjective` | Marks the memory as opinion/preference rather than fact |
33
+ | `description` | Short human-readable summary |
34
+ | `captureMode` | `hot` (written via `akm remember`) or `background` (inferred by `akm improve`) |
35
+ | `beliefState` | See belief states below |
36
+ | `supersededBy` | Points at the memory that replaced this one |
37
+
38
+ Supply frontmatter fields explicitly with `--tag`/`--expires`/`--source`,
39
+ derive them from the body heuristically with `--auto`, or have the
40
+ configured LLM propose them with `--enrich`. See
41
+ [`akm remember`](cli.md#remember) for the full flag list.
42
+
43
+ ### Belief states
44
+
45
+ Memories carry a `beliefState` field that records how current they are.
46
+ Search ranking does not read it; the `--belief` filter below does. The
47
+ supported values, from strongest to weakest authority:
48
+
49
+ | State | When it's set | `--belief` |
50
+ | --- | --- | --- |
51
+ | `asserted` | Written directly by `akm remember` (user-explicit) | current |
52
+ | `active` | Default for memories with no explicit state | current |
53
+ | `deprecated` | Marked as no-longer-current but not yet superseded; frozen (never auto-refreshed) | historical |
54
+ | `superseded` | Replaced by another memory via the `supersededBy` field | historical |
55
+ | `contradicted` | Marked as contradicted by other evidence | historical |
56
+ | `archived` | Soft-deleted; retained for audit | historical |
57
+
58
+ `akm search` filters via `--belief current|historical|all`:
59
+
60
+ - `current` → `active` + `asserted`
61
+ - `historical` → `deprecated` + `superseded` + `contradicted` + `archived`
62
+ - `all` (default — no filter) → every belief state, including `archived` and
63
+ `contradicted` memories, is eligible to surface.
64
+
65
+ ### Derived memories as retrieval shortcuts
66
+
67
+ When `akm improve` infers a derived memory from a parent (e.g. distilling a
68
+ verbose memory into a focused summary), the derived memory is written with a
69
+ `source:` frontmatter backref naming the parent, and the indexer records the
70
+ parent/child link in the `derived_from` column. This provenance backref is a
71
+ sanctioned internal channel that carries a bare parent name, not a public
72
+ [ref](refs.md) — agents never construct it.
73
+
74
+ Search hits for the parent memory are then enriched in-place: the parent's
75
+ description and tags are swapped with the derived child's surface text, and
76
+ an `expandTo: memories/<derived>` field on the hit points at the richer
77
+ derived ref. The parent ref itself is preserved on the hit, so existing
78
+ automation keeps working — agents that want the deeper summary follow
79
+ `expandTo`.
80
+
81
+ ## Defaults
82
+
83
+ - Hot-path memories (those written via `akm remember`) receive
84
+ `captureMode: hot` and `beliefState: asserted` in their frontmatter
85
+ automatically.
86
+ - Background-derived memories (those inferred from other assets by `akm
87
+ improve`) receive `captureMode: background`.
88
+ - A memory with no explicit `beliefState` defaults to `active`.
89
+ - `akm search --belief` defaults to `all` — no filter is applied unless you
90
+ pass `current` or `historical` explicitly.
91
+
92
+ ## Security / persistence implications
93
+
94
+ - Memories are plain markdown files inside a bundle directory; there is no
95
+ separate memory store. `akm improve` and `akm lint` only operate on
96
+ writable sources — a read-only registry-cached memory source is excluded
97
+ from cleanup and derivation passes even if it's indexed.
98
+ - The derived-memory `source:` backref and the index's `derived_from` column
99
+ are an internal provenance channel, not a ref an agent should read,
100
+ construct, or rely on programmatically. Use the `expandTo` field on a
101
+ search hit instead.
102
+ - Belief-state frontmatter is rewritten in place by `akm improve`'s memory
103
+ cleanup lane when autonomy is enabled (`experimental.improveAutonomy`);
104
+ with autonomy off, cleanup is analyzed but not applied. See
105
+ `STABILITY.md`'s "`akm improve` autonomy" section.
106
+
107
+ ## Stability
108
+
109
+ Per `STABILITY.md`, **memory belief-state transitions are Experimental**:
110
+ `captureMode`, `beliefState`, contradiction edges, and the consolidate
111
+ journal are observable but the algorithm that writes them is tuning across
112
+ patch releases. Do not script against the exact transition logic — the
113
+ frontmatter fields and their meanings above are the stable-enough surface to
114
+ read, but when and how akm assigns them is still settling. The `lesson`
115
+ asset type, which shares the same distillation pipeline, is also
116
+ Experimental for the same reason.
117
+
118
+ ## See also
119
+
120
+ - [Concepts](../guides/concepts.md) — how a memory fits the capability model
121
+ - [Refs](refs.md) — the public ref grammar (distinct from the internal derived-memory backref)
122
+ - [Asset Types](asset-types.md) — where `memory` sits in the full type taxonomy
123
+ - [`akm remember`](cli.md#remember) — the capture command and its flags
124
+ - `STABILITY.md` — the full stability tier index, including `akm improve` autonomy
@@ -0,0 +1,156 @@
1
+ # Refs
2
+
3
+ Reference for the ref grammar `akm search` emits and `akm show` consumes,
4
+ rename semantics, and namespacing conventions.
5
+
6
+ ## Contract
7
+
8
+ A **ref** is a compact handle identifying one capability. Agents should
9
+ treat refs as opaque tokens — get them from search or curate, pass them to
10
+ show. The structured `conceptId` and `bundle` fields in search results
11
+ provide the same information in parseable form; never parse a ref string by
12
+ hand.
13
+
14
+ ## Grammar
15
+
16
+ ```text
17
+ [bundle//]conceptId[#fragment]
18
+ ```
19
+
20
+ | Part | Required | Description |
21
+ | --- | --- | --- |
22
+ | `bundle` | no | Narrows lookup to one installed bundle, separated from the rest of the ref by `//`. Omit it and the ref resolves against the workspace `defaultBundle`, then the remaining bundles in installation-priority order. |
23
+ | `conceptId` | yes | Subdir-qualified within its bundle: the placement subdirectory followed by the item's canonical name (extension stripped for markdown-like types; scripts and secrets keep their natural filename). `type` is not part of a ref — the subdirectory carries that signal. |
24
+ | `fragment` | no | A selector for part of the item. Input-only — never stored. |
25
+
26
+ Examples: `scripts/deploy.sh`, `agents/reviewer`, `knowledge/api-guide`,
27
+ `workflows/ship-release`, `team-catalog//scripts/deploy.sh`,
28
+ `personal//knowledge/guide`, `knowledge/api-guide#authentication`.
29
+
30
+ Source locators like `github:owner/repo` and `npm:@scope/pkg` are **install
31
+ refs**, a distinct grammar accepted only by `akm bundle add` and `akm
32
+ clone`. They are not asset refs and are never addressable through `akm
33
+ show`.
34
+
35
+ This reference page is deliberately non-normative prose over the same
36
+ grammar; [`docs/architecture/specs/ref.md`](https://github.com/itlackey/akm/blob/main/docs/architecture/specs/ref.md)
37
+ is the normative spec, including the `parseBundleRef` grammar, fragment
38
+ resolution rules, and reserved-name handling.
39
+
40
+ ## Namespacing
41
+
42
+ AKM supports **physical-subdirectory namespacing** — no extra flags
43
+ required. Drop assets under nested directories beneath the type folder and
44
+ the path becomes part of the ref's name:
45
+
46
+ ```text
47
+ memories/projectA/auth-tip.md → memories/projectA/auth-tip
48
+ memories/teamA/clientX/notes.md → memories/teamA/clientX/notes
49
+ skills/projectB/lint-fix.md → skills/projectB/lint-fix
50
+ knowledge/clientX/api-guide.md → knowledge/clientX/api-guide
51
+ ```
52
+
53
+ This works for **any** asset type. The subpath segments become part of the
54
+ conceptId, so `akm search "projectA" --type memory` narrows results to that
55
+ subtree, and `akm show memories/projectA/auth-tip` resolves the full ref.
56
+
57
+ There is also a **ref-prefix query syntax** — a query that is a conceptId
58
+ prefix ending in `/` enumerates that subtree instead of keyword-matching:
59
+
60
+ ```sh
61
+ akm search "memories/" # every memory
62
+ akm search "memories/projectA/" # exactly that subtree
63
+ akm search "team-catalog//" # every item in one bundle
64
+ akm search "team-catalog//skills/" # one subtree of one bundle
65
+ ```
66
+
67
+ Enumeration is `/`-boundary exact — a sibling `projectAlpha/` scope does not
68
+ leak — and hits are a deterministic listing with the fixed browse score `1`,
69
+ not a relevance ranking. Because it matches conceptIds, it works for items
70
+ from every adapter, and you can copy a ref prefix straight out of search
71
+ output and paste it back as a query. A complete ref
72
+ (`memories/projectA/auth-tip`, no trailing `/`) stays an ordinary keyword
73
+ search — resolving a single ref is `akm show`'s job.
74
+
75
+ **Recommendation:** use physical subdirectories now to organize multi-project
76
+ or multi-team bundles. They sort cleanly on disk and require no
77
+ configuration.
78
+
79
+ **Which subdirectory?** Choose the partition axis by asset **type**:
80
+ scope-born types (`memory`, `lesson`, `task`, `env`, `secret`) take the
81
+ current **project/client** slug; reuse-born types (`knowledge`, `skill`,
82
+ `fact`, `script`) take a stable **domain**; global types (`command`, `agent`,
83
+ `workflow`) stay at the type root or a tool slug. The full rules — depth
84
+ limits, no-volatile-facets, off-axis facets as tags, and how to cross-link
85
+ for retrieval — ship as the `facts/conventions/organization`,
86
+ `facts/conventions/backlinks`, and `facts/conventions/domains` convention
87
+ facts in the bundle skeleton, and are surfaced to agents automatically at
88
+ authoring time.
89
+
90
+ ### Planned
91
+
92
+ Not part of the current stability contract; see
93
+ [ROADMAP.md](../../ROADMAP.md) for what's committed:
94
+
95
+ - A `--namespace <ns>` flag to provide a thin name-prefix normalizer on
96
+ `search`, `remember`, `improve`, and `feedback` so the same prefix doesn't
97
+ have to be typed every time.
98
+ - A `::` delimiter (for example `projectA::memories/auth-tip`) to provide
99
+ strict isolation so refs from different namespaces never collide in
100
+ ranking or recall.
101
+
102
+ Until those land, physical subdirectories remain the recommended pattern.
103
+
104
+ ## Renames and moves
105
+
106
+ **Treat a ref as permanent.** A rename is **delete plus create**: the new
107
+ path is a new identity, so the destination starts with fresh learned state
108
+ (utility, salience, usage history) and any inbound refs to the old path
109
+ dangle. When you must rename:
110
+
111
+ ```sh
112
+ mv ~/akm/memories/old-note.md ~/akm/memories/new-note.md
113
+ # update any intentional refs (they are fully qualified: bundle//memories/old-note)
114
+ akm index
115
+ akm lint # confirms nothing dangles
116
+ ```
117
+
118
+ Moving an item between bundles is copy/import followed by deletion from the
119
+ source — both the bundle and the concept identity change. `akm mv`, which
120
+ promised identity-preserving renames, was removed in 0.9.0: its inbound-ref
121
+ rewriting targeted bare conceptIds rather than the anchored
122
+ `bundle//conceptId` prose form, so it could rewrite non-refs while leaving
123
+ real refs dangling. The procedure above is the only supported path today.
124
+
125
+ To carry an asset's earned signal (feedback, usage, salience/outcome
126
+ history) across a rename, the maintainer script `scripts/rekey-asset-ref.ts`
127
+ re-keys those rows onto the new ref before `akm index` runs; it is Internal
128
+ tooling, not a supported command surface. See
129
+ [the decision record](https://github.com/itlackey/akm/blob/main/docs/architecture/specs/0.9.0-decisions.md#d3--renames-are-delete--create-akm-mv-ships-experimental).
130
+
131
+ ## Refs in prose
132
+
133
+ Refs embedded in prose must use the fully-qualified `bundle//conceptId` form
134
+ — the bundle-slug charset makes such a token lexically anchored — or a
135
+ native link form owned by the adapter (OKF links, wiki links). A bare
136
+ conceptId in prose is ordinary text, not a ref, and no akm tool rewrites it.
137
+
138
+ ## Stability
139
+
140
+ Per `STABILITY.md`, this is **Stable** surface: the
141
+ `[bundle//]conceptId[#fragment]` grammar (durable state always stores the
142
+ fully-qualified `bundle//conceptId`; the short form is accepted input only),
143
+ conceptId-prefix enumeration, and the rename-is-delete-plus-create procedure
144
+ are all named explicitly in the Stable tier, and the ref grammar is called
145
+ out as frozen at 1.0 alongside the supported source model, search behavior,
146
+ and write-target rules. The `--namespace` flag and `::` delimiter above are
147
+ On the horizon, not yet part of the contract. See `STABILITY.md` for the
148
+ full command- and surface-level tier index.
149
+
150
+ ## See also
151
+
152
+ - [Concepts](../guides/concepts.md) — where refs fit in the retrieval loop
153
+ - [Asset Types](asset-types.md) — how a conceptId's subdirectory maps to an asset type
154
+ - [Memory](memory.md) — parent/derived-memory provenance backrefs
155
+ - [`docs/architecture/specs/ref.md`](https://github.com/itlackey/akm/blob/main/docs/architecture/specs/ref.md) — the normative ref grammar spec
156
+ - [ROADMAP.md](../../ROADMAP.md) — planned ref-syntax additions