/grug-brain:ingest sourcefrom grug-brain
Ingests documentation from local directories or GitHub repos into grug-brain for FTS-indexed search. Supports full repos and subfolder paths.
Ships in grug-brain. Installing the plugin adds it to Claude Code.
Add documentation to grug-brain as a brain entry. Each doc set lives in a directory that grug-brain indexes on startup. Docs are searchable via grug-search and grug-read.
$ARGUMENTS contains the source. Handle each type:
github:<owner>/<repo>): Clone entire repo, ingest all markdown.github:<owner>/<repo>/<path>): Clone repo, ingest only the specified subfolder. Examples:
github:ryanthedev/grug-docs/agentic-planning — entire categorygithub:ryanthedev/grug-docs/agentic-planning/extractions — just extractionsParse the GitHub source by splitting on / after github: — first two segments are owner/repo, the rest is the path within the repo.
Short, lowercase, hyphens only (e.g., react-native, agentic-planning).
agentic-planning from agentic-planning/extractions).The target directory is where docs will live on disk. Default: ~/.grug-brain/<brain-name>/. Ask the user if they prefer a different location.
Check if a brain with this name already exists in ~/.grug-brain/brains.json:
cat ~/.grug-brain/brains.json 2>/dev/null
If a brain with this name already exists and has a source field, offer to re-ingest from the stored source without asking for the source again. If the user confirms, skip step 1 and use the stored source. If no source is stored, ask: update (provide source again), or cancel?
rsync -av --include='*/' --include='*.md' --include='*.mdx' --exclude='_*' --exclude='.*' --exclude='*' <source>/ <target-dir>/
Clone shallowly:
git clone --depth 1 <repo-url> /tmp/grug-ingest
Where <repo-url> is https://github.com/<owner>/<repo>.git (only owner/repo, not the subfolder path).
Determine the source directory inside the clone:
find /tmp/grug-ingest -maxdepth 3 -type d -name docs -o -name documentation -o -name content | head -5). If no obvious docs dir, list top-level and ask the user./tmp/grug-ingest/<path> directly. If it doesn't exist, list what's available and ask.Copy the files, preserving structure relative to the source:
rsync -av --include='*/' --include='*.md' --include='*.mdx' --exclude='_*' --exclude='.*' --exclude='*' /tmp/grug-ingest/<source-dir>/ <target-dir>/
rm -rf /tmp/grug-ingest
If zero files were copied, report the error and do not proceed. Check:
find <target-dir> -name '*.md' -o -name '*.mdx' | wc -l
After files are in place, add (or update) the brain entry in ~/.grug-brain/brains.json.
Read the current config:
cat ~/.grug-brain/brains.json 2>/dev/null || echo '[]'
Add the new entry. Ingested docs brains are read-only and non-primary. Include the source field using the original source argument so re-ingestion can use it without re-asking:
{
"name": "<brain-name>",
"dir": "<target-dir>",
"primary": false,
"writable": false,
"flat": false,
"git": null,
"source": "<original source argument, e.g. github:owner/repo/path or local absolute path>"
}
If the directory structure is flat (all files at top level, no category subdirectories), use "flat": true instead.
Write the updated array back to ~/.grug-brain/brains.json. Preserve all existing entries — only add or replace the entry for this brain name.
Tell the user:
/setup)github:org/grug-docs/agentic-planning/extractions~/.grug-brain/brains.json and restart the MCP server.What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
Generated from the plugin's indexed repository (ryanthedev/grug-brain.mcp) — no native marketplace selected
npx claudepluginhub p/ryanthedev-grug-brain3 commands in this plugin
Other plugins' commands for the same job