agentify afk

Create and run autonomous plans.

Two subcommands, create and run, dispatched at src/main.js:695 via runAfk(root, config, args, { runClean }) in src/core/afk.js. Plan markdown is validated by validateAfkPlanMarkdown against schema version 1.0.

module src/core/afk.js plans dir .agentify/planned/<slug>.md schema type: agentify-afk-plan · v1.0

Two moves: create and run.

author

afk create <task>

Implementation: src/core/afk.js:268 · runAfkCreate(root, config, args).

Flags: --slug <string> (auto-generated from task if omitted), --root, --provider, --json.

Writes: .agentify/planned/<slug>.md with frontmatter type: agentify-afk-plan, schema_version: "1.0", status: pending.

Required sections: ## Plan, ## Implementation, ## Verification.

agentify afk create "task..." --slug my-slug
execute

afk run <plan-file>

Implementation: src/core/afk.js:356 · runAfkRun(root, config, args).

Flags: --current-worktree, --allow-dirty, --no-commit, --cleanup <keep|delete|ask>, --provider, --root, --json.

Reads: the plan markdown; validates frontmatter and required sections via validateAfkPlanMarkdown.

Writes: a fresh worktree (unless --current-worktree); auto-commits on completion (unless --no-commit); updates the plan's status field.

agentify afk run plan.md --cleanup ask

What validateAfkPlanMarkdown checks.

From src/core/afk.js:73. The validator throws if any of these are missing or wrong.

frontmatter.type Must equal agentify-afk-plan.
frontmatter.schema_version Must equal "1.0" (constant AFK_PLAN_SCHEMA_VERSION).
## Plan Required H2 section. Author intent, scope, constraints.
## Implementation Required H2 section. Concrete steps the agent will take.
## Verification Required H2 section. How the run is checked when complete.
frontmatter.status Tracked through the run: pendingrunningcomplete / failed.

Run-time guards.

dirty worktree

Both isolated and current-worktree paths call assertCleanWorktree(root, "--allow-dirty"). Pass --allow-dirty to bypass.

protected branch

--current-worktree refuses to auto-commit on the default or a protected branch. Either run from a feature branch or pass --no-commit.

--cleanup

Must be one of keep, delete, or ask. Any other value throws: "afk run --cleanup must be one of: keep, delete, ask".

labels for batch runs

For supervised runs over GitHub issues, use agentify issue-killer with the default agentify-ready label or a custom CSV via --labels.