Async Agent Skill
Use this skill to drive the local async-agent-backend bundle that ships with this repository.
Before running commands
- Use the packaged binary at
./assets/async-agent-backend relative to this SKILL.md.
- If the packaged binary is missing or not executable on the current machine, rebuild from
../async-agent-backend/ relative to this SKILL.md.
- This file is intended to be self-contained for normal binary usage. Do not assume a second doc will be consulted first.
- If a request depends on exact backend-supported flags, verify against
../async-agent-backend/internal/app/app.go and ../async-agent-backend/internal/task/task.go instead of guessing.
Common commands
后台提交:
./assets/async-agent-backend submit --provider <claude|codex|gemini> --task "<prompt>" --working-dir <dir>
同步执行:
./assets/async-agent-backend run --provider <claude|codex|gemini> --task "<prompt>"
查询状态:
./assets/async-agent-backend status <task-id>
./assets/async-agent-backend status --result-mode normalized <task-id>
等待任务结束:
./assets/async-agent-backend wait <task-id>
./assets/async-agent-backend wait --timeout-seconds 60 --result-mode normalized <task-id>
跟随日志:
./assets/async-agent-backend logs <task-id>
./assets/async-agent-backend logs --follow <task-id>
./assets/async-agent-backend logs --follow --event-mode normalized <task-id>
取消任务:
./assets/async-agent-backend cancel <task-id>
启动 MCP:
./assets/async-agent-backend mcp
Command model
submit and run share the same execution flag surface.
status, wait, logs, cancel, and mcp operate on persisted task state under the task store.
- Prefer
--result-mode normalized when the caller only wants the backend's unified result envelope.
- Prefer
logs --follow --event-mode normalized when the caller wants structured stream events instead of raw stdout/stderr chunks.
Execution flags for submit and run
所有 provider 通用:
--provider <claude|codex|gemini>
--task <text>
--working-dir <dir>
--model <name>
--output-format <format>
--result-mode <normalized>
--subcommand <name>
--store-root <dir>
--timeout-seconds <n>
--arg <value> repeatable passthrough flag for provider-native args not modeled as first-class backend fields
通用 repeatable flags:
--add-dir <dir> additional provider-accessible directory
--allowed-tool <name> allowed provider tool
Claude-mapped flags:
--skip-permissions <bool>
--json-schema <json>
--continue
--resume <session>
--max-turns <n>
--disallowed-tool <name> repeatable
--tools-mode <mode>
--permission-mode <mode>
--max-budget-usd <amount>
--permission-prompt-tool <tool>
Codex-mapped flags:
--approval-mode <mode>
--sandbox-mode <read-only|workspace-write|danger-full-access>
--ephemeral
--search
--resume-last
--resume-all
--full-auto
--image <path> repeatable
--profile <name>
--config-override <key=value> repeatable
--output-last-message <path>
--output-schema <path>
Gemini-mapped flags:
--approval-mode <mode>
--sandbox
--include-directory <dir> repeatable
--allowed-mcp-server-name <name> repeatable
--extension <name> repeatable
--debug
--experimental-acp
--screen-reader
--list-sessions
--delete-session <session>
Provider cheat sheet inside this skill
This section embeds the headless parameter knowledge needed to decide how to call the packaged binary. The binary itself exposes a normalized flag surface; when the user asks for a provider-native capability that is not first-class yet, use --arg.
Claude Code
headless upstream entry:
claude -p "your prompt"
claude --print "your prompt"
backend invocation shape:
./assets/async-agent-backend run \
--provider claude \
--task "<prompt>"
backend behavior:
- always calls Claude in
--print mode
- defaults Claude
output_format to stream-json if you do not pass --output-format
- automatically adds
--verbose when --output-format stream-json
- defaults to
--dangerously-skip-permissions unless --skip-permissions false
most useful Claude headless flags:
--output-format text|json|stream-json
--input-format text|stream-json
--include-partial-messages
--json-schema <schema>
--verbose
-c, --continue
-r, --resume <session>
--fork-session
--session-id <uuid>
--no-session-persistence
--allowedTools
--disallowedTools
--tools
--permission-mode <mode>
--permission-prompt-tool <mcp_tool>
--dangerously-skip-permissions
--allow-dangerously-skip-permissions
--max-turns <n>
--max-budget-usd <amount>
--fallback-model <model>
--model <alias|full-name>
--add-dir <dir...>
--mcp-config <json-file-or-json>
--strict-mcp-config
--plugin-dir <dir>
--system-prompt
--system-prompt-file
--append-system-prompt
--append-system-prompt-file
backend first-class mappings for Claude:
- use
--output-format, --model, --json-schema, --continue, --resume, --max-turns, --add-dir, --allowed-tool, --disallowed-tool, --tools-mode, --permission-mode, --max-budget-usd, --permission-prompt-tool
- use
--skip-permissions false only when you explicitly do not want the default skip-permissions behavior
- use
--arg for currently unmapped Claude-native flags like --system-prompt, --append-system-prompt, --mcp-config, --strict-mcp-config
examples:
./assets/async-agent-backend run \
--provider claude \
--task "Extract APIs" \
--output-format json \
--json-schema '{"type":"object"}' \
--result-mode normalized
./assets/async-agent-backend run \
--provider claude \
--task "Use this custom system prompt" \
--arg --system-prompt \
--arg "You are a strict API extractor."
Codex CLI
headless upstream entry:
codex exec "your prompt"
backend invocation shape:
./assets/async-agent-backend run \
--provider codex \
--task "<prompt>"
backend behavior:
- defaults
subcommand to exec
- if
--subcommand resume is used, backend builds codex exec resume
- appends
--skip-git-repo-check automatically unless already present in --arg
- passes
--working-dir through as codex -C <dir>
most useful Codex headless flags:
--add-dir <path>
--ask-for-approval, -a untrusted|on-request|never
--cd, -C <path>
--config, -c key=value
--dangerously-bypass-approvals-and-sandbox
--disable <feature>
--enable <feature>
--full-auto
--image, -i <path[,path...]>
--model, -m <string>
--oss
--profile, -p <string>
--sandbox, -s read-only|workspace-write|danger-full-access
--search
--color always|never|auto
--ephemeral
--json
--output-last-message, -o <path>
--output-schema <path>
--skip-git-repo-check
PROMPT <string | ->
codex exec resume [SESSION_ID]
--last
--all
backend first-class mappings for Codex:
- use
--subcommand, --sandbox-mode, --approval-mode, --search, --full-auto, --ephemeral, --resume-last, --resume-all, --add-dir, --image, --profile, --config-override, --output-last-message, --output-schema
- use
--resume <session> together with --subcommand resume when the user wants a specific resumable session id
- use
--arg for currently unmapped Codex-native flags like --json, --oss, --color, --enable, --disable, --dangerously-bypass-approvals-and-sandbox
examples:
./assets/async-agent-backend run \
--provider codex \
--task "Review this diff" \
--full-auto \
--sandbox-mode workspace-write \
--approval-mode never \
--arg=--json \
--result-mode normalized
./assets/async-agent-backend run \
--provider codex \
--subcommand resume \
--resume "<session-id>"
Gemini CLI
headless upstream entry:
gemini -p "your prompt"
gemini --prompt "your prompt"
backend invocation shape:
./assets/async-agent-backend run \
--provider gemini \
--task "<prompt>"
backend behavior:
- appends
--prompt <task> when --task is present
- supports session-management commands through
--list-sessions and --delete-session
--sandbox is a boolean switch in backend, not a string enum
most useful Gemini headless flags:
--prompt, -p <string>
--output-format, -o text|json|stream-json
--model, -m <string>
--sandbox, -s <boolean>
--approval-mode <default|auto_edit|yolo>
--yolo, -y deprecated, use --approval-mode yolo
--allowed-mcp-server-names <array>
--allowed-tools <array> deprecated
--extensions, -e <array>
--include-directories <array>
--resume, -r <session>
--debug, -d
--prompt-interactive, -i
--experimental-acp
--experimental-zed-integration
--list-extensions
--list-sessions
--delete-session
--screen-reader
backend first-class mappings for Gemini:
- use
--output-format, --model, --approval-mode, --sandbox, --resume, --include-directory, --allowed-mcp-server-name, --extension, --debug, --experimental-acp, --screen-reader, --list-sessions, --delete-session
- use
--arg for currently unmapped Gemini-native flags like --list-extensions, --prompt-interactive, --experimental-zed-integration
examples:
./assets/async-agent-backend run \
--provider gemini \
--task "Summarize these logs" \
--output-format stream-json \
--approval-mode yolo \
--result-mode normalized
./assets/async-agent-backend run \
--provider gemini \
--list-sessions
Task-state flags
status:
status [--store-root <dir>] [--result-mode normalized] <task-id>
wait:
wait [--store-root <dir>] [--timeout-seconds <n>] [--result-mode normalized] <task-id>
logs:
logs [--store-root <dir>] <task-id>
logs [--store-root <dir>] --follow [--poll-ms <n>] [--event-mode raw|normalized] <task-id>
cancel:
cancel [--store-root <dir>] <task-id>
mcp:
Parameter selection rules
- Use backend first-class flags whenever they exist; this keeps requests portable across providers and preserves normalized results.
- If the user asks for a provider-native capability that is not modeled as a backend field yet, use the provider cheat sheet in this file and pass the native flag through
--arg.
- Do not invent flag names from memory. Resolve them from this skill first, then verify against backend parser code when the request is exacting or unusual.
- When the request is about structured results, explicitly choose both provider output mode and backend result mode:
- Example: Claude JSON result usually needs
--output-format json or stream-json
- Example: backend-trimmed return payload needs
--result-mode normalized
- When the request is about streaming, prefer
logs --follow --event-mode normalized unless the caller explicitly wants raw stdout/stderr.
Notes
submit/status/wait/logs/cancel operate on persisted task state, not in-memory handles.
- Prefer
--event-mode normalized when the caller wants structured stream events.
- Provider overrides are available through
ASYNC_AGENT_CLAUDE_BIN, ASYNC_AGENT_CODEX_BIN, ASYNC_AGENT_GEMINI_BIN, and ASYNC_AGENT_TASK_DIR.
- The backend automatically strips
CLAUDECODE from child processes, so Claude provider works correctly even when invoked from within a Claude Code session.
- The backend help text is intentionally short; the full supported execution flag surface lives in
internal/app/app.go.
- This skill intentionally embeds the provider headless cheat sheet so the binary can be used from
SKILL.md alone.
1---2name: async-agent-skill3description: Uses the packaged async-agent-backend binary to run Claude, Codex, or Gemini tasks asynchronously or synchronously from this repository. Use whenever the user asks to submit background agent jobs, run headless provider tasks, wait for completion, stream logs, cancel tasks, or expose the local backend over MCP.4---56# Async Agent Skill78Use this skill to drive the local `async-agent-backend` bundle that ships with this repository.910## Before running commands11121. Use the packaged binary at `./assets/async-agent-backend` relative to this `SKILL.md`.132. If the packaged binary is missing or not executable on the current machine, rebuild from `../async-agent-backend/` relative to this `SKILL.md`.143. This file is intended to be self-contained for normal binary usage. Do not assume a second doc will be consulted first.154. If a request depends on exact backend-supported flags, verify against `../async-agent-backend/internal/app/app.go` and `../async-agent-backend/internal/task/task.go` instead of guessing.1617## Common commands1819后台提交:2021```bash22./assets/async-agent-backend submit --provider <claude|codex|gemini> --task "<prompt>" --working-dir <dir>23```2425同步执行:2627```bash28./assets/async-agent-backend run --provider <claude|codex|gemini> --task "<prompt>"29```3031查询状态:3233```bash34./assets/async-agent-backend status <task-id>35./assets/async-agent-backend status --result-mode normalized <task-id>36```3738等待任务结束:3940```bash41./assets/async-agent-backend wait <task-id>42./assets/async-agent-backend wait --timeout-seconds 60 --result-mode normalized <task-id>43```4445跟随日志:4647```bash48./assets/async-agent-backend logs <task-id>49./assets/async-agent-backend logs --follow <task-id>50./assets/async-agent-backend logs --follow --event-mode normalized <task-id>51```5253取消任务:5455```bash56./assets/async-agent-backend cancel <task-id>57```5859启动 MCP:6061```bash62./assets/async-agent-backend mcp63```6465## Command model6667- `submit` and `run` share the same execution flag surface.68- `status`, `wait`, `logs`, `cancel`, and `mcp` operate on persisted task state under the task store.69- Prefer `--result-mode normalized` when the caller only wants the backend's unified result envelope.70- Prefer `logs --follow --event-mode normalized` when the caller wants structured stream events instead of raw stdout/stderr chunks.7172## Execution flags for `submit` and `run`7374所有 provider 通用:7576- `--provider <claude|codex|gemini>`77- `--task <text>`78- `--working-dir <dir>`79- `--model <name>`80- `--output-format <format>`81- `--result-mode <normalized>`82- `--subcommand <name>`83- `--store-root <dir>`84- `--timeout-seconds <n>`85- `--arg <value>` repeatable passthrough flag for provider-native args not modeled as first-class backend fields8687通用 repeatable flags:8889- `--add-dir <dir>` additional provider-accessible directory90- `--allowed-tool <name>` allowed provider tool9192Claude-mapped flags:9394- `--skip-permissions <bool>`95- `--json-schema <json>`96- `--continue`97- `--resume <session>`98- `--max-turns <n>`99- `--disallowed-tool <name>` repeatable100- `--tools-mode <mode>`101- `--permission-mode <mode>`102- `--max-budget-usd <amount>`103- `--permission-prompt-tool <tool>`104105Codex-mapped flags:106107- `--approval-mode <mode>`108- `--sandbox-mode <read-only|workspace-write|danger-full-access>`109- `--ephemeral`110- `--search`111- `--resume-last`112- `--resume-all`113- `--full-auto`114- `--image <path>` repeatable115- `--profile <name>`116- `--config-override <key=value>` repeatable117- `--output-last-message <path>`118- `--output-schema <path>`119120Gemini-mapped flags:121122- `--approval-mode <mode>`123- `--sandbox`124- `--include-directory <dir>` repeatable125- `--allowed-mcp-server-name <name>` repeatable126- `--extension <name>` repeatable127- `--debug`128- `--experimental-acp`129- `--screen-reader`130- `--list-sessions`131- `--delete-session <session>`132133## Provider cheat sheet inside this skill134135This section embeds the headless parameter knowledge needed to decide how to call the packaged binary. The binary itself exposes a normalized flag surface; when the user asks for a provider-native capability that is not first-class yet, use `--arg`.136137### Claude Code138139headless upstream entry:140141```bash142claude -p "your prompt"143claude --print "your prompt"144```145146backend invocation shape:147148```bash149./assets/async-agent-backend run \150 --provider claude \151 --task "<prompt>"152```153154backend behavior:155156- always calls Claude in `--print` mode157- defaults Claude `output_format` to `stream-json` if you do not pass `--output-format`158- automatically adds `--verbose` when `--output-format stream-json`159- defaults to `--dangerously-skip-permissions` unless `--skip-permissions false`160161most useful Claude headless flags:162163- `--output-format text|json|stream-json`164- `--input-format text|stream-json`165- `--include-partial-messages`166- `--json-schema <schema>`167- `--verbose`168- `-c, --continue`169- `-r, --resume <session>`170- `--fork-session`171- `--session-id <uuid>`172- `--no-session-persistence`173- `--allowedTools`174- `--disallowedTools`175- `--tools`176- `--permission-mode <mode>`177- `--permission-prompt-tool <mcp_tool>`178- `--dangerously-skip-permissions`179- `--allow-dangerously-skip-permissions`180- `--max-turns <n>`181- `--max-budget-usd <amount>`182- `--fallback-model <model>`183- `--model <alias|full-name>`184- `--add-dir <dir...>`185- `--mcp-config <json-file-or-json>`186- `--strict-mcp-config`187- `--plugin-dir <dir>`188- `--system-prompt`189- `--system-prompt-file`190- `--append-system-prompt`191- `--append-system-prompt-file`192193backend first-class mappings for Claude:194195- use `--output-format`, `--model`, `--json-schema`, `--continue`, `--resume`, `--max-turns`, `--add-dir`, `--allowed-tool`, `--disallowed-tool`, `--tools-mode`, `--permission-mode`, `--max-budget-usd`, `--permission-prompt-tool`196- use `--skip-permissions false` only when you explicitly do not want the default skip-permissions behavior197- use `--arg` for currently unmapped Claude-native flags like `--system-prompt`, `--append-system-prompt`, `--mcp-config`, `--strict-mcp-config`198199examples:200201```bash202./assets/async-agent-backend run \203 --provider claude \204 --task "Extract APIs" \205 --output-format json \206 --json-schema '{"type":"object"}' \207 --result-mode normalized208```209210```bash211./assets/async-agent-backend run \212 --provider claude \213 --task "Use this custom system prompt" \214 --arg --system-prompt \215 --arg "You are a strict API extractor."216```217218### Codex CLI219220headless upstream entry:221222```bash223codex exec "your prompt"224```225226backend invocation shape:227228```bash229./assets/async-agent-backend run \230 --provider codex \231 --task "<prompt>"232```233234backend behavior:235236- defaults `subcommand` to `exec`237- if `--subcommand resume` is used, backend builds `codex exec resume`238- appends `--skip-git-repo-check` automatically unless already present in `--arg`239- passes `--working-dir` through as `codex -C <dir>`240241most useful Codex headless flags:242243- `--add-dir <path>`244- `--ask-for-approval, -a untrusted|on-request|never`245- `--cd, -C <path>`246- `--config, -c key=value`247- `--dangerously-bypass-approvals-and-sandbox`248- `--disable <feature>`249- `--enable <feature>`250- `--full-auto`251- `--image, -i <path[,path...]>`252- `--model, -m <string>`253- `--oss`254- `--profile, -p <string>`255- `--sandbox, -s read-only|workspace-write|danger-full-access`256- `--search`257- `--color always|never|auto`258- `--ephemeral`259- `--json`260- `--output-last-message, -o <path>`261- `--output-schema <path>`262- `--skip-git-repo-check`263- `PROMPT <string | ->`264- `codex exec resume [SESSION_ID]`265- `--last`266- `--all`267268backend first-class mappings for Codex:269270- use `--subcommand`, `--sandbox-mode`, `--approval-mode`, `--search`, `--full-auto`, `--ephemeral`, `--resume-last`, `--resume-all`, `--add-dir`, `--image`, `--profile`, `--config-override`, `--output-last-message`, `--output-schema`271- use `--resume <session>` together with `--subcommand resume` when the user wants a specific resumable session id272- use `--arg` for currently unmapped Codex-native flags like `--json`, `--oss`, `--color`, `--enable`, `--disable`, `--dangerously-bypass-approvals-and-sandbox`273274examples:275276```bash277./assets/async-agent-backend run \278 --provider codex \279 --task "Review this diff" \280 --full-auto \281 --sandbox-mode workspace-write \282 --approval-mode never \283 --arg=--json \284 --result-mode normalized285```286287```bash288./assets/async-agent-backend run \289 --provider codex \290 --subcommand resume \291 --resume "<session-id>"292```293294### Gemini CLI295296headless upstream entry:297298```bash299gemini -p "your prompt"300gemini --prompt "your prompt"301```302303backend invocation shape:304305```bash306./assets/async-agent-backend run \307 --provider gemini \308 --task "<prompt>"309```310311backend behavior:312313- appends `--prompt <task>` when `--task` is present314- supports session-management commands through `--list-sessions` and `--delete-session`315- `--sandbox` is a boolean switch in backend, not a string enum316317most useful Gemini headless flags:318319- `--prompt, -p <string>`320- `--output-format, -o text|json|stream-json`321- `--model, -m <string>`322- `--sandbox, -s <boolean>`323- `--approval-mode <default|auto_edit|yolo>`324- `--yolo, -y` deprecated, use `--approval-mode yolo`325- `--allowed-mcp-server-names <array>`326- `--allowed-tools <array>` deprecated327- `--extensions, -e <array>`328- `--include-directories <array>`329- `--resume, -r <session>`330- `--debug, -d`331- `--prompt-interactive, -i`332- `--experimental-acp`333- `--experimental-zed-integration`334- `--list-extensions`335- `--list-sessions`336- `--delete-session`337- `--screen-reader`338339backend first-class mappings for Gemini:340341- use `--output-format`, `--model`, `--approval-mode`, `--sandbox`, `--resume`, `--include-directory`, `--allowed-mcp-server-name`, `--extension`, `--debug`, `--experimental-acp`, `--screen-reader`, `--list-sessions`, `--delete-session`342- use `--arg` for currently unmapped Gemini-native flags like `--list-extensions`, `--prompt-interactive`, `--experimental-zed-integration`343344examples:345346```bash347./assets/async-agent-backend run \348 --provider gemini \349 --task "Summarize these logs" \350 --output-format stream-json \351 --approval-mode yolo \352 --result-mode normalized353```354355```bash356./assets/async-agent-backend run \357 --provider gemini \358 --list-sessions359```360361## Task-state flags362363`status`:364365- `status [--store-root <dir>] [--result-mode normalized] <task-id>`366367`wait`:368369- `wait [--store-root <dir>] [--timeout-seconds <n>] [--result-mode normalized] <task-id>`370371`logs`:372373- `logs [--store-root <dir>] <task-id>`374- `logs [--store-root <dir>] --follow [--poll-ms <n>] [--event-mode raw|normalized] <task-id>`375376`cancel`:377378- `cancel [--store-root <dir>] <task-id>`379380`mcp`:381382- `mcp [--store-root <dir>]`383384## Parameter selection rules3853861. Use backend first-class flags whenever they exist; this keeps requests portable across providers and preserves normalized results.3872. If the user asks for a provider-native capability that is not modeled as a backend field yet, use the provider cheat sheet in this file and pass the native flag through `--arg`.3883. Do not invent flag names from memory. Resolve them from this skill first, then verify against backend parser code when the request is exacting or unusual.3894. When the request is about structured results, explicitly choose both provider output mode and backend result mode:390 - Example: Claude JSON result usually needs `--output-format json` or `stream-json`391 - Example: backend-trimmed return payload needs `--result-mode normalized`3925. When the request is about streaming, prefer `logs --follow --event-mode normalized` unless the caller explicitly wants raw stdout/stderr.393394## Notes395396- `submit/status/wait/logs/cancel` operate on persisted task state, not in-memory handles.397- Prefer `--event-mode normalized` when the caller wants structured stream events.398- Provider overrides are available through `ASYNC_AGENT_CLAUDE_BIN`, `ASYNC_AGENT_CODEX_BIN`, `ASYNC_AGENT_GEMINI_BIN`, and `ASYNC_AGENT_TASK_DIR`.399- The backend automatically strips `CLAUDECODE` from child processes, so Claude provider works correctly even when invoked from within a Claude Code session.400- The backend help text is intentionally short; the full supported execution flag surface lives in `internal/app/app.go`.401- This skill intentionally embeds the provider headless cheat sheet so the binary can be used from `SKILL.md` alone.