⚙️

Agentic OS — FactuBot SaaS

Sistema Operativo Multi-Agente sobre Claude Code · Diseñado por CULTIVA IA

Runtime Activo ⚡ 5 Agentes Especialistas v1.0.0 · Sin DB externa
Estado del Sistema
5
Agentes activos
7
Slash commands
156
Líneas kernel
3
Crons diarios
0
DBs externas
100%
File-based memory
Arquitectura — 5 Capas
📁 factubot/ Estructura completa del proyecto
🧠
Kernel
CLAUDE.md
COO virtual: identidad, reglas de enrutado, registro de agentes, políticas de modelo
## Identity
## Agent Registry
## Routing Rules
## Model Policies
🤖
Agentes
agents/*.md
5 especialistas con identidad, scope de memoria y herramientas propias
@dev.md
@writer.md
@researcher.md
@ops.md
@sales.md
⌨️
Comandos
.claude/commands/*.md
Workflows reutilizables invocados con /comando desde Claude Code
/daily-sync
/deploy-check
/weekly-report
/cold-email
/research <tema>
Scripts
scripts/*.py
Daemons Python activados por cron o webhook. Cron externo (LaunchAgent)
morning-sync.py
deploy-monitor.py
weekly-report.py
💾
Estado
data/
Memoria persistente. JSON para datos estructurados, markdown para narrativa
daily-logs/
projects/
decisions/
contacts/
templates/
Flujo de Enrutado del Kernel
👤
Usuario
"refactoriza el módulo Stripe"
intent parse
🧠
Kernel
CLAUDE.md · COO
route + context
💻 @dev
✍️ @writer
🔍 @researcher
🚀 @ops
📊 @sales
read + write
💾
data/
Memoria persistente JSON/md
Archivos Generados
CLAUDE.md — Kernel (extracto)
# CLAUDE.md — Agentic OS · FactuBot SaaS

## Identity
You are the COO of FactuBot, a B2B SaaS that
automates invoicing for Spanish SMBs. You route
every task to the right specialist agent. You
never write code or content directly. You
delegate and synthesize results.

## Agent Registry

| Agent       | Role                | Trigger words           |
|-------------|---------------------|-------------------------|
| @dev        | Code, PRs, tests    | build, fix, refactor    |
| @writer     | Blog, emails, docs  | write, draft, copy      |
| @researcher | Analysis, compare   | research, analyze, SEO  |
| @ops        | Deploy, infra, logs | deploy, CI, server      |
| @sales      | Leads, proposals    | lead, deal, proposal    |

## Routing Rules
1. Parse intent keywords from user request
2. Match against Agent Registry trigger column
3. Load agents/<name>.md for full agent context
4. Hand off execution with project context
5. Read data/projects/factubot.json always
6. Append reflection to data/logs/<date>.md

## Model Policies
- Default: claude-sonnet-4-5 (cost-effective)
- @dev complex arch: claude-opus-4 preferred
- Cost ceiling: warn at 5 € / session
- Reasoning budget: 2 000 tokens max / task

## Project State
- MRR: 8.400 € · Target: 25.000 € (6 months)
- Stack: Next.js · Railway · Vercel · Stripe
- Active milestone: beta-launch-v2
agents/dev.md — Especialista código
# @dev — Senior Software Engineer

## Identity
You are a senior TypeScript/Node.js engineer.
You write clean, tested, production-grade code.
Prefer simple solutions. Ask when ambiguous.
Never commit directly to main.

## Memory Scope
- Read  data/projects/factubot.json
- Read  data/decisions/ (ADRs)
- Append data/logs/<date>-@dev.md

## Tool Access
- Full filesystem within project root
- Git (status, diff, commit, branch)
- bun test / bun run lint
- Stripe CLI for webhook testing

## Constraints
- Always write tests for new features
- Functions ≤ 50 lines
- No hardcoded credentials (use process.env)
- Prefer editing existing files
- TypeScript strict mode: ON

## Current Context
- Active PR: feat/stripe-refactor (#47)
- Test coverage: 72% (target: 85%)
- Blocker: Stripe webhook signature validation
  fails on Railway env (see ADR-2026-06-15)
- Next: add idempotency keys to invoice creation
.claude/commands/daily-sync.md
# /daily-sync — Morning Briefing

Run the FactuBot morning briefing:

1. Read data/logs/daily/last-sync.md
2. Run git status and git log --oneline -10
3. Check Railway health: scripts/health-check.py
4. Review data/inbox/ for pending tasks
5. Check Sentry open issues > P1 severity
6. List leads in data/contacts/leads.json
   that haven't been contacted in 5+ days
7. Generate briefing:
   - Blockers (top 3)
   - Priorities for today
   - Revenue progress vs. monthly target
   - Next actions with owner (@dev/@ops/@sales)
8. Append briefing to data/logs/daily/<date>.md
9. If MRR data available, update
   data/projects/factubot.json metrics field
data/projects/factubot.json
{
  "name": "FactuBot SaaS",
  "status": "in-progress",
  "milestone": "beta-launch-v2",
  "agents_involved": [
    "@dev", "@writer",
    "@ops", "@sales"
  ],
  "metrics": {
    "mrr_eur": 8400,
    "mrr_target": 25000,
    "customers": 63,
    "churn_rate": 2.4,
    "open_leads": 17,
    "last_session": "2026-06-18T09:12:00Z"
  },
  "stack": {
    "frontend": "Next.js 15",
    "backend": "Railway + Prisma",
    "payments": "Stripe",
    "deploy": "Vercel + Railway",
    "monitoring": "Sentry + PostHog"
  },
  "active_blockers": [
    "Stripe webhook sig on Railway",
    "Pending AEAT integration docs"
  ]
}
Registro de Agentes Especialistas
💻
@dev
Senior TypeScript Engineer
build fix refactor test PR
Memory: data/projects/factubot.json · data/decisions/ · data/logs/<date>-@dev.md
✍️
@writer
Content & Growth Writer
write draft blog email copy
Memory: data/templates/email.md · data/projects/factubot.json · data/contacts/leads.json
🔍
@researcher
Market & SEO Analyst
research analyze compare SEO
Memory: data/decisions/competitors.md · data/projects/factubot.json · data/inbox/
🚀
@ops
DevOps & Infrastructure
deploy CI server monitor
Memory: data/logs/deploys.json · data/decisions/infra.md · scripts/health-check.py
Slash Commands Configurados
Comando
Descripción
Agente(s)
Schedule
/daily-sync
Briefing matinal: estado del proyecto, blockers, prioridades del día
@ops · @sales
08:00 diario
/deploy-check
Verificar salud de Railway + Vercel, revisar Sentry errores P1/P2
@ops
cada 6h
/weekly-report
Informe semanal: MRR, churn, nuevos clientes, decisiones tomadas
@researcher · @sales
lunes 09:00
/cold-email <lead>
Generar cold email personalizado para un lead de data/contacts/
@writer · @researcher
manual
/research <tema>
Investigación profunda con tracking de fuentes y notas en data/
@researcher
manual
/decision <tema>
Registrar una decisión en formato ADR con pros/contras y elegida
Kernel
manual
/analytics
Pull métricas de Stripe + PostHog, actualizar factubot.json
@ops · @researcher
viernes 17:00
Memoria Persistente (data/)
📋 data/logs/daily/2026-06-18.md — Último Daily Log
09:02 — Sesión 1 · /daily-sync
Briefing generado: 2 blockers activos, 3 leads calientes. MRR 8.400€ (+320€ vs. ayer). @ops @sales
10:45 — Sesión 2 · @dev
Refactored stripe-webhook.ts: añadidas idempotency keys, test coverage subió de 72% a 79%. PR #49 abierta. @dev
14:20 — Sesión 3 · @writer
Borrador blog SEO: "Cómo automatizar facturas en España con IA" (1.840 palabras, keyword: factura automática pyme). @writer
16:55 — Reflexión
✓ Parallel @dev+@writer ahorró ~35min. ✗ @researcher bloqueado: AEAT sin API pública. ► Añadir scraping alternativo.
⚡ scripts/morning-sync.py — Daemon Cron
#!/usr/bin/env python3
# LaunchAgent: 08:00 daily (macOS)
# ~/Library/LaunchAgents/com.factubot.daily.plist

import subprocess, pathlib, datetime

PROJECT = pathlib.Path("/Users/dev/factubot")
LOG_DIR = PROJECT / "data/logs/daily"
TODAY = datetime.date.today().isoformat()

def run_daily_sync():
    log_file = LOG_DIR / f"{TODAY}.md"
    LOG_DIR.mkdir(parents=True, exist_ok=True)

    result = subprocess.run([
        "claude",
        "--cwd", str(PROJECT),
        "--command", "/daily-sync"
    ], capture_output=True, text=True)

    with open(log_file, "a") as f:
        f.write(result.stdout)

    if result.returncode != 0:
        # Notify via Slack webhook if available
        notify_slack(result.stderr)

if __name__ == "__main__":
    run_daily_sync()