Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/okisdev/claude-code-fusion/grok-cli-runtimenpx skills add okisdev/claude-code-fusion --skill grok-cli-runtimegit clone --depth 1 https://github.com/okisdev/claude-code-fusionWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00019 | $0.04318 |
| Opus 5 | $0.00010 | $0.02159 |
| Sonnet 5 | $0.00004 | $0.00864 |
| Haiku 4.5 | $0.00002 | $0.00432 |
Grade A, and why
grok-cli-runtime scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 55 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Grok runtime
Primary helper:
node "${CLAUDE_PLUGIN_ROOT}/scripts/grok-companion.mjs" <subcommand> [flags]
Subcommand surface:
task [--prompt-file <path>] [--write] [--web] [--memory] [--background] [--resume <uuid>] [--resume-last] [--fresh] [--model <id>] [--effort <level>] [--max-turns <n>] [--cwd <dir>] [--json-schema <schema>] [--json] [--] [prompt]- The upstream Grok CLI has no default turn limit. An unset limit is unlimited, and one turn is one main-agent model call plus its tool cycle, excluding subagent calls. The companion defaults consult and write to
--max-turns 60; consult previously defaulted to 25. When the limit is reached, Grok prints the complete final JSON envelope to stdout, including partial text, usage,num_turns, andmodelUsage, then exits 1 with stderrError: max turns reached. The companion salvages that envelope and recordsfailureKind: "turn_limit". - Grok headless JSON has no top-level
modelfield. Model names are available only as keys inmodelUsagewhen usage attaches, so model capture depends on that map and on error-path salvage. MissingmodelUsageleaves the resolved model unavailable. review [--base <ref>] [--focus <text>] [--cwd <dir>] [--background] [--json]status [job-id] [--cwd <dir>] [--json]history [--all] [--limit <n>] [--cwd <dir>] [--json]result <job-id> [--cwd <dir>] [--wait] [--wait-timeout-ms <ms>] [--json]cancel <job-id> [--cwd <dir>] [--json]stats [--all] [--cwd <dir>] [--json]setup [--continuity <manual|claude-session>] [--enable-stop-gate] [--disable-stop-gate] [--json]stop-gate
Execution rules:
- Slash commands stage their complete raw arguments through
transport-create, one Read of the allocated empty file, Write to that same file, and a fixed--raw-args-tokeninvocation. The token transport applies to task, review, status, history, result, cancel, stats, and setup. Raw request bytes never enter Bash, shell arguments, environment variables, redirections, substitutions, encoded literals, or heredocs. A transport is private, bounded, validated, and consumed once. Never delete, rename, recreate, or change the permissions of the transport file; usetransport-discardwhen Read or Write fails or when the allocated file is not empty. - The companion always invokes Grok with
--prompt-file /dev/stdinand pipes the complete prompt to the child. Never pass a private staging path to Grok. Headless installs the sandbox before it reads--prompt-file, so a brief under Claude plugin data can be unreadable even when the companion already consumed it successfully. - Task and review options must precede the first positional text. Once prompt or focus text starts, every remaining token is data, including option shaped words such as
--background,--write,--cwd, and--json. - Background has three distinct layers. The Grok rescue Agent and every helper
Bashcall remain foreground. Parallel orchestration starts multiple foreground Agent calls in one message. The Grok CLI runs in its own supervised process group, which is not itself a detached user job. - Ordinary delegations use one foreground helper call with timeout
600000. Only an explicit incoming user--backgrounddetaches a task and creates a manual receipt that crosses the Agent boundary. The dedicated review runner is the sole managed worker exception because it owns and collects the review before returning. Native Grok background tool waiting is a fourth, internal lifecycle. Ordinary calls pass--no-wait-for-background. That setting does not authorize companion detachment. - Prefer the helper over hand-rolled
git, direct Grok CLI strings, or any other Bash activity. - Consult mode is the default. Consult, write, and review pin
--sandbox strict; never downgrade to workspace. Consult overrides inherited always approve mode with--permission-mode defaultand hard filters built in tools to file read, list, and search.--webadditionally exposes Grok's web search and fetch tools. Strict's upstreamsystem_readroots include/varand/tmpon Linux, and/privateplus the entire~/Libraryon macOS, so shared temporary content and substantial user application configuration and caches may be readable. Its write roots include the workspace and entire Grok home, always include/tmpand/var/tmp, and on macOS also include/private/tmp,/private/var/tmp, and all of/private/var/folders; the unique private runTMPDIRis the adapter's preferred and verified path, not the only temporary write surface. Its configuration requests child process network restriction, which Linux enforces through seccomp while macOS currently treats network blocking as a no-op; a write shell can reach the network on macOS, and--webcontrols only built in web tools. Hostedx_searchstays outside managed runs because the fixed--toolsallowlist governs the toolset (live verified on 1.0.0), and the companion adds no speculative disallow entries because Grok 1.0.0 warns when adisallowedToolsentry matches nothing and tracing fails closed on that warning. The hard tool filter and deny set provide the consult no-write model contract. Shell commands, tests, git, builds, file edits, MCP tools, and subagents are unavailable.--writekeeps strict, enables auto approval, and usesread_file,grep,list_dir,search_replace, andrun_terminal_cmd;search_replacecreates files, while upstream 1.0.0's OpenCode-compatiblewritetool id remains outside the fixed allowlist. Denies for common direct grok, claude, and codex commands do not cover absolute paths, aliases or functions, or indirect scripts. They are not hard confinement whilerun_terminal_cmdremains enabled; that requires removing the terminal tool or an OS-level executable or network policy. User toolchains outside strict's readable roots may be unavailable, which is a reroute or environment problem rather than permission to weaken the profile. - Every consult and write call explicitly denies
search_tool,use_tool,ask_user_question, and all MCP tools. Every ordinary call also passes bare--disallowed-tools AgentandGROK_SUBAGENTS=0. Cross-session memory is force-disabled withGROK_MEMORY=0unless an ordinary task explicitly supplies--memory, in which case the child receivesGROK_MEMORY=1. Review and stop gate always keep memory off. Published headless Grok parses--experimental-memoryand--no-memorywithout forwarding them through the single-turn path, so the companion uses the environment variable as the effective control and never trusts an inherited value. When memory is enabled, upstream first-turn injection may read relevant global or workspace memory and place it in the model context sent to xAI. That internal injection is not a modelread_filecall and is not blocked by the companion's Read denies for~/.grok/memory/**. Upstream automatic saving normally requires at least three real user prompts in the same resumed session and enough content, so a single Fusion task usually only reads existing memory and does not guarantee that new memory is saved. Upstream parses--no-subagents, but the single-turn and agent resolvers do not forward it, while the interactive TUI does apply it; the hard Agent tool deny andGROK_SUBAGENTS=0are the effective headless controls. The child sets all eighteenGROK_CLAUDE_*_ENABLED,GROK_CURSOR_*_ENABLED, andGROK_CODEX_*_ENABLEDbridge variables to false; upstream currently consumes the six Claude and six Cursor cells plus the Codex sessions cell and reserves the other five Codex cells, and the child also pinsGROK_MANAGED_MCPS_ENABLED=falsebecause that variable has highest precedence over[managed_mcps]in~/.grok/config.tomland remote settings. It removes inheritedCLAUDE_CODE_*andCLAUDE_PLUGIN_*variables plus_GROK_CLAUDE_MARKER_OVERRIDE, and broadly scrubs secret-bearing variables except required xAI authentication. The entire Grok home remains read-write, and the sandbox permits consultread_fileto reach~/.grok/auth.json, config, and sessions while a write shell can receive retained xAI authentication variables. The companion adds best-effort Read denies forauth.json,mcp_credentials.json,config.toml,sessions,memory,logs, anddebugthrough absolute paths and standard**/.grokpatterns. Raw path variants, symbolic links, and shell or indirect scripts can bypass those rules, so environment scrubbing and path-pattern denies do not isolate the credentials. The model-facing meta-tool denies cannot prove that native MCP servers, plugins, or hooks configured under~/.grokdid not start during agent construction or had no side effects; those bridge variables do not disable native Grok configuration. Narrower exposure needs a dedicated sandbox profile, an isolated Grok home, an authentication broker, or upstream path-level authorization. The child passes--no-auto-update; Grok enforces hard version requirements at startup (introduced in 0.2.112, verified through 1.0.3; organization message, exit 1 before any envelope), the companion classifies that death assetup, and the soft update floors it also introduced only steer auto-update. - The companion probes the installed binary before using source-derived flags. Every run requires
--prompt-file,--output-format,--sandbox,--tools,--disallowed-tools,--deny,--max-turns,--no-auto-update, and--no-wait-for-background. Consult also requires--permission-modeand--allow; no-web runs require--disable-web-search; write requires--always-approve; review requires--json-schema. A missing applicable capability fails before launch with failure kindsetup. Every managed run forces builder tracing. Upstream initializes tracing only after it consumes the complete stdin prompt, so it is not a pre-prompt or pre-side-effect attestation. Fallback, unmappable, or unmatched-policy warnings trigger early verified termination, and a successful close is rejected without positivetools allowlist appliedevidence. Before sending stdin, the companion creates a unique privateTMPDIRand requires a newProfileAppliedrecord in the incremental sharedsandbox-events.jsonldelta that contains that path and matches the canonical workspace, strict profile, enforced state, and requestedrestrict_network: trueconfiguration. Upstream supplies no run id or pid, so unrelatedProfileAppliedandApplyFailedrecords are not attributed; failure events are auxiliary diagnostics. The matching event proves profile and configuration application, not platform-level network isolation. A matching owned-stderr warning, handshake timeout, missing or malformed matching evidence, shared-log disappearance or rotation, or matching field mismatch fails closed. --backgrounddetachestaskorreviewinto a companion worker; the helper prints the job id plus/grok:statusand/grok:resulthints. A task accepts it only from an explicit incoming user flag and creates manual delivery. The dedicated review runner setsGROK_COMPANION_BACKGROUND_DELIVERY=managed, owns that review job, and collects it with repeatedresult <job-id> --waitcalls before returning. The runner accepts only a 32 character lowercase hexadecimal job id and omits the raw launch--cwdbecause companion job ids resolve globally across workspaces; an original--jsonstays on both launch and result. Text collection continues only after a zero exit whose output ends instate: running; JSON collection continues only after a zero exit with top levelstatus: "running"andcleanupRequirednot true. A textphase: cleanup-requiredor JSONcleanupRequired: trueresult is returned as a nonterminal failure receipt instead of looping. Terminal result collection records successful companion output, not later Agent message delivery. The monitor suppresses collected managed jobs and emits a delayed fallback after the grace period when a terminal managed job remains uncollected, as a best effort owner loss fallback.result --waitblocks while a job is running, refreshes liveness on each poll, and prints the same terminal output asresultwhen the job finishes. If its bounded wait budget elapses first, it prints a compact running render ending instate: runningand exits zero so the forwarder can issue another foreground wait call. If verified cleanup cannot complete, it exits nonzero and returns the explicit cleanup-required receipt even though the durable record remains running for a later cleanup retry.- A user asking to resume maps to the companion's
--resume <uuid>or--resume-last. Never invent a session uuid; only uuids recorded by finished ordinary companion tasks are resumable. Every mode records strict, so legacy workspace or unknown profiles fail closed and require a fresh task. Resume also requires the same mode and memory boundary as the source task. A memory-enabled session must be resumed with--memory, a memory-disabled session must be resumed without it, and inconsistent recorded memory modes fail closed.--resume-lastselects the newest compatible terminal task and requires the current Claude session when one is available. Resolved metadata for a short cwd uses only its exact URL-encoded directory. A long cwd may scan bounded session-id candidates but accepts only an exact decoded or.cwdmatch; it never falls back to a sole candidate from another cwd. - Continuity policy defaults to
manual, which never resumes without--resumeor--resume-last./grok:setup --continuity claude-sessionpersists automatic affinity for an ordinary task that has a prompt, does not request explicit resume, and does not pass--fresh. Affinity selects only the newestdoneordinary task from the same Claude session, exact resolved cwd, mode, strict profile, and memory boundary. Fusion routed briefs identified by their routing header do not receive automatic affinity and stay fresh unless explicitly resumed.--freshstarts a new session for one task and cannot be combined with either resume option.GROK_COMPANION_CONTINUITY_POLICYmay override the persisted policy withmanualorclaude-session. historyexposes a safe canonical projection of companion job metadata and resumable session identifiers. It defaults to the current workspace and 50 newest records,--allincludes every recorded workspace,--limitaccepts 1 to 500, and--cwdselects an exact workspace when--allis absent. It does not read native Grok conversation contents, briefs, stored results, or logs.- Leave
--modeland--effortunset so Grok's own config rules apply, unless the user explicitly asks for a specific model or effort level. --cwdscopes the workspace for task, review, status, history, result, cancel, and stats. Status, result, and cancel search all recorded workspaces by strict job id when--cwdis omitted, while history remains workspace-scoped unless--allis explicit. A bad working directory, or an implicit task or review working directory below its Git repository root, fails before a job record is created. Worktree isolation means creating a real Git worktree before launch and supplying that canonical path as the actual cwd. Headless--worktreeand--worktree-refare not a substitute.--jsonreturns structured output for task, review, status, history, result, cancel, stats, and setup. Preflight failures with--jsonreturn a structured error object on stderr. Headless stdout is captured through a 0600 file that is unlinked immediately after a successful open, parsed in full through the still open descriptor under a total size limit, and reduced to a bounded tail for diagnostics.- Review requires and passes one
--json-schemacontract and consumesstructuredOutputfrom the same Grok call. A reported structured output error or explicit null result fails the review. Compatibility parsing oftextis limited to a response that completely omits the structured output field and never triggers a second call. - The stop gate is primarily toggled by the plugin's
Stop gate reviewsetting in Claude Code's plugin configuration;setup --enable-stop-gateandsetup --disable-stop-gatepersist the same toggle locally as a scripting fallback and only take effect when that setting is left unset. The Stop hook reads the first nonempty reply line:ALLOWpermits stopping andBLOCK: <reason>blocks it; a preamble beforeBLOCKand infrastructure failures fail open. Stop gate runs are always fresh and memory-disabled. After collection, the hook adds a non-blocking advisory when collected workers remain acceptance unverified. SessionEnd attempts verified process cleanup for jobs owned by that Claude session and removes verified unused raw transports; it does not delete the terminal companion ledger. cancelaccepts active foreground or background job ids. It waits for process cleanup before rendering the cancelled record.- Job outcomes carry a
state:line (done,error, orcancelled). JSON records keepstatusandtransportStatusequal, keep semantic acceptance atsemanticStatus: "unverified", distinguish delivery mode from delivery status, and record the observed resolved model and effort when Grok exposes them. They also preserve reported request id, session id, turn count, structured output, aggregate and per-model usage, total cost, cost ticks, partial cost, and incomplete billing indicators without inventing missing values. Upstreammodel_usagerows contain onlyinput,output,cacheRead, andmodelCalls, plus optionalcostUSD; never synthesize aggregate reasoning or total token channels from them. The upstream map is namedmodelUsagein the headless envelope, and its keys are the only source for model names when usage attaches. Error and cancelled outcomes carry afailure: <kind>line; cancelled jobs usefailure: cancelled. - Stats aggregate reported turn counts separately from coverage.
usage_is_incompletemeans the upstream usage ledger may have missed open subagents, usage application, or a drain timeout. Reported token fields then remain observed lower bounds, but job-total token and cost coverage both fail closed to incomplete and those values stay out of exact totals. Exact cost otherwise requires a finite positive top-level USD and tick pair with neither partial marker set; ticks are authoritative at 10000000000 per USD. - Native Grok session storage is independent from the companion ledger. Upstream native sessions are retained for 30 days by default.
~/.grok/config.tomlaccepts a positive integer at[storage] cleanup_ttl_days;0falls back to the default 30 days. The companion promises no automatic garbage collection for job records, briefs, or logs under~/.claude/plugins/data/grok-claude-code-fusion/; remove that data directory manually only after no running job, uncollected result, history entry, or resume evidence is needed. - Upstream ships ACP today, but the companion has not adopted it and continues per-call invocation. Any future companion implementation pools processes by canonical cwd plus sandbox profile and launches each directly as
grok --cwd <canonical> --sandbox <profile> agent --no-leader stdio, because the sandbox is installed once at process start and a reused leader can retain the wrong cwd or sandbox. - Return the helper output exactly as-is, whether the Bash tool reports it from stdout or stderr.
- If the Bash call fails or Grok cannot be invoked, surface the failure instead of hiding it; the grok-rescue agent returns exactly one
grok unavailable: <reason>line for the orchestrator's circuit breaker.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 55 lines · 19 tokens per session scan A 7a39314e2564
grok-cli-runtime is a skill published in the GitHub repository okisdev/claude-code-fusion (3 stars, last pushed 15d ago), licensed MIT. It adds 19 tokens to every session and 4,318 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
agent-orchestrator
Meta-skill que orquestra todos os agentes do ecossistema. Scan automatico de skills, match por capacidades, coordenacao de workflows multi-skill e registry management.
crewai-multi-agent
Multi-agent orchestration framework for autonomous AI collaboration. Use when building teams of specialized agents working together on complex tasks, when you need role-based agent collaboration with memory, or for production workflows requiring sequential/hierarchical execution. Built without LangChain dependencies…
project-orchestration
Orchestrate multi-agent workflows for feature development using planning agents, context handoff, and stage management.
hyperflow
Use when applying Hyperflow's orchestration doctrine in Codex, Antigravity, Grok, or another single-agent surface. Auto-invoke for non-trivial engineering work: build, implement, add, refactor, debug, fix, review, audit, plan, scope, design, brainstorm, ship, or deploy. Trigger with /hyperflow:hyperflow, "use…
skill-creator
Generates Anthropic Skills with complete workflow including GitHub PR creation and local download verification.
Ability Generator
This skill generates markdown skill templates to be later used.