Aichaku Architecture
This document explains the architectural design of Aichaku, focusing on the “why” behind key decisions.
The fundamental distinction
Section titled “The fundamental distinction”Aichaku’s architecture reflects a core insight about software development: teams need different types of guidance for different aspects of their work.
Methodologies are holistic workflows
Section titled “Methodologies are holistic workflows”When you adopt Shape Up, you’re not just using a planning template - you’re embracing an entire philosophy about how to build software. You need:
- The shaping process to define work
- The betting table to prioritize
- The six-week cycles to execute
- The cool-down periods to reflect
This is why Aichaku copies entire methodology directories. You can’t do “half of Shape Up” any more than you can bake half a cake.
Standards are modular guidelines
Section titled “Standards are modular guidelines”In contrast, coding standards are independent modules. You can:
- Use OWASP security practices without adopting a security methodology
- Apply TDD without following XP
- Write conventional commits in any workflow
This is why standards are selectively integrated - you pick what applies to your context.
Architectural layers
Section titled “Architectural layers”User interface layer
Section titled “User interface layer”Aichaku provides two primary interfaces:
CLI interface: Direct commands for setup and configuration
- Simple, memorable commands (
init,integrate,standards) - Consistent flags across commands
- Clear error messages that guide users
Claude interface: Natural language within selected methodology
- No commands to memorize
- Context-aware responses
- Progressive disclosure of complexity
Command layer
Section titled “Command layer”Commands reflect the methodology/standards distinction:
Bulk operations (methodologies):
init: Copies complete methodology packagesintegrate: Injects behavioral rules into CLAUDE.md
Selective operations (standards):
standards --add: Cherry-picks specific standardsstandards --remove: Removes individual standards
This separation makes the conceptual model clear through the interface.
Core services layer
Section titled “Core services layer”Three essential services power Aichaku:
Installer service: Handles bulk copying of methodologies
- Validates source and destination paths
- Preserves directory structure
- Manages file permissions
Injector service: Manages selective standard integration
- Parses CLAUDE.md safely
- Preserves user customizations
- Updates standard content blocks
Lister service: Discovers available resources
- Scans methodology directories
- Categorizes standards
- Provides metadata
Data layer
Section titled “Data layer”The file system serves as Aichaku’s database:
Why files instead of a database?
- Transparency: Users can see and edit everything
- Version control: Git tracks all changes naturally
- Portability: No dependencies or migration issues
- Claude compatibility: Direct file access for the AI
Directory structure as schema:
.claude/├── methodologies/ # Bulk resources (complete packages)├── standards/ # Selective resources (individual files)└── output/ # User work (generated content)Integration architecture
Section titled “Integration architecture”Claude integration philosophy
Section titled “Claude integration philosophy”Aichaku enhances Claude through structure, not restriction:
- Persistent memory: Projects live in predictable locations
- Visual language: Consistent emoji indicators
- Natural triggers: Keywords from selected methodologies
- Progressive enhancement: Complexity only when needed
- Focused expertise: Sub-agents provide specialized knowledge
Sub-Agent Architecture
Section titled “Sub-Agent Architecture”Aichaku employs specialized sub-agents to manage context and provide focused expertise:
Core Agents:
- Orchestrator: General workflow coordinator
- Security Reviewer: OWASP and security best practices
- Documenter: Documentation generation and lifecycle
- Methodology Coach: Adaptive methodology guidance
- Code Explorer: Codebase discovery and analysis
- API Architect: API design and documentation
Technology Experts:
- Language specialists (TypeScript, Python, Go, etc.)
- Framework experts (React, Deno, Tailwind, etc.)
- Tool specialists (PostgreSQL, Lume, Vento, etc.)
Context Management:
- Each agent maintains focused context (~4K tokens vs 12K+ for monolithic approaches)
- Agents delegate to each other for specialized tasks
- Orchestrator coordinates multi-agent workflows
- Methodology-aware loading reduces irrelevant context
The two-phase approach
Section titled “The two-phase approach”Phase 1: Discussion
- Triggered by methodology keywords
- No file creation
- Exploratory conversation
- Idea refinement
Phase 2: Creation
- Explicit user signal required
- Immediate file generation
- No confirmation prompts
- Clear status reporting
This respects user autonomy while providing structure.
MCP server architecture
Section titled “MCP server architecture”The Model Context Protocol server provides real-time analysis:
Claude <-> MCP Server <-> Review Engine <-> Standards Manager <-> Methodology ManagerThis optional enhancement layer adds:
- Live security scanning
- Standards compliance checking
- Methodology adherence validation
Security architecture
Section titled “Security architecture”Principle of least privilege
Section titled “Principle of least privilege”Every operation requests only necessary permissions:
- Read: Only from Aichaku directories
- Write: Only to designated output paths
- Execute: Only for git operations
- Network: Never required
Defense in depth
Section titled “Defense in depth”Multiple security layers protect users:
- Input validation: All paths sanitized
- Path containment: No directory traversal
- Safe defaults: Conservative permissions
- Explicit operations: No automatic execution
Offline by design
Section titled “Offline by design”Aichaku requires no network access:
- All resources bundled
- No telemetry or tracking
- No external dependencies
- Complete airgap compatibility
Performance architecture
Section titled “Performance architecture”Optimization strategies
Section titled “Optimization strategies”Lazy loading: Resources loaded only when needed
- Methodologies scanned on demand
- Standards read during integration
- Templates cached after first use
Efficient operations:
- Batch file operations when possible
- Stream large files instead of loading
- Async I/O for non-blocking operations
Memory management:
- Clear caches between operations
- Limit concurrent file handles
- Stream output for large results
Agent architecture
Section titled “Agent architecture”Agent Template System
Section titled “Agent Template System”Agents are defined through structured templates that specify:
name: aichaku-{agent-name}description: Agent's specialized focustools: ["Read", "Write", "Edit", "Bash", "Grep", "Glob"]methodology_aware: true|falseexamples: - context: When to use this agent user: "Example user question" assistant: "How the agent responds"delegations: - trigger: When to hand off target: Which agent to delegate toAgent Coordination
Section titled “Agent Coordination”Orchestrator Pattern: The orchestrator agent serves as a general coordinator, routing tasks to appropriate specialists based on the work context.
Delegation Flow:
- User request analyzed by current agent
- Agent identifies need for specialized knowledge
- Delegation to target agent with context
- Results flow back through chain
Context Isolation: Each agent maintains its own context window, preventing contamination and allowing focused expertise.
Agent Benefits
Section titled “Agent Benefits”Performance: 70% reduction in context usage vs loading all methodologies enables longer sessions Expertise: Deep, focused knowledge in specific domains Scalability: New agents added without affecting existing ones Flexibility: Agents composed for complex workflows
Extension architecture
Section titled “Extension architecture”Adding methodologies
Section titled “Adding methodologies”New methodologies follow a simple pattern:
- Create directory in
/methodologies/ - Add
[METHODOLOGY]-AICHAKU-GUIDE.md - Include
/templates/subdirectory - Provide mode-specific templates
The system automatically discovers and integrates new methodologies.
Adding standards
Section titled “Adding standards”Standards are even simpler:
- Choose appropriate category directory
- Create Markdown file with standard content
- Follow the established template format
No registration or configuration needed.
Adding agents
Section titled “Adding agents”New agents follow the template pattern:
- Create directory in
/core/agent-templates/ - Add
base.mdwith YAML frontmatter - Include 10+ idiomatic code examples
- Define delegation patterns
Agents are automatically available to Claude Code.
Future plugin system
Section titled “Future plugin system”The architecture supports future extensions:
interface AichakuPlugin { name: string; version: string; methodologies?: MethodologyDefinition[]; standards?: StandardDefinition[]; commands?: CommandDefinition[]; hooks?: HookDefinition[];}This would enable:
- Third-party methodologies
- Custom commands
- Workflow automation
- Tool integrations
Design decisions
Section titled “Design decisions”Why copy all methodologies?
Section titled “Why copy all methodologies?”The problem: Teams need flexibility to adapt their process, but setting up new methodologies creates friction.
The solution: Copy all methodologies during initialization.
Trade-offs:
- ✅ Zero friction to try new approaches
- ✅ Works completely offline
- ✅ Supports methodology mixing
- ❌ Uses more disk space (~300KB)
- ❌ Creates more files in repositories
Why it’s worth it: The flexibility gained far outweighs the minimal disk usage. Teams can experiment freely without setup overhead.
Why inject standards into CLAUDE.md?
Section titled “Why inject standards into CLAUDE.md?”The problem: Claude needs consistent access to coding standards, but reading multiple files impacts performance.
The solution: Selected standards are injected directly into CLAUDE.md.
Trade-offs:
- ✅ Single file for Claude to read
- ✅ Fast performance
- ✅ User can customize injected content
- ❌ Larger CLAUDE.md files
- ❌ Potential sync issues with source
Why it’s worth it: Performance and customization benefits outweigh the maintenance considerations.
Why enforce directory structure?
Section titled “Why enforce directory structure?”The problem: Flexible paths create complexity for automation and Claude integration.
The solution: Enforce the .claude/ directory convention.
Trade-offs:
- ✅ Predictable file locations
- ✅ Reliable automation
- ✅ Clear project boundaries
- ❌ Less flexibility
- ❌ May conflict with some workflows
Why it’s worth it: Consistency enables powerful automation and reduces cognitive load.
Architectural principles
Section titled “Architectural principles”Simplicity over features
Section titled “Simplicity over features”Every feature must justify its complexity:
- Three modes instead of complex state machines
- File system instead of databases
- Copying instead of linking
- Keywords instead of commands
Explicit over implicit
Section titled “Explicit over implicit”Users should understand what’s happening:
- Clear phase transitions
- Visible file operations
- Obvious status indicators
- No hidden behavior
Flexibility through structure
Section titled “Flexibility through structure”Structure enables rather than constrains:
- All methodologies available
- Standards mixed freely
- Templates customizable
- Workflows adaptable
Human-centric design
Section titled “Human-centric design”Optimize for human understanding:
- Natural language interfaces
- Visual progress indicators
- Predictable organization
- Clear error messages
Future architectural considerations
Section titled “Future architectural considerations”Potential optimizations
Section titled “Potential optimizations”Symlinks for methodologies: Reduce disk usage by linking to global cache
- Saves space in projects
- Complicates Windows support
- May break with some tools
Incremental standard updates: Update only changed standards
- Reduces update time
- Adds complexity
- Requires version tracking
Lazy methodology loading: Fetch methodologies on first use
- Minimal initial footprint
- Requires network access
- Complicates offline use
Scaling considerations
Section titled “Scaling considerations”The current architecture scales well for:
- Hundreds of projects
- Dozens of standards
- Multiple methodologies
- Large teams
Potential bottlenecks at scale:
- File system operations with thousands of projects
- CLAUDE.md size with many standards
- Discovery performance with many methodologies
These can be addressed if needed without architectural changes.
Summary
Section titled “Summary”Aichaku’s architecture embodies its core philosophy: provide complete methodologies for flexible workflows while maintaining focused standards for code quality. Every architectural decision supports this distinction, creating a system that’s both powerful and simple to understand.
The file-based approach may seem primitive compared to modern databases, but it provides transparency, portability, and compatibility that more complex systems struggle to match. Sometimes the simple solution is the right solution.