- Introduce .grok/context.md for Grok CLI workflows, MCP tool examples, and best practices. - Add .grokignore to optimize context by excluding large files and binaries. - Create CONTEXT.md as a general LLM context guide adaptable across platforms. - Update README.md for provider-agnostic structure, Grok CLI integration, and generalized docs. - Fix paths in config/claude_desktop_config.json to match new repository location.
5.5 KiB
5.5 KiB
Grok CLI Context Guide for this Repository (llm-tools)
This document provides persistent context, best practices, and usage patterns for Grok CLI Agent mode when working in this repository. It is automatically included in context (via .grok/context.md convention or explicit inclusion) to keep interactions model-provider agnostic, efficient, and aligned with the tools/skills here.
Core Principles
- Provider Agnostic: All documentation, prompts, and workflows should work for Claude, Grok, or any MCP-compatible LLM. Avoid platform-specific assumptions (e.g., prefer MCP tools over Claude-only skills where possible). Update README.md, SKILL.md, and sub-READMEs accordingly.
- MCP-First: Leverage the built-in MCP tools exposed in Grok CLI (prefixed
mcp_dicom-mcp__*,mcp_filesystem-mcp__*,mcp_playwright-mcp__*,mcp_selenium-mcp__*,mcp_github__*,mcp_us-weather-mcp__*, etc.). These map directly to the MCP servers in./mcps/. - Sub-Agent System: Use the
tasktool proactively:general: Multi-step execution, editing, implementation.explore: Fast read-only research, reviews, "how does this work?".verify: Sandbox-aware builds, tests, validation.computer: Desktop interaction (snapshots, clicks, typing, screenshots).- Prefer
delegatefor long-running read-only background work.
- Workflow Priorities (from system instructions):
- Understand the request.
- Decide on sub-agent for investigation (default to
taskfor review/research/bug triage/verification). - Use
read_file,bashfor direct exploration (small tasks). bashwithbackground=truefor servers/watchers.delegatefor parallel read-only work.edit_file(surgical),write_file(new/full rewrites).- Verify with reads, tests, builds.
search_web/search_xfor up-to-date info.
- Tool Preferences:
- File ops: Dedicated
read_file/write_file/edit_fileover bash. - Edits:
edit_filefor targeted changes (unique old_string + context);write_fileonly for new files or full overwrites. - Background: Use for dev servers; manage with
process_*tools. - Schedules: Use
schedule_*tools for recurring tasks. - Images/Video:
generate_image/generate_video. - Payments/Wallet:
wallet_*,paid_request,fetch_payment_info. - Desktop:
computer_*tools (snapshot first for stable @e refs). - MCP: Call directly (e.g.,
mcp_dicom-mcp__dicom_summarize_directory); see individual MCP READMEs for params.
- File ops: Dedicated
- Context Management: This file +
.grokignorekeep context lean. Avoid loading binaries, large dirs, or node_modules. Explicitly include key files (README.md, SKILL.md, specific MCP docs) when needed.
Key Directories & When to Use
- mcps/: Launch MCP servers via scripts (e.g.,
bash mcps/dicom_mcp/run_dicom_mcp_server.sh). Use correspondingmcp_*tools in Grok.- dicom_mcp: QA for DICOM (Dixon, SNR, metadata, rendering, validation). Start here for medical imaging tasks. See mcps/dicom_mcp/README.md + docs/.
- Others: filesystem (ops), open_meteo (weather), playwright/selenium (browser automation/testing).
- skills/: Reusable agent instructions. Read
SKILL.mdfiles for patterns (e.g., mcp-builder for new MCPs, artifacts-builder for UIs, document-skills for Office/PDF). Adapt YAML frontmatter + guidelines into prompts or custom tools.mcp-builder/SKILL.mdis especially valuable for extending this repo. - config/ & .claude/: Claude-specific; update paths in claude_desktop_config.json for cross-machine use. Ignore for Grok workflows.
- .mcp.json: Registers MCPs for Claude Code; useful reference for tool signatures.
Best Practices for Grok CLI in this Repo
- Exploration:
taskwithexploreagent first for reviews/research ("review this change", "how does MCP X work?"). Follow withgeneralfor edits. - Verification: Always use
verifysub-agent for builds/tests/smoke tests before/after changes. - Editing: Quote sufficient unique context in
edit_file. Verify by re-reading the file. - DICOM QA: Prefer
mcp_dicom-mcp__*tools (e.g.,dicom_summarize_directory,dicom_compute_snr,dicom_render_image). Usedicom_read_pixels+dicom_compute_snrwith ROIs identified via render. - Browser Automation: Choose playwright-mcp for modern snapshots/eval; selenium-mcp for multi-session or specific WebDriver needs. Combine with
computer_*if testing desktop apps. - Avoid: Loading entire node_modules, large image/DICOM dirs (use .grokignore), or Claude-only phrasing. For long research,
delegatetoexplore. - Extending: Follow skills/mcp-builder/SKILL.md phases (research/planning → implementation → evaluation). Use mcp_github__* tools for PRs/commits if working on remote repos.
- Scheduling: Use
schedule_createfor recurring checks (e.g., daily DICOM validation or security scans).
Quick MCP Tool Examples (Grok CLI)
- Summarize DICOM dir:
mcp_dicom-mcp__dicom_summarize_directory(directory=..., recursive=true). - Filesystem write:
mcp_filesystem-mcp__write_file(after setting default if needed). - Browser:
mcp_playwright-mcp__browser_navigateormcp_selenium-mcp__selenium_navigate. - Weather:
mcp_uk-weather-mcp__get_forecastor open-meteo equivalent.
Refer to this file in prompts: "Follow the Grok CLI context in .grok/context.md, the updated README.md, and relevant SKILL.md files. Keep all outputs provider-agnostic."
Update this context.md as the repo evolves (e.g., new MCPs, refined workflows). For full tool list, inspect available tools or run grep -o 'mcp_[^ ]*' -r . --include="*.py" | sort | uniq.