# rclalithkumar/prism architecture

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

- Interactive diagram: https://gitdiagram.com/rclalithkumar/prism
- Repository: https://github.com/rclalithkumar/prism

## Overview

PRISM is a local AI digital twin: users ask questions in the Streamlit chat, relevant saved memories are retrieved by semantic similarity, and Ollama generates a personalized-context answer. The sidebar also lets users add memories and clear chat. The main app keeps UI, retrieval, embedding, LLM requests, and JSON persistence in one file; `prism_demo.py` is a separate earlier prototype. Relationships reflect the sampled `pp4.py` implementation and README; the prototype’s internal wiring is not fully evidenced.

Main entry points: [`pp4.py`](https://github.com/rclalithkumar/prism/blob/main/pp4.py) (Chat interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Chat application"]
  node_streamlit["Chat interface<br/>[pp4.py]"]
end

subgraph group_memory["Memory and retrieval"]
  node_retrieval["Memory retrieval<br/>[pp4.py]"]
  node_embedding["Text embeddings<br/>[pp4.py]"]
  node_memory_store[("Memory JSON")]
end

subgraph group_local["Local AI services"]
  node_llm["Answer generation<br/>[pp4.py]"]
  node_ollama["Ollama"]
end

subgraph group_prototype["Earlier prototype"]
  node_demo["Pipeline prototype<br/>[prism_demo.py]"]
end

node_user(("User"))

node_user -->|"asks or adds"| node_streamlit
node_streamlit -->|"retrieves memories"| node_retrieval
node_retrieval -->|"embeds query"| node_embedding
node_embedding -->|"requests vectors"| node_ollama
node_retrieval -->|"returns memories"| node_streamlit
node_streamlit -->|"sends prompt"| node_llm
node_llm -->|"requests response"| node_ollama
node_streamlit -->|"loads or saves"| node_memory_store
node_streamlit -->|"embeds new memory"| node_embedding

click node_streamlit "https://github.com/rclalithkumar/prism/blob/main/pp4.py"
click node_retrieval "https://github.com/rclalithkumar/prism/blob/main/pp4.py"
click node_embedding "https://github.com/rclalithkumar/prism/blob/main/pp4.py"
click node_llm "https://github.com/rclalithkumar/prism/blob/main/pp4.py"
click node_demo "https://github.com/rclalithkumar/prism/blob/main/prism_demo.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_streamlit,node_user toneBlue
class node_retrieval,node_embedding,node_memory_store toneAmber
class node_llm,node_ollama toneMint
class node_demo toneRose
```

## Components

### Chat application

- [Chat interface](https://github.com/rclalithkumar/prism/blob/main/pp4.py): `pp4.py`

### Memory and retrieval

- [Memory retrieval](https://github.com/rclalithkumar/prism/blob/main/pp4.py): `pp4.py`
- [Text embeddings](https://github.com/rclalithkumar/prism/blob/main/pp4.py): `pp4.py`
- **Memory JSON**

### Local AI services

- [Answer generation](https://github.com/rclalithkumar/prism/blob/main/pp4.py): `pp4.py`
- **Ollama**

### Earlier prototype

- [Pipeline prototype](https://github.com/rclalithkumar/prism/blob/main/prism_demo.py): `prism_demo.py`

### Other components

- **User**

## Connections

- User → Chat interface: asks or adds (evidence: `README.md`)
- Chat interface → Memory retrieval: retrieves memories (evidence: `pp4.py`)
- Memory retrieval → Text embeddings: embeds query (evidence: `pp4.py`)
- Text embeddings → Ollama: requests vectors (evidence: `pp4.py`)
- Memory retrieval → Chat interface: returns memories (evidence: `pp4.py`)
- Chat interface → Answer generation: sends prompt (evidence: `pp4.py`)
- Answer generation → Ollama: requests response (evidence: `pp4.py`)
- Chat interface → Memory JSON: loads or saves (evidence: `pp4.py`)
- Chat interface → Text embeddings: embeds new memory (evidence: `pp4.py`)
