akm-cli 0.9.29 → 0.9.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +10 -10
  3. package/ROADMAP.md +112 -0
  4. package/dist/commands/improve/improve-cli.js +33 -12
  5. package/dist/commands/sources/plugin-upgrade.js +46 -23
  6. package/dist/core/file-lock.js +10 -1
  7. package/dist/llm/client.js +33 -3
  8. package/dist/scripts/akm-migrate-node.js +5 -1
  9. package/dist/scripts/akm-migrate.js +5 -1
  10. package/docs/README.md +42 -41
  11. package/docs/agents/README.md +15 -0
  12. package/docs/agents/agent-install.md +14 -0
  13. package/docs/architecture/README.md +67 -0
  14. package/docs/architecture/adapters.md +272 -0
  15. package/docs/architecture/akm-architecture-decision-history.md +2055 -0
  16. package/docs/architecture/akm-core-principles.md +126 -0
  17. package/docs/architecture/architecture.md +579 -0
  18. package/docs/architecture/comparisons/claude-code-vs-akm-workflows-full.md +550 -0
  19. package/docs/architecture/decisions/0001-no-interpolation-attached-structured-context.md +72 -0
  20. package/docs/architecture/decisions/0002-unit-reuse-and-input-hash-scope.md +142 -0
  21. package/docs/architecture/decisions/0003-child-env-allowlist-and-provenance.md +189 -0
  22. package/docs/architecture/decisions/0004-task-input-contract-and-flag-coercion.md +97 -0
  23. package/docs/architecture/decisions/0005-task-result-vocabulary-and-legacy-read-mapping.md +108 -0
  24. package/docs/architecture/decisions/0006-task-source-version-routing.md +124 -0
  25. package/docs/architecture/decisions/0007-workflow-composition-bounds.md +83 -0
  26. package/docs/architecture/decisions/0008-task-binding-normalization.md +88 -0
  27. package/docs/architecture/decisions/0009-child-run-publication-column-parity.md +80 -0
  28. package/docs/architecture/decisions/0010-driver-protocol-cut.md +36 -0
  29. package/docs/architecture/decisions/0011-engine-run-loop-invariants.md +125 -0
  30. package/docs/architecture/decisions/README.md +62 -0
  31. package/docs/architecture/improvement.md +440 -0
  32. package/docs/architecture/internals/classification.md +154 -0
  33. package/docs/architecture/internals/fresh-host-rebuild-runbook.md +40 -0
  34. package/docs/architecture/internals/functional-contract-patterns.md +340 -0
  35. package/docs/architecture/internals/health-advisories.md +110 -0
  36. package/docs/architecture/internals/improve-workflow.md +713 -0
  37. package/docs/architecture/internals/indexing.md +498 -0
  38. package/docs/architecture/internals/registry-network-boundary.md +57 -0
  39. package/docs/architecture/internals/search.md +249 -0
  40. package/docs/architecture/internals/storage-locations.md +943 -0
  41. package/docs/architecture/persisted-data-compat.md +59 -0
  42. package/docs/architecture/reviews/env-secret-access.md +319 -0
  43. package/docs/architecture/runtime-boundary-design.md +153 -0
  44. package/docs/architecture/specs/0.9.0-close-out-plan.md +361 -0
  45. package/docs/architecture/specs/0.9.0-decisions.md +528 -0
  46. package/docs/architecture/specs/0.9.0-docs-code-drift-register.md +745 -0
  47. package/docs/architecture/specs/0.9.0-open-items-register.md +135 -0
  48. package/docs/architecture/specs/0.9.0-public-api-issue-backlog.md +740 -0
  49. package/docs/architecture/specs/0.9.0-release-surface-review.md +636 -0
  50. package/docs/architecture/specs/agent-command-engine-model-design.md +513 -0
  51. package/docs/architecture/specs/akm-0.9.0-bundle-adapter-spec.md +501 -0
  52. package/docs/architecture/specs/akm-0.9.0-ref-grammar-decision.md +291 -0
  53. package/docs/architecture/specs/akm-format-neutral-bundle-workspace-spec.md +2059 -0
  54. package/docs/architecture/specs/di-seams-plan.md +539 -0
  55. package/docs/architecture/specs/driver-protocol-keep-or-cut.md +275 -0
  56. package/docs/architecture/specs/fact-asset-type.md +142 -0
  57. package/docs/architecture/specs/improve-collapse-churn-detector-design.md +634 -0
  58. package/docs/architecture/specs/okf-support.md +148 -0
  59. package/docs/architecture/specs/ref.md +329 -0
  60. package/docs/architecture/specs/reviews/task-workflow-unification/README.md +72 -0
  61. package/docs/architecture/specs/reviews/task-workflow-unification/findings-consolidated.md +152 -0
  62. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-alternatives.md +352 -0
  63. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-bunqueue.md +300 -0
  64. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-openworkflow.md +402 -0
  65. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-1.md +758 -0
  66. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-2.md +645 -0
  67. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-3.md +602 -0
  68. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-adversarial.md +27 -0
  69. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-architecture.md +27 -0
  70. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-coverage.md +74 -0
  71. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-security.md +15 -0
  72. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-adversarial.md +132 -0
  73. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-verification.md +147 -0
  74. package/docs/architecture/specs/stash-conventions-code-spec.md +275 -0
  75. package/docs/architecture/specs/stash-organization-conventions.md +377 -0
  76. package/docs/architecture/specs/task-workflow-format-unification.md +721 -0
  77. package/docs/architecture/specs/workflow-engine-buy-vs-build.md +231 -0
  78. package/docs/architecture/specs/workflow-format-unification.md +437 -0
  79. package/docs/architecture/testing/manual-testing-checklist.md +3420 -0
  80. package/docs/architecture/testing/okf-v0.2-conformance-runbook.md +924 -0
  81. package/docs/architecture/testing/task-workflow-manual-tests.md +1817 -0
  82. package/docs/architecture/testing/testing-workflow.md +446 -0
  83. package/docs/architecture/workflow-engine.md +274 -0
  84. package/docs/guides/README.md +33 -0
  85. package/docs/guides/author-bundles.md +310 -0
  86. package/docs/guides/author-workflows.md +520 -0
  87. package/docs/guides/bundles.md +321 -0
  88. package/docs/guides/capture-knowledge.md +136 -0
  89. package/docs/guides/claude-code-vs-akm-workflows.md +30 -0
  90. package/docs/guides/concepts.md +93 -0
  91. package/docs/guides/discover-and-load.md +158 -0
  92. package/docs/guides/getting-started.md +240 -0
  93. package/docs/guides/improve-the-library.md +246 -0
  94. package/docs/guides/knowledge-management.md +18 -0
  95. package/docs/guides/recipes/headless-install.md +97 -0
  96. package/docs/guides/recipes/website-source.md +28 -0
  97. package/docs/guides/run-workflows.md +279 -0
  98. package/docs/guides/scheduling.md +123 -0
  99. package/docs/guides/use-with-any-agent.md +129 -0
  100. package/docs/guides/wikis.md +81 -0
  101. package/docs/maintainers/README.md +19 -0
  102. package/docs/maintainers/curate-workmap.md +336 -0
  103. package/docs/maintainers/eval.md +3 -0
  104. package/docs/maintainers/local-development.md +108 -0
  105. package/docs/maintainers/release-checklist.md +103 -0
  106. package/docs/migration/README.md +2 -2
  107. package/docs/migration/release-notes/0.0.13.md +1 -1
  108. package/docs/migration/release-notes/0.1.0.md +1 -1
  109. package/docs/migration/release-notes/0.2.0.md +1 -1
  110. package/docs/migration/release-notes/0.3.0.md +1 -1
  111. package/docs/migration/release-notes/0.5.0.md +1 -1
  112. package/docs/migration/release-notes/0.6.0.md +1 -1
  113. package/docs/migration/release-notes/0.7.0.md +1 -1
  114. package/docs/migration/release-notes/0.7.3.md +2 -2
  115. package/docs/migration/release-notes/0.7.4.md +1 -1
  116. package/docs/migration/release-notes/0.7.5.md +1 -1
  117. package/docs/migration/release-notes/0.8.0.md +1 -1
  118. package/docs/migration/release-notes/0.9.0.md +1 -1
  119. package/docs/migration/release-notes/0.9.14.md +1 -1
  120. package/docs/migration/release-notes/0.9.15.md +1 -1
  121. package/docs/migration/release-notes/0.9.16.md +1 -1
  122. package/docs/migration/release-notes/0.9.17.md +1 -1
  123. package/docs/migration/release-notes/0.9.19.md +1 -1
  124. package/docs/migration/release-notes/0.9.2.md +1 -1
  125. package/docs/migration/release-notes/README.md +27 -31
  126. package/docs/migration/v0.5-to-v0.6.md +759 -0
  127. package/docs/migration/v0.8-to-v0.9.md +1 -1
  128. package/docs/plans/0.9.2-agent-command-workflow-plan.md +423 -0
  129. package/docs/posts/README.md +30 -0
  130. package/docs/posts/akm-command-tour.md +495 -0
  131. package/docs/posts/akm-logo-sized.webp +0 -0
  132. package/docs/posts/belief-aware-memory-12.md +139 -0
  133. package/docs/posts/config-v2-lessons-16.md +191 -0
  134. package/docs/posts/improve-loop-autonomous-10.md +225 -0
  135. package/docs/posts/improve-pipeline-debugging-0803.md +179 -0
  136. package/docs/posts/intro-part-01.md +76 -0
  137. package/docs/posts/intro-part-02.md +221 -0
  138. package/docs/posts/intro-part-03.md +190 -0
  139. package/docs/posts/intro-part-04.md +221 -0
  140. package/docs/posts/llm-mode-reflect-13.md +166 -0
  141. package/docs/posts/openpalm-built-on-akm.md +86 -0
  142. package/docs/posts/progressive-disclosure-06.md +129 -0
  143. package/docs/posts/proposal-safety-net-15.md +112 -0
  144. package/docs/posts/release-0.5.0.md +247 -0
  145. package/docs/posts/release-0.6.0.md +117 -0
  146. package/docs/posts/release-0.7.0.md +159 -0
  147. package/docs/posts/release-0.8.0.md +332 -0
  148. package/docs/posts/scattered-skills-05.md +100 -0
  149. package/docs/posts/task-assets-persistent-workflows-11.md +222 -0
  150. package/docs/posts/team-skills-07.md +198 -0
  151. package/docs/posts/wiki-agent-knowledge-08.md +223 -0
  152. package/docs/posts/workflows-vaults-09.md +321 -0
  153. package/docs/product-surface.md +54 -0
  154. package/docs/reference/README.md +1 -2
  155. package/docs/reference/asset-types.md +168 -0
  156. package/docs/reference/cli.md +5 -6
  157. package/docs/reference/env-and-secrets.md +126 -0
  158. package/docs/reference/memory.md +124 -0
  159. package/docs/reference/refs.md +156 -0
  160. package/docs/reference/registry.md +489 -0
  161. package/docs/reference/website-sources.md +141 -0
  162. package/package.json +12 -15
@@ -0,0 +1,97 @@
1
+ # Recipe: Headless Install
2
+
3
+ A precise, no-prompts sequence for automated or agent-driven setup of `akm` —
4
+ no interactive wizard, no assumed defaults.
5
+
6
+ ```sh
7
+ #!/usr/bin/env bash
8
+ set -euo pipefail
9
+
10
+ # 1. Install (standalone binary, runtime-free)
11
+ curl -fsSL https://github.com/itlackey/akm/releases/latest/download/install.sh | bash
12
+
13
+ # 2. Initialize the bundle directory and accept all defaults (no prompts)
14
+ akm setup --yes
15
+
16
+ # 3. Don't rely on the implicit semantic-search default in an unattended
17
+ # script — the default can vary by release and by install path. Set it
18
+ # explicitly so this script's behavior is deterministic. `auto` uses local
19
+ # embeddings (downloaded on first index run); `off` skips them entirely.
20
+ akm config set semanticSearchMode auto
21
+
22
+ # 4. Add sources (adjust paths as needed)
23
+ akm bundle add /path/to/skills
24
+
25
+ # 5. Build the search index (downloads the embedding model on first run if
26
+ # semantic search is enabled)
27
+ akm index
28
+
29
+ # 6. Verify
30
+ akm info
31
+ akm search "test"
32
+
33
+ # 7. Install agent guidance
34
+ akm help agents >> AGENTS.md
35
+
36
+ echo "akm setup complete"
37
+ ```
38
+
39
+ ## Notes on each step
40
+
41
+ **Install.** The standalone binary (step 1) is runtime-free. The npm package
42
+ (`npm install -g akm-cli`, or one-shot via `npx akm-cli <command>`) requires
43
+ Node.js >= 22; a working Bun >= 1.0 is optional and preferred for execution
44
+ after Node starts the package launcher.
45
+
46
+ **Setup.** `akm setup --yes` accepts every default with no prompts. To
47
+ pre-configure an LLM or agent engine at the same time instead of accepting
48
+ defaults, pass `--config` with a JSON object, optionally followed by
49
+ `--probe` to verify connectivity:
50
+
51
+ ```sh
52
+ akm setup --config '{
53
+ "engines": {
54
+ "default": {
55
+ "kind": "llm",
56
+ "endpoint": "http://localhost:11434/v1/chat/completions",
57
+ "model": "llama3.2"
58
+ }
59
+ },
60
+ "defaults": { "llmEngine": "default" }
61
+ }' --probe
62
+ ```
63
+
64
+ For the full set of accepted top-level `--config` keys and their meaning,
65
+ see [configuration.md](../../reference/configuration.md).
66
+
67
+ **Semantic search.** Headless setups (`--yes` or `--config`, no wizard
68
+ prompts) defer the embedding-model download to the first `akm index` run,
69
+ unlike the interactive wizard which downloads immediately during `akm
70
+ setup`. Set the mode explicitly rather than relying on the implicit default:
71
+
72
+ ```sh
73
+ akm config set semanticSearchMode auto # local embeddings, downloaded on first index
74
+ akm config set semanticSearchMode off # skip embeddings entirely
75
+ ```
76
+
77
+ For resource requirements and remote-embedding alternatives, see
78
+ [configuration.md](../../reference/configuration.md).
79
+
80
+ **Add source.** `akm bundle add <path|github:owner/repo|@scope/package>`
81
+ registers a directory or package as a source. Add every source before
82
+ indexing.
83
+
84
+ **Index and verify.** `akm index` builds the search index; `akm info` reports
85
+ `indexStats.entryCount` and `semanticSearch.status`; `akm search "<query>"`
86
+ confirms retrieval actually returns results.
87
+
88
+ **Install agent guidance.** `akm help agents >> AGENTS.md` appends the
89
+ canonical usage block agents need to discover and use the library. Run this
90
+ after indexing so the guidance matches the installed version.
91
+
92
+ ## See also
93
+
94
+ - [configuration.md](../../reference/configuration.md) — full configuration
95
+ key reference
96
+ - [docs/agents/agent-install.md](../../agents/agent-install.md) — agent-facing
97
+ entry point that links here
@@ -0,0 +1,28 @@
1
+ # Recipe: Turn a Website into a Searchable Bundle
2
+
3
+ Crawl a documentation site into markdown knowledge assets you can search and
4
+ show like any other source.
5
+
6
+ ```sh
7
+ akm bundle add https://docs.example.com --name docs
8
+ ```
9
+
10
+ Website sources are crawled and converted to markdown knowledge assets, then
11
+ indexed locally — no different from a local directory or a git bundle once
12
+ they're in.
13
+
14
+ Control the crawl scope with `--max-pages` and `--max-depth`:
15
+
16
+ ```sh
17
+ akm bundle add https://www.agentic-patterns.com/ --name agent-patterns --max-pages 100
18
+ ```
19
+
20
+ Reindex and search once the crawl finishes:
21
+
22
+ ```sh
23
+ akm index
24
+ akm search "agent" --type knowledge
25
+ ```
26
+
27
+ See [Registry](../../reference/registry.md) for the full install flow and
28
+ supported ref formats.
@@ -0,0 +1,279 @@
1
+ # Running Workflows
2
+
3
+ This guide walks through operating a workflow run day to day: starting or
4
+ continuing one, checking on it, resuming it after it blocks, and abandoning
5
+ one you no longer want. It assumes you already know what a workflow is; see
6
+ [Workflow Schema](../reference/workflow-schema.md) for the exact frontmatter
7
+ and body syntax, and
8
+ [Architecture: The Workflow Engine](../architecture/workflow-engine.md) for
9
+ what happens under the hood (frozen plans, dispatch, resume-without-replay).
10
+ For task/schedule-driven workflow runs — akm tasks and the OS scheduler —
11
+ see [Scheduling](scheduling.md).
12
+
13
+ ## Start or continue a run
14
+
15
+ `akm workflow run <run-id|workflows/ref>` starts or continues a persisted run
16
+ and executes it until completion, failure, verification rejection,
17
+ interruption, or an explicit invocation limit. Run state is scoped to the
18
+ current project directory (nearest `.akm/config.json`, git root, bundle root,
19
+ or current directory), so the same workflow can run independently in separate
20
+ projects.
21
+
22
+ Every new run/start compiles source IR v1 and freezes the durable plan v4
23
+ family's current executable format (`irVersion: 5`) before publishing the run.
24
+ Markdown `.md` and GitHub-shaped `.yml` refs use the same freeze path.
25
+
26
+ ```sh
27
+ akm workflow run workflows/ship-release --version 1.2.3
28
+ akm workflow run workflows/review --changed_files a.ts --changed_files b.ts
29
+ akm workflow run <run-id> --max-retries 2 --timeout 10m
30
+ ```
31
+
32
+ Parameter flags must come after the target and exactly match declared
33
+ `params` keys. Values are coerced through each parameter's JSON Schema:
34
+ repeat an array flag, pass an object or whole array as JSON, and use a bare
35
+ boolean flag for `true`. There are no hyphen/underscore aliases. Parameters
36
+ are accepted only while creating a new run — a later invocation against an
37
+ active run rejects parameter flags.
38
+
39
+ `--max-steps <n>` leaves a partial run active after at most `n` steps.
40
+ `--max-retries <n>` retries a failed step on the same run up to `n` additional
41
+ times (0 through 100). `--timeout <duration>` bounds the whole invocation and
42
+ accepts `N`, `Nms`, `Ns`, or `Nm`; bare `N` is milliseconds. A timeout or
43
+ signal abort releases the run's lock without advancing the active step, so the
44
+ run remains resumable. Failed, gate-rejected, timed-out, and interrupted runs
45
+ exit nonzero.
46
+
47
+ The run freezes its plan, exact models, execution limits, parameter snapshot,
48
+ and verifier selection at creation — edits to source or config do not alter
49
+ an in-flight run. See
50
+ [Architecture: Frozen plans](../architecture/workflow-engine.md#frozen-plans)
51
+ for why.
52
+
53
+ ## Check status
54
+
55
+ `akm workflow status` shows the full run state — all step statuses, notes,
56
+ and evidence — for a given run ID or workflow ref.
57
+
58
+ ```sh
59
+ akm workflow status <run-id>
60
+ akm workflow status workflows/ship-release
61
+ # When given a ref, resolves to the most-recently-updated run in the current scope
62
+ ```
63
+
64
+ Use this to inspect where a run is after a context window break, or to verify
65
+ all steps completed cleanly before closing a PR.
66
+
67
+ **`--units` — per-unit diagnostics.** For an orchestrated run, add `--units`
68
+ to also list the run's journaled unit rows — each unit's id, status,
69
+ `failure_reason`, and any result/error diagnostic text the row carries:
70
+
71
+ ```sh
72
+ akm workflow status <run-id> --units
73
+ ```
74
+
75
+ This is a **diagnostic** surface, deliberately kept out of the deterministic
76
+ artifact graph. A step's promoted artifact (what `steps.x.output` resolves to,
77
+ and what a gate judges) keeps only a failed unit's structured `failure_reason`
78
+ — never the raw error text — so step evidence stays reproducible across
79
+ resumes. When you need the human-facing *why* behind a failure, `--units`
80
+ reads the unit journal directly and shows it without ever feeding that text
81
+ back into an artifact or input hash.
82
+
83
+ ## Child runs
84
+
85
+ A step that composes another workflow (see [Workflow Schema: Child
86
+ workflows](../reference/workflow-schema.md#child-workflows)) drives that
87
+ child inline when the composing step runs. `akm workflow status` on a run
88
+ that composes children renders a `children:` tree after its `steps:` block:
89
+
90
+ ```sh
91
+ akm workflow status <run-id>
92
+ ```
93
+
94
+ ```
95
+ steps:
96
+ - build [work] (completed)
97
+ - dispatch [dispatch] (completed)
98
+ children:
99
+ - ✓ 4f2b1a9c workflows/leaf [completed] (step "dispatch")
100
+ ```
101
+
102
+ Each row shows the child's run id, its workflow ref, its status, and which
103
+ of the parent's steps spawned it; a blocked child also shows its resume
104
+ command. Nesting reflects composition depth — a child that itself composes
105
+ a grandchild shows its own indented `children:` rows.
106
+
107
+ **Recovering a blocked child.** A blocked child blocks the composing step
108
+ (and the parent run) too — `akm` will not resume a child for you. Resume the
109
+ **child** first, then resume and re-run the **parent**; re-driving the
110
+ parent is what advances it, because that re-enters the composing step and
111
+ drives the now-resumed child:
112
+
113
+ ```sh
114
+ akm workflow resume <childRunId>
115
+ akm workflow resume <parentRunId>
116
+ akm workflow run <parentRunId>
117
+ ```
118
+
119
+ **Nested blocks (composition depth 2+).** The three-command sequence above
120
+ clears a block exactly one level deep. When a grandchild blocks — a root
121
+ workflow composes a child, and that child composes the grandchild that
122
+ actually blocks — re-driving the root does **not** cascade down into
123
+ re-driving the still-blocked grandchild: a composing step never re-drives a
124
+ child whose own status is already `blocked`, so re-running the root just
125
+ re-observes the child's block and re-blocks the root the same way, without
126
+ ever reaching the grandchild. Resume **every** blocked run in the chain,
127
+ deepest first, then re-run only the root:
128
+
129
+ ```sh
130
+ akm workflow resume <grandchildRunId>
131
+ akm workflow resume <childRunId>
132
+ akm workflow resume <rootRunId>
133
+ akm workflow run <rootRunId>
134
+ ```
135
+
136
+ The status tree prints `resume`/`then` commands on each blocked node, but
137
+ those two commands alone only ever name that node and the root — they do not
138
+ enumerate an intermediate chain. Read the tree top to bottom and resume every
139
+ `blocked` row you see (deepest first) before re-running the root.
140
+
141
+ **Child runs are hidden by default.** `akm workflow list` excludes child
142
+ runs so the list stays a view of the runs you started; pass `--children` to
143
+ include them:
144
+
145
+ ```sh
146
+ akm workflow list # child runs excluded
147
+ akm workflow list --children # child runs included
148
+ ```
149
+
150
+ A child run id always works directly, listed or not — `akm workflow status
151
+ <childRunId>`, `resume`, `abandon`, and `run` all operate on it exactly like
152
+ any other run.
153
+
154
+ ## List runs in scope
155
+
156
+ `akm workflow list` shows workflow runs in the current scope.
157
+
158
+ ```sh
159
+ akm workflow list # All runs in this scope (any status)
160
+ akm workflow list --active # Only status=active (executable) runs
161
+ akm workflow list --ref workflows/ship-release # Runs for a specific workflow
162
+ ```
163
+
164
+ `--active` filters to runs whose status is exactly `active` — currently
165
+ executable work. A `blocked` run (parked awaiting a human `akm workflow
166
+ resume`) or a `failed`/`completed` run is **not** active and is excluded, so a
167
+ script that treats `--active` output as runnable never picks one up. Blocked
168
+ runs remain listed by the unfiltered `akm workflow list` with their `blocked`
169
+ status.
170
+
171
+ **Example: see what is in flight**
172
+
173
+ ```sh
174
+ akm workflow list --active
175
+ # → lists runs by workflow ref, status, currentStepId, and updatedAt
176
+ ```
177
+
178
+ ## Resume a blocked or failed run
179
+
180
+ ```sh
181
+ akm workflow resume <run-id>
182
+ ```
183
+
184
+ Flips a `blocked` or `failed` run back to `active`. Completed runs cannot be
185
+ resumed. Use `akm workflow list` to find runs by status. Once resumed,
186
+ `akm workflow run <run-id>` continues it — units already journaled as
187
+ completed are skipped, not re-run (see
188
+ [Architecture: Resume skips completed units](../architecture/workflow-engine.md#resume-skips-completed-units)).
189
+
190
+ A resume consumes the frozen plan and journaled attempts; it does not re-read
191
+ configuration or the index, and reads the authored workflow only to warn once
192
+ when it changed since the run was frozen (the run continues on the frozen
193
+ plan; `akm workflow run <ref> --new` picks up the edit). A stored plan this akm
194
+ cannot decode is abandoned with a message naming how to start a new run.
195
+
196
+ ## Abandon a run
197
+
198
+ ```sh
199
+ akm workflow abandon <run-id>
200
+ ```
201
+
202
+ Marks a run failed so it stops counting as active. This only changes the
203
+ run's status — `resume` can still reopen it later if you change your mind.
204
+
205
+ ## Follow a run's events
206
+
207
+ There is no `akm workflow watch` (0.9.0: dropped — a foreground polling
208
+ daemon in a one-shot CLI). `akm log --run <run-id>` reads the same
209
+ `workflow_*` / `workflow_unit_*` events from the general append-only events
210
+ stream: `--since '@offset:<id>'` gives a durable row-id cursor a cooperating
211
+ process can poll from, in place of `watch --stream`'s in-process loop.
212
+
213
+ ```sh
214
+ akm workflow run <run-id> & # engine in one shell
215
+ akm log --run <run-id> --since '@offset:0' # backlog so far
216
+ akm log --run <run-id> --since '@offset:<nextOffset>' # poll for more, from the prior call's nextOffset
217
+ ```
218
+
219
+ Event metadata is ids/status/enums only — never workflow-authored content —
220
+ so following a run's events is safe to pipe into logs or dashboards.
221
+
222
+ ## Security: workflow sources are executed code
223
+
224
+ Workflow steps that include shell commands run with **the full filesystem and
225
+ network access of the user invoking `akm workflow run`** — same as if the user
226
+ had typed those commands in their shell. There is no sandbox and no separation
227
+ between trusted and untrusted workflows. An `exec` unit's *environment* is
228
+ narrowed to an allowlist by default
229
+ ([Workflow Schema](../reference/workflow-schema.md#the-childs-environment-is-an-allowlist)),
230
+ which bounds accidental exposure of unrelated credentials — but a command that
231
+ runs at all can still read those credentials off disk, so it is a hygiene
232
+ boundary, not a containment one. AKM
233
+ directly orchestrates workflows as a defined execution surface — it does not
234
+ blindly execute arbitrary indexed content — but that orchestration still runs
235
+ the workflow's own declared shell commands with your full access once you
236
+ choose to run it.
237
+
238
+ This is by design: a workflow is a runbook authored by you or by a bundle
239
+ maintainer you trust. The flexibility of "run any shell command, read any
240
+ file, hit any network" is what makes workflows useful as automation.
241
+
242
+ The consequence is that **you should treat workflow sources the same way you
243
+ treat package dependencies**:
244
+
245
+ - **Only add workflow sources you trust.** `akm bundle add github:<some-user>/<bundle-repo>`
246
+ followed by `akm workflow run workflows/<their-thing>` is functionally
247
+ equivalent to piping a stranger's bash script into your shell. Read the
248
+ workflow file first (`akm show workflows/<name>`) before running it.
249
+ - **Audit before run** for any workflow that touches secrets, deploys to
250
+ production, or writes outside the project tree. Read the `env:` bindings a
251
+ workflow declares, and read its `exec.pass_env` lines.
252
+ The durable v4 family (`irVersion: 5`) rejects `inherit_env`. Authors must
253
+ use exact named bindings and `pass_env` names.
254
+ - **Pin known-good versions** when adding workflow sources from a registry
255
+ or git remote (`akm bundle add github:owner/repo#v1.2.3`), and update
256
+ deliberately rather than via `akm bundle update --all`. A trusted workflow
257
+ source can become hostile if its upstream is compromised.
258
+ - **Workflow steps cannot escape this trust model** by being labeled
259
+ `dryRun` or `interactive` — those flags affect bookkeeping, not execution.
260
+ `akm workflow status` is read-only; `akm workflow run` executes configured
261
+ units with your process's access.
262
+
263
+ If you operate a CI runner or shared host where untrusted workflows might be
264
+ executed, scope the process: a dedicated user account with no secrets in its
265
+ environment, ephemeral working directory, and a network/filesystem allowlist
266
+ enforced outside akm.
267
+
268
+ ## See also
269
+
270
+ - [Workflow Schema](../reference/workflow-schema.md) — exact frontmatter,
271
+ refs, gates, and outputs syntax
272
+ - [Author's Guide: Writing Workflows](../guides/author-workflows.md) —
273
+ writing and testing a workflow definition
274
+ - [Architecture: The Workflow Engine](../architecture/workflow-engine.md) —
275
+ persistence, dispatch, and resume internals
276
+ - [Scheduling](scheduling.md) — running akm tasks (including workflow runs)
277
+ through the OS scheduler
278
+ - [CLI Reference](../reference/cli.md) — full flag documentation for all
279
+ `workflow` subcommands
@@ -0,0 +1,123 @@
1
+ # Scheduling
2
+
3
+ This guide covers running akm tasks — `akm improve` and other background
4
+ work — through the OS scheduler (cron / launchd / schtasks) safely: how
5
+ `akm setup` reviews task definitions before touching the scheduler, how to
6
+ verify the result, and how to migrate or repair scheduler bindings after
7
+ moving or reinstalling akm.
8
+
9
+ ## Review tasks during setup
10
+
11
+ Interactive setup reviews every embedded task definition — both the
12
+ general-purpose core task-template set and the maintainer-oriented
13
+ multi-cadence improve task set — in one pass. See the
14
+ [task CLI reference](../reference/cli.md#task) for the full template list.
15
+
16
+ ```sh
17
+ akm setup
18
+ ```
19
+
20
+ Before any OS scheduler change, setup shows every reviewed task's schedule
21
+ and enabled state and asks one explicit activation question. Confirming runs
22
+ the scheduler sync; declining leaves both task files and scheduler state
23
+ unchanged.
24
+
25
+ **Safety note:** schedule activation always requires an explicit confirmation
26
+ after reviewing the complete task summary. Nothing is written to the OS
27
+ scheduler without that review step.
28
+
29
+ ## Verify
30
+
31
+ ```sh
32
+ akm task doctor
33
+ ```
34
+
35
+ `akm task doctor` reports the scheduler backend, paths, task state, and
36
+ warnings — run it after any setup pass, and again after a `--rebind` (below),
37
+ to confirm the scheduler state matches what you expect.
38
+
39
+ ## Non-interactive setup never activates schedules
40
+
41
+ `akm setup --yes`, config-file setup, and CI runs skip the task step
42
+ entirely: neither task definitions nor OS scheduler entries are created or
43
+ changed. Run interactive `akm setup` to review, prepare, and activate tasks.
44
+
45
+ ## Task definitions vs. scheduler state
46
+
47
+ Task definitions live under `<bundle>/tasks/` as task source v4 `.yml` sources;
48
+ the [task source reference](../reference/tasks.md) defines their executable and
49
+ scheduling grammar. A definition cannot enable itself: the refs this host schedules live
50
+ separately in `config.json` under `scheduler.enabled`, a list of
51
+ fully-qualified refs. Use `akm task enable <bundle>//tasks/<id>` or `akm task
52
+ disable <ref>` to change it without editing bundle content. An unscoped `akm
53
+ task sync` installs exactly the listed refs from every enabled configured
54
+ bundle and removes akm-written bindings for refs that are gone or no longer
55
+ listed. Removing a bundle drops its refs from the list; disabling a bundle
56
+ leaves them inert.
57
+
58
+ Native scheduler entries are separate OS state. Activation captures the
59
+ installed akm runtime so scheduled execution does not silently switch to a
60
+ different checkout or package. Editing definitions and running ordinary `akm
61
+ task sync` preserves that captured runtime.
62
+
63
+ A scheduled fire re-reads the guarded current source and creates a fresh
64
+ durable-v4-family freeze at executable `irVersion: 5`.
65
+ Scheduler sync/validation evidence is not an executable snapshot and is never reused as the later run plan.
66
+
67
+ ## A scheduled `akm improve` covers one bundle
68
+
69
+ An `akm improve` run improves one bundle, the one it writes to: `--bundle`,
70
+ else `defaultWriteTarget`, else the working bundle. A scheduled row sets
71
+ `AKM_BUNDLE_DIR` to the working bundle of the shell that synced it, so a
72
+ scheduled `akm improve` covers that bundle (or `defaultWriteTarget`, when set)
73
+ and leaves your other bundles alone, even the writable ones. To improve
74
+ another bundle on a schedule, give it a task of its own; the `--bundle` inside
75
+ the command is `akm improve`'s own:
76
+
77
+ ```sh
78
+ akm task add improve-team --schedule "15 3 * * *" \
79
+ --command "akm improve --bundle team --skip-if-locked --require-engines"
80
+ ```
81
+
82
+ ## Rerunning setup preserves scheduler bindings
83
+
84
+ Rerunning `akm setup` preserves existing scheduler bindings by design — it
85
+ will not silently rebind entries that are already activated.
86
+
87
+ ## Upgrades
88
+
89
+ A config written before 0.9.17 has no `scheduler.enabled` list. The first
90
+ `akm task sync` (or `setup`, `task enable`, `task disable`, `task add`) after
91
+ the upgrade takes the akm-written rows already installed in the native
92
+ scheduler as this host's choice, writes the list, and says so — a scheduled
93
+ task survives an upgrade by any install method with no manual step. An
94
+ explicit empty list is a choice: sync then removes every akm-written row.
95
+ `akm migrate status` reports anything else that remains pending, and why.
96
+
97
+ ## Migrating or repairing scheduler bindings (`--rebind`)
98
+
99
+ If akm was moved, reinstalled under a different package prefix, or repaired
100
+ after an installation problem, migrate scheduler entries deliberately:
101
+
102
+ ```sh
103
+ akm task sync --rebind
104
+ akm task doctor
105
+ ```
106
+
107
+ Use `--rebind` only for that explicit runtime migration or repair — it
108
+ captures the current installed runtime, replacing whatever runtime a prior
109
+ activation had captured.
110
+
111
+ If you change the AKM storage path during reconfiguration, or move or install
112
+ akm at a new runtime path, follow setup with `akm task sync --rebind`; setup
113
+ never silently rebinds existing entries on your behalf.
114
+
115
+ ## See also
116
+
117
+ - [Getting Started](getting-started.md) — the first-run path this guide was
118
+ split out of
119
+ - [CLI Reference: task](../reference/cli.md#task) — the full `task` command
120
+ group, including `add`, `enable`, `disable`, `run`, `sync`, `doctor`, and
121
+ `history`
122
+ - [Task source reference](../reference/tasks.md) — exact file grammar,
123
+ targets, triggers, and migration
@@ -0,0 +1,129 @@
1
+ # Use AKM With Any Agent
2
+
3
+ AKM works from any shell-capable coding agent — Claude Code, OpenCode, Cursor,
4
+ Windsurf, Aider, and others. No plugins or SDKs are required for the core
5
+ workflow: a three-line system prompt block plus shell access is all an agent
6
+ needs to start using your bundle.
7
+
8
+ ## AGENTS.md / CLAUDE.md snippet
9
+
10
+ Add this block to your `AGENTS.md`, `CLAUDE.md`, or system prompt. It tells
11
+ the agent that `akm` is available and how to discover it.
12
+
13
+ ```markdown
14
+ ## Resources & Capabilities
15
+
16
+ You have access to a searchable library of scripts, skills, commands, agents,
17
+ knowledge, workflows, env files, secrets, lessons, memories, tasks, sessions,
18
+ and facts via the `akm` CLI. Use `akm -h` for details.
19
+ ```
20
+
21
+ That is the minimum. The agent can then run `akm curate <task>` at the start
22
+ of any complex task to pull the most relevant assets into context, and
23
+ `akm show <ref>` to load any asset by ref.
24
+
25
+ For a longer, agent-facing instruction block — usage patterns, flag guidance,
26
+ the full ref format — generate one instead of hand-writing it:
27
+
28
+ ```sh
29
+ akm help agents >> AGENTS.md
30
+ ```
31
+
32
+ The output is stable across patch releases and designed for agents rather
33
+ than humans: it describes the lookup workflow (`curate` → `show` →
34
+ `feedback`) and explains how refs work. It prints a short guide by default;
35
+ pass `--full` for the complete one.
36
+
37
+ ## The retrieval loop: curate, show, feedback
38
+
39
+ Once an agent knows `akm` is available, the working pattern is always the
40
+ same three calls:
41
+
42
+ ```sh
43
+ # 1. Curate assets for the current task
44
+ akm curate "deploy to production" --limit 3
45
+
46
+ # 2. Load the best match by ref from the curate output
47
+ akm show workflows/deploy-to-prod
48
+
49
+ # 3. Record outcome
50
+ akm feedback workflows/deploy-to-prod --positive --reason "Completed without issues"
51
+ ```
52
+
53
+ **Get refs from search.** Agents should call `akm search --shape agent` or
54
+ `akm curate` to discover refs — not guess them. The `ref` field in search
55
+ results is the stable token to pass to `akm show`. Feedback closes the loop.
56
+ Record `--negative` only when the asset's content is wrong or stale; a note that
57
+ simply did not fit the task is not negative feedback, so record nothing for it.
58
+ `akm feedback <ref> --negative --reason "<what is wrong and what should change>"`
59
+ flags the asset, and the next improve run may repair its description, title or
60
+ `when_to_use` from your reason. Once you have verified the correct fact, attach
61
+ the exact fix with `--replace`, `--with` and `--source`. `--positive` records
62
+ that an asset helped (it raises its ranking) and does not trigger a rewrite. See
63
+ [Improve the Library](improve-the-library.md) for what happens to feedback after
64
+ it's recorded.
65
+
66
+ ## Compatibility matrix
67
+
68
+ Not every agent surface integrates with AKM the same way. The table below
69
+ sets expectations by environment.
70
+
71
+ | Environment | Core support | Optional/extended support |
72
+ | --- | --- | --- |
73
+ | Shell-capable coding agent | `curate` / `show` / `feedback` via the CLI | Generated prompt block (`akm help agents`) or a platform plugin |
74
+ | Claude/OpenCode project layout | Indexed in place through a `BundleAdapter` — no migration needed | `akm clone` selected assets into a writable bundle for editing |
75
+ | IDE assistant without shell access | Not a direct core integration | Requires a plugin, an `akm task`, or an external bridge that can shell out on the assistant's behalf |
76
+
77
+ A Claude Code `.claude` directory or an OpenCode `.opencode` directory is
78
+ recognized and indexed automatically once added as a source — see
79
+ [Bundle Types](../reference/bundle-types.md) for the full adapter list and
80
+ which formats are read-only versus writable in the current release.
81
+ The native directory remains the source of truth: AKM translates recognized
82
+ assets while reading the bundle and does not synchronize, copy, or write them
83
+ back. The approved target execution rules for these translated agents and
84
+ commands are documented in
85
+ [Agent, Command, Engine, and Model Resolution](../architecture/specs/agent-command-engine-model-design.md).
86
+
87
+ ## AKM complements, rather than replaces
88
+
89
+ AKM is not a competitor to assistant-native rules/skills or to MCP — it fills
90
+ a different layer. Assistant-native rules and skills give a specific tool
91
+ built-in, tool-specific activation. MCP exposes live tools and resources over
92
+ a protocol. AKM manages portable, versionable capability assets — and the
93
+ retrieval loop that finds and loads them — across whichever tool you're
94
+ sitting in. In short, AKM complements MCP and assistant-native skills rather
95
+ than replacing either.
96
+
97
+ ## Also available
98
+
99
+ - **Tab completion.** `akm completions --install` sets up shell completions
100
+ for subcommands and flags. See [CLI Reference](../reference/cli.md#completions).
101
+ - **Dispatching a bundle agent asset.** `akm agent agents/<name> --engine
102
+ <engine> --prompt "..."` runs a bundle `agents/<name>` persona and model
103
+ defaults through a named engine — including built-in model aliases like
104
+ `sonnet` and `opus` that resolve per platform. The current CLI rejects a
105
+ nonempty tool request at its separate authorization boundary; asset metadata
106
+ is never authorization by itself. See
107
+ [Configuration](../reference/configuration.md#engines) for the alias table
108
+ and [Architecture](../architecture/architecture.md) for how dispatch is
109
+ built into platform-specific CLI argv per backend.
110
+ - **Install refs vs. asset refs.** `npm:@scope/pkg` and `github:owner/repo`
111
+ are install refs, accepted only by `akm bundle add`/`akm clone`, and are a
112
+ different grammar from the `[bundle//]conceptId` refs `show`/`search` use.
113
+ See [Refs](../reference/refs.md) for the full grammar.
114
+ - **Plugin integrations.** For tighter editor and agent integrations,
115
+ platform-specific plugins are available in
116
+ [akm-plugins](https://github.com/itlackey/akm-plugins) (current
117
+ integrations include OpenCode). Plugins add richer UX — in-editor asset
118
+ browsing, automatic context injection — but the core `akm` CLI works
119
+ without them.
120
+
121
+ ## See also
122
+
123
+ - [Configuration](../reference/configuration.md#engines) — named agent engines and model aliases
124
+ - [Discover and Load](discover-and-load.md) — the full curate → show retrieval path
125
+ - [Knowledge Management](knowledge-management.md) — capturing agent-generated memories
126
+ - [Improve the Library](improve-the-library.md) — feeding back usage signals
127
+ - [CLI Reference](../reference/cli.md) — `completions`, `agent`, and `help agents` command documentation
128
+ - [Concepts](concepts.md) — refs, origins, and the asset type system
129
+ - [Bundle Types](../reference/bundle-types.md) — how AKM indexes existing project layouts in place