context
Analyze and optimize Claude Code's context configuration (analyze, optimize, or reset).
Bootstrap a new project with the scaffolding CLAUDE.md, settings.json, and `.scaffolding/` directory structure.
> /plugin marketplace add komluk/scaffolding > /plugin install scaffolding@komluk-scaffolding
How it fires
How this command gets triggered: by you, by Claude, or both.
/init-scaffoldingContext preview
What this command does when you run it.
Bootstrap a new project with the scaffolding CLAUDE.md, settings.json, and `.scaffolding/` directory structure.
Bootstrap a new project with the scaffolding CLAUDE.md, settings.json, and `.scaffolding/` directory structure.
/init-scaffolding
Run from the root of a project that was set up via `/plugin install scaffolding@komluk-scaffolding`. This command creates the `.scaffolding/` directory structure, copies the routing protocol and settings into the project so Claude respects the agent delegation rules on every session.
1. Locates the installed plugin directory (searches known marketplace cache paths) 2. Creates `.scaffolding/` directory structure for agent memory, conversations, and specs 3. Adds `.scaffolding/` to `.gitignore` 4. Copies `CLAUDE.md` to `$CWD/CLAUDE.md` — always overwrites with latest from plugin 5. Copies `settings.json` to `$CWD/.claude/settings.json` — always overwrites with latest from plugin 6. Copies `hooks/*.sh` to `$CWD/.claude/hooks/` — always overwrites with latest from plugin 7. Reports what was copied
Follow these steps exactly:
Search for the plugin in the known Claude Code plugin cache location:
PLUGIN_ROOT=""
# Search helper: find latest version directory containing CLAUDE.md under a base path
find_plugin_root() {
local base="$1"
[ -d "$base" ] || return
# Try versioned path: base/scaffolding/<version>/CLAUDE.md
local latest
latest=$(find "$base" -name "CLAUDE.md" -path "*/scaffolding/*/CLAUDE.md" 2>/dev/null | sort -V | tail -1 | xargs dirname 2>/dev/null || true)
if [ -n "$latest" ] && [ -f "$latest/CLAUDE.md" ]; then
echo "$latest"
return
fi
# Fallback: any CLAUDE.md anywhere under this base
latest=$(find "$base" -name "CLAUDE.md" 2>/dev/null | sort -V | tail -1 | xargs dirname 2>/dev/null || true)
if [ -n "$latest" ] && [ -f "$latest/CLAUDE.md" ]; then
echo "$latest"
return
fi
}
# Unix / macOS (Linux, macOS, WSL)
for base in \
"$HOME/.claude/plugins/cache/komluk-scaffolding" \
"$HOME/.claude/plugins/marketplaces/komluk-scaffolding"; do
found=$(find_plugin_root "$base")
if [ -n "$found" ]; then
PLUGIN_ROOT="$found"
break
fi
done
# Windows (Git Bash / MSYS2) — USERPROFILE and LOCALAPPDATA are set by the shell
if [ -z "$PLUGIN_ROOT" ]; then
for base in \
"${USERPROFILE:-}/.claude/plugins/cache/komluk-scaffolding" \
"${LOCALAPPDATA:-}/claude/plugins/cache/komluk-scaffolding"; do
[ -n "$base" ] || continue
found=$(find_plugin_root "$base")
if [ -n "$found" ]; then
PLUGIN_ROOT="$found"
break
fi
done
fi
echo "Plugin root: ${PLUGIN_ROOT:-NOT FOUND}"If `PLUGIN_ROOT` is empty, report that the plugin was not found and stop. The user may need to run `/plugin install scaffolding@komluk-scaffolding` first.
mkdir -p .scaffolding/conversations mkdir -p .scaffolding/agent-memory/shared mkdir -p .scaffolding/agent-memory/agents mkdir -p .scaffolding/worktrees mkdir -p .scaffolding/openspec/specs mkdir -p .scaffolding/openspec/schemas mkdir -p .scaffolding/reports echo "CREATED: .scaffolding/ directory structure"
# Check if .gitignore exists and if .scaffolding/ is already in it if [ -f ".gitignore" ]; then grep -q "^\.scaffolding/" .gitignore || echo -e "\n# Claude Scaffolding\n.scaffolding/" >> .gitignore else echo -e "# Claude Scaffolding\n.scaffolding/" > .gitignore fi echo "UPDATED: .gitignore — .scaffolding/ is excluded from git"
cp "$PLUGIN_ROOT/CLAUDE.md" "$CWD/CLAUDE.md" echo "COPIED: CLAUDE.md -> $CWD/CLAUDE.md (overwritten with latest)"
mkdir -p "$CWD/.claude" cp "$PLUGIN_ROOT/settings.json" "$CWD/.claude/settings.json" echo "COPIED: settings.json -> $CWD/.claude/settings.json (overwritten with latest)"
mkdir -p "$CWD/.claude/hooks" cp "$PLUGIN_ROOT/hooks/"*.sh "$CWD/.claude/hooks/" chmod +x "$CWD/.claude/hooks/"*.sh echo "COPIED: hooks/ -> $CWD/.claude/hooks/ (all hook scripts)"
Print a summary listing each action: CREATED/UPDATED/COPIED or SKIPPED, and its destination path.
After initializing, inform the user:
the project root after running this command
Spec-driven multi-agent orchestration for Claude Code — pure markdown, zero backend, runs on the stock runtime. 13 agents, 36 skills, 19 commands, 15 hooks, per-phase model tiers, opt-in lifecycle hooks, optional cross-device semantic memory.
Repo: komluk/scaffolding
Analyze and optimize Claude Code's context configuration (analyze, optimize, or reset).
Scaffold a new scaffolding-compatible skill: an interactive flow that creates `skills/<name>/SKILL.md` from the canonical template, composes a `TRIGGER`/`SKIP`…
Health-check the scaffolding install and report install problems plus exact fixes (diagnose-only, never mutates).
Initialize OpenSpec in a project directory with the scaffolding-workflow schema.
Scaffold opt-in path-scoped nested CLAUDE.md rule files into the project to lazy-load per-area conventions while keeping routing always-loaded.