Skip to content

About

AI-powered SRE agent for homelab infrastructure monitoring, OODA sweeps, RAG memory, and remediation workflows

Topics

Resources

Contributing

Security policy

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

582 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CFOperator — a self-hosted AI SRE agent

Despite the name, this is not a Kubernetes operator. It is a self-hosted agent that watches your infrastructure, investigates alerts with an LLM, and proposes fixes as pull requests. It runs on your hardware against your Prometheus, and it never sends your telemetry to anyone — including us. There is no phone-home, no version ping, no usage analytics.

Latest release: v1.0.9

What it actually does

alert → triage → investigate → propose a fix → open a GitOps PR → verify after merge

Each step is real and running in production:

  • Triage — every Alertmanager alert is classified log_only / notify / investigate / escalate by a local LLM, so only the alerts that deserve one cost you an investigation.
  • Investigate — the agent queries Prometheus, Loki, Kubernetes and Docker through a tool loop, checks the finding against past investigations held in a pgvector knowledge base, and writes a verdict.
  • Propose — for the fix classes it understands, it produces a concrete diff against your manifest repo.
  • Open a PR — and stop there. It never changes anything unattended. Every change has a named human behind it: the merge on that PR, the merge of a change record for a host action, or an admin confirming a command in the console. This is a deliberate design limit, not a missing feature; the precise statement is in SECURITY.md.
  • Verify — after the merge it checks whether the thing it claimed to fix is actually healthy, and downgrades its own verdict if not.

It also runs a proactive sweep every 30 minutes rather than waiting to be paged, and answers questions in chat, Slack, or any MCP host.

Requirements: Prometheus and Alertmanager. Loki for logs. An LLM — a local Ollama model is the default and the tested path; cloud providers work as a fallback chain. Supported integrations are listed honestly in docs/infrastructure-config.md — the list is short, and that page says so.

Architecture

The deployed system runs as two processes that split responsibilities along a clean HTTP boundary:

  • event_runtime (separate process / pod) — ingests alerts from Alertmanager, applies dedupe/cooldown policies, runs the decision engine, dispatches actions, and owns the notification surface (Slack, Discord, ntfy).
  • agent (this codebase's main process) — runs LLM-driven investigations, owns the knowledge base + embeddings, runs the proactive deep sweep, and serves the chat UI.

Beside them sit small single-purpose services, each behind its own HTTP contract: cfop-dedupe (Go, dedupe/) decides whether a remediation the agent is about to enqueue is new, belongs on a row already open, or is already queued — while it cannot answer, the agent's exact-key check decides alone; changerecord/ keeps the record a host action waits on; cfop-tracker (tracker/) files remediation rows in an issue tracker (Plane, GitHub or Jira). The executor that carries a remediation to a PR, the deep-investigation worker and cockpit sessions run as disposable Jobs.

Two additional sibling deployments reuse the same image and expose the agent to conversational surfaces:

  • mcp_server — a standard MCP facade over the agent API (12 tools, 4 resources, 9 skill prompts — one per skills/*/SKILL.md) with bearer auth + scope tiers (read ⊂ investigate ⊂ remediate) and a structured audit log, consumable by Claude Desktop/Code, Cursor, or any MCP host. See docs/mcp-server.md.
  • bridge — a Slack Socket Mode bot (@cfoperator mentions/DMs, threaded conversations, investigate: enqueue, per-message claude: model escalation) with pluggable runtimes: local (agent chat API, free) or anthropic (Claude drives the MCP server's tools). See docs/slack-bridge.md.

The console on :8083 authenticates against database-backed accounts with admin / member roles, plus individually revocable API tokens carrying the same read ⊂ investigate ⊂ remediate scopes. Admins manage users, tokens, LLM settings, git repos, the node-action allowlist and MCP connectors at /admin; everyone manages their own password and tokens at /account. See docs/auth.md.

When an alert arrives, event_runtime asks the agent's LLM to triage it into log_only / notify / investigate / escalate. investigate triggers the full LLM investigation: the runtime POSTs the alert to the agent's /v1/investigate, the agent enqueues, runs the LLM investigation with tools, and POSTs the completed ActionResult back to event_runtime at /v1/investigations/{alert_id}/complete, which fires the single notification with the real outcome, tagged with the model that ran the investigation (Investigated by: ollama/gemma4:26b). escalate belongs to the optional deep-investigation tier: with it on, a host-shaped escalate becomes a forensics Job (docs/deep-investigation.md) and any other escalate is routed to notify; with it off, the runtime has no handler for escalate and the alert ends as action_missing. See docs/event-runtime-quickstart.md for the full flow + env vars (CFOP_AGENT_URL, CFOP_COMPLETION_SHARED_SECRET).

Triage can optionally run on a dedicated local fine-tune rather than the general model chain. Ours (cfop-triage-ministral3:v5-q4, a QLoRA of Ministral-3-14B trained on real investigation history) matches the incumbent gemma4:26b's perfect eval score at about 5.3x lower latency (5.53 s → 1.04 s on the 14-case suite). In the homelab it runs on an Ollama host of its own, named by llm.triage_url (CFOP-175), because sharing the investigation model's GPU made the two evict each other. It is one config key (llm.triage_model) and falls back to the normal chain on any failure. See docs/triage-fine-tune.md for the model card, training recipe and rebuild procedure.

flowchart LR
    AM[Alertmanager] --> ER[event_runtime]
    ER -- "POST /v1/triage" --> Agent
    Agent -- "log_only / notify /<br/>investigate / escalate" --> ER
    ER -- "POST /v1/investigate<br/>(only when investigate)" --> Agent
    Agent -- "POST /v1/investigations/&lt;id&gt;/complete" --> ER
    ER -. "escalate, host-shaped<br/>(optional deep tier)" .-> Deep[deep-investigation Job]
    Deep -. "report via the same<br/>completion path" .-> ER
    ER --> Slack["Slack / Discord / ntfy<br/>(one notification per alert,<br/>tagged with the investigating model)"]
Loading
CFOperator agent (Docker container)
├── OODA Loop
│   ├── HTTP-driven investigations: POST /v1/investigate from event_runtime
│   ├── Proactive: deep sweep every 30 min
│   ├── LLM Judge: each sweep finding checked against its evidence before reporting
│   └── Morning: summary report in the 7-9 AM window (the container's local
│       time, configurable), written by the primary model; the judge checks
│       sweep findings only, not this report
│
├── Knowledge Base (ResilientKnowledgeBase)
│   ├── PostgreSQL + pgvector (persistent storage + semantic search)
│   ├── Embeddings: nomic-embed-text via Ollama (768 dims, HNSW index)
│   └── Offline Buffer: JSON Lines fallback
│
├── Observability (pluggable interface; this is the whole shipped list)
│   ├── Metrics: Prometheus
│   ├── Logs: Loki
│   ├── Alerts: handled by event_runtime (Alertmanager → /v1/investigate)
│   ├── Containers: Kubernetes + Docker + Prometheus bare-metal discovery
│   └── Notifications: handled by event_runtime (Slack + Discord + ntfy)
│
├── LLM provider chain (below)
│   └── Local Ollama first; hosted providers as escalation rungs, each only
│       when it has a key
│
├── Tools (by family; tools/__init__.py registers them and is the list)
│   ├── Core: prometheus_query (auto-corrects common PromQL), loki_query
│   │         (validates LogQL), docker_list, docker_inspect, the knowledge
│   │         base (store_learning, find_learnings), sweep reports,
│   │         investigations and the remediation queue
│   ├── SSH (9): commands, service status and restart, logs, containers,
│   │           system info and ports on fleet hosts
│   ├── Kubernetes (16): pods, logs, deployments, events, nodes, services,
│   │                   ingresses, describe; plus rollout restart and exec
│   ├── Git (5): history, diffs and blame in the configured repos
│   ├── GitHub (9): PRs, issues, commits and files; opening a PR
│   ├── TimescaleDB (1): timescale_query — read-only SQL over the telemetry
│   │              database (`sensors`) where telegraf lands every MQTT message
│   │              plus the flood/river history. Single SELECT/WITH only, on a
│   │              read-only role and read-only transaction, with a statement
│   │              timeout and row cap. Registered only when `TIMESCALE_PASSWORD`
│   │              is set; without it the agent logs `TIMESCALE_PASSWORD not
│   │              set - timescale_query tool disabled`.
│   ├── Discovery (4): ping_host, verify_ssh, verify_sudo, discover_all_hosts
│   ├── web_search: SearXNG, registered only when `search.url` is set
│   └── MCP connectors: tools from external MCP servers an admin adds under
│                      Admin → Connectors, offered in console chat only
│
├── Skills (9 workflows: the 8 investigation playbooks plus mqtt-top-talkers)
│   ├── /investigate-host — Systematic host/server investigation
│   ├── /investigate-container — Systematic container investigation
│   ├── /investigate-pod — Kubernetes pod investigation
│   ├── /investigate-deployment — Kubernetes deployment investigation
│   ├── /investigate-code-change — Correlate alerts with recent git changes
│   ├── /k3s-cluster-health — Full cluster health check
│   ├── /why-restart — Analyze container restart causes
│   ├── /compare-hosts — Compare metrics across fleet
│   └── /mqtt-top-talkers — Rank IoT/MQTT devices by telemetry volume
│                            (one timescale_query call, so it has nothing to
│                            call without TIMESCALE_PASSWORD)
│
└── Console (:8083; seven pages inside one shared rail, dark theme)
    ├── Inbox: what is waiting on a human (untriaged needs-action
    │   investigations, rows filed to the tracker, the latest sweep)
    ├── Chat: HTTP polling of /api/chat, /api/qa and /api/health (Waitress is
    │   WSGI, so there is no WebSocket; the /ws route was removed in CFOP-91),
    │   collapsible sidebar (skills, chat history), sweep findings with
    │   severity badges, status bar (connection, uptime, last sweep)
    ├── Remediations (the queue), Investigations (history), Events (every
    │   alert the event runtime received)
    ├── Account: your own password and API tokens
    └── Admin: users, tokens, LLM, git repos, node-action allowlist, MCP connectors

LLM provider chain

Every LLM-driven call (triage, investigation, chat, learning extraction, …) walks one provider chain until a rung answers. The head is the backend selected in Admin → LLM. With none selected, the head is the first Ollama host in the llm_fallback_chain setting (DB) that is not cooling down, or, when every one is and allow_paid_escalation is on, the single paid_llm_escalation provider. Behind the head come the escalation rungs in a fixed order — Ollama, Groq, xAI, Anthropic, then OpenRouter, each only when it has a key — and allow_paid_escalation set to false drops them. Gemini and DeepSeek can be selected by name but are never escalated to. A provider that fails is put in a cooldown with exponential backoff, persisted in llm_provider_state (Postgres), so a flapping Ollama host is not re-hit every alert; when whole walks keep failing, a circuit breaker fails calls fast until a probe gets through (CFOP-321). The notification for an investigation names the model that ran it (Investigated by: …). Provider entries, keys and why the order is what it is: docs/config-reference.md.

flowchart TD
    Start([LLM call needed]) --> Head["Head: the selected backend, else the first<br/>Ollama host in llm_fallback_chain not cooling down,<br/>else paid_llm_escalation"]
    Head --> Try{Rung answers?}
    Try -->|yes| Done([Return response<br/>+ backend/model])
    Try -->|HTTP error<br/>or timeout| Cooldown[Record the failure:<br/>cooldown, exponential backoff,<br/>persisted in Postgres]
    Cooldown --> More{"Next rung?<br/>Ollama → Groq → xAI →<br/>Anthropic → OpenRouter,<br/>keyed ones only"}
    More -->|yes| Try
    More -->|no| Fail([Raise the last error;<br/>repeated exhaustion<br/>opens the circuit breaker])
Loading

Knowledge Base & Semantic Search

CFOperator learns from every investigation. Investigations and learnings are stored in PostgreSQL and embedded via Ollama (nomic-embed-text, 768 dims) into pgvector with an HNSW index for cosine similarity search. An investigation is embedded with its trigger, outcome, recommendation and findings, not only the alert that started it; rows embedded before that re-index a batch at a time on the sweep (CFOP-542).

When a new alert fires or a sweep surfaces a finding, the agent queries the knowledge base for similar past incidents — so it can reuse proven remediation steps instead of reasoning from scratch every time.

Components:

  • agent/knowledge_base.py — ResilientKnowledgeBase wrapping PostgreSQL + pgvector, with offline JSON Lines fallback when the DB is unreachable
  • agent/embedding_service.py — Embedding generation via Ollama's /api/embeddings, with in-memory LRU cache and DB-backed cache for cross-session dedup
  • Hybrid search — combines pgvector cosine similarity with PostgreSQL full-text search (tsvector) for best-of-both retrieval

Sweep Finding Verification (LLM Judge)

Sweep models sometimes hallucinate findings — e.g., reporting "immich-ml container is missing" when immich_machine_learning is running fine (name mismatch). To prevent false findings from cascading into false correlations and polluting the knowledge base, a verification step runs after each sweep.

How it works:

  1. Each sweep phase is required to include an evidence field — the specific tool output supporting the finding
  2. After dedup, an LLM judge reviews each finding against its evidence
  3. Findings where the evidence contradicts the claim, is missing, or has name mismatches are filtered out
  4. Only verified findings reach report generation, notifications, storage, and correlation

Graceful degradation: If the judge LLM call fails, original findings pass through unmodified.

Logs: Look for "Finding verification: N → M (K filtered)" to see the judge in action.

Example Fleet

Host Address Role Services
primary 10.0.0.10 primary Prometheus, Loki, PostgreSQL
worker-1 10.0.0.11 worker node_exporter, promtail, Docker
worker-2 10.0.0.12 worker (CFOperator host) node_exporter, promtail, Docker
worker-3 10.0.0.13 worker node_exporter, promtail, Docker
gpu-host 10.0.0.14 gpu Ollama, Alertmanager

Quick Start

To a completed investigation. You need Docker (with the compose plugin), a Prometheus, and an LLM — Ollama locally, or an API key.

curl -fsSL https://raw.githubusercontent.com/aachtenberg/cfoperator/main/scripts/install.sh | sh

That installs the latest release into ~/cfoperator without a clone: it verifies the bundle's SHA-256, asks the setup questions below from inside the stack's network (so a URL that passes will work for the agent — this machine is host.docker.internal there, not localhost), and starts the stack. The images are pinned to the release; re-run it to upgrade, CFOP_VERSION=x.y.z to pin. amd64 and arm64 (Raspberry Pi) are published.

From a clone instead (to run your own changes):

./cfoperator init             # probes each answer as you give it, writes .env + config.yaml
docker compose up -d          # postgres, bootstrap, agent (the console is its :8083), cfop-dedupe, event-runtime

Prefer the file? cp .env.example .env and edit — three values matter; the rest have defaults. The wizard exists because it checks the values as you type them: the Prometheus URL either answered or it did not, Ollama either has your model pulled or it does not. (--non-interactive reads the same variables from the environment, for CI.)

The stack seeds itself on first boot: it creates an admin, mints the service token event_runtime needs, and generates a session secret. Nothing to configure by hand, and no config.yaml to author — the trial ships its own.

docker compose logs bootstrap | grep password    # your generated admin password
open http://localhost:8083                       # log in as `admin`

Then put a real alert through it:

./scripts/demo-alert.sh

The script asks your Prometheus what is actually true and builds the alert from that — a genuinely down target if you have one, otherwise a verification task about a healthy one. It is deliberately not a fabricated Kubernetes alert: a trial has no cluster, so that can only ever end in "I could not check".

You get triage, a real investigation, and the line that matters:

  investigation #2 -> resolved  (9 tool calls, 48s)
  model: ollama/gemma4:26b
  recommendation: No action needed

      cfassist attach 2

That last command drops you into a terminal session already briefed on the investigation — the same line CFOperator puts on every Slack, Discord and ntfy notification, so an alert is one paste away from context.

Add --spawn and the session runs on the affected machine instead of on your laptop, with a credential that expires with it and nothing left behind afterwards. It follows the fleet rather than the cluster: a pod on a Kubernetes node, a container on a docker host, a plain process on a bare Pi — same command, and only the isolation and the cleanup differ. See docs/cockpit.md.

Running on Kubernetes instead, or wiring your own fleet? See docs/DEPLOYMENT.md and docs/config-reference.md. The SSH host inventory, Timescale, MCP and the deep-investigation tier are all optional overlays — none of them are needed to investigate your first alert.

Usage

Chat UI: http://<cfoperator-host>:8083

"summary"                          → Overnight TPS report
"Why did immich restart last night?" → Targeted investigation
"Show me worker-1 container status" → Fleet query
/investigate-host raspberrypi2      → Host-level investigation
/investigate-container telegraf     → Container investigation
/why-restart immich-ml              → Root cause analysis
/compare-hosts                      → Fleet comparison
/mqtt-top-talkers                   → Chattiest MQTT devices (TimescaleDB)

Key Endpoints

Endpoint Description
/ Redirects to /inbox, the console's landing page
/inbox Everything waiting on a human
/console Chat UI (also opens as a floating panel from the Ask button on every other page)
/api/health Health check + uptime
/api/chat HTTP chat API (polling)
/api/sweep Trigger deep system sweep (POST)
/api/config/reload Hot-reload config (POST)
/api/models/<backend> List the models a backend offers (ollama, or a hosted provider with a key)
/api/models/<backend>/select Persist the model for a backend and make that backend the default; with "default": false, persist the model and leave the selection alone (POST, admin)
/api/settings/llm_chain The default provider chain as the agent walks it: each rung's model, and why a rung is skipped
/api/qa GET pending investigation questions; POST {question_id, answer} to answer one
/v1/investigate POST — async investigation entry point called by event_runtime
/v1/triage POST — synchronous triage decision (log_only/notify/investigate/escalate)
/metrics Prometheus metrics

cfassist (Go CLI)

A standalone single-binary CLI assistant for SRE and systems administration. Cross-compiles to any platform — no Python or runtime dependencies needed.

Its CFOperator side — cfassist attach, --spawn, cockpits on fleet hosts, the console's Open cockpit, and the probe that notices a local agent — is documented in docs/cockpit.md. This section is the CLI reference that page builds on.

Install

curl -fsSL https://raw.githubusercontent.com/aachtenberg/cfoperator/main/scripts/install-cfassist.sh | sh

Detects your OS and CPU, downloads from the cfassist-latest pointer, verifies the SHA-256 against the release's checksums.txt, and installs to /usr/local/bin (asking for sudo only if it has to; ~/.local/bin if there is no sudo). No gh, no Python, no runtime deps — it is one static binary.

Knobs, all optional: CFASSIST_VERSION=0.10.0 pins an exact release, CFASSIST_INSTALL_DIR changes where it lands, --dry-run prints what it would do. Built for linux-amd64, linux-arm64, linux-arm, darwin-amd64, darwin-arm64.

Configure

On first run — and again if you delete the file and rerun the installer — cfassist writes ~/.cfassist/config.yaml with every setting stubbed — live values where a default is safe, commented where a human has to fill something in (API keys, the CFOperator agent URL). Edit that file rather than starting from a blank one. An existing file is never overwritten.

llm:
  default: ollama
  temperature: 0.7

providers:
  ollama:
    provider: ollama
    url: http://localhost:11434
    model: llama3.2

# url and token stay commented until you point attach at an agent.
cfoperator:
  # url: http://192.168.1.50:8083
  # token: ${CFOP_API_TOKEN}
  timeout: 30
  discover: true

The providers: block also carries commented stubs for groq, xai, gemini, deepseek, openrouter and claude. Uncomment one, fill its api_key, and /use <name> in the TUI (or --provider <name>). Groq, xAI, DeepSeek and OpenRouter are provider: openai — the same wire — while Gemini is its own provider: gemini because Google's OpenAI-compatible surface lives at …/v1beta/openai with no /v1 segment; copying the groq stub onto it would 404.

What it may run

cfassist's shell runs as you, on this machine. Reads run as the model asks — journalctl, systemctl status, kubectl get, curl to a metrics endpoint. A command that changes state — restart, stop, delete, install, edit a file, redirect output to a file — is shown to you first and runs only if you say so (y once, a for the rest of the session). Declined, the model is told it did not run. The classification is a denylist of write shapes, not a proof: an interpreter one-liner (python -c …), a database client or a script run by its path counts as a read and runs unasked. tools.bash.confirm_writes: false turns the question off; that is the shell with your permissions in the model's hands, so it is not the default.

On piped input (journalctl -u nginx | cfassist "summarize errors") there is no shell at all: the text came from a pipe, not from you, and whatever is in it must not be able to run commands. read_file, the playbooks, memory and the read-only CFOperator tool stay.

Usage

# Interactive TUI
cfassist

# One-shot mode
cfassist "what is my hostname?"

# Pipe mode
journalctl -u nginx --since '1 hour ago' | cfassist "summarize errors"

# Attach to a CFOperator investigation — the alert-to-terminal handoff.
# Every Slack/Discord/ntfy notification that carries an investigation ends
# with this exact line. See docs/cockpit.md.
cfassist attach 1889
cfassist attach 1889 --print                  # briefing only, no session
cfassist attach 1889 "did the pod recover?"   # one-shot, briefing seeded

CLI Flags

Flag Description
--config Path to config file (default ~/.cfassist/config.yaml)
--model Override LLM model
--provider Select LLM provider by name
--url Override LLM endpoint URL
--version Show version
--print (attach only) render the briefing to stdout and start nothing; attach's other flags (--agent-url, --spawn, --tier, --host, …) are in docs/cockpit.md

attach reads the CFOperator API over CFOP_AGENT_URL / CFOP_API_TOKEN — the same variables the MCP server uses — or a cfoperator: block in the config file. It is read-only: a read-scope token is enough.

Finding your way

Nothing in the session has to be guessed. Type / and every command is listed with what it does, narrowing as you type; past the command, the same menu switches to its argument — the playbooks after /skill , the providers after /use , the models after /model . ↑↓ choose, tab accepts, enter runs, esc closes. ? on an empty line lists the keys, and /help is the one page with all of it: commands, the tools the model can call, the playbooks, the keys.

╭─ #2242 · PodUnschedulable on headless-gpu ─────────────────────────────────╮
│ > /sk                                                                      │
╰────────────────────────────────────────────────────────────────────────────╯
  /skill <name> [target]    Load a playbook into this session, aimed at a pod…
  /skills                   The playbooks this session knows, and what each o…
  ↑↓ choose · tab accept · enter run · esc close       ollama:gemma4:26b · 12.3k/32k

The box around the input carries the investigation an attach session is on, and turns amber while a turn is running; ctrl+c stops the turn, ctrl+d quits. The footer keeps the model name on any width and sheds the rest — last turn's numbers first, then hints, then the provider prefix, then the context gauge — rather than wrapping.

Open cockpit from the console

On an investigation in the console, an admin gets Open cockpit beside the attach line. One click spawns (or joins) the session on the affected host and opens a terminal in the drawer, with the finding still in view. The agent's bridge carries the bytes and is off by default (cockpit.bridge_enabled). How to enable it, the one-shot ticket, kill and reattach, and which tiers the drawer serves are in docs/cockpit.md, section 8.

Skills

cfassist ships CFOperator's nine investigation playbooks — the same skills/*/SKILL.md files the MCP server exposes to Claude Desktop and the Slack bridge — baked into the binary, so a fresh install on a Pi with no network has all of them.

/skills                              # what they are, and what each is for
/skill investigate-pod immich-kiosk-0   # load one, aimed at something

/skill sends the playbook to the model and prints one line to the terminal; the body is thousands of words and burying the incident under it helps nobody.

The model has the same capability as a skill tool, so "why does immich-kiosk-0 keep restarting" can reach for why-restart on its own rather than improvising a worse version of a procedure the product already has. The playbook names are in the tool description and constrained by an enum, so it cannot invent one.

Drop your own into ~/.cfassist/skills/<name>/SKILL.md to add a playbook or replace one of the built-ins — same name wins, and the listing marks it (yours).

It notices the agent it is running next to

A plain cfassist — no id, no attach — probes the address attach would use at startup (one GET to the auth-exempt /api/health, 1.5s ceiling). When CFOperator answers, the session is told so and gets a cfoperator tool for its investigations, remediation queue and knowledge base, and — unlike attach — can close or act on a row when asked. Turn the probe off with cfoperator: {discover: false}. Why it exists and what the tool can do are in docs/cockpit.md, section 7.

Build from Source

cd cfassist-go
make build          # native binary
make linux-arm64    # cross-compile for Pi
make all            # all platforms

Key Files

File Purpose
agent/agent.py OODA loop (proactive sweep + HTTP-driven run_investigation), chat handler, tool registry
web_server.py Flask + Waitress; REST APIs + POST /v1/investigate for event_runtime delegation
event_runtime/ Standalone process: alert ingest, dedupe, decisions, action dispatch, Slack/Discord/ntfy
mcp_server/ MCP facade over the agent API: tools/resources/prompts, bearer auth + scopes, audit log (docs)
bridge/ Slack Socket Mode bot with pluggable runtimes (local agent / Claude-over-MCP) (docs)
event_runtime/http_actions.py HTTPInvestigateActionHandler + completion endpoint auth/validation helpers
auth/ Console users, roles, and API tokens: models, store, routes, bootstrap (docs)
web_auth.py Console gate on :8083: session login, bearer verification, require_role
ui/ The console: seven static pages inside one rail (ui/nav.js) and one stylesheet (ui/console.css), no build step, third-party code vendored under ui/vendor/
ui/index.html Chat page (dark theme, sidebar layout)
ui/account.html Self-service password and own API tokens
ui/admin.html Admin panel: users, tokens, LLM, git repos, node-action allowlist, MCP connectors
agent/knowledge_base.py ResilientKnowledgeBase wrapping PostgreSQL + pgvector
agent/embedding_service.py Embedding generation via Ollama with LRU + DB cache
agent/llm_fallback.py LLM provider chain with cooldown/retry
config.yaml.example Getting-started config: profile, LLM, Prometheus, Alertmanager, Loki, notifications, database. Every other setting defaults from cfshared/config.py and is documented in docs/config-reference.md
cfshared/ Code the agent and the event runtime share: the config schema and its defaults, database, tracing, evidence. No third-party import at module scope, because the event runtime may run stdlib-only
tools/ SSH, K8s, git, GitHub, TimescaleDB, discovery, and core tool implementations
tools/timescale.py Read-only SQL over the telemetry TimescaleDB (timescale_query)
executor/ Disposable Job that carries a remediation to a PR (docs)
changerecord/ Change-record microservice for the node-action lane (docs)
dedupe/ cfop-dedupe, the Go service that decides every remediation enqueue; its own CI job, held to the agent's Python model by shared cases in dedupe/testdata/ (docs)
tracker/ cfop-tracker, the stdlib service that files remediation rows in Plane, GitHub or Jira (docs)
worker/ Deep-investigation worker + forensics templates (docs)
discovery/ One-shot fleet characterization that seeds the KB (report-only without an agent) (docs)
cockpit/ The cockpit: the Job launcher behind POST /api/cockpit/spawn, the host-tier ladder, the browser terminal bridge, and the Job image they launch (docs)
cfassist-go/ The cfassist CLI (above)
charts/cfoperator/ Helm chart — the k8s trial path, three required values, investigate/remediate profiles (docs)
deploy/ The compose trial's config (deploy/compose/config.yaml) and a systemd unit for event_runtime on a plain host
demo/ Reproducible kind demo — break a real cluster, watch the second investigation cite the first — and the release e2e harness (README)
integrations/ Optional event-runtime plugins, loaded only when named in CFOP_EVENT_RUNTIME_PLUGINS (Dynatrace) (docs)
cfoperator The operator command: ./cfoperator init probes each answer and writes .env + config.yaml
scripts/ Operator and maintainer scripts, copied into the image: installers, the init wizard, create_admin.py, mcp_smoke.py, the triage dataset builders, the LLM PR review
hf/ Publishing the triage fine-tune to Hugging Face: model card, sha256 manifest, secret scan (docs)
tests/ Suites that belong to no one package, collected by CI as one directory (how to run)
.github/workflows/tests.yml pytest suites, the cfassist Go tests and the dedupe service's Go checks on every PR and push to main
.mcp.json Dev-tooling MCP servers for agentic sessions in this repo (Plane, workspace cfoperator; needs PLANE_API_KEY in the environment)
skills/ Investigation workflow definitions (SKILL.md)
observability/ Pluggable backends (Prometheus, Loki, Kubernetes, Docker, Slack, Discord)
llm-gateway/ Go proxy with health-based routing + fallback
benchmarks/ Inference latency and tool-calling benchmarks, and the triage eval harness (benchmarks/triage_eval.py) with its committed results
grafana/ Dashboard JSON, a mirror of the copies provisioned from homelab-infra

Tests & CI

.github/workflows/tests.yml runs the pytest suites, the cfassist Go tests and the dedupe service's Go checks on every pull request and on pushes to main (plus workflow_dispatch). The Python suite cannot run as one flat pytest; CONTRIBUTING.md has the per-directory invocation that mirrors CI, and why.

Documentation

Getting Started

Configuration & deploy

Interfaces

Remediation & Investigation

  • docs/REMEDIATION.md — Remediation lifecycle and pipeline internals: the queue, executor, change records, dedupe service, tracker hand-off
  • docs/deep-investigation.md — The deep-investigation tier: forensics Jobs for host-shaped escalations and unclean reboots
  • docs/noise-reduction.md — Keeping red for broken-now: the recovered-pod restart filter, severity-to-channel digest routing, recurrence suppression, dismissal learning

LLM / triage model

Operations & Monitoring

Planned work is tracked in Plane (project CFOP), not in this repo — a roadmap file here went stale twice in nine days and was dropped rather than re-synced by hand.

Historical benchmarks

Dated snapshots of the models of their day: read them for the method, not as a current recommendation.

License

MIT — see LICENSE.

About

AI-powered SRE agent for homelab infrastructure monitoring, OODA sweeps, RAG memory, and remediation workflows

Topics

Resources

Contributing

Security policy

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages