# qtrieu0610/tieru-agent architecture

> Architecture diagram of the GitHub repository qtrieu0610/tieru-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/qtrieu0610/tieru-agent
- Repository: https://github.com/qtrieu0610/tieru-agent

## Overview

Tieru is a local-first personal AI runtime. Its main workflow routes a user request through Model Fabric and the conversation loop, where requested actions pass the Trust Kernel before registered tools execute; Replay records bounded run evidence. Distinct product branches provide durable tasks, persistent memory and context, reusable skills and passive suggestions, portable identity, and external messaging. The graph follows documented flows and indexed imports; several subsystem internals were not sampled, so uncertain connections are omitted.

Main entry points: [`tieru/loop/agent.py`](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/loop/agent.py) (Conversation Loop), [`tieru/app.py`](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/app.py) (Runtime Assembly), [`tieru/replay/service.py`](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/replay/service.py) (Replay), [`tieru/fabric/service.py`](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/fabric/service.py) (Model Fabric)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Conversation Runtime"]
  node_app["Runtime Assembly<br/>[app.py]"]
  node_fabric["Model Fabric<br/>[service.py]"]
  node_loop["Conversation Loop<br/>[agent.py]"]
  node_context["Context Firewall<br/>[builder.py]"]
end

subgraph group_governance["Action Governance"]
  node_trust["Trust Kernel<br/>[kernel.py]"]
  node_tools["Tool Registry<br/>[registry.py]"]
  node_capabilities["Capability Router<br/>[router.py]"]
end

subgraph group_state["Memory and Evidence"]
  node_memory[("Personal Memory<br/>[personal.py]")]
  node_memory_graph[("Memory Graph<br/>[service.py]")]
  node_skills["Skill Retrieval<br/>[loader.py]"]
  node_replay[("Replay<br/>[service.py]")]
end

subgraph group_workflows["Durable Workflows"]
  node_tasks["Durable Tasks<br/>[service.py]"]
  node_recovery["Task Recovery<br/>[service.py]"]
  node_forge["Skill Forge<br/>[service.py]"]
  node_shadow["Shadow Suggestions<br/>[service.py]"]
end

subgraph group_extensions["Identity and Channels"]
  node_capsule["Capsule Transfer<br/>[service.py]"]
  node_gateways["Messaging Gateways<br/>[telegram.py]"]
  node_dashboard["Local Dashboard<br/>[dashboard.py]"]
end

node_user(("User"))
node_providers["Model Providers"]
node_local_model["Ollama"]

node_user -->|"sends request"| node_app
node_app -->|"routes request"| node_fabric
node_app -->|"runs conversation"| node_loop
node_fabric -->|"selects model"| node_providers
node_loop -->|"requests authorization"| node_trust
node_trust -->|"authorizes action"| node_tools
node_loop -->|"routes capabilities"| node_capabilities
node_loop -->|"assembles context"| node_context
node_app -->|"records events"| node_replay
node_loop -->|"uses explicit memory"| node_memory
node_loop -->|"uses typed memory"| node_memory_graph
node_loop -->|"retrieves skills"| node_skills
node_user -->|"creates task"| node_tasks
node_tasks -->|"recovers execution"| node_recovery
node_replay -->|"drafts from run"| node_forge
node_replay -->|"observes patterns"| node_shadow
node_shadow -->|"suggests candidate"| node_forge
node_user -->|"exports identity"| node_capsule
node_user -->|"messages through"| node_gateways
node_user -->|"opens dashboard"| node_dashboard
node_providers -.->|"may use local"| node_local_model

click node_app "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/app.py"
click node_fabric "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/fabric/service.py"
click node_loop "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/loop/agent.py"
click node_context "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/context/builder.py"
click node_trust "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/trust/kernel.py"
click node_tools "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/tools/registry.py"
click node_capabilities "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/capabilities/router.py"
click node_memory "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/memory/personal.py"
click node_memory_graph "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/memory/graph/service.py"
click node_skills "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/memory/procedural/loader.py"
click node_replay "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/replay/service.py"
click node_tasks "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/tasks/service.py"
click node_recovery "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/recovery/service.py"
click node_forge "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/forge/service.py"
click node_shadow "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/shadow/service.py"
click node_capsule "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/capsule/service.py"
click node_gateways "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/gateway/telegram.py"
click node_dashboard "https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/ops/dashboard.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_app,node_fabric,node_loop,node_context,node_user toneBlue
class node_trust,node_tools,node_capabilities toneAmber
class node_memory,node_memory_graph,node_skills,node_replay toneMint
class node_tasks,node_recovery,node_forge,node_shadow toneRose
class node_capsule,node_gateways,node_dashboard,node_providers,node_local_model toneIndigo
```

## Components

### Conversation Runtime

- [Runtime Assembly](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/app.py): `tieru/app.py`
- [Model Fabric](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/fabric/service.py): `tieru/fabric/service.py`
- [Conversation Loop](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/loop/agent.py): `tieru/loop/agent.py`
- [Context Firewall](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/context/builder.py): `tieru/context/builder.py`

### Action Governance

- [Trust Kernel](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/trust/kernel.py): `tieru/trust/kernel.py`
- [Tool Registry](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/tools/registry.py): `tieru/tools/registry.py`
- [Capability Router](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/capabilities/router.py): `tieru/capabilities/router.py`

### Memory and Evidence

- [Personal Memory](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/memory/personal.py): `tieru/memory/personal.py`
- [Memory Graph](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/memory/graph/service.py): `tieru/memory/graph/service.py`
- [Skill Retrieval](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/memory/procedural/loader.py): `tieru/memory/procedural/loader.py`
- [Replay](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/replay/service.py): `tieru/replay/service.py`

### Durable Workflows

- [Durable Tasks](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/tasks/service.py): `tieru/tasks/service.py`
- [Task Recovery](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/recovery/service.py): `tieru/recovery/service.py`
- [Skill Forge](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/forge/service.py): `tieru/forge/service.py`
- [Shadow Suggestions](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/shadow/service.py): `tieru/shadow/service.py`

### Identity and Channels

- [Capsule Transfer](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/capsule/service.py): `tieru/capsule/service.py`
- [Messaging Gateways](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/gateway/telegram.py): `tieru/gateway/telegram.py`
- [Local Dashboard](https://github.com/qtrieu0610/tieru-agent/blob/main/tieru/ops/dashboard.py): `tieru/ops/dashboard.py`

### Other components

- **User**
- **Model Providers**
- **Ollama**

## Connections

- User → Runtime Assembly: sends request (evidence: `README.md`)
- Runtime Assembly → Model Fabric: routes request (evidence: `README.md`)
- Runtime Assembly → Conversation Loop: runs conversation (evidence: `tieru/app.py`)
- Model Fabric → Model Providers: selects model (evidence: `README.md`)
- Conversation Loop → Trust Kernel: requests authorization (evidence: `README.md`)
- Trust Kernel → Tool Registry: authorizes action (evidence: `tieru/tools/registry.py`)
- Conversation Loop → Capability Router: routes capabilities (evidence: `tieru/loop/agent.py`)
- Conversation Loop → Context Firewall: assembles context (evidence: `tieru/loop/agent.py`)
- Runtime Assembly → Replay: records events (evidence: `tieru/app.py`)
- Conversation Loop → Personal Memory: uses explicit memory (evidence: `README.md`)
- Conversation Loop → Memory Graph: uses typed memory (evidence: `README.md`)
- Conversation Loop → Skill Retrieval: retrieves skills (evidence: `README.md`)
- User → Durable Tasks: creates task (evidence: `README.md`)
- Durable Tasks → Task Recovery: recovers execution (evidence: `tieru/tasks/service.py`)
- Replay → Skill Forge: drafts from run (evidence: `README.md`)
- Replay → Shadow Suggestions: observes patterns (evidence: `tieru/shadow/service.py`)
- Shadow Suggestions → Skill Forge: suggests candidate (evidence: `tieru/shadow/service.py`)
- User → Capsule Transfer: exports identity (evidence: `README.md`)
- User → Messaging Gateways: messages through (evidence: `README.md`)
- User → Local Dashboard: opens dashboard (evidence: `README.md`)
- Model Providers → Ollama: may use local (evidence: `README.md`)
