akm-cli 0.9.0-rc.13 → 0.9.0-rc.15

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 (111) hide show
  1. package/CHANGELOG.md +162 -23
  2. package/dist/akm-migrate +3 -1
  3. package/dist/assets/hints/cli-hints-full.md +3 -4
  4. package/dist/assets/hints/cli-hints-short.md +5 -5
  5. package/dist/assets/workflows/workflow-template.md +4 -3
  6. package/dist/cli/invocation.js +3 -2
  7. package/dist/cli/retired-commands.js +5 -0
  8. package/dist/cli/unknown-flags.js +226 -0
  9. package/dist/cli.js +19 -35
  10. package/dist/commands/agent/agent-dispatch.js +7 -3
  11. package/dist/commands/agent/contribute-cli.js +15 -3
  12. package/dist/commands/feedback-cli.js +6 -3
  13. package/dist/commands/health/checks.js +6 -3
  14. package/dist/commands/improve/collapse-detector.js +2 -3
  15. package/dist/commands/improve/reflect.js +5 -3
  16. package/dist/commands/lint/base-linter.js +4 -16
  17. package/dist/commands/lint/index.js +13 -13
  18. package/dist/commands/log.js +6 -1
  19. package/dist/commands/migration-tool.js +4 -5
  20. package/dist/commands/observability-cli.js +1 -1
  21. package/dist/commands/proposal/propose.js +5 -3
  22. package/dist/commands/proposal/repository.js +5 -5
  23. package/dist/commands/read/knowledge.js +2 -0
  24. package/dist/commands/registry-cli.js +5 -3
  25. package/dist/commands/sources/add-cli.js +6 -6
  26. package/dist/commands/sources/init.js +1 -1
  27. package/dist/commands/sources/self-update.js +30 -7
  28. package/dist/commands/sources/source-add.js +17 -2
  29. package/dist/commands/tasks/tasks.js +10 -10
  30. package/dist/commands/workflow-cli.js +133 -259
  31. package/dist/core/adapter/adapters/akm-lint.js +17 -13
  32. package/dist/core/adapter/adapters/akm-task-adapter.js +14 -11
  33. package/dist/core/asset/akm-markdown.js +41 -8
  34. package/dist/core/asset/frontmatter.js +22 -0
  35. package/dist/core/asset/resolve-ref.js +23 -3
  36. package/dist/core/common.js +45 -2
  37. package/dist/core/config/config-schema.js +8 -0
  38. package/dist/core/config/schema/experimental.js +0 -17
  39. package/dist/core/config/schema/sources-bundles.js +11 -0
  40. package/dist/core/config/schema/workflow.js +3 -3
  41. package/dist/core/errors.js +5 -1
  42. package/dist/core/logs-db.js +2 -1
  43. package/dist/core/parse.js +4 -1
  44. package/dist/core/state/migrations.js +11 -14
  45. package/dist/core/state-db.js +4 -6
  46. package/dist/core/subprocess.js +6 -4
  47. package/dist/core/type-presentation.js +1 -1
  48. package/dist/indexer/indexer.js +16 -1
  49. package/dist/indexer/search/search-source.js +1 -1
  50. package/dist/indexer/walk/matchers.js +3 -1
  51. package/dist/integrations/agent/config.js +2 -2
  52. package/dist/integrations/agent/detect.js +49 -19
  53. package/dist/integrations/agent/engine-fallback.js +76 -0
  54. package/dist/integrations/agent/profiles.js +14 -0
  55. package/dist/integrations/agent/spawn.js +1 -2
  56. package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +13 -4
  57. package/dist/integrations/lockfile.js +11 -56
  58. package/dist/output/shapes/passthrough.js +0 -6
  59. package/dist/output/text/command-format.js +3 -3
  60. package/dist/output/text/helpers.js +1 -1
  61. package/dist/output/text/show-directives.js +4 -6
  62. package/dist/output/text/workflow-format.js +15 -181
  63. package/dist/output/text/workflow.js +1 -6
  64. package/dist/scripts/akm-migrate-node.js +58666 -0
  65. package/dist/scripts/akm-migrate.js +33976 -11498
  66. package/dist/setup/detect.js +42 -15
  67. package/dist/setup/setup.js +1 -1
  68. package/dist/sources/providers/git-stash.js +4 -2
  69. package/dist/sources/providers/website.js +5 -0
  70. package/dist/sources/snapshot-fetchers/bluesky.js +146 -0
  71. package/dist/sources/snapshot-fetchers/content-extract.js +370 -0
  72. package/dist/sources/snapshot-fetchers/fetcher-util.js +40 -0
  73. package/dist/sources/snapshot-fetchers/host-guard.js +199 -0
  74. package/dist/sources/snapshot-fetchers/registry.js +10 -1
  75. package/dist/sources/snapshot-fetchers/robots.js +348 -0
  76. package/dist/sources/snapshot-fetchers/rss.js +279 -0
  77. package/dist/sources/snapshot-fetchers/secret-seam.js +42 -0
  78. package/dist/sources/snapshot-fetchers/website-ingest.js +488 -257
  79. package/dist/sources/snapshot-fetchers/x.js +193 -0
  80. package/dist/storage/engines/sqlite-migrations.js +22 -107
  81. package/dist/storage/repositories/workflow-runs-repository.js +9 -23
  82. package/dist/tasks/runner.js +43 -19
  83. package/dist/tasks/schema.js +24 -1
  84. package/dist/tasks/validator.js +6 -2
  85. package/dist/workflows/exec/frozen-judge.js +28 -2
  86. package/dist/workflows/exec/native-executor.js +44 -28
  87. package/dist/workflows/exec/param-secrets.js +9 -9
  88. package/dist/workflows/exec/run-workflow.js +122 -60
  89. package/dist/workflows/exec/step-work.js +64 -175
  90. package/dist/workflows/exec/unit-dispatch.js +4 -0
  91. package/dist/workflows/ir/compile.js +2 -2
  92. package/dist/workflows/ir/freeze.js +29 -9
  93. package/dist/workflows/ir/params.js +135 -11
  94. package/dist/workflows/ir/plan-hash.js +1 -1
  95. package/dist/workflows/ir/schema.js +6 -2
  96. package/dist/workflows/renderer.js +2 -2
  97. package/dist/workflows/runtime/checkin.js +3 -3
  98. package/dist/workflows/runtime/runs.js +72 -92
  99. package/dist/workflows/runtime/unit-checkin.js +1 -1
  100. package/dist/workflows/runtime/unit-phases.js +2 -2
  101. package/dist/workflows/validate-summary.js +30 -14
  102. package/docs/migration/release-notes/0.9.0.md +31 -4
  103. package/docs/migration/v0.8-to-v0.9.md +70 -100
  104. package/docs/reference/data-and-telemetry.md +5 -5
  105. package/package.json +7 -3
  106. package/schemas/akm-config.json +24 -6
  107. package/schemas/akm-workflow.json +1 -1
  108. package/dist/workflows/cli.js +0 -33
  109. package/dist/workflows/exec/brief.js +0 -450
  110. package/dist/workflows/exec/report.js +0 -1460
  111. package/dist/workflows/exec/workflow-engine-gate.js +0 -67
@@ -9,10 +9,9 @@
9
9
  * demonstrates each criterion is met, and returns either a pass or structured
10
10
  * corrective feedback steering the agent on what to finish/fix.
11
11
  *
12
- * The LLM call is injected (`judge`) so the gate is unit-testable without a
13
- * live endpoint, and the whole gate is fail-open: when no criteria exist or no
14
- * judge is available the step completes as before (per the workflow-agent
15
- * check-in ADR).
12
+ * The judge call is injected so the gate is unit-testable without a live
13
+ * endpoint. A declared gate is fail-closed: only a well-formed affirmative
14
+ * verdict advances the step.
16
15
  *
17
16
  * @module workflows/validate-summary
18
17
  */
@@ -36,31 +35,45 @@ function buildUserPrompt(input) {
36
35
  /**
37
36
  * Run the summary-validation gate.
38
37
  *
39
- * Fail-open contract:
40
- * - no criteria → `{ complete: true, skipped: true }`
41
- * - no judge → `{ complete: true, skipped: true }`
42
- * - judge throws / returns unparseable → `{ complete: true, skipped: true }`
43
- *
44
- * Only a well-formed `complete: false` verdict blocks completion.
38
+ * No criteria skips verification. A missing, failing, or malformed judge is a
39
+ * rejection: declared criteria are never silently bypassed.
45
40
  */
46
- export async function validateStepSummary(input, judge) {
41
+ export async function validateStepSummary(input, judge, signal) {
47
42
  const criteria = input.completionCriteria.filter((c) => c.trim().length > 0);
48
43
  if (criteria.length === 0) {
49
44
  return { complete: true, missing: [], skipped: true };
50
45
  }
51
46
  if (!judge) {
52
- return { complete: true, missing: [], skipped: true };
47
+ return {
48
+ complete: false,
49
+ missing: criteria,
50
+ feedback: "This step declares completion criteria but no verification judge is available.",
51
+ };
53
52
  }
54
53
  let raw;
55
54
  try {
55
+ if (signal?.aborted)
56
+ throw interruptionReason(signal);
56
57
  raw = await judge({ system: JUDGE_SYSTEM, user: buildUserPrompt({ ...input, completionCriteria: criteria }) });
58
+ if (signal?.aborted)
59
+ throw interruptionReason(signal);
57
60
  }
58
61
  catch {
59
- return { complete: true, missing: [], skipped: true };
62
+ if (signal?.aborted)
63
+ throw interruptionReason(signal);
64
+ return {
65
+ complete: false,
66
+ missing: criteria,
67
+ feedback: "The verification judge failed. Retry after fixing the verifier configuration or service.",
68
+ };
60
69
  }
61
70
  const parsed = parseJsonResponse(raw);
62
71
  if (!parsed || typeof parsed.complete !== "boolean") {
63
- return { complete: true, missing: [], skipped: true };
72
+ return {
73
+ complete: false,
74
+ missing: criteria,
75
+ feedback: "The verification judge returned a malformed verdict instead of the required JSON result.",
76
+ };
64
77
  }
65
78
  if (parsed.complete) {
66
79
  return { complete: true, missing: [] };
@@ -74,3 +87,6 @@ export async function validateStepSummary(input, judge) {
74
87
  "Finish the outstanding work and resubmit with a summary that addresses each criterion.";
75
88
  return { complete: false, missing, feedback };
76
89
  }
90
+ function interruptionReason(signal) {
91
+ return signal.reason instanceof Error ? signal.reason : new Error("Workflow verification interrupted.");
92
+ }
@@ -81,10 +81,37 @@ Primary public command family for 0.9.0:
81
81
 
82
82
  ## Release validation
83
83
 
84
- Release validation passed on 2026-07-31. `bun run release:check` verified the
85
- packed npm installation, Node fallback and Bun launcher paths, migration and
86
- task execution from published 0.8.14, the Linux standalone scheduler artifact,
87
- 2,953 unit tests, 5,061 integration tests, and all seven Docker install targets.
84
+ Release validation was repeated on 2026-07-31. An isolated manual pass covered
85
+ 114 first-run, CLI, indexing, search/show, output-format, strict-flag,
86
+ tools-only agent classification, multi-bundle write/lint, workflow, task,
87
+ llm-wiki, env/secret, feedback/log, config/migration, health, upgrade, and
88
+ registry checks with no failures. `bun run release:check` verified the packed
89
+ npm installation, Node fallback and Bun launcher paths, migration and task
90
+ execution from published 0.8.14, the Linux standalone scheduler artifact,
91
+ 3,003 unit tests, 5,071 integration tests, and all seven Docker install targets.
92
+ The gated semantic-search suite passed 9 tests; Node 24 passed all 9 fallback
93
+ smoke steps and 25 compatibility tests.
94
+
95
+ The post-release checklist audit added a separate 125-check deterministic pass
96
+ for cross-bundle identity, write fidelity, output destinations, lint/task
97
+ behavior, env secrecy, durable log cursors, workflow transitions, proposal
98
+ dry-runs, setup recovery, fresh health initialization, and source-install
99
+ safety. It passed 125/125 on Linux. The current branch also passed
100
+ `bun run check` (3,005 unit and 5,072 integration tests) and `bun run build`.
101
+
102
+ A container-isolated follow-up passed 188 destructive crash/recovery checks,
103
+ including real `SIGKILL` windows across proposal, workflow, and lock journals,
104
+ plus deterministic interruption replay across phase-free migration sentinels.
105
+ The container also passed `release:check --skip-docker`, the seven-image
106
+ Docker install matrix, 9 semantic-search tests, all 9 Node 22 smoke steps, all
107
+ 25 Node compatibility tests, and the offline full gate (3,005 unit and 5,070
108
+ integration tests). This pass exposed and fixed host-scheduler and co-located
109
+ Node/Bun assumptions in three tests; no production behavior changed.
110
+
111
+ Live credential-backed agent/LLM calls and native macOS/Windows execution were
112
+ not run from this Linux host. Their deterministic paths remain covered by the
113
+ full unit/integration suite; release artifacts still require their normal
114
+ platform CI/release checks.
88
115
 
89
116
  Required upgrade checks:
90
117
 
@@ -20,7 +20,7 @@ ordered the way you'll need it:
20
20
  5. [Troubleshooting](#5-troubleshooting)
21
21
 
22
22
  The durable-state re-key, database merge, and config migration are handled by
23
- the journaled, crash-resumable `akm migrate apply` coordinator. It also rewrites
23
+ the crash-resumable `akm migrate apply` coordinator. It also rewrites
24
24
  legacy `workflow:` target refs in valid 0.8 task files after resolving them
25
25
  against their containing/configured bundle while preserving each YAML file's
26
26
  permission mode; it does not translate profile-based configuration or workflow
@@ -109,40 +109,20 @@ akm task sync --rebind
109
109
 
110
110
  Status and dry-run perform the same read-only eligibility checks and report the
111
111
  source config plus target config explicitly. Apply validates the target in
112
- memory, creates a verified recovery run, applies pending `state.db` and
113
- `workflow.db` migrations one transaction at a time, and atomically installs the
114
- prepared config last. If any later artifact fails, apply restores config and
115
- both databases from the verified run before returning. Each artifact is
116
- classified independently, so a current config with pre-cutover databases can be
117
- recovered safely.
118
-
119
- Apply records durable `prepared`, `state-converting`, `state-collapsing`,
120
- `state-applied`, `workflow-applied`, `cutover-applied`, `config-applied`, `tasks-prepared`, `tasks-applied`,
121
- `pilot-prepared`, `pilot-applied`, `rollback-prepared`, and `committed` phases. Every phase stores
122
- streaming size/SHA fingerprints for config, both databases, and SQLite sidecars;
123
- a pre-cutover resume or rollback first requires the exact live generation.
124
- State schema migration and the `state-converting` marker commit together; the
125
- marker binds a canonical logical digest before the journal records the exact
126
- physical `state-collapsing` generation. A marker-write crash is recoverable only
127
- when that digest still matches. Once the journal is bound, any later WAL frame
128
- fails closed; a nonexact generation is accepted only after the raw database
129
- header proves the WAL-to-DELETE collapse completed and the logical digest still
130
- matches. After a process
131
- crash, ordinary config and canonical database access fail closed; `akm migrate
132
- status` reports the pending phase and `akm migrate apply` resumes idempotently
133
- from the retained target and verified backup. Apply also refuses before backup
134
- while managed database handles, maintenance activities, AKM mutation locks, or
135
- workflow claims are live.
136
-
137
- A journal at `state-applied` or `workflow-applied` is authenticated by raw
138
- artifact fingerprints before AKM opens live SQLite files. An exact journal is
139
- durably rewound through `state-converting`; a nonexact journal fails closed
140
- without probing WAL state. A journal at `cutover-applied` or any later
141
- forward-only phase is instead authenticated by the same operation's committed
142
- cutover ledger row, continuing from its recorded phase without requiring the
143
- `state-converting` marker; physical WAL differences are retained rather than
144
- rolled back. A post-cutover journal without that operation-bound marker fails
145
- closed.
112
+ memory and creates a verified recovery run. Before the first mutation it writes
113
+ one phase-free incomplete sentinel containing the retained target, path base,
114
+ and original backup identity. It then applies schema changes by ordered
115
+ migration ID, runs the data and asset transforms idempotently, and atomically
116
+ installs the prepared config last.
117
+
118
+ If a transform fails, apply does not guess at rollback and does not replace the
119
+ original backup. It leaves the incomplete sentinel in place, ordinary config
120
+ and canonical database access fail closed, and the next `akm migrate apply`
121
+ replays the same transforms to convergence. The transaction-local cutover
122
+ ledger prevents duplicate workflow or usage-event imports. The sentinel is
123
+ removed only after final config, schema, task, proposal-ref, and cutover outcome
124
+ checks pass. Apply also refuses before backup while managed database handles,
125
+ maintenance activities, AKM mutation locks, or workflow claims are live.
146
126
 
147
127
  Once already running a contract-capable 0.9 release, future self-upgrades may
148
128
  pass a prepared target through the coordinated upgrade path:
@@ -161,12 +141,13 @@ no migration-config flag is needed.
161
141
 
162
142
  Recovery runs are stored under
163
143
  `$DATA/backups/migrations/<installation-id>/<run-id>/`. They record present and
164
- absent `config.json`, `state.db`, and `workflow.db` artifacts, ordered migration
165
- ledgers, sizes, and streaming SHA-256 hashes. SQLite snapshots must also pass
144
+ absent `config.json`, `state.db`, `workflow.db`, and `index.db` artifacts,
145
+ ordered migration ledgers, and semantic state. SQLite snapshots must pass
166
146
  `PRAGMA quick_check` and ledger-prefix validation before the manifest is
167
- published. `akm-migrate backup --for 0.9.0` creates an additional unique run when
168
- an operator wants a manual snapshot. Routine config writes, telemetry, and
169
- already-current database opens do not depend on any historical run.
147
+ published. `akm-migrate backup
148
+ --for 0.9.0` creates an additional unique run when an operator wants a manual
149
+ snapshot. Routine config writes, telemetry, and already-current database opens
150
+ do not depend on any historical run.
170
151
 
171
152
  ## 2. Ref grammar: `type:name` → `[bundle//]conceptId`
172
153
 
@@ -590,6 +571,11 @@ there was no 0.8.x warn-and-delegate period for these.
590
571
  | `akm workflow template` | `akm workflow create --print` | prints the template without writing |
591
572
  | `akm workflow validate` | `akm lint --type workflows --fail-on-flagged` | plain `lint` exits 0 regardless of findings — keep `--fail-on-flagged` in CI gates to preserve the old non-zero-on-invalid semantics |
592
573
  | `akm workflow watch <run-id>` | `akm log --run <run-id> --since '@offset:<id>'` | |
574
+ | `akm workflow start <ref> --params '<json>'` | `akm workflow run <ref> --<param> <value> ...` | `run` is the canonical start/resume/execute command; parameter flags must exactly match declared names, and `--force` parallel starts are removed |
575
+ | `akm workflow next <target>` | `akm workflow run <target>` or `akm workflow status <target>` | use `run` to execute and `status` to inspect; there is no step-at-a-time native lifecycle |
576
+ | `akm workflow complete ...` | `akm workflow run ...` | native orchestration completes steps itself |
577
+ | `akm workflow brief` / `akm workflow report` | `akm workflow run <target>` | the experimental external-driver protocol was removed; `run` dispatches and records units itself |
578
+ | `akm workflow run <ref> --params '<json>'` | `akm workflow run <ref> --<param> <value> ...` | the JSON parameter bag is removed; repeat array flags or pass object/whole-array values as JSON |
593
579
  | `akm extract --watch` / `--debounce-ms` | (removed) | use the shipped `core/extract.yml` cron template instead of a foreground daemon |
594
580
  | `akm improve canary` / `--refresh` | `bun scripts/refresh-canary-set.ts [--refresh]` | maintainer tooling, run from a source checkout — helper scripts are not shipped in the npm package or binaries |
595
581
  | `akm config show` | `akm config list` | `show` was a self-declared alias |
@@ -713,6 +699,11 @@ keys are errors in v2. Unsupported versions are reported by current task
713
699
  commands. Migration changes only removed AKM spellings; arbitrary shell
714
700
  commands are never rewritten.
715
701
 
702
+ A workflow task now invokes the same native orchestration as `akm workflow
703
+ run`: it executes to completion, failure, or verification rejection rather
704
+ than merely creating a run row. Review scheduled workflow tasks for the
705
+ resulting execution and cost impact before re-enabling the scheduler.
706
+
716
707
  For 0.8 command tasks, syntax migration and self-invocation routing are separate.
717
708
  `--profile` is lowered only for a PATH-selected bare `akm`/`akm.exe`, including
718
709
  when it follows supported `env` options and assignments. The scanner recognizes
@@ -757,88 +748,67 @@ than inventing a command classification. New runs use the correct target kind.
757
748
 
758
749
  ## 5. Troubleshooting
759
750
 
760
- ### "Cannot convert state.db out of WAL mode for migration"
761
-
762
- `akm migrate apply` fails with:
751
+ ### Database is busy
763
752
 
764
- > Cannot convert state.db out of WAL mode for migration — another akm process
765
- > is holding it open. Close other akm processes and re-run `akm migrate apply`.
766
-
767
- This means a live `akm` process (or a zombie connection from a prior crashed
768
- one) still has `state.db` open in WAL mode, which blocks the checkpoint apply
769
- needs to fold `workflow.db` in. Close every other `akm` process (schedulers,
770
- `akm workflow run`, background `improve` runs) and re-run `akm migrate apply`
771
- — it resumes from the last completed phase rather than starting over.
753
+ Close every other `akm` process, including schedulers, workflow runs, and
754
+ background improve jobs, then re-run `akm migrate apply`. Apply holds the
755
+ maintenance barrier and refuses to begin while known database handles, process
756
+ locks, or workflow claims are active.
772
757
 
773
758
  ### Resuming after a crash
774
759
 
775
760
  If `akm migrate apply` is interrupted (killed, host crash, power loss), do not
776
761
  manually edit or delete anything under `$DATA`. Run `akm migrate status` to
777
- read the pending phase, then re-run `akm migrate apply` with the same
778
- `--config` (or none, if the active config is already the target) — it
779
- authenticates the retained target and verified backup by fingerprint and
780
- resumes idempotently from the last durable phase (`prepared`, `state-converting`, `state-collapsing`, `state-applied`,
781
- `workflow-applied`, `cutover-applied`, `config-applied`, `tasks-prepared`,
782
- `tasks-applied`, `pilot-prepared`, `pilot-applied`, `rollback-prepared`, or `committed`). A
783
- malformed or fingerprint-mismatched journal fails closed for operator
784
- diagnosis instead of guessing.
762
+ confirm that an incomplete apply is present, then re-run `akm migrate apply`.
763
+ The sentinel already contains the original target and path base, so `--config`
764
+ is not needed on a retry. Apply reuses the same verified backup and operation ID,
765
+ reruns every idempotent transform, verifies final outcomes, and removes the
766
+ sentinel. A malformed sentinel fails closed for operator diagnosis.
785
767
 
786
- ### Restoring or downgrading the cutover
768
+ ### Restoring migration control state
787
769
 
788
770
  Stop scheduled AKM jobs and all running `akm improve`, `akm extract`, and
789
771
  workflow engine processes first. Restore refuses while a live process lock or
790
772
  workflow lease exists. Then, while still running the 0.9 binary, restore the
791
- complete pre-cutover snapshot:
773
+ pre-cutover config and database snapshot:
792
774
 
793
775
  ```sh
794
776
  akm-migrate restore --for 0.9.0 --run <run-id> --confirm
795
777
  ```
796
778
 
797
779
  Restore verifies the selected run before changing live files and then creates a
798
- second verified rescue run of the current installation. It stages every
799
- replacement beside its destination, writes a durable restore journal,
800
- quarantines each database together with its WAL/SHM sidecars, and only then
801
- publishes clean staged files. The journal records a durable committed phase
802
- before cleanup: an earlier interruption rolls back, while an interruption after
803
- commit finishes cleanup without mixing generations. While either recovery phase
804
- is pending, ordinary config and canonical database access fail closed before
805
- accepting writes or recreating absent files. The selected and rescue runs remain
806
- under `$DATA`; if verification reports corruption, preserve them and recover
807
- from an independent backup.
808
-
809
- Recovery validates the complete restore journal before removing or renaming any
810
- path: journal format and migration version, phase, exact artifact and SQLite
811
- sidecar set, operation-bound stage/quarantine names, path uniqueness, source
812
- backup, and the expected prepared/committed filesystem state. A malformed or
813
- stale journal remains in place and recovery fails closed for operator diagnosis.
814
- Committed recovery additionally authenticates each published artifact against
815
- the selected backup's byte size and streaming SHA-256, then reruns config-state
816
- validation or SQLite `quick_check` and ledger validation before deleting any
817
- quarantine or journal.
818
-
819
- Prepared rollback is itself crash-idempotent. The journal fingerprints the
820
- original config/database/sidecar generation before quarantine. If recovery dies
821
- after restoring a quarantine or deleting a stage but before journal deletion,
822
- the next recovery authenticates the already-restored destination and continues
823
- cleanup. A same-ledger but byte-different substitution fails closed.
824
-
825
- Migration config files, manifests, and apply/restore journals are read through
780
+ second verified rescue run of the current installation. It writes one
781
+ phase-free restore sentinel, stages each selected artifact beside its
782
+ destination, removes stale SQLite sidecars, and publishes the config last. If
783
+ interrupted, ordinary config and canonical database access remain blocked and
784
+ the next recovery repeats the same replacements from the selected backup until
785
+ semantic verification passes. The selected and rescue runs remain under
786
+ `$DATA`; if verification reports corruption, preserve them and recover from an
787
+ independent backup.
788
+
789
+ Recovery runs do not copy writable bundle content. Reserved-file rename and ref
790
+ plans are retained; sidecar/frontmatter rewrites are inherently idempotent, and
791
+ task rewrites are re-planned on each apply. Restore replaces config and databases
792
+ only. Already-migrated content stays in its forward-compatible form so a later
793
+ 0.9 apply can converge without undoing filesystem changes.
794
+
795
+ Migration config files, manifests, and apply/restore sentinels are read through
826
796
  bounded readers (1 MiB each). Oversized local control files fail closed rather
827
- than being loaded wholesale. Apply also measures the complete serialized journal
797
+ than being loaded wholesale. Apply also measures the complete serialized sentinel
828
798
  before its first write; a near-limit config whose expanded target would exceed
829
- the same cap is rejected before any apply journal or artifact mutation.
799
+ the same cap is rejected before any apply sentinel or artifact mutation.
830
800
 
831
- Only after restore succeeds should you install the older AKM binary. A 0.8
832
- binary must not run against a 0.9 config or against `state.db` migration 017 /
833
- `workflow.db` migration 010. If no valid pre-cutover bundle exists, do not
834
- downgrade in place: preserve the current config and databases, create a separate
835
- 0.8 data/config root, and manually reconstruct the profile-based configuration.
801
+ Do not install a 0.8 binary into this restored installation: writable content may
802
+ already use 0.9 task and ref formats. Restore is a control-state recovery step for
803
+ a later 0.9 apply, not an in-place downgrade. To run 0.8 again, recover config,
804
+ databases, and writable content from an independent pre-cutover backup, or create
805
+ a separate 0.8 data/config/content root and reconstruct it manually.
836
806
 
837
807
  ### Where backups live
838
808
 
839
809
  Recovery runs are stored under
840
810
  `$DATA/backups/migrations/<installation-id>/<run-id>/`. They record present and
841
- absent `config.json`, `state.db`, and `workflow.db` artifacts, ordered
842
- migration ledgers, sizes, and streaming SHA-256 hashes. `akm-migrate backup
843
- --for 0.9.0` creates an additional unique run when an operator wants a manual
844
- snapshot outside of `apply`'s automatic one.
811
+ absent `config.json`, `state.db`, `workflow.db`, and `index.db` artifacts,
812
+ ordered migration ledgers, and semantic state. `akm-migrate backup --for 0.9.0`
813
+ creates an additional unique run when an operator wants a manual snapshot
814
+ outside of `apply`'s automatic one.
@@ -174,12 +174,12 @@ the set of types the code actually emits at HEAD (verified against every
174
174
 
175
175
  | Event type | When emitted | Key metadata fields |
176
176
  |---|---|---|
177
- | `workflow_started` | `akm workflow start <ref>` | `ref`, `runId` |
178
- | `workflow_step_completed` | `akm workflow complete` (genuine `completed` transition only; `completeWorkflowStep`, `src/workflows/runtime/runs.ts`) | `ref`, `runId`, `stepId`, `status` |
179
- | `workflow_step_updated` | `akm workflow complete` (non-`completed` transitions: `failed`/`skipped`/`blocked`) | `ref`, `runId`, `stepId`, `status` |
180
- | `workflow_finished` | `akm workflow complete`, when that step completion brings the run to a terminal status | `ref`, `runId` |
177
+ | `workflow_started` | `akm workflow run <ref>` creates a run (including native workflow task execution) | `ref`, `runId` |
178
+ | `workflow_step_completed` | The shared native/driver completion path records a genuine `completed` transition | `ref`, `runId`, `stepId`, `status` |
179
+ | `workflow_step_updated` | The shared native/driver completion path records a non-`completed` transition (`failed`/`skipped`/`blocked`) | `ref`, `runId`, `stepId`, `status` |
180
+ | `workflow_finished` | A native `run` or external-driver `report` transition makes the run terminal | `ref`, `runId` |
181
181
  | `workflow_abandoned` | `akm workflow abandon` | `runId` only — never the workflow title |
182
- | `workflow_unit_started` | A workflow-engine unit dispatch begins (native `akm workflow run` or the `brief`/`report` driver protocol — both require `experimental.workflowEngine`, see [Workflows](workflows.md#enabling-the-workflow-engine-opt-in-in-090)) | ids/status only — never unit instructions or results |
182
+ | `workflow_unit_started` | A unit begins through stable native `akm workflow run` or the experimental `brief`/`report` external-driver protocol | ids/status only — never unit instructions or results |
183
183
  | `workflow_unit_finished` | A workflow-engine unit terminates | ids/status/tokens only — never unit instructions or results |
184
184
 
185
185
  *LLM usage and health*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akm-cli",
3
- "version": "0.9.0-rc.13",
3
+ "version": "0.9.0-rc.15",
4
4
  "type": "module",
5
5
  "description": "akm (Agent Knowledge Manager) — A knowledge toolkit for AI agents: capture, curate, search, and share skills, commands, tools, and knowledge. Works with Claude Code, OpenCode, Cursor, and any AI coding assistant.",
6
6
  "keywords": [
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "license": "MPL-2.0",
35
35
  "pinNotes": {
36
- "@opencode-ai/sdk@1.2.20": "Exact pin. The SDK surface we use (createOpencode + session.create/prompt/delete in src/integrations/agent/sdk-runner.ts) is stable across 1.x, but the SDK has shipped 5+ minor versions of unrelated provider/registry churn. akm-cli is a global CLI install so the pin is isolated from user-project deps. Re-test sdk-runner before bumping."
36
+ "@opencode-ai/sdk@1.2.20": "Exact pin. The SDK surface we use (createOpencodeClient + session.create/prompt/delete in src/integrations/harnesses/opencode-sdk/sdk-runner.ts) is stable across 1.x, but the SDK has shipped 5+ minor versions of unrelated provider/registry churn. akm-cli is a global CLI install so the pin is isolated from user-project deps. Re-test sdk-runner before bumping. Note this package is an HTTP client only — it declares no dependencies and its own createOpencodeServer spawns `opencode serve` — so it does NOT make the opencode binary available; that install is separate and is what every SDK-path probe checks for."
37
37
  },
38
38
  "files": [
39
39
  "dist",
@@ -70,7 +70,7 @@
70
70
  "lint:devto-posts:fix": "bun scripts/lint-devto-posts.ts --fix",
71
71
  "publish:devto": "npx -y @sinedied/devto-cli push \"docs/posts/**/*.md\" --token \"$DEVTO_TOKEN\" --repo \"$GITHUB_REPOSITORY\" --branch \"${GITHUB_REF_NAME:-main}\" --reconcile",
72
72
  "release:check": "./tests/release-check.sh",
73
- "lint": "bunx biome check src/ tests/ scripts/ && bun scripts/lint-tests-isolation.ts && bun scripts/lint-license-headers.ts && bun scripts/lint-runtime-boundary.ts && bun scripts/lint-write-source-chokepoint.ts && bun scripts/lint-process-argv.ts && bun scripts/lint-repository-sql.ts && bun scripts/lint-goldens-presence.ts && bun scripts/lint-golden-captured-at-head.ts && bun scripts/lint-test-ref-literals.ts && bun scripts/lint-shipped-assets.ts && bun scripts/lint-doc-examples.ts && bun scripts/gen-config-schema.ts --check",
73
+ "lint": "bunx biome check src/ tests/ scripts/ && bun scripts/lint-tests-isolation.ts && bun scripts/lint-license-headers.ts && bun scripts/lint-runtime-boundary.ts && bun scripts/lint-write-source-chokepoint.ts && bun scripts/lint-secret-resolver-boundary.ts && bun scripts/lint-process-argv.ts && bun scripts/lint-repository-sql.ts && bun scripts/lint-goldens-presence.ts && bun scripts/lint-golden-captured-at-head.ts && bun scripts/lint-test-ref-literals.ts && bun scripts/lint-shipped-assets.ts && bun scripts/lint-doc-examples.ts && bun scripts/gen-config-schema.ts --check",
74
74
  "lint:runtime-boundary": "bun scripts/lint-runtime-boundary.ts",
75
75
  "lint:tests-isolation": "bun scripts/lint-tests-isolation.ts",
76
76
  "lint:fix": "bunx biome check --write src/ tests/ scripts/",
@@ -87,6 +87,7 @@
87
87
  "@biomejs/biome": "^2.4.14",
88
88
  "@types/node": "^22.19.17",
89
89
  "@types/semver": "^7.5.8",
90
+ "@types/turndown": "^5.0.6",
90
91
  "bun-types": "^1.3.13",
91
92
  "cmd-shim": "9.0.2",
92
93
  "typescript": "^5.9.3",
@@ -105,7 +106,10 @@
105
106
  "@opencode-ai/sdk": "1.2.20",
106
107
  "citty": "^0.2.2",
107
108
  "dotenv": "^17.4.2",
109
+ "fast-xml-parser": "^5.10.1",
110
+ "node-html-parser": "^9.0.1",
108
111
  "semver": "^7.6.0",
112
+ "turndown": "^7.2.4",
109
113
  "yaml": "^2.8.4",
110
114
  "zod": "^3.23.0"
111
115
  }
@@ -458,6 +458,13 @@
458
458
  "maxDepth": {
459
459
  "type": "integer",
460
460
  "exclusiveMinimum": 0
461
+ },
462
+ "respectRobots": {
463
+ "type": "boolean"
464
+ },
465
+ "crawlTimeoutMs": {
466
+ "type": "integer",
467
+ "minimum": 0
461
468
  }
462
469
  },
463
470
  "required": [
@@ -1613,6 +1620,11 @@
1613
1620
  "maxConcurrency": {
1614
1621
  "type": "integer",
1615
1622
  "exclusiveMinimum": 0
1623
+ },
1624
+ "judgeEngine": {
1625
+ "type": "string",
1626
+ "maxLength": 63,
1627
+ "pattern": "^(?!akm-)[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
1616
1628
  }
1617
1629
  },
1618
1630
  "additionalProperties": true
@@ -1627,9 +1639,6 @@
1627
1639
  "properties": {
1628
1640
  "improveAutonomy": {
1629
1641
  "type": "boolean"
1630
- },
1631
- "workflowEngine": {
1632
- "type": "boolean"
1633
1642
  }
1634
1643
  },
1635
1644
  "additionalProperties": true
@@ -2096,6 +2105,13 @@
2096
2105
  "maxDepth": {
2097
2106
  "type": "integer",
2098
2107
  "exclusiveMinimum": 0
2108
+ },
2109
+ "respectRobots": {
2110
+ "type": "boolean"
2111
+ },
2112
+ "crawlTimeoutMs": {
2113
+ "type": "integer",
2114
+ "minimum": 0
2099
2115
  }
2100
2116
  },
2101
2117
  "required": [
@@ -3251,6 +3267,11 @@
3251
3267
  "maxConcurrency": {
3252
3268
  "type": "integer",
3253
3269
  "exclusiveMinimum": 0
3270
+ },
3271
+ "judgeEngine": {
3272
+ "type": "string",
3273
+ "maxLength": 63,
3274
+ "pattern": "^(?!akm-)[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
3254
3275
  }
3255
3276
  },
3256
3277
  "additionalProperties": true
@@ -3265,9 +3286,6 @@
3265
3286
  "properties": {
3266
3287
  "improveAutonomy": {
3267
3288
  "type": "boolean"
3268
- },
3269
- "workflowEngine": {
3270
- "type": "boolean"
3271
3289
  }
3272
3290
  },
3273
3291
  "additionalProperties": true
@@ -213,7 +213,7 @@
213
213
  "engine": {
214
214
  "type": "string",
215
215
  "minLength": 1,
216
- "description": "Named engine selected at workflow start."
216
+ "description": "Named engine selected when the workflow run is created."
217
217
  },
218
218
  "model": {
219
219
  "type": "string",
@@ -1,33 +0,0 @@
1
- // This Source Code Form is subject to the terms of the Mozilla Public
2
- // License, v. 2.0. If a copy of the MPL was not distributed with this
3
- // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
- import { UsageError } from "../core/errors.js";
5
- export const WORKFLOW_STEP_STATES = [
6
- "completed",
7
- "blocked",
8
- "failed",
9
- "skipped",
10
- ];
11
- export function parseWorkflowJsonObject(raw, flagName) {
12
- if (!raw)
13
- return {};
14
- let parsed;
15
- try {
16
- parsed = JSON.parse(raw);
17
- }
18
- catch {
19
- throw new UsageError(`${flagName} must be valid JSON.`);
20
- }
21
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
22
- throw new UsageError(`${flagName} must be a JSON object.`);
23
- }
24
- return parsed;
25
- }
26
- export function parseWorkflowStepState(value) {
27
- if (!value)
28
- return "completed";
29
- if (WORKFLOW_STEP_STATES.includes(value)) {
30
- return value;
31
- }
32
- throw new UsageError(`Invalid workflow step state "${value}". Expected one of: ${WORKFLOW_STEP_STATES.join(", ")}`);
33
- }