Aet Work
Published by getatelier in ae-toolkit
What this skill does
Work queue management and sequential task execution. Use when you have plan.md files to run in order, want hands-free task execution, or need to check what's ready. Triggers on "run the queue", "pick next task", "what's next", "what's unblocked", "run all tasks", "keep working", "run tasks", "execute plans", "night shift", "AFK mode", "queue status", "init queue", "what can I work on", "run unblocked tasks".
Add Aet Work to your agent
Review the source and files first. When you are ready, copy the prompt instruction or use the CLI command supported by your environment.
Install with a prompt
Paste this into a compatible coding agent:
add this skill "aet-work" from https://github.com/getatelier/ae-toolkitInstall with the CLI
Run this command in a controlled environment after reviewing the repository:
npx skills add https://github.com/getatelier/ae-toolkit --skill aet-workSkill instructions
aet-work
Queue management for agentic engineering. The single job of this skill is to manage the work queue and orchestrate task execution — not to plan, implement, or review.
When to Use
- You have multiple
docs/plans/*.mdfiles from a PRD breakdown - You want to run tasks sequentially without manual intervention
- You want to check what's blocked, what's unblocked, what's done
- You want the "night shift" AFK loop
Shared Preamble
Before executing any command in this skill, collect the following context:
BRANCH— current git branchREPO_STATE— clean / dirty / merge-conflictAGENTS_MD— presence and last-modified date of AGENTS.mdLEARNINGS— top-3 relevant entries from.agents/learnings.jsonl(if exists)ACTIVE_PLAN— anydocs/plans/*.mdmodified in last 7 daysLAST_PIV— date of last completed plan-implement-validate cycle (from git log if available)ACTIVE_PRD_STAGE— current*Stage:value from the most-recently-modifieddocs/prds/*.mdfooter (if exists)ACTIVE_PLAN_STAGE— current*Stage:value from the most-recently-modifieddocs/plans/*.mdfooter (if exists)
Use this context to ground all recommendations. Do not ask the user to provide it manually.
If a stage is found, print at the start of execution: "📍 Current stage: {stage}."
Prerequisites
This skill invokes AET helper binaries (aet-state, status, init-queue, sync, next, report, orchestrator). They must be on PATH. Run /aet-setup install-binaries (or ~/.agents/skills/aet-setup/bin/install-aet-binaries) once after installing skills. If you are developing in this repo, make install-skills runs it automatically.
Forward-Only State Model
Workflow state is recorded forward by code and trusted on read.
- One writer.
aet-state transitionis the only code path that mutatestasks[].state. It validates legality, atomically applies the change, appends a{from, to, at, by, evidence}history entry, and updates dependents. - Audit off the hot path.
aet-state auditreconciles stored state against git ground truth on demand. It is never invoked bystatus,next,run, or the orchestrator during normal operation. - Live / settled partition.
.agents/work-queue.jsonholds only non-terminal tasks. Terminal tasks (merged,abandoned) are sealed to.agents/work-history.jsonlautomatically and are never loaded for scheduling. - Stage as sub-state. While a task is
in_progress, itsstagefield records the pipeline stage (tdd,implement,qa,review,cso,sync-docs). The plan footer*Stage:*is a human breadcrumb, not a scheduler input.
Commands
Queue Terminal Statuses
The work queue uses the following terminal statuses:
| Status | Meaning | Set by |
|---|---|---|
merged | Code is verified on origin/main | post-ship-verify or mark-terminal |
merge_verified | Legacy alias for merged. Some pipelines historically set this status. Normalized to merged by init-queue and sync. | Orchestrator (legacy) |
done | Deprecated. Pipeline completed but not yet verified on main. Treated as terminal for blocker-resolution purposes. | Orchestrator (legacy) |
abandoned | Task explicitly cancelled with a documented reason | mark-terminal |
failed | Pipeline failed; requires human inspection | Orchestrator |
New tasks should reach merged or abandoned. done and merge_verified are retained for backwards compatibility and normalized to merged during queue sync.
init-queue
Rebuild .agents/work-queue.json from docs/plans/*.md. Use this after a major reorganization or when creating the queue for the first time.
Procedure:
- Scan
docs/plans/for atomic, implementable task plans. Roadmaps, audits, and meta-plans belong indocs/roadmaps/ordocs/audits/and are ignored. - If
.agents/work-queue.jsonexists, load it asexisting_queue. - For each plan.md, extract title, task ID (from filename or frontmatter), and blocking relationships.
- Build the DAG as
blocked_byandblocksarrays. - For each plan:
- If its
plan_fileexists inexisting_queue, preservebranch,worktree,merge_commit,completed_at,merged_at, and terminalstatus. - Normalize legacy status: if an existing task has
status: "merge_verified", rewrite it tostatus: "merged". - If new or non-terminal, set
status: "planned"and clear execution metadata.
- If its
- Set
source_prdto the most recent PRD indocs/prds/(if any). - Set
queue_updated_atto the current ISO-8601 timestamp. - Write
.agents/work-queue.json.
init-queue does not call aet-state audit or promote tasks to ready.
sync
Append-only sync of docs/plans/*.md into the existing queue. Implemented by aet-work/bin/sync. Use this after adding new plan files.
Procedure:
- Read
.agents/work-queue.jsonif it exists; otherwise treat it as empty. - Read
.agents/work-history.jsonland collect settledplan_filepaths and task IDs. - Scan
docs/plans/for all*.mdfiles. - For each plan whose
plan_fileis not already in the queue:- Settled-history deduplication: skip if its
plan_fileor task ID is already settled. - Validate intake contract on candidates only: run fail-closed intake validation (frontmatter, size, atomicity, legacy sections) only on plans that are actually candidates to be added. Already-queued plans are preserved as-is.
- Validate size: skip plans that exceed the complexity limit unless they contain
⚠️ ATOMIC OVERSIZED(setoversized: trueif allowed). - Validate atomicity: skip plans that reference other plan files or contain multiple "Phase" sections.
- Append a new task with
status: "planned".
- Settled-history deduplication: skip if its
- Recompute
blocksfor the entire queue. - Normalize legacy status: rewrite
merge_verifiedtomerged. - Report any queue entry whose
plan_fileis missing as drift; do not mutate the stored status. - Update
queue_updated_atand write.agents/work-queue.json.
sync does not call aet-state audit or promote dependents.
status
Show the current state of the work queue.
Procedure:
Invoke the status helper, which runs a settled-history-aware plan-drift check, reads stored state, and prints the summary:
status \
--queue-file .agents/work-queue.json \
--history-file .agents/work-history.jsonl \
--plans-dir docs/plans
The helper reports:
- Any plan drift (plans on disk that are neither queued nor settled)
- Active task counts:
planned,unblocked,blocked,in-progress,failed,done(counts are a projection of storedstate;failedis read from stored state) - The stored
statefor each active task - The next 3 tasks whose stored state is
ready - Any failed tasks (from stored state)
- Stale worktree warnings
next
Identify and output the next ready task.
Procedure:
- Run the
plan-driftcheck. If drift is detected, refuse to pick a task and instruct the user to runinit-queuefirst - Read
.agents/work-queue.json - Find tasks whose stored
stateisready(falling back to legacystatusduring migration) - Pick the first in topological order (respecting the DAG)
- Output: task ID, title, plan_file path
- Transition to
in_progressviaaet-state transition <task_id> <current_state> in_progress .agents/work-queue.json, then recordbranch: <task_id>andworktree: .worktrees/<task_id>
run
AFK loop with OS-level process isolation and parallel execution. Invokes the centralized aet-work/bin/orchestrator Python script, which spawns fresh agent sessions per pipeline stage. Independent tasks execute simultaneously—each in its own git worktree—up to a configurable concurrency cap. Context leakage between skills is eliminated by session isolation.
Procedure:
-
Plan-drift guard: Run the
plan-driftcheck. If drift is detected, refuse to start the AFK loop and instruct the user to runinit-queuefirst -
Pre-branch git hygiene:
Before spawning the first task, the orchestrator ensures
mainis clean and synchronized withorigin/main. Ifmainis dirty, ahead, or behind, the orchestrator prints actionable warnings and halts before creating any worktrees. In unattended mode, warnings are logged but the loop continues. -
Invoke the unified orchestrator:
Background the orchestrator with shell redirection so the launching shell observes its true exit status; do not pipe through
teewithoutset -o pipefail:orchestrator \ --queue-file .agents/work-queue.json \ --repo-root . \ --cli-bin $(which kimi) \ --isolation standard \ --max-jobs 4 \ > aet-work.log 2>&1 &The orchestrator handles CLI detection, worktree management, parallel execution, and stage advancement automatically. It prints the telemetry archive path when the run finishes.
-
Per-plan pipeline override:
A plan's frontmatter may declare
pipeline: minimal|standard|full. The orchestrator uses this value instead of the--isolationdefault for that task. See.agents/templates/plan-template.md. -
Concurrency cap:
- Default:
4jobs (override withAET_WORK_JOBSenv var), hard cap at 8 - Override: set
AET_WORK_JOBSenvironment variable - The orchestrator never exceeds the cap to prevent resource exhaustion
- Default:
-
Resume behavior:
- Re-running
runresumes from the current queue state - Already-done or in-progress tasks with existing worktrees are skipped automatically
- Re-running
Context isolation mechanism:
Parent agent session (clean)
→ invokes aet-work/bin/orchestrator
→ Orchestrator spawns Stage 1 session (clean context, worktree A)
→ TDD + Implement + QA run in one isolated session
→ Orchestrator spawns Stage 2 session (clean context, worktree A)
→ Review runs with no implementation context
→ Orchestrator spawns Stage 3 session (clean context, worktree A)
→ CSO + Sync-docs run with no review bias
→ … up to concurrency cap for parallel tasks
→ Orchestrator returns
→ Parent session remains clean
Unattended mode: The orchestrator sets AET_EXECUTION_MODE=unattended in the environment of every spawned subagent. Skills that have interactive approval gates (e.g., aet-implement) detect this variable and skip gates that require human input, logging the bypass for auditability. See references/context-isolation.md for details.
run-one
Run the full pipeline on a single plan with session-isolated stages. Replaces the manual multi-skill pipeline workflow.
Procedure:
-
Accept a plan file path:
aet-work run-one docs/plans/FEAT-001-plan.md -
Invoke the orchestrator in single-plan mode:
orchestrator \ --plan-file docs/plans/FEAT-001-plan.md \ --repo-root . \ --cli-bin $(which kimi) \ --isolation standard \ > aet-work-run-one.log 2>&1 & -
The orchestrator advances the plan through all stage groups sequentially.
-
Telemetry is written to
~/.aet/telemetry/{project-slug}/{date}/{run-id}/and the path is printed on completion. -
On completion, the branch is ready for
aet-ship.
Pipeline override: The plan's frontmatter pipeline: minimal|standard|full overrides the --isolation default for this task.
Queue bookkeeping: When the plan file corresponds to a task already tracked in .agents/work-queue.json, run-one records the task's branch and worktree, transitions it to in_progress at the start of the run, and transitions it to awaiting_merge on success. This lets aet-state record-merge resolve the merge commit automatically after the PR ships. If the plan is not in the queue, or if run-one was spawned by run (AET_TASK_ID is set), the queue is left unchanged.
When to use: For one-off plans where you want the full pipeline but don't need a queue.
Worktree dependency warmup
The orchestrator can automatically symlink heavy dependency directories from the main worktree into each new task worktree. This avoids reinstalling dependencies (e.g. node_modules, vendor) on every stage.
Configure it in .agents/aet-work.json:
{
"symlink_dependencies": [
{
"name": "node_modules",
"source": "app/node_modules",
"target": "app/node_modules"
},
{ "name": "vendor", "source": "api/vendor", "target": "api/vendor" }
]
}
sourceis relative to the repository root.targetis relative to the new worktree root.- Missing target parents are created automatically.
- If the source is missing, the orchestrator emits an
environment_issuetelemetry event instead of failing the task.
audit
Reconcile stored state against git ground truth without mutating the queue. audit is a human-run diagnostic; it is never called during normal operation.
Procedure:
- Run
aet-state audit .agents/work-queue.json - For each task, compute the expected status from git ground truth in order:
merged—branchormerge_commitis an ancestor oforigin/mainin-progress— localbranchexistsunblocked—plan_fileexists, no local branch, and every task inblocked_byis terminal (mergedorabandoned)blocked—plan_fileexists, no local branch, and some blocker is not terminaldrift—plan_fileis missing
- Compare stored
stateagainst the expected status for each task - Report any discrepancies (e.g.,
⚠️ Task {id} stored as awaiting_merge but expected in-progress from git) - Return a JSON object showing
stored,expected, anddiscrepancyfor every task
When to use: When you suspect the stored queue state has drifted from git reality (e.g., after manual branch cleanup, a crash, or an external merge). Do not rely on audit during normal operation; status, next, and run read stored state directly.
report
Print an execution telemetry summary from the archive.
Procedure:
- Run
report - The helper scans
~/.aet/telemetry/{project-slug}/and prints:- Total runs
- Tasks spawned, succeeded, and failed
- Total wall-clock time
- Average isolation level observed across stage records
- Use
--since <ISO-8601-timestamp>to restrict the summary to recent runs - Use
--run-dir <path>to summarize a single run - Use
--task-log <path>to summarize a single task
When to use: After one or more orchestrator runs to inspect throughput, failure rate, and resource usage.
plan-drift
Detect plan files that exist on disk but are not represented in the active work queue.
Procedure:
- Read
.agents/work-queue.jsonand collect allplan_filepaths - Read
.agents/work-history.jsonland collect all settledplan_filepaths - List all
docs/plans/*.mdfiles. Only atomic plans in this directory are considered; roadmaps and audits stored elsewhere are ignored. - Identify any plan files whose path is not found in the queue's
plan_fileset and not found in the settled history'splan_fileset - Compare the most recent modification time of any
docs/plans/*.mdagainst thequeue_updated_atfield (or the queue file's mtime as fallback) - Report findings:
- Orphaned plans: print each filename and
⚠️ Plan drift detected: N plan file(s) not in queue. Run init-queue to sync. - Stale queue: if plans are newer than the queue, print
⚠️ Queue is stale (plans modified after last init-queue). Run init-queue to sync. - If none: print
✅ No plan drift detected. All plans are tracked in the queue.
- Orphaned plans: print each filename and
plan-drift checks only the active queue. Settled tasks are ignored; their plan files may still exist on disk but are no longer tracked as active work.
drift-check
Detect tasks marked done or merged whose commits are not on origin/main.
Procedure:
- Read
.agents/work-queue.json - Run
git fetch origin - For each task with status
done,merged, ormerge_verified: a. Ifmerge_commitis set andgit merge-base --is-ancestor <merge_commit> origin/mainpasses, skip (verified) b. Ifbranchis set, rungit merge-base --is-ancestor <branch> origin/main. If it fails, record as drifted c. If neithermerge_commitnorbranchis available, record as unverifiable - Report findings:
- Drifted tasks: print task ID, title, and branch name
- Unverifiable tasks: print task ID and note missing metadata
- If none: print
✅ No drift detected. All done/merged tasks are on origin/main.
mark-terminal
Mark a task as merged or abandoned. This is the only supported way to set a terminal status manually. Uses the centralized aet-state helper for legality validation and atomic updates.
Procedure:
- Read
.agents/work-queue.jsonto determine the task's current status - Find the task by ID
- If the requested status is
merge_verified:- STOP and print:
⛔ merge_verified is a legacy status. Use merged instead.
- STOP and print:
- If setting to
merged:- Run
aet-state validate <task_id> <current_status> merged .agents/work-queue.json - If validation fails, STOP and print the error message
- If validation passes, run
aet-state transition <task_id> <current_status> merged .agents/work-queue.json
- Run
- If setting to
abandoned:- Require a
reasonargument (non-empty string) - Run
aet-state transition <task_id> <current_status> abandoned .agents/work-queue.json --reason="<reason>" - Print:
⚠️ Task {id} marked abandoned. Reason: {reason}
- Require a
Rules:
- Never mark a task
mergedwithout verifying its merge_commit is on origin/main - Never mark a task
donemanually; usemerged(if on main) orabandoned(if cancelled) - Never mark a task
merge_verified; it is normalized automatically tomerged - Always use
aet-state transitioninstead of direct JSON mutation
cleanup
Seal terminal tasks and remove their worktrees atomically. Repairs stale queue entries.
Procedure:
-
Run
aet-state audit .agents/work-queue.jsonto reconcile stored state against git for active (non-terminal) tasks only. -
Read
.agents/work-queue.json -
Identify terminal tasks: status is
merged,done, orabandoned. Normalize anymerge_verifiedstatuses tomerged. -
Seal any legacy terminal tasks still present in the live queue:
aet-state archive .agents/work-queue.jsonTerminal transitions now seal tasks to
.agents/work-history.jsonlautomatically. The deprecatedarchivecommand remains as a migration helper that seals any remaining terminal tasks and reports what it did. -
Atomicity: If sealing fails, STOP. Do not remove any worktrees. Investigate the failure and re-run
cleanup. -
Remove worktrees for archived tasks:
git worktree remove .worktrees/<task-id> # If it refuses due to uncommitted changes, inspect first: # git -C .worktrees/<task-id> status # Then force-remove if safe: git worktree remove --force .worktrees/<task-id> -
Stale worktree repair (universal): For each remaining task with a
worktreefield, regardless of status:- If the directory does not exist, clear
worktree: nullviaaet-state transition(or direct JSON update if the task status is unchanged) and printRepaired stale worktree field for {task_id} - If the directory exists but has 0 commits ahead of main (
git rev-list --count main..HEADin the worktree returns 0), remove the worktree and clearworktree: null
- If the directory does not exist, clear
-
Report archived, removed, repaired, and remaining worktrees
For the full one-time upgrade procedure for older projects that predate the forward-only state model, see references/upgrading-existing-project.md.
Key Principles
- Queue-unaware pipeline — individual skills (aet-tdd, aet-implement, aet-qa, etc.) know nothing about the queue. The orchestrator checks results and updates the queue.
- OS-process isolation —
runinvokes the unified orchestrator, which spawns fresh OS processes for each pipeline stage. Seereferences/context-isolation.mdfor details. - Agent-agnostic — uses only git commands and generic session language; no tool-specific APIs.
- Queue file is the memory —
.agents/work-queue.jsonpersists state across process boundaries by design. - Stored state, explicit audit —
status,next, andrunread the recordedstatefield directly.aet-state auditreconciles stored state against git for human review, but never runs during normal operation. - Live / settled partition — the live queue holds only non-terminal tasks; terminal tasks are sealed to
.agents/work-history.jsonlautomatically. - Stage as sub-state — pipeline progress is recorded in the task record's
stagefield whilestate == in_progress, not inferred from plan footers. - Execution telemetry — the orchestrator writes per-task JSONL logs directly to
~/.aet/telemetry/{project-slug}/{date}/{run-id}/. Useaet-work reportto summarize them. - Worktree isolation — each task gets its own branch; branches persist for independent review and PR.
- Drain on failure — running tasks finish, new spawns halt. Preserves in-progress work while stopping the pipeline.
Files included
- bin/aet-state
- bin/init-queue
- bin/next
- bin/orchestrator
- bin/report
- bin/status
- bin/sync
- examples/README.md
- lib/__init__.py
- lib/cli_adapter.py
- lib/pipeline.py
- lib/plan_parser.py
- lib/queue.py
- lib/telemetry.py
- lib/verifier.py
- lib/worktree.py
- references/context-isolation.md
- references/migration-aet-state.md
- references/parallel-execution.md
- references/telemetry-log-schema.md
- references/upgrading-existing-project.md
- SKILL.md

