
Vtai Agent
io.github.velsrocky由 GitHub 账号 velsrocky 发布v0.7.0更新于 Oct 26, 2026
System-automation agent MCP server for opencode/claude/pi: guarded shell, dry-run-first, audited.
概览
本地 MCP 服务器,让助手在你自己的机器上执行受管控、默认试运行的系统自动化:shell、文件、备份、媒体与编码委派。
- 可以做什么
- 查看机器状态:只读的系统快照与磁盘空间审计
- 在失败即关闭的沙箱中运行白名单内的 shell 命令
- 在可写根目录内整理文件,并执行带校验的 rsync 增量备份
- 批量视频转码与磁盘清理,不触碰原始文件
- 把编码任务委派给 opencode/claude/pi,带 git 快照、校验与回滚,并提供自主目标循环
- 在隔离副本上对本地应用做静态分析,可选启用评审环节
- 适用场景
- 适合希望 AI 助手真正操作自己 Linux、macOS 或 Windows 机器的人:清理目录、运行经审核的命令、备份、转码,或把编码任务交给命令行工具,同时保持写入受限、默认只预览、每次允许与拒绝都有审计记录。
- 运行要求
- 以 stdio 方式在本地运行,来自 PyPI 包 vtai-agent(或用 uv 克隆仓库)。需要 Python 3.14+ 与 uv >= 0.13.1、一个 TOML 配置文件(VT_CONFIG 或 ~/.vtaiagent/settings.toml),以及规划模型:本地 OpenAI 兼容端点(如 Ollama),或云端提供方的 ANTHROPIC_API_KEY / OPENAI_API_KEY。rsync、ffmpeg 与 Lemonade Server 按工具可选。
安装
在 SourceWeft 中
- 打开 控制台中的 Vtai Agent,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
VT-AIAgent
System-automation agent for your machine, exposed as an MCP server for
opencode / Claude Code / pi — and drivable directly via the vtai CLI.
Tools
Safety model
- Dry-run by default (
guardrails.dry_run_default) — previews never touch disk. - Path containment: writes only inside
paths.writable_roots, resolved paths defeat../symlink escapes;guardrails.deny_globsprotect secrets. - Fail-closed shell sandbox: the binary must be a bare allowlisted name
with an explicit read/write policy, resolve inside
trusted_bin_dirs, carry no exec-enabling flags, and every path argument passes the same checks. - Kill switch: drop a
KILLfile indata_dirto abort executing tools. - Echo-loop breaker: N identical denials in a window escalate the refusal
into a
CIRCUIT BREAKERinstruction the looping model can't miss. - Budget cap:
budget_usd_per_runaborts an orchestrated run when accrued token cost exceeds it; spend is recorded per run. - Audit: every allow and deny is logged to SQLite in
data_dir, each invocation (orchestrated, MCP, or CLI) attributed to a run row.
Quick start
Prerequisites
1. Install
uv sync needs uv >= 0.13.1 (the lockfile is revision = 5; the floor is
declared as [tool.uv] required-version, so an older uv says so plainly
instead of failing on a lockfile parse).
2. Configure
The agent reads one TOML file. Which one is resolved in this order:
$VT_CONFIG— explicit overrideconfig/settings.tomlnext to the package (i.e. the clone you just made)~/.vtaiagent/settings.toml— the per-user file
A machine with no config file anywhere fails loudly on first use — the
built-in defaults leave nothing protected (shell_allowlist empty) so
nothing runs, and vtai info says so plainly ("no config file there").
vtai init writes a starter config; vtai init --doctor runs the full
preflight right after it.
A fresh clone contains the maintainer's config (their provider, their writable roots), so point the agent at your own file instead of editing the tracked one:
Put that export in your shell profile so every later command (and the MCP
server) picks it up.
vtai init creates ~/.vtaiagent (audit DB + data dir), ~/Downloads, and
~/Documents/vt-data, and writes a starter config with safe defaults:
dry_run_default = true, deny_globs for ~/.ssh, ~/.gnupg, ~/.aws and
**/.env, and writable roots limited to ~/Downloads, ~/Documents/vt-data
and ~/.vtaiagent/tmp. Use vtai init --doctor to run the preflight
immediately after writing. It is safe to re-run.
Check which config you ended up with — vtai info names the file and its
origin:
Alternative: keep the checkout's config and override with env vars
A .env file (gitignored; copy .env.example) in the working directory
overrides any setting, using the VT_ prefix with __ for nesting:
This is how a machine with no Ollama points the agent at a Lemonade server
instead. The .env is read from the current working directory, so run
the CLI from the checkout, or export the variables in your shell.
Choosing a model
The planner/judge model comes from active_provider:
local— any OpenAI-compatible endpoint: Ollama (http://localhost:11434/v1), llama.cpp, vLLM, LM Studio, Lemonade. No API key.anthropic/openai— cloud models; putANTHROPIC_API_KEYorOPENAI_API_KEYin.env.
Set cost_per_1k_input / cost_per_1k_output in the provider block to make
budget_usd_per_run meaningful; without them the agent falls back to the
model's native price table.
3. Verify
Start with the preflight — it checks uv, your config, the writable roots, what is protected, the optional tools, the model endpoint, the MCP registration and any delegate waiting for review:
It exits non-zero if something needs fixing. Then, to try the pieces:
4. Use it from your agent CLI
opencode's registration lands in ~/.config/opencode/opencode.jsonc and
merges with your existing providers. The script registers an absolute
uv path on purpose: a bare uv fails with
NotFound: ChildProcess.spawn (uv ...) when the client spawns the server
from a daemon with a minimal PATH.
Use
To get the vtai CLI outside the checkout, install it as an editable tool so
it tracks your working copy:
Install into another project as a dependency with
uv add git+https://github.com/velsrocky/[email protected], or pull the
image with docker build -t vtai-agent ..
Registry & distribution
PyPI: uv tool install vtai-agent (or pipx install vtai-agent) — publishes
on v* tags via Trusted Publishing with build attestations (see
.github/workflows/publish.yml). The <!-- mcp-name: ... --> comment above
is the PyPI-package proof the official MCP registry expects; server.json
carries the registry manifest (io.github.velsrocky/vtai-agent, stdio)
alongside a metadata-consistency gate in the publish workflow. Only install
from these sources; a similar repository name does not establish provenance.
Register with the official MCP registry after a PyPI release:
Certification (vtai-cert)
Safety claims are probes, not prose: vtai certify runs the executable
guardrail-compliance suite (deny-glob containment, dotdot/symlink escapes,
fail-closed shell, injected-argv resistance, dry-run-first, kill switch,
audit exactness, echo-loop breaker, and the delegate's verify-then-trust
loop with scripted-fake rollback + approval-gate probes) and emits a
digest-stamped certificate;
exit 0 gates the release in CI. See docs/certification.md.
HTTP transport
vtai serve --transport http --port 8765 --token $VT_HTTP_TOKEN exposes the
same guarded tools over MCP StreamableHTTP at /mcp. The bearer token is
required when binding anything other than localhost; the server refuses to
bind externally without one.
Development
The config file is resolved as described in Configure: $VT_CONFIG
→ the checkout's config/settings.toml → ~/.vtaiagent/settings.toml. Env
overrides use the VT_ prefix with __ nesting (e.g.
VT_GUARDRAILS__DRY_RUN_DEFAULT=false). Config is validated at startup
(validate_settings) — a bad deny_globs pattern or a missing writable root
fails fast, not mid-run.
Windows: the shell sandbox needs the allowlisted binaries to resolve, and a
fresh Windows runner does not put Git for Windows' coreutils on PATH. Install
Git for Windows and prepend its usr\bin (this is what CI does):
Everything else (install, config, MCP registration) is the same on all three platforms.
Orchestrator
vtai goal runs a bounded ReAct-style agent loop. Each step the model
either emits one fenced-JSON tool call (parsed, guarded, executed, result fed
back) or a final natural-language answer. Bounds enforced every step:
max_steps, kill switch, and budget_usd_per_run. A lonely dry_run: true
text blob that fails to parse or misses its tool key is retried with a
corrective note instead of ending the run as "success"; the run mode is
authoritative — the model cannot override it — and every tool call is
persisted as a Step row and audit entry. If a paid provider's spend can't
be determined (no cost_per_1k_* config and no native cost), the run fails
closed rather than reporting free. The system prompt describes the machine's
actual OS.
We use a text protocol rather than native function-calling on purpose: the local Ollama models on this box emit tool calls as raw JSON text even when native tool schemas are provided (verified 2026-10-03 with qwen2.5-coder:7b), so the text protocol behaves identically across local and cloud providers.
Auto mode
auto_mode runs the loop you describe: it dispatches the goal to a coding
CLI (opencode by default), reviews the reply against the goal with the
configured model, and if the reply is insufficient, sends a follow-up prompt
quoting the critique — up to max_iterations. The judge accepts only an
unqualified approval: hedged replies (OK, but ...) and objection prose
(OK. However, ...) fail, always. Verbose judges that justify a clean
first-line OK get their approval honored; prose that signals a defect
(missing/unverified/wrong...) keeps the verdict strict, and that bias is
deliberate — a caveat word inside praise costs one extra probe, never a
wrong approval. With [auto_mode] judge_replicas = N (default 1) the
verdict is the majority of N independent judge calls — a measured defense
against single-call verdict variance; the judge's spend is capped by
guardrails.budget_usd_per_run shared across the replicas, never N times
it. All spend is metered the same way and attributed in the run's spend
detail:
the judge's own LLM calls always; the delegate CLI when it can report it —
claude -p --output-format json exposes total_cost_usd, and an unreadable
report from a cost-capable CLI fails closed. opencode/pi report no
headless spend (documented vendor behavior, not guess-parsed event streams),
so their runs carry "cli_usd": "unmeasured" and stay bounded only by
max_iterations/timeout. From inside opencode or
Claude Code, start the prompt with @vt-ai_automode_on: the MCP server's
instructions route that to the tool.
Delegate coding
delegate_coding snapshots the target repo, runs the chosen CLI headlessly,
captures the diff, and on verify_command failure (or timeout / non-zero
exit) rolls back. Three guards worth knowing:
- Human approval gate:
require_approvaldefaults totrue. Interactively it showsgit diff --statand asks before keeping changes. Non-interactive runs (MCP, scripted, orchestrated) keep the changes in the worktree as a pending approval — the run reports failure so automated loops stop — andvtai approve <id>(keep) orvtai approve <id> --rollbackresolves it. While a pending approval exists for a repo, delegate_coding refuses new work there, even withrequire_approval: false. Passrequire_approval: falseonly for tasks a human has already reviewed. pineeds credentials: with no authenticated provider,pi -pexits 0 having emitted a tool-call JSON block and applied nothing. The tool now fails closed with a clear message. Runpi auth check— or preferopencode/claude— before delegating to pi.
Claude delegations run with --output-format json, so the reply text comes
from result and the invocation's total_cost_usd is captured into the
tool detail as cli_cost_usd (and audited). Delegations to opencode/pi
report "cli_cost_usd": "unmeasured".
vtai info shows how many approvals are waiting, so a delegate that was kept
for review does not get lost.
Inspect applications (REA capability)
inspect_application integrates REA so the
agent can statically explain how a local app works without source code.
Because REA's inspection is powerful, it runs entirely inside vtai-agent's
guards and is off by default:
Safety contract, in order: the target must pass deny_globs; it is then
copied into a quarantine dir under data_dir (denied entries and
out-of-policy symlinks are skipped on the way in, so REA never reads a path
you couldn't); REA runs on the copy with a minimal child environment (no
inherited API keys) and is killed after timeout; output JSON is parsed and
a sha256 evidence digest plus REA's evidence id are written to the audit
trail; the optional judge pass (same model and fail-closed policy as
auto_mode) verifies the evidence answers the goal before the result reports
success. The original target is never touched, and the quarantine copy is
deleted unless keep_copy is true. Live-validated 2026-10-21 against the
real rea 6.7.0 CLI on a real JS app — spawn, --json envelope, and
evidence digits all confirmed; see
docs/showcases/rea-live-validation.md.
Install REA only from official sources (github.com/morluto/rea or the
rea-agents package on npm — verify provenance), not mirror sites.
Audit log
Every allow/deny is stored in ~/.vtaiagent/vtai.db. Query it without a SQL
client:
To see one run end to end — the goal, every tool call, what was allowed or refused, and the spend:
Voice control (agent-listen / agent-speak)
Both helpers talk to a local Lemonade Server (TTS kokoro-v1, STT
Whisper-Tiny on Linux/macOS — Windows defaults to Moonshine-Tiny-Streaming
because the whisper.cpp recipe misbehaves on some AMD GPUs) at
http://localhost:13305. LEMONADE_STT_MODEL overrides the STT model on any
platform. Use --seconds N to change the
record window, --vad for silence-based early stop, LEMONADE_BASE_URL to
point elsewhere.
The scripts are versioned in scripts/; install them with:
voice-sync copies both helpers to ~/.local/bin (override with --dest),
marks them executable, and reports installed / updated / unchanged per
file. vtai voice-sync --check only reports drift (exit 1 when out of sync)
— re-run without --check after pulling script updates. Set
VTAI_SCRIPTS_DIR to sync from a different checkout.
Cross-platform notes (verified on macOS 27/ARM, 2026-10-12):
Supported: Linux + macOS + Windows — all three run in CI (Linux and macOS push-blocked; Windows reinstated in 0.6.0 after the suite became portable, with Git Bash coreutils prepended to PATH so the allowlisted sandbox resolves real binaries). rsync-dependent tests skip on runners without rsync and are complemented by a fail-closed counter-test.
arecordis used for recording on Linux; elsewhere the helpers fall back toffmpeg(-f pulse/avfoundation), so macOS and Windows work too.--vadcurrently requires Linuxarecord; on other platforms use--seconds N.- macOS mic selection: avfoundation device indexes vary per machine — list
them with
ffmpeg -f avfoundation -list_devices true -i ""and override viaAGENT_LISTEN_FF_INPUT(default audio-only-f avfoundation -i ":0"). Machines with no built-in microphone (many mini PCs) need an external/USB device attached, otherwise recording yields silence (exit 6, no speech). - Playback tries
ffplay→afplay(macOS) →mpg123→aplayin order. - The ALSA mic-level fix and
vtai-audio-fixsystemd unit below are Linux-specific; Windows and macOS handle this in System Settings. guardrails.trusted_bin_dirsdefaults per OS (C:\Windows\System32,/usr/bin, /bin, /usr/local/bin, /opt/homebrew/bin, and the Linux set); entries missing on the current machine are ignored (validation only fails when none exist), so one config can list both Linux and macOS paths.system_infois portable: memory viasysctl/vm_statand disks via/,$HOME,/Volumes/*on macOS (Metal GPU note; norocm-smithere).transcode_mediadefaults tolibx264off Linux (VAAPI is Linux-only); an explicit"codec"still overrides.disk_auditalso measures~/Library/Caches,~/Library/Logs,/Library/Caches, and~/.Trashon macOS; fresh mac installs getvm_stat(instead of Linux-onlyfree/nproc) in the starter allowlist.
Troubleshooting
Setup and MCP
opencode mcp listshows✗ vtai-agent failed: NotFound: ChildProcess.spawn (uv ...): the client spawned the server with a minimal PATH (daemons givePATH=/usr/bin:/bin:...), so a bareuvwas unresolvable. Re-runscripts/register-mcp.sh— it registers the absoluteuvpath — or edit themcp.servers.vtai-agent.commandarray in your opencode config to the full path ofuv(command -v uv).opencode mcp listsaysNo MCP servers configured: the registration is per-project. Run it from the checkout, or use the global registrationscripts/register-mcp.shwrites to~/.config/opencode/opencode.jsonc.- "config exists: …/config/settings.toml" and your settings are ignored:
the checkout's config wins over
~/.vtaiagent/settings.toml. SetVT_CONFIG="$HOME/.vtaiagent/settings.toml"and re-runvtai init;vtai infoprints the file in use and where it came from. uv syncfails withRequired uv version ... does not match: install uv >= 0.13.1 (the lockfile is revision 5).
Voice (Linux / PipeWire / ALSA)
-
Mic produces silence or clipped garbage transcripts: the internal mic boost is pinned too high and clips the input. Fix (also applied at every login via
~/.config/systemd/user/vtai-audio-fix.service): -
Headphone jack not detected: the kernel reports no jack on the combo port, so the headphone amp stays off. Check
pw-cli enum-params 53 EnumRoute— theanalog-output-headphonesroute showsavailable: nountil a headset is firmly plugged in. Route manually withwpctl set-route 38 1if detection is flaky. -
Default source is the wrong mic: list routes with
pw-cli enum-params 53 Routeand select withwpctl set-route 47 <index>(0= internal mic,1= headset mic). -
STT returns
[BLANK_AUDIO]or noise transcripts: verify levels witharecord -d 3 -f cd /tmp/t.wavand inspect the peak; near 0 means the selected route carries no signal, full-scale means clipping (lower the boost).
Delegate coding
- Files changed via
delegate_codingare still sitting in the repo: that is a pending approval — the changes are kept for your review until you runvtai approve <id>to keep them or--rollbackto discard them. Passrequire_approval: falseonly for tasks a human has already reviewed.
Contributing
See CONTRIBUTING.md — setup, the guardrail rules any change has to respect, and the test/lint commands.
Security
Guardrails, what counts as a vulnerability, and how to report one privately: SECURITY.md.
License
MIT — see LICENSE. Use it, fork it, run it on your own machine.
来源:README.md,提交 ed71c05
工具
0版本历史
3- v0.7.0最新Oct 22, 2026
- v0.6.8Oct 21, 2026
- v0.6.6Oct 21, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分