SourceAtlas PRD v2.9.6
**AI-Powered Codebase Understanding Assistant**
SourceAtlas PRD v2.9.6
AI-Powered Codebase Understanding Assistant
- Version: 2.9.6
- Last Updated: 2025-12-21
- Status: โ Stable
Executive Summary
SourceAtlas is an intelligent code understanding assistant integrated into Claude Code. Through the architecture of Claude Commands (slash commands) + Lightweight Scripts, it provides real-time project understanding, pattern learning, and impact analysis capabilities within the developer's workflow.
Core Positioning Shift:
- โ NOT: A standalone CLI indexing tool
- โ BUT: A native Claude Code analysis assistant (Commands)
Core Features
- ๐ฏ Real-time Exploration: No pre-indexing required, analyze on-demand
- ๐ Standard Format: Uses YAML format with complete ecosystem support
- ๐ง Intelligent Understanding: AI dynamic reasoning, not static indexing
- โก Workflow Integration: Seamlessly integrated into Claude Code
- ๐ ๏ธ Lightweight Design: Scripts collect data, AI handles understanding
- ๐ Quality Assurance: Constitution v1.0 ensures consistent analysis quality
Table of Contents
- Product Positioning
- Use Cases
- Product Architecture
- Core Capabilities
- Output Format Decisions
- Command Interface Design
- Scripts Design
- Analysis Methodology
- Implementation Specifications
- Success Metrics
- Implementation Roadmap
1. Product Positioning
1.1 Product Evolution
v2.0 (Completed) - Manual Prompts Methodology
โ
v2.7 (Completed) - SourceAtlas Commands โ
โโ Claude Code Commands Integration
โโ 6 Core Commands Completed
โโ Git History Temporal Analysis
โโ 141 Patterns Support
โ
v2.8.1 - Constitution v1.1 + Handoffs โ
โโ Analysis Quality Framework (7 Articles)
โโ Automated Compliance Validation
โโ Monorepo Detection Support
โโ Discovery-driven Handoffs (Article VII: Handoffs Principles)
โ
v2.8.2 - Branch-Aware Analysis โ
โโ Git Branch Detection
โโ Monorepo Subdirectory Awareness
โโ Package Name Identification
โโ Context-Aware Output Path Suggestions
โ
v2.9.6 (Current) - Full Feature Set
โโ /atlas.deps Command
โโ Library Usage Point Analysis
โโ Breaking Change Comparison
โโ Migration Checklist Generation
โ
v3.0 (Future) - SourceAtlas Monitor
โโ Continuous Tracking System
โโ Historical Trend Analysis
โโ Health Dashboard
1.2 Why Choose Skill Architecture
Problem: Limitations of Standalone CLI
The standalone CLI tool designed in the original PRD has the following issues:
| Problem | Impact |
|---|---|
| Requires index export | Developers need to leave Claude Code |
| Pre-build index | Cannot handle dynamic changes |
| Reinventing the wheel | Claude Code already has file operation tools |
| Long development cycle | 8 weeks to complete MVP |
| High learning curve | Need to memorize new CLI commands |
Solution: Skill + Scripts
| Advantage | Description |
|---|---|
| Native Integration | Use /atlas.* commands directly in Claude Code |
| Real-time Analysis | On-demand exploration, no pre-indexing |
| Zero Learning Cost | Natural language interaction |
| Rapid Development | 1-2 weeks to complete core features |
| AI-Driven | Leverage Claude's understanding capabilities |
1.3 Target Users
- Primary: Engineers developing with Claude Code
- Scenarios: Taking over new projects, learning existing patterns, debugging, code review
- Frequency: Multiple times daily
2. Use Cases
Scenario 0: Quickly Understanding a New Project (Project Overview) โญ
Context:
Alice just joined the team and needs to quickly understand a 2000+ LOC project
PM expects her to start contributing tomorrow
Traditional Approach:
- Start reading from README
- Open files one by one to browse directory structure
- Guess tech stack and architecture patterns
- Ask senior colleagues
- Takes 2-3 days to get a global concept
Using SourceAtlas:
Alice: /atlas.overview
AI analyzes and responds (10-15 minutes):
=== Project Fingerprint Analysis ===
๐ Basic Information:
- Project Type: WEB_APP
- Scale: MEDIUM (~3500 LOC)
- Architecture Pattern: MVC + Service Layer
๐ง Tech Stack:
Backend: Ruby on Rails 7.0
Database: PostgreSQL + Redis
Frontend: React 18 + TypeScript
๐๏ธ Architecture Inference (Confidence: 0.85):
- Controllers handle HTTP requests
- Services contain business logic
- Jobs handle async tasks
- Policies manage permissions
๐ก Key Findings:
1. Has complete test coverage (85%+)
2. Uses Sidekiq for background tasks
3. AI Collaboration Level: Level 3 (has CLAUDE.md)
๐ Priority Reading Files:
1. app/models/user.rb - Core data model
2. app/services/order_service.rb - Main business logic
3. config/routes.rb - API route definitions
Time Saved: From 2-3 days โ 10-15 minutes to achieve 70-80% understanding
Follow-up Actions:
- Need to learn specific patterns โ
/atlas.pattern - Need to modify code โ
/atlas.impactto assess impact
Scenario 1: Taking Over Legacy System (Bug Fix)
Context:
New developer Alice needs to fix a bug:
"After user login, specific roles cannot see the order list"
Traditional Approach:
- Search "orders" โ 50 files
- Guess it's OrdersController?
- Find authorization logic, but where's the Policy?
- Ask senior colleague (might be busy)
- Takes 2 hours
Using SourceAtlas:
Alice: /atlas.impact "order list authorization"
AI responds:
Order list authorization chain:
1. OrdersController#index (app/controllers/orders_controller.rb:23)
โ Calls authorize(@orders)
2. OrderPolicy#index? (app/policies/order_policy.rb:15)
โ Checks user.role and store permissions
3. Related tests: spec/requests/orders_spec.rb:45
Possible issue:
- OrderPolicy modified 2 days ago
- Commit: "fix: update role check logic"
Suggestion: First check order_policy.rb:18 role judgment logic
Time Saved: From 2 hours โ 15 minutes
Scenario 2: New Feature Development (Learning Existing Patterns)
Context:
PM: "We need a new feature: users can export invoice PDFs"
Developer Bob: "OK, but how does this project handle PDF generation?"
Using SourceAtlas:
Bob: /atlas.pattern "file generation"
AI responds:
This project's file generation pattern (Example: Order PDF):
Standard Process:
1. Controller receives request
2. Enqueue background job GeneratePdfJob
3. Service uses Prawn gem to generate
4. Upload to S3 (config/storage.yml:15)
5. Send email notification to user
Reference Implementation:
- Service: app/services/order_pdf_service.rb
- Job: app/jobs/generate_pdf_job.rb
- Test: spec/services/order_pdf_service_spec.rb
To add invoice PDF following this pattern:
1. Create InvoicePdfService
2. Create GenerateInvoicePdfJob
3. Configure S3 bucket
4. Update InvoiceMailer
Value: Avoid redesign, follow existing architecture
Scenario 3: Impact Scope Analysis
Impact analysis is a critical need in development, including two common situations:
3A. Cascading Impact of Model Changes
Context:
Found in test environment: After changing User model validation rules,
3 seemingly unrelated features broke
Using SourceAtlas:
Developer: /atlas.impact "User model validation"
AI responds:
Impact scope of User model validation changes:
Direct Impact (4 places):
- RegistrationController#create
- Admin::UsersController#update
- Api::V1::ProfileController#update
- UserImportService (bulk import)
Cascading Impact (3 places):
- Order model (belongs_to :user, validates: true)
- Notification service (assumes user.email is always valid)
- Analytics job (depends on user data structure)
Test Coverage Gaps:
โ ๏ธ UserImportService has no validation failure tests
โ ๏ธ Order#user association doesn't test invalid user
Suggestions:
1. First add missing tests
2. Check Notification service's email handling
Value: Prevent cascading failures, add tests proactively
3B. Library/Framework Upgrade (โญ High-Frequency Scenario)
Context:
Need to upgrade React 17 โ 18, or axios 0.x โ 1.x
Unsure which APIs the project uses, which will be affected by breaking changes
Traditional Approach:
- Read Migration Guide, search item by item
grepsearch, but might miss dynamic imports- Try upgrading, see what breaks
- Often miss things, takes days
Using SourceAtlas:
Developer: /atlas.deps "react"
AI responds:
=== Dependency Analysis: react ===
๐ฆ Version Info:
- Current Version: 17.0.2
- Latest Stable: 18.2.0
๐ Usage Statistics:
- Import Count: 156 places
- APIs Used: 23 types
๐ API Usage Details:
| API | Usage Count | File Count | React 18 Status |
|-----|------------|-----------|----------------|
| `useState` | 89 | 45 | โ
Compatible |
| `useEffect` | 67 | 38 | โ
Compatible |
| `ReactDOM.render` | 3 | 1 | โ ๏ธ Deprecated โ createRoot |
| `componentWillMount` | 5 | 3 | ๐ด Removed |
โ ๏ธ Breaking Changes Impact:
1. **ReactDOM.render** (3 places)
- `src/index.tsx:5` - App entry point
- `src/utils/modal.tsx:12` - Modal helper
- `tests/setup.ts:3` - Test setup
โ Need to use `createRoot`
2. **componentWillMount** (5 places)
- `src/legacy/OldComponent.tsx:15`
- `src/legacy/AnotherOld.tsx:22`
โ Need to use `useEffect` or `componentDidMount`
๐ Migration Checklist:
- [ ] Update src/index.tsx: ReactDOM.render โ createRoot
- [ ] Refactor 3 Legacy component lifecycles
- [ ] Update test setup
- [ ] Check Concurrent Mode compatibility
Estimated Effort: 4-6 hours
Risk Level: ๐ก Medium (has deprecated APIs)
Value:
- Complete inventory of all usage points, avoid omissions
- Automatically compare breaking changes
- Generate specific Migration Checklist
- Assess effort and risk
3C. API Change Impact Scope
Context:
Backend API endpoint changes, need to inventory which frontend pages will be affected
Example: GET /api/users/{id} response format changes
- 'role' field changes from string to array 'roles'
- Added nested 'profile' object
Using SourceAtlas:
Developer: /atlas.impact api "/api/users/{id}"
AI responds:
=== API Impact Analysis ===
๐ Call Chain:
1. API Layer
- src/types/api.ts (type definitions)
- src/lib/apiClient.ts (call wrapper)
2. Hook Layer
- src/hooks/useUser.ts (main Hook)
โ Used by 5 components
3. Component Layer
- src/app/profile/page.tsx
- src/app/users/[id]/page.tsx
- src/components/UserCard.tsx
- src/components/UserBadge.tsx
- src/app/dashboard/page.tsx
๐ Field Usage Analysis:
'role' field (โ ๏ธ Will be changed to 'roles' array):
- Usage Count: 8 places
- Key Locations:
1. UserBadge.tsx:34 - Render role badge
if (user.role === 'admin') { ... }
2. permissions.ts:12 - Permission check
return user.role === 'admin' || user.role === 'editor'
3. UserForm.tsx:67 - Form display
4. useUser.ts:23 - Data transformation
- Assumes string type: โ
Yes (all)
- Impact Assessment: ๐ด Breaking Change (requires modification)
๐งช Test Impact:
Need to update 5 test files:
- useUser.test.ts - Mock data
- UserBadge.test.tsx
- permissions.test.ts
- UserForm.test.tsx
- e2e/user-profile.spec.ts
๐ Migration Checklist:
[ ] Update API type definitions (api.ts)
[ ] Update 8 places role โ roles usage
[ ] Change to user.roles.includes('admin')
[ ] Add backward compatibility if needed
[ ] Update 5 test files
[ ] Test all affected pages
Estimated Effort: 2-3 hours
Risk Level: ๐ด High (breaking change)
Value:
- Discover all impact points in advance, avoid omissions
- Provide clear modification list and migration steps
- Assess effort and risk level
- Reduce frontend-backend collaboration friction
Applicable Scenarios:
- API Response format changes
- Adding required parameters
- Field removal or renaming
- Status code logic changes
Scenario 4: Code Review (Understanding Change Intent)
Context:
Received PR: Added PaymentRefundService
Reviewer unfamiliar with payment module, needs to quickly understand context
Using SourceAtlas:
Reviewer: /atlas.review PR#123
AI responds:
This PR adds refund service to payment module
Module Context:
- Existing: PaymentService (charge, capture)
- Existing: PaymentWebhookHandler
- New: PaymentRefundService โ This PR
Architecture Compliance: โ
Good
- Follows existing Service Object pattern
- Error handling consistent (Result pattern)
- Naming follows conventions
Potential Issues:
โ ๏ธ Missing idempotency handling (PaymentService has it)
โ ๏ธ Webhook handler needs update to support refund events
โ ๏ธ Test coverage 85% (suggest >90% for payment logic)
Suggestions:
1. Reference PaymentService#charge's idempotency implementation
2. Update webhook_handler.rb
Value: Improve review quality, reduce back-and-forth revisions
Scenario 5: Technical Debt Management (Project Health)
Context:
Tech Lead needs to report to CTO:
"How serious is our technical debt? Refactoring priorities?"
Using SourceAtlas:
Tech Lead: /atlas.health
AI responds:
Project Health Report
๐ด High-Risk Areas (Need Immediate Action):
1. PaymentService
- Complexity: 450 lines, 8 dependencies
- Depended by 12 files (core module)
- Modified 23 times in 6 months (high churn)
- Test coverage 78% (payment logic should be >95%)
โ Suggestion: Split into multiple small Services + add tests
2. User model
- God Object pattern (15 concerns)
- Affects 45 files
โ Suggestion: Extract Authentication, Authorization as separate modules
๐ก Medium Risk (Plan refactoring):
...
โ
Healthy Areas:
- API Controllers (98% consistency)
- Background Jobs (95% test coverage)
Value: Quantify technical debt, priority ranking
Scenario Classification
| Scenario Type | Need Characteristics | Applicable Product | Commands Used |
|---|---|---|---|
| Real-time Exploration | No historical data, real-time reasoning | โ SourceAtlas Commands | |
| Scenario 0: Quickly understand new project โญ | 10-15 min global view | โ Commands | /atlas.overview โญโญโญโญโญ |
| Scenario 1: Bug fixing | Quickly locate issues | โ Commands | /atlas.flow + /atlas.impact |
| Scenario 2: Learning patterns | Identify design patterns | โ Commands | /atlas.pattern โญโญโญโญโญ |
| Scenario 3B: Library upgrade | Inventory dependency usage points | โ Commands | /atlas.deps โญโญโญโญโญ |
| Scenario 3C: API impact analysis | Track API call chain | โ Commands | /atlas.impact โญโญโญโญ |
| Scenario 4: Code Review | Understand change intent | โ Commands | /atlas.overview + /atlas.pattern |
| Continuous Tracking | Need historical data, trend analysis | ๐ฎ SourceAtlas Monitor (v3.0) | |
| Scenario 3A: Model change impact | Git history, association analysis | โ Commands | /atlas.history |
| Scenario 5: Technical debt | Continuous tracking, quantified metrics | ๐ฎ Monitor | /atlas.health (future) |
3. Product Architecture
3.1 Overall Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Claude Code Environment โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ SourceAtlas Commands (Slash Commands) โ
โ โโ /atlas.overview - Project Fingerprint โญโญโญโญโญ
โ โโ /atlas.pattern - Learn Patterns โญโญโญโญโญ
โ โโ /atlas.impact - Impact Analysis โญโญโญโญ
โ โโ /atlas.history - Git Temporal Analysis โญโญโญโญ
โ โโ /atlas.flow - Flow Tracing โญโญโญโญ
โ โโ /atlas.deps - Dependency Analysis โญโญโญโญโญ
โ โโ /atlas.init - Project Setup โญโญโญ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Helper Scripts (Bash) โ
โ โโ detect-project.sh โ
โ โโ scan-entropy.sh โ
โ โโ find-patterns.sh โ
โ โโ collect-git.sh โ
โ โโ analyze-dependencies.sh โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Claude Code Built-in Tools โ
โ โโ Glob (file pattern matching) โ
โ โโ Grep (content search) โ
โ โโ Read (file reading) โ
โ โโ Bash (command execution) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Historical Evolution: SourceAtlas evolved from standalone CLI design to Claude Code Commands integration. Complete evolution process in
dev-notes/HISTORY.md
3.2 File Structure
Current Status (v1.0 completed, v2.5 in development):
sourceatlas2/
โโโ .claude/commands/ # Claude Code Commands
โ โโโ atlas.overview.md # โ
/atlas.overview (completed)
โ โโโ atlas.pattern.md # โ
/atlas.pattern (completed) โญ
โ โโโ atlas.impact.md # โ
/atlas.impact (completed)
โ
โโโ dev-notes/ # โญ v1.0 Development Records (Important!)
โ โโโ HISTORY.md # โ
Complete history and decision records
โ โโโ KEY_LEARNINGS.md # โ
v1.0 key learnings summary
โ โโโ toon-vs-yaml-analysis.md # โ
Format decision analysis
โ โโโ v1-implementation-log.md # โ
Complete implementation log
โ โโโ implementation-roadmap.md # โ
v2.5 roadmap
โ โโโ NEXT_STEPS.md # โ
Next steps guide
โ
โโโ PROMPTS.md # Manual Prompts (Stage 0/1/2)
โ
โโโ scripts/atlas/ # Helper Scripts
โ โโโ detect-project-enhanced.sh # โ
Scale-aware detection
โ โโโ scan-entropy.sh # โ
High-entropy file scanning
โ โโโ find-patterns.sh # โ
Pattern identification (completed) โญ
โ โโโ benchmark.sh # โ
Performance testing
โ โโโ compare-formats.sh # โ
Format comparison
โ # Planned:
โ # โโโ collect-git.sh # โณ Git statistics (Phase 2)
โ # โโโ analyze-dependencies.sh # โณ Dependency analysis (Phase 3)
โ
โโโ plugin/ # ๐ฎ Marketplace publishing preparation
โ โโโ (separate plugin structure)
โ
โโโ test_results/ # Validation cases (git ignored)
โโโ test_targets/ # Test projects (git ignored)
โ
โโโ CLAUDE.md # AI work guide
โโโ PRD.md # Product requirements document
โโโ PROMPTS.md # Complete prompt templates
โโโ README.md # Project overview
โโโ USAGE_GUIDE.md # Usage guide
Note:
- โ = Completed
- ๐ต = In Development (Phase 1)
- โณ = Planned (Phase 2-3)
- ๐ฎ = Future Features
4. Core Capabilities
4.1 Three-Stage Analysis (Retain v2.0 Core)
Stage 0: Project Fingerprint
- Goal: Scan <5% of files to achieve 70-80% understanding
- Method: High-entropy file prioritization (README, package.json, Models)
- Output: YAML format project fingerprint
- Time: 10-15 minutes
Stage 1: Hypothesis Validation
- Goal: Validate Stage 0 hypotheses, achieve 85-95% understanding
- Method: Systematic validation, provide evidence
- Output: Validation report
- Time: 20-30 minutes
Stage 2: Git Hotspots Analysis
- Goal: Identify development patterns, 95%+ understanding depth
- Method: Analyze commit history, identify hotspots
- Output: Git analysis report
- Time: 15-20 minutes
4.2 Real-time Exploration Capabilities (New)
Pattern (Pattern Recognition) โญโญโญโญโญ
/atlas.pattern "api endpoint"
AI identifies:
1. Find best example files
2. Extract design pattern
3. Explain conventions
4. Provide step-by-step guidance
Impact (Impact Analysis) โญโญโญโญ
/atlas.impact api "/api/users/{id}"
AI analyzes:
1. Track call chain
2. Identify affected files
3. Assess change risk
4. Provide migration list
4.3 AI Collaboration Recognition (Retain v2.0 Discovery)
Identify project's AI collaboration maturity (Level 0-4):
| Level | Characteristics | Identification Method |
|---|---|---|
| Level 0 | No AI | Traditional code style |
| Level 1-2 | Basic use | Occasional AI traces |
| Level 3 | Systematic | CLAUDE.md, high consistency, detailed comments |
| Level 4 | Ecosystem | Team-level AI collaboration (future) |
5. Output Format Decisions
5.1 Format Choice: YAML (v1.0 Decision)
Decision Result: Use YAML as Stage 0 output format
Evaluation Process: During v1.0 implementation, evaluated custom TOON (Token Optimized Output Notation) format
| Feature | JSON | YAML | TOON (Evaluated) |
|---|---|---|---|
| Token Efficiency | Baseline | Baseline +15% | Baseline -14% โ |
| Ecosystem | Wide | Wide โ | None |
| Readability | Medium | High โ | High |
| IDE Support | โ | โ โ | โ |
| Tool Support | Many | Many โ | None |
| Learning Curve | Low | Low โ | Needs learning |
TOON vs YAML Test Results (cursor-talk-to-figma-mcp project):
- TOON: 807 tokens
- YAML: 938 tokens
- Difference: 131 tokens (14% savings)
Decision Rationale:
- 14% savings is marginal benefit - Not the expected 30-50%
- Content is 85%, structure only 15% - Limited benefit of optimizing structure
- High ecosystem value - YAML has complete toolchain, IDE support, widespread use
- Aligns with "minimalist" philosophy - Use standard tools, don't reinvent the wheel
- Development efficiency - No need to maintain custom parser and documentation
Complete Analysis: See dev-notes/toon-vs-yaml-analysis.md
5.2 YAML Format Specification
Used for Stage 0 output:
metadata:
project_name: EcommerceAPI
scan_time: "2025-11-22T10:00:00Z"
scanned_files: 12
total_files_estimate: 450
project_fingerprint:
project_type: WEB_APP
framework: Rails 7.0
architecture: Service-oriented
scale: LARGE
tech_stack:
backend:
language: Ruby 3.1
framework: Rails 7.0
database: PostgreSQL 14
hypotheses:
architecture:
- hypothesis: "Uses Service Object pattern for business logic"
confidence: 0.9
evidence: "app/services/ has 15 Service classes"
validation_method: "Check Service class structure and calling patterns"
Format Decision History: v1.0 evaluated custom TOON format (14% token savings), but ultimately chose YAML for ecosystem support. Details in
dev-notes/HISTORY.mdanddev-notes/toon-vs-yaml-analysis.md
6. Command Interface Design
6.1 Core Commands (By Priority)
# Priority โญโญโญโญโญ - Most frequently used features
/atlas.overview # Project overview (Stage 0 fingerprint)
/atlas.overview src/api # Analyze specific directory
/atlas.pattern "api endpoint" # Learn how project implements API endpoints
/atlas.pattern "background job" # Learn background job patterns
/atlas.pattern "file upload" # Learn file upload flow
# Priority โญโญโญโญโญ - Dependency analysis
/atlas.deps "react" # Analyze React usage
/atlas.deps "axios" # Analyze axios usage
/atlas.deps "lodash" --breaking # Show breaking changes impact
# Priority โญโญโญโญ - Impact scope analysis
/atlas.impact "User authentication" # Feature change impact
/atlas.impact api "/api/users/{id}" # API change impact
# Priority โญโญโญโญ - Git history analysis
/atlas.history # Entire project hotspots
/atlas.history auth # Module analysis (auto-detect)
/atlas.history src/auth/login.ts # Single file detailed analysis
# Priority โญโญโญโญ - Flow tracing
/atlas.flow "user checkout" # Trace checkout flow
/atlas.flow "from OrderService" # Trace from specific Service
# Priority โญโญโญ - Project setup
/atlas.init # Inject SourceAtlas trigger rules into CLAUDE.md
# Future features (v3.0+)
/atlas.health # Project health analysis
/atlas.review PR#123 # PR change analysis
Complete Three-Stage Analysis (Rare scenario):
For deep due diligence scenarios (evaluating open source projects, hiring assessment, technical due diligence), use PROMPTS.md to manually execute complete Stage 0-1-2 analysis:
# Applicable scenarios:
โ
Evaluate if open source project is suitable for adoption
โ
Evaluate developer candidate's work
โ
Technical due diligence (investment, acquisition)
โ
Complete assessment before major refactoring
# Not applicable to daily development work (use above Commands)
6.2 Command Definition Structure
Example 1: /atlas.overview (Project Overview)
# .claude/commands/atlas.overview.md
---
description: Get project overview - scan <5% of files to achieve 70-80% understanding
allowed-tools: Bash, Glob, Grep, Read
argument-hint: [optional: specific directory to analyze]
---
# SourceAtlas: Project Overview (Stage 0 Fingerprint)
## Context
Analysis Target: $ARGUMENTS
Goal: Generate project fingerprint by scanning <5% of files in 10-15 minutes.
## Your Task
Execute Stage 0 Analysis using information theory principles:
1. Run: `bash scripts/atlas/detect-project.sh`
2. Run: `bash scripts/atlas/scan-entropy.sh`
3. Apply high-entropy file prioritization
4. Generate 10-15 hypotheses with confidence levels
5. Output YAML format report
### High-Entropy Priority:
1. Documentation (README, CLAUDE.md)
2. Config files (package.json, etc.)
3. Core models (3-5 samples)
4. Entry points (1-2 samples)
5. Tests (1-2 samples)
Output Format: YAML (Standard format with ecosystem support)
Time Limit: 10-15 minutes
Understanding Target: 70-80%
STOP after Stage 0 - do not proceed to validation or git analysis.
Example 2: /atlas.pattern (Learn Design Patterns)
# .claude/commands/atlas.pattern.md
---
description: Learn design patterns from the current codebase
allowed-tools: Bash, Glob, Grep, Read
argument-hint: [pattern type, e.g., "api endpoint", "background job"]
---
# SourceAtlas: Pattern Learning Mode
## Context
Project structure: !`tree -L 2 -d --charset ascii`
Pattern type requested: **$ARGUMENTS**
## Your Task
Goal: Help the user learn how THIS codebase implements the requested pattern.
Workflow:
1. Run: `bash scripts/atlas/find-patterns.sh "$ARGUMENTS"`
2. Identify 2-3 exemplary implementations
3. Extract the design pattern
4. Provide actionable guidance
Output Format:
- Pattern name and standard approach
- Best example files with line numbers
- Key conventions to follow
- Common pitfalls to avoid
- Testing patterns
Remember: Scan <5% of files, focus on patterns not exhaustive details.
Example 3: /atlas.deps (Dependency Analysis)
# .claude/commands/atlas.deps.md
---
description: Analyze dependency usage for library/framework upgrades
allowed-tools: Bash, Glob, Grep, Read, WebFetch
argument-hint: [library name, e.g., "react", "axios", "lodash"]
---
# SourceAtlas: Dependency Analysis
## Context
Target library: $ARGUMENTS
Goal: Analyze how this library is used in the codebase to facilitate upgrade planning.
## Your Task
1. **Identify Current Version**
- Check package.json, requirements.txt, Cargo.toml, go.mod, etc.
- Note: locked version vs declared version
2. **Find All Import/Usage Points**
- Search for import statements
- Search for require() calls
- Search for dynamic imports
- Count total usage occurrences
3. **Categorize API Usage**
- List all unique APIs/functions used from the library
- Count usage frequency for each
- Identify deprecated APIs if known
4. **Breaking Changes Assessment** (if --breaking flag or latest version differs)
- Fetch library's CHANGELOG or migration guide (WebFetch if needed)
- Cross-reference with found usages
- Highlight affected code locations
5. **Generate Migration Checklist**
- List all files needing changes
- Provide specific file:line references
- Estimate effort level
## Output Format
```yaml
dependency_analysis:
library: [name]
current_version: [version]
latest_version: [version]
usage_summary:
total_imports: [number]
unique_files: [number]
api_count: [number]
api_usage:
- api: [function/class name]
count: [number]
files: [list of file:line]
status: compatible | deprecated | removed
breaking_changes:
- change: [description]
affected_files: [count]
locations:
- file: [path]
line: [number]
current_usage: [code snippet]
migration: [suggested fix]
migration_checklist:
- task: [description]
files: [list]
effort: low | medium | high
risk_level: low | medium | high
estimated_effort: [hours]
Key Principles
- Focus on USED APIs, not all available APIs
- Provide specific file:line references (Constitution Article IV)
- Include migration suggestions, not just problem identification
- Assess risk honestly
---
#### Example 4: `/atlas.init` (Project Setup)
```markdown
# .claude/commands/atlas.init.md
---
description: Initialize SourceAtlas in current project - inject auto-trigger rules into CLAUDE.md
allowed-tools: Read, Write, Edit
---
# SourceAtlas: Project Initialization
## Purpose
Inject SourceAtlas auto-trigger rules into the project's CLAUDE.md so Claude Code
knows when to automatically suggest using Atlas commands.
## Behavior
1. Check if CLAUDE.md exists in project root
2. If exists: Append SourceAtlas section (avoid duplicates)
3. If not exists: Create minimal CLAUDE.md with SourceAtlas section
## Injected Content (English)
The command injects the following section:
## SourceAtlas Auto-Trigger Rules
When encountering these situations, automatically execute the corresponding command:
| User Intent | Command |
|-------------|---------|
| "What is this project", "Help me understand codebase" | `/atlas.overview` |
| "How to implement X pattern", "Learn the approach" | `/atlas.pattern [pattern]` |
| "What will this change affect" | `/atlas.impact [target]` |
| Just entered project + unfamiliar | `/atlas.overview` |
## Design Rationale
- Similar to spec-kit's `specify init` approach
- Enables Claude Code to auto-suggest Atlas commands contextually
- Uses English by default (international standard)
- Non-invasive: appends to existing CLAUDE.md
7. Scripts Design
7.1 Design Principles
Scripts only do data collection, not understanding reasoning
# โ
Good Script Design
detect_project_type() {
# Output raw data
echo "package.json: $(test -f package.json && echo 'exists')"
echo "composer.json: $(test -f composer.json && echo 'exists')"
# AI judges itself whether it's Node or PHP project
}
# โ Bad Script Design
detect_project_type() {
# Don't do judgment logic in Script
if [ -f "package.json" ]; then
echo "This is a Node.js project"
fi
}
7.2 Core Scripts
scripts/atlas.stage0.sh
#!/bin/bash
# Stage 0: Collect basic project information
main() {
echo "=== Project Detection ==="
detect_project_files
echo ""
echo "=== Project Stats ==="
project_statistics
echo ""
echo "=== High-Entropy Files ==="
list_high_entropy_files
echo ""
echo "=== Directory Structure ==="
show_structure
}
detect_project_files() {
# Check if key files exist
for file in package.json composer.json requirements.txt Gemfile pom.xml; do
[ -f "$file" ] && echo "Found: $file"
done
}
project_statistics() {
# Basic statistics
echo "Total files: $(find . -type f | wc -l)"
echo "Total lines: $(find . -name '*.rb' -o -name '*.js' | xargs wc -l | tail -1)"
echo "Languages: $(find . -name '*.rb' -o -name '*.js' -o -name '*.py' | \
sed 's/.*\.//' | sort | uniq -c)"
}
list_high_entropy_files() {
# List high-entropy files (README, configs, Models)
find . -maxdepth 2 -iname 'readme*' -o -iname 'claude*'
find . -name 'package.json' -o -name 'composer.json'
find . -path '*/models/*' -o -path '*/app/models/*' | head -5
}
show_structure() {
# Show directory structure (2 levels)
tree -L 2 -d --charset ascii 2>/dev/null || find . -maxdepth 2 -type d
}
main
scripts/atlas.find.sh
#!/bin/bash
# Smart search helper tool
search_term="$1"
main() {
echo "=== File Name Search ==="
find . -iname "*${search_term}*" -type f | head -10
echo ""
echo "=== Content Search ==="
grep -r -i "$search_term" --include="*.rb" --include="*.js" . | head -20
echo ""
echo "=== Related Files ==="
# After finding files containing search term, list their dependencies
grep -l -r -i "$search_term" . | head -5
}
main
7.3 Scripts vs AI Division of Labor
| Task | Responsible | Example |
|---|---|---|
| File listing | Script | find . -name "*.rb" |
| Content search | Script | grep -r "User" |
| Statistics | Script | wc -l, git log --stat |
| Understand intent | AI | "This is user authentication module" |
| Identify patterns | AI | "Uses Service Object pattern" |
| Infer relationships | AI | "Changing User model will affect Order" |
| Generate suggestions | AI | "Suggest splitting into multiple Services" |
8. Analysis Methodology
8.1 High-Entropy File Priority Strategy (Retain v2.0)
Information Theory Basis:
Information Entropy = Amount of "surprising" information a file contains
High-entropy files: README.md, Models, config files
โ Contains project-level understanding, data structures, architecture decisions
Low-entropy files: Repetitive CRUD Controllers, boilerplate code
โ Patterns are predictable, low value when viewed alone
Scanning Priority:
1. README.md, CLAUDE.md (project description, specifications)
2. package.json, composer.json (tech stack, dependencies)
3. Models (3-5 core) (data structure)
4. Routes, Controllers (1-2) (API design)
5. Main config files (environment, integration)
8.2 Bayesian Reasoning Model (Retain v2.0)
Prior Probability (Stage 0) + Evidence (Stage 1) = Posterior Probability
Example:
Stage 0 hypothesis: "Uses JWT authentication" (confidence 0.7)
Based on: package.json has jsonwebtoken
Stage 1 validation: grep "jwt" โ Found 5 usage points
Evidence: Auth middleware, Token generation, validation logic
Posterior probability: Confidence raised to 0.95 โ
Confirmed
8.3 Pattern Recognition Rules
Architecture Patterns
MVC:
indicators:
- directories: [models, views, controllers]
- framework: Rails, Django
Service-oriented:
indicators:
- directory: services/
- naming: *_service.rb
- pattern: Single responsibility
Microservices:
indicators:
- multiple: package.json
- docker: docker-compose.yml
- gateway: API gateway config
Design Patterns
Repository:
indicators:
- suffix: Repository
- methods: [find, save, delete]
Factory:
indicators:
- suffix: Factory
- methods: [create, build]
Observer:
indicators:
- methods: [subscribe, notify]
- gems: [wisper, eventmachine]
9. Implementation Specifications
9.1 Tech Stack
skill:
format: Markdown
location: .claude/skills/atlas.md
size: ~500 lines
scripts:
language: Bash (POSIX)
location: scripts/
total_size: ~1000 lines
dependencies:
required: [bash, find, grep, git]
optional: [tree, jq]
templates:
format: Plain text + YAML
location: templates/
9.2 Development Priorities
Phase 1: Core Commands Framework (Week 1)
- Create
.claude/commands/directory structure โ - Implement
/atlas.overview- Project fingerprint โญโญโญโญโญ โ (2025-11-20) - Implement
/atlas.pattern- Learn patterns โญโญโญโญโญ โ (2025-11-22) - Implement
find-patterns.shscript โ (2025-11-22) - YAML format output โ (v1.0 decision)
Phase 2: Impact Analysis Features
- Implement
/atlas.impact- Static impact analysis โญโญโญโญ โ (2025-11-25)- API change impact (Scenario 3B)
- Frontend-backend call chain analysis
- Test impact assessment
- Swift/ObjC language deep analysis (auto-triggered)
Phase 3: Enhancement & Release (Current)
- Implement
/atlas.init- Project setup โญโญโญ โ (2025-11-30)- Inject SourceAtlas trigger rules into CLAUDE.md
- Let Claude Code auto-suggest using Atlas commands
- Expand multi-language support (Kotlin โ , Python โ , TypeScript/React/Vue โ , Go/Rust TBD)
- Improve Git analysis Scripts
- Overall testing and documentation
- User feedback collection
- Release v2.5.4
Decision: /atlas.find cancelled (functionality covered by existing 3 commands)
10. Success Metrics
10.1 Quantitative Metrics
| Metric | Target | Measurement | v2.0 Validation Result |
|---|---|---|---|
| Understanding Accuracy | >85% | AI can correctly locate features | โ 87-100% |
| Token Savings | >80% | vs complete file reading | โ 95%+ |
| Time Savings | >90% | vs manual understanding | โ 95%+ |
| Stage 0 Accuracy | >70% | Hypothesis validation rate | โ 75-95% |
| Usage Frequency | 3+ times/day | Developer actual usage | ๐ To test |
10.2 Qualitative Metrics
user_experience:
- Learning cost: < 5 minutes to get started
- Response speed: < 30 seconds to get results
- Accuracy: 85%+ useful
- Integration: Seamlessly integrated into workflow
technical_quality:
- Script execution: < 5 seconds to complete data collection
- Error handling: Graceful degradation
- Compatibility: Support mainstream languages (Ruby, JS, Python, Go)
10.3 Acceptance Criteria
Basic Features
- Stage 0 can complete analysis within 15 minutes โ
- Stage 1 validation rate >80% โ
- Stage 2 identifies AI collaboration patterns โ
-
/atlas.overviewcan quickly generate project fingerprint โ (2025-11-20) -
/atlas.patterncan identify design patterns โ (2025-11-22, 95%+ accuracy) -
/atlas.impactstatic impact analysis โ (2025-11-25, 4.2/5 average rating, 8 subagent tests)
Quality Standards
- Tested on 4+ real projects โ
(
/atlas.patterntested on 3 large projects) - Scripts run on macOS โ (Linux to be tested)
- Provide clear messages on errors โ
- User feedback >4/5 score (to be collected)
11. Implementation Roadmap
Detailed Roadmap & Version History: See dev-notes/ROADMAP.md
Historical Version Detailed Records: See dev-notes/archives/2025-11-prd-roadmap-history.md
Current Status Summary
| Version | Status | Main Features |
|---|---|---|
| v1.0 | โ | Methodology validation (5 project tests) |
| v2.5.4 | โ | Commands architecture + 141 patterns |
| v2.6.0 | โ | /atlas.history temporal analysis |
| v2.7.0 | โ | /atlas.flow flow tracing (11 patterns) |
| v2.8.1 | โ | Constitution v1.1 + Handoffs |
| v2.9.0 | โ | /atlas.deps dependency analysis |
| v3.0 | ๐ฎ | Language expansion (Go/Ruby) + Monitor |
Core Commands
| Command | Purpose | Completion Date |
|---|---|---|
/atlas.init | Project initialization | 2025-11-30 |
/atlas.overview | Project fingerprint | 2025-11-20 |
/atlas.pattern | Learn design patterns | 2025-11-22 |
/atlas.impact | Impact scope analysis | 2025-11-25 |
/atlas.history | Git temporal analysis | 2025-11-30 |
/atlas.flow | Flow tracing | 2025-12-01 |
/atlas.deps | Dependency analysis | 2025-12-12 |
Appendix A: Design Decision Records
Complete Design Decision Records: See dev-notes/archives/decisions/2025-11-prd-design-decisions.md
Key Decisions Summary
| Decision | Choice | Rationale |
|---|---|---|
| CLI vs Commands | Commands | Native integration, fast development, user control |
| Scripts Responsibility | Only data collection | AI handles understanding reasoning |
| Continuous Indexing | Deferred | First validate real-time exploration value |
| YAML vs TOON | YAML | Ecosystem > 14% token optimization |
Version Information
Current Version: v2.9.6 (2025-12-21)
Development Status:
- v1.0 โ - Methodology validation completed (5 project tests)
- v2.5.4 โ
- Commands architecture completed
/atlas.overviewโ - Project overview (completed, 2025-11-20)/atlas.patternโ - Pattern learning (completed, 2025-11-22) โญ/atlas.impactโ - Static impact analysis (completed, 2025-11-25)/atlas.initโ - Project initialization (completed, 2025-11-30)- Multi-language support: iOS (34), Kotlin (31), Python (26), TypeScript/React/Vue (50) = 141 patterns
- v2.6.0 โ
- Temporal analysis completed
/atlas.historyโ - Git history analysis (completed, 2025-11-30)- Core outputs: Hotspots + Coupling + Recent Contributors
- v2.7.0 โ
- Flow analysis completed
/atlas.flowโ - Flow tracing (completed, 2025-12-01) โญ- 11 analysis patterns: Language-specific entry point detection
- 10 boundary types: API, DB, LIB, LOOP, MQ, CLOUD, AUTH, PAY, FILE, PUSH
- Entry point identification accuracy: 60% โ 90%
- v2.8.0 โ
- Constitution v1.0 quality framework
- Constitution v1.0 โ - Immutable principles for analysis behavior (completed, 2025-12-05)
- validate-constitution.sh โ - Automated compliance validation
- Monorepo detection โ - lerna/pnpm/nx/turborepo/npm workspaces
- Quality improvements: +3900% file:line references, -63% output lines, -95% validation cost
- v2.8.1 โ
- Discovery-driven Handoffs
- Constitution v1.1 โ - Added Article VII: Handoffs Principles (completed, 2025-12-06)
- Dynamic next step suggestions โ - Based on analysis findings, suggest 1-2 most relevant follow-up commands
- 5 Sections: Discovery-driven, termination conditions, suggestion count, parameter quality, rationale quality
- Test results: 27 scenarios 95%+ maturity
- v2.9.6 โ
- Full Feature Set
/atlas.depsโ - Dependency usage analysis (completed, 2025-12-12)- Core features: Library usage point inventory, Breaking Change comparison, Migration Checklist
- Target scenario: Library/Framework upgrades (Scenario 8)
- Complete three-stage analysis: Use
PROMPTS.mdmanual execution (deep due diligence scenarios)
Decision Records (2025-12-08) - v2.9.0:
- ๐ต Added
/atlas.depscommand: Specifically handles Library/Framework upgrade scenarios- Problem identification: Scenario 8 (Library upgrades) currently lacks specialized tools
- Design choice: New command (semantic clarity) rather than extending impact (conceptual confusion)
- Core features: Usage inventory, Breaking Change comparison, Migration Checklist
- Output format: YAML (complies with existing Constitution specifications)
Decision Records (2025-12-06) - v2.8.2:
- โ
Branch-Aware Context: Learning from spec-kit's context-aware design
- Git branch detection: Auto-identify current branch
- Monorepo subdirectory awareness: Detect relative paths
- Package name identification: Extract from package.json/Cargo.toml/go.mod/pyproject.toml
- Context Metadata: YAML metadata includes
contextblock
- โ
--save parameter: Optional save analysis results to
.sourceatlas/overview.yaml - โ Built-in quality checks: Constitution Section 5.4
Decision Records (2025-12-06) - v2.8.1:
- โ Constitution v1.1 implemented: Added Article VII: Handoffs Principles
- โ
Discovery-driven Handoffs completed: 27 test scenarios validated, 95%+ maturity
- Core insight: SourceAtlas is exploratory tool (non-linear), not suitable for spec-kit's linear handoffs
- Design choice: Dynamically generate suggestions based on actual findings, not statically list all possible commands
- 5 Sections: Discovery-driven(7.1), termination conditions(7.2), suggestion count(7.3), parameter quality(7.4), rationale quality(7.5)
- โ
/atlas.validatecommand cancelled: Changed to built-in quality checks- Inspiration source: spec-kit checklist.md's "Unit Tests for English" concept
- Cancellation reason: Standalone command over-engineered, analysis outputs usually consumed immediately, judge quality themselves
- Alternative approach: Built-in automatic checks before each command output, warn if non-compliant
Decision Records (2025-12-05):
- โ Constitution v1.0 implemented: Learning from spec-kit's Constitution pattern
- โ 7 Articles: Information theory, exclusion principles, hypothesis principles, evidence principles, output principles, scale awareness, revision principles
Decision Records (2025-12-01):
- โ
/atlas.flowP0-A accuracy improvement: Language-specific patterns + confidence scoring
Decision Records (2025-11-30):
- โ
Naming decision:
/atlas.history(3 votes won, intuitive, cross-platform universal) - โ Design decision: Single command + smart output (zero parameters preferred, facilitates cross-platform porting)
- โ
Remove
/atlas.expert- Low value for legacy takeovers (original author may have left) - โ Politically friendly design: Show "Recent Contributors" instead of "Ownership %"
Decision Records (2025-11-25):
- โ
Cancel
/atlas.find- Functionality already covered by existing 3 commands
Complete Version History & Decision Records: See
dev-notes/HISTORY.md
This document is licensed under CC-BY-SA 4.0
Related Documents
Fleet Management System - Product Requirements Document (PRD)
Fleet operators managing commercial vehicles face significant operational inefficiencies due to:
AGENTS.md โ ShakkaShell v2.0
> Instructions for AI coding agents working on this project.
๐ง Joey Developer Dashboard (Vercel + API Integration)
This dashboard is a web-based interface built using **Next.js (or Astro)** and hosted on **Vercel**. It acts as the control center for Joeyโs stock intelligence, allowing you to:
CLAHub v2 โ Product Requirements Document
CLAHub is a GitHub-integrated platform for managing Contributor License Agreements (CLAs). Project owners create CLAs for their repositories (or entire organizations), contributors sign them via GitHub authentication, and pull request status checks are automatically updated.