# second-charan/second-self architecture

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

- Interactive diagram: https://gitdiagram.com/second-charan/second-self
- Repository: https://github.com/second-charan/second-self

## Overview

SecondSelf turns notes, links, and files into a PARA-organized personal knowledge base, then adds semantic links, a visual graph, and cited conversational answers. The main workflow is capture → classify → link → export graph, with chat as a separate retrieval path over the wiki and embeddings. Source excerpts show the processing stages and dashboard behavior; README statements support the overall workflow and capabilities where implementation details were not sampled.

Main entry points: [`app.py`](https://github.com/second-charan/second-self/blob/main/app.py) (Streamlit dashboard), [`ask.py`](https://github.com/second-charan/second-self/blob/main/ask.py) (RAG question answering), [`classify.py`](https://github.com/second-charan/second-self/blob/main/classify.py) (PARA classifier), [`link.py`](https://github.com/second-charan/second-self/blob/main/link.py) (Semantic linker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_dashboard["Streamlit dashboard<br/>[app.py]"]
  node_visualizer["Interactive graph<br/>[graph.html]"]
  node_ask["RAG question answering<br/>[ask.py]"]
end

subgraph group_ingestion["Capture and organization"]
  node_capture["Capture inputs<br/>[capture.py]"]
  node_raw["Raw captures"]
  node_classify["PARA classifier<br/>[classify.py]"]
  node_wiki["PARA wiki"]
end

subgraph group_knowledge["Semantic knowledge"]
  node_linker["Semantic linker<br/>[link.py]"]
  node_embeddings["Embedding engine<br/>[embeddings.py]"]
  node_embedding_cache[("Embedding cache")]
  node_graph_builder["Graph exporter<br/>[build_graph.py]"]
  node_graph_data["Graph data<br/>[graph.json]"]
end

subgraph group_services["AI services and persistence"]
  node_models["Domain models<br/>[models.py]"]
  node_storage["Filesystem storage<br/>[storage.py]"]
  node_index[("Processing index<br/>[index.json]")]
  node_llm["Groq language model<br/>[llm.py]"]
end

node_user(("User"))
node_groq{{"Groq API"}}

node_user -->|"uses"| node_dashboard
node_user -->|"submits inputs"| node_capture
node_dashboard -->|"launches capture"| node_capture
node_capture -->|"writes captures"| node_raw
node_raw -->|"provides unprocessed items"| node_classify
node_classify -->|"requests classification"| node_llm
node_llm -->|"calls"| node_groq
node_classify -->|"writes classified notes"| node_wiki
node_classify -->|"reads captures, writes notes"| node_storage
node_classify -->|"tracks processed items"| node_index
node_dashboard -->|"runs processing"| node_classify
node_dashboard -->|"runs processing"| node_linker
node_dashboard -->|"runs processing"| node_graph_builder
node_linker -->|"reads and updates links"| node_wiki
node_linker -->|"embeds and compares notes"| node_embeddings
node_linker -->|"loads and saves vectors"| node_embedding_cache
node_graph_builder -->|"reads notes"| node_wiki
node_graph_builder -->|"loads vectors"| node_embedding_cache
node_graph_builder -->|"exports graph"| node_graph_data
node_dashboard -->|"loads graph"| node_graph_data
node_dashboard -->|"embeds graph view"| node_visualizer
node_user -->|"asks questions"| node_ask
node_dashboard -->|"offers chat"| node_ask
node_ask -->|"retrieves notes"| node_wiki
node_ask -->|"searches vectors"| node_embedding_cache
node_ask -->|"embeds query"| node_embeddings
node_ask -->|"synthesizes answer"| node_llm
node_storage -->|"constructs wiki notes"| node_models

click node_dashboard "https://github.com/second-charan/second-self/blob/main/app.py"
click node_capture "https://github.com/second-charan/second-self/blob/main/capture.py"
click node_classify "https://github.com/second-charan/second-self/blob/main/classify.py"
click node_wiki "https://github.com/second-charan/second-self/tree/main/wiki"
click node_linker "https://github.com/second-charan/second-self/blob/main/link.py"
click node_embeddings "https://github.com/second-charan/second-self/blob/main/lib/embeddings.py"
click node_graph_builder "https://github.com/second-charan/second-self/blob/main/build_graph.py"
click node_graph_data "https://github.com/second-charan/second-self/blob/main/data/graph.json"
click node_visualizer "https://github.com/second-charan/second-self/blob/main/static/graph.html"
click node_ask "https://github.com/second-charan/second-self/blob/main/ask.py"
click node_models "https://github.com/second-charan/second-self/blob/main/lib/models.py"
click node_storage "https://github.com/second-charan/second-self/blob/main/lib/storage.py"
click node_index "https://github.com/second-charan/second-self/blob/main/data/index.json"
click node_llm "https://github.com/second-charan/second-self/blob/main/lib/llm.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_dashboard,node_visualizer,node_ask,node_user toneBlue
class node_capture,node_raw,node_classify,node_wiki toneAmber
class node_linker,node_embeddings,node_embedding_cache,node_graph_builder,node_graph_data,node_groq toneMint
class node_models,node_storage,node_index,node_llm toneRose
```

## Components

### User experience

- [Streamlit dashboard](https://github.com/second-charan/second-self/blob/main/app.py): `app.py`
- [Interactive graph](https://github.com/second-charan/second-self/blob/main/static/graph.html): `static/graph.html`
- [RAG question answering](https://github.com/second-charan/second-self/blob/main/ask.py): `ask.py`

### Capture and organization

- [Capture inputs](https://github.com/second-charan/second-self/blob/main/capture.py): `capture.py`
- **Raw captures**
- [PARA classifier](https://github.com/second-charan/second-self/blob/main/classify.py): `classify.py`
- [PARA wiki](https://github.com/second-charan/second-self/tree/main/wiki): `wiki`

### Semantic knowledge

- [Semantic linker](https://github.com/second-charan/second-self/blob/main/link.py): `link.py`
- [Embedding engine](https://github.com/second-charan/second-self/blob/main/lib/embeddings.py): `lib/embeddings.py`
- **Embedding cache**
- [Graph exporter](https://github.com/second-charan/second-self/blob/main/build_graph.py): `build_graph.py`
- [Graph data](https://github.com/second-charan/second-self/blob/main/data/graph.json): `data/graph.json`

### AI services and persistence

- [Domain models](https://github.com/second-charan/second-self/blob/main/lib/models.py): `lib/models.py`
- [Filesystem storage](https://github.com/second-charan/second-self/blob/main/lib/storage.py): `lib/storage.py`
- [Processing index](https://github.com/second-charan/second-self/blob/main/data/index.json): `data/index.json`
- [Groq language model](https://github.com/second-charan/second-self/blob/main/lib/llm.py): `lib/llm.py`

### Other components

- **User**
- **Groq API**

## Connections

- User → Streamlit dashboard: uses (evidence: `README.md`)
- User → Capture inputs: submits inputs (evidence: `README.md`)
- Streamlit dashboard → Capture inputs: launches capture (evidence: `app.py`)
- Capture inputs → Raw captures: writes captures (evidence: `README.md`)
- Raw captures → PARA classifier: provides unprocessed items (evidence: `README.md`)
- PARA classifier → Groq language model: requests classification (evidence: `classify.py`)
- Groq language model → Groq API: calls (evidence: `lib/llm.py`)
- PARA classifier → PARA wiki: writes classified notes (evidence: `classify.py`)
- PARA classifier → Filesystem storage: reads captures, writes notes (evidence: `classify.py`)
- PARA classifier → Processing index: tracks processed items (evidence: `classify.py`)
- Streamlit dashboard → PARA classifier: runs processing (evidence: `README.md`)
- Streamlit dashboard → Semantic linker: runs processing (evidence: `README.md`)
- Streamlit dashboard → Graph exporter: runs processing (evidence: `README.md`)
- Semantic linker → PARA wiki: reads and updates links (evidence: `link.py`)
- Semantic linker → Embedding engine: embeds and compares notes (evidence: `link.py`)
- Semantic linker → Embedding cache: loads and saves vectors
- Graph exporter → PARA wiki: reads notes (evidence: `build_graph.py`)
- Graph exporter → Embedding cache: loads vectors (evidence: `build_graph.py`)
- Graph exporter → Graph data: exports graph (evidence: `README.md`)
- Streamlit dashboard → Graph data: loads graph (evidence: `app.py`)
- Streamlit dashboard → Interactive graph: embeds graph view (evidence: `app.py`)
- User → RAG question answering: asks questions (evidence: `README.md`)
- Streamlit dashboard → RAG question answering: offers chat (evidence: `README.md`)
- RAG question answering → PARA wiki: retrieves notes (evidence: `ask.py`)
- RAG question answering → Embedding cache: searches vectors (evidence: `ask.py`)
- RAG question answering → Embedding engine: embeds query (evidence: `ask.py`)
- RAG question answering → Groq language model: synthesizes answer (evidence: `ask.py`)
- Filesystem storage → Domain models: constructs wiki notes (evidence: `lib/storage.py`)
