From Idea to Production in 28 Days
From Idea to Production in 28 Days
October 31, 2025 - I opened my terminal with a simple idea: What if an AI system could improve itself?
November 26, 2025 - Cortex was production-ready with 27,000+ lines of code, 5 master agents, and a self-improving MoE learning system.
This is that story.
Day 1 (Oct 31): The Spark
It started with frustration. I was managing multiple GitHub repositories manually:
- Reviewing pull requests
- Running security scans
- Updating documentation
- Deploying releases
All repetitive. All automatable. But existing tools were static - they didn’t learn or improve.
The Question: What if the automation system learned from every action and got smarter over time?
Hour 1-2: Research
- Explored Mixture of Experts papers
- Reviewed multi-agent architectures
- Sketched initial design on whiteboard
Hour 3-4: First Code
mkdir cortex
cd cortex
npm init -y
# First file: coordination/coordinator/master.js
# First commit: "Initial project structure"
Hour 5-8: Core Architecture
- Master-worker pattern design
- JSONL event stream prototype
- Basic task routing
Day 1 Commits: 12
Week 1 (Nov 1-7): Foundation
Day 2-3: Coordinator Master
The brain of the system. Routes tasks to specialist masters.
Key Decisions:
- Pattern-based routing (not pure ML)
- Confidence scoring for decisions
- JSONL for event streaming
Breakthrough Moment:
// This pattern worked beautifully
const confidence = calculateConfidence(task, masters);
const selectedMaster = selectBestMaster(confidence);
// Simple, interpretable, learnable
Day 4-5: Development Master
First specialist master. Handles feature implementation and bug fixes.
Challenge: How to spawn workers dynamically?
Solution:
// Worker spawning became dead simple
spawnWorker({
type: 'implementation-worker',
task: taskData,
master: 'development-master'
});
Day 6-7: Learning System
The magic ingredient - pattern tracking and outcome learning.
Key Insight: Don’t try to learn everything. Focus on:
- Which master succeeded for which task type?
- What patterns led to success/failure?
- How confident should we be in routing decisions?
Week 1 Stats:
- Commits: 87
- Lines of code: ~3,000
- Features: Core architecture complete
- Sleep: Not enough
Week 2 (Nov 8-14): Specialization
Day 8-9: Security Master
CVE scanning, vulnerability remediation, compliance monitoring.
Real Test: Scanned Cortex itself
- Found 10 Path Traversal vulnerabilities (CWE-23)
- Security-master fixed all 10 autonomously
- Took 2 hours total
Proof of concept achieved.
Day 10-11: Inventory Master
Repository cataloging and documentation generation.
Why This Matters:
Before: Manual repo documentation
After: Auto-generated, always current
Before: Unknown dependency versions
After: Tracked in real-time
Day 12-14: CI/CD Master
Build automation, test orchestration, deployment workflows.
The Integration:
// Masters now work together
Task: "Deploy new feature"
↓
CI/CD-Master: Run tests
Development-Master: Review code
Security-Master: Security scan
CI/CD-Master: Deploy to production
Week 2 Stats:
- Commits: 142
- Lines of code: ~8,000
- Features: All 5 masters operational
- Bugs fixed: 23
Week 3 (Nov 15-21): Intelligence
Day 15-16: Neural Routing
Added PyTorch-based task routing alongside pattern matching.
Hybrid Approach:
- Pattern matching for interpretability
- Neural net for complex patterns
- Fallback to rules if confidence low
Day 17-18: Learning Loop
Implemented the continuous improvement cycle:
1. Execute task
2. Measure outcome
3. Extract patterns
4. Update confidence scores
5. Store for future routing
Watching It Learn:
Day 15: "auth bug" → Development (confidence: 0.75)
Day 16: "auth bug" → Development (confidence: 0.78)
Day 17: "auth bug" → Development (confidence: 0.82)
Day 18: "auth bug" → Development (confidence: 0.87)
Beautiful.
Day 19-21: Observability
Elastic APM, Kibana dashboards, custom metrics, alerting.
Why: You can’t improve what you don’t measure.
Result: 128 REST API endpoints, full instrumentation.
Week 3 Stats:
- Commits: 189
- Lines of code: ~15,000
- Features: Learning system operational
- “Aha!” moments: 7
Week 4 (Nov 22-26): Production Readiness
Day 22-23: Governance Framework
SOC2 & GDPR compliance automation, access control, audit logging.
Enterprise Features:
- Role-based access control
- Complete audit trail
- Compliance reporting
- Quality validation gates
Day 24-25: Polish & Refine
- Documentation completion
- API reference generation
- Setup guides
- Error handling improvements
- Edge case fixes
The Rename: Day 25 evening - decided to rename from “commit-relay” to “Cortex”
- Used Cortex’s own development-master to execute rename
- 925 files updated
- Meta-programming in action
Day 26 (Nov 26): Production Deployment
Morning: Final testing Afternoon: Deploy to production Evening: Monitor metrics
Status: ✅ All systems operational
Week 4 Stats:
- Commits: 104 (slower, more deliberate)
- Lines of code: ~27,000
- Features: Production-ready
- Bugs in production: 0 (so far!)
The Numbers
Development Velocity
Total commits: 794
Days: 28
Average: 28.4 commits/day
Peak: 47 commits in one day
Longest break: 0 days (worked every day)
Code Metrics
Total lines: ~27,000
JavaScript: ~18,000
Documentation: ~5,000
Config/JSON: ~3,000
Tests: ~8,000 (separate)
Test coverage: 94%
Architecture
Masters: 5
Worker types: 7
Daemons: 9
API endpoints: 128
Event types: 47
Key Decisions
What Went Right ✅
1. Master-Worker Pattern
- Clear separation of concerns
- Easy to scale
- Fault tolerant
2. JSONL Events
- Simple
- Debuggable
- No database needed
3. File-Based State
- No external dependencies
- Easy backup
- Fast enough
4. Hybrid Routing
- Pattern + neural nets
- Best of both worlds
- Interpretable
5. AI-Accelerated Development
- 10x velocity
- Maintained quality
- Made 4 weeks possible
What I’d Change 🔄
1. Earlier Testing
- Week 1-2: Minimal tests
- Week 3-4: Scrambled to add coverage
- Next time: Test-first from day 1
2. More Documentation
- Week 1-3: Minimal docs
- Week 4: Doc sprint
- Next time: Document as you go
3. Smaller Commits
- Some commits were too large
- Harder to review
- Split complex changes earlier
4. More Breaks
- 28 days straight was intense
- Needed mental downtime
- Next time: Plan rest days
Lessons Learned
Technical
1. Start Simple, Add Complexity
Don't start with:
- Complex neural routing
- Distributed databases
- Microservices
Start with:
- Pattern matching
- File-based state
- Monolithic masters
Add complexity when needed, not before.
2. Make It Observable
If you can't see it, you can't debug it.
If you can't debug it, you can't improve it.
3. Embrace Failure
Workers will crash.
Masters will hang.
Tasks will fail.
Design for failure, not success.
Process
1. AI as Collaborator
Not: "AI, write this feature"
But: "AI, let's design this feature together"
The difference is ownership and understanding.
2. Iterate Rapidly
Ship → Learn → Improve → Repeat
4 weeks of this beats 6 months of planning.
3. Trust Your Instincts
Gut feeling about an architecture?
Investigate.
Uneasy about a decision?
Discuss with AI and iterate.
The Meta-Programming Moment
Day 25: Using Cortex to rename itself from commit-relay to Cortex.
This wasn’t just symbolic - it was validation:
- Development-master routed the rename task
- Implementation workers updated 925 files
- Pattern learning improved routing for future renames
- System successfully improved itself
This is what I built Cortex for.
What’s Next for Cortex?
Immediate (Dec 2025)
- Open source the MoE learning framework
- Write comprehensive tutorials
- Build community
Short-term (Q1 2026)
- Multi-repository management
- GitHub Actions integration
- Slack notifications
- Custom master development
Long-term (2026)
- Transfer learning across projects
- Meta-learning optimization
- Academic research collaboration
- Enterprise features
For You
If you’re building something similar, remember:
- Start small - Core functionality first
- Ship early - Learn from real usage
- Use AI - It’s a force multiplier
- Make it learn - Static systems are dead systems
- Have fun - If you’re not enjoying it, why build it?
Tomorrow
Next week, I’ll dive deeper into specific topics:
- How Cortex routes tasks to specialist masters
- The learning loop that improves routing over time
- Building a coordinator master from scratch
- Meta-programming techniques
- PyTorch neural routing implementation
This is just the beginning of the story.
The Real Insight
Building Cortex in 4 weeks wasn’t about working faster - it was about:
- AI eliminating friction at every step
- Rapid iteration instead of perfect planning
- Learning by building instead of learning then building
- Meta-programming to improve the tool while using it
The future of development isn’t AI replacing developers. It’s developers using AI to achieve the previously impossible.
And that’s exactly what happened here.
This is part of the Cortex series, documenting the journey of building a self-improving AI system. Visit Meet Cortex for an overview of the architecture, or explore the full series for deep dives into MoE routing, learning systems, meta-programming, and more.