# biditdas18/asterism architecture

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

- Interactive diagram: https://gitdiagram.com/biditdas18/asterism
- Repository: https://github.com/biditdas18/asterism

## Overview

Asterism is a local-first personal knowledge graph with a Streamlit chat interface, CLI, and constellation visualization. In the main workflow, a person chats with the app; the assistant can inject weighted graph context, call an LLM, extract triples, and update the local graph. Conversation exports can also be crawled into the graph, whose weights and contents evolve through traversal and decay. The repository additionally contains a substantial evaluation campaign. Some runtime wiring is inferred only from README statements or SOURCE INDEX references; those limits are reflected by omitted or dashed edges.

Main entry points: [`llm.py`](https://github.com/biditdas18/asterism/blob/main/llm.py) (Assistant), [`db.py`](https://github.com/biditdas18/asterism/blob/main/db.py) (SQLite graph), [`app.py`](https://github.com/biditdas18/asterism/blob/main/app.py) (Chat app), [`research/poc_compare.py`](https://github.com/biditdas18/asterism/blob/main/research/poc_compare.py) (Initial PoC)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_streamlit_app["Chat app<br/>[app.py]"]
  node_cli["CLI<br/>[cli.py]"]
  node_renderer["Constellation renderer<br/>[render.py]"]
end

subgraph group_graph_runtime["Graph runtime"]
  node_assistant["Assistant<br/>[llm.py]"]
  node_extractor["Triple extractor<br/>[extractor.py]"]
  node_graph_view["Graph queries<br/>[graph.py]"]
  node_decay["Decay scheduler<br/>[decay_scheduler.py]"]
  node_crawler["Export crawler<br/>[crawler.py]"]
end

subgraph group_local_data["Local data"]
  node_config["Configuration<br/>[config.py]"]
  node_storage[("SQLite graph<br/>[db.py]")]
end

subgraph group_evaluation["Evaluation research"]
  node_latency_benchmark["Latency benchmark"]
  node_poc_eval["Initial PoC<br/>[poc_compare.py]"]
  node_poc_eval_v2["PoC v2<br/>[poc_compare_v2.py]"]
  node_seed_graph_2["Graph two seed<br/>[seed_graph_2.py]"]
  node_campaign["N=100 campaign<br/>[n100_campaign.py]"]
  node_query_gen["Query generation"]
  node_correctness_1["Graph one analysis"]
  node_correctness_2["Graph two analysis"]
  node_followup["Follow-up intervals<br/>[followup_ci.py]"]
  node_tables["Paper tables"]
  node_analysis_100["N=100 analysis<br/>[n100_analysis.py]"]
  node_tables_100["N=100 tables<br/>[n100_tables.py]"]
end

node_person(("Person"))
node_llm_service["LLM provider"]

node_person -->|"chats with"| node_streamlit_app
node_person -->|"runs commands"| node_cli
node_streamlit_app -->|"requests response"| node_assistant
node_assistant -->|"calls model"| node_llm_service
node_assistant -->|"extracts triples"| node_extractor
node_assistant -->|"reads and updates"| node_storage
node_assistant -->|"loads context"| node_graph_view
node_streamlit_app -->|"edits graph"| node_storage
node_streamlit_app -->|"summarizes graph"| node_graph_view
node_streamlit_app -->|"renders constellation"| node_renderer
node_renderer -->|"gets graph summary"| node_graph_view
node_cli -->|"starts ingestion"| node_crawler
node_crawler -->|"writes extracted graph"| node_storage
node_crawler -->|"opens visualization"| node_renderer
node_decay -->|"decays graph"| node_storage
node_graph_view -->|"reads and strengthens"| node_storage
node_config -->|"selects database"| node_storage
node_assistant -->|"loads settings"| node_config
node_streamlit_app -->|"checks setup"| node_config
node_latency_benchmark -->|"benchmarks calls"| node_assistant
node_latency_benchmark -->|"uses isolated graph"| node_storage
node_poc_eval -->|"compares injection"| node_assistant
node_poc_eval -->|"seeds graph"| node_storage
node_poc_eval_v2 -->|"reuses evaluation"| node_poc_eval
node_poc_eval_v2 -->|"compares injection"| node_assistant
node_seed_graph_2 -->|"seeds graph"| node_storage
node_campaign -->|"runs model cells"| node_assistant
node_campaign -->|"uses scorer"| node_poc_eval_v2
node_campaign -->|"uses graph seed"| node_seed_graph_2
node_campaign -->|"seeds evaluation DB"| node_storage
node_query_gen -->|"uses query material"| node_poc_eval
node_query_gen -->|"uses graph seed"| node_seed_graph_2
node_correctness_1 -->|"reads evaluation"| node_poc_eval
node_correctness_1 -->|"reads evaluation"| node_poc_eval_v2
node_correctness_2 -->|"uses graph labels"| node_seed_graph_2
node_correctness_2 -->|"reads evaluation"| node_poc_eval_v2
node_followup -->|"aggregates results"| node_correctness_1
node_followup -->|"aggregates results"| node_correctness_2
node_tables -->|"formats intervals"| node_followup
node_analysis_100 -->|"analyzes results"| node_correctness_1
node_analysis_100 -->|"analyzes results"| node_correctness_2
node_tables_100 -->|"uses analysis"| node_correctness_1
node_tables_100 -->|"uses analysis"| node_correctness_2

click node_streamlit_app "https://github.com/biditdas18/asterism/blob/main/app.py"
click node_cli "https://github.com/biditdas18/asterism/blob/main/cli.py"
click node_assistant "https://github.com/biditdas18/asterism/blob/main/llm.py"
click node_extractor "https://github.com/biditdas18/asterism/blob/main/extractor.py"
click node_graph_view "https://github.com/biditdas18/asterism/blob/main/graph.py"
click node_decay "https://github.com/biditdas18/asterism/blob/main/decay_scheduler.py"
click node_renderer "https://github.com/biditdas18/asterism/blob/main/render.py"
click node_crawler "https://github.com/biditdas18/asterism/blob/main/crawler.py"
click node_config "https://github.com/biditdas18/asterism/blob/main/config.py"
click node_storage "https://github.com/biditdas18/asterism/blob/main/db.py"
click node_latency_benchmark "https://github.com/biditdas18/asterism/blob/main/research/benchmark_latency.py"
click node_poc_eval "https://github.com/biditdas18/asterism/blob/main/research/poc_compare.py"
click node_poc_eval_v2 "https://github.com/biditdas18/asterism/blob/main/research/poc_compare_v2.py"
click node_seed_graph_2 "https://github.com/biditdas18/asterism/blob/main/research/seed_graph_2.py"
click node_campaign "https://github.com/biditdas18/asterism/blob/main/research/n100_campaign.py"
click node_query_gen "https://github.com/biditdas18/asterism/blob/main/research/generate_queries_n100.py"
click node_correctness_1 "https://github.com/biditdas18/asterism/blob/main/research/correctness_analysis.py"
click node_correctness_2 "https://github.com/biditdas18/asterism/blob/main/research/correctness_analysis_graph2.py"
click node_followup "https://github.com/biditdas18/asterism/blob/main/research/followup_ci.py"
click node_tables "https://github.com/biditdas18/asterism/blob/main/research/make_paper_tables.py"
click node_analysis_100 "https://github.com/biditdas18/asterism/blob/main/research/n100_analysis.py"
click node_tables_100 "https://github.com/biditdas18/asterism/blob/main/research/n100_tables.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_app,node_cli,node_renderer toneBlue
class node_assistant,node_extractor,node_graph_view,node_decay,node_crawler toneAmber
class node_config,node_storage toneMint
class node_latency_benchmark,node_poc_eval,node_poc_eval_v2,node_seed_graph_2,node_campaign,node_query_gen,node_correctness_1,node_correctness_2,node_followup,node_tables,node_analysis_100,node_tables_100 toneRose
class node_person,node_llm_service toneIndigo
```

## Components

### User interfaces

- [Chat app](https://github.com/biditdas18/asterism/blob/main/app.py): `app.py`
- [CLI](https://github.com/biditdas18/asterism/blob/main/cli.py): `cli.py`
- [Constellation renderer](https://github.com/biditdas18/asterism/blob/main/render.py): `render.py`

### Graph runtime

- [Assistant](https://github.com/biditdas18/asterism/blob/main/llm.py): `llm.py`
- [Triple extractor](https://github.com/biditdas18/asterism/blob/main/extractor.py): `extractor.py`
- [Graph queries](https://github.com/biditdas18/asterism/blob/main/graph.py): `graph.py`
- [Decay scheduler](https://github.com/biditdas18/asterism/blob/main/decay_scheduler.py): `decay_scheduler.py`
- [Export crawler](https://github.com/biditdas18/asterism/blob/main/crawler.py): `crawler.py`

### Local data

- [Configuration](https://github.com/biditdas18/asterism/blob/main/config.py): `config.py`
- [SQLite graph](https://github.com/biditdas18/asterism/blob/main/db.py): `db.py`

### Evaluation research

- [Latency benchmark](https://github.com/biditdas18/asterism/blob/main/research/benchmark_latency.py): `research/benchmark_latency.py`
- [Initial PoC](https://github.com/biditdas18/asterism/blob/main/research/poc_compare.py): `research/poc_compare.py`
- [PoC v2](https://github.com/biditdas18/asterism/blob/main/research/poc_compare_v2.py): `research/poc_compare_v2.py`
- [Graph two seed](https://github.com/biditdas18/asterism/blob/main/research/seed_graph_2.py): `research/seed_graph_2.py`
- [N=100 campaign](https://github.com/biditdas18/asterism/blob/main/research/n100_campaign.py): `research/n100_campaign.py`
- [Query generation](https://github.com/biditdas18/asterism/blob/main/research/generate_queries_n100.py): `research/generate_queries_n100.py`
- [Graph one analysis](https://github.com/biditdas18/asterism/blob/main/research/correctness_analysis.py): `research/correctness_analysis.py`
- [Graph two analysis](https://github.com/biditdas18/asterism/blob/main/research/correctness_analysis_graph2.py): `research/correctness_analysis_graph2.py`
- [Follow-up intervals](https://github.com/biditdas18/asterism/blob/main/research/followup_ci.py): `research/followup_ci.py`
- [Paper tables](https://github.com/biditdas18/asterism/blob/main/research/make_paper_tables.py): `research/make_paper_tables.py`
- [N=100 analysis](https://github.com/biditdas18/asterism/blob/main/research/n100_analysis.py): `research/n100_analysis.py`
- [N=100 tables](https://github.com/biditdas18/asterism/blob/main/research/n100_tables.py): `research/n100_tables.py`

### Other components

- **Person**
- **LLM provider**

## Connections

- Person → Chat app: chats with (evidence: `README.md`)
- Person → CLI: runs commands (evidence: `README.md`)
- Chat app → Assistant: requests response (evidence: `app.py`)
- Assistant → LLM provider: calls model (evidence: `README.md`)
- Assistant → Triple extractor: extracts triples (evidence: `llm.py`)
- Assistant → SQLite graph: reads and updates (evidence: `llm.py`)
- Assistant → Graph queries: loads context (evidence: `llm.py`)
- Chat app → SQLite graph: edits graph (evidence: `app.py`)
- Chat app → Graph queries: summarizes graph (evidence: `app.py`)
- Chat app → Constellation renderer: renders constellation (evidence: `app.py`)
- Constellation renderer → Graph queries: gets graph summary (evidence: `render.py`)
- CLI → Export crawler: starts ingestion (evidence: `README.md`)
- Export crawler → SQLite graph: writes extracted graph (evidence: `crawler.py`)
- Export crawler → Constellation renderer: opens visualization (evidence: `crawler.py`)
- Decay scheduler → SQLite graph: decays graph (evidence: `decay_scheduler.py`)
- Graph queries → SQLite graph: reads and strengthens (evidence: `graph.py`)
- Configuration → SQLite graph: selects database (evidence: `config.py`)
- Assistant → Configuration: loads settings (evidence: `llm.py`)
- Chat app → Configuration: checks setup (evidence: `app.py`)
- Latency benchmark → Assistant: benchmarks calls (evidence: `research/benchmark_latency.py`)
- Latency benchmark → SQLite graph: uses isolated graph (evidence: `research/benchmark_latency.py`)
- Initial PoC → Assistant: compares injection (evidence: `research/poc_compare.py`)
- Initial PoC → SQLite graph: seeds graph (evidence: `research/poc_compare.py`)
- PoC v2 → Initial PoC: reuses evaluation (evidence: `research/poc_compare_v2.py`)
- PoC v2 → Assistant: compares injection (evidence: `research/poc_compare_v2.py`)
- Graph two seed → SQLite graph: seeds graph (evidence: `research/seed_graph_2.py`)
- N=100 campaign → Assistant: runs model cells (evidence: `research/n100_campaign.py`)
- N=100 campaign → PoC v2: uses scorer (evidence: `research/n100_campaign.py`)
- N=100 campaign → Graph two seed: uses graph seed (evidence: `research/n100_campaign.py`)
- N=100 campaign → SQLite graph: seeds evaluation DB (evidence: `research/n100_campaign.py`)
- Query generation → Initial PoC: uses query material (evidence: `research/generate_queries_n100.py`)
- Query generation → Graph two seed: uses graph seed (evidence: `research/generate_queries_n100.py`)
- Graph one analysis → Initial PoC: reads evaluation (evidence: `research/correctness_analysis.py`)
- Graph one analysis → PoC v2: reads evaluation (evidence: `research/correctness_analysis.py`)
- Graph two analysis → Graph two seed: uses graph labels (evidence: `research/correctness_analysis_graph2.py`)
- Graph two analysis → PoC v2: reads evaluation (evidence: `research/correctness_analysis_graph2.py`)
- Follow-up intervals → Graph one analysis: aggregates results (evidence: `research/followup_ci.py`)
- Follow-up intervals → Graph two analysis: aggregates results (evidence: `research/followup_ci.py`)
- Paper tables → Follow-up intervals: formats intervals (evidence: `research/make_paper_tables.py`)
- N=100 analysis → Graph one analysis: analyzes results (evidence: `research/n100_analysis.py`)
- N=100 analysis → Graph two analysis: analyzes results (evidence: `research/n100_analysis.py`)
- N=100 tables → Graph one analysis: uses analysis (evidence: `research/n100_tables.py`)
- N=100 tables → Graph two analysis: uses analysis (evidence: `research/n100_tables.py`)
