> **Constitution**: This command operates under [ANALYSIS_CONSTITUTION.md](../../ANALYSIS_CONSTITUTION.md) v1.0
/plugin marketplace add lis186/SourceAtlas/plugin install sourceatlas@lis186-SourceAtlasConstitution: This command operates under ANALYSIS_CONSTITUTION.md v1.0
Key principles enforced:
- Article I: High-entropy priority, scan ratio limits
- Article II: Mandatory directory exclusions
- Article III: Hypothesis count limits, required elements
- Article IV: Evidence format requirements
Arguments: ${ARGUMENTS:-.}
Save Mode: Check if --save is in arguments. If present:
--save from path argument.sourceatlas/overview.yaml.sourceatlas/ directory if neededAnalysis Target: Parse from arguments (default: current directory)
Goal: Generate a comprehensive project fingerprint by scanning <5% of files to achieve 70-80% understanding in 10-15 minutes.
If --force is NOT in arguments, check cache first:
Calculate cache path:
.: .sourceatlas/overview.yamlsrc/api): .sourceatlas/overview-src-api.yaml (slashes to -)Check if cache exists:
ls -la .sourceatlas/overview.yaml 2>/dev/null
If cache exists:
ls outputπ Loading cache: .sourceatlas/overview.yaml (N days ago)
π‘ Add --force to re-analyze
β οΈ Cache is over 30 days old, recommend re-analysis
---
[cache content]
If cache does not exist: Continue with the analysis flow below
If --force is in arguments: Skip cache check, execute analysis directly
Execute Stage 0 Analysis Only - generate a project overview using information theory principles.
IMPORTANT: Use the enhanced detection script for accurate file counts and scale-aware recommendations.
# Run enhanced detection script (RECOMMENDED)
# Try global install first, then local
if [ -f ~/.claude/scripts/atlas/detect-project.sh ]; then
bash ~/.claude/scripts/atlas/detect-project.sh ${ARGUMENTS:-.}
elif [ -f scripts/atlas/detect-project.sh ]; then
bash scripts/atlas/detect-project.sh ${ARGUMENTS:-.}
else
echo "Warning: detect-project.sh not found, using manual detection"
fi
The script will:
Scale-Aware Scan Limits:
Scale-Aware Hypothesis Targets:
Apply information theory - high-entropy files contain disproportionate information.
Scan Priority Order:
Documentation (Highest entropy)
Configuration Files (Project-level decisions)
Core Models (Data structure - scan 3-5 only)
Entry Points (Architecture patterns - scan 1-2 examples)
Tests (Development practices - scan 1-2 examples)
Execute scans:
# Use helper script if available (try global first, then local)
if [ -f ~/.claude/scripts/atlas/scan-entropy.sh ]; then
bash ~/.claude/scripts/atlas/scan-entropy.sh ${ARGUMENTS:-.}
elif [ -f scripts/atlas/scan-entropy.sh ]; then
bash scripts/atlas/scan-entropy.sh ${ARGUMENTS:-.}
else
echo "Warning: scan-entropy.sh not found, scanning manually"
fi
Based on scanned files, generate scale-appropriate hypotheses (use targets from Phase 1) about:
Technology Stack:
Architecture:
Development Practices:
AI Collaboration (SourceAtlas Signature Analysis):
Detect AI tool usage by scanning for tool-specific configuration files:
Tier 1: High-Confidence Indicators (Tool-Specific Config Files)
| Tool | Files to Check | Confidence Boost |
|---|---|---|
| Claude Code | CLAUDE.md, .claude/ | +0.30 |
| Cursor | .cursorrules, .cursor/rules/*.mdc | +0.25 |
| Windsurf | .windsurfrules, .windsurf/rules/ | +0.25 |
| GitHub Copilot | .github/copilot-instructions.md, **/.instructions.md | +0.20 |
| Cline/Roo | .clinerules, .clinerules/, .roo/ | +0.25 |
| Aider | CONVENTIONS.md, .aider.conf.yml, .aider.input.history | +0.25 |
| Continue.dev | .continuerules, .continue/rules/ | +0.25 |
| JetBrains AI | .aiignore | +0.20 |
| AGENTS.md | AGENTS.md (Linux Foundation standard, 60K+ projects) | +0.20 |
| Sourcegraph Cody | .vscode/cody.json | +0.15 |
| Replit | replit.nix + .replit (may indicate Replit Agent) | +0.15 |
| Ruler | .ruler/ (multi-tool manager) | +0.20 |
Tier 2: Indirect Indicators
| Indicator | Threshold | Interpretation |
|---|---|---|
| Comment density | >15% | AI-generated code (vs 5-8% manual) |
| Code consistency | >98% | Systematic AI assistance |
| Conventional Commits | 100% | AI tool integration |
| Docs-to-code ratio | >1:1 | AI documentation generation |
Level Definitions:
Detection Script (run during Phase 2):
# Use helper script for comprehensive AI tool detection
if [ -f ~/.claude/scripts/atlas/detect-ai-tools.sh ]; then
bash ~/.claude/scripts/atlas/detect-ai-tools.sh ${ARGUMENTS:-.}
elif [ -f scripts/atlas/detect-ai-tools.sh ]; then
bash scripts/atlas/detect-ai-tools.sh ${ARGUMENTS:-.}
else
# Fallback: manual checks
echo "Warning: detect-ai-tools.sh not found, checking manually"
ls -la CLAUDE.md .cursorrules .windsurfrules CONVENTIONS.md AGENTS.md .aiignore 2>/dev/null
ls -la .claude/ .cursor/rules/ .windsurf/rules/ .clinerules/ .roo/ .continue/rules/ .ruler/ 2>/dev/null
ls -la .github/copilot-instructions.md .vscode/cody.json .aider.conf.yml 2>/dev/null
fi
Business Domain:
Each hypothesis must include:
Generate output with branded header, then YAML format (standard, ecosystem-supported):
πΊοΈ SourceAtlas: Overview
βββββββββββββββββββββββββββββββ
π [project_name] β [SCALE] ([file count] files)
Then YAML content:
metadata:
project_name: "[detected name]"
scan_time: "[ISO 8601 timestamp]"
target_path: "${ARGUMENTS:-.}"
total_files: [actual count after exclusions]
scanned_files: [files read]
scan_ratio: "[percentage]"
project_scale: "[TINY|SMALL|MEDIUM|LARGE|VERY_LARGE]"
constitution_version: "1.1"
# Branch-Aware Context (v2.8.2)
context:
git_branch: "[branch name or null]"
relative_path: "[path within repo or null]"
package_name: "[detected package name or null]"
project_fingerprint:
project_type: "[WEB_APP|CLI|LIBRARY|MOBILE_APP|MICROSERVICE|MONOREPO]"
scale: "[TINY|SMALL|MEDIUM|LARGE|VERY_LARGE]"
# TINY: <500 LOC, SMALL: 500-2k, MEDIUM: 2k-10k, LARGE: 10k-50k, VERY_LARGE: >50k
primary_language: "[language + version]"
framework: "[framework + version]"
architecture: "[pattern name]"
tech_stack:
backend:
language: "[name + version]"
framework: "[name + version]"
database: "[name + version]"
frontend: # if applicable
language: "[name]"
framework: "[name]"
infrastructure: # if applicable
containerization: "[Docker/none]"
orchestration: "[K8s/none]"
hypotheses:
architecture:
- hypothesis: "[architectural pattern description]"
confidence: 0.0-1.0
evidence: "[file:line references]"
validation_method: "[how to verify]"
tech_stack:
- hypothesis: "[technology decision]"
confidence: 0.0-1.0
evidence: "[file:line references]"
validation_method: "[how to verify]"
development:
- hypothesis: "[development practice]"
confidence: 0.0-1.0
evidence: "[file:line references]"
validation_method: "[how to verify]"
ai_collaboration:
level: 0-4
confidence: 0.0-1.0
tools_detected:
- tool: "[tool name]"
config_file: "[file path]"
content_quality: "[minimal|basic|comprehensive]"
indicators:
- "[indicator 1]"
- "[indicator 2]"
# Level interpretation:
# 0: No AI (no config files, 5-8% comments)
# 1: Occasional (1 config, minimal content)
# 2: Frequent (1-2 configs + indirect indicators)
# 3: Systematic (complete config + high comments + consistent style)
# 4: Ecosystem (multiple tools/AGENTS.md + team standards)
business:
- hypothesis: "[business domain insight]"
confidence: 0.0-1.0
evidence: "[file:line references]"
validation_method: "[how to verify]"
scanned_files:
- file: "[path/to/file]"
reason: "[why scanned]"
key_insight: "[main learning]"
summary:
understanding_depth: "[70-80%]"
key_findings:
- "[finding 1]"
- "[finding 2]"
- "[finding 3]"
## Recommended Next
<!-- Dynamic suggestions based on findings, omit this section if end condition is met -->
| # | Command | Purpose |
|---|---------|---------|
| 1 | `/sourceatlas:pattern "[pattern name]"` | [reason based on findings] |
| 2 | `/sourceatlas:flow "[entry point]"` | [reason based on findings] |
π‘ Enter a number (e.g., `1`) or copy the command to execute
βββββββββββββββββββββββββββββββ
πΊοΈ v2.11.0 β Constitution v1.1
Follow Constitution Article VII: Handoffs Principles
β οΈ Important: The following two outputs are mutually exclusive, choose only one
Case A - End (Omit Recommended Next): When any of the following conditions are met, only output end message, no table:
Output:
β
**Analysis sufficient** - Project is small, can read all files directly to start development
Case B - Suggestions (Output Recommended Next Table): When project scale is large enough or there are clear next steps, only output table, no end message.
| Finding | Suggested Command | Parameter Source |
|---|---|---|
| Clear design patterns | /sourceatlas:pattern | Discovered pattern name |
| Complex architecture (multi-layer/microservices) | /sourceatlas:flow | Main entry point file |
| Scale β₯ LARGE | /sourceatlas:history | No parameters needed |
| High risk areas | /sourceatlas:impact | Risk file/module name |
Use numbered table:
| # | Command | Purpose |
|---|---------|---------|
| 1 | `/sourceatlas:pattern "repository"` | Found Repository pattern used in 15 places |
"repository" not "related pattern"Purpose: Prevent hallucinated file paths, incorrect counts, and fictional configurations from appearing in output. This phase runs AFTER output generation, BEFORE save.
After generating the YAML output, extract all verifiable claims:
Claim Types to Extract:
| Type | Pattern | Verification Method |
|---|---|---|
| File Path | scanned_files.file entries | test -f path |
| Directory | Architecture directories mentioned | test -d path |
| File Count | total_files, scanned_files | find . -type f | wc -l |
| Config File | AI tools config_file entries | test -f config_file |
| Git Branch | context.git_branch | git branch --show-current |
Run ALL verification checks in parallel:
# Execute all verifications in a single parallel block
# 1. Verify scanned_files entries exist
for path in "path/to/file1" "path/to/file2"; do
if [ ! -f "$path" ]; then
echo "β FILE_NOT_FOUND: $path"
fi
done
# 2. Verify AI tool config files
for config in "CLAUDE.md" ".cursorrules" ".github/copilot-instructions.md"; do
if [ ! -f "$config" ] && [ ! -d "$config" ]; then
echo "β CONFIG_NOT_FOUND: $config"
fi
done
# 3. Verify file count is reasonable
claimed_count=150
actual_count=$(find . -type f -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/.venv/*" 2>/dev/null | wc -l | tr -d ' ')
# Allow 10% variance for dynamic counts
if [ $((actual_count * 90 / 100)) -gt $claimed_count ] || [ $((actual_count * 110 / 100)) -lt $claimed_count ]; then
echo "β οΈ COUNT_CHECK: claimed $claimed_count, actual ~$actual_count"
fi
# 4. Verify git branch if claimed
claimed_branch="main"
actual_branch=$(git branch --show-current 2>/dev/null)
if [ "$actual_branch" != "$claimed_branch" ]; then
echo "β BRANCH_MISMATCH: claimed $claimed_branch, actual $actual_branch"
fi
If ALL checks pass:
If ANY check fails:
FILE_NOT_FOUND β Remove from scanned_files or find correct pathCONFIG_NOT_FOUND β Remove from tools_detected or verify pathCOUNT_CHECK β Update total_files with actual countBRANCH_MISMATCH β Update context.git_branchAdd to footer (before πΊοΈ v2.11.0 β Constitution v1.1):
If all verifications passed:
β
Verified: [N] scanned files, [M] config paths, file count
If corrections were made:
π§ Self-corrected: [list specific corrections made]
β
Verified: [N] scanned files, [M] config paths, file count
Before finalizing output, confirm:
scanned_files.file entries verified to existtools_detected.config_file entries verified to existtotal_files count verified against filesystemcontext.git_branch verified against current branchevidence file references in hypotheses verified to existIf --save flag is present in arguments:
mkdir -p .sourceatlas
Save YAML output to .sourceatlas/overview.yaml
Confirm save:
πΎ Saved to .sourceatlas/overview.yaml
File naming for subdirectory analysis:
.sourceatlas/overview.yamlsrc/api): .sourceatlas/overview-src-api.yaml