CTO — Chief Technology Officer
The Chief Technology Officer (CTO) runs on the Sonnet
(workhorse) model tier at 5 credits per call. The CTO is the technology
and integration guardian: integration health monitoring, performance
auditing, tech-stack review, data-pipeline integrity, system optimization,
security-scan review for stack-owned findings, technical incident response
(including autonomous resolution via the Incident Commander state
machine), and capacity planning.
Day in the life
The CTO opens the day by checking integration health across every
active connector — status, latency, error rate, last successful sync, and
recommended action when degraded. Deep integration audits require
Professional+ via the AGENT_FORGE feature gate. A performance audit
follows on the configured rolling window (default 24 hours): p50/p95/p99
response times, error-rate trends, top bottlenecks ranked by impact, and
a prioritized optimization action list.
Data-pipeline integrity verifies completeness and latency across ingestion and processing pipelines, alerting on lag beyond the configured threshold (default 15 minutes), data gaps, duplicates, and stale records. System optimization recommendations cover query tuning, caching layers, connection pooling, concurrency settings, and infrastructure right-sizing — each with expected improvement, implementation complexity, and rollback plan.
When an incident fires, the CTO’s autonomous resolution path runs the
CTOIncidentCommander state machine: RootCauseDiagnoser produces a
diagnosis and confidence; RunbookExecutor attempts the matched runbook;
the post-action health_check (HTTP /health against the affected
service) verifies recovery; if the verification fails, retry up to the
configured max_attempts and escalate via EscalationManager.
RetrospectiveGenerator writes the post-incident retrospective.
incident.commander_completed is emitted with the final state, attempts,
and verification result.
For non-autonomous incidents, the CTO produces a structured response: triage (root-cause hypothesis + confidence), immediate actions to stop the bleeding, full remediation plan with owners and timeline, status communication, and post-incident prevention measures.
Capacity planning runs both an interactive handler (forecast resource
needs over a configurable horizon) and the weekly capacity forecast
worker that runs Holt-Winters ETS over 30 days of hourly BigQuery history
and writes a decision record with confidence score, reasoning chain,
projected utilization, and projected monthly cost. Tech-stack review
evaluates fitness, TCO, security posture, vendor lock-in, community
health, and upgrade paths with effort estimates and expected benefits.
Security-scan review triages CTO-owned findings (CVEs, misconfigured
cloud services, exposed secrets, compliance gaps) and emits
security_scan_reviewed.
Tools
Tools are registered via register_cto_tools in
src/agents/cto/tools.py. The Incident Commander pulls in the full
incidents subsystem.
RootCauseDiagnoser(src/core/incidents/rca.py) — Produces diagnosis- confidence for the autonomous resolution loop.
RunbookExecutor(src/core/incidents/runbook.py) — Runs the matched runbook with retry semantics.EscalationManager(src/core/incidents/escalation.py) — Escalates when autonomous attempts fail or exceedmax_attempts.RetrospectiveGenerator(src/core/incidents/retrospective.py) — Writes the post-incident retrospective.CapacityForecaster.forecast(src/core/scaling/forecaster.py) — Holt-Winters ETS forecast for Cloud Run instance demand._fetch_hourly_history(src/workers/cadence/capacity_forecast_weekly.py) — Pulls 30 days of hourly BigQuery history for the forecaster.httpxhealth check — Defaulthealth_checkfor the Incident Commander (https://{service}.run.app/health).quality_gate— Validates every CTO output (audit reports, optimization plans, incident responses, capacity plans) before delivery.
Decision patterns
These are the entries in _CAPABILITY_DISPATCH from
src/agents/cto/capabilities.py.
INTEGRATION_HEALTH— Triggered daily; gated to Professional+ viaAGENT_FORGE; emitsintegration_health_checked.PERFORMANCE_AUDIT— Triggered daily over a rolling window (default 24h).TECH_STACK_REVIEW— Triggered quarterly or on demand.DATA_PIPELINE_CHECK— Triggered every 15 minutes (or per the configuredmax_acceptable_lag_minutes).SYSTEM_OPTIMIZATION— Triggered when audits surface bottlenecks.SECURITY_SCAN_REVIEW— Triggered on every new scan; emitssecurity_scan_reviewed.INCIDENT_RESPONSE— Triggered by alerts; produces structured triage/actions/remediation/comms/post-incident.AUTONOMOUS_RESOLUTION— Triggered for runbook-matchable incidents; drives theCTOIncidentCommanderstate machine.CAPACITY_PLANNING— Triggered on demand; configurable horizon (default 90 days).CAPACITY_FORECAST— Triggered weekly via the cadence worker; ETS forecast with confidence score and cost projection.
Escalation criteria
- Tenant plan lacks
AGENT_FORGE— deep integration audit returnsfeature_gated. - Capacity forecast called with <168 hours of history (less than one
full week) — handler skips with
Insufficient historyrather than fitting on too-thin data. - Forecast called for an unknown service — handler returns
Capacity forecast failed: unknown service. CTOIncidentCommanderexhaustsmax_attempts(default 3) without a passing health check —EscalationManagerpaged.- Action requires changes outside the autonomy-engine-approved scope (DB migrations, infra changes affecting cost, breaking API changes) — chairman approval required.
- Quality Gate flagged the output and auto-revise failed.
- Action would exceed the CTO’s daily budget cap.
Example outputs
[Integration health — 2026-04-25 06:00 UTC]
Connector | Status | p95 (ms) | err rate | Last sync----------------|----------|----------|----------|----------Stripe | healthy | 142 | 0.01% | 30s agoTwilio | healthy | 210 | 0.00% | 12s agoResend | healthy | 98 | 0.02% | 45s agoGmail | healthy | 320 | 0.05% | 1m agoQuickBooks | degraded | 1,840 | 3.10% | 14m ago ⚠Shopify | healthy | 175 | 0.00% | 8s ago
ACTION: QuickBooks degraded — likely upstream throttle. Reduce syncbatch size 250→100; revisit in 30 minutes.{ "service": "api", "horizon_days": 7, "peak_instances": 18.4, "p95_instances": 14.7, "confidence_score": 0.83, "projected_utilization": 0.74, "projected_cost_monthly_usd": 612.40, "data_sources": ["bigquery_hourly_metrics_30d"], "summary": "Capacity forecast: api peak=18 (74% utilization)"}[Incident response — sev1: queue worker OOM]
TRIAGERoot cause: queue worker OOM under burst from outreach cadence.Confidence: 0.84 (Cloud Run logs + memory metrics).
IMMEDIATE ACTIONS1. Increase worker memory 1Gi → 2Gi (CTO; now).2. Throttle outreach worker concurrency 8 → 4 (CTO; now).
REMEDIATION- Move outreach prompt construction off the worker hot path (1d).- Add memory-pressure circuit breaker (2d).
POST-INCIDENTAdd a rolling p99 memory alert at 80% of limit; the existing 90%alert fired too late to prevent restarts.Sourced from src/agents/cto/agent.py,
src/agents/cto/capabilities.py,
src/core/incidents/commander.py, and
src/core/scaling/forecaster.py. Last reviewed: 2026-04-25.