# smartflame17/cluechain architecture

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

- Interactive diagram: https://gitdiagram.com/smartflame17/cluechain
- Repository: https://github.com/smartflame17/cluechain

## Overview

Four Pyres, One Pardon is a Unity detective game in which the player interrogates suspects, gathers evidence, and deduces the innocent character. The documented flow uses a local LLM to generate shared story context and NPC dialogue, with a separate evaluation role adjusting cooperation. The tree includes the LLMUnity runtime and game assets but no game scripts; game-system nodes therefore point only to the existing Assets directory. Edges reflect README statements, not inspected implementation; the exact internal game-to-plugin calls cannot be verified.

Main entry points: [`Assets`](https://github.com/smartflame17/cluechain/tree/main/Assets) (NPC Dialogue), [`Assets/LLMUnity/Runtime/LLMManager.cs`](https://github.com/smartflame17/cluechain/blob/main/Assets/LLMUnity/Runtime/LLMManager.cs) (LLM Manager), [`Assets/Images/Evidences`](https://github.com/smartflame17/cluechain/tree/main/Assets/Images/Evidences) (Evidence), [`Assets/LLMUnity/Runtime/LLM.cs`](https://github.com/smartflame17/cluechain/blob/main/Assets/LLMUnity/Runtime/LLM.cs) (LLM Inference)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Investigation Gameplay"]
  node_investigation["Interrogation"]
  node_evidence["Evidence"]
  node_deduction["Innocent Deduction"]
end

subgraph group_narrative["AI Narrative"]
  node_story["Story Context"]
  node_npc["NPC Dialogue"]
  node_cooperation["Cooperation Evaluation"]
end

subgraph group_runtime["Local LLM Runtime"]
  node_manager["LLM Manager<br/>[LLMManager.cs]"]
  node_llm["LLM Inference<br/>[LLM.cs]"]
  node_character["LLM Character<br/>[LLMCharacter.cs]"]
  node_templates["Chat Templates"]
end

node_player(("Player"))
node_llamacpp["llama.cpp"]

node_player -->|"questions suspects"| node_investigation
node_investigation -->|"uses evidence"| node_evidence
node_investigation -.->|"requests dialogue"| node_manager
node_manager -->|"generates context"| node_story
node_manager -.->|"runs inference"| node_llm
node_llm -->|"executes locally"| node_llamacpp
node_manager -->|"constructs prompts"| node_npc
node_evidence -->|"informs dialogue"| node_npc
node_story -->|"provides context"| node_npc
node_investigation -->|"evaluates questioning"| node_cooperation
node_cooperation -->|"adjusts responses"| node_npc
node_character -.->|"switches identity"| node_npc
node_npc -.->|"returns dialogue"| node_player
node_player -->|"identifies innocent"| node_deduction
node_templates -.->|"supports formatting"| node_manager

click node_investigation "https://github.com/smartflame17/cluechain/tree/main/Assets"
click node_evidence "https://github.com/smartflame17/cluechain/tree/main/Assets/Images/Evidences"
click node_deduction "https://github.com/smartflame17/cluechain/tree/main/Assets"
click node_story "https://github.com/smartflame17/cluechain/tree/main/Assets"
click node_npc "https://github.com/smartflame17/cluechain/tree/main/Assets"
click node_cooperation "https://github.com/smartflame17/cluechain/tree/main/Assets"
click node_manager "https://github.com/smartflame17/cluechain/blob/main/Assets/LLMUnity/Runtime/LLMManager.cs"
click node_llm "https://github.com/smartflame17/cluechain/blob/main/Assets/LLMUnity/Runtime/LLM.cs"
click node_character "https://github.com/smartflame17/cluechain/blob/main/Assets/LLMUnity/Runtime/LLMCharacter.cs"
click node_templates "https://github.com/smartflame17/cluechain/blob/main/Assets/LLMUnity/Runtime/LLMChatTemplates.cs"

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_investigation,node_evidence,node_deduction toneBlue
class node_story,node_npc,node_cooperation toneAmber
class node_manager,node_llm,node_character,node_templates toneMint
class node_player,node_llamacpp toneIndigo
```

## Components

### Investigation Gameplay

- [Interrogation](https://github.com/smartflame17/cluechain/tree/main/Assets): `Assets`
- [Evidence](https://github.com/smartflame17/cluechain/tree/main/Assets/Images/Evidences): `Assets/Images/Evidences`
- [Innocent Deduction](https://github.com/smartflame17/cluechain/tree/main/Assets): `Assets`

### AI Narrative

- [Story Context](https://github.com/smartflame17/cluechain/tree/main/Assets): `Assets`
- [NPC Dialogue](https://github.com/smartflame17/cluechain/tree/main/Assets): `Assets`
- [Cooperation Evaluation](https://github.com/smartflame17/cluechain/tree/main/Assets): `Assets`

### Local LLM Runtime

- [LLM Manager](https://github.com/smartflame17/cluechain/blob/main/Assets/LLMUnity/Runtime/LLMManager.cs): `Assets/LLMUnity/Runtime/LLMManager.cs`
- [LLM Inference](https://github.com/smartflame17/cluechain/blob/main/Assets/LLMUnity/Runtime/LLM.cs): `Assets/LLMUnity/Runtime/LLM.cs`
- [LLM Character](https://github.com/smartflame17/cluechain/blob/main/Assets/LLMUnity/Runtime/LLMCharacter.cs): `Assets/LLMUnity/Runtime/LLMCharacter.cs`
- [Chat Templates](https://github.com/smartflame17/cluechain/blob/main/Assets/LLMUnity/Runtime/LLMChatTemplates.cs): `Assets/LLMUnity/Runtime/LLMChatTemplates.cs`

### Other components

- **Player**
- **llama.cpp**

## Connections

- Player → Interrogation: questions suspects (evidence: `README.md`)
- Interrogation → Evidence: uses evidence (evidence: `README.md`)
- Interrogation → LLM Manager: requests dialogue
- LLM Manager → Story Context: generates context (evidence: `README.md`)
- LLM Manager → LLM Inference: runs inference
- LLM Inference → llama.cpp: executes locally (evidence: `README.md`)
- LLM Manager → NPC Dialogue: constructs prompts (evidence: `README.md`)
- Evidence → NPC Dialogue: informs dialogue (evidence: `README.md`)
- Story Context → NPC Dialogue: provides context (evidence: `README.md`)
- Interrogation → Cooperation Evaluation: evaluates questioning (evidence: `README.md`)
- Cooperation Evaluation → NPC Dialogue: adjusts responses (evidence: `README.md`)
- LLM Character → NPC Dialogue: switches identity
- NPC Dialogue → Player: returns dialogue
- Player → Innocent Deduction: identifies innocent (evidence: `README.md`)
- Chat Templates → LLM Manager: supports formatting
