8.3 KiB
name, description, version, author, license, platforms, metadata
| name | description | version | author | license | platforms | metadata | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ask-grok | Delegate tasks to Grok 4.5 or Grok Build on 10.0.0.15. | 1.0.0 | Hermes Agent | MIT |
|
|
ask-grok — Delegate Tasks to Grok on 10.0.0.15
Two modes, one skill:
| Mode | Command | Behavior | Session |
|---|---|---|---|
| Quick ask | ask grok | Inline, fire-and-forget | Stateless |
| Project | ask grok build | Background, persistent | Named session (-s) |
Models
- grok / ask grok → grok-4.5 (flagship, 500K ctx, $2/$6 per M)
- grokb / ask grokb → grok-build-0.1 (coding-specific, 256K ctx, $1/$2 per M)
Infrastructure
- Host: 10.0.0.15 (LXC)
- Binary: ~/.grok/bin/grok v0.2.112 (NOT in PATH — use full path)
- Auth: XAI_API_KEY env var already set on the LXC
- Config: ~/.grok/config.toml — add --no-auto-update in every invocation
- SSH: sshpass -p 'passw0rd' ssh -o StrictHostKeyChecking=no [email protected]
Mode 1: Quick Ask (ask grok / ask grokb)
Inline one-shot. Fire, wait for response, relay answer. No session tracking.
Command
sshpass -p 'passw0rd' ssh -o StrictHostKeyChecking=no [email protected] \
"XAI_API_KEY=\"\$XAI_API_KEY\" ~/.grok/bin/grok --no-auto-update --no-alt-screen \
-m MODEL -p 'PROMPT' --output-format json --yolo"
- MODEL: grok-4.5 for ask grok, grok-build-0.1 for ask grokb
- PROMPT: the composed prompt (see Prompt Composition below)
- --yolo: skip approval prompts (required for headless)
- --no-auto-update: suppress background update checks
- --no-alt-screen: inline output, no TUI takeover
Post-Dispatch
Return control to the operator immediately after relaying the answer. Do NOT poll, do NOT check. This is a one-shot — there is no session to track.
Mode 2: Project Mode (ask grok build / ask grokb build)
Background process with named session persistence. Grok has full tool access (bash, file ops, web search) in its workspace on the LXC.
Command
terminal(background=true, notify_on_complete=true, timeout=3600,
command="sshpass -p 'passw0rd' ssh -o StrictHostKeyChecking=no [email protected] \
\"XAI_API_KEY=\\\"\$XAI_API_KEY\\\" ~/.grok/bin/grok --no-auto-update --no-alt-screen \
-m MODEL -s PROJECT_NAME -p 'PROMPT' --output-format json --yolo\"",
workdir="/home/n8n/workspace/general")
- MODEL: grok-4.5 for ask grok build, grok-build-0.1 for ask grokb build
- SESSION_UUID: generate with
python3 -c "import uuid; print(uuid.uuid4())"— Grok REQUIRES a valid UUID, kebab-case names are rejected - -s SESSION_UUID: creates or resumes a named session — persists across turns. Save the UUID for follow-ups.
- Background with notify_on_complete=true — the user is notified when Grok finishes
Follow-up Turns
Same command, same -s SESSION_UUID. Grok resumes the session and remembers prior context.
Post-Dispatch
Return control to the operator immediately. Do NOT poll, do NOT check for results. The notify_on_complete notification will fire when Grok finishes. The operator reads results when they want to.
Prompt Composition
Quoted Text (Verbatim)
When the user wraps their instruction in double quotes, pass the exact text inside the quotes verbatim. No framing, no context, no rephrasing.
Example: ask grok "what is the capital of France?" → prompt is exactly: what is the capital of France?
Unquoted Text (Composed)
When the user does NOT use quotes, compose a prompt with appropriate framing:
- Include relevant context (what we're working on, what's been decided)
- Include absolute file paths the user referenced (Grok can't read them, but the context helps)
- State the expected output format
- Keep it concise — Grok is a narrow subagent for this task
For Mode 1 (quick ask) unquoted prompts, prepend this output contract:
Be concise. Lead with the answer. No greetings, no restating the question, no filler ("Certainly", "Great question", "I'd be happy to"), no closers ("Want me to...", "Let me know if..."), no unnecessary headers or markdown.
Default: 1-3 sentences or 3-5 bullets. Expand only for explicit deliverables. Prefer plain text; use structure only when it cuts tokens or ambiguity. Omit hedging, apologies, and self-narration. Skip preamble and recap — answer, then stop.
Output Parsing
The --output-format json response includes:
- text — Grok's answer text
- sessionId — session identifier (capture for mode 2 follow-ups, discard for mode 1)
- usage — token counts (input, output, cache, reasoning)
- total_cost_usd — cost in USD
Parse with Python:
import json, sys
d = json.load(sys.stdin)
answer = d.get('text', '(empty)')
session_id = d.get('sessionId', '')
print(answer)
Relay only the answer text. No footer, no usage stats, no session ID (unless the user asks).
When to Use
- User says "ask grok", "ask grokb", "ask grok build", "ask grokb build"
- Want a second opinion from a different model
- Delegated research, analysis, or code review
- Project work that benefits from Grok Build's toolset (bash, file ops, web search)
When NOT to Use
- Simple factual question I can answer directly
- Task that needs Hermes-native tools (SearXNG MCP, Qdrant, etc.)
- Task that needs access to the Hermes host filesystem (Grok is isolated on 10.0.0.15)
- User explicitly says "quick search" or "just look it up"
Critical Evaluation — You Are the Final Authority
Grok's output is input, not a decision. You are the engineer — you own the code, the system, and the final call. Grok is a separate agent with no memory of your conversation, no access to your files, and no ability to verify its own claims against your environment.
Mandatory before acting on Grok's output:
- Do your own reasoning first. Does this make sense? Is there a simpler way? Would this actually work in our environment?
- Push back when Grok is wrong. If Grok's analysis doesn't hold up, tell it so in a follow-up turn (mode 2). "Your claim about X is wrong because Y. Re-examine."
- Do your own web searches to validate. For any claim about API behavior, version compatibility, or tool capabilities, run your own mcp_searxng_searxng_web_search and compare.
- Involve the user when there's genuine ambiguity. If Grok and you disagree after a round of pushback, surface the disagreement with both positions stated clearly.
Grok's Limitations
- Grok cannot read files on the Hermes host. Grok runs on 10.0.0.15 and has no access to /home/n8n/workspace/ or any other local path. File paths in prompts are for context only — Grok cannot open them.
- Grok's environment is not your environment. Grok has its own filesystem, its own tools, and its own constraints. A command that works in Grok's environment may fail in yours.
- Grok self-reports are not verified fact. If Grok reports a file write or a test pass, you cannot verify it from the Hermes host. Treat as unverified.
Common Pitfalls
- SSH quoting. The prompt is passed through multiple shell layers (Hermes terminal → ssh → bash → grok). Single quotes in the outer layer, escape internal quotes. Test with a simple prompt first if unsure.
- --yolo is required. Without it, approval prompts fail closed in headless mode and Grok returns empty.
- --no-auto-update is required. Without it, Grok may pause for update checks during headless runs.
- --no-alt-screen is required. Without it, Grok tries to take over the terminal with a TUI.
- Mode 2 sessions persist on the LXC. Named sessions (-s) accumulate in ~/.grok/sessions/ on 10.0.0.15. No auto-cleanup. The user may want to prune old sessions periodically.
- Grok Build has its own toolset. bash, web_search, web_fetch, read_file, grep_search, list_dir, todo_write, task (subagents), memory. These operate on the LXC filesystem, not the Hermes host.
- No file staging. Unlike ask-claude (which uses scp for large artifacts), ask-grok passes everything inline. Grok cannot reach the Hermes host filesystem. If Grok needs file content, the user must provide it in the prompt.
- Mode 1 has no memory. Each ask grok is a fresh conversation. Grok does not remember prior asks. For multi-turn work, use mode 2.
- -s requires a UUID, not a name.
-s burn-the-helix-kitchenfails with "must be a valid UUID". Generate withpython3 -c "import uuid; print(uuid.uuid4())"and save the UUID for follow-up turns.