/bootstrap Skill
Seeds a knowledge store by fan-out exploration of a codebase's architecture. Identifies domains (directories/modules), dispatches Explore agents to investigate each one in parallel, then synthesizes and files findings via lore capture at the lead level. All entries are filed at confidence: medium with source: bootstrap. Supports incremental execution — bootstrap specific directories now, others later — using plan.md checkboxes for progress tracking.
Resolve Work Path
lore resolve
Set KNOWLEDGE_DIR to the result and WORK_DIR to $KNOWLEDGE_DIR/_work.
Step 1: Scope
Run the scoping script to identify domains for exploration.
- •Parse arguments: if directory paths were provided (e.g.,
/bootstrap src/auth src/api), pass them to the script. Otherwise, scope the entire repo. - •Run scoping:
Stdout: JSON array of domain objectsbash
lore bootstrap scope [optional dir args...]
[{"path": "src/auth", "description": "...", "languages": ["Python"]}]. Stderr: tree output for each scoped directory (useful context but not parsed). - •Parse the JSON output. Present the domain list to the user:
code
[bootstrap] Scoped N domains: 1. src/auth — Authentication module (Python) 2. src/api — API layer (Node.js) 3. lib/ — Library modules ... Add, remove, or merge domains? (Enter to proceed)
- •Allow the user to adjust: add new paths, remove irrelevant ones (e.g.,
vendor/,dist/), or merge related directories into a single domain. Wait for confirmation before proceeding.
Step 2: Team Setup
Create the agent team and one task per domain.
- •
Check for existing work item: Look for a
bootstrap-*work item in$WORK_DIR/. If found, load it for resume (see "Resuming a Bootstrap" below). If not found, create one:bashlore work create "Bootstrap <repo-name>" --tags bootstrap
Set
SLUGto the resulting slug. - •
Create the team (MUST precede TaskCreate):
codeTeamCreate: team_name="bootstrap-<SLUG>", description="Bootstrapping knowledge for <repo-name>"
- •
Read your team lead name from
~/.claude/teams/bootstrap-<SLUG>/config.json. - •
Create one task per domain using the scoping JSON:
codeTaskCreate: subject: "Explore: <domain path>" description: | Explore the <domain path> directory and report architectural findings. **Scope:** <domain path> **Languages:** <languages array from scoping, e.g., ["Python", "Node.js"]> **Description:** <description from scoping JSON> Investigate and report: - Architecture: how is this module/directory structured? What are the layers? - Key patterns: design patterns, conventions, idioms used - Entry points: main files, exports, public API surface - Data flow: how data moves through this module - Dependencies: internal (what other parts of the codebase does this depend on) and external (third-party packages) - Key files: the most important files with brief descriptions **Report format:** Send findings to "<team-lead-name>" via SendMessage with: **Domain:** <path> **Architecture:** (bullets) **Key patterns:** (bullets) **Entry points:** (bullets) **Data flow:** (1-2 sentences) **Dependencies:** internal: ..., external: ... **Key files:** (paths with descriptions) **IMPORTANT:** Do NOT call `lore capture`. Report findings only — the lead handles all filing. activeForm: "Exploring <domain path>" - •
Set up phase dependencies: Domains are independent — no cross-domain blocking. All tasks can run in parallel.
Step 3: Explorer Prompts
Spawn Explore agents to investigate each domain in parallel.
- •
Pre-fetch knowledge per domain — before constructing prompts:
bashPRIOR_KNOWLEDGE=$(lore prefetch "<domain path>" --format prompt --limit 5)
- •
Get directory tree for each domain:
bashDOMAIN_TREE=$(tree -L 3 --dirsfirst -I 'node_modules|.git|vendor|__pycache__|dist|build|.next|target|coverage' <domain-path>)
- •
Spawn agents — launch
min(domain_count, 4)agents in a single message:codeTask: subagent_type: "general-purpose" model: "sonnet" team_name: "bootstrap-<SLUG>" name: "explorer-N" mode: "bypassPermissions" prompt: | You are explorer-N on the bootstrap-<SLUG> team. <embed $PRIOR_KNOWLEDGE here> ## Directory Structure <embed $DOMAIN_TREE here> ## Workflow 1. Call TaskList to see available exploration tasks 2. Claim one: TaskUpdate with owner=your name, status=in_progress 3. Read the full task with TaskGet 4. Explore the domain using Glob, Grep, Read: - Start with entry points and key files - Read enough code to understand architecture, not every line - Focus on: structure, patterns, conventions, data flow, dependencies 5. Send findings to "<team-lead-name>" via SendMessage: summary: "Findings: <domain path>" content: | **Domain:** <path> **Architecture:** - <structural observations> **Key patterns:** - <design patterns, conventions, idioms> **Entry points:** - <main files, exports, public API> **Data flow:** <how data moves> **Dependencies:** - Internal: <other modules this depends on> - External: <third-party packages> **Key files:** - <path>: <description> **Observations:** - <patterns that span beyond this domain, anything surprising or non-obvious> **IMPORTANT:** Do NOT call `lore capture` — report findings only. 6. Mark task completed: TaskUpdate with status=completed 7. Call TaskList — claim next unclaimed task if available 8. When no tasks remain, you're done Keep findings to 500-1500 characters. Facts over opinions. Focus on what a developer new to this codebase would need to know. - •
If more domains than agents, agents pick up additional tasks after completing their first (self-service model).
Step 4: Collection
Persist findings as they arrive for synthesis.
- •
As explorer messages arrive (delivered automatically), write each to
findings.mdin the work item directory ($WORK_DIR/<SLUG>/findings.md):markdown## <Domain Path> **Explored by:** explorer-N **Timestamp:** <ISO timestamp> <paste the full findings report from the agent> ---
Append each finding —
findings.mdis the durable record that survives compaction. - •
When all exploration tasks are complete:
- •Send
shutdown_requestto all explorer agents via SendMessage - •Run
TeamDeleteto clean up the team - •Proceed to Step 5
- •Send
Step 5: Synthesis
Group findings by theme, flag contradictions, and draft knowledge entries.
- •
Read
findings.mdfrom the work item directory. - •
Group by theme, not just domain. Findings often reveal cross-cutting patterns:
- •Domain-specific architecture → files to
domains/<area>category - •Cross-cutting conventions (error handling, logging, testing patterns) → files to
conventions/category - •Architectural patterns (data flow, layering, service boundaries) → files to
architecture/category - •Gotchas and non-obvious behaviors → files to
gotchas/category
- •Domain-specific architecture → files to
- •
Flag contradictions: Check for cases where two agents describe the same file, pattern, or module differently. List contradictions explicitly:
code[contradiction] explorer-1 says auth uses middleware pattern, explorer-3 says auth uses decorator pattern → Verify: read src/auth/index.ts to resolve
Resolve contradictions by reading the relevant files before filing.
- •
Draft entry list. For each finding that meets the (relaxed) bootstrap gate:
- •Reusable beyond a single task? (yes — bootstrap targets architectural knowledge)
- •Non-obvious to someone new? (the whole point of bootstrap)
- •Stable enough to be worth filing? (skip anything that looks mid-refactor)
Draft each entry with:
codeTitle: <concise insight title> Insight: <1-3 sentence description> Category: <domains/<area> | conventions | architecture | gotchas> Related files: <key file paths>
- •
Deduplicate: If multiple agents reported the same pattern, merge into a single entry with the best description. Do not create duplicate entries.
Step 6: Filing
Present entries to the user and file approved ones.
- •
Present the entry list to the user for review:
code[bootstrap] Synthesized N entries from M domains: 1. [domains/auth] "Auth uses middleware chain pattern" → src/auth/middleware.ts, src/auth/index.ts 2. [conventions] "All API routes follow controller-service-repo layering" → src/api/users/controller.ts, src/api/users/service.ts 3. [gotchas] "Database migrations must run before seed scripts" → scripts/migrate.sh, scripts/seed.sh ... Accept all, or specify numbers to reject/edit? (e.g., "drop 3, edit 2")
- •
Process user feedback: Remove rejected entries, apply edits.
- •
File approved entries — serialize all
lore capturecalls (one at a time, not concurrent):bashlore capture --insight "<insight text>" --context "Discovered during bootstrap of <repo>" --category "<category>" --confidence "medium" --related-files "<comma-separated paths>"
- •
Run heal once after all captures:
bashlore heal
Step 7: Spot-Check
Verify a random sample of filed entries against actual code.
- •Pick 3 random entries from the set just filed.
- •For each entry, read the
related_fileslisted in the entry. - •Verify the claims are accurate — does the code actually do what the entry says?
- •Report results:
code
[bootstrap] Spot-check (3/N entries): "Auth middleware chain" — verified, src/auth/middleware.ts exports chain at L45 "Controller-service layering" — verified, pattern holds in 4/4 sampled routes "DB migrations before seeds" — INACCURATE: seed.sh actually checks migration status first
- •If any entry is inaccurate, offer to correct or remove it. This step is advisory — it does not block completion.
Step 8: Cleanup
Wrap up the bootstrap session.
- •
Update work item notes with a session summary:
bash# Append to notes.md
markdown## YYYY-MM-DDTHH:MM **Focus:** Bootstrap via /bootstrap **Domains explored:** <list> **Entries filed:** N entries across M categories **Contradictions found:** <count and brief descriptions, or "none"> **Spot-check:** <pass/fail summary> **Next:** <remaining domains if partial, or "Bootstrap complete">
- •
Check off completed phases in
plan.md— each bootstrapped domain's scope task gets marked[x]. - •
If all domains are bootstrapped:
- •Archive the work item:
lore work archive "<SLUG>"
- •Archive the work item:
- •
If partial completion (some domains remain):
- •Leave the work item active for later
/bootstrapresumption - •Run
lore work heal
- •Leave the work item active for later
- •
Report to user:
code[bootstrap] Done. Domains explored: N Entries filed: M (confidence: medium, source: bootstrap) Spot-check: K/3 verified Remaining: <list if any, or "none — bootstrap complete">
Resuming a Bootstrap
When /bootstrap is called and an existing bootstrap-* work item is found:
- •Read
findings.mdandplan.mdto determine which domains are already bootstrapped (checked phases). - •Re-run scoping (
bootstrap-scope.sh) to detect any new directories since the last run. - •Present the current state:
code
[bootstrap] Resuming — found existing bootstrap work item. Already explored: src/auth, src/api, lib/ New/remaining: src/workers, tests/ Proceed with remaining domains? (or specify different scope)
- •User confirms scope. Proceed from Step 2 with only the unchecked/new domains.
- •New findings append to existing
findings.md. New entries go through the same synthesis/filing/spot-check flow.