/interlock:bootstrap [--quick] [--scope <path>]from Interlock
Onboard a brownfield project into OpenSpec by analyzing the existing codebase with parallel explorer agents, writing an initial architecture document, and generating one spec per discovered feature describing what is already built.
Ships in Interlock. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Document what a codebase already is, in OpenSpec form, so that every later change has something to change from.
This is archaeology, not design. Every spec you write describes behavior that exists in the code today. If you cannot point at the code that implements a requirement, it does not belong in the spec.
| Flag | Effect |
|---|---|
--quick | Sequential, single-context. For small repos (< ~50 source files). |
--scope <path> | Restrict the whole run to a subdirectory. |
| (none) | Full parallel run. |
openspec --version
If it does not print a version, stop here, before openspec init, before interlock-graph build, before spawning any explorer or writing any file — even when openspec/config.yaml already exists, because the specs this skill writes are only done once openspec validate passes.
command not found (or the shell's equivalent): the CLI is missing. Say so in one line, then run interlock openspec provision, which installs the pinned OpenSpec into the plugin's own data directory, and probe openspec --version again. If provisioning exits non-zero, quote its first line and stop; a sandbox-refused write means one run of the same command outside the sandbox. The user's own route stays npm install --location=global @fission-ai/[email protected], or the project's own package manager if it pins openspec.interlock or interlock-graph that answers command not found means this session predates the plugin. Until a new session, run node "${CLAUDE_PLUGIN_ROOT}/cli/interlock" (or …/cli/interlock-graph) instead; those calls match no allow rule, so each asks for approval.interlock doctor's node row names the floor and the Node it found.Either way, point at interlock doctor for the full preflight. Do not install or upgrade anything yourself, except by running interlock openspec provision, and do not hand-write openspec/config.yaml or openspec/specs/ — the CLI owns those formats.
# Initialize OpenSpec if this repo has never been initialized.
# `openspec init` creates openspec/config.yaml, so its absence is the real signal.
test -f openspec/config.yaml || openspec init --tools claude
# Build the structural graph once — it seeds every explorer below.
# Never swallow the outcome: stderr stays visible, and every way the graph can
# come back less than whole (build errored / nothing readable / nothing
# indexable / some paths unreadable) gets a banner.
graph_log=$(interlock-graph build .)
graph_status=$?
printf '%s\n' "$graph_log"
if [ "$graph_status" -ne 0 ]; then
echo "GRAPH UNAVAILABLE: build errored (exit $graph_status) — explorers fall back to grep and will be slower"
elif printf '%s' "$graph_log" | grep -q 'nothing indexable under the root could be read'; then
echo "GRAPH UNAVAILABLE: nothing under the root could be read — explorers fall back to grep and will be slower"
elif printf '%s' "$graph_log" | grep -q 'nodes=0'; then
echo "GRAPH UNAVAILABLE: nothing indexable found — explorers fall back to grep and will be slower"
elif printf '%s' "$graph_log" | grep -q 'skipped='; then
echo "GRAPH PARTIAL: some paths were unreadable and are not in the graph (each is named above as GRAPH SKIPPED UNREADABLE) — a missing edge for one of them is not evidence of absence"
fi
A graph failure is not a stop. Bootstrap works without it — docs and OpenSpec indexing still happen — so print the banner, carry it to the final report, and continue with degraded expectations: the explorers grep instead of following edges, and they are slower for it.
A partial graph is not a failure, and not a whole graph either. interlock-graph build exits 0 when it meets a path it cannot read: it skips the path, names it on stderr as GRAPH SKIPPED UNREADABLE: <path> (<code>), and ends its summary line in skipped=<n>. The exit code alone no longer tells you the graph is complete. The explorers still follow edges, but nothing about a skipped path is in the graph, so tell them which paths those were and have them Read or grep there instead of trusting an empty result.
nodes=0 is the ordinary case for a repo the graph doesn't structurally index (Go, Rust, Java, Ruby — structural indexing covers JavaScript/TypeScript, Python, shell, C# (.cs, .csproj) and Bicep (.bicep)). Say which reason applied — an unsupported language, or a tree that could not be read — rather than presenting either as a defect.
When the build did produce a graph, read .claude/graph/GRAPH_REPORT.md before spawning anything. Its hub nodes and module boundaries tell the explorers where to look, so they don't rediscover the tree from scratch.
Then check whether openspec/specs/ already has content. If it does:
"This project already has N specs. Bootstrap will ADD specs for undocumented features but will never overwrite an existing one. Continue?"
Session suggestion. Unless another Interlock skill invoked this one, run interlock suggest bootstrap once, now, and print every line it returns verbatim. If it exits non-zero, print SESSION SUGGESTION UNAVAILABLE: <first line of its output> and continue. It is advice and never a gate: do not change the model or the effort yourself, and do not wait for the person to.
Spawn five explorer subagents via the Agent tool (subagent_type: "Explore"), or run them in sequence under --quick. Each returns structured JSON.
Before writing the prompts, establish the stack. Read the dependency manifest (package.json, pyproject.toml, go.mod, Cargo.toml, pom.xml, Gemfile, …) and the top-level layout. Then phrase each prompt in that stack's vocabulary. The categories below are universal; examples in your head are illustrative only — replace them with the frameworks this repo actually uses. Asking a Go service about React hooks wastes a whole agent.
Shared skeleton — fill {role}, {task}, {schema} from the table:
You are the {role} explorer for this repo. Phrase findings in this stack's vocabulary.
{task}
Prefer GRAPH_REPORT.md / interlock-graph when a graph exists; otherwise grep.
Return JSON only: {schema}
| Role | Task | JSON schema |
|---|---|---|
| Structure Mapper | Map layout. Prefer GRAPH_REPORT modules/hubs, then verify on disk. Report organization (feature/layer/hybrid), entry points and routes, naming conventions, key config files, monorepo yes/no. | { organization, entryPoints[], conventions[], configFiles[], monorepo } |
| Dependency & Data Model Analyzer | Prefer interlock-graph query / path. Report third-party deps by role, internal layer imports, persistence schema/models, entity relationships, outbound integrations. | { dependencies[], internalLayers[], dataModels[], entityRelationships[], integrations[] } |
| Pattern Extractor | Recurring composition (components/handlers/services), state/lifecycle, errors, auth, data fetch/mutate, testing, code style. | { compositionPatterns[], stateManagement, errorHandling, auth, dataFlow, testing, codeStyle } |
| Interface Scanner | External surface: endpoints and protocol, mutations, schemas/validators, public exports/SDK, realtime/streaming, CLI. | { endpoints[], mutations[], schemas[], publicExports[], realtime[], cli[] } |
| Infrastructure & Config Reader | Build/task-runner entry points, env vars referenced in code, CI/CD, deploy target, lint/format, typecheck/static analysis. | { buildSystem, tasks[], envVars[], cicd, deployment, linting, staticAnalysis } |
Cap: 8 agents in this phase.
One synthesis pass reads all five outputs and writes openspec/initial-architecture.md:
# Initial Architecture
> Auto-generated by /interlock:bootstrap on {date}.
> Point-in-time snapshot, not a living document.
## Stack & Infrastructure
## Project Organization
## Architecture Overview <- ASCII diagram, subsystem boundaries, data flow
## Data Model
## Subsystems & Features <- table: subsystem | location | responsibility | patterns
## Established Patterns <- composition, data flow, state, errors, auth, testing
## Interface Surface
## Design Decisions (Inferred)
- [EXTRACTED] stated outright in comments or docs
- [INFERRED] deduced from a consistent pattern
- [AMBIGUOUS] unclear — several patterns coexist
## Gaps & Risks <- incomplete work, conflicting patterns, hazards
Tag every design decision with its confidence. An [INFERRED] decision that turns out wrong is recoverable; one presented as fact is not.
From the synthesis, pick the units that each deserve a spec:
Present the list for confirmation before generating:
Discovered N features to spec:
1. authentication — login, register, session management
2. task-crud — create, read, update, delete tasks
3. app-shell — layout, navigation, route protection
Generate specs for all, or select specific ones?
For each confirmed feature, spawn a subagent (cap: 12).
You are writing an OpenSpec spec for an existing feature. Document what IS built, not what SHOULD be. Feature:
{name}. Architecture context:{relevant section}. Source files:{paths}. Read the implementation. Write requirements in the repo's OpenSpec spec format, each one traceable to code. Where behavior is genuinely unclear, mark it rather than guessing.
Write to openspec/specs/<feature>/spec.md. Never overwrite an existing spec file. If one exists, skip it and report the skip.
Then validate:
openspec validate --specs
Fill in the project context in openspec/config.yaml with what was discovered — stack, architecture summary, conventions, domain — so later openspec instructions calls carry it. Merge into the existing file; never clobber unrelated keys a user has set.
GRAPH UNAVAILABLE: <reason> — explorers fall back to grep and will be slower banner from pre-flight, repeated verbatim. A GRAPH PARTIAL banner is repeated verbatim too, followed by the paths the build named as GRAPH SKIPPED UNREADABLE. If the graph built whole, say so in one line instead — a report that mentions none of these reads like a graph-backed run that never happened.openspec validate --specs result/interlock:docs-digest to build the agent prose primerThis is the one moment the repository is looked at before any run has written to it, so raise the question now: will its run corpora be kept?
Observe the current state with git's own matcher — do not read or parse
.gitignore. Its semantics include negation, directory-only trailing slashes,
nested files, .git/info/exclude and the user's global excludes file, and a
hand-rolled match gets some of those wrong:
git check-ignore -q .claude/ship/ ; echo "ship=$?"
git check-ignore -q .claude/learning/ ; echo "learning=$?"
git check-ignore -q .claude/metrics/ ; echo "metrics=$?"
Exit 0 means the path is excluded, 1 means it is tracked territory.
Report each of the three separately — never collapse them into one verdict. A split state, where one is excluded and the others are not, is the case most likely to be unintentional, and collapsing hides exactly that.
State the recommendation as conditional, never as a verdict about this
repository. Nothing you can observe tells you whether the repo will run
/interlock:ship against its own product, so say which posture fits which
intent and let the reader choose:
.claude/ship/and.claude/metrics/are excluded,.claude/learning/is not. If this repository will run/interlock:shipon its own product, those exclusions drop the audit trail — remove them from.gitignore. If it is a harness whose ship runs are development exhaust, add.claude/learning/so all three match. Rationale and both.gitignoreblocks: docs/11, "Whether to keep them".
Never write to .gitignore. Not to create it, not to append, not to "fix"
a split state. Name the entries a person could add and let them add them — this
skill was invoked to produce specs, and an edit to an unrelated file is a
surprise in someone's diff, not a service.
If any git check-ignore exits non-zero for a reason other than "not ignored"
— an unreadable .gitignore, or a directory that is not a git repository at all
— report the posture as undetermined and say why, then carry on. Bootstrap
completes and writes every artifact it would otherwise have written; a failed
check never fails the onboarding.
openspec/ and .claude/graph/..gitignore; skip vendored and generated trees.Follow ${CLAUDE_PLUGIN_ROOT}/shared/TOOL-ECONOMY.md.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub renzrollon/interlock --plugin interlock16 skills in this plugin
/commitCreate a single feature-level commit after a change is implemented. Reads the OpenSpec change artifacts to write a verb-phrase conventional-commit message with an outcome summary and optional issue reference. Commit only — never runs tests, typecheck, lint or build, and never pushes./dispatchRoute a request to the right interlock skill, after one batched pre-flight that loads git state, OpenSpec status, open tasks and graph presence in a single pass. Use when you are not sure which skill applies, or at the start of a session to orient before doing anything else./docs-digestCompress a repo's docs and OpenSpec specs into one token-dense, agent-only primer at .claude/graph/DOCS_DIGEST.md — the prose twin of GRAPH_REPORT.md. Use when docs context is too large to load, after substantial docs or spec edits, or when asked to rebuild or refresh the docs digest. Not for producing human-readable documentation.Other plugins' skills for the same job