Generate and maintain AI-agent guidance files for any software project.
This repository provides:
- A master prompt template in
master-prompt.md - A builder script in
setup-ai-docs.py - A generated drop-in executable (
ai-docs-bootstrapon macOS/Linux, orai-docs-bootstrap.pyfor Windows profile) - CI freshness workflow in
.github/workflows/ai-docs-freshness.yml
The bootstrap scans a target project and creates standardized AI documentation for:
- Cursor
- GitHub Copilot
- Claude Code
- OpenAI Codex
- Antigravity
- Shared cross-agent documentation and governance files
It supports:
- New vs existing project detection
- Stack detection from common manifests (
package.json,pyproject.toml,composer.json,Package.swift, etc.) - Prompted onboarding for new projects
- Stack presets for common setups
- Starter app-intent profiles (
general-app,chatbot,crm) plus any custom intent (for example analytics, crash-logger, social, ewallet, chat-app, ride-booking, ecommerce, scraper, gaming, travel, legal-tech, gov-tech, ad-tech) - Deterministic freshness checks for CI
- Stale report output for review artifacts
- User-custom section preservation across regenerations
- Knowledge-graph-friendly specs/memory notes (frontmatter, wiki links, and vault map)
- Spec-driven development with executable specs and validation patterns
- Parallel agent coordination and session-based learning templates
- Python 3.11+ (recommended)
- A project directory where docs will be generated
master-prompt.md: canonical prompt used by the buildersetup-ai-docs.py: generates executable bootstrap from the promptai-docs-bootstrap: generated executable (macOS/Linux/auto profile)Makefile: one-command automation for build/check/smoke/release flows.github/workflows/ai-docs-freshness.yml: optional CI check workflow.github/pull_request_template.md: pull request checklist.github/ISSUE_TEMPLATE/*: bug and feature request templatesOPERATIONAL_PLAYBOOK.md: troubleshooting, security checklist, and upgrade notes
Use the included Makefile to run common tasks quickly:
make help
make build-bootstrap
make compile
make smoke
make check-bootstrap
make smoke-check
make stale-report
make release-checkTo use a custom temp directory:
make smoke TMP_DIR=/tmp/my-ai-docs- Build the bootstrap executable:
python3 setup-ai-docs.py- Choose target OS profile when prompted:
- macOS
- Linux
- Windows
- Auto (recommended)
- Run bootstrap against a target project:
./ai-docs-bootstrap --project /path/to/projectFor Windows profile output:
py ai-docs-bootstrap.py --project C:\path\to\projectFrom another local repo on the same machine:
cp /absolute/path/to/Coding\ Agent/ai-docs-bootstrap . && chmod +x ai-docs-bootstrap && ./ai-docs-bootstrap --project .From GitHub (macOS/Linux):
curl -fsSL https://raw.githubusercontent.com/baralmanish/Coding-Agent/main/ai-docs-bootstrap -o ai-docs-bootstrap && chmod +x ai-docs-bootstrap && ./ai-docs-bootstrap --project .Command form by platform:
- macOS/Linux profile:
./ai-docs-bootstrap ... - Windows profile:
py ai-docs-bootstrap.py ...
Discover all available flags:
./ai-docs-bootstrap --help
# Windows profile:
py ai-docs-bootstrap.py --help./ai-docs-bootstrap --project /path/to/project./ai-docs-bootstrap --project /path/to/project --mode new
./ai-docs-bootstrap --project /path/to/project --mode existing./ai-docs-bootstrap --project /path/to/project --mode existing --checkExit codes:
0: docs are up to date1: docs are stale2: invalid check invocation for interactive new-project flow
./ai-docs-bootstrap --project /path/to/project --mode new --non-interactive./ai-docs-bootstrap \
--project /path/to/project \
--mode new \
--non-interactive \
--intent "ride booking ecommerce payments" \
--compliance "soc2,gdpr"Notes:
--intentaccepts any free-text app intent.--complianceaccepts comma-separated keys:pci-dss,hipaa,soc2,gdpr,ccpa,iso27001.- Intent ranking in
.ai-docs/APP-BLUEPRINT.mduses confidence scoring and stack-aware tie-breaks.
./ai-docs-bootstrap --project /path/to/project --mode existing --check --report-path .ai-docs-check-report.md./ai-docs-bootstrap --project /path/to/project --mode existing \
--json-report-path .ai-docs-run-report.json \
--track-performanceThe JSON report includes per-feature generated_files, changed_files, and duration_ms entries. Performance history also records the slowest features for each run.
Tune markdown context ingestion for stable prompt size:
./ai-docs-bootstrap --project /path/to/project --mode existing \
--context-max-files 20 \
--context-preview-chars 500Limits:
--context-max-files: 1-200--context-preview-chars: 100-8000
Each non-check, non-dry run writes a lightweight run state snapshot to:
.ai-docs/session-state.json
Override location with:
./ai-docs-bootstrap --project /path/to/project --session-state-path .ai-docs/session-state.json./ai-docs-bootstrap --list-stack-presets
./ai-docs-bootstrap --list-intents
./ai-docs-bootstrap --list-compliance
./ai-docs-bootstrap --list-featuresValidate key feature combinations against versioned fixtures:
python3 scripts/feature_snapshot_ci.py --bootstrap ./ai-docs-bootstrapRegenerate fixtures intentionally after approved content changes:
python3 scripts/feature_snapshot_ci.py --bootstrap ./ai-docs-bootstrap --update-fixturesCI writes:
.ci-artifacts/feature-snapshot-summary.json.ci-artifacts/feature-snapshot-diffs.md(actionable diff hints)
Run fast tier (PR-focused):
python3 scripts/feature_matrix_ci.py --bootstrap ./ai-docs-bootstrap --tier fastRun full tier (main/nightly):
python3 scripts/feature_matrix_ci.py --bootstrap ./ai-docs-bootstrap --tier fullMatrix artifacts include:
- Tier summary with
duration_msandslowest_cases - Duration trend data in
.ci-artifacts/feature-matrix-duration-history-*.json
Use only the capabilities you want for a run:
./ai-docs-bootstrap --project /path/to/project --mode existing \
--features "base-docs,agent-docs,feature-specs" \
--enable-features "feature-catalog" \
--disable-features "compliance-dashboard"Use a named feature profile as the base set, then override it:
./ai-docs-bootstrap --project /path/to/project --mode existing \
--feature-profile "standard" \
--enable-features "compliance-level-3,compliance-dashboard" \
--disable-features "custom-agent-config"Available profiles:
minimal: core docs, agent docs, feature specs, containerization docs, feature catalogstandard: minimal + custom-agent-config + compliance-level-2compliance-heavy: standard + compliance-level-3 + ai-analysis + patch-proposals + compliance-dashboard
Notes:
--feature-profilecannot be combined with--features- Use
--list-feature-profilesto print the profile definitions
Import/export repeatable feature config:
# Import
./ai-docs-bootstrap --project /path/to/project --mode existing \
--features-config .ai-docs/features-config.json
# Export resolved active set
./ai-docs-bootstrap --project /path/to/project --mode existing \
--feature-profile "standard" \
--enable-features "compliance-level-3,compliance-dashboard" \
--write-features-config .ai-docs/features-config.jsonFeature config schema keys:
feature_profile(string)features(array of strings)enable_features(array of strings)disable_features(array of strings)apply_auto_patches(boolean)
Validation behavior:
- Unknown keys in
--features-configfail fast with a clear error - CLI flags override imported config where explicitly provided
Generated feature visibility file:
.ai-docs/FEATURES.md(available options + active/inactive features)
Validation behavior:
- Feature names must be from
--list-features - Unknown feature names fail fast with an error (not silently ignored)
feature-specsis enabled by default in standard profiles, but it can be disabled- If
feature-specsis enabled, spec-driven flow is strict: every newly requested app feature should be documented in specs where behavior, interfaces, or workflows change - Dependency violations fail fast with actionable messages
- Add more capabilities later with
--enable-featuresand remove with--disable-features - Selected profile is emitted in
.ai-docs/FEATURES.md
Dependency rules:
ai-analysisrequirescompliance-level-3patch-proposalsrequirescompliance-level-3compliance-dashboardrequirescompliance-level-3auto-patch-applyrequirescompliance-level-3and the--apply-auto-patchesflag
Feature spec template contract (when feature-specs is enabled):
- Required path shape:
.specs/features/<feature-slug>/spec.md - Required sections in each changed feature spec:
## Spec Enrollment Checklist (Mandatory)## Goal## Acceptance Criteria## Test Mapping## Traceability Matrix
- Normalization strategy for large specs:
- Keep
.specs/features/<feature>/spec.mdas the summary - Move detailed content into
.specs/features/<feature>/spec/modules:index.mdacceptance-criteria.mdtest-mapping.mdtraceability-matrix.md
- Keep
Feature lifecycle policy:
- Feature keys are lifecycle-labeled as
stable,experimental, ordeprecated --list-featuresand.ai-docs/FEATURES.mdinclude lifecycle labels- Renamed feature keys are auto-migrated (alias mapping) and shown by
--list-features - Removed feature keys fail fast with migration guidance
Current alias migrations:
ai-compliance-analysis->ai-analysisdashboard-html->compliance-dashboard
Current removed keys:
compliance-report: usecompliance-level-2and/orcompliance-level-3outputs
Feature key reference:
| Feature key | Purpose |
|---|---|
base-docs |
Core shared AI docs and top-level indexes |
agent-docs |
Agent-specific guidance files (Copilot, Claude, Codex, etc.) |
feature-specs |
Feature spec and memory scaffolding under .specs/features |
containerization-docs |
Containerization baseline and deployment guidance (.ai-docs/CONTAINERIZATION.md) |
custom-agent-config |
Custom framework/compliance/template summary docs |
compliance-level-2 |
Level 2 compliance scanning files |
compliance-level-3 |
Level 3 compliance implementation pattern files |
ai-analysis |
AI-assisted compliance analysis report |
patch-proposals |
Level 3 patch proposal and injection reports |
auto-patch-apply |
Apply deterministic auto-patches and emit result report |
compliance-dashboard |
Compliance dashboard HTML output |
feature-catalog |
Generated feature status file (.ai-docs/FEATURES.md) |
In new-project onboarding, you can select:
react-tsnext-tsnode-apiexpress-tsfastify-tsnestjsangularvuereact-nativenuxtsveltekitlaraveldjangogo-fiberspring-bootdotnet-webapiswift-vaporswift-iosfastapi
Preset values are merged with manually entered languages/frameworks/tests/linting.
The displayed preset list in CLI is generated dynamically from STACK_PRESETS.
In new-project onboarding, you can pick a starter app intent profile:
general-appchatbotcrm
You can also enter any custom app intent (for example: analytics, crash-logger, social-app, ewallet, whatsapp-style chat, ride-booking, ecommerce, scraper, gaming, travel, legal-tech, gov-tech, ad-tech, or anything else). The generator maps known keywords to targeted guidance and falls back to strong general defaults when no keyword matches.
When multiple intent keywords are present, the generator ranks matched domains and shows scoring in .ai-docs/APP-BLUEPRINT.md.
You can optionally add compliance packs during onboarding:
pci-dsshipaasoc2gdprccpaiso27001
Compliance can also be auto-suggested from app intent keywords (for example, wallet/payments -> PCI DSS, health -> HIPAA, social/ad-tech -> GDPR/CCPA, enterprise SaaS -> SOC 2/ISO 27001).
The generated blueprint also includes:
- Recommended package set aligned to current ecosystem standards for detected stack/frameworks
- Stale/deprecated package warnings with modern alternatives
- Security audit command checklist to run before installing new dependencies
This adds targeted implementation guidance and generates .ai-docs/APP-BLUEPRINT.md with capability checklists and stack-specific notes (React/Node/Laravel/Python).
Typical files include:
AGENTS.mdAI_DOCS_INDEX.md.cursor/rules/project.mdc.github/copilot-instructions.mdCLAUDE.mdCODEX.mdANTIGRAVITY.md.ai-docs/CONTEXT-SNAPSHOT.md.ai-docs/APP-BLUEPRINT.md.ai-docs/FEEDBACK.md.ai-docs/ROADMAP.md.ai-docs/SECURITY.md.ai-docs/SPEC-DRIVEN-DEVELOPMENT.md.ai-docs/CHANGELOG.md.ai-docs/metadata.json.ai-docs/MASTER_PROMPT_REFERENCE.md
Generated markdown supports preserving user custom content blocks:
<!-- user-custom:start:local -->
Your team-specific guidance here.
<!-- user-custom:end:local -->These blocks are preserved during regeneration.
This repository includes .github/workflows/ai-docs-freshness.yml:
- Builds bootstrap during CI
- Skips freshness checks if AI docs are not initialized
- Runs
--checkmode - Uploads stale report artifact when docs are outdated
- Fails workflow when stale docs are detected
Default docs/specs-first gate (hard enforcement):
- Enforces: code changes must include updates under
.specs/or.ai-docs/(orAGENTS.md/AI_DOCS_INDEX.md) - Enforces: code changes must include at least one updated feature spec at
.specs/features/<feature>/spec.md - Enforces: changed feature specs must include the required template sections listed above
- Runs by default on PR, push, scheduled, and full manual CI runs
- Gate report artifact path:
.ci-artifacts/spec-traceability-gate.json
Optional strict mode for the gate:
- Enable globally with repository variable:
AI_DOCS_SPECS_STRICT_MODE=true - Enable for manual full runs with workflow input:
strict_specs_mode=on - Additional strict checks:
- Checklist items under
## Spec Enrollment Checklist (Mandatory)must be checked ([x]) - Oversized
spec.mdfiles (default: >400 lines or >24000 bytes) must be normalized into module files under.specs/features/<feature>/spec/
- Checklist items under
PR checklist for oversized feature specs (copy/paste):
- Replace
<feature-slug>and run:
FEATURE="<feature-slug>"
mkdir -p ".specs/features/$FEATURE/spec"
cat > ".specs/features/$FEATURE/spec/index.md" <<'EOF'
# Spec Index
Summary and links to detailed sections.
EOF
cat > ".specs/features/$FEATURE/spec/acceptance-criteria.md" <<'EOF'
# Acceptance Criteria
- AC1: ...
- AC2: ...
EOF
cat > ".specs/features/$FEATURE/spec/test-mapping.md" <<'EOF'
# Test Mapping
- AC1 -> tests
- AC2 -> tests
EOF
cat > ".specs/features/$FEATURE/spec/traceability-matrix.md" <<'EOF'
# Traceability Matrix
- AC1 -> changed files and tests
- AC2 -> changed files and tests
EOF- Ensure
.specs/features/<feature-slug>/spec.mdstays as the concise summary and links to the module files. - Commit both the updated
spec.mdand the new module files in the same PR.
- Run bootstrap after major stack/tooling changes.
- Review generated doc diffs.
- Keep team-specific notes inside user-custom blocks.
- Use
--checkmode in CI to enforce freshness.
- For CI/non-interactive setup, use
--intentand--complianceto avoid prompts. - Run discovery flags (
--list-*) before choosing presets/intents. - Review
.ai-docs/APP-BLUEPRINT.mdfirst; it now includes ranked intents, package recommendations, stale-package warnings, and security-audit commands.
- If check mode fails unexpectedly, regenerate docs once and rerun check.
- For brand-new temporary projects, run one extra generation pass before
--check(themake smoke/make doctorflows already do this). - If running new-project checks in CI, add
--non-interactiveor force--mode existing. - If Python cannot import
tomllib, use Python 3.11+.
Before tagging or publishing changes to this generator, run:
- Run automated pre-release flow:
make release-check
- Confirm CI workflow is still valid:
.github/workflows/ai-docs-freshness.yml
- Optional manual breakdown (if you need step-by-step):
make build-bootstrapmake compilemake smokemake check-bootstrapmake stale-report
Use clear, generator-focused changelog entries:
- Include: feature, fix, and behavior changes that affect generated output
- Include: CLI flag additions/changes (
--check,--non-interactive,--report-path, etc.) - Include: CI contract changes (exit code behavior, artifact names, skip logic)
- Exclude: purely cosmetic README wording tweaks unless behavior changed
Suggested format:
- Date (UTC)
- Change type (
feat,fix,docs,ci,refactor) - What changed
- Why it matters for users/CI
- Any migration note (if command behavior changed)
This project is licensed under the MIT License. See LICENSE for full text.
Contribution process and validation expectations are documented in CONTRIBUTING.md.
Use the repository issue templates for consistent triage:
- Bug reports:
.github/ISSUE_TEMPLATE/bug_report.md - Feature requests:
.github/ISSUE_TEMPLATE/feature_request.md