grok-cli-collab
Use when the user invokes /grok-cli-collab, $grok-cli-collab, asks Codex to collaborate with Grok through the local Grok CLI, says to call Grok directly, or wants sticky Grok CLI collaboration for the rest of the session.
- License 许可
- MIT
- 最近更新
- 2026-07-19
- Stars
- ★ 1
- Forks
- 1
01 前言 Front Matter
- name
- grok-cli-collab
- description
- Use when the user invokes /grok-cli-collab, $grok-cli-collab, asks Codex to collaborate with Grok through the local Grok CLI, says to call Grok directly, or wants sticky Grok CLI collaboration for the rest of the session.
02 资源文件 1
- 脚本scripts/grok_cli.py3.6 KB
03 SKILL.md 正文
Grok CLI Collab
Use this skill when Codex should collaborate with Grok through the local Grok CLI.
Sticky Session Behavior
When the user invokes this skill, keep using Grok CLI collaboration for the rest of the current Codex session unless the user explicitly says to stop, disable it, or switch collaboration modes.
Do not wait for the user to say "check Grok" or "ask Grok" during an active collaboration loop. When Grok input is useful, call Grok directly.
Contract
Grok CLI is the live collaboration channel.
Use Grok CLI for:
- peer reasoning;
- second-pass pressure;
- research objections;
- experiment design feedback;
- repo-aware technical judgment;
- follow-up questions that would otherwise require the user to relay messages.
Do not use Agent Bus MCP as the live back-and-forth channel when this skill is active. Do not use the xAI API Grok path for this mode.
The repository remains the source of truth for durable artifacts, code, evidence, outputs, and documentation.
Command Modes
Always pass the working directory explicitly.
Normal Mode
Use normal mode for live collaboration, follow-up questions, and repo-aware discussion that should preserve the current Grok session:
grok \
--cwd /absolute/path/to/repo \
--always-approve \
--continue \
--prompt-file /tmp/grok-task.md \
--output-format plain \
--max-turns 3
Use the current repository root as --cwd. For the prime-gap-structure repo,
that is:
/Users/velocityworks/IdeaProjects/prime-gap-structure
Use --continue by default to preserve the most recent Grok session for the
working directory. Use --resume <SESSION_ID> only when the user or prior
evidence identifies a specific Grok session to continue.
Use --always-approve every time. The local Grok project may be untrusted, and
this flag prevents approval prompts from stalling collaboration.
Use --output-format plain by default. Grok's JSON output includes extra
metadata and may expose fields that are noisy for ordinary collaboration.
Parallel Reasoning Mode
Use parallel reasoning mode when the next Grok call should pressure a result from multiple attempts without carrying prior session state:
grok \
--cwd /absolute/path/to/repo \
--always-approve \
--best-of-n 2 \
--prompt-file /tmp/grok-task.md \
--output-format plain \
--max-turns 10 \
--disable-web-search
Do not use --continue in parallel reasoning mode. The clean prompt and the
repository state are the intended context.
Role-Agent Mode
Use role-agent mode when the research needs explicit lenses, such as boundary critic, experiment designer, grammar compressor, or evidence auditor:
grok \
--cwd /absolute/path/to/repo \
--always-approve \
--best-of-n 3 \
--agents '{"boundary_critic":{"description":"Pressure-test candidate PEDK rules","instructions":"Find falsification risks and public-state boundary failures."}}' \
--prompt-file /tmp/grok-task.md \
--output-format plain \
--max-turns 10 \
--disable-web-search
Do not use --continue in role-agent mode until clean isolation from old bus
context has been revalidated.
Helper Script
Prefer the bundled helper for repeatable CLI calls:
python /Users/velocityworks/.codex/skills/grok-cli-collab/scripts/grok_cli.py \
--cwd /Users/velocityworks/IdeaProjects/prime-gap-structure \
--max-turns 3 \
--prompt-file /tmp/grok-task.md
Normal helper mode invokes:
grok --cwd <cwd> --always-approve --continue --prompt-file <file> --output-format plain
Parallel helper mode starts a clean Grok run:
python /Users/velocityworks/.codex/skills/grok-cli-collab/scripts/grok_cli.py \
--mode parallel \
--best-of-n 2 \
--cwd /Users/velocityworks/IdeaProjects/prime-gap-structure \
--prompt-file /tmp/grok-task.md
Role-agent helper mode reads the JSON agent map from a file:
python /Users/velocityworks/.codex/skills/grok-cli-collab/scripts/grok_cli.py \
--mode roles \
--best-of-n 3 \
--agents-file /tmp/grok-agents.json \
--cwd /Users/velocityworks/IdeaProjects/prime-gap-structure \
--prompt-file /tmp/grok-task.md
It also avoids zsh's read-only status variable issue by managing exit codes
inside Python.
Prompt Style
Write Grok prompts as focused task briefs.
Include:
- the collaboration role;
- whether Grok may edit files;
- exact repository paths when relevant;
- current evidence or result summaries;
- the precise question or objection requested;
- required output shape.
Default to non-mutating prompts unless the user explicitly asks Grok to edit or implement. If Grok may edit files, state the exact write scope.
For research work, ask Grok for:
- strongest objection;
- falsification criterion;
- next measurable object;
- interpretation of a measured result;
- one concrete experiment design.
For parallel and role-agent calls, make the prompt self-contained. Include the measured result, exact paths, candidate rule, falsification boundary, and requested output shape because those modes do not inherit the live session.
Do not send Grok Codex's hidden reasoning. Send the evidence and the question.
Output Handling
After Grok returns:
- summarize the useful contribution;
- preserve material disagreement;
- continue the work without asking the user to mediate;
- cite repo paths and measured outputs when Grok's answer changes the work;
- do not pretend Grok participated if the CLI call failed.
If Grok proposes an experiment or code change, Codex remains responsible for reviewing, implementing, and validating it in the shared repo.
Known Good Validation
This command shape has been validated in prime-gap-structure:
--cwd set the repo root correctly
--always-approve allowed read-only tool execution
--continue preserved session continuity
--prompt-file worked for task transport
plain stdout capture worked
normal helper mode returned GROK_HELPER_NORMAL_CHECK_OK
parallel helper mode returned GROK_HELPER_PARALLEL_OK
role-agent helper mode returned GROK_HELPER_ROLES_OK
The Grok CLI --check flag is not a lightweight dry run in this workflow. It
can consume internal turns and fail with max_turns exceeded; validate helper
changes with real plain-output smoke prompts instead.
The active tested Grok session id was:
019e2e0b-ca71-7a22-a28e-b7ca6d0b4400
Failure Rule
If the Grok CLI call fails:
- report the exact command shape and error;
- do not silently fall back to Agent Bus or xAI API;
- do not pretend Grok participated;
- continue locally only if the user has asked Codex to proceed despite Grok being unavailable.
04 同仓库更多 Skills
Zotero
Use Zotero Desktop from Codex to enable/probe the local API, search a local Zotero library, list items/collections/tags, export BibTeX, insert citation keys into LaTeX or Markdown drafts, read indexed full text when requested, and import BibTeX/RIS records into Zotero through the connector server. Use when the user mentions Zotero, citations, references.bib, BibTeX export, local Zotero API, localhost:23119, or adding citations from a Zotero library.
zoom-apps-sdk
Use when using Apps SDK.
youtube
Obtain accurate, timestamped YouTube video transcripts (preferring manual captions over auto-generated) as the primary deliverable, then derive summaries, key claims, or notes from that transcript. Use when the user provides a YouTube URL (or video ID) and wants the transcript, a faithful summary, key claims with attribution, timestamped notes, or "what does this video actually say". The skill is transcript-first: never substitute metadata, title, description, or search snippets for the spoken content. Triggers: "youtube transcript", "get the transcript of this video", "summarize this youtube video", "what did they say in https://youtube.com/...", "key claims from this talk".
yeet
Publish local changes to GitHub by confirming scope, committing intentionally, pushing the branch, and opening a draft PR through the GitHub app from this plugin, with `gh` used only as a fallback where connector coverage is insufficient.
x-post-creator
Create X-ready post threads and co-located story packages from the active conversation or referenced project material. Use when the user says turn this into an X-post, /x-post, make this into an X thread, or wants plain-language social posts with supporting images saved to docs/x-posts/[story-name]/.
x-api
Search, read, and write X posts through the local X API MCP server (the same backend used by the Codex x-api skill). Use for searching X/x.com, reading threads and replies, creating lists, staging/publishing posts for @alltheputs, finding high-visibility reply targets for research outreach, ingesting public context, or any request that mentions /x-api or "search X".