System Report — Phase 21.5 (Historical)
Historical snapshot of Arc OS after Evolutionary Intelligence integration. Note: This document reflects the system state at Phase 21.5. The current system is at Phase 40.18 with 62+ API endpoints, CRM dashboard, OAuth, Sage Worker, and more. See the User Guide and Product Overview for current documentation.
System Summary
| Metric | Value |
|---|---|
| Core TypeScript (shared + bots + scripts) | 3,298 lines |
| Shared modules | 7 |
| Registered skills (registry) | 18 |
| Library skills | 7 |
| Total skills | 25 |
| Eval rule types | 6 |
| Pilot eval rulesets | 3 (9 rules total) |
| Agents | 6 |
| Child bots (production) | 2 |
| Git commits | 36 |
| Phases delivered | 15 → 21.5 |
| Custom backend code | 0 lines |
Architecture
┌──────────────────────────────────┐
│ Master Bot (Port 19210) │
│ @citadel_master_bot │
│ │
│ /status /health /deploy /watchdog │
│ /new_project /remove_project │
│ Approve/Reject improvements │
└──────────┬───────────┬─────────────┘
│ │
┌────────────┘ └────────────┐
▼ ▼
┌───────────────────┐ ┌───────────────────┐
│ Child: citadel-v2 │ │ Child: pt │
│ Port 19211 │ │ Port 19212 │
│ │ │ │
│ Intelligence: │ │ Intelligence: │
│ ├ Context Router │ │ ├ Context Router │
│ ├ Learnings │ │ ├ Learnings │
│ ├ Binary Evals │ │ ├ Binary Evals │
│ └ Quality Track │ │ └ Quality Track │
└───────────────────┘ └───────────────────┘
│ │
▼ ▼
┌───────────────────┐ ┌───────────────────┐
│ MCP Bridge │ │ │
│ Port 19200 │ │ (no bridge yet) │
│ SSE + HTTP API │ │ │
└────────┬──────────┘ └───────────────────┘
│
▼
┌───────────────────┐
│ Phaser.js Frontend│
│ Port 5173 (dev) │
│ Visual AI Office │
└───────────────────┘
Module Map
shared/ (7 modules, 1,124 lines)
| Module | Lines | Phase | Purpose |
|---|---|---|---|
logger.ts |
189 | 20.5 | Structured JSONL logging: system/dialog/error channels, daily rotation |
vault.ts |
216 | 20.5 | AES-256-GCM encrypted secret storage: initVault, getSecret, setSecret |
quality.ts |
192 | 21.1+21.5 | Execution/feedback tracking, aggregation, underperformer detection |
ui_templates.ts |
158 | 21.0+21.5 | Telegram keyboards: master menu, project cards, child buttons, improvement proposals |
evals.ts |
142 | 21.5 | Binary eval engine: 6 rule types, checkOutput, formatWarnings |
context-router.ts |
117 | 21.5 | Skill scoring: trigger/keyword matching, SKILLS_HINT generation |
learnings.ts |
110 | 21.5 | Persistent corrections: load/add/format learnings from markdown |
Bot runtimes (1,937 lines)
| File | Lines | Purpose |
|---|---|---|
child-bot/bot.ts |
944 | Telegram-Claude CLI proxy with intelligence layer integration |
master-bot/bot.ts |
993 | Orchestrator: commands, project cards, watchdog, improvement approval |
Scripts (237 lines)
| File | Lines | Purpose |
|---|---|---|
scripts/nightly-improve.ts |
237 | Karpathy Loop: metrics analysis → improvement proposals → CEO Telegram |
Skills Inventory
Registry Skills (18)
| Skill | Category | Phase | Evals |
|---|---|---|---|
| handoff-protocol | complex, skill_injection | 15.2 | - |
| code-review | complex | 15.3 | 3 rules |
| system-audit | complex | 15.3 | 3 rules |
| git-manager | complex, skill_injection | 16 | 3 rules |
| project-onboarding | complex, skill_injection | 16 | - |
| web-scaffolding | complex | 15 | - |
| code-review-protocol | complex | 15 | - |
| automated-testing | complex | 15 | - |
| deployment-flow | complex | 15 | - |
| knowledge-index | complex | 15 | - |
| document-analysis | complex | 15 | - |
| citadel-wrapup | cli_command | 19.4 | - |
| citadel-recall | cli_command | 19.4 | - |
| citadel-status | cli_command | 19.5 | - |
| citadel-task | cli_command | 19.5 | - |
| citadel-deploy | cli_command | 19.5 | - |
| figma-audit | complex, skill_injection | 21 | - |
| figma-apply-system | complex, skill_injection | 21 | - |
| figma-implement | complex, skill_injection | 21 | - |
Library Skills (7)
| Skill | Domain |
|---|---|
| docker-ops | Container orchestration |
| figma-design | Design-to-code pipeline |
| github-actions | CI/CD workflows |
| odoo-expert | Odoo ERP development |
| odoo-owl-expert | Odoo Owl framework |
| plasthetica-style-guide | Project-specific style guide |
| postgres-pro | PostgreSQL optimization |
Intelligence Layer (Phase 21.5)
Message Processing Pipeline
Message In
│
├─ Context Router scores 18 registry skills → top-5 SKILLS_HINT
├─ Learnings Loader reads learnings.md → LEARNINGS block
├─ BTW Queue prepends extra context from BTW mode
│
▼
buildGsdPrompt() assembles: LEARNINGS → BTW → CONTEXT → SKILLS_HINT → TASK
│
▼
claude -p <prompt> --max-turns 20
│
▼
├─ Binary Evals checks response against .evals.json rules
├─ Quality Tracker logs execution event (skills, success, duration)
│
▼
Telegram response + inline buttons + eval footnotes
Feedback Loop
Fix It button → addLearning(source: "fixit") → learnings.md → next prompt
Thumbs-down → addLearning(source: "negative") + logFeedback → metrics
Thumbs-up → logFeedback(positive: true) → metrics
Nightly Cycle
03:00 UTC → nightly-improve.ts
→ Read quality-metrics.json per child
→ findUnderperformingSkills(threshold: 80%)
→ Generate proposals
→ Send to CEO via Master Bot Telegram
→ CEO: [Approve] → backup skill.md → mark approved
→ CEO: [Reject] → mark rejected
Infrastructure
VPS (Contabo)
| Service | Port | Health Endpoint |
|---|---|---|
| Master Bot | 19210 | /api/master/health |
| Child: citadel-v2 | 19211 | /api/child/health |
| Child: pt | 19212 | /api/child/health |
| MCP Bridge | 19200 | /api/health |
| Frontend | 5173 (dev) / Docker | N/A |
Cron Jobs
| Schedule | Job |
|---|---|
| Every 15m | Git sync (memory bridge) |
| Every 30m | Morty SRE health check |
| Every 2h | CFO metrics aggregation |
| Daily | CMO status report |
| Daily | DB backup |
| Daily 03:00 | Nightly improvement loop |
Logging
- Format: Structured JSONL
- Channels: system, dialog, error
- Location:
/var/log/citadel/<bot-name>/ - Rotation: daily (logrotate)
- Access:
jq . /var/log/citadel/citadel-v2/dialog-$(date +%F).log
Security
- Bot tokens: AES-256-GCM vault (
config/vault.json, gitignored) - Encryption key:
config/vault-key(auto-generated, chmod 600) - CEO-only access: all bots check
CEO_CHAT_IDon every message - No credentials in git (
.gitignore+.claudeignore)
Phase History
| Phase | What Was Built |
|---|---|
| 15 | Skills system, agents, blueprints |
| 16 | Git manager, project onboarding |
| 18 | Parent umbrella issue |
| 19 | CLI commands, library, wrapup/recall |
| 20 | Federated bots, Master + Child architecture |
| 20.5 | Structured logging, watchdog, vault, onboarding |
| 21.0 | UI templates, subprocess control, quality tracking |
| 21.1 | Quality metrics aggregation, feedback buttons |
| 21.5 | Evolutionary Intelligence: evals, context router, learnings, nightly loop |
| 22-26 | CRM Backend API, Workspace, Workers, Specs |
| 28-30 | Knowledge auto-ingest, onboarding wizard |
| 32-34 | Wiki, Skills CRUD, Issues, ARC CLI |
| 36 | Cloud PM, Neural Skill Generator, NotebookLM Bridge |
| 37-38 | OAuth (Google/GitHub), email/password auth, ARC CLI binary |
| 39 | Mobile responsive CRM |
| 40.10-40.18 | Chat history, Sage Worker, benchmarks, marketplace, Lucide icons, Telegram vault, worker bots |
For current system details, see Product Overview.