A reusable, production-grade bootstrap repository for AI agents.
Use this repo as a source of truth when initializing, documenting, and operating on target repositories.
agent-bootstrap is a canonical scaffold and control-plane repository that an AI agent (or human) can point at any target repository to:
- Perform structured discovery on the target repo.
- Understand how projects should be structured and documented.
- Create required operating files in the target repo.
- Leave behind durable project state for future agent sessions.
It is not a library, CLI tool, or deployment pipeline.
It is a documentation and prompt system — the operating model for AI-assisted project work.
AI agent sessions are ephemeral. Without durable state, every new session re-discovers the same things, makes the same assumptions, and risks contradicting prior work.
This repository solves that by providing:
- Machine-readable manifests that describe what a bootstrapped repo looks like.
- Reusable prompt files that enforce inspection-before-change discipline.
- Templates for the operating files every agent-assisted repo should have.
- Schemas for validating structured artifacts.
- A validation script to confirm a bootstrap repo is intact.
scripts/apply_bootstrap.py stages the canonical scaffold into a target repository.
This is the fastest way to get a target repo ready for the discovery/bootstrap prompt.
Apply does not auto-populate repo-specific content. It copies template files with
their {{PLACEHOLDER}} markers intact. A human or agent then inspects the target repo
and fills those placeholders with real, evidence-based content.
# Preview what would be created (no files written):
python scripts/apply_bootstrap.py --target-dir /path/to/target-repo --dry-run
# Apply the scaffold (skips files that already exist):
python scripts/apply_bootstrap.py --target-dir /path/to/target-repo
# Re-apply and overwrite existing files:
python scripts/apply_bootstrap.py --target-dir /path/to/target-repo --force
# Preview what --force would overwrite:
python scripts/apply_bootstrap.py --target-dir /path/to/target-repo --dry-run --force- Creates required directories (
docs/ai/,bootstrap/,artifacts/ai/). - Copies each canonical template to its target destination.
- Writes
bootstrap/BOOTSTRAP_SOURCE.mdwith the bootstrap source URL, version, and date filled in. - Skips any file that already exists (safe by default).
- Prints a summary: created / skipped / would overwrite / overwritten / errors.
- It does not inspect the target repo or infer repo-specific content.
- It does not fill
{{PLACEHOLDER}}markers (except the bootstrap system markers inBOOTSTRAP_SOURCE.md). - It does not run discovery or populate
artifacts/ai/repo_discovery.jsonwith real findings.
Once the scaffold is staged, point an agent at the target repo using one of the prompts:
prompts/new-repo-bootstrap.md ← for new or empty repos
prompts/existing-repo-discovery.md ← for repos with existing code
The agent will inspect the target repo and fill all remaining {{PLACEHOLDER}} markers
with evidence found in the repo.
After the agent has populated the files:
python scripts/validate_bootstrap.py --target-dir /path/to/target-repoThis checks:
- All required files are present.
- No unfilled
{{PLACEHOLDER}}markers remain. - JSON artifacts are valid.
| Step | Tool | What it does |
|---|---|---|
| Apply | scripts/apply_bootstrap.py |
Stages canonical file structure and skeletal templates |
| Bootstrap prompt / discovery | prompts/*.md → agent session |
Inspects target repo; fills templates with real evidence |
These are two separate steps. Apply first, then run the prompt.
Profiles let you apply a slightly different scaffold shape depending on the target repository type. They provide more relevant starting guidance without inventing repo-specific content.
Profiles do:
- Select profile-specific template variants where they materially improve guidance
(currently:
docs/ai/AI_AGENT_VENDOR_KNOWLEDGE_BASE.mdhas per-profile variants) - Record the selected profile in
bootstrap/BOOTSTRAP_SOURCE.mdfor future reference - Allow
refresh_bootstrap.pyto use the same profile-specific templates when upgrading
Profiles do not:
- Auto-populate repo-specific discovery content (that remains agent-led)
- Replace the bootstrap prompt / discovery step
- Infer which profile to use — you must select one explicitly
| Profile | Suitable for |
|---|---|
generic |
Any repo not covered by a more specific profile (default) |
python-service |
Python service or library repositories |
infra-repo |
Infrastructure/platform repos (Terraform, Pulumi, Ansible, etc.) |
vscode-extension |
VS Code extension repositories |
kubernetes-platform |
Kubernetes operator or platform repositories |
# Apply with the default (generic) profile:
python scripts/apply_bootstrap.py --target-dir /path/to/target-repo
# Apply with a specific profile:
python scripts/apply_bootstrap.py --target-dir /path/to/target-repo --profile python-service
python scripts/apply_bootstrap.py --target-dir /path/to/target-repo --profile infra-repo
python scripts/apply_bootstrap.py --target-dir /path/to/target-repo --profile vscode-extension
python scripts/apply_bootstrap.py --target-dir /path/to/target-repo --profile kubernetes-platform
# Preview what a profile apply would create:
python scripts/apply_bootstrap.py --target-dir /path/to/target-repo --profile python-service --dry-runAn unknown profile name causes apply to exit with an error and list the supported options.
The common core (applied for all profiles) includes:
AGENTS.md— execution contract templateIMPLEMENTATION_TRACKER.md— live state templatedocs/ai/REPO_MAP.md— repository map templatedocs/ai/SOURCE_REFRESH.md— source refresh instructionsbootstrap/BOOTSTRAP_SOURCE.md— bootstrap origin markerartifacts/ai/repo_discovery.json— discovery artifact template
The profile-specific overlay replaces:
docs/ai/AI_AGENT_VENDOR_KNOWLEDGE_BASE.md— a profile-tuned variant with guidance comments specific to that repo family (Python packaging, IaC providers, VS Code APIs, etc.)
All other files use the same common template regardless of profile.
refresh_bootstrap.py reads the Bootstrap profile field from
bootstrap/BOOTSTRAP_SOURCE.md and uses the same profile-specific templates when
upgrading managed files. If no profile is recorded (e.g., the repo was bootstrapped
before Milestone 12), refresh falls back to the generic profile automatically.
Profiles select which templates to stage — they do not fill those templates with
repo-specific content. After apply, the {{PLACEHOLDER}} markers in profile-specific
templates still require an agent to inspect the target repo and fill them with real
evidence, using the bootstrap or discovery prompt.
scripts/refresh_bootstrap.py upgrades an already-bootstrapped target repository
to align with the current canonical bootstrap source templates.
Refresh is safe by default. It never blindly overwrites repo-specific populated content. It classifies each managed file before taking action.
| Situation | Tool |
|---|---|
| Target repo has never been bootstrapped | scripts/apply_bootstrap.py |
| Target repo was bootstrapped before; templates have been updated | scripts/refresh_bootstrap.py |
| Checking status of a bootstrapped repo | scripts/refresh_bootstrap.py --dry-run |
| Classification | Meaning | Default action |
|---|---|---|
missing |
File not present in target | Created |
unchanged |
File matches current template exactly | Skipped (already current) |
safe-refresh |
File differs from template but still has unfilled {{PLACEHOLDER}} markers |
Refreshed (template updated; no local content to lose) |
populated |
File has been filled with real content (no remaining placeholders) | Skipped — flagged for manual review |
# Preview what would change (no files written):
python scripts/refresh_bootstrap.py --target-dir /path/to/target-repo --dry-run
# Run refresh (safe defaults — skips populated files):
python scripts/refresh_bootstrap.py --target-dir /path/to/target-repo
# Preview what --force would overwrite (including populated files):
python scripts/refresh_bootstrap.py --target-dir /path/to/target-repo --dry-run --force
# Refresh and overwrite even populated files (destructive — use with care):
python scripts/refresh_bootstrap.py --target-dir /path/to/target-repo --force- Detects whether the target repo was previously bootstrapped (checks for
bootstrap/BOOTSTRAP_SOURCE.md). - Reads the prior bootstrap version and date from the marker if present.
- Classifies each managed file (
missing,unchanged,safe-refresh, orpopulated). - Creates missing files and refreshes unpopulated scaffold files by default.
- Skips files that have been populated with real content (no remaining
{{PLACEHOLDER}}markers). - Prints a summary of all classifications and actions taken.
- It does not blindly overwrite populated files (unless
--forceis given). - It does not auto-merge repo-specific content with template changes.
- It does not replace the agent population step — manually review flagged files.
# 1. Preview the impact (always start here):
python scripts/refresh_bootstrap.py --target-dir /path/to/target-repo --dry-run
# 2. Review which files would be skipped (populated) vs refreshed.
# For populated files, manually compare them to the updated template.
# 3. Run the refresh:
python scripts/refresh_bootstrap.py --target-dir /path/to/target-repo
# 4. Re-populate any refreshed files that need updated content.
# 5. Validate the final state:
python scripts/validate_bootstrap.py --target-dir /path/to/target-repo| Step | Tool | What it does |
|---|---|---|
| Apply | scripts/apply_bootstrap.py |
Stages canonical file structure into a fresh target repo |
| Refresh | scripts/refresh_bootstrap.py |
Updates managed files in an existing bootstrapped repo (safe by default) |
| Validate | scripts/validate_bootstrap.py |
Checks file presence, placeholder completion, and JSON validity |
- Clone or reference this repository.
- Open
prompts/new-repo-bootstrap.mdand paste it into your agent session, pointing the agent at your target repo. - The agent will inspect the target repo, create the required operating files, and record its work in
IMPLEMENTATION_TRACKER.md.
- Open
prompts/resume-work.mdand paste it into a new agent session. - The agent will read the existing tracker and operating files before taking any action.
- After bootstrap is complete, use
prompts/bounded-implementation.md. - The agent will scope itself to a single milestone and update the tracker on completion.
- Use
prompts/closeout-and-handoff.mdto finalize state, validate files, and prepare handoff notes.
fixtures/ contains controlled minimal target repositories and population data
used to prove the bootstrap apply and validate workflow end-to-end.
scripts/run_fixture_selftest.py orchestrates the proof flow against each fixture.
| State | Description | Validation result |
|---|---|---|
| A — raw fixture | Fixture as committed; no bootstrap files present | N/A (starting point) |
| B — scaffold applied | apply_bootstrap.py run; placeholders present |
Expected to fail (unfilled placeholders) |
| C — minimally populated | Placeholder values applied from fixtures/population/*.json |
Expected to pass |
State B failing is correct behavior — it proves the scaffold was staged but not yet populated, exactly as documented. State C passing proves the full population path works.
State C population data is fixture-only proof data. It is not the result of real discovery and does not replace evidence-driven agent work. It exists only to prove that a fully populated bootstrap passes validation.
# Run all fixtures (State B + State C):
python scripts/run_fixture_selftest.py
# Run a specific fixture only:
python scripts/run_fixture_selftest.py --fixture minimal-python-service
# State B only (scaffold staging proof, skip population):
python scripts/run_fixture_selftest.py --state-b-only
# Verbose output + inspect working copies:
python scripts/run_fixture_selftest.py --verbose --keep-work-dirBootstrap self-test
...
minimal-python-service B:PASS C:PASS
minimal-infra-repo B:PASS C:PASS
SELF-TEST PASSED.
| Fixture | Shape | Why |
|---|---|---|
minimal-python-service |
Code-oriented (Flask, pytest) | Proves bootstrap on a typical application repo |
minimal-infra-repo |
Infra/docs-oriented (Terraform) | Proves bootstrap on a non-application, docs-heavy repo |
See fixtures/README.md for full fixture documentation.
An agent that receives a prompt from this repo's prompts/ directory should:
- Read
bootstrap-manifest.yamlto understand required outputs and stop conditions. - Inspect the target repo before making any changes.
- Use the templates in
templates/as starting points, filling them with real evidence from the target repo. - Validate its outputs against the schemas in
schemas/. - Run
scripts/validate_bootstrap.py(or equivalent checks) before declaring bootstrap complete. - Update
IMPLEMENTATION_TRACKER.mdin the target repo with a full record of the run.
| File | Purpose |
|---|---|
AGENTS.md |
Execution contract for AI agents working in that repo |
IMPLEMENTATION_TRACKER.md |
Live state file: milestones, decisions, gaps |
docs/ai/REPO_MAP.md |
Human + agent-readable map of the repository |
docs/ai/SOURCE_REFRESH.md |
Instructions for re-syncing agent knowledge |
docs/ai/AI_AGENT_VENDOR_KNOWLEDGE_BASE.md |
Vendor-specific AI knowledge relevant to the repo |
bootstrap/BOOTSTRAP_SOURCE.md |
Record of where the bootstrap originated |
artifacts/ai/repo_discovery.json |
Machine-readable discovery artifact |
A target repo is considered bootstrap-complete when:
- All required files listed in
bootstrap-manifest.yamlare present. - Each file is populated with repo-specific content (not generic placeholders).
IMPLEMENTATION_TRACKER.mdrecords the run that created them.- The discovery artifact (
repo_discovery.json) reflects actual findings. - A human or agent can open the tracker and understand the project state without chat history.
Inspect → Document → Bound → Validate → Record
- Inspect: Read the target repo before touching anything.
- Document: Create or update operating files with real evidence.
- Bound: Limit each session to a declared milestone scope.
- Validate: Confirm file presence, internal references, and schema compliance.
- Record: Update the tracker; leave the repo resumable.
# Stage the bootstrap scaffold into a target repo (default generic profile):
python scripts/apply_bootstrap.py --target-dir /path/to/target-repo
# Stage with a profile (e.g., for a Python service repo):
python scripts/apply_bootstrap.py --target-dir /path/to/target-repo --profile python-service
# Then run the bootstrap prompt (new repo) or discovery prompt (existing repo)
# against the target repo to fill in the content.
# Validate after the agent has populated the files:
python scripts/validate_bootstrap.py --target-dir /path/to/target-repo.
├─ README.md ← this file
├─ AGENTS.md ← execution contract for this repo
├─ IMPLEMENTATION_TRACKER.md ← live state for this repo
├─ bootstrap-manifest.yaml ← machine-readable control plane
├─ prompts/ ← reusable agent prompt files
│ ├─ new-repo-bootstrap.md
│ ├─ existing-repo-discovery.md
│ ├─ resume-work.md
│ ├─ bounded-implementation.md
│ └─ closeout-and-handoff.md
├─ templates/ ← canonical templates for target repos
│ ├─ AGENTS.md.template
│ ├─ IMPLEMENTATION_TRACKER.md.template
│ ├─ bootstrap/
│ │ └─ BOOTSTRAP_SOURCE.md.template
│ ├─ docs/ai/
│ │ ├─ REPO_MAP.md.template
│ │ ├─ SOURCE_REFRESH.md.template
│ │ └─ AI_AGENT_VENDOR_KNOWLEDGE_BASE.md.template ← generic (default)
│ ├─ profiles/ ← profile-specific template overrides
│ │ ├─ python-service/docs/ai/AI_AGENT_VENDOR_KNOWLEDGE_BASE.md.template
│ │ ├─ infra-repo/docs/ai/AI_AGENT_VENDOR_KNOWLEDGE_BASE.md.template
│ │ ├─ vscode-extension/docs/ai/AI_AGENT_VENDOR_KNOWLEDGE_BASE.md.template
│ │ └─ kubernetes-platform/docs/ai/AI_AGENT_VENDOR_KNOWLEDGE_BASE.md.template
│ └─ artifacts/ai/
│ └─ repo_discovery.json.template
├─ fixtures/ ← fixture target repos + self-test data
│ ├─ README.md ← fixture documentation
│ ├─ targets/
│ │ ├─ minimal-python-service/ ← code-oriented fixture (Flask, pytest)
│ │ └─ minimal-infra-repo/ ← infra/docs-oriented fixture (Terraform)
│ └─ population/
│ ├─ minimal-python-service.json ← State C proof data
│ └─ minimal-infra-repo.json ← State C proof data
├─ examples/ ← per-repo-type discovery notes
│ ├─ python-service/
│ ├─ infra-repo/
│ ├─ vscode-extension/
│ └─ kubernetes-platform/
├─ schemas/ ← JSON schemas for structured artifacts
│ ├─ implementation_tracker.schema.json
│ ├─ repo_discovery.schema.json
│ └─ bootstrap_doctor_report.schema.json ← doctor/audit JSON output contract (Milestone 19)
├─ scripts/
│ ├─ bootstrap_core.py ← shared internal semantic helpers (Milestone 17)
│ ├─ validate_bootstrap.py ← lightweight validation script
│ ├─ apply_bootstrap.py ← scaffold apply script
│ ├─ refresh_bootstrap.py ← safe upgrade/refresh script
│ ├─ run_fixture_selftest.py ← end-to-end self-test harness
│ ├─ bootstrap_status.py ← source/target repo status report
│ ├─ suggest_profile.py ← target repo profile suggestion
│ └─ bootstrap_doctor.py ← target repo health audit (read-only)
└─ tests/
├─ test_bootstrap_core.py ← contract tests for shared semantics
└─ test_bootstrap_doctor.py ← contract tests for doctor/diagnosis semantics
1. Agent receives prompt from prompts/new-repo-bootstrap.md
2. Agent inspects target repo → records findings in repo_discovery.json
3. Agent creates AGENTS.md, IMPLEMENTATION_TRACKER.md, docs/ai/* from templates
4. Agent fills templates with real evidence (no guessing)
5. Agent runs validate_bootstrap.py against target repo
6. Agent updates IMPLEMENTATION_TRACKER.md with completion status
7. Session ends — repo is resumable by any future agent or human
scripts/bootstrap_core.py is a small internal module that centralises the
bootstrap semantics reused across multiple scripts.
As the tool set grew across milestones, several scripts independently defined the same logic: placeholder regex patterns, SEMVER validation, marker field parsing, era classification, profile resolution, and template mapping. Duplicated definitions drift over time — a fix in one script silently leaves others inconsistent.
bootstrap_core.py is the single source of truth for:
PLACEHOLDER_REandSEMVER_RE(shared regex constants)read_version()— reads the VERSION fileload_manifest()— reads the bootstrap-manifest.yaml as textget_supported_profiles()/resolve_profile()— profile names and validationparse_bootstrap_marker()— parses the bootstrap marker tableclassify_marker_era()— classifies markers as pre-version, pre-profile, versioned, or unknownis_placeholder(),has_placeholders(),find_placeholders()— placeholder helpersresolve_template_mappings()— effective template mappings per profile
Scripts remain the main operator interfaces. Only the shared semantic primitives live in the core. CLI behaviour, output formatting, and script-specific logic stay in each script.
tests/test_bootstrap_core.py contains bounded contract tests that prove
the shared semantics are stable:
- regex behaviour
- version file parsing
- manifest loading
- profile enumeration and validation
- template mapping resolution for all profiles
- marker parsing from sample text
- era classification (all four states)
- placeholder helpers
tests/test_bootstrap_doctor.py contains bounded contract tests that prove
the target-repo diagnosis semantics are stable:
- all six health state classifications
- version comparison helpers (materially-behind logic)
- marker status, required-files status, and placeholder status helpers
- profile alignment classification (aligned / mismatch / insufficient-evidence / not-recorded)
- recommended next-action guidance for every health state (conservative by default — no
--force) - era classification alignment between
bootstrap_doctorandbootstrap_core audit()integration for key states using real temporary directories
Doctor behavior is intentionally conservative and stable: it never recommends
--force, never shells out to external processes, and never mutates any files.
These properties are proved by the contract tests and must remain stable.
Run the contract tests locally:
python -m unittest discover -s tests -p 'test_*.py' -vUpdate bootstrap_core.py and its contract tests when:
- a shared semantic changes (e.g., new marker field, new era state)
- a new profile is added (update
PROFILESand its tests) - a placeholder pattern changes
Do not add script-specific output logic to the core.
A GitHub Actions workflow at .github/workflows/ci.yml runs automatically on every push,
pull request, and manual trigger.
| Step | Command |
|---|---|
| Script syntax | python -m py_compile scripts/*.py |
| Bootstrap repo structure | python scripts/validate_bootstrap.py |
| Contract tests | python -m unittest discover -s tests -p 'test_*.py' |
| Fixture end-to-end self-tests | python scripts/run_fixture_selftest.py |
- Every push to any branch
- Every pull request
- On demand via the GitHub Actions "Run workflow" button
CI runs the same commands you should run locally before pushing:
python scripts/validate_bootstrap.py
python -m unittest discover -s tests -p 'test_*.py'
python scripts/run_fixture_selftest.pyIf CI fails, the failure maps directly to one of these commands — inspect the step that failed to identify which check broke.
- Missing required bootstrap repo files
- Broken or invalid JSON schemas and templates
apply_bootstrap.pyfailures (scaffold apply path)validate_bootstrap.pyfailures (validation path)- Fixture self-test failures (State B, State C, or State D refresh)
- Python syntax errors in any of the three scripts
Note for maintainers: After merging changes that update the CI workflow or add new scripts, confirm that GitHub Actions is actually firing on subsequent pushes and pull requests by checking the Actions tab in the repository. The workflow was added in Milestone 10 and should run automatically for all branches.
Before applying a bootstrap scaffold, you can inspect a target repository and get a suggested profile based on its file-system evidence.
scripts/suggest_profile.py scans the target directory for well-known signal files
and directories (e.g., pyproject.toml, *.tf, Chart.yaml) and reports:
- The most likely bootstrap profile.
- A confidence level (
high,medium, orlow). - The specific signals that matched.
- Any alternative candidate profiles.
- The recommended
apply_bootstrap.pycommand to run next.
The tool is read-only. It never creates, modifies, or deletes any files.
- It does not apply the suggested profile automatically.
- It does not replace the maintainer's judgment.
- It does not guarantee the suggestion is correct — it is advisory only.
- It does not run discovery or populate
{{PLACEHOLDER}}markers.
| Profile | Key signals |
|---|---|
python-service |
pyproject.toml, requirements.txt, src/, tests/, .py files |
infra-repo |
*.tf files, environments/, modules/, inventory/, no app runtime |
vscode-extension |
package.json with vscode content, extension.ts, .vscodeignore |
kubernetes-platform |
Chart.yaml, values.yaml, kustomization.yaml, manifests/, clusters/ |
generic |
Fallback — weak, mixed, or absent evidence |
# Basic suggestion (human-readable output):
python scripts/suggest_profile.py --target-dir /path/to/repo
# Verbose output (shows alternative candidates and all scores):
python scripts/suggest_profile.py --target-dir /path/to/repo --verbose
# JSON output (useful for scripting):
python scripts/suggest_profile.py --target-dir /path/to/repo --json- Run the suggestion tool against the target repo.
- Review the evidence and confidence level.
- If the suggestion looks right, use the recommended command shown in the output.
- If uncertain, review the signals and choose manually.
- The final profile choice is always yours.
# Step 1: inspect
python scripts/suggest_profile.py --target-dir /path/to/repo
# Step 2: apply with the suggested (or chosen) profile
python scripts/apply_bootstrap.py --target-dir /path/to/repo --dry-run --profile python-service
# Step 3: apply for real once dry-run looks right
python scripts/apply_bootstrap.py --target-dir /path/to/repo --profile python-serviceProfile selection determines which template variant is staged into the target repo. The suggestion tool uses simple file-system heuristics — it cannot know team conventions, architectural intent, or edge cases that an experienced maintainer would recognize. Treat the suggestion as a fast starting point, not an authoritative decision.
scripts/bootstrap_doctor.py is a read-only diagnostic tool that inspects a target
repository and explains its bootstrap health, drift, and recommended next action.
Runs a single command that answers:
- Is this repo bootstrapped at all?
- What bootstrap version, profile, and era is recorded?
- Are all required managed files present?
- Are
{{PLACEHOLDER}}markers still present in managed files? - What health state is the repo in?
- Does the recorded profile match the currently suggested profile?
- Is a refresh likely needed?
- What exact next command should the operator run?
The doctor is read-only. It never creates, modifies, or deletes any files.
- It does not apply the bootstrap scaffold.
- It does not run refresh automatically.
- It does not fill
{{PLACEHOLDER}}markers. - It does not validate — that is
validate_bootstrap.py's job. - It does not recommend
--forceflags by default.
# Human-readable audit report:
python scripts/bootstrap_doctor.py --target-dir /path/to/repo
# Verbose output (lists missing files, files with placeholders):
python scripts/bootstrap_doctor.py --target-dir /path/to/repo --verbose
# JSON output (useful for scripting):
python scripts/bootstrap_doctor.py --target-dir /path/to/repo --json| State | Meaning |
|---|---|
unbootstrapped |
No marker found; repo has not been bootstrapped |
scaffold-applied-unpopulated |
Marker present; all managed files still have placeholder markers |
partially-populated |
Marker present; some files populated, some placeholders remain |
populated-and-healthy |
Marker present; all required files present; no placeholder markers |
stale-version-review-recommended |
Recorded version is materially behind current source version |
profile-mismatch-review-recommended |
Recorded profile differs from suggested with meaningful evidence |
Run the doctor first to understand what the target repo needs before taking any action.
# Step 1: audit the target repo
python scripts/bootstrap_doctor.py --target-dir /path/to/repo
# Step 2: follow the recommended command from the output
# (e.g., suggest_profile, apply --dry-run, validate, or refresh --dry-run)
# Step 3: run the actual action once confidentThe doctor output always includes a "Recommended next action(s)" section with ready-to-run commands based on the actual health state it detected.
The --json flag produces stable machine-readable output for automation, CI consumers,
and bulk audit tooling. Downstream tools should depend on the JSON output, not on
parsing human-readable terminal text.
python scripts/bootstrap_doctor.py --target-dir /path/to/repo --jsonSchema: schemas/bootstrap_doctor_report.schema.json
The JSON contract guarantees:
- A
schema_versionfield (semver) identifying the JSON contract version — this is independent of the bootstrap repo'sVERSIONfile. The two version axes serve different purposes:schema_versiontracks the shape of this JSON output;VERSIONtracks the bootstrap tooling release. Do not conflate them. - Stable, bounded
health_statevalues — the six health state strings are the stable vocabulary and will not be renamed without a semver minor version bump. - Structured
recommendations— each item is an object withtype("command"or"note") andvalue. Consumers must branch ontypeto distinguish runnable commands from informational notes — do not parsevalueto infer the type. - Bounded enum values for
marker_status,marker_era,profile_confidence,profile_alignment,required_files_status, andplaceholder_status.
Stability guarantees:
| Change type | Schema version bump |
|---|---|
| Additive optional fields or clarifying documentation | patch |
| New required fields or new enum values | minor |
| Renamed/removed required fields or changed semantics | major |
Enum growth note: A minor version bump may add new enum values (e.g., a new
health_state). Consumers must handle unknown enum values defensively — do not treat the current enum sets as permanently frozen.
Human-readable output (the default, without --json) may change phrasing across
releases. Only the JSON output is the stable contract.
scripts/bulk_audit.py is a read-only bulk audit tool that inspects multiple target
repositories and produces a concise aggregate health summary.
- Accepts one or more explicit
--repopaths and/or a--root-dirto scan. - Runs the bootstrap doctor audit (read-only) on each discovered repo.
- Reports per-repo health state, version, and profile.
- Produces aggregate counts by health state and profile.
- Identifies high-priority repos that need attention.
- Outputs machine-readable JSON when
--jsonis specified.
Bulk audit is read-only. It never creates, modifies, or deletes any files.
- It does not apply the bootstrap scaffold to any repo.
- It does not run refresh or validate on any repo.
- It does not fill
{{PLACEHOLDER}}markers. - It does not clone or fetch remote repos.
- It does not build a database or dashboard backend.
# Audit explicit repos:
python scripts/bulk_audit.py --repo /path/to/repo-a --repo /path/to/repo-b
# Discover repos in a parent directory (looks for .git/ in immediate subdirs):
python scripts/bulk_audit.py --root-dir /path/to/repos
# Scan up to 2 directory levels deep:
python scripts/bulk_audit.py --root-dir /path/to/repos --max-depth 2
# JSON output to stdout:
python scripts/bulk_audit.py --root-dir /path/to/repos --json
# JSON output to file:
python scripts/bulk_audit.py --repo /path/to/repo-a --json --output /tmp/bulk.json
# Mix explicit repos and root-dir:
python scripts/bulk_audit.py --repo /extra/repo --root-dir /path/to/repos --jsonOnly directories containing a .git/ subdirectory are treated as repositories.
This is conservative by design. Do not assume every folder under --root-dir
will be scanned — the tool only picks up clear git repos.
Default max depth is 1 (immediate subdirectories only). Use --max-depth 2 to
scan one level deeper.
The default terminal output is concise and operator-friendly:
- Scan summary and aggregate counts by health state.
- Profile distribution.
- High-priority repos (stale, mismatch, partially-populated, unbootstrapped).
- Per-repo concise lines.
The --json output is the stable machine-readable contract for automation and
downstream tooling. Downstream tools should consume the JSON output, not parse
terminal text.
Schema: schemas/bootstrap_bulk_audit_report.schema.json
Key fields in the bulk JSON report:
schema_version— tracks the bulk report JSON contract version (independent ofVERSION).generated_at— ISO 8601 UTC timestamp.bootstrap_source_version— current bootstrap tooling version.repo_count— total repos considered (audited + errors).summary.by_health_state— aggregate counts per health state.summary.by_profile— aggregate counts per profile.repos— array of per-repo results, using the same semantic fields as the doctor JSON contract.errors— repos that could not be audited, with error details.
Per-repo entries in the bulk report use the same field vocabulary as
bootstrap_doctor.py --json output. Consumers must handle unknown enum values
defensively — a minor version bump may add new values.
python scripts/bootstrap_status.pyReports: version, git revision, CHANGELOG presence, core docs and scripts, supported profiles, and version/changelog coherence.
python scripts/bootstrap_status.py --target-dir /path/to/target-repoReports: bootstrap source, version, revision, date, agent, prompt, profile, and era classification (pre-version, pre-profile, or versioned).
The coherence check (run automatically by validate_bootstrap.py and
bootstrap_status.py) confirms:
VERSIONexists and contains a valid semver string.CHANGELOG.mdexists.- The current version appears in
CHANGELOG.mdas a release heading, OR an[Unreleased]section is present (version in progress).
python scripts/validate_bootstrap.py # includes coherence check
python scripts/bootstrap_status.py # human-readable summarySee docs/BOOTSTRAP_RELEASE_WORKFLOW.md
for the full step-by-step release checklist, including:
- When to use patch/minor/major bumps.
- What files to update.
- What local checks to run before merge.
- How to tag a release.
The bootstrap version is defined in the VERSION file at the root of this repository.
It contains a single semantic version string (e.g., 0.13.0).
cat VERSION
# 0.13.0apply_bootstrap.py and refresh_bootstrap.py read this file at run time to record
the bootstrap version in the target repo's marker.
When apply_bootstrap.py runs, it writes two version fields into bootstrap/BOOTSTRAP_SOURCE.md:
| Field | Value | Example |
|---|---|---|
| Bootstrap source version | semver from VERSION file |
0.13.0 |
| Bootstrap source revision | git SHA of the bootstrap repo | abc1234 |
The refresh_bootstrap.py script reads the prior version from the marker, shows it
alongside the current version, and emits a warning if the major version has changed.
| Change type | Example | Refresh safety |
|---|---|---|
| Patch | Doc corrections, script bug fixes | Safe — no manual review expected |
| Minor | New templates, new profiles, additive marker fields | Bounded review — new files created; existing populated files skipped |
| Major | Marker field renames, structural policy changes | Manual review required — run --dry-run first |
- Update the
VERSIONfile. - Add an entry to
CHANGELOG.md. - Commit and tag:
git tag vX.Y.Z.
Full policy details are in docs/BOOTSTRAP_VERSIONING.md.
- This repo does not implement a CLI for end-users.
- This repo does not contain target-repo-specific content.
- This repo does not automate deployments or CI pipelines.
- Templates contain placeholders, not real project data.
- The validation script checks file presence, not semantic correctness.
- Schemas enforce shape, not business logic.