# tracer-cloud/opensre architecture

> Architecture diagram of the GitHub repository tracer-cloud/opensre, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tracer-cloud/opensre
- Repository: https://github.com/tracer-cloud/opensre

## Overview

OpenSRE is a self-hosted SRE agent for investigating CI/CD failures and preparing fixes for review. The documented terminal workflow starts at the CLI, continues in the interactive shell or a headless agent turn, and uses configured models and integrations to investigate and act. Distinct product areas also include session and memory context, task planning, CI repair, and reliability telemetry. The graph uses README claims and the supplied source index/excerpts; several internal links are omitted where sampled code does not establish the caller or data flow.

Main entry points: [`core/agent_harness/harness.py`](https://github.com/tracer-cloud/opensre/blob/main/core/agent_harness/harness.py) (Agent harness), [`surfaces/interactive_shell/controller.py`](https://github.com/tracer-cloud/opensre/blob/main/surfaces/interactive_shell/controller.py) (Interactive shell), [`gateway/core/lifecycle/controller.py`](https://github.com/tracer-cloud/opensre/blob/main/gateway/core/lifecycle/controller.py) (Gateway lifecycle), [`surfaces/cli/app.py`](https://github.com/tracer-cloud/opensre/blob/main/surfaces/cli/app.py) (CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entrypoints"]
  node_cli["CLI<br/>[app.py]"]
  node_shell["Interactive shell<br/>[controller.py]"]
  node_headless["Headless agent turn<br/>[headless_agent.py]"]
end

subgraph group_agent["Agent runtime"]
  node_harness["Agent harness<br/>[harness.py]"]
  node_turns["Turn orchestration<br/>[orchestrator.py]"]
  node_tools["Tool execution<br/>[execution.py]"]
  node_plans["Task plans<br/>[plan.py]"]
  node_goals["Session goals<br/>[goal.py]"]
  node_prompts["Prompt assembly<br/>[assemble.py]"]
  node_session["Session state<br/>[session_core.py]"]
  node_memory[("Memory domain<br/>[store.py]")]
end

subgraph group_investigation["Reliability investigation"]
  node_github["GitHub CI repair<br/>[storage.py]"]
  node_knowledge["Knowledge sources<br/>[access.py]"]
  node_telemetry["CI reliability telemetry<br/>[investigation.py]"]
end

subgraph group_connectors["Models and integrations"]
  node_llm["LLM clients<br/>[llm_clients.py]"]
  node_integrations["Service integrations<br/>[config_models.py]"]
end

subgraph group_operations["Gateway and telemetry"]
  node_gateway["Gateway lifecycle<br/>[controller.py]"]
  node_prompt_intake["Gateway prompt intake<br/>[jobs.py]"]
  node_event_store[("Gateway event storage<br/>[repository.py]")]
  node_remote_sync["Remote context sync<br/>[engine.py]"]
end

node_engineer(("Engineer"))

node_engineer -->|"runs"| node_cli
node_cli -->|"opens shell"| node_shell
node_engineer -->|"submits prompt"| node_headless
node_shell -->|"queues turns"| node_turns
node_headless -.->|"runs agent"| node_harness
node_turns -.->|"dispatches turn"| node_harness
node_harness -.->|"assembles prompt"| node_prompts
node_harness -.->|"requests model"| node_llm
node_harness -.->|"uses tools"| node_tools
node_harness -.->|"uses session"| node_session
node_harness -.->|"plans work"| node_plans
node_harness -.->|"tracks goals"| node_goals
node_session -.->|"uses memory"| node_memory
node_tools -.->|"invokes services"| node_integrations
node_harness -->|"investigates failures"| node_github
node_harness -.->|"reads context"| node_knowledge
node_harness -->|"analyzes reliability"| node_telemetry
node_engineer -->|"uses managed gateway"| node_gateway
node_gateway -->|"hosts intake"| node_prompt_intake
node_gateway -->|"serves transport events"| node_event_store
node_shell -->|"syncs context"| node_remote_sync

click node_cli "https://github.com/tracer-cloud/opensre/blob/main/surfaces/cli/app.py"
click node_shell "https://github.com/tracer-cloud/opensre/blob/main/surfaces/interactive_shell/controller.py"
click node_headless "https://github.com/tracer-cloud/opensre/blob/main/core/agent_harness/turns/headless_agent.py"
click node_harness "https://github.com/tracer-cloud/opensre/blob/main/core/agent_harness/harness.py"
click node_turns "https://github.com/tracer-cloud/opensre/blob/main/core/agent_harness/turns/orchestrator.py"
click node_tools "https://github.com/tracer-cloud/opensre/blob/main/core/tool/execution.py"
click node_plans "https://github.com/tracer-cloud/opensre/blob/main/core/agent_harness/task_plan/plan.py"
click node_goals "https://github.com/tracer-cloud/opensre/blob/main/core/agent_harness/session_goal/goal.py"
click node_prompts "https://github.com/tracer-cloud/opensre/blob/main/core/agent_harness/prompts/action/assemble.py"
click node_session "https://github.com/tracer-cloud/opensre/blob/main/core/agent_harness/session/session_core.py"
click node_memory "https://github.com/tracer-cloud/opensre/blob/main/core/domain/memory/store.py"
click node_llm "https://github.com/tracer-cloud/opensre/blob/main/core/llm/transports/sdk/llm_clients.py"
click node_github "https://github.com/tracer-cloud/opensre/blob/main/integrations/github/tools/ci_repair_loop/storage.py"
click node_knowledge "https://github.com/tracer-cloud/opensre/blob/main/core/domain/knowledge/access.py"
click node_telemetry "https://github.com/tracer-cloud/opensre/blob/main/core/telemetry/investigation.py"
click node_integrations "https://github.com/tracer-cloud/opensre/blob/main/integrations/config_models.py"
click node_gateway "https://github.com/tracer-cloud/opensre/blob/main/gateway/core/lifecycle/controller.py"
click node_prompt_intake "https://github.com/tracer-cloud/opensre/blob/main/gateway/core/prompt_intake/jobs.py"
click node_event_store "https://github.com/tracer-cloud/opensre/blob/main/gateway/core/storage/events/repository.py"
click node_remote_sync "https://github.com/tracer-cloud/opensre/blob/main/infrastructure/filestorage/engine.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_shell,node_headless toneBlue
class node_harness,node_turns,node_tools,node_plans,node_goals,node_prompts,node_session,node_memory toneAmber
class node_github,node_knowledge,node_telemetry toneMint
class node_llm,node_integrations toneRose
class node_gateway,node_prompt_intake,node_event_store,node_remote_sync,node_engineer toneIndigo
```

## Components

### User entrypoints

- [CLI](https://github.com/tracer-cloud/opensre/blob/main/surfaces/cli/app.py): `surfaces/cli/app.py`
- [Interactive shell](https://github.com/tracer-cloud/opensre/blob/main/surfaces/interactive_shell/controller.py): `surfaces/interactive_shell/controller.py`
- [Headless agent turn](https://github.com/tracer-cloud/opensre/blob/main/core/agent_harness/turns/headless_agent.py): `core/agent_harness/turns/headless_agent.py`

### Agent runtime

- [Agent harness](https://github.com/tracer-cloud/opensre/blob/main/core/agent_harness/harness.py): `core/agent_harness/harness.py`
- [Turn orchestration](https://github.com/tracer-cloud/opensre/blob/main/core/agent_harness/turns/orchestrator.py): `core/agent_harness/turns/orchestrator.py`
- [Tool execution](https://github.com/tracer-cloud/opensre/blob/main/core/tool/execution.py): `core/tool/execution.py`
- [Task plans](https://github.com/tracer-cloud/opensre/blob/main/core/agent_harness/task_plan/plan.py): `core/agent_harness/task_plan/plan.py`
- [Session goals](https://github.com/tracer-cloud/opensre/blob/main/core/agent_harness/session_goal/goal.py): `core/agent_harness/session_goal/goal.py`
- [Prompt assembly](https://github.com/tracer-cloud/opensre/blob/main/core/agent_harness/prompts/action/assemble.py): `core/agent_harness/prompts/action/assemble.py`
- [Session state](https://github.com/tracer-cloud/opensre/blob/main/core/agent_harness/session/session_core.py): `core/agent_harness/session/session_core.py`
- [Memory domain](https://github.com/tracer-cloud/opensre/blob/main/core/domain/memory/store.py): `core/domain/memory/store.py`

### Reliability investigation

- [GitHub CI repair](https://github.com/tracer-cloud/opensre/blob/main/integrations/github/tools/ci_repair_loop/storage.py): `integrations/github/tools/ci_repair_loop/storage.py`
- [Knowledge sources](https://github.com/tracer-cloud/opensre/blob/main/core/domain/knowledge/access.py): `core/domain/knowledge/access.py`
- [CI reliability telemetry](https://github.com/tracer-cloud/opensre/blob/main/core/telemetry/investigation.py): `core/telemetry/investigation.py`

### Models and integrations

- [LLM clients](https://github.com/tracer-cloud/opensre/blob/main/core/llm/transports/sdk/llm_clients.py): `core/llm/transports/sdk/llm_clients.py`
- [Service integrations](https://github.com/tracer-cloud/opensre/blob/main/integrations/config_models.py): `integrations/config_models.py`

### Gateway and telemetry

- [Gateway lifecycle](https://github.com/tracer-cloud/opensre/blob/main/gateway/core/lifecycle/controller.py): `gateway/core/lifecycle/controller.py`
- [Gateway prompt intake](https://github.com/tracer-cloud/opensre/blob/main/gateway/core/prompt_intake/jobs.py): `gateway/core/prompt_intake/jobs.py`
- [Gateway event storage](https://github.com/tracer-cloud/opensre/blob/main/gateway/core/storage/events/repository.py): `gateway/core/storage/events/repository.py`
- [Remote context sync](https://github.com/tracer-cloud/opensre/blob/main/infrastructure/filestorage/engine.py): `infrastructure/filestorage/engine.py`

### Other components

- **Engineer**

## Connections

- Engineer → CLI: runs
- CLI → Interactive shell: opens shell
- Engineer → Headless agent turn: submits prompt
- Interactive shell → Turn orchestration: queues turns (evidence: `surfaces/interactive_shell/controller.py`)
- Headless agent turn → Agent harness: runs agent
- Turn orchestration → Agent harness: dispatches turn
- Agent harness → Prompt assembly: assembles prompt
- Agent harness → LLM clients: requests model
- Agent harness → Tool execution: uses tools
- Agent harness → Session state: uses session
- Agent harness → Task plans: plans work
- Agent harness → Session goals: tracks goals
- Session state → Memory domain: uses memory
- Tool execution → Service integrations: invokes services
- Agent harness → GitHub CI repair: investigates failures
- Agent harness → Knowledge sources: reads context
- Agent harness → CI reliability telemetry: analyzes reliability
- Engineer → Gateway lifecycle: uses managed gateway
- Gateway lifecycle → Gateway prompt intake: hosts intake (evidence: `gateway/core/lifecycle/controller.py`)
- Gateway lifecycle → Gateway event storage: serves transport events
- Interactive shell → Remote context sync: syncs context (evidence: `infrastructure/filestorage/engine.py`)
