akm-cli 0.9.17-alpha.6 → 0.9.17-alpha.8
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 +285 -0
- package/STABILITY.md +2 -2
- package/dist/akm +62 -29
- package/dist/akm-migrate +38 -19
- package/dist/assets/prompts/retrieval-relevance-judge.md +6 -0
- package/dist/assets/stash-skeleton/facts/conventions/backlinks.md +5 -3
- package/dist/commands/improve/consolidate.js +11 -0
- package/dist/commands/improve/improve-cli.js +27 -7
- package/dist/commands/improve/ledger.js +7 -3
- package/dist/commands/improve/loop-stages.js +4 -3
- package/dist/commands/improve/preparation.js +40 -10
- package/dist/commands/improve/reflect.js +46 -22
- package/dist/commands/improve/retrieval-gate.js +127 -0
- package/dist/commands/improve/retrieval-scope.js +77 -0
- package/dist/commands/read/curate.js +41 -30
- package/dist/commands/read/show.js +55 -2
- package/dist/commands/sources/info.js +3 -0
- package/dist/commands/tasks/tasks-cli.js +10 -12
- package/dist/commands/tasks/tasks.js +57 -56
- package/dist/commands/tasks/validate.js +27 -46
- package/dist/core/adapter/adapters/akm-adapter.js +2 -0
- package/dist/core/adapter/adapters/akm-metadata.js +31 -0
- package/dist/core/adapter/adapters/akm-task-adapter.js +29 -8
- package/dist/core/improve-result.js +4 -1
- package/dist/core/non-task-input.js +20 -0
- package/dist/core/paths.js +0 -4
- package/dist/indexer/db/graph-db.js +0 -32
- package/dist/indexer/graph/graph-extraction.js +3 -1
- package/dist/indexer/indexer.js +1 -3
- package/dist/indexer/links/declared-links.js +90 -0
- package/dist/indexer/scan/doc-to-entry.js +1 -0
- package/dist/indexer/usage/usage-events.js +34 -0
- package/dist/llm/graph-extract.js +26 -37
- package/dist/output/shapes/helpers.js +3 -0
- package/dist/output/text/show-format.js +16 -0
- package/dist/scripts/akm-migrate-node.js +6377 -6437
- package/dist/scripts/akm-migrate.js +6860 -6920
- package/dist/storage/repositories/index-entries-repository.js +12 -6
- package/dist/storage/repositories/index-entry-schema.js +18 -1
- package/dist/storage/repositories/index-links-repository.js +143 -0
- package/dist/storage/repositories/index-schema.js +27 -0
- package/dist/storage/repositories/proposals-repository.js +4 -0
- package/dist/tasks/backends/cron.js +80 -43
- package/dist/tasks/backends/launchd.js +28 -15
- package/dist/tasks/backends/schtasks.js +25 -10
- package/dist/tasks/run/load-task.js +1 -1
- package/dist/tasks/scheduler-binding.js +4 -2
- package/dist/tasks/scheduler-invocation.js +127 -235
- package/dist/tasks/scheduler-sync.js +13 -8
- package/dist/tasks/source/parse-task-source.js +22 -126
- package/dist/tasks/source/task-to-v4.js +463 -87
- package/docs/migration/release-notes/0.9.17.md +7 -5
- package/docs/migration/v0.9.1-to-v0.9.2.md +7 -3
- package/docs/reference/cli.md +26 -10
- package/docs/reference/tasks.md +58 -40
- package/package.json +1 -1
- package/dist/tasks/source/task-to-v3.js +0 -507
|
@@ -57,7 +57,9 @@ pace: an unmigrated v2/v3 task source keeps reading and running through the
|
|
|
57
57
|
in-memory read shim, with a one-line deprecation warning, until you migrate
|
|
58
58
|
it (nothing silently breaks or half-runs, and only a genuinely unmigratable
|
|
59
59
|
shape fails closed with an actionable hint), and pre-`irVersion`-5 runs stay
|
|
60
|
-
inspectable indefinitely.
|
|
60
|
+
inspectable indefinitely. (0.9.17-alpha.7 removed that shim: a v2/v3 task
|
|
61
|
+
source now fails on its own, naming `akm migrate apply`, which `akm upgrade`
|
|
62
|
+
runs after an install.)
|
|
61
63
|
|
|
62
64
|
## Task sources
|
|
63
65
|
|
|
@@ -72,7 +74,9 @@ apply` remains the way to rewrite the file on disk and silence the warning.
|
|
|
72
74
|
current grammar — extended the same kind of shim to a `version: 4` document
|
|
73
75
|
whose `schedule[]` still carries a per-entry `enabled` key, retired from
|
|
74
76
|
task source v4's own grammar since; the field is stripped without being
|
|
75
|
-
read, never re-added.
|
|
77
|
+
read, never re-added. 0.9.17-alpha.7 removed both shims: akm now reads only
|
|
78
|
+
task source v4, and each older file fails on its own, naming
|
|
79
|
+
`akm migrate apply`.)
|
|
76
80
|
|
|
77
81
|
**Before — 0.9.1 task v2:**
|
|
78
82
|
|
|
@@ -679,7 +683,7 @@ phase-specific code:
|
|
|
679
683
|
| Code | Domain |
|
|
680
684
|
|---|---|
|
|
681
685
|
| `TASK_SOURCE_INVALID` | A task document's field- or semantic-level validation failure, or a malformed/oversized/too-deep YAML front end failure. |
|
|
682
|
-
| `TASK_SCHEMA_VERSION_UNSUPPORTED` | A task document's `version:` is `3` or `2` and the in-memory read shim's deterministic conversion cannot resolve it — a human decision is needed (see [Task sources](#task-sources)); a convertible v2/v3 document reads through the shim instead of failing. |
|
|
686
|
+
| `TASK_SCHEMA_VERSION_UNSUPPORTED` | A task document's `version:` is `3` or `2` and the in-memory read shim's deterministic conversion cannot resolve it — a human decision is needed (see [Task sources](#task-sources)); a convertible v2/v3 document reads through the shim instead of failing. From 0.9.17-alpha.7, every v2/v3 document fails this way, naming `akm migrate apply`. |
|
|
683
687
|
| `TARGET_REF_INVALID` | A value is not a canonical `commands/`, `scripts/`, `tasks/`, or `workflows/` asset ref (malformed shapes, GitHub locators, other asset families). |
|
|
684
688
|
| `WORKFLOW_SOURCE_INVALID` | A workflow-source compile failure other than the one below. |
|
|
685
689
|
| `COMPOSITION_INVALID` | A composition-policy rejection: a rejected `with:`, a multi-job document, a composition cycle/depth/size violation. |
|
package/docs/reference/cli.md
CHANGED
|
@@ -104,7 +104,7 @@ with an `INVALID_SHAPE_VALUE` usage error (exit 2) — an honest rejection rathe
|
|
|
104
104
|
than a silent fallback. It returns a compact view suitable for capability
|
|
105
105
|
discovery:
|
|
106
106
|
|
|
107
|
-
- **show**: `type`, `name`, canonical `ref`, `description`, `tags`, `parameters`, `workflowTitle`, `action`, `run`, `origin`, `keys`, `related`
|
|
107
|
+
- **show**: `type`, `name`, canonical `ref`, `description`, `tags`, `parameters`, `workflowTitle`, `action`, `run`, `origin`, `keys`, `related`, `links`
|
|
108
108
|
|
|
109
109
|
## Exit Codes and Error Envelope
|
|
110
110
|
|
|
@@ -331,7 +331,7 @@ Returns a JSON object with:
|
|
|
331
331
|
| `semanticSearch` | Semantic search status: `mode`, `status`, and optional `reason`/`message` |
|
|
332
332
|
| `registries` | Configured registries |
|
|
333
333
|
| `sourceProviders` | Configured sources (filesystem, git, website, npm) |
|
|
334
|
-
| `indexStats` | Index stats: `entryCount`, `byType` (per-asset-type breakdown), `lastBuiltAt`, `hasEmbeddings` |
|
|
334
|
+
| `indexStats` | Index stats: `entryCount`, `byType` (per-asset-type breakdown), `links` (declared links per kind with `total` and `unresolved`; absent when the index holds none), `lastBuiltAt`, `hasEmbeddings` |
|
|
335
335
|
|
|
336
336
|
`semanticSearch.status` values:
|
|
337
337
|
- `"ready-js"` — every entry has a vector; semantic search is active (the name is historical: `"ready-vec"`, the sqlite-vec variant, is gone)
|
|
@@ -436,7 +436,8 @@ The indexed entity graph (entities/relations extracted from bundle assets) has
|
|
|
436
436
|
no dedicated inspection command; its summary counts surface as an info-level
|
|
437
437
|
metric in `akm health`. Graph data is automatically re-extracted on the first
|
|
438
438
|
`akm improve` cycle after a `DB_VERSION` upgrade. The graph backs `akm show`'s
|
|
439
|
-
`related` list
|
|
439
|
+
`related` list; it does not affect search ranking. Curate's support refs come
|
|
440
|
+
from declared links (`akm show`'s `links`), not from this graph.
|
|
440
441
|
|
|
441
442
|
### search
|
|
442
443
|
|
|
@@ -595,10 +596,13 @@ akm curate "learn the release workflow" --from all --format text
|
|
|
595
596
|
| `--track-usage`, `--no-track-usage` | flag | `true` | Record or suppress local usage events for this successful read |
|
|
596
597
|
|
|
597
598
|
`akm curate` takes the top `--limit` hits of one search, in search order, and
|
|
598
|
-
enriches each with a preview, run details and up to two
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
599
|
+
enriches each with a preview, run details and up to two support refs: the
|
|
600
|
+
assets the hit's declared links name (`xrefs:`, `supersededBy:` and the other
|
|
601
|
+
kinds `akm show` lists under `links`), what it links to before what links to
|
|
602
|
+
it, skipping assets curate already selected. With
|
|
603
|
+
`search.curateRerank.enabled`, a cross-encoder first reorders the top 30 fused
|
|
604
|
+
candidates (`search.curateRerank.topN`) by name, description and the start of
|
|
605
|
+
each asset's indexed content. Curate includes direct follow-up
|
|
602
606
|
commands such as `akm show <ref>` or `akm bundle add <ref>` so you can
|
|
603
607
|
immediately inspect or install what it found.
|
|
604
608
|
`--detail` and `--shape agent` both work on curate output; `--shape summary`
|
|
@@ -691,6 +695,17 @@ returns a compact view with `type`, `name`, `ref`, `description`, `tags`,
|
|
|
691
695
|
`parameters`, `workflowTitle`, `action`, `run`, `origin`, and `keys`, plus the
|
|
692
696
|
optional fragment metadata described below.
|
|
693
697
|
|
|
698
|
+
`links` lists the asset's declared links, grouped by kind: `outgoing` (the
|
|
699
|
+
assets its own `xrefs:`, `supersededBy:`, `contradictedBy:`,
|
|
700
|
+
`currentBeliefRefs:`, wiki `sources:`, `.derived` parent, page links, or
|
|
701
|
+
workflow and task targets name), `incoming` (the assets that name it), and
|
|
702
|
+
`unresolved` (tokens it names that match no indexed asset, as written). Each
|
|
703
|
+
kind is `{ "total": n, "refs": [...] }` with at most 10 refs; `total` counts
|
|
704
|
+
them all. The field is omitted when nothing links either way. Links are read
|
|
705
|
+
from frontmatter and parsed structure at index time, with no model; they do
|
|
706
|
+
not affect search ranking. `related` is separate: the LLM entity graph's
|
|
707
|
+
shared-entity neighbours.
|
|
708
|
+
|
|
694
709
|
Opaque fragment shows and `--context lead` keep `ref` as the canonical parent
|
|
695
710
|
identity and add
|
|
696
711
|
`selectedRef`, `parentRef`, one-based `fragmentOrdinal`, `fragmentCount`,
|
|
@@ -2980,9 +2995,10 @@ crontab whose akm markers are malformed is refused unmodified, and another
|
|
|
2980
2995
|
akm process holding the scheduler lock makes sync exit 75 (retry shortly).
|
|
2981
2996
|
|
|
2982
2997
|
`akm task prune` reclaims installed scheduler entries that `sync` can never
|
|
2983
|
-
clean up on its own: entries
|
|
2984
|
-
|
|
2985
|
-
|
|
2998
|
+
clean up on its own: entries that no longer resolve to a live bundle (a row
|
|
2999
|
+
whose `AKM_BUNDLE_DIR` names a directory that is gone, or a row written
|
|
3000
|
+
before 0.9.17-alpha.7 whose `--scheduler-context` descriptor cannot be
|
|
3001
|
+
read). It never touches an entry that
|
|
2986
3002
|
still resolves to a live bundle — that's `sync`'s job. Like `sync
|
|
2987
3003
|
--dry-run`, the default is a dry-run preview (zero scheduler writes) that
|
|
2988
3004
|
exits non-zero when there are candidates to remove; `--yes` executes the
|
package/docs/reference/tasks.md
CHANGED
|
@@ -5,27 +5,22 @@ Task assets are strict, local automation sources. They live at
|
|
|
5
5
|
launchd, or Windows Task Scheduler with `akm task sync`. The task file is
|
|
6
6
|
authored source; scheduler entries are derived OS state.
|
|
7
7
|
|
|
8
|
-
**Task source v4 (`version: 4`) is the
|
|
9
|
-
document with `version: 3` or `version: 2`
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
stripped without ever being read (activation is host-local, below) and the
|
|
20
|
-
same one-line deprecation warning is printed. Task source v4 adds typed
|
|
21
|
-
`inputs:` and a single bounded `output:` schema (command targets only), and
|
|
22
|
-
makes scheduling OPTIONAL rather than mandatory. `akm task add` authors
|
|
23
|
-
task source v4 directly.
|
|
8
|
+
**Task source v4 (`version: 4`) is the only task source grammar akm reads.**
|
|
9
|
+
A document with `version: 3` or `version: 2` fails to load with `UsageError`
|
|
10
|
+
code `TASK_SCHEMA_VERSION_UNSUPPORTED`, naming `akm migrate apply`, which
|
|
11
|
+
converts it. A declared `version: 4` document whose `schedule[]` still
|
|
12
|
+
carries a per-entry `enabled` key — 0.9.15's v4 grammar accepted it, this
|
|
13
|
+
release's does not — fails the same way with `TASK_SOURCE_INVALID`
|
|
14
|
+
(activation is host-local, below). Each such file fails on its own:
|
|
15
|
+
`akm task sync` reports it and keeps reconciling every other task. Task
|
|
16
|
+
source v4 adds typed `inputs:` and a single bounded `output:` schema
|
|
17
|
+
(command targets only), and makes scheduling OPTIONAL rather than
|
|
18
|
+
mandatory. `akm task add` authors task source v4 directly.
|
|
24
19
|
|
|
25
20
|
If you have `version: 3` or `version: 2` files on disk (from an earlier
|
|
26
21
|
akm release), see [Migrating to task source v4](#migrating-to-task-source-v4)
|
|
27
22
|
below — `akm migrate apply` converts both generations in one pass and
|
|
28
|
-
rewrites the file on disk
|
|
23
|
+
rewrites the file on disk (`akm upgrade` runs it after an install). The
|
|
29
24
|
retired v3 grammar itself is documented at the bottom of this page
|
|
30
25
|
([Task v3 (retired): grammar reference for migration](#task-v3-retired-grammar-reference-for-migration))
|
|
31
26
|
purely so you can read an old file while migrating it; it is no longer
|
|
@@ -38,10 +33,9 @@ indexed, scheduled, or run. Every task should declare `version: 4`; a
|
|
|
38
33
|
document with no `version:` key, or a `version:` that is not a number,
|
|
39
34
|
fails with `TASK_SOURCE_INVALID` (`must be exactly 4.` / `is required and
|
|
40
35
|
must be exactly 4.`) — a genuinely malformed v4 document, not a legacy one.
|
|
41
|
-
`version: 3` and `version: 2`
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
(see [Migrating to task source v4](#migrating-to-task-source-v4)).
|
|
36
|
+
`version: 3` and `version: 2` fail with `TASK_SCHEMA_VERSION_UNSUPPORTED`
|
|
37
|
+
naming `akm migrate apply` (see
|
|
38
|
+
[Migrating to task source v4](#migrating-to-task-source-v4)).
|
|
45
39
|
The published [task schema](../../schemas/akm-task.json) describes the
|
|
46
40
|
hand-authored contract; `src/tasks/source/task-source-v4.ts` is the
|
|
47
41
|
authoritative bounded parser.
|
|
@@ -414,17 +408,14 @@ for full before/after examples and recovery guidance.
|
|
|
414
408
|
anything — see [`akm task explain`](#akm-task-explain) above.
|
|
415
409
|
- `akm task validate <path>` parses one task file by filesystem path (the
|
|
416
410
|
file need not live in a configured bundle) and reports the same
|
|
417
|
-
`valid`/`
|
|
411
|
+
`valid`/`blocked`/`invalid`/`not-a-task` diagnostic
|
|
418
412
|
`akm task sync` would produce for it — including sync's own cron-dialect
|
|
419
413
|
check and its per-schedule-entry input-contract check — without touching
|
|
420
414
|
the scheduler and without requiring a configured engine, even for a
|
|
421
415
|
command-kind task. The envelope's own `sourceVersion` field names the
|
|
422
|
-
file's declared schema version. A version 2/3 file
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
decision it needs. A `version: 4` file whose only defect is a retired
|
|
426
|
-
`schedule[].enabled` also reports `converts` (`sourceVersion` still `4`)
|
|
427
|
-
— it read through the shim too, not the direct v4 path.
|
|
416
|
+
file's declared schema version. A version 2/3 file, and a `version: 4`
|
|
417
|
+
file still carrying a retired `schedule[].enabled`, report `blocked`
|
|
418
|
+
(exit 1) naming `akm migrate apply`, which converts them.
|
|
428
419
|
- `akm task add` validates a task source v4 document, writes it, adds its ref
|
|
429
420
|
to local scheduler activation, and syncs its bundle. `--params` renders
|
|
430
421
|
typed `inputs:` declarations instead of a `with:` bag; `--schedule` is
|
|
@@ -443,8 +434,8 @@ for full before/after examples and recovery guidance.
|
|
|
443
434
|
A row that fails to install or remove is reported in `failures` and every
|
|
444
435
|
other row still applies. A source that fails to parse is reported the same
|
|
445
436
|
way, and its installed row is left exactly as it is. Rows akm cannot attribute to a bundle this sync covers —
|
|
446
|
-
another bundle's, another installation's (the row's
|
|
447
|
-
different
|
|
437
|
+
another bundle's, another installation's (the row's `AKM_BUNDLE_DIR`
|
|
438
|
+
names a different working stash), or anything outside akm's `# akm:task` markers,
|
|
448
439
|
`com.akm.task.` labels, or `\akm\` task folder — are never touched. A
|
|
449
440
|
Task Scheduler row is compared by the fingerprint akm writes into its
|
|
450
441
|
`<Source>` plus its enabled state, so an edit made in Task Scheduler that
|
|
@@ -457,9 +448,10 @@ for full before/after examples and recovery guidance.
|
|
|
457
448
|
removals annotated with their owning bundle) without writing to the
|
|
458
449
|
scheduler; exits non-zero when removals are pending.
|
|
459
450
|
- `akm task prune` removes installed scheduler entries `sync` cannot reach
|
|
460
|
-
because
|
|
461
|
-
|
|
462
|
-
|
|
451
|
+
because they no longer resolve to a live bundle: a row whose
|
|
452
|
+
`AKM_BUNDLE_DIR` names a directory that is gone, or a row written before
|
|
453
|
+
0.9.17-alpha.7 whose `--scheduler-context` descriptor cannot be read. It
|
|
454
|
+
never touches an entry that still resolves to a live bundle.
|
|
463
455
|
Defaults to a dry-run preview (zero writes); `--yes` executes it; `--id
|
|
464
456
|
<id1,id2,...>` scopes to specific ids and refuses any id that isn't a
|
|
465
457
|
current orphan candidate.
|
|
@@ -473,13 +465,39 @@ for full before/after examples and recovery guidance.
|
|
|
473
465
|
section directly above the first akm task block in the crontab (on macOS,
|
|
474
466
|
an `EnvironmentVariables` entry in each plist). It is the PATH of the shell
|
|
475
467
|
that ran the sync, rewritten on every crontab write and removed with the
|
|
476
|
-
last akm block; cron applies it to every row below it.
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
468
|
+
last akm block; cron applies it to every row below it.
|
|
469
|
+
- A task's row is its command plus its schedule:
|
|
470
|
+
`<launcher> task run <id> --bundle <bundle> --scheduled`, and it sets its
|
|
471
|
+
own environment. Every row sets `AKM_BUNDLE_DIR` to the working stash of
|
|
472
|
+
the shell that ran the sync (its `AKM_BUNDLE_DIR`, or the default bundle),
|
|
473
|
+
so the scheduled run uses the same working stash, `--bundle` finds a stash
|
|
474
|
+
no config names, and sync tells rows of other installations sharing the
|
|
475
|
+
scheduler apart (#846). Rows synced from a shell that set
|
|
476
|
+
`AKM_CONFIG_DIR`, `AKM_DATA_DIR`, `AKM_CACHE_DIR` or `AKM_STATE_DIR`
|
|
477
|
+
explicitly set those too. Each backend does it its own way: a
|
|
478
|
+
`VAR=value` prefix in the crontab, an `EnvironmentVariables` entry in the
|
|
479
|
+
plist, a `$env:VAR='value';` assignment ahead of the command in Task
|
|
480
|
+
Scheduler. Other defaults resolve at fire time, so a scheduled run uses
|
|
481
|
+
the same state, data and cache directories an interactive command does.
|
|
482
|
+
Run the sync from a shell whose environment you would want scheduled.
|
|
483
|
+
|
|
484
|
+
```text
|
|
485
|
+
15 2 * * * AKM_BUNDLE_DIR=/home/u/akm /home/u/.bun/bin/bun /home/u/.bun/lib/node_modules/akm-cli/dist/akm task run nightly --bundle work --scheduled > /home/u/.cache/akm/tasks/logs/nightly.log 2>&1
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
A row whose command is over 1,000 bytes runs a wrapper script under the
|
|
489
|
+
log directory instead (`sh <log dir>/.akm-cron-wrapper-<id>-<hash>.sh`);
|
|
490
|
+
sync reads the script to tell which task the row runs.
|
|
491
|
+
|
|
492
|
+
Releases 0.9.0 through 0.9.17-alpha.6 wrote a `--scheduler-context
|
|
493
|
+
<file>` argument into each row instead, naming a descriptor file under
|
|
494
|
+
`$DATA/tasks/context/` that held the same values. akm still applies that
|
|
495
|
+
file when such a row fires, and the first `akm task sync` after upgrading
|
|
496
|
+
rewrites each row in place: it shows as an update, keeps the row's
|
|
497
|
+
launcher and schedule, and sets the values inline. A row the sync leaves as it is (its task file failed to load, or
|
|
498
|
+
a `--bundle` sync did not cover it) still names its file; once
|
|
499
|
+
`akm task doctor` lists no binding with a `contextPath`, the old descriptor
|
|
500
|
+
files are not read and can be deleted.
|
|
483
501
|
|
|
484
502
|
Scheduler execution is at least once. Backends provide a stable invocation
|
|
485
503
|
identity and AKM fences stale attempts, but an ambiguous process crash can be
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "akm-cli",
|
|
3
|
-
"version": "0.9.17-alpha.
|
|
3
|
+
"version": "0.9.17-alpha.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "akm (Agent Knowledge Manager) — a portable, local-first capability library for AI agents. Discover, load, share, and improve reusable skills, scripts, workflows, and knowledge across any shell-capable coding agent, including Claude Code, OpenCode, and Cursor.",
|
|
6
6
|
"keywords": [
|