YAACLI CLI
TUI reference implementation for ya-agent-sdk.
Usage
Run with uvx:
uvx --from 'yaacli[rs]' yaacli
Install with uv:
uv tool install 'yaacli[rs]'
yaacli
Install a trusted capability plugin into the same isolated tool environment with
--with:
uv tool install 'yaacli[rs]' --with acme-agent-plugin
[rs] installs the native Rust filesystem search binding. The equivalent extra-dependency form is:
uv tool install yaacli --with ya-ripgrep-core
ya-ripgrep-core is a library dependency, so --with is the matching uv form; --with-executables-from applies to companion packages that also expose CLI executables.
Update with uv:
uv tool upgrade yaacli
Model Price Updates
YAACLI calls pydantic_ai.prices.update_in_background() once when the TUI application
enters, keeps the handle across turns, sessions, and subagent runs, and stops it when
the application exits. Both the direct TUI entrypoint and fast-start execution child
use this boundary; the fast-start terminal parent does not start an updater. Headless
execution owns a handle for the entire invocation, including internal continuations.
The upstream worker downloads immediately and then hourly, without blocking startup.
Failed downloads retain existing prices, and early responses may still be unpriced.
Price updates do not recalculate recorded usage snapshots. Sharing is per process;
a new CLI process downloads again. No per-turn SDK runtime starts a price updater.
For your own SDK application, retain an upstream updater at startup and call stop()
at shutdown, or wrap the application in with prices.update_in_background():. See
the SDK guide.
Subagent Configuration
YAACLI accepts both generic Markdown definitions and native versioned SubagentSpec
YAML/JSON documents under ~/.yaacli/subagents/. In the interactive TUI, the visible
delegate tool is processor-hosted and fully asynchronous: it immediately returns a
bounded structured result with a readable <subagent-name>-<4hex> execution_id.
Foreground and background use the same handle format; mode is explicit result data. Use
resume_subagent(execution_id, prompt) for linked continuation, and use the returned
execution ID for wait, steering, and cancellation. The one-shot headless frontend fixes
the same processor-hosted tool to foreground mode and returns the same result shape with
a bounded output page before shutdown.
---
name: code-reviewer
description: Review a bounded change and report evidence-based findings.
instruction: Use this agent after meaningful implementation or refactoring.
model: inherit
model_settings: inherit
model_cfg: inherit
tools: [glob, grep, ls, view]
---
You are a senior code reviewer. Prioritize architecture, correctness, security, and
critical-path behavior.
Markdown is normalized into the current portable SubagentSpec; it does not activate a
legacy runtime. The frontmatter description plus optional instruction form the
parent-facing delegation roster entry; the Markdown body becomes the child's native
instructions. Omitted or inherit model fields use the active root model, settings, and
context configuration. YAACLI materializes its current standard child capability
template for the common inherited-tool behavior, then turns any tool list into a final
visibility allowlist. It does not copy live parent, MCP, plugin, delegation, or
main-agent-only capabilities.
A same-basename Markdown file is the complete authoritative definition. Any native
preset copied by an earlier upgrade is ignored rather than merged, so a stale capability
snapshot cannot override the current standard child template. Other duplicate routes
remain errors. New setup runs do not copy code-reviewer.yaml when
code-reviewer.md already exists. Use native YAML/JSON by itself when exact capability
grants, plugin types, nesting, or full delegation policy are required. See
spec/02-configuration.md for both schemas.
Capability Plugins
YAACLI optionally loads the SDK's strict plugin manifest from the fixed global path
~/.yaacli/plugins.toml:
schema_version = 1
entry_points = ["acme.search"]
[[capabilities]]
name = "acme.search"
arguments = { result_limit = 10 }
Package installation and authorization are separate. The distribution must be installed
in YAACLI's own Python environment; entry_points then selects the exact installed
types YAACLI may import, and capabilities grants ordered instances to the main root
agent. YAACLI never scans or loads every installed entry point.
The file is global-only because selected Python code executes with YAACLI process
authority. A project .yaacli/plugins.toml is ignored. A missing global file means no
external plugins; invalid TOML, unknown fields, missing or duplicate entry points,
import failures, grant argument signature mismatches, and catalog collisions stop
startup. Manifest arguments are durable non-secret configuration, so secret-like keys
such as API keys, tokens, passwords, or credentials are rejected recursively. This
name-based guard cannot detect a secret stored under a neutral key; keep every secret
value outside the manifest.
Selected types are available to native subagent documents, but root grants do not
implicitly enter named children or self forks. A child must declare the selected
serialization name in its own agent.capabilities. TUI and headless startup each load
one catalog snapshot and reuse it for current, historical, child, and restored runtime
construction. Restart YAACLI after changing the manifest or installed distribution.
See the SDK file configuration contract
and the installable example.
Install with pip:
pip install 'yaacli[rs]'
yaacli
Run as a module:
python -m yaacli
Headless and Saved Sessions
Run one prompt without the TUI:
yaacli -p "Fix the failing tests"
yaacli -p "Continue" --session <session-id> --profile <profile-id>
yaacli -p "Run an isolated worker task" --worker
Headless stdout is an NDJSON event stream. Human-readable diagnostics, fatal details, and resume hints are written to stderr so scripts can parse every stdout line as JSON. Every successful, failed, or cancelled logical run commits a terminal durable revision. --worker requires --prompt and disables delegate subagents for that run. --profile applies only to the current invocation; selecting a profile through /model persists it for future launches.
Inspect or delete durable sessions without starting the TUI:
yaacli sessions list
yaacli sessions show <session-id>
yaacli sessions delete <session-id>
yaacli sessions maintain
Session IDs may be supplied by unique prefix. The YAACLI 2 product store defaults to
~/.yaacli/sessions/sessions-v2.sqlite3. SQLite contains only transactional metadata
and small coordination records; grep-friendly revision, checkpoint, and child payloads
live beside it under <session-id>/{revisions,checkpoints,subagents}/<id>/state.json.
Schema-v5 and other incompatible databases are rejected without runtime migration,
reset, or modification. The former sessions.sqlite3 is left untouched. An explicit
[session] database_path or YAACLI_DATABASE_PATH remains authoritative, with state
directories placed next to that database. Run yaacli sessions maintain explicitly,
while no other YAACLI process is using that store, to apply retention and storage
maintenance; it is never part of startup. [session] max_turns_per_session,
max_sessions, and the optional
max_session_age_days define its retention limits. Nonterminal main and child work is
never selected for automatic deletion. See
spec/05-session-persistence.md.
TUI Interaction
On a configured POSIX TTY, YAACLI immediately renders the canonical editable TUI layout while a cold child process initializes the agent runtime and durable session host. When the child is ready, terminal ownership transfers without leaving and re-entering the alternate screen. Draft text, cursor and selection, send/edit mode, mouse mode, and a locally queued Enter are preserved. A queued prompt is submitted only through the runtime TUI's ordinary durable acceptance path; startup never displays a false acknowledgement or moves initialization cost to the first request. First-time setup, worktree creation, unsupported terminals, non-TTY use, and headless mode retain direct startup.
The output viewport has priority over auxiliary UI. The task pane is hidden when empty, uses one summary row by default, and expands with F2. The model selector is an overlay and does not permanently consume output rows.
- Enter submits while idle and sends guidance to the active run while an agent is running.
- Ordinary text submitted during an active agent run is durable steering. YAACLI persists the original text before displaying a replayable
Guidance sent to the active run. receipt and waking the owning local execution task. The native enqueue boundary applies the established model-facing steering reminder envelope rather than treating the text as a new ordinary prompt; native application later displays a distinct replayable Guidance injected projection. Adjacent guidance applied at one graph boundary is grouped into one visible block while retaining distinct durable events, and restored application blocks remain beside their acceptance receipts rather than moving to the bottom. This uses native Pydantic AI enqueue and does not restore MessageBus. Main-run input admission has no ingress or session lock: graph-boundary snapshots, input writes, and terminal commits use SQLite transaction order with last-write-wins semantics. A terminal-winning input is persisted as rejected without raising, is not acknowledged as sent, and leaves the compose draft intact. The status bar counts accepted/enqueued inputs without exposing their content. Registered slash commands and !shell remain local control syntax: safe busy commands execute and idle-only commands are rejected without clearing the draft. Other slash-prefixed text, including absolute paths such as /home/user/file, remains ordinary user input.
/cancel or Ctrl+C requests cancellation of cancellable foreground work, including pending approval and structured-question waits. Cancellation preserves already visible tool calls, including when it lands between a native segment and checkpoint publication. Once the TUI enters SAVING, persistence is allowed to finish and cannot be cancelled; Ctrl+C does not exit while the save is in progress.
/clear clears only the visible transcript; /new starts a fresh conversation and session. Tombstoning refuses nonterminal main work, closes child input, atomically records nonterminal children as cancelled, and persists cancellation intent; late child success, steering, and completion delivery are fenced while the runtime environment remains reusable.
- Background results never modify or clear the compose area. A terminal background subagent is projected as session-scoped readiness only; its committed result enters the canonical parent continuation path on the next accepting agent turn and does not automatically wake the model. Monitored-shell notifications are persisted as feature input and may start one idle turn according to shell-monitor policy. There is no
/integrate command or MessageBus delivery path.
/agents shows running and recently completed background subagents; /process shows active background shell processes.
/attachments and /remove-image inspect or edit images queued for the next turn.
/tool <call-id> shows the complete retained result for a tool call. Reused native IDs return an ambiguity message with occurrence selectors; use /tool <selector> to choose a result. Selectors refer to the current retained history or live display turn.
/session <id> restores a saved session. The CLI equivalent is yaacli --session <id>.
- Use
/help for the complete built-in and configured command list. Slash commands and available skills complete while typing.
- Prefix an idle prompt with one or more available skill names to request them explicitly:
/lark-cli /agent-builder Build an agent that replies in Lark. Only the leading consecutive /skill-name tokens are selected. Reserved built-in commands keep control-plane precedence; an available skill takes precedence over a configured prompt command with the same name.
- The interactive TUI enables
ask_user_question by default. When the agent needs clarification, YAACLI renders one to four structured questions and accepts an option number, comma-separated numbers for multi-select questions, or free text.
- Long status text wraps to the available terminal width. When token usage is enabled it shows context utilization, durable cumulative session tokens in decimal K/M/B units,
cache read / all tokens, and estimated cost. Session usage includes all native continuation segments, including HITL pauses; repeated live updates do not count a segment twice. Cache read/write counters remain details, with all tokens = input + output. Controlled failure/cancellation retains safely captured usage; restart recovery retains the last stable checkpoint's totals. Foreground elapsed time uses compact forms such as 42s, 3m 05s, and 1h 05m 09s.
Built-in Skills
YAACLI ships with building-agents from the repository canonical source skills/agent-builder/.
The YA Claw deployment skill lives in skills/ya-claw-deploy/ and is published as YA_CLAW_DEPLOY_SKILL.zip during release.
The repository sync script keeps bundled skill files under packages/yaacli/yaacli/skills/ aligned.
YAACLI refreshes and resolves /skill-name against the effective SDK skill catalog at submission time, including built-in, global, shared, and project skills after normal priority rules. Like a configured prompt command, the visible transcript and model input contain one Use this skill: <name> line per selected skill followed by the remaining task as User instructions: <task>; prompt history retains the original slash input for editing and reuse. A slash prefix that matches neither a registered command nor an available skill is submitted as ordinary user input.
CodeAct
YAACLI exposes run_code and run_program by default. They execute restricted Python for tool orchestration; run_program reads reviewed programs through the runtime's FileOperator. Shell remains a separate execution surface and is not made callable from CodeAct. Disable both CodeAct tools globally in ~/.yaacli/tools.toml or per project in .yaacli/tools.toml:
[tools]
enable_codeact = false
MCP Tool Exposure
MCP tools are exposed directly to the model by default. Configure the behavior globally in ~/.yaacli/tools.toml or per project in .yaacli/tools.toml:
[tools]
mcp_mode = "direct" # "direct" (default) or "proxy"
Direct mode registers each configured MCP server as a native toolset and exposes namespaced <server>_<tool> names by default. A server's optional prefix field in mcp.json overrides <server>; set it to "" to expose the server's native tool names without a prefix. Omitting prefix or setting it to null preserves the default server-name prefix. Proxy mode exposes the fixed mcp_search_tool and mcp_call_tool pair instead, which can improve prompt-cache stability when many MCP tools are configured. Servers marked "required": false remain optional in both modes. If an optional server cannot connect or becomes unavailable, the TUI reports the degraded MCP namespace once per status change and continues without that server.
For direct host-managed MCP tools, structured output remains the tool's Python return value even when the response also contains media. Completed MCP error responses are returned for model or CodeAct inspection without consuming Pydantic AI's ModelRetry budget; failures that produce no MCP result are terminal failed tool outcomes.