Kelly Factory — Overview
Compiled by: Router (subagent)
Date: 2026-04-27
Sources: Kelly Handbook Ch7 (Multi-Agent), Kelly Handbook Ch11 (Software Factory), Kelly Tweets (Factory), Kelly vs Gas Town Gap Analysis, soul, AGENTS.md
Architecture
Pipeline Stages
The factory runs a structured six-stage pipeline:
Idea → Intake → Research → Planning → Implementation → Testing → Release (CIS Loop) (PRD+ (Sprint (TEA (Operator Arch+ Execution) Audit) Decision) UX Design)
| Stage | Agent | Key Artifact | Gate |
|---|---|---|---|
| Intake | Router | `intake.md` | — |
| Research | research-lead | `research-summary.md` | READY / NOT-READY |
| Planning | project-lead | `prd.md`, `architecture.md`, `ux-design.md` | PASS / FAIL |
| Implementation | build agents | `implementation-summary.md` | — |
| Testing | test-lead | `tea-summary.md` | PASS / PASS-WITH-FOLLOWUPS / REMEDIATE |
| Release | Router | — | SHIP / NO-SHIP |
Quick Path: Bug fixes skip Research and go directly to Planning/Implementation. New products run the full pipeline.
Full Pipeline example (CSV Export Feature): 10:15 AM intake → 10:21 AM planning complete → 11:15 AM implementation done → 11:30 AM TEA audit PASS-WITH-FOLLOWUPS → 11:31 AM release decision. ~75 minutes end-to-end.
Sub-Agent Routing Table
| Task Type | Route To |
|---|---|
| New project intake | carson |
| Research | carson, drquinn, mary, victor |
| Planning | mary |
| Architecture | winston |
| Design/UI | sally |
| Building | amelia |
| Testing/QA | qa, testlead |
| DevOps/Scaffold/Deploy | phil |
BEADS Pipeline State
Kelly currently tracks pipeline state across four separate mechanisms:
- **pipeline state** — machine-readable current stage, subphase, timestamps
- **done markers per subphase** — text signals for completed subphases
- **TEA audit narrative** — structured Thought/Event/Action captures per quality gate
- **heartbeat** — agent liveness and current activity
The Kelly vs Gas Town gap analysis identifies Beads (git-versioned, SQL-queryable work primitives backed by Dolt) as the highest-priority migration target to unify these four separate mechanisms into a single substrate.
Memory Model
5-Layer System
Kelly's session persistence uses a 5-layer memory system — demand-loaded, narrative-dominant:
| Layer | File | Purpose |
|---|---|---|
| 1 | soul | Who Kelly is — identity, role, communication style |
| 2 | memory | Curated long-term memory — learnings, decisions, insights |
| 3 | memory/YYYY-MM-DD.md | Today's raw session log |
| 4 | projects/{id}/context.md | Per-project state and context |
| 5 | data/.json | Structured data, lookups |
Design principle: Narrative at the top (layers 2–3), structured at the bottom (layers 4–5). Yuki AI CEO experiments confirm this is correct — LLM recall is associative, not indexed. Tables are for lookup; narrative is for association. More knowledge can compound without expanding the attention footprint via progressive disclosure.
Load strategy: soul and memory load every session (small map). Project context and daily logs load on demand (large encyclopedia). This is the "map, not encyclopedia" principle — validated empirically by Yuki's CLAUDE.md shrinking 36% while repo doubled in size.
Autonomy Model
sessions_yield for Sub-Agent Execution
The Router uses sessions_yield to delegate work to sub-agents:
- Parent yields control while sub-agent executes
- Parent resumes when sub-agent completes or session is explicitly continued
- Sub-agents run to completion without requiring the parent to poll
RALPH Retry Protocol
Retry And Learn Protocol:
- Any sub-agent failure → retry
- Same failure twice → escalate immediately (don't waste third attempt)
- Three failures → mandatory escalation with structured diagnostic
- Unrecoverable → immediate escalation with operator decision requested
Cron for Scheduling
Scheduled automations (health checks, periodic updates, daily syncs) run via cron — tasks that need no reasoning and run on a timer. sessions_yield vs cron separation principle: tasks that need reasoning belong in agent sessions; tasks that don't belong in cron/scheduled automation. Mixing them makes both worse. Yuki AI CEO confirmed this separation with Romain's correction: "New tool doesn't mean move everything there."
heartbeat for Active Pulse
Kelly's heartbeat mechanism: agents periodically update heartbeat with current activity and timestamp. Detects stuck agents by absence of updates. This is a file-based approximation of Gas Town's Deacon daemon (which actively patrols hooks structurally).
Gaps vs Gas Town
The Kelly vs Gas Town gap analysis (Carson, 2026-04-26) identified these missing elements:
Missing Beads Unified Substrate
Kelly has 4 separate state mechanisms (pipeline state, done markers, TEA audit, heartbeat) that Beads would unify into a single git-versioned, SQL-queryable substrate. Adoption priority: High.
Missing GUPP Hook Enforcement
Kelly's yield-friendly model has no equivalent to GUPP's absolute "if hook is non-empty, you MUST run" rule. No architectural enforcement that a deferred sub-agent is violating a contract. Adoption priority: Medium-High.
Missing Autonomous Compounding Loops
Kelly's cron/TaskFlow handle scheduled tasks but none read their own prior outputs and compound. Yuki AI CEO's three production loops (New AI Models, Bug Autofix, SEO Optimizer) demonstrate the pattern: each reads its last run's output, takes the next step, and writes new output for next time. Adoption priority: Medium.
Missing Explicit Authority Matrix
Kelly's authority is gate-driven (PASS/FAIL before advancing) but has no written per-agent authority tiers with progressive transfer tracking. Gas Town's Mayor/Crew/Polecats and Yuki's three-tier authority matrix provide the model. Adoption priority: High.
Missing 30-Day Outcome Reviews
Kelly's quality gates are point-in-time (gate at stage transition). Yuki AI CEO adds temporal quality gates: every significant decision sets a 30-day review date, then assesses actual vs expected outcome. Adoption priority: Medium.
Related
- [[kelly-gas-town-gap-analysis]] — full Gas Town comparison with adoption priorities
- [[kelly-handbook-multi-agent]] — Ch7 router/sub-agent architecture, RALPH protocol
- [[kelly-handbook-software-factory]] — Ch11 factory pipeline, TEA audit
- [[kelly-tweets-factory]] — Kelly's public tweets on factory evolution
- [[yuki-ai-ceo-vs-kelly-gas-town-gap]] — Yuki AI CEO cross-reference and synthesis recommendations
- [[yukicapital-ai-ceo-overview]] — Yuki Capital AI CEO patterns mapped to Kelly equivalents