Architecture Analyze Agent
Map your entire system automatically! Generate multi-repo diagrams and visualize data flow to master complex architecture
What it does
The Architecture Analyze Agent automatically discovers, maps, and documents your entire software architecture—generating visual diagrams, API documentation, cost optimization recommendations, and operational runbooks.
Think of it as your automated principal architect that reverse-engineers your system and creates production-ready documentation.
You'll get:
System architecture diagrams (15+ formats: Mermaid, PlantUML, D2, Draw.io)
Complete API documentation with endpoints and data flows
Cost optimization analysis with savings projections
Disaster recovery blueprints with RPO/RTO targets
Production-ready code examples and operational runbooks
⏱️ Analysis time: 5-15 minutes depending on codebase size
Sample Prompts
Examples
pre‑deploy‑review
Prompt: “Analyze our service mesh and identify any single‑points‑of‑failure before deploying the new microservice.”
auth‑route‑audit
Prompt: “Verify all authentication routes and dataflows to ensure no unsecured endpoints exist.”
high‑latency‑diagnosis
Prompt: “Inspect the architecture for components contributing to the 200 ms latency spikes in the checkout flow.”
scaling‑risk‑assessment
Prompt: “Evaluate our current setup for risks when scaling from 100 to 10 000 concurrent users.”
third‑party‑dependency‑map
Prompt: “Generate a diagram showing external APIs and their expected request volumes for security review.”
Why use it
Instead of:
Spending 30-40 hours manually documenting architecture
Reverse-engineering systems from outdated diagrams
Guessing at cost optimization opportunities
Creating DR plans from scratch
You get:
Automated discovery of your entire tech stack
Multi-format diagrams ready to edit
$335K+ average annual cloud savings identified
Production-ready monitoring and error handling code
Week-by-week implementation roadmap
Impact:
30-40 hours saved per project on documentation
40-60% cloud cost reduction (average)
15-minute RPO / 4-hour RTO for disaster recovery
What it analyzes
The agent performs deep analysis across multiple layers:
1. Technology Stack Discovery
Scans: Languages, frameworks, cloud services Finds: Python versions, React/Node.js, Databricks, AWS/Azure/GCP Example: Detects "Python 3.11, FastAPI, Databricks Unity Catalog, Delta Lake"
2. Component Mapping
Analyzes: Directory structures, config files Finds: Microservices, APIs, databases, storage layers Example: Maps package.json, Dockerfile, terraform files to system boundaries
3. Data Flow Analysis
Reads: Source code, API calls, data pipelines Finds: Medallion architecture (Bronze/Silver/Gold), API endpoints, auth flows Example: Traces data from ingestion → transformation → consumption
4. Security Architecture
Maps: Defense-in-depth layers, access controls Finds: Network isolation, authentication, encryption, RBAC Example: Documents 8-layer security framework with Private Link setup
5. Cost Optimization
Analyzes: Compute resources, storage, network Finds: Auto-termination gaps, spot instance opportunities, rightsizing needs Example: Identifies $335K+ annual savings in unused compute
6. Disaster Recovery
Plans: Multi-region failover, backup strategies Finds: Recovery point objectives (RPO), recovery time objectives (RTO) Example: Creates active-passive setup with 15-min RPO / 4-hour RTO
How to use it
Basic analysis
Analyze your current directory:
bash
or in natural language:
Specific analyses
Full system with all diagram formats:
Focus on cost optimization:
CI/CD architecture:
Security architecture only:
Specific directory:
What you'll see
During analysis
bash
Reports generated
You'll get 5 comprehensive documentation files:
1. Architecture Documentation
File: architecture-documentation.md
Contains:
Technology Stack Analysis: Complete breakdown of backend, data layers, infrastructure
API Specification: All discovered endpoints with request/response formats
Visual Blueprints: 15+ diagrams including:
System overview
Data flow (Medallion architecture)
Component diagrams
Sequence diagrams
ER diagrams
Multi-Format Export: Mermaid, PlantUML, D2, Draw.io XML
Example output:
markdown
2. CI/CD Architecture
File: cicd-pipeline-architecture.md
Contains:
Pipeline Orchestration: Complete GitHub Actions workflows (600+ lines)
Environment Strategy: Dev → Staging → Prod promotion path
Quality Gates: Automated testing, security scanning, manual approvals
Deployment Patterns: Blue-green, canary, rolling updates
Example output:
yaml
3. Cost Optimization Analysis
File: cost-optimization-analysis.md
Contains:
Current Spend Analysis: Breakdown by service, region, resource type
Optimization Opportunities: Auto-termination, spot instances, rightsizing
ROI Projections: 3-year savings forecast
Implementation Roadmap: Week-by-week plan
Example output:
4. Disaster Recovery Blueprint
File: disaster-recovery-architecture.md
Contains:
Resiliency Targets: RPO (15 minutes), RTO (4 hours)
Failover Procedures: Active-passive multi-region setup
Automated Scripts: Failover automation code
Testing Procedures: DR drill runbooks
Example output:
5. Production-Ready Code & Operations
Files: production_ready_code_examples.py, operational-guide.md
Contains:
Hardened Code: Circuit breakers, exponential backoff, structured logging
Operational Runbooks: Common tasks (scaling, troubleshooting, monitoring)
Security Hardening: Network isolation, RBAC, encryption
Example output:
python
After analysis
1. Review the architecture documentation
Open architecture-documentation.md to see:
Complete system overview
All discovered APIs and endpoints
Visual diagrams in multiple formats
Technology stack breakdown
2. Implement cost optimizations
Follow the quick wins in cost-optimization-analysis.md:
Enable auto-termination on compute clusters
Switch non-prod workloads to spot instances
Rightsize over-provisioned resources
Implement data lifecycle policies
Typical savings: $300K-$500K annually
3. Deploy CI/CD improvements
Use the workflows in cicd-pipeline-architecture.md:
Copy GitHub Actions workflows to
.github/workflows/Set up quality gates (testing, security scanning)
Configure environment promotion (Dev → Staging → Prod)
Enable automated deployments
4. Harden production systems
Use production_ready_code_examples.py:
Add circuit breakers to external API calls
Implement exponential backoff with retry logic
Switch to structured JSON logging
Add comprehensive error handling
5. Prepare disaster recovery
Follow the DR blueprint in disaster-recovery-architecture.md:
Set up multi-region replication
Configure automated failover scripts
Schedule quarterly DR drills
Document runbooks for emergencies
Quality benchmarks
Use these standards to measure architectural quality:
Documentation Coverage
100%
All components documented
Diagram Accuracy
Current
Reflects actual system state
Cost Efficiency
Auto-termination enabled
No wasted compute
DR Preparedness
RPO 15min / RTO 4hr
Business continuity
Security Layers
8-layer defense-in-depth
Comprehensive protection
Architecture maturity levels:
✅ Production Ready: All targets met, DR tested, costs optimized
⚠️ Needs Hardening: Documentation complete, DR planned, some cost waste
❌ Early Stage: Incomplete docs, no DR plan, high cost waste
Common issues
Analysis taking too long?
Start with specific directory: "Analyze only the ./api directory"
Skip certain analyses: "Analyze architecture but skip cost optimization"
Larger codebases may take 15-20 minutes
Diagrams not rendering?
Copy Mermaid/PlantUML code to specialized viewers
Use Draw.io XML files for visual editing
Check diagram syntax in generated markdown
Missing components in diagrams?
Ensure all config files are present (package.json, Dockerfile, etc.)
Check that services are running or have recent activity
Verify cloud provider credentials for service discovery
Cost analysis shows no savings?
Your infrastructure may already be optimized
Run analysis on production environment for accurate data
Check for auto-termination and spot instance usage
Reports not generated?
Check write permissions in output directory
Verify sufficient disk space
Look for errors in analysis output
Examples
Quick architecture overview:
Full analysis with all diagrams:
API documentation:
Cost optimization focus:
Security architecture:
DR planning:
Last updated

