Skip to main content

Cli Agent

@mgreten/cli-agentv2026.08.21.3· 1d agoMODELS
01README

Invoke CLI coding agents (claude, opencode, amp, gemini, codex, grok, pi) with typed inputs and capture structured outputs — tokens, cost, duration, retries, and exit code. Supports slash command resolution and JSON response parsing.

02Release Notes

Support standard linked Git worktrees inside Linux bwrap with read-only canonical Git metadata mounts.

03Models1
@mgreten/cli-agentv2026.08.21.3cli_agent.ts

Global Arguments

ArgumentTypeDescription
commandsDirstring
commandSubdirsarrayAdditional subdirectories under commandsDir to search for slash commands
claudePathstring
opencodePathstring
ampPathstring
geminiPathstring
codexPathstring
grokPathstring
piPathstring
maxRetriesnumber
sandboxProfile?stringOverride path to the Seatbelt .sb profile (defaults to the shipped cli_agent.sandbox.sb, resolved from the extension's files dir)
sandboxRequiredbooleanWhen true, fail the invocation instead of degrading when a sandbox is requested but the platform can't apply it (no backend for the OS, or the backend's binary is missing). Default false: warn and run unsandboxed.
fn collectLocalUsage(date?: string, timeZone?: string)
Aggregate one local calendar day of native Claude Code, Amp, and Codex CLI token usage without reading cli-agent invocation resources
ArgumentTypeDescription
date?string
timeZone?string
fn invoke(prompt: string, cwd?: string, tags?: record, toolAllowlist?: array, sandboxRequired?: boolean)
Run a CLI agent tool (claude, opencode, amp, gemini, codex, grok, pi) with a prompt and record structured results
ArgumentTypeDescription
promptstringThe prompt or slash command to execute
cwd?stringWorking directory for the CLI (defaults to Deno.cwd())
tags?recordArbitrary key-value tags for grouping/filtering invocations
toolAllowlist?arrayRestrict the child to ONLY these tool names (e.g. specific MCP tools like 'mcp__granola__list_meetings'). Every other tool is rejected. Layered on top of toolProfile's rules. Currently honored by the amp provider; other providers ignore it.
sandboxRequired?booleanOverride the global sandboxRequired for this invocation: fail closed instead of warn-and-degrade when the sandbox can't be applied.
fn invokeAndParse(prompt: string, cwd?: string, tags?: record, toolAllowlist?: array, sandboxRequired?: boolean)
Run a CLI agent and parse the JSON response from the output. Returns the parsed data alongside the invocation record.
ArgumentTypeDescription
promptstringThe prompt or slash command to execute
cwd?stringWorking directory for the CLI (defaults to Deno.cwd())
tags?recordArbitrary key-value tags for grouping/filtering invocations
toolAllowlist?arrayRestrict the child to ONLY these tool names (e.g. specific MCP tools like 'mcp__granola__list_meetings'). Every other tool is rejected. Layered on top of toolProfile's rules. Currently honored by the amp provider; other providers ignore it.
sandboxRequired?booleanOverride the global sandboxRequired for this invocation: fail closed instead of warn-and-degrade when the sandbox can't be applied.
fn listProviders()
List CLI providers supported by this extension (from the closed PROVIDERS registry). Pure — does not shell out. Use listModels to enumerate model ids for a provider that supports it.
fn listModels()
List the model identifiers available to a provider's CLI (any provider with parseModelsList in PROVIDERS — currently opencode and grok). Prefer listProviders to see which providers support enumeration.

Resources

localUsage(infinite)— Daily native-client token usage aggregated from local Claude Code, Amp, and Codex sessions
ampThreadUsageCache(30d)— Normalized latest Amp protocol usage events for one thread
invocationLaunchClaim(30d)— Durable pre-spawn identity claim for a caller-owned invocationId
invocation(30d)— Structured record of a CLI agent invocation with provider, tokens, cost, and output
transcript(30d)— Full untruncated prompt and output for an invocation (companion to the invocation record)
modelList(7d)— Models available to a provider's CLI
providerList(7d)— CLI providers supported by this extension version (from PROVIDERS registry)
04Previous Versions19
2026.08.20.1

Configure OpenCode actor invocations for noninteractive tool execution and default-deny readonly tools, including custom, plugin, and MCP mutation surfaces.

updated binaries

2026.08.14.2

Automated republish 2026.08.14.2 (regression suite + quality 14/14)

Modified 1 models. updated binaries

2026.08.11.1

updated binaries

2026.08.07.1

updated binaries

2026.07.31.1

Adds read-only local-day usage aggregation across native Claude Code, Amp, and Codex session stores with timezone-aware attribution, cross-midnight cumulative deltas, and cache-safe combined totals.

Modified 1 models. updated binaries

2026.07.27.3

updated binaries

2026.07.27.2

Modified 1 models. updated binaries

2026.07.25.5

updated binaries

2026.07.25.4

updated binaries

2026.07.25.3

updated binaries

2026.07.25.2

updated binaries

2026.07.25.1

updated binaries

2026.07.24.3

updated binaries

2026.07.24.2

updated binaries

2026.07.24.1

Normalize provider subprocess PWD to the requested cwd so agent CLIs select the intended checkout or Git worktree. Adds a regression test for stale parent PWD.

updated binaries

2026.07.21.3

v2026.07.21.3: add the upgrades[] entry matching the localhost-egress strict-profile change (v.2 omitted it, causing a version-mismatch on run). No behavior change vs .2.

updated binaries

2026.07.21.2

v2026.07.21.2: strict sandbox profile (sandboxNetwork:deny) now allows localhost egress so network-denied flows can use a LOCAL model (Ollama) while external egress stays blocked. Default profile unchanged.

updated binaries

2026.07.21.1

v2026.07.21.1: add opt-in sandboxNetwork:'allow'|'deny' (default 'allow' — existing behavior unchanged). 'deny' selects a hardened Seatbelt profile that denies all network egress + the per-repo .swamp/secrets vault, for flows running an LLM on untrusted input (prompt-injection exfiltration defense). Additive schema change; ADW/software-factory/watchers unaffected (never set the flag).

updated binaries

2026.07.20.1

updated binaries

05Stats
A
100 / 100
Downloads
425
Archive size
115.8 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository2/2earned
06Platforms