akm-cli 0.9.2-alpha.4 → 0.9.2

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 (143) hide show
  1. package/CHANGELOG.md +493 -0
  2. package/STABILITY.md +23 -5
  3. package/dist/assets/hints/cli-hints-full.md +12 -7
  4. package/dist/assets/tasks/core/extract.yml +3 -5
  5. package/dist/assets/tasks/core/improve.yml +3 -5
  6. package/dist/assets/tasks/core/index-refresh.yml +3 -5
  7. package/dist/assets/tasks/core/sync.yml +3 -5
  8. package/dist/assets/tasks/core/version-check.yml +3 -5
  9. package/dist/assets/tasks/improve/akm-graph-refresh-weekly.yml +3 -5
  10. package/dist/assets/tasks/improve/akm-improve-catchup.yml +6 -6
  11. package/dist/assets/tasks/improve/akm-improve-consolidate.yml +3 -5
  12. package/dist/assets/tasks/improve/akm-improve-frequent.yml +3 -5
  13. package/dist/assets/tasks/improve/akm-improve-nightly.yml +3 -5
  14. package/dist/cli/unknown-flags.js +12 -1
  15. package/dist/cli.js +8 -1
  16. package/dist/commands/command/command-execution.js +23 -2
  17. package/dist/commands/health/improve-metrics.js +38 -0
  18. package/dist/commands/health/windows.js +8 -4
  19. package/dist/commands/health.js +8 -4
  20. package/dist/commands/lint/index.js +1 -1
  21. package/dist/commands/migrate-cli.js +130 -24
  22. package/dist/commands/proposal/validators/proposal-validators.js +7 -2
  23. package/dist/commands/tasks/explain.js +304 -0
  24. package/dist/commands/tasks/tasks-cli.js +185 -3
  25. package/dist/commands/tasks/tasks.js +265 -52
  26. package/dist/commands/workflow/plan.js +159 -0
  27. package/dist/commands/workflow-cli.js +94 -2
  28. package/dist/core/activation-policy.js +2 -12
  29. package/dist/core/adapter/adapters/akm-lint.js +7 -4
  30. package/dist/core/adapter/adapters/akm-metadata.js +26 -14
  31. package/dist/core/adapter/adapters/akm-task-adapter.js +13 -10
  32. package/dist/core/errors.js +45 -0
  33. package/dist/core/json-schema.js +15 -5
  34. package/dist/core/state/migrations.js +57 -0
  35. package/dist/core/state-db.js +16 -14
  36. package/dist/core/subprocess.js +47 -13
  37. package/dist/execution/guarded-source.js +44 -0
  38. package/dist/execution/input-contract.js +250 -0
  39. package/dist/execution/target-ref.js +63 -0
  40. package/dist/indexer/usage/usage-events.js +14 -3
  41. package/dist/integrations/agent/execution-lowering.js +12 -1
  42. package/dist/output/shapes/passthrough.js +2 -0
  43. package/dist/output/text/helpers.js +1 -1
  44. package/dist/output/text/migrate.js +12 -3
  45. package/dist/output/text/workflow-format.js +192 -10
  46. package/dist/output/text/workflow.js +2 -1
  47. package/dist/runtime.js +1 -0
  48. package/dist/scripts/akm-migrate-node.js +11838 -10118
  49. package/dist/scripts/akm-migrate.js +11828 -10117
  50. package/dist/setup/steps/tasks.js +34 -17
  51. package/dist/storage/repositories/task-history-repository.js +5 -1
  52. package/dist/storage/repositories/workflow-runs-repository.js +144 -6
  53. package/dist/tasks/backends/launchd.js +31 -84
  54. package/dist/tasks/embedded.js +13 -7
  55. package/dist/tasks/model/invocation.js +4 -0
  56. package/dist/tasks/prepare/prepare-script-target.js +9 -0
  57. package/dist/tasks/prepare/prepare-support.js +154 -0
  58. package/dist/tasks/prepare/prepare.js +117 -0
  59. package/dist/tasks/prepare/prepared-execution.js +4 -0
  60. package/dist/tasks/prepare/script-capture.js +80 -0
  61. package/dist/tasks/run/attempt-lifecycle.js +165 -0
  62. package/dist/tasks/run/load-task.js +117 -0
  63. package/dist/tasks/run/provenance.js +20 -0
  64. package/dist/tasks/run/run-command-task.js +92 -0
  65. package/dist/tasks/run/run-native-task.js +222 -0
  66. package/dist/tasks/run/run-task.js +99 -0
  67. package/dist/tasks/run/run-workflow-task.js +222 -0
  68. package/dist/tasks/run/task-history.js +134 -0
  69. package/dist/tasks/run/task-log.js +179 -0
  70. package/dist/tasks/run/task-result.js +19 -0
  71. package/dist/tasks/scheduler-binding.js +66 -2
  72. package/dist/tasks/scheduler-invocation.js +63 -3
  73. package/dist/tasks/scheduler-sync.js +77 -14
  74. package/dist/tasks/source/bounded-document.js +455 -0
  75. package/dist/tasks/source/parse-task-source.js +59 -0
  76. package/dist/tasks/source/project-v4.js +62 -0
  77. package/dist/tasks/source/task-input-diagnostics.js +36 -0
  78. package/dist/tasks/source/task-source-v4.js +626 -0
  79. package/dist/tasks/source-v3.js +10 -733
  80. package/dist/tasks/task-run-reserved-flags.js +79 -0
  81. package/dist/workflows/authoring/authoring.js +17 -8
  82. package/dist/workflows/exec/child-invocation.js +34 -0
  83. package/dist/workflows/exec/child-workflow.js +370 -0
  84. package/dist/workflows/exec/exec-unit.js +50 -170
  85. package/dist/workflows/exec/frozen-judge.js +19 -2
  86. package/dist/workflows/exec/native-executor.js +49 -27
  87. package/dist/workflows/exec/param-secrets.js +12 -0
  88. package/dist/workflows/exec/run-workflow.js +48 -59
  89. package/dist/workflows/exec/step-work.js +222 -80
  90. package/dist/workflows/exec/unit-dispatch.js +72 -0
  91. package/dist/workflows/freeze/child-output-references.js +94 -0
  92. package/dist/workflows/freeze/environment.js +174 -0
  93. package/dist/workflows/freeze/identity.js +22 -0
  94. package/dist/workflows/freeze/resolve-steps.js +78 -0
  95. package/dist/workflows/freeze/source-freeze.js +57 -0
  96. package/dist/workflows/freeze/step-values.js +68 -0
  97. package/dist/workflows/freeze/targets/child-workflow.js +206 -0
  98. package/dist/workflows/freeze/targets/command.js +81 -0
  99. package/dist/workflows/freeze/targets/script.js +57 -0
  100. package/dist/workflows/freeze/targets/shell.js +31 -0
  101. package/dist/workflows/freeze/targets/task.js +179 -0
  102. package/dist/workflows/freeze/task-bindings.js +180 -0
  103. package/dist/workflows/ir/compile.js +59 -11
  104. package/dist/workflows/ir/environment-v4.js +3 -3
  105. package/dist/workflows/ir/freeze-v4.js +41 -7
  106. package/dist/workflows/ir/params.js +58 -131
  107. package/dist/workflows/ir/plan-hash.js +3 -3
  108. package/dist/workflows/ir/schema-v4.js +246 -17
  109. package/dist/workflows/parser.js +74 -2
  110. package/dist/workflows/program/schema.js +5 -2
  111. package/dist/workflows/resource-limits.js +20 -0
  112. package/dist/workflows/runtime/plan-classifier.js +24 -7
  113. package/dist/workflows/runtime/run-outputs.js +103 -0
  114. package/dist/workflows/runtime/runs.js +114 -9
  115. package/dist/workflows/runtime/workflow-asset-loader.js +14 -6
  116. package/dist/workflows/source-files.js +5 -5
  117. package/dist/workflows/source-ir/compare.js +17 -0
  118. package/dist/workflows/source-ir/compile.js +7 -3
  119. package/dist/workflows/source-ir/github-yaml.js +64 -17
  120. package/dist/workflows/source-ir/schema.js +69 -21
  121. package/dist/workflows/source-ir/semantics.js +7 -25
  122. package/dist/workflows/source-ir/triggers.js +79 -0
  123. package/dist/workflows/source-ir/uses.js +33 -7
  124. package/docs/migration/README.md +1 -1
  125. package/docs/migration/release-notes/0.9.2.md +87 -11
  126. package/docs/migration/release-notes/README.md +3 -2
  127. package/docs/migration/v0.8-to-v0.9.md +13 -11
  128. package/docs/migration/v0.9.0-troubleshooting.md +20 -13
  129. package/docs/migration/v0.9.1-to-v0.9.2.md +598 -49
  130. package/docs/reference/README.md +1 -1
  131. package/docs/reference/cli.md +140 -46
  132. package/docs/reference/configuration.md +6 -5
  133. package/docs/reference/supported-formats.md +9 -5
  134. package/docs/reference/tasks.md +338 -75
  135. package/docs/reference/workflow-schema.md +290 -16
  136. package/docs/reference/workflows.md +57 -7
  137. package/package.json +1 -1
  138. package/schemas/akm-task.json +173 -118
  139. package/schemas/akm-workflow.json +28 -0
  140. package/dist/tasks/runner.js +0 -941
  141. package/dist/tasks/runtime-v3.js +0 -281
  142. package/dist/workflows/ir/source-freeze-v4.js +0 -506
  143. package/dist/workflows/source-ir/ordering.js +0 -38
@@ -6,7 +6,7 @@ Authoritative reference documentation for the akm CLI and its data.
6
6
  - [CLI](cli.md) -- All `akm` commands and flags
7
7
  - [Configuration](configuration.md) -- Engines, strategies, bundles, and settings
8
8
  - [Supported Formats](supported-formats.md) -- Formats akm can index, from its own bundle layout to other tools' existing asset directories
9
- - [Tasks](tasks.md) -- Strict task-v3 source grammar, executable targets, triggers, migration, and scheduler operations
9
+ - [Tasks](tasks.md) -- Task source v4 grammar, executable targets, scheduling, migration, and scheduler operations
10
10
  - [Workflow Schema](workflow-schema.md) -- Authoritative reference for a workflow asset's exact frontmatter and body syntax
11
11
  - [Workflows](workflows.md) -- Map of the workflow documentation: running, authoring, the schema, and the engine
12
12
  - [Memory](https://github.com/itlackey/akm/blob/main/docs/reference/memory.md) -- The `memory` asset type: capture, belief states, and derived memories
@@ -560,6 +560,8 @@ akm workflow status workflows/ship-release
560
560
  akm workflow resume <run-id>
561
561
  akm workflow abandon <run-id>
562
562
  akm workflow list --active
563
+ akm workflow list --children # also list child workflow runs
564
+ akm workflow plan workflows/ship-release # compile+freeze preview, zero writes
563
565
  ```
564
566
 
565
567
  Bare `akm workflow` (no subcommand) is a usage error (exit 2), the canonical
@@ -571,10 +573,11 @@ Subcommands:
571
573
  | --- | --- |
572
574
  | `create <name>` | Validate and write a Markdown workflow under `workflows/`. `--path <dir>` places it in a subdirectory; `--from <file>` imports content; `--force` (requires `--from` or `--reset`) overwrites; `--print` prints the template that would be written instead of writing it |
573
575
  | `run <run-id\|ref>` | Stable canonical start/resume/execute command. A ref starts a run or continues the active run in the current scope; a run id continues that exact active run. Executes until completion, failure, verification rejection, interruption, or an explicit limit |
574
- | `status <run-id\|ref>` | Show the full run state, including all step statuses. `--units` also lists per-unit rows from the run journal (diagnostics only) |
575
- | `list` | List workflow runs (optionally filtered by `--ref`; `--active` shows only `status=active` runs, excluding `blocked`/`failed`/`completed`) |
576
+ | `status <run-id\|ref>` | Show the full run state, including all step statuses. `--units` also lists per-unit rows from the run journal (diagnostics only). Renders a `children:` tree when the run composes child workflows |
577
+ | `list` | List workflow runs (optionally filtered by `--ref`; `--active` shows only `status=active` runs, excluding `blocked`/`failed`/`completed`). Child workflow runs are excluded unless `--children` is passed |
576
578
  | `resume <run-id>` | Flip a `blocked` or `failed` run back to `active`. Completed runs cannot be resumed |
577
579
  | `abandon <run-id>` | Mark a run failed so it stops counting as active (`resume` can reopen it) |
580
+ | `plan <ref>` | **Evolving.** Compile and freeze a workflow WITHOUT publishing a run: the canonical step graph, per-step frozen target kinds, task/child expansion, input bindings, source read set, and lowering notices — zero durable writes. Defaults to a human-readable summary; pass `--format json` for the full envelope |
578
581
 
579
582
  The public `workflow start`, `next`, and `complete` lifecycle was removed in
580
583
  0.9, along with the experimental `brief`/`report` external-driver protocol.
@@ -704,6 +707,70 @@ to the most-recently-updated run for that ref in the current working scope.
704
707
  result/error diagnostic text) from the run journal — diagnostics only; step
705
708
  evidence stays deterministic and is unaffected.
706
709
 
710
+ #### workflow plan
711
+
712
+ ```sh
713
+ akm workflow plan workflows/release
714
+ akm workflow plan workflows/release --format json
715
+ ```
716
+
717
+ **Evolving** (see [STABILITY.md](../../STABILITY.md)). Compiles, resolves,
718
+ and freezes the named workflow exactly as `akm workflow run` would when
719
+ starting a new run — the same two calls, `loadWorkflowAsset` +
720
+ `compileResolveFreezeWorkflowV4` — and stops. It publishes **no** run row,
721
+ takes **no** lease, appends **no** event, and writes to no other table:
722
+ zero durable writes, verified by row count before and after, not merely
723
+ assumed. Use it to preview what a run *would* freeze — the canonical step
724
+ graph, which steps expand through a task or a composed child workflow, and
725
+ any freeze-time lowering notices or compile warnings — before committing to
726
+ a run, or to inspect a workflow's shape without side effects.
727
+
728
+ Two output modes:
729
+
730
+ - **No `--format`** (the default for this command only — every other verb
731
+ defaults to JSON): a human-readable text summary.
732
+ - **`--format json`**: the full envelope — `ok`, `ref`, `title`,
733
+ `sourceFormat`, `sourcePath`, `irVersion`, `planHash`, `published` (always
734
+ `false`, so a consumer can never mistake this for a run envelope),
735
+ `execution`, `budget?`, `params?`, `outputs?`, `steps[]`, `sourceReadSet[]`,
736
+ `notices[]`, `warnings[]`. Each step entry carries an `expansion` field
737
+ naming how its target was reached: `{via: "direct"}`, `{via: "task",
738
+ taskRef}`, or — for a step composing a child workflow —
739
+ `{via: "child", childRef, childPlanHash, childOutputs, steps[]}` with the
740
+ child's own step list nested recursively in the same shape.
741
+
742
+ Text-mode example:
743
+
744
+ ```
745
+ workflow: team//workflows/release (markdown)
746
+ source: workflows/release.md
747
+ plan: irVersion 5, hash 4f2ba91c3d0e… (not published)
748
+ limits: maxConcurrency 4; budget max_units 50, max_tokens 100000
749
+ params: channel, version
750
+ outputs: report <- steps.summarize.output
751
+ steps:
752
+ 1. notify [command] direct
753
+ 2. build [script] via tasks/plan-v4-task
754
+ 3. dispatch [child-workflow] -> workflows/release-checklist (plan 91acbe20f5d1…)
755
+ with: channel="stable" (literal), files <- steps.build.output.files (reference)
756
+ exports: report, changed_count
757
+ 3.1 verify [command] direct
758
+ 4. summarize [command] direct
759
+ read set:
760
+ workflows/release.md
761
+ commands/notify.md
762
+ workflows/release-checklist.md
763
+ ```
764
+
765
+ **Secret-free by construction.** Neither mode ever prints a resolved
766
+ reference value (references resolve at pre-attempt, not here), request
767
+ content (`request.command.content`, `request.persona`, `request.conversation`,
768
+ `request.runtime.environment`), a script's `bytesBase64`, or any credential —
769
+ only binding *shapes* (`inputBindings[].name`/`.kind`, a literal's `.value`,
770
+ a reference's `.from`), environment binding *names* (`environment[].kind`/
771
+ `.name`, an `env-ref`'s `.ref`/`.keys`/`.secretNames`), and engine *names*
772
+ (`gate.judgeEngine`).
773
+
707
774
  #### workflow resume
708
775
 
709
776
  ```sh
@@ -1366,10 +1433,15 @@ akm registry remove my-team --yes # Skip the confirmation prompt
1366
1433
 
1367
1434
  ### migrate
1368
1435
 
1369
- Inspect or apply the explicit one-way task-v2 to task-v3 conversion. Normal task
1370
- execution accepts only task v3. Database schema upgrades are additive and run
1371
- automatically when `state.db` opens; config and workflow formats have no runtime
1372
- compatibility migrator.
1436
+ Inspect or apply the explicit, one-way conversion of on-disk task sources to
1437
+ task source v4, the only grammar normal task execution accepts. `akm migrate`
1438
+ runs **both** migration generations in one pass task-v2 to task-v3, then
1439
+ task-v3 to task source v4 against the resulting files — each keeping its own
1440
+ lock, backup, prevalidation, and rollback, so a file blocked in the first
1441
+ generation does not stop the second generation from converting files that are
1442
+ already `version: 3`. Database schema upgrades are additive and run
1443
+ automatically when `state.db` opens; config and workflow formats have no
1444
+ runtime compatibility migrator.
1373
1445
 
1374
1446
  ```sh
1375
1447
  akm migrate status
@@ -1377,9 +1449,17 @@ akm migrate apply --dry-run
1377
1449
  akm migrate apply
1378
1450
  ```
1379
1451
 
1380
- `status` and `apply --dry-run` are read-only. Apply refuses blocked task sources,
1381
- backs up each changed file, atomically publishes strict v3 YAML, and is
1382
- idempotent: an already-v3 file is skipped.
1452
+ `status` and `apply --dry-run` are read-only. Apply refuses blocked task
1453
+ sources, backs up each changed file immediately before replacement, and
1454
+ atomically publishes strict task source v4 YAML; it is idempotent per
1455
+ generation, skipping a file already at that generation's target version
1456
+ (`already-v3`, `already-v4`). To run only the second generation in isolation
1457
+ (for example, previewing just the v3-to-v4 step against a tree that is
1458
+ already all `version: 3`), the frozen migrator's standalone entry points
1459
+ remain available as a separate executable: `akm-migrate task-v4-status` /
1460
+ `akm-migrate task-v4-apply [--dry-run]`. See [Tasks: Migrating to task
1461
+ source v4](tasks.md#migrating-to-task-source-v4) for the full blocked-reason
1462
+ table and worked examples.
1383
1463
 
1384
1464
  ### config
1385
1465
 
@@ -2335,10 +2415,11 @@ prompts. Negative feedback requires a reason by default.
2335
2415
  `akm task` is the scheduling surface for workflows, agent prompts, and
2336
2416
  shell commands. It manages on-disk task definitions under
2337
2417
  `<bundle>/tasks/<id>.yml` and reconciles them with the OS-native scheduler
2338
- (cron / launchd / schtasks). Strict task v3 YAML is the executable source
2339
- contract; see the canonical [Tasks reference](tasks.md). The
2340
- group is `add | run | sync | doctor | history` — there is no `list` or
2341
- `remove`; use `akm search --type task` / `akm show tasks/<id>` to inspect,
2418
+ (cron / launchd / schtasks). Task source v4 YAML (`version: 4`) is the only
2419
+ executable source contract this release accepts; `akm task add` writes v4
2420
+ see the canonical [Tasks reference](tasks.md). The
2421
+ group is `add | run | explain | sync | doctor | history` there is no `list`
2422
+ or `remove`; use `akm search --type task` / `akm show tasks/<id>` to inspect,
2342
2423
  and edit the file + `akm task sync` to change or remove a schedule.
2343
2424
 
2344
2425
  ```sh
@@ -2350,6 +2431,7 @@ akm task add review --schedule "@daily" --prompt "Review recent changes" --engin
2350
2431
  akm task add nightly --schedule "@daily" --command "akm improve" --disabled # register but leave off
2351
2432
  akm task add nightly --schedule "@daily" --command "akm improve" --force # overwrite an existing task id
2352
2433
  akm task run <id> # Execute now (what the scheduler calls)
2434
+ akm task explain <ref> # Read-only: declared inputs, target, schedule — spawns nothing
2353
2435
  akm task history [--id <id>] [--limit <n>] # Recent runs from state.db
2354
2436
  akm task sync # Reconcile on-disk YAML with scheduler
2355
2437
  akm task sync --rebind # Also capture the current installed runtime
@@ -2361,14 +2443,23 @@ scheduler), `--force` (overwrite an existing task with the same id), and
2361
2443
  `--rebind` (explicitly permit scheduler creation from a local invocation that
2362
2444
  would otherwise be considered ineligible).
2363
2445
 
2446
+ `akm task explain <ref> [input flags]` prints a task's declared `inputs:`,
2447
+ the values that would actually be supplied (with provenance), the resolved
2448
+ target, effective execution settings, and schedule bindings — **read-only**:
2449
+ it never spawns anything, writes history, or touches the scheduler. A
2450
+ secret-shaped value prints as `<redacted>`. See
2451
+ [`akm task explain`](tasks.md#akm-task-explain).
2452
+
2364
2453
  `akm task run` is what cron / launchd / schtasks invoke at the scheduled
2365
2454
  time. Each run is recorded as a row in the durable `task_history` table
2366
2455
  (`state.db`), surfaced by `akm task history` — **not** by `akm log`; there is
2367
2456
  no `task_invoked`/`task_completed` event type on the `akm log` stream.
2368
2457
 
2369
- To disable a scheduled task, set `enabled: false` in its file and run
2370
- `akm task sync`. To remove one, delete its file (`<bundle>/tasks/<id>.yml`)
2371
- and run `akm task sync` sync uninstalls the orphaned scheduler entry.
2458
+ To disable a scheduled task, set `enabled: false` on its `schedule:` entry
2459
+ (task source v4 has no document-level `enabled` flag — it lives per
2460
+ schedule-binding) and run `akm task sync`. To remove one, delete its file
2461
+ (`<bundle>/tasks/<id>.yml`) and run `akm task sync` — sync uninstalls the
2462
+ orphaned scheduler entry.
2372
2463
 
2373
2464
  Scheduler activation captures the installed akm runtime. Ordinary `task sync`
2374
2465
  reconciles definitions, schedules, and enabled state while preserving that
@@ -2384,10 +2475,10 @@ the AKM storage path or installed runtime path therefore requires an explicit
2384
2475
  `akm task sync --rebind`; setup does not silently migrate those entries.
2385
2476
 
2386
2477
  **Bundle targeting (`--bundle <bundle>`).** By default every subcommand
2387
- operates on the primary/default bundle. `add`, `history`, `sync`, and `run`
2388
- all accept `--bundle <bundle>` to schedule and reconcile tasks that live in
2389
- another configured bundle (`doctor` reports scheduler-wide state and takes no
2390
- `--bundle`):
2478
+ operates on the primary/default bundle. `add`, `history`, `sync`, `run`, and
2479
+ `explain` all accept `--bundle <bundle>` to schedule, reconcile, or inspect
2480
+ tasks that live in another configured bundle (`doctor` reports scheduler-wide
2481
+ state and takes no `--bundle`):
2391
2482
 
2392
2483
  ```sh
2393
2484
  akm task add nightly --schedule "@daily" --command "akm improve" --bundle team-bundle
@@ -2403,15 +2494,17 @@ are never namespaced: registering a task whose id is already scheduled from a
2403
2494
  different bundle is a hard error.
2404
2495
 
2405
2496
  `task add` accepts exactly one CLI target selector (`--workflow <ref>`,
2406
- `--prompt <text-or-ref>`, or `--command <shell>`) and writes a strict task v3
2407
- source. In the file, exactly one of `uses` or `run` is allowed. `uses` accepts
2408
- command, workflow, and script refs plus `akm/command`; agents and task refs are
2409
- not executable. `run` accepts a shell string with the closed shell and
2410
- contained working-directory contract. The `akm` object owns scheduling,
2411
- resolver overrides, `timeout`, `maxSteps`, `maxRetries`, and redaction names.
2412
- Normal execution rejects v2 and points to `akm migrate apply --dry-run` followed
2413
- by `akm migrate apply`. See [Tasks](tasks.md#migrating-task-v2-to-v3) for the
2414
- complete grammar and fail-closed migration behavior.
2497
+ `--prompt <text-or-ref>`, or `--command <shell>`) and writes a task source v4
2498
+ document (`version: 4`). In the file, exactly one of `uses` or `run` is
2499
+ allowed. `uses` accepts command, workflow, and script refs plus `akm/command`;
2500
+ agents and task refs are not executable. `run` accepts a shell string with the
2501
+ closed shell and contained working-directory contract. Task source v4 has no
2502
+ `akm:` options bag or `on:` trigger block — scheduling, resolver overrides,
2503
+ `timeout`, `maxSteps`, `maxRetries`, and redaction names are all top-level
2504
+ keys on the document itself. Normal execution rejects v2 and v3 and points to
2505
+ `akm migrate apply --dry-run` followed by `akm migrate apply`. See
2506
+ [Tasks](tasks.md#migrating-to-task-source-v4) for the complete grammar and
2507
+ fail-closed migration behavior.
2415
2508
 
2416
2509
  **Task-log redaction and `redact:`.** A task's persisted output — the run `.log`
2417
2510
  file and its `logs.db` rows — is scrubbed before it is written. Two passes run:
@@ -2428,11 +2521,10 @@ Any task kind may add `redact:` for a secret exported under a name none of those
2428
2521
  rules recognise:
2429
2522
 
2430
2523
  ```yaml
2431
- version: 3
2524
+ version: 4
2432
2525
  run: ./deploy.sh
2433
- akm:
2434
- schedule: "0 3 * * *"
2435
- redact: [ACME_DEPLOY_TOKEN] # NAMES, never values
2526
+ schedule: "0 3 * * *"
2527
+ redact: [ACME_DEPLOY_TOKEN] # NAMES, never values
2436
2528
  ```
2437
2529
 
2438
2530
  akm looks each name up in the environment the run is given; a name that is unset
@@ -2445,16 +2537,17 @@ units' `pass_env:` follows.
2445
2537
  A workflow-target task executes the same native orchestration as `akm workflow
2446
2538
  run`; it does not stop after creating a run. Completion maps to task
2447
2539
  `completed`, while workflow failure or verifier rejection maps to task
2448
- `failed`. The task schema's `params` mapping remains the non-CLI way a scheduled
2449
- definition supplies its new-run parameter snapshot.
2540
+ `failed`. A workflow-target task's declared `inputs:` (with their `default:`
2541
+ values) remain the non-CLI way a scheduled definition supplies its new-run
2542
+ parameter snapshot.
2450
2543
 
2451
- **Workflow-task run bounds.** `akm.timeout`, `akm.maxSteps`, and
2452
- `akm.maxRetries` correspond to `akm workflow run --timeout`, `--max-steps`, and
2544
+ **Workflow-task run bounds.** Top-level `timeout`, `maxSteps`, and
2545
+ `maxRetries` correspond to `akm workflow run --timeout`, `--max-steps`, and
2453
2546
  `--max-retries`. Unlike the interactive command, a scheduled workflow task gets
2454
2547
  a **default whole-run timeout of 6 hours**
2455
2548
  (`DEFAULT_WORKFLOW_TASK_TIMEOUT_MS`): nobody is at the terminal to Ctrl-C an
2456
2549
  unattended run, so without one a single wedged unit hangs the task forever. An
2457
- explicit `akm.timeout` always wins, and `timeout: null` opts out entirely. On
2550
+ explicit `timeout` always wins, and `timeout: null` opts out entirely. On
2458
2551
  expiry the runner aborts the run's signal, which the engine treats as a
2459
2552
  graceful break at the next step boundary — the journal is kept and the run
2460
2553
  stays resumable with `akm workflow resume <run-id>` (the run id is in the task
@@ -2462,13 +2555,14 @@ run's `detail.error` and log). The attempt itself is recorded as `failed`, so
2462
2555
  the OS scheduler sees a non-zero exit.
2463
2556
 
2464
2557
  ```yaml
2465
- version: 3
2558
+ version: 4
2466
2559
  uses: workflows/nightly-report
2467
- with:
2468
- region: us-east-1
2469
- akm:
2470
- schedule: "@daily"
2471
- timeout: 3600000 # 1h whole-run bound (omit for the 6h default, null for none)
2472
- maxSteps: 20 # optional
2473
- maxRetries: 1 # optional
2560
+ inputs:
2561
+ region:
2562
+ type: string
2563
+ default: us-east-1
2564
+ schedule: "@daily"
2565
+ timeout: 3600000 # 1h whole-run bound (omit for the 6h default, null for none)
2566
+ maxSteps: 20 # optional
2567
+ maxRetries: 1 # optional
2474
2568
  ```
@@ -11,8 +11,8 @@ A present configuration file must set `configVersion` to exactly `"0.9.0"`.
11
11
  Missing, older, newer, numeric, and malformed versions are rejected by ordinary
12
12
  commands without rewriting the file. Pre-0.9 config and database layouts are
13
13
  not runtime inputs and are not migrated by `akm upgrade`. Configure the current
14
- schema directly. The standalone migrator exists only for explicit task v2 to
15
- task v3 conversion.
14
+ schema directly. The standalone migrator exists only for explicit task
15
+ migration: task v2 to task v3, then task v3 to task source v4, in one pass.
16
16
 
17
17
  ```jsonc
18
18
  {
@@ -141,14 +141,15 @@ known merged alias, selecting an engine with no mapping is an actionable
141
141
  configuration error rather than silently sending the alias as a model ID.
142
142
 
143
143
  The common execution cascade reads these files for current direct command and
144
- non-interactive agent calls, task-v3 runs, and improve/proposal/index
144
+ non-interactive agent calls, task source v4 runs, and improve/proposal/index
145
145
  model work routed through that resolver. A structured alias expands as
146
146
  defaults at the layer that selected it; explicit sibling fields and nearer
147
147
  layers still win. The resulting request carries the exact model ID and merged
148
148
  inference object. Engine lowerers consume that exact selection and never run
149
149
  alias resolution again. New workflow starts persist the exact request and
150
- symbolic runner selection in durable plan v4; resume consumes that frozen
151
- material without resolving aliases again.
150
+ symbolic runner selection in the durable plan v4 family's executable
151
+ `irVersion: 5`; resume consumes that frozen material without resolving aliases
152
+ again.
152
153
 
153
154
  Copy the complete installed starter into the user configuration directory when
154
155
  you want to customize all fields:
@@ -21,7 +21,7 @@ one explicitly. 0.9.0 recognizes 11 formats.
21
21
  | `opencode` | Same shape as `claude`, rooted on `AGENTS.md` | `opencode.json`/`opencode.jsonc`, or root `AGENTS.md` plus a canonical plural tool directory | Read-only | Point AKM at an existing OpenCode `.opencode` tool directory |
22
22
  | `dotenv` | `env` entries as key names only (never values); `secret` entries as file names only (never content) | Every top-level directory is `env/` and/or `secrets/`, with at least one present | Writable, narrowly — `akm env create`/`env remove`/`secret set` only | A standalone env/secrets-only bundle |
23
23
  | `akm-workflow` | Workflow steps, name, description, tags | Either a top-level `.md` file with explicit `type: workflow` frontmatter or a peer top-level GitHub-shaped `.yml` workflow | Writable — `akm workflow create` only | A standalone workflow bundle, one workflow per file |
24
- | `akm-task` | Strict task-v3 `.yml` sources (`version: 3`) as type `task`, including local schedules/manual triggers and the exact authored YAML | A top-level `.yml` file accepted by the task-v3 source probe (`akm.schedule` or supported `on`) | Read-only | A standalone scheduled-task bundle; `.yaml` is rejected |
24
+ | `akm-task` | Task source v4 (`version: 4`) `.yml` sources as type `task`, including local schedules/manual triggers and the exact authored YAML | A top-level `.yml` file accepted by the task source v4 parser (`version: 4`, one `uses`/`run` executable selector, optional top-level `schedule:`) | Read-only | A standalone scheduled-task bundle; `.yaml` is rejected |
25
25
  | `llm-wiki` | `raw/` sources as `wiki-source`; `pages/` as their `pageKind` (default `note`), with resolved cross-reference links | Root `schema.md` plus a `pages/` directory | Read-only (author by writing directly into `pages/`; AKM indexes and serves the result) | [Karpathy's LLM-wiki pattern](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f) — agent-authored reference wikis |
26
26
  | `akm` (native) | AKM's own 14 native asset types — see [Asset Types](https://github.com/itlackey/akm/blob/main/docs/reference/asset-types.md) | A `.stash` marker directory, or two-plus native subdirectories, or the fallback when nothing else matches | Fully writable — every AKM-native write command | Your working bundle, and any bundle authored as AKM's own format |
27
27
  | `okf` | Frontmatter `type` (defaults to `knowledge`); name, description, tags, links, body | A root `index.md`, or any `.md` file anywhere carrying a non-empty frontmatter `type` | Read-only | The [Open Knowledge Format](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md) — the portable baseline every markdown-based format here is a superset of |
@@ -40,15 +40,19 @@ native files remain authoritative.
40
40
 
41
41
  ## Task format
42
42
 
43
- The `akm-task` adapter and native AKM task directory use the same strict
44
- `version: 3` task-v3 contract. An `akm-task` source is `.yml` only; `.yaml` is
45
- diagnosed but never indexed, scheduled, or executed. See [Tasks](tasks.md).
43
+ The `akm-task` adapter and native AKM task directory accept exactly one task
44
+ source grammar: `version: 4` task source v4 (typed `inputs:`, a single
45
+ bounded `output:` schema, and OPTIONAL scheduling). A `version: 3` or
46
+ `version: 2` document is no longer read by `src` at all — it fails to load
47
+ with `TASK_SCHEMA_VERSION_UNSUPPORTED`, naming `akm migrate` as the path
48
+ forward. An `akm-task` source is `.yml` only; `.yaml` is diagnosed but never
49
+ indexed, scheduled, or executed. See [Tasks](tasks.md).
46
50
 
47
51
  ## Workflow formats
48
52
 
49
53
  Workflow sources are the one intentional peer-format case inside the native
50
54
  AKM workspace: workflows may be `.md` or `.yml`, and both compile to the same
51
- source IR. Task sources remain `.yml` only and require task v3. See
55
+ source IR. Task sources remain `.yml` only, authored as task source v4. See
52
56
  [Tasks](tasks.md) and [Workflow Schema](workflow-schema.md).
53
57
 
54
58
  ## Why this matters