# viespirkiu-grupe/tyras architecture

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

- Interactive diagram: https://gitdiagram.com/viespirkiu-grupe/tyras
- Repository: https://github.com/viespirkiu-grupe/tyras

## Overview

Tyras is a TypeScript orchestration system for Lithuanian public-procurement fraud investigations. A user supplies a case description; the orchestrator resumes or initializes case state, runs a planner, dispatches theme-specific investigators, and then runs reporting and technical review. Agents use Claude CLI sessions, with the planner and investigators querying Viešpirkiai MCP. Case files and resumable state are stored in the investigations workspace. The README documents the workflow and theme library; edges to unsampled subsystems are included only where that documentation supports them.

Main entry points: [`src/orchestrator.ts`](https://github.com/viespirkiu-grupe/tyras/blob/main/src/orchestrator.ts) (Orchestrator), [`src/agents/base-agent.ts`](https://github.com/viespirkiu-grupe/tyras/blob/main/src/agents/base-agent.ts) (Agent framework), [`src/agents/planner.ts`](https://github.com/viespirkiu-grupe/tyras/blob/main/src/agents/planner.ts) (Planning agent), [`src/io/workspace.ts`](https://github.com/viespirkiu-grupe/tyras/blob/main/src/io/workspace.ts) (Case workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Investigation workflow"]
  node_orchestrator["Orchestrator<br/>[orchestrator.ts]"]
  node_cli["CLI entry point<br/>[index.ts]"]
end

subgraph group_agents["Agent execution"]
  node_planner["Planning agent<br/>[planner.ts]"]
  node_investigator["Theme investigator<br/>[investigator.ts]"]
  node_reporter["Report writer<br/>[reporter.ts]"]
  node_techreview["Technical reviewer<br/>[tech-reviewer.ts]"]
  node_baseagent["Agent framework<br/>[base-agent.ts]"]
end

subgraph group_runtime["Runtime services"]
  node_agentloop["Claude session runner<br/>[agent-loop.ts]"]
  node_config["Runtime configuration<br/>[config.ts]"]
  node_logger["Investigation logger<br/>[logger.ts]"]
  node_format["Document formatting<br/>[format.ts]"]
end

subgraph group_data["Case data and research"]
  node_workspace[("Case workspace<br/>[workspace.ts]")]
  node_themeguide["Theme library and MCP guidance"]
  node_prompts["Agent prompts"]
end

node_user(("Investigator"))
node_claude["Claude CLI"]
node_mcp["Viešpirkiai MCP"]
node_procurementdb[("Procurement data")]

node_user -->|"starts case"| node_cli
node_cli -->|"invokes"| node_orchestrator
node_orchestrator -->|"reads and saves case"| node_workspace
node_orchestrator -->|"runs planning"| node_planner
node_orchestrator -->|"dispatches themes"| node_investigator
node_orchestrator -->|"runs reporting"| node_reporter
node_orchestrator -->|"runs review"| node_techreview
node_planner -->|"extends"| node_baseagent
node_investigator -->|"extends"| node_baseagent
node_reporter -->|"extends"| node_baseagent
node_techreview -->|"extends"| node_baseagent
node_baseagent -->|"runs session"| node_agentloop
node_agentloop -->|"spawns process"| node_claude
node_planner -->|"queries entities"| node_mcp
node_investigator -->|"queries by theme"| node_mcp
node_mcp -->|"retrieves records"| node_procurementdb
node_planner -->|"uses theme guidance"| node_themeguide
node_baseagent -->|"loads prompt"| node_prompts
node_planner -.->|"writes dossier and plan"| node_workspace
node_investigator -.->|"writes findings"| node_workspace
node_reporter -->|"reads findings and writes report"| node_workspace
node_techreview -->|"reads and writes review"| node_workspace
node_orchestrator -->|"uses settings"| node_config
node_orchestrator -->|"records progress"| node_logger
node_agentloop -->|"logs session"| node_logger
node_orchestrator -->|"formats documents"| node_format

click node_orchestrator "https://github.com/viespirkiu-grupe/tyras/blob/main/src/orchestrator.ts"
click node_planner "https://github.com/viespirkiu-grupe/tyras/blob/main/src/agents/planner.ts"
click node_investigator "https://github.com/viespirkiu-grupe/tyras/blob/main/src/agents/investigator.ts"
click node_reporter "https://github.com/viespirkiu-grupe/tyras/blob/main/src/agents/reporter.ts"
click node_techreview "https://github.com/viespirkiu-grupe/tyras/blob/main/src/agents/tech-reviewer.ts"
click node_baseagent "https://github.com/viespirkiu-grupe/tyras/blob/main/src/agents/base-agent.ts"
click node_agentloop "https://github.com/viespirkiu-grupe/tyras/blob/main/src/agent-loop.ts"
click node_workspace "https://github.com/viespirkiu-grupe/tyras/blob/main/src/io/workspace.ts"
click node_themeguide "https://github.com/viespirkiu-grupe/tyras/tree/main/docs/themes"
click node_prompts "https://github.com/viespirkiu-grupe/tyras/tree/main/docs/prompts"
click node_config "https://github.com/viespirkiu-grupe/tyras/blob/main/src/config.ts"
click node_logger "https://github.com/viespirkiu-grupe/tyras/blob/main/src/io/logger.ts"
click node_format "https://github.com/viespirkiu-grupe/tyras/blob/main/src/io/format.ts"
click node_cli "https://github.com/viespirkiu-grupe/tyras/blob/main/src/index.ts"

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_orchestrator,node_cli toneBlue
class node_planner,node_investigator,node_reporter,node_techreview,node_baseagent,node_procurementdb toneAmber
class node_agentloop,node_config,node_logger,node_format toneMint
class node_workspace,node_themeguide,node_prompts toneRose
class node_user,node_claude,node_mcp toneIndigo
```

## Components

### Investigation workflow

- [Orchestrator](https://github.com/viespirkiu-grupe/tyras/blob/main/src/orchestrator.ts): `src/orchestrator.ts`
- [CLI entry point](https://github.com/viespirkiu-grupe/tyras/blob/main/src/index.ts): `src/index.ts`

### Agent execution

- [Planning agent](https://github.com/viespirkiu-grupe/tyras/blob/main/src/agents/planner.ts): `src/agents/planner.ts`
- [Theme investigator](https://github.com/viespirkiu-grupe/tyras/blob/main/src/agents/investigator.ts): `src/agents/investigator.ts`
- [Report writer](https://github.com/viespirkiu-grupe/tyras/blob/main/src/agents/reporter.ts): `src/agents/reporter.ts`
- [Technical reviewer](https://github.com/viespirkiu-grupe/tyras/blob/main/src/agents/tech-reviewer.ts): `src/agents/tech-reviewer.ts`
- [Agent framework](https://github.com/viespirkiu-grupe/tyras/blob/main/src/agents/base-agent.ts): `src/agents/base-agent.ts`

### Runtime services

- [Claude session runner](https://github.com/viespirkiu-grupe/tyras/blob/main/src/agent-loop.ts): `src/agent-loop.ts`
- [Runtime configuration](https://github.com/viespirkiu-grupe/tyras/blob/main/src/config.ts): `src/config.ts`
- [Investigation logger](https://github.com/viespirkiu-grupe/tyras/blob/main/src/io/logger.ts): `src/io/logger.ts`
- [Document formatting](https://github.com/viespirkiu-grupe/tyras/blob/main/src/io/format.ts): `src/io/format.ts`

### Case data and research

- [Case workspace](https://github.com/viespirkiu-grupe/tyras/blob/main/src/io/workspace.ts): `src/io/workspace.ts`
- [Theme library and MCP guidance](https://github.com/viespirkiu-grupe/tyras/tree/main/docs/themes): `docs/themes`
- [Agent prompts](https://github.com/viespirkiu-grupe/tyras/tree/main/docs/prompts): `docs/prompts`

### Other components

- **Investigator**
- **Claude CLI**
- **Viešpirkiai MCP**
- **Procurement data**

## Connections

- Investigator → CLI entry point: starts case (evidence: `README.md`)
- CLI entry point → Orchestrator: invokes (evidence: `src/index.ts`)
- Orchestrator → Case workspace: reads and saves case (evidence: `src/orchestrator.ts`)
- Orchestrator → Planning agent: runs planning (evidence: `src/orchestrator.ts`)
- Orchestrator → Theme investigator: dispatches themes (evidence: `src/orchestrator.ts`)
- Orchestrator → Report writer: runs reporting (evidence: `src/orchestrator.ts`)
- Orchestrator → Technical reviewer: runs review (evidence: `src/orchestrator.ts`)
- Planning agent → Agent framework: extends (evidence: `src/agents/planner.ts`)
- Theme investigator → Agent framework: extends (evidence: `src/agents/investigator.ts`)
- Report writer → Agent framework: extends (evidence: `src/agents/reporter.ts`)
- Technical reviewer → Agent framework: extends (evidence: `src/agents/tech-reviewer.ts`)
- Agent framework → Claude session runner: runs session (evidence: `src/agents/base-agent.ts`)
- Claude session runner → Claude CLI: spawns process (evidence: `src/agent-loop.ts`)
- Planning agent → Viešpirkiai MCP: queries entities (evidence: `README.md`)
- Theme investigator → Viešpirkiai MCP: queries by theme (evidence: `README.md`)
- Viešpirkiai MCP → Procurement data: retrieves records (evidence: `README.md`)
- Planning agent → Theme library and MCP guidance: uses theme guidance (evidence: `src/agents/planner.ts`)
- Agent framework → Agent prompts: loads prompt (evidence: `src/agents/base-agent.ts`)
- Planning agent → Case workspace: writes dossier and plan (evidence: `README.md`)
- Theme investigator → Case workspace: writes findings (evidence: `README.md`)
- Report writer → Case workspace: reads findings and writes report (evidence: `src/agents/reporter.ts`)
- Technical reviewer → Case workspace: reads and writes review (evidence: `src/agents/tech-reviewer.ts`)
- Orchestrator → Runtime configuration: uses settings (evidence: `src/orchestrator.ts`)
- Orchestrator → Investigation logger: records progress (evidence: `src/orchestrator.ts`)
- Claude session runner → Investigation logger: logs session (evidence: `src/agent-loop.ts`)
- Orchestrator → Document formatting: formats documents (evidence: `src/orchestrator.ts`)
