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.
- package/CHANGELOG.md +40 -0
- package/README.md +10 -10
- package/ROADMAP.md +112 -0
- package/dist/commands/feedback-cli.js +21 -13
- package/dist/commands/improve/improve-cli.js +33 -12
- package/dist/core/errors.js +1 -0
- package/dist/core/file-lock.js +10 -1
- package/dist/indexer/usage/usage-events.js +6 -2
- package/dist/llm/client.js +33 -3
- package/dist/scripts/akm-migrate-node.js +6 -1
- package/dist/scripts/akm-migrate.js +6 -1
- package/docs/README.md +42 -41
- package/docs/agents/README.md +15 -0
- package/docs/agents/agent-install.md +14 -0
- package/docs/architecture/README.md +67 -0
- package/docs/architecture/adapters.md +272 -0
- package/docs/architecture/akm-architecture-decision-history.md +2055 -0
- package/docs/architecture/akm-core-principles.md +126 -0
- package/docs/architecture/architecture.md +579 -0
- package/docs/architecture/comparisons/claude-code-vs-akm-workflows-full.md +550 -0
- package/docs/architecture/decisions/0001-no-interpolation-attached-structured-context.md +72 -0
- package/docs/architecture/decisions/0002-unit-reuse-and-input-hash-scope.md +142 -0
- package/docs/architecture/decisions/0003-child-env-allowlist-and-provenance.md +189 -0
- package/docs/architecture/decisions/0004-task-input-contract-and-flag-coercion.md +97 -0
- package/docs/architecture/decisions/0005-task-result-vocabulary-and-legacy-read-mapping.md +108 -0
- package/docs/architecture/decisions/0006-task-source-version-routing.md +124 -0
- package/docs/architecture/decisions/0007-workflow-composition-bounds.md +83 -0
- package/docs/architecture/decisions/0008-task-binding-normalization.md +88 -0
- package/docs/architecture/decisions/0009-child-run-publication-column-parity.md +80 -0
- package/docs/architecture/decisions/0010-driver-protocol-cut.md +36 -0
- package/docs/architecture/decisions/0011-engine-run-loop-invariants.md +125 -0
- package/docs/architecture/decisions/README.md +62 -0
- package/docs/architecture/improvement.md +440 -0
- package/docs/architecture/internals/classification.md +154 -0
- package/docs/architecture/internals/fresh-host-rebuild-runbook.md +40 -0
- package/docs/architecture/internals/functional-contract-patterns.md +340 -0
- package/docs/architecture/internals/health-advisories.md +110 -0
- package/docs/architecture/internals/improve-workflow.md +713 -0
- package/docs/architecture/internals/indexing.md +498 -0
- package/docs/architecture/internals/registry-network-boundary.md +57 -0
- package/docs/architecture/internals/search.md +249 -0
- package/docs/architecture/internals/storage-locations.md +943 -0
- package/docs/architecture/persisted-data-compat.md +59 -0
- package/docs/architecture/reviews/env-secret-access.md +319 -0
- package/docs/architecture/runtime-boundary-design.md +153 -0
- package/docs/architecture/specs/0.9.0-close-out-plan.md +361 -0
- package/docs/architecture/specs/0.9.0-decisions.md +528 -0
- package/docs/architecture/specs/0.9.0-docs-code-drift-register.md +745 -0
- package/docs/architecture/specs/0.9.0-open-items-register.md +135 -0
- package/docs/architecture/specs/0.9.0-public-api-issue-backlog.md +740 -0
- package/docs/architecture/specs/0.9.0-release-surface-review.md +636 -0
- package/docs/architecture/specs/agent-command-engine-model-design.md +513 -0
- package/docs/architecture/specs/akm-0.9.0-bundle-adapter-spec.md +501 -0
- package/docs/architecture/specs/akm-0.9.0-ref-grammar-decision.md +291 -0
- package/docs/architecture/specs/akm-format-neutral-bundle-workspace-spec.md +2059 -0
- package/docs/architecture/specs/di-seams-plan.md +539 -0
- package/docs/architecture/specs/driver-protocol-keep-or-cut.md +275 -0
- package/docs/architecture/specs/fact-asset-type.md +142 -0
- package/docs/architecture/specs/improve-collapse-churn-detector-design.md +634 -0
- package/docs/architecture/specs/okf-support.md +148 -0
- package/docs/architecture/specs/ref.md +329 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/README.md +72 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/findings-consolidated.md +152 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-alternatives.md +352 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-bunqueue.md +300 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-openworkflow.md +402 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-1.md +758 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-2.md +645 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-3.md +602 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-adversarial.md +27 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-architecture.md +27 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-coverage.md +74 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-security.md +15 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-adversarial.md +132 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-verification.md +147 -0
- package/docs/architecture/specs/stash-conventions-code-spec.md +275 -0
- package/docs/architecture/specs/stash-organization-conventions.md +377 -0
- package/docs/architecture/specs/task-workflow-format-unification.md +721 -0
- package/docs/architecture/specs/workflow-engine-buy-vs-build.md +231 -0
- package/docs/architecture/specs/workflow-format-unification.md +437 -0
- package/docs/architecture/testing/manual-testing-checklist.md +3420 -0
- package/docs/architecture/testing/okf-v0.2-conformance-runbook.md +924 -0
- package/docs/architecture/testing/task-workflow-manual-tests.md +1817 -0
- package/docs/architecture/testing/testing-workflow.md +446 -0
- package/docs/architecture/workflow-engine.md +274 -0
- package/docs/guides/README.md +33 -0
- package/docs/guides/author-bundles.md +310 -0
- package/docs/guides/author-workflows.md +520 -0
- package/docs/guides/bundles.md +321 -0
- package/docs/guides/capture-knowledge.md +136 -0
- package/docs/guides/claude-code-vs-akm-workflows.md +30 -0
- package/docs/guides/concepts.md +93 -0
- package/docs/guides/discover-and-load.md +158 -0
- package/docs/guides/getting-started.md +240 -0
- package/docs/guides/improve-the-library.md +246 -0
- package/docs/guides/knowledge-management.md +18 -0
- package/docs/guides/recipes/headless-install.md +97 -0
- package/docs/guides/recipes/website-source.md +28 -0
- package/docs/guides/run-workflows.md +279 -0
- package/docs/guides/scheduling.md +123 -0
- package/docs/guides/use-with-any-agent.md +129 -0
- package/docs/guides/wikis.md +81 -0
- package/docs/maintainers/README.md +19 -0
- package/docs/maintainers/curate-workmap.md +336 -0
- package/docs/maintainers/eval.md +3 -0
- package/docs/maintainers/local-development.md +108 -0
- package/docs/maintainers/release-checklist.md +103 -0
- package/docs/migration/README.md +2 -2
- package/docs/migration/release-notes/0.0.13.md +1 -1
- package/docs/migration/release-notes/0.1.0.md +1 -1
- package/docs/migration/release-notes/0.2.0.md +1 -1
- package/docs/migration/release-notes/0.3.0.md +1 -1
- package/docs/migration/release-notes/0.5.0.md +1 -1
- package/docs/migration/release-notes/0.6.0.md +1 -1
- package/docs/migration/release-notes/0.7.0.md +1 -1
- package/docs/migration/release-notes/0.7.3.md +2 -2
- package/docs/migration/release-notes/0.7.4.md +1 -1
- package/docs/migration/release-notes/0.7.5.md +1 -1
- package/docs/migration/release-notes/0.8.0.md +1 -1
- package/docs/migration/release-notes/0.9.0.md +1 -1
- package/docs/migration/release-notes/0.9.14.md +1 -1
- package/docs/migration/release-notes/0.9.15.md +1 -1
- package/docs/migration/release-notes/0.9.16.md +1 -1
- package/docs/migration/release-notes/0.9.17.md +1 -1
- package/docs/migration/release-notes/0.9.19.md +1 -1
- package/docs/migration/release-notes/0.9.2.md +1 -1
- package/docs/migration/release-notes/README.md +27 -31
- package/docs/migration/v0.5-to-v0.6.md +759 -0
- package/docs/migration/v0.8-to-v0.9.md +1 -1
- package/docs/plans/0.9.2-agent-command-workflow-plan.md +423 -0
- package/docs/posts/README.md +30 -0
- package/docs/posts/akm-command-tour.md +495 -0
- package/docs/posts/akm-logo-sized.webp +0 -0
- package/docs/posts/belief-aware-memory-12.md +139 -0
- package/docs/posts/config-v2-lessons-16.md +191 -0
- package/docs/posts/improve-loop-autonomous-10.md +225 -0
- package/docs/posts/improve-pipeline-debugging-0803.md +179 -0
- package/docs/posts/intro-part-01.md +76 -0
- package/docs/posts/intro-part-02.md +221 -0
- package/docs/posts/intro-part-03.md +190 -0
- package/docs/posts/intro-part-04.md +221 -0
- package/docs/posts/llm-mode-reflect-13.md +166 -0
- package/docs/posts/openpalm-built-on-akm.md +86 -0
- package/docs/posts/progressive-disclosure-06.md +129 -0
- package/docs/posts/proposal-safety-net-15.md +112 -0
- package/docs/posts/release-0.5.0.md +247 -0
- package/docs/posts/release-0.6.0.md +117 -0
- package/docs/posts/release-0.7.0.md +159 -0
- package/docs/posts/release-0.8.0.md +332 -0
- package/docs/posts/scattered-skills-05.md +100 -0
- package/docs/posts/task-assets-persistent-workflows-11.md +222 -0
- package/docs/posts/team-skills-07.md +198 -0
- package/docs/posts/wiki-agent-knowledge-08.md +223 -0
- package/docs/posts/workflows-vaults-09.md +321 -0
- package/docs/product-surface.md +54 -0
- package/docs/reference/README.md +1 -2
- package/docs/reference/asset-types.md +168 -0
- package/docs/reference/cli.md +5 -6
- package/docs/reference/data-and-telemetry.md +6 -0
- package/docs/reference/env-and-secrets.md +126 -0
- package/docs/reference/memory.md +124 -0
- package/docs/reference/refs.md +156 -0
- package/docs/reference/registry.md +489 -0
- package/docs/reference/website-sources.md +141 -0
- package/package.json +12 -15
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
# Design: bundle organization & back-linking conventions
|
|
2
|
+
|
|
3
|
+
Status: accepted (conventions shipped in the bundle skeleton)
|
|
4
|
+
Author: akm
|
|
5
|
+
Date: 2026-07-11
|
|
6
|
+
|
|
7
|
+
> **Amended by the 0.9.0 surface decisions.** Two mechanisms this document
|
|
8
|
+
> records as closed are superseded; the sections below that narrate the
|
|
9
|
+
> 2026-07-12 amendments are kept as a historical record, not current guidance:
|
|
10
|
+
> - **A tooled rename** (`akm mv`, SPEC-7) — the command still ships, but only
|
|
11
|
+
> as an **Experimental** surface outside the stability contract: its
|
|
12
|
+
> inbound-ref rewriting is inverted relative to the body-ref grammar. A rename
|
|
13
|
+
> is delete plus create: the destination is a new identity and learned state
|
|
14
|
+
> does not follow it. The recommended forced-rename procedure is the manual
|
|
15
|
+
> one (move, fix inbound refs, `akm index`, `akm lint`). See
|
|
16
|
+
> [0.9.0-decisions.md D3](0.9.0-decisions.md#d3--renames-are-delete--create-akm-mv-ships-experimental).
|
|
17
|
+
> - **The ref-prefix filter** (SPEC-4) — the `<type>:<prefix>/` spelling is
|
|
18
|
+
> retired in favour of conceptId prefixes (`memories/projecta/`,
|
|
19
|
+
> `bundle//skills/`). See
|
|
20
|
+
> [0.9.0-decisions.md D4](0.9.0-decisions.md#d4--browse-uses-conceptid-prefixes-not-type).
|
|
21
|
+
>
|
|
22
|
+
> The no-rename default this document argues for is therefore *stronger* under
|
|
23
|
+
> 0.9.0, not weaker: no tool you may rely on makes a rename cheap.
|
|
24
|
+
|
|
25
|
+
## Problem
|
|
26
|
+
|
|
27
|
+
The bundle skeleton already ships per-type authoring conventions
|
|
28
|
+
(`facts/conventions/assets/<type>.md`) that tell an agent **how to write** each
|
|
29
|
+
asset type. Nothing told an agent **where to place** an asset (which
|
|
30
|
+
subdirectory) or **how to cross-link** it. Yet placement and linking are exactly
|
|
31
|
+
what determine whether the same knowledge is *retrievable* two sessions later, or
|
|
32
|
+
re-derived from scratch — and whether cross-project reuse happens or duplicates
|
|
33
|
+
accumulate.
|
|
34
|
+
|
|
35
|
+
The request that drove this: define conventions that instruct agents how to
|
|
36
|
+
organize assets under their type directories (subdirectories for projects,
|
|
37
|
+
domains, etc.) and how to back-link them to improve retrieval during agentic
|
|
38
|
+
tasks. This document records the analysis, a structured debate, and the resulting
|
|
39
|
+
conventions.
|
|
40
|
+
|
|
41
|
+
## What AKM's mechanics dictate (the ground truth)
|
|
42
|
+
|
|
43
|
+
Any organization scheme has to fit how AKM actually stores and retrieves. The
|
|
44
|
+
load-bearing facts, each verified in code:
|
|
45
|
+
|
|
46
|
+
1. **Path becomes the ref.** A file's subpath under its type dir is part of its
|
|
47
|
+
ref name — `memories/projectA/auth-tip.md` → `memory:projectA/auth-tip`. Works
|
|
48
|
+
for every type. A ref-prefix query syntax exists since SPEC-4 landed
|
|
49
|
+
(amended 2026-07-11): `akm search "memory:projectA/"` enumerates exactly
|
|
50
|
+
that subtree (typed, recursive, `/`-boundary exact) and a bare `memory:`
|
|
51
|
+
enumerates the whole type. At review time the idiom was false —
|
|
52
|
+
`sanitizeFtsQuery` strips `:` and `/` and `entry_type` is not an FTS
|
|
53
|
+
column, so the query degenerated to token noise (empirically tested; see
|
|
54
|
+
the Review round). `akm search "projectA" --type memory` remains the
|
|
55
|
+
token-match alternative. The path is
|
|
56
|
+
therefore the one facet you cannot express twice and cannot change without
|
|
57
|
+
breaking the ref (and every inbound reference to it).
|
|
58
|
+
2. **Retrieval is search, not browse — and folders are highly visible to the
|
|
59
|
+
ranker.** There is no folder walk at query time — agents `akm search`/
|
|
60
|
+
`akm curate`, then `akm show <ref>`. A subdirectory's real payoff: its tokens
|
|
61
|
+
join the FTS `name` column at the highest bm25 weight (10.0), always merge
|
|
62
|
+
into `tags` (since SPEC-2 landed; see fact 6), and match the cwd
|
|
63
|
+
project-context boost (`projectContextRankingContributor`, +0.2/token,
|
|
64
|
+
cap 0.5). No "indexing-confidence bump" for subdirectories exists in code.
|
|
65
|
+
3. **The FTS surface is `name`, `description`, `tags`, `hints`, `content`**
|
|
66
|
+
(`entries_fts`, `src/storage/repositories/index-schema.ts`). There is **no `project` field** —
|
|
67
|
+
a bare `project:` frontmatter value is invisible to search. Off-axis facets
|
|
68
|
+
must be `tags` to be retrievable.
|
|
69
|
+
4. **`xrefs:` fold into the FTS `hints` field for all types**
|
|
70
|
+
(`src/indexer/search/search-fields.ts:58`). Back-links are a *retrieval*
|
|
71
|
+
signal, not decoration — which means both too few and too many degrade
|
|
72
|
+
ranking.
|
|
73
|
+
5. **Project relevance is recovered at query time.** Ranking blends
|
|
74
|
+
a per-project usage signal — `scopedUtility * 0.7 + globalUtility * 0.3`
|
|
75
|
+
(`SCOPED_UTILITY_BLEND_SCOPED`, `src/indexer/search/ranking-contributors.ts`),
|
|
76
|
+
keyed by a cwd-anchor (a hash of the querying project root), not the asset's
|
|
77
|
+
path. It is NOT rename-proof for the asset: `entry_key` includes the full
|
|
78
|
+
name, so renaming a file mints a new entry row and orphans its accumulated
|
|
79
|
+
global + scoped utility history. As of 0.9.0 that is the defined semantics —
|
|
80
|
+
a rename is delete plus create, and no command preserves learned state
|
|
81
|
+
across one (see 0.9.0-decisions.md D3). A
|
|
82
|
+
reusable asset does not need the *project* baked into its path to rank well
|
|
83
|
+
inside a project — and a manual rename costs learned ranking.
|
|
84
|
+
6. **Directory (scope/domain) tokens always merge into `tags`** — since SPEC-2
|
|
85
|
+
landed (`extractDirTagsFromName`, `src/indexer/passes/metadata.ts`) they are
|
|
86
|
+
derived from the canonical ref subpath, so explicit `tags` no longer
|
|
87
|
+
suppress the scope token, both indexing walks agree, and the exact-tag
|
|
88
|
+
ranking boost fires for the path token without restating it. Filename
|
|
89
|
+
tokens are still auto-derived only when `tags` is empty (they already live
|
|
90
|
+
in the FTS `name` column and in aliases). The old explicit-tags footgun is
|
|
91
|
+
gone; existing installs pick the merged tags up on the next reindex.
|
|
92
|
+
7. **The entity/relation graph boost extracts from body content, not the path**
|
|
93
|
+
(`graph-extraction.ts`). Canonical entity naming must live in the prose.
|
|
94
|
+
8. **`category: convention|meta` facts are surfaced to every non-wiki authoring
|
|
95
|
+
flow** (`resolveStashStandards`); `facts/conventions/assets/<type>.md` is
|
|
96
|
+
surfaced type-scoped (`resolveTypeConventions`). This is the only channel that
|
|
97
|
+
reaches a browse-blind agent mid-task — so conventions must ship as facts.
|
|
98
|
+
9. **Non-wiki xref breakage is caught by `akm lint`, not at write time.** The
|
|
99
|
+
deterministic `missing-ref` check covers body refs, the `refs:` frontmatter
|
|
100
|
+
array, and (since SPEC-1 landed) the `xrefs:`/`supersededBy:`/
|
|
101
|
+
`contradictedBy:` frontmatter channels. A rename dangles inbound links
|
|
102
|
+
silently — nothing catches them until the next `akm lint` run flags them, so
|
|
103
|
+
run `akm lint` as the last step of any rename. (`akm mv` automates this, but
|
|
104
|
+
its rewriting is inverted relative to the body-ref grammar, so it ships
|
|
105
|
+
Experimental in 0.9.0 and does not substitute for the lint run — see
|
|
106
|
+
0.9.0-decisions.md D3.) Wikis are excluded from
|
|
107
|
+
`akm lint`'s directory sweep; the equivalent
|
|
108
|
+
orphan/broken-xref/broken-source/stale-index/uncited-raw structural checks
|
|
109
|
+
are implemented in the LLM Wiki adapter
|
|
110
|
+
(`core/adapter/adapters/llm-wiki-adapter.ts`, ported from the pre-0.9.0
|
|
111
|
+
`akm wiki lint`). **Amendment:** the `akm wiki` command family, including
|
|
112
|
+
`akm wiki lint`, was removed in the 0.9.0 bundle-adapter cutover (see
|
|
113
|
+
[wikis.md](../../guides/wikis.md)) — there is currently no CLI surface that
|
|
114
|
+
invokes these checks.
|
|
115
|
+
|
|
116
|
+
## Research inputs
|
|
117
|
+
|
|
118
|
+
Three parallel research briefs (Karpathy's LLM wiki; agent memory / RAG /
|
|
119
|
+
GraphRAG; PKM taxonomies — Zettelkasten, PARA, Johnny.Decimal) converged on a few
|
|
120
|
+
transferable principles:
|
|
121
|
+
|
|
122
|
+
- **Separate raw from synthesized, and keep raw immutable.** Karpathy's core
|
|
123
|
+
invariant: interpret and correct in a synthesized layer that *cites* the raw
|
|
124
|
+
source; never edit the source. Gives every claim an auditable provenance chain.
|
|
125
|
+
- **The index is the catalog — don't hand-maintain one.** Karpathy's `index.md`
|
|
126
|
+
exists because a filesystem has no ranker. AKM already has one (plus a utility
|
|
127
|
+
signal), so effort should go into per-asset *retrievability* (strong title,
|
|
128
|
+
accurate first paragraph, tags, xrefs), not a hand-kept catalog.
|
|
129
|
+
- **Metadata/facets beat folder depth for retrieval.** The literature repeatedly
|
|
130
|
+
measures metadata-enriched and "contextual"/self-situating retrieval as
|
|
131
|
+
materially better (e.g. contextual headers cutting failed retrievals by a large
|
|
132
|
+
margin) — because the reader is a ranker, not a browser.
|
|
133
|
+
- **Atomicity + sparse, real links (Zettelkasten), not dense mandatory links.**
|
|
134
|
+
Backlinks help multi-hop recall, but forced density produces junk edges.
|
|
135
|
+
- **Controlled vocabulary prevents bucket drift**, but deep hierarchies and
|
|
136
|
+
opaque codes (Johnny.Decimal) fail when nobody browses.
|
|
137
|
+
|
|
138
|
+
## The debate
|
|
139
|
+
|
|
140
|
+
Four positions were argued and adversarially critiqued:
|
|
141
|
+
|
|
142
|
+
| Position | Thesis | Verdict |
|
|
143
|
+
|---|---|---|
|
|
144
|
+
| **Domain-first taxonomy** | Path = stable subject domain; lowest rename rate, highest lexical signal. | reject-keep-ideas |
|
|
145
|
+
| **Scope-first namespacing** | Path = project/client/team; scope is the dominant retrieval filter. | reject-keep-ideas |
|
|
146
|
+
| **Flat + faceted + dense backlinks** | Minimal folders; organizing signal lives in frontmatter + a dense link graph the index can read. | adopt-with-changes |
|
|
147
|
+
| **Hybrid "narrowest stable scope" ladder** | One folder = the narrowest stable boundary (client > project > domain > root), rest in facets. | adopt-with-changes |
|
|
148
|
+
|
|
149
|
+
The critiques were decisive:
|
|
150
|
+
|
|
151
|
+
- **A single global axis fails both ways.** Domain-first makes project scope
|
|
152
|
+
invisible (no `project` FTS field; agents that write `project:` frontmatter get
|
|
153
|
+
zero retrieval benefit) and splits "everything about project A's auth" across
|
|
154
|
+
three query idioms. Scope-first strands reusable assets behind an arbitrary
|
|
155
|
+
project home and creates a `shared/` dumping ground.
|
|
156
|
+
- **The per-asset "narrowest scope" ladder is non-deterministic.** Two agents run
|
|
157
|
+
the delete/archive test on equivalent insights and pick different rungs,
|
|
158
|
+
fragmenting a topic across `memory:projectA/` and `knowledge/auth/` with no
|
|
159
|
+
reconciliation pass — and the wrong guess is baked into an immutable ref.
|
|
160
|
+
- **Mandatory dense xrefs actively hurt.** Because ref strings fold into the FTS
|
|
161
|
+
`hints` field, a link quota smears a popular source's ref token across dozens of
|
|
162
|
+
citers (destroying its ranking signal) and fills the entity graph with
|
|
163
|
+
plausible-but-wrong edges.
|
|
164
|
+
- **Per-namespace hub wikis rot.** As an obligation they contend on concurrent
|
|
165
|
+
writes, generate stale-index lint noise, and flatten the multi-hop graph into a
|
|
166
|
+
namespace-wide star.
|
|
167
|
+
|
|
168
|
+
## Decision
|
|
169
|
+
|
|
170
|
+
**Resolve the project-vs-domain tension by asset TYPE, not per-asset judgment.**
|
|
171
|
+
This is the one rule that is both deterministic mid-task and mechanically
|
|
172
|
+
justified:
|
|
173
|
+
|
|
174
|
+
- **Scope-born types** (`memory`, `lesson`, `task`, `env`, `secret`) → the
|
|
175
|
+
current **project/client** slug. They are born bound to the work in front of
|
|
176
|
+
the agent, so the working context *is* the answer — zero counterfactual
|
|
177
|
+
reasoning, and `akm search "projectA" --type memory` reconstructs the project.
|
|
178
|
+
- **Reuse-born types** (`knowledge`, `skill`, `wiki`, `fact`, `script`) → a
|
|
179
|
+
stable **domain** from a short closed vocabulary. Project relevance is already
|
|
180
|
+
recovered by scoped-utility ranking (fact 5), so spending the path on the
|
|
181
|
+
project axis is redundant; the domain prefix is the only handle that
|
|
182
|
+
co-locates cross-project reuse. For a wiki, the domain names the wiki itself.
|
|
183
|
+
- **Global-by-nature types** (`command`, `agent`, `workflow`, bundle-wide `env`) →
|
|
184
|
+
type root or a tool slug.
|
|
185
|
+
|
|
186
|
+
Supporting rules, all shipped as convention facts:
|
|
187
|
+
|
|
188
|
+
- One path axis; depth 1 (2 max for strict containment); lowercase-hyphen
|
|
189
|
+
semantic segments; **no volatile facets in the path** (status/date/version/…);
|
|
190
|
+
flat type-root fallback instead of inventing a one-off domain.
|
|
191
|
+
- Off-axis facets go in `tags` (never a bare `project:` field); the path
|
|
192
|
+
scope/domain token merges into `tags` automatically, so it never needs
|
|
193
|
+
restating (fact 6).
|
|
194
|
+
- **A provenance xref is mandatory when the asset derives from another** (never
|
|
195
|
+
invented for original observations). Associative xrefs are discretionary and
|
|
196
|
+
capped (~5, a heuristic). Corrections are new assets that xref what they
|
|
197
|
+
correct, paired with `beliefState: superseded`/`supersededBy` on the stale
|
|
198
|
+
asset; immutability applies to ingested material (wiki `raw/`, vendored docs,
|
|
199
|
+
transcripts) — synthesized knowledge pages are the rewritable layer (Karpathy
|
|
200
|
+
immutability inside AKM's flat model).
|
|
201
|
+
- **Self-situating text on every asset** — the orientation line goes in
|
|
202
|
+
`description:`/`when_to_use:` (the higher-weight indexed fields; bounded
|
|
203
|
+
body prose also enters the lowest-weight `content` field). The body header feeds the
|
|
204
|
+
entity graph (extracted from body prose) and human readers at `akm show`.
|
|
205
|
+
Anthropic's Contextual Retrieval figures (35%/49%/67% top-20 failure-rate
|
|
206
|
+
reduction) were measured on chunk-prepended context in a chunked RAG pipeline —
|
|
207
|
+
an analogy motivating the description-field placement, not a measurement of it.
|
|
208
|
+
- Hubs are optional wiki assets for a few high-traffic domains, never a per-write
|
|
209
|
+
obligation. The FTS index is the catalog.
|
|
210
|
+
- A ref is an address chosen once: **default to not renaming**; if unavoidable,
|
|
211
|
+
move the file, grep the bundle for the old ref and fix inbound xrefs in the
|
|
212
|
+
same pass, then `akm index` and `akm lint`. The destination is a new identity
|
|
213
|
+
and starts with fresh learned state.
|
|
214
|
+
|
|
215
|
+
Rejected over-builds: mandatory dense/bidirectional xrefs, per-namespace hub
|
|
216
|
+
wikis, the per-asset scope ladder, and any hand-maintained catalog.
|
|
217
|
+
|
|
218
|
+
## What shipped
|
|
219
|
+
|
|
220
|
+
Convention facts in the bundle skeleton (`src/assets/stash-skeleton/facts/conventions/`):
|
|
221
|
+
|
|
222
|
+
- `organization.md` (`category: convention`) — the partition-by-type placement
|
|
223
|
+
rules. Surfaced to every non-wiki author.
|
|
224
|
+
- `backlinks.md` (`category: convention`) — the cross-linking / provenance /
|
|
225
|
+
canonical-naming rules. Surfaced to every non-wiki author.
|
|
226
|
+
- `domains.md` (`category: convention`) — the editable domain vocabulary and
|
|
227
|
+
canonical entity spellings for reuse-born assets.
|
|
228
|
+
- A short **Placement & linking** section added to each
|
|
229
|
+
`facts/conventions/assets/<type>.md`, stating that type's default axis
|
|
230
|
+
(surfaced type-scoped).
|
|
231
|
+
|
|
232
|
+
Because these are `category: convention` facts, `resolveStashStandards` injects
|
|
233
|
+
them into the authoring context automatically — no code change was required to
|
|
234
|
+
enforce the surfacing. They are soft guidance; a bundle owner edits them to match
|
|
235
|
+
how their bundle is queried.
|
|
236
|
+
|
|
237
|
+
The code changes the finalized conventions imply are specced separately in
|
|
238
|
+
[stash-conventions-code-spec.md](stash-conventions-code-spec.md) (8 specs,
|
|
239
|
+
prioritized and sequenced; nothing implemented in this change).
|
|
240
|
+
|
|
241
|
+
## Review round
|
|
242
|
+
|
|
243
|
+
A two-reviewer adversarial review (retrieval mechanics / IR + KM methodology /
|
|
244
|
+
agent usability), with cross-rebuttals, tuned the shipped conventions. Decisive
|
|
245
|
+
corrections, each code-verified or empirically tested:
|
|
246
|
+
|
|
247
|
+
- **The ref-prefix search idiom was false.** `akm search "<type>:<prefix>/"`
|
|
248
|
+
never worked (`sanitizeFtsQuery` strips `:` and `/`; `entry_type` is not an
|
|
249
|
+
FTS column) — live-tested at zero hits. All convention text now uses
|
|
250
|
+
`akm search "<slug>" --type <type>`. *Amendment (2026-07-11): SPEC-4 has
|
|
251
|
+
since made the idiom real — `<type>:<prefix>/` (and bare `<type>:`) queries
|
|
252
|
+
now translate to a typed subtree enumeration (`parseRefPrefixQuery`). The
|
|
253
|
+
finding was correct at review time; the shipped convention facts keep the
|
|
254
|
+
`--type` idiom for now (re-adoption deferred one release — see open
|
|
255
|
+
questions).*
|
|
256
|
+
- **"Folders are invisible to the ranker" was backwards.** Subpath tokens are
|
|
257
|
+
indexed in the FTS `name` column at the highest weight and earn the cwd
|
|
258
|
+
project-context boost; the claimed "indexing-confidence bump" does not exist.
|
|
259
|
+
- **xrefs never feed the entity graph** — extraction reads body prose
|
|
260
|
+
(memory + knowledge) with frontmatter stripped, so graph-relevant
|
|
261
|
+
relationships must be stated in the body.
|
|
262
|
+
- **Body prose is not FTS/embedding-indexed** — self-situating orientation
|
|
263
|
+
belongs in `description:`/`when_to_use:`; the body header serves the graph
|
|
264
|
+
and human readers.
|
|
265
|
+
- **"Rename-proof" was misleading** — a rename orphans the asset's utility
|
|
266
|
+
history (new `entry_key` row), strengthening the no-rename rule.
|
|
267
|
+
*Amendment (2026-07-12): SPEC-7 (`akm mv`) made a tooled rename preserve that
|
|
268
|
+
history.* **Superseded (0.9.0): a rename is delete plus create and orphans
|
|
269
|
+
the utility history. `akm mv`'s in-place re-key still ships, but it is
|
|
270
|
+
Experimental and nothing may be built on it, so the original finding stands
|
|
271
|
+
unqualified.**
|
|
272
|
+
- **Corrections now pair with `beliefState: superseded`/`supersededBy`**
|
|
273
|
+
(parsed for all markdown types, demoted at rank time), and immutability was
|
|
274
|
+
rescoped to ingested material only, resolving a contradiction with the
|
|
275
|
+
knowledge type conventions.
|
|
276
|
+
- Completeness: `script` joined the reuse-born bucket; wikis take the domain as
|
|
277
|
+
the wiki NAME; `env` got a decision test; a `conventions` domain entered the
|
|
278
|
+
vocabulary (the shipped facts had violated their own list); a two-domain
|
|
279
|
+
tie-break was added; and duplicated pointer text was trimmed from the nine
|
|
280
|
+
co-injected per-type files.
|
|
281
|
+
|
|
282
|
+
## Open questions / future work
|
|
283
|
+
|
|
284
|
+
Items with an implementation path were specced in
|
|
285
|
+
[stash-conventions-code-spec.md](stash-conventions-code-spec.md), and all
|
|
286
|
+
eight specs have since landed (amended 2026-07-12): the lint frontmatter
|
|
287
|
+
channels (SPEC-1), the tag merge (SPEC-2), `--xref` (SPEC-3), the ref-prefix
|
|
288
|
+
filter (SPEC-4), `--supersedes` demotion (SPEC-5), category capture (SPEC-6 —
|
|
289
|
+
shipped capture-only; the rank-time demotion was dropped after measurement
|
|
290
|
+
showed no crowding), `akm mv` (SPEC-7), and bounded native body indexing
|
|
291
|
+
(SPEC-8) — see the closed bullets below. What remains genuinely open:
|
|
292
|
+
vocabulary governance, scheduled consolidation (argued down in the spec — the
|
|
293
|
+
improve pipeline already injects the amended conventions), and the typed
|
|
294
|
+
provenance channel.
|
|
295
|
+
|
|
296
|
+
- **A thin HARD floor.** `akm lint` runs a deterministic `missing-ref` check
|
|
297
|
+
over body text and `refs:` frontmatter for non-wiki markdown assets; the gap
|
|
298
|
+
was precisely the `xrefs:`/`supersededBy:`/`contradictedBy:` frontmatter
|
|
299
|
+
channels the conventions mandate — closed by SPEC-1 in
|
|
300
|
+
[stash-conventions-code-spec.md](stash-conventions-code-spec.md) (implemented:
|
|
301
|
+
the same check now scans those keys too). Orphan and uncited-source checks for
|
|
302
|
+
non-wiki assets are argued down (orphanhood is the sanctioned normal state
|
|
303
|
+
under discretionary linking; uncited-source is undecidable without knowing
|
|
304
|
+
whether an asset is derived).
|
|
305
|
+
- **Kill the tag footgun in code.** Closed by SPEC-2 in
|
|
306
|
+
[stash-conventions-code-spec.md](stash-conventions-code-spec.md)
|
|
307
|
+
(implemented: directory tokens from the canonical ref subpath now always
|
|
308
|
+
merge into `tags`; filename tokens still derive only when `tags` is empty).
|
|
309
|
+
Takes effect on reindex; operators with collapse-detector canary sets should
|
|
310
|
+
re-mint baselines via `akm improve canary --refresh`.
|
|
311
|
+
- **Vocabulary governance.** How an agent proposes a `fact:conventions/domains`
|
|
312
|
+
addition mid-task without blocking on human review (interim: flat type-root
|
|
313
|
+
fallback + a proposal note).
|
|
314
|
+
- **Scheduled consolidation.** A curate/consolidate trigger to dedup near-duplicate
|
|
315
|
+
atoms, promote recurring memories into domain knowledge, and fix danglers —
|
|
316
|
+
since no reorg pass happens organically and utility ranking is cold-start-biased
|
|
317
|
+
toward incumbents.
|
|
318
|
+
- **Naming collision.** The convention's "scope" wording vs the existing
|
|
319
|
+
`entry.scope` (user/agent/run/channel) / `scopeKey` concepts in code — the
|
|
320
|
+
convention facts deliberately say "project/client slug" and "partition axis" to
|
|
321
|
+
avoid cross-wiring; keep it that way.
|
|
322
|
+
- **Ref-prefix filter in code.** Closed by SPEC-4 in
|
|
323
|
+
[stash-conventions-code-spec.md](stash-conventions-code-spec.md)
|
|
324
|
+
(implemented: `parseRefPrefixQuery` detects `<type>:<prefix>/` — and bare
|
|
325
|
+
`<type>:` — queries on the untyped search path and translates them to a
|
|
326
|
+
typed index enumeration with name-prefix narrowing; hits carry the fixed
|
|
327
|
+
browse score 1, an explicit `--type` wins over the parsed type, and the
|
|
328
|
+
in-memory prefix filter leaves an `entry_key LIKE` SQL push-down as a later
|
|
329
|
+
optimization). Whether the skeleton convention facts should re-adopt the
|
|
330
|
+
idiom over `akm search "<slug>" --type <type>` stays deferred one release so
|
|
331
|
+
older CLI versions aren't taught a query shape they don't support.
|
|
332
|
+
- **A tooled rename.** Closed by SPEC-7, then **re-opened in 0.9.0 and answered
|
|
333
|
+
"not as a contract"**: `akm mv` ships Experimental and a rename is delete plus
|
|
334
|
+
create. The recommended forced-rename procedure is the manual one this
|
|
335
|
+
document originally prescribed — move the file (a memory's `.derived.md` twin
|
|
336
|
+
moves with it), grep and fix inbound refs in the same pass, then `akm index`
|
|
337
|
+
and `akm lint`. The no-rename default is again the primary defence, which
|
|
338
|
+
strengthens it. See
|
|
339
|
+
[0.9.0-decisions.md D3](0.9.0-decisions.md#d3--renames-are-delete--create-akm-mv-ships-experimental).
|
|
340
|
+
- **Index self-situating body text.** Closed by SPEC-8 in
|
|
341
|
+
[stash-conventions-code-spec.md](stash-conventions-code-spec.md)
|
|
342
|
+
(implemented: the native adapter normalizes bounded Markdown prose into the
|
|
343
|
+
lowest-weight `content` field; secrets, env files, raw sessions, and session
|
|
344
|
+
checkpoints are excluded at the adapter boundary). The
|
|
345
|
+
`description:`/`when_to_use:` orientation routing the conventions teach
|
|
346
|
+
remains primary.
|
|
347
|
+
- **Typed provenance channel.** Evaluate `sources:` for all types, indexed
|
|
348
|
+
outside `hints` — it would separate provenance from associative links and
|
|
349
|
+
resolve the xref-cap tension mechanically. Rejected for the shipped
|
|
350
|
+
convention because non-wiki `sources:` earns no retrieval benefit today and
|
|
351
|
+
provenance-in-xrefs powers the "what did we build on this?" query.
|
|
352
|
+
- **Convention facts crowd domain-term queries.** Their name/description/
|
|
353
|
+
when_to_use tokens (bodies are unindexed) match via prefix expansion and carry
|
|
354
|
+
the fact type boost (0.22); consider excluding `category: convention` facts
|
|
355
|
+
from default untyped search (their delivery channel is prompt injection,
|
|
356
|
+
parallel to the `session` default exclusion) or demoting the category at rank
|
|
357
|
+
time. *Amendment (2026-07-12): closed by SPEC-6 in
|
|
358
|
+
[stash-conventions-code-spec.md](stash-conventions-code-spec.md), shipped
|
|
359
|
+
capture-only. The `category:` key is now captured into the index as
|
|
360
|
+
`entry.category` (takes effect on reindex), making a category-keyed policy
|
|
361
|
+
implementable — but the spec's prescribed measurement (full skeleton
|
|
362
|
+
convention facts plus a real `knowledge/auth` asset, untyped `auth` query,
|
|
363
|
+
semantic off) showed NO crowding: FTS is exact-first, so prefix expansion
|
|
364
|
+
onto the facts' tokens fires only when nothing matches the query exactly,
|
|
365
|
+
and a real domain asset always outranks the facts. The rank-time demotion
|
|
366
|
+
contributor was therefore dropped;
|
|
367
|
+
`tests/integration/search-convention-fact-demotion.test.ts` pins the no-crowding
|
|
368
|
+
invariant and is the regression guard if demotion is ever revisited.*
|
|
369
|
+
- **Automate correction demotion.** Closed by SPEC-5 in
|
|
370
|
+
[stash-conventions-code-spec.md](stash-conventions-code-spec.md)
|
|
371
|
+
(implemented as the deterministic CLI form: `--supersedes <old ref>` on
|
|
372
|
+
`akm remember`/`akm import` writes the correction with the xref, sets
|
|
373
|
+
`beliefState: superseded` + `supersededBy: [<new ref>]` on the old asset,
|
|
374
|
+
and reindexes it; demoting belief states now also cap the final search
|
|
375
|
+
score so the stale incumbent cannot outrank its correction). An LLM-side
|
|
376
|
+
`curate`/`improve` pass that detects citing corrections automatically
|
|
377
|
+
remains open.
|