akm docs

0.9.2 Agent, Command, Task, Workflow, and Model Resolution Plan

Historical implementation plan. WP0-WP8 are implementation-complete for the 0.9.2 release cut. Current public contracts live in Tasks and Workflow Schema. The sequencing and staged checkpoint text below is preserved as historical evidence, not current product status.

Status: In progress; WP5 runtime lowering convergence is implemented, with WP6 task v3 and WP7 durable workflow IR work still outstanding

Decision date: 2026-08-18

Target branch: release/0.9.2

GitHub tracker: #801

Normative design: Agent, Command, Engine, and Model Resolution

Implementation checkpoint (2026-08-19): The reviewed WP5/#809 integration uses the active WP2/WP3 model-map and common-cascade resolver before runtime lowering. Canonical command and non-interactive agent dispatch, the existing task-v2 prompt arm, improve/proposal model-work adapters, current frozen workflow unit and judge dispatch, index passes, and the shared structured-LLM seam now enter the common resolved-request/lowerer path. This is runtime lowering convergence, not completion of the task-v3 source format (WP6) or the WP7 source-to-frozen durable workflow IR and resume-persistence design. Current workflow lowering notices are live diagnostics, not journaled result/evidence data. Full GitHub Actions execution remains out of scope.

1. Outcome

AKM 0.9.2 delivers one coherent execution model for direct command runs, scheduled tasks, and frozen workflows. The same source assets and configuration must resolve to the same command content, persona, engine, model, tools, and ordinary runtime settings regardless of entry point.

The release also establishes GitHub-compatible task and workflow seams without claiming full GitHub Actions execution. Existing AKM Markdown workflows remain first-class. Native Claude and OpenCode files remain authoritative and are translated at runtime; AKM does not synchronize or write them.

2. Definition of done

0.9.2 is complete only when all of the following are true:

  1. akm command run is the only stored-command execution surface.
  2. Direct command runs, task runs, and workflow freeze call one resolver and produce equivalent resolved requests for equivalent inputs.
  3. Commands and agents are read through their bundle adapters. Raw native file bytes and frontmatter are never accidentally dispatched as user prompt content.
  4. All registered agent harness profiles and direct LLM engines consume the same resolved/lowered request contract.
  5. Task v3 uses the approved GitHub-step-compatible shape. V2 is rejected by normal execution and handled by an explicit fail-closed migrator.
  6. AKM Markdown workflows and GitHub-shaped YAML compile into the same versioned internal IR and freeze the same dispatch-significant state.
  7. Installed and user models.json layers resolve aliases deterministically, with user values overlaying installed defaults by alias and field.
  8. Unsupported native template syntax, GitHub triggers, and adapter constructs fail or emit notices according to the normative design; nothing is silently ignored, guessed, synchronized, or partially expanded.
  9. Contract, unit, integration, migration, and release checks pass.

3. Decisions fixed for this milestone

Area 0.9.2 ruling
Scope Full coherent MVP across direct invocation, tasks, and workflow freeze/resume
Agents Personas selected by agent; never executable uses targets
Commands Reusable prompt templates; inline prompt text is anonymous command content, not another executable type
Native files AKM-native, Claude, and OpenCode formats only; read and translated at runtime, never synchronized or written
Engines Every currently registered profile plus direct LLM engines uses the unified resolver/lowering boundary
Cascade Installation -> engine -> agent -> command -> task/workflow defaults -> current task/step/CLI; nearest explicit value wins
Tools Selected by the ordinary cascade, then checked separately against operator authorization
Arguments One exact-string, one-pass $ARGUMENTS substitution; unsupported native syntax fails before dispatch
Sessions Fresh one-shot execution; explicit resume remains deferred
Models Installed default models.json plus field-wise user overlay in the AKM config directory
Task format Breaking v3; GitHub-step-shaped uses/run; AKM-only fields namespaced under akm
Shell run is a shell string with compatible shell and working-directory controls
Workflow formats AKM Markdown remains supported indefinitely; GitHub-shaped YAML is a peer format
Internal workflow form Internal, versioned, GitHub-shaped IR with AKM freeze/journal data and adapter-owned extensions
Local triggers schedule -> OS scheduler; workflow_dispatch -> manual; unsupported service events fail explicitly
GitHub direction Consumption-first; no file generation or synchronization
Future GitHub bridge One package with typed /command, /workflow, and /task actions; no separate /prompt action

4. Architecture and data flow

Every entry point must converge before engine dispatch:

source adapter
  -> typed agent/command/task/workflow source
  -> invocation adapter
  -> common cascade resolver
  -> model alias expansion
  -> authorization check
  -> versioned resolved request / workflow IR
  -> engine-specific optimistic lowering
  -> harness, LLM provider, shell, or workflow scheduler

For direct commands and scheduled tasks, resolution occurs when execution starts. For workflows, the same resolver runs during plan creation and the complete resolved result is frozen. Resume consumes the frozen representation; it does not re-read current assets or config.

No entry point may independently rebuild command arguments, choose a model, interpret tools, or construct agent prompts after this convergence point.

5. Implementation work packages

WP0 - Characterization and contract fixtures

Before changing behavior:

This package prevents cleanup from accidentally enshrining a 0.9.1 seam as the new contract.

WP1 - Shared source and resolved-execution types

Introduce one internal source representation for:

Introduce one resolved request containing the dispatch-significant result:

The type must not embed a static engine capability matrix. Unsupported-field handling belongs to lowering adapters.

WP2 - Model map files and alias expansion

Do not store authoritative defaults in the cache and do not add reusable mapping-pack installation in 0.9.2.

WP3 - Common cascade resolver and authorization boundary

WP4 - Command execution surface

No code path may fall back to asking a harness to resolve an AKM command name.

WP5 - Engine lowering convergence

The conformance matrix must cover OpenCode, OpenCode SDK, Claude, Codex, Gemini, Aider, Copilot, Pi, Amazon Q, OpenHands, and direct LLM connections without adding native file-format adapters for those extra harnesses.

Implemented checkpoint (2026-08-19): Engine lowering is an implementation registry derived from the harness registry, plus a direct-LLM lowerer; it is not a model/provider capability table. The common cascade resolves model-map aliases to exact model IDs and inference before lowering. Lowerers consume that exact selection, report translated and untranslated paths with stable, secret-free structured notices, and dispatch optimistically. Symbolic LLM and SDK-fallback credentials remain symbolic until the final runner dispatch. Already-frozen runner material uses the config-free lowering entry point, so it does not re-read config, aliases, environment variables, or credentials. The current task-v2 and workflow-engine adapters exercise this runtime seam; their WP6/WP7 replacement schemas and durable freeze/resume representation are not claimed by WP5.

WP6 - Task v3, adapters, migration, and scheduling

Define and publish a strict v3 schema with:

Add adapters for:

  1. step plus akm.schedule;
  2. step plus GitHub-style on; and
  3. complete on plus jobs documents.

A complete on plus jobs document becomes one workflow asset with an internal scheduler binding. It must not create a duplicate public task ref.

The scheduler adapter supports time schedules and manual dispatch. It rejects locally unsupported GitHub service-event triggers with source-located diagnostics and never installs a watcher or polling daemon.

The v2 migrator must:

Normal task execution rejects v2 with a direct migration hint.

WP7 - Multi-format workflow compile and freeze

Full GitHub Actions/workflow execution and remote action acquisition are not part of this work package.

WP8 - Documentation, diagnostics, and release gates

6. Sequencing and dependencies

WP0 characterization
  -> WP1 shared types
      -> WP2 model maps
      -> WP3 resolver/authorization
          -> WP4 command surface
          -> WP5 engine convergence
          -> WP6 task v3 and migration
          -> WP7 workflow compile/freeze
              -> WP8 release gates

WP2 may proceed alongside the source-type portion of WP1 once its schema contract is pinned. WP6 and WP7 may proceed in parallel only after WP3's resolved-request contract is stable. Engine-specific work in WP5 can be split by harness after the common lowering interface and conformance fixture exist.

7. GitHub milestone tracking

The milestone parent is #801. Closing carryover defects does not complete this plan; every work package has its own issue and must link its implementation commits and verification evidence.

Work package GitHub issue Dependency role
WP0 #803 Foundation for every later contract and conformance test
WP1 #804 Depends on WP0
WP2 #802 May start after WP0 and the relevant WP1 schema contract are pinned
WP3 #807 Depends on WP1
WP4 #806 Depends on WP3 and the WP1 source contract
WP5 #809 Depends on WP3; coordinates with the WP4 invocation path
WP6 #808 Depends on stable WP3; coordinates with WP4 and gated CI
WP7 #805 Depends on stable WP3; coordinates with WP4 and WP6
WP8 #810 Collects evidence after WP0-WP7 and the release-hardening lanes

The milestone also contains parallel architecture, security, infrastructure, and product-correctness work. These issues do not substitute for a work package:

Issue Plan relationship Sequencing and release treatment
#744 Website-provider dependency-edge refactor Separate architecture lane; land before WP1 if included, but make it a core dependency only when a concrete cycle or blocked adapter seam is demonstrated
#765 Dangerous environment-key audit during bundle update Security hardening; stage and audit before publication or completely roll back content, lock/config state, and index
#767 Registry SSRF, DNS-rebinding, and redirect protection Security hardening; inventory the complete registry fetch surface and document the private-registry compatibility policy
#811 Registry credential rejection and output redaction Split from #767 so secret-handling and network-boundary behavior are independently testable
#784 Gated semantic, Docker, and native-scheduler CI Foundation for WP6 and WP8; scheduled runs detect drift, while a manual run against the release-candidate SHA supplies release evidence
#794 Proven dead-code and fixture removal Land as an isolated pre-WP0 cleanup so characterization does not preserve dead surfaces
#798 Transformers dependency advisories Must use a remediation that affects installed consumers; root-only npm overrides are not a published-user fix; real embedding verification depends on #784
#800 Effective, side-effect-free improve --dry-run planning Separate improve lane using the same planner-for-preview-and-execution principle; complete before dogfood evidence is collected
#766 Git-backed walker symlink containment Completed by 5f389979; closed during milestone triage

Release readiness requires WP0-WP8 to be complete, the security issues to be resolved or covered by an explicit documented release decision, gated suites to pass against the release-candidate SHA, and improve --dry-run to be trustworthy for the dogfood period. Architecture cleanup may remain off the critical path only when it does not block those outcomes.

8. Required contract tests

At minimum, the suite must prove:

  1. Equivalent direct, task, and workflow inputs produce byte-equivalent normalized resolved requests.
  2. Every cascade layer wins only over farther layers, including tools.
  3. Operator tool denial is explicit and independent of bundle provenance.
  4. Native command frontmatter is metadata, not prompt content.
  5. $ARGUMENTS expands exactly once and unsupported templates never dispatch.
  6. Installed model defaults, partial user overlays, structured profiles, engine overrides, known-unmapped aliases, and exact unknown identifiers behave as specified.
  7. Every registered engine profile receives the selected exact model and emits notices for intentionally untranslated settings.
  8. All three scheduling source shapes produce the expected scheduler binding; unsupported service triggers produce no registration side effect.
  9. Task migration preview performs no writes and matches the later execution plan; ambiguous cases remain untouched.
  10. Equivalent Markdown and YAML workflows freeze equivalent portable IR.
  11. Resume does not observe subsequent edits to commands, agents, config, or model maps.
  12. Native Claude/OpenCode bundles remain byte-for-byte unchanged throughout indexing and execution.

9. Explicitly out of scope

These may become 0.9.3 work, but 0.9.2 must leave clean adapter and IR seams for them without claiming support early.

10. Release evidence

The 0.9.2 release PR and parent tracker #801 must include: