# simonbouhier/lyra_reborn architecture

> Architecture diagram of the GitHub repository simonbouhier/lyra_reborn, 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/simonbouhier/lyra_reborn
- Repository: https://github.com/simonbouhier/lyra_reborn

## Overview

Lyra Reborn is a local-LLM cognitive layer combining conversation, control, memory, and knowledge exploration. Its user workflow enters through the local app, runs a session turn through the cognitive loop and language model, and returns a response while updating session state and memory. The app also exposes a separate durable request/journal workflow. ESMM provides a distinct graph-exploration capability, and La Vigie is a separate campaign instrument. Some wiring is omitted because the sampled excerpts do not show those implementations.

Main entry points: [`app/session.py`](https://github.com/simonbouhier/lyra_reborn/blob/main/app/session.py) (Session manager), [`core/loop.py`](https://github.com/simonbouhier/lyra_reborn/blob/main/core/loop.py) (Cognitive loop), [`app/main.py`](https://github.com/simonbouhier/lyra_reborn/blob/main/app/main.py) (HTTP interface), [`explore/esmm/orchestrator.py`](https://github.com/simonbouhier/lyra_reborn/blob/main/explore/esmm/orchestrator.py) (ESMM orchestrator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Local app"]
  node_web["HTTP interface<br/>[main.py]"]
  node_session["Session manager<br/>[session.py]"]
  node_dialogue["Dialogue mode<br/>[dialogue.py]"]
  node_requests["Journal requests<br/>[requests.py]"]
  node_journalui["Journal client<br/>[journal-client.js]"]
  node_sessiondb[("Session persistence<br/>[storage.py]")]
end

subgraph group_cognition["Cognitive loop"]
  node_loop["Cognitive loop<br/>[loop.py]"]
  node_control["Dynamic control<br/>[controller.py]"]
  node_knobs["Generation knobs<br/>[knobs.py]"]
  node_llm["LLM clients<br/>[llm.py]"]
end

subgraph group_memory["Memory and knowledge"]
  node_graph["Knowledge graph<br/>[store.py]"]
  node_ecology["Memory ecology<br/>[ecology.py]"]
  node_cases["Case memory<br/>[memento.py]"]
  node_embeddings["Embeddings<br/>[embeddings.py]"]
end

subgraph group_exploration["Graph exploration"]
  node_esmm["ESMM orchestrator<br/>[orchestrator.py]"]
  node_gaps["Gap detection<br/>[gaps.py]"]
  node_consensus["Proposal consensus<br/>[consensus.py]"]
end

subgraph group_vigie["La Vigie"]
  node_vigiev1["Vigie campaign<br/>[campaign.py]"]
  node_vigiev2["Vigie campaign V2<br/>[campaign_v2.py]"]
end

node_user(("User"))
node_ollama["Local Ollama"]
node_embedollama["Ollama embeddings"]

node_user -->|"sends requests"| node_web
node_web -->|"handles turns"| node_session
node_session -->|"restores dialogue"| node_dialogue
node_session -->|"runs turn"| node_loop
node_loop -->|"updates control"| node_control
node_loop -->|"uses settings"| node_knobs
node_loop -->|"generates text"| node_llm
node_llm -.->|"calls API"| node_ollama
node_session -->|"updates concepts"| node_graph
node_session -->|"triages turn"| node_ecology
node_session -->|"saves state"| node_sessiondb
node_session -->|"loads state"| node_sessiondb
node_embeddings -.->|"requests vectors"| node_embedollama
node_web -->|"dispatches journal"| node_requests
node_journalui -->|"calls API"| node_web
node_esmm -->|"detects gaps"| node_gaps
node_esmm -->|"reads and commits"| node_graph
node_esmm -->|"builds consensus"| node_consensus

click node_web "https://github.com/simonbouhier/lyra_reborn/blob/main/app/main.py"
click node_session "https://github.com/simonbouhier/lyra_reborn/blob/main/app/session.py"
click node_dialogue "https://github.com/simonbouhier/lyra_reborn/blob/main/app/dialogue.py"
click node_requests "https://github.com/simonbouhier/lyra_reborn/blob/main/app/requests.py"
click node_journalui "https://github.com/simonbouhier/lyra_reborn/blob/main/app/static/journal-client.js"
click node_sessiondb "https://github.com/simonbouhier/lyra_reborn/blob/main/app/storage.py"
click node_loop "https://github.com/simonbouhier/lyra_reborn/blob/main/core/loop.py"
click node_control "https://github.com/simonbouhier/lyra_reborn/blob/main/core/control/controller.py"
click node_knobs "https://github.com/simonbouhier/lyra_reborn/blob/main/core/knobs.py"
click node_llm "https://github.com/simonbouhier/lyra_reborn/blob/main/core/llm.py"
click node_graph "https://github.com/simonbouhier/lyra_reborn/blob/main/memory/graph/store.py"
click node_ecology "https://github.com/simonbouhier/lyra_reborn/blob/main/memory/ecology/ecology.py"
click node_cases "https://github.com/simonbouhier/lyra_reborn/blob/main/memory/cbr/memento.py"
click node_embeddings "https://github.com/simonbouhier/lyra_reborn/blob/main/core/embeddings.py"
click node_esmm "https://github.com/simonbouhier/lyra_reborn/blob/main/explore/esmm/orchestrator.py"
click node_gaps "https://github.com/simonbouhier/lyra_reborn/blob/main/explore/esmm/gaps.py"
click node_consensus "https://github.com/simonbouhier/lyra_reborn/blob/main/explore/esmm/consensus.py"
click node_vigiev1 "https://github.com/simonbouhier/lyra_reborn/blob/main/agency/tools/vigie/campaign.py"
click node_vigiev2 "https://github.com/simonbouhier/lyra_reborn/blob/main/agency/tools/vigie/campaign_v2.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_web,node_session,node_dialogue,node_requests,node_journalui,node_sessiondb,node_user toneBlue
class node_loop,node_control,node_knobs,node_llm toneAmber
class node_graph,node_ecology,node_cases,node_embeddings toneMint
class node_esmm,node_gaps,node_consensus toneRose
class node_vigiev1,node_vigiev2,node_ollama,node_embedollama toneIndigo
```

## Components

### Local app

- [HTTP interface](https://github.com/simonbouhier/lyra_reborn/blob/main/app/main.py): `app/main.py`
- [Session manager](https://github.com/simonbouhier/lyra_reborn/blob/main/app/session.py): `app/session.py`
- [Dialogue mode](https://github.com/simonbouhier/lyra_reborn/blob/main/app/dialogue.py): `app/dialogue.py`
- [Journal requests](https://github.com/simonbouhier/lyra_reborn/blob/main/app/requests.py): `app/requests.py`
- [Journal client](https://github.com/simonbouhier/lyra_reborn/blob/main/app/static/journal-client.js): `app/static/journal-client.js`
- [Session persistence](https://github.com/simonbouhier/lyra_reborn/blob/main/app/storage.py): `app/storage.py`

### Cognitive loop

- [Cognitive loop](https://github.com/simonbouhier/lyra_reborn/blob/main/core/loop.py): `core/loop.py`
- [Dynamic control](https://github.com/simonbouhier/lyra_reborn/blob/main/core/control/controller.py): `core/control/controller.py`
- [Generation knobs](https://github.com/simonbouhier/lyra_reborn/blob/main/core/knobs.py): `core/knobs.py`
- [LLM clients](https://github.com/simonbouhier/lyra_reborn/blob/main/core/llm.py): `core/llm.py`

### Memory and knowledge

- [Knowledge graph](https://github.com/simonbouhier/lyra_reborn/blob/main/memory/graph/store.py): `memory/graph/store.py`
- [Memory ecology](https://github.com/simonbouhier/lyra_reborn/blob/main/memory/ecology/ecology.py): `memory/ecology/ecology.py`
- [Case memory](https://github.com/simonbouhier/lyra_reborn/blob/main/memory/cbr/memento.py): `memory/cbr/memento.py`
- [Embeddings](https://github.com/simonbouhier/lyra_reborn/blob/main/core/embeddings.py): `core/embeddings.py`

### Graph exploration

- [ESMM orchestrator](https://github.com/simonbouhier/lyra_reborn/blob/main/explore/esmm/orchestrator.py): `explore/esmm/orchestrator.py`
- [Gap detection](https://github.com/simonbouhier/lyra_reborn/blob/main/explore/esmm/gaps.py): `explore/esmm/gaps.py`
- [Proposal consensus](https://github.com/simonbouhier/lyra_reborn/blob/main/explore/esmm/consensus.py): `explore/esmm/consensus.py`

### La Vigie

- [Vigie campaign](https://github.com/simonbouhier/lyra_reborn/blob/main/agency/tools/vigie/campaign.py): `agency/tools/vigie/campaign.py`
- [Vigie campaign V2](https://github.com/simonbouhier/lyra_reborn/blob/main/agency/tools/vigie/campaign_v2.py): `agency/tools/vigie/campaign_v2.py`

### Other components

- **User**
- **Local Ollama**
- **Ollama embeddings**

## Connections

- User → HTTP interface: sends requests
- HTTP interface → Session manager: handles turns
- Session manager → Dialogue mode: restores dialogue
- Session manager → Cognitive loop: runs turn
- Cognitive loop → Dynamic control: updates control
- Cognitive loop → Generation knobs: uses settings
- Cognitive loop → LLM clients: generates text
- LLM clients → Local Ollama: calls API
- Session manager → Knowledge graph: updates concepts
- Session manager → Memory ecology: triages turn
- Session manager → Session persistence: saves state
- Session manager → Session persistence: loads state
- Embeddings → Ollama embeddings: requests vectors
- HTTP interface → Journal requests: dispatches journal
- Journal client → HTTP interface: calls API
- ESMM orchestrator → Gap detection: detects gaps
- ESMM orchestrator → Knowledge graph: reads and commits
- ESMM orchestrator → Proposal consensus: builds consensus
