# cosmosmind-ai/rsi-harness architecture

> Architecture diagram of the GitHub repository cosmosmind-ai/rsi-harness, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cosmosmind-ai/rsi-harness
- Repository: https://github.com/cosmosmind-ai/rsi-harness

## Overview

RSIH wraps the Pi coding agent with versionable, switchable Genome configurations. The main workflow is to launch a Genome, resolve and project its components into a Pi session, and use the configured harness; GEE additionally analyzes prior sessions and interactively authors a validated Genome. The graph retains Genome management, model configuration, MCP, and session-switching capabilities. Some subsystem wiring is based on README descriptions because the sampled source excerpts omit implementation details.

Main entry points: [`src/pi-cli-runtime.ts`](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/pi-cli-runtime.ts) (Pi CLI runtime), [`src/cli.ts`](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/cli.ts) (RSIH CLI), [`src/cli/genome-command.ts`](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/cli/genome-command.ts) (Genome commands), [`config/genomes/harness-rsi/extension/harness-rsi.ts`](https://github.com/cosmosmind-ai/rsi-harness/blob/main/config/genomes/harness-rsi/extension/harness-rsi.ts) (Harness authoring extension)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and session"]
  node_cli["RSIH CLI<br/>[cli.ts]"]
  node_supervisor["Session supervisor<br/>[supervisor.ts]"]
  node_pi_runtime["Pi CLI runtime<br/>[pi-cli-runtime.ts]"]
end

subgraph group_genome["Genome management"]
  node_genome_command["Genome commands<br/>[genome-command.ts]"]
  node_genome_shorthand["Genome shorthand"]
  node_genome_loader["Genome resolver<br/>[genome-loader.ts]"]
  node_genome_bundle["Genome bundle loader<br/>[genome-bundle.ts]"]
  node_genome_rules["Genome validation and patches<br/>[genome.ts]"]
  node_genome_files["Genome configurations"]
end

subgraph group_runtime["Agent runtime"]
  node_projection["Pi configuration projection<br/>[pi-projection.ts]"]
  node_settings["Managed settings layer<br/>[settings-layer.ts]"]
  node_mcp["MCP integration<br/>[mcp.ts]"]
  node_builtin_tools["Generated tools<br/>[builtin-tools.ts]"]
  node_provider_profiles["Provider profiles<br/>[env.ts]"]
  node_model_runtime["Model runtime<br/>[model-runtime.ts]"]
end

subgraph group_gee["Genome authoring"]
  node_gee["GEE launcher<br/>[cli.ts]"]
  node_authoring_extension["Harness authoring extension<br/>[harness-rsi.ts]"]
  node_session_sources["Session source readers<br/>[session-sources.ts]"]
  node_generated_genome["Authored Genome"]
end

node_user(("User or caller"))
node_pi_agent["Pi coding agent"]
node_mcp_servers["MCP servers"]
node_model_provider["Model provider"]
node_session_stores["Agent session stores"]

node_user -->|"invokes"| node_cli
node_cli -->|"expands markers"| node_genome_shorthand
node_cli -->|"starts sessions"| node_supervisor
node_supervisor -->|"spawns or restarts"| node_pi_runtime
node_pi_runtime -->|"runs on"| node_pi_agent
node_user -->|"manages Genomes"| node_genome_command
node_genome_command -->|"resolves references"| node_genome_loader
node_genome_command -->|"installs bundles"| node_genome_bundle
node_genome_loader -->|"searches and reads"| node_genome_files
node_genome_bundle -->|"loads component data"| node_genome_rules
node_pi_runtime -->|"resolves active Genome"| node_genome_loader
node_pi_runtime -->|"renders prompt"| node_genome_rules
node_pi_runtime -->|"projects Genome"| node_projection
node_projection -->|"merges settings"| node_settings
node_pi_runtime -->|"creates MCP tools"| node_mcp
node_mcp -.->|"connects to"| node_mcp_servers
node_pi_runtime -->|"registers tools"| node_builtin_tools
node_pi_runtime -->|"loads profiles"| node_provider_profiles
node_provider_profiles -->|"configures"| node_model_runtime
node_model_runtime -->|"sends requests"| node_model_provider
node_user -->|"launches authoring"| node_gee
node_gee -->|"launches harness-rsi"| node_cli
node_pi_runtime -->|"loads extension"| node_authoring_extension
node_authoring_extension -->|"reads history through"| node_session_sources
node_session_sources -->|"reads transcripts"| node_session_stores
node_authoring_extension -->|"writes after confirmation"| node_generated_genome
node_generated_genome -->|"validates with"| node_genome_rules

click node_cli "https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/cli.ts"
click node_supervisor "https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/cli/supervisor.ts"
click node_pi_runtime "https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/pi-cli-runtime.ts"
click node_genome_command "https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/cli/genome-command.ts"
click node_genome_shorthand "https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/cli/genome-shorthand.ts"
click node_genome_loader "https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/harness/genome-loader.ts"
click node_genome_bundle "https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/harness/genome-bundle.ts"
click node_genome_rules "https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/harness/genome.ts"
click node_genome_files "https://github.com/cosmosmind-ai/rsi-harness/tree/main/config/genomes"
click node_projection "https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/harness/pi-projection.ts"
click node_settings "https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/harness/settings-layer.ts"
click node_mcp "https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/harness/mcp.ts"
click node_builtin_tools "https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/harness/builtin-tools.ts"
click node_provider_profiles "https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/model/env.ts"
click node_model_runtime "https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/model/model-runtime.ts"
click node_gee "https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/gee/cli.ts"
click node_authoring_extension "https://github.com/cosmosmind-ai/rsi-harness/blob/main/config/genomes/harness-rsi/extension/harness-rsi.ts"
click node_session_sources "https://github.com/cosmosmind-ai/rsi-harness/blob/main/config/genomes/harness-rsi/extension/session-sources.ts"
click node_generated_genome "https://github.com/cosmosmind-ai/rsi-harness/tree/main/config/genomes"

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_supervisor,node_pi_runtime,node_user toneBlue
class node_genome_command,node_genome_shorthand,node_genome_loader,node_genome_bundle,node_genome_rules,node_genome_files toneAmber
class node_projection,node_settings,node_mcp,node_builtin_tools,node_provider_profiles,node_model_runtime,node_mcp_servers toneMint
class node_gee,node_authoring_extension,node_session_sources,node_generated_genome toneRose
class node_pi_agent,node_model_provider,node_session_stores toneIndigo
```

## Components

### CLI and session

- [RSIH CLI](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/cli.ts): `src/cli.ts`
- [Session supervisor](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/cli/supervisor.ts): `src/cli/supervisor.ts`
- [Pi CLI runtime](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/pi-cli-runtime.ts): `src/pi-cli-runtime.ts`

### Genome management

- [Genome commands](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/cli/genome-command.ts): `src/cli/genome-command.ts`
- [Genome shorthand](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/cli/genome-shorthand.ts): `src/cli/genome-shorthand.ts`
- [Genome resolver](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/harness/genome-loader.ts): `src/harness/genome-loader.ts`
- [Genome bundle loader](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/harness/genome-bundle.ts): `src/harness/genome-bundle.ts`
- [Genome validation and patches](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/harness/genome.ts): `src/harness/genome.ts`
- [Genome configurations](https://github.com/cosmosmind-ai/rsi-harness/tree/main/config/genomes): `config/genomes`

### Agent runtime

- [Pi configuration projection](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/harness/pi-projection.ts): `src/harness/pi-projection.ts`
- [Managed settings layer](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/harness/settings-layer.ts): `src/harness/settings-layer.ts`
- [MCP integration](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/harness/mcp.ts): `src/harness/mcp.ts`
- [Generated tools](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/harness/builtin-tools.ts): `src/harness/builtin-tools.ts`
- [Provider profiles](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/model/env.ts): `src/model/env.ts`
- [Model runtime](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/model/model-runtime.ts): `src/model/model-runtime.ts`

### Genome authoring

- [GEE launcher](https://github.com/cosmosmind-ai/rsi-harness/blob/main/src/gee/cli.ts): `src/gee/cli.ts`
- [Harness authoring extension](https://github.com/cosmosmind-ai/rsi-harness/blob/main/config/genomes/harness-rsi/extension/harness-rsi.ts): `config/genomes/harness-rsi/extension/harness-rsi.ts`
- [Session source readers](https://github.com/cosmosmind-ai/rsi-harness/blob/main/config/genomes/harness-rsi/extension/session-sources.ts): `config/genomes/harness-rsi/extension/session-sources.ts`
- [Authored Genome](https://github.com/cosmosmind-ai/rsi-harness/tree/main/config/genomes): `config/genomes`

### Other components

- **User or caller**
- **Pi coding agent**
- **MCP servers**
- **Model provider**
- **Agent session stores**

## Connections

- User or caller → RSIH CLI: invokes
- RSIH CLI → Genome shorthand: expands markers
- RSIH CLI → Session supervisor: starts sessions
- Session supervisor → Pi CLI runtime: spawns or restarts
- Pi CLI runtime → Pi coding agent: runs on
- User or caller → Genome commands: manages Genomes
- Genome commands → Genome resolver: resolves references
- Genome commands → Genome bundle loader: installs bundles
- Genome resolver → Genome configurations: searches and reads
- Genome bundle loader → Genome validation and patches: loads component data
- Pi CLI runtime → Genome resolver: resolves active Genome
- Pi CLI runtime → Genome validation and patches: renders prompt
- Pi CLI runtime → Pi configuration projection: projects Genome
- Pi configuration projection → Managed settings layer: merges settings
- Pi CLI runtime → MCP integration: creates MCP tools
- MCP integration → MCP servers: connects to
- Pi CLI runtime → Generated tools: registers tools
- Pi CLI runtime → Provider profiles: loads profiles
- Provider profiles → Model runtime: configures
- Model runtime → Model provider: sends requests
- User or caller → GEE launcher: launches authoring
- GEE launcher → RSIH CLI: launches harness-rsi
- Pi CLI runtime → Harness authoring extension: loads extension
- Harness authoring extension → Session source readers: reads history through
- Session source readers → Agent session stores: reads transcripts
- Harness authoring extension → Authored Genome: writes after confirmation
- Authored Genome → Genome validation and patches: validates with
