File size: 7,636 Bytes
7584d03
0ad4494
95e1617
7584d03
 
 
 
 
 
5e78c96
7584d03
e6f3c63
95e1617
 
 
 
 
d0c8c11
 
 
c2f81e2
 
 
 
 
7584d03
 
17640d9
 
95e1617
 
 
 
d0c8c11
95e1617
 
e6f3c63
95e1617
 
17640d9
 
 
95e1617
 
 
 
 
17640d9
 
 
 
95e1617
 
 
 
 
17640d9
 
 
 
 
95e1617
 
 
 
17640d9
bfd14ab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7ce13bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bfd14ab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
---
title: Knowme
emoji: πŸ„
colorFrom: red
colorTo: indigo
sdk: gradio
sdk_version: 6.16.0
python_version: '3.13'
app_file: app.py
pinned: true
license: mit
short_description: Stop losing ideas. Capture, connect, recall.
tags:
  - build-small-hackathon
  - backyard-ai
  - tiny-titan
  - nvidia-nemotron
  - off-brand
  - off-the-grid
  - field-notes
  - track:backyard
  - sponsor:nvidia
  - achievement:offgrid
  - achievement:offbrand
  - achievement:fieldnotes
---

# Mycelium β€” Personal Knowledge Agent

> Capture fast. Think later. Let the system surface what matters.

Mycelium is a local-first AI knowledge companion that closes the loop between saving something and actually learning from it. No more screenshot graveyards or forgotten browser tabs.


## The problem

Everyone has the same graveyard: saved links, screenshots, notes-to-self β€” all gone dark in a week. The capture habit exists. The recall loop doesn't.

Mycelium fixes the loop.

## What it does

- **Capture** notes, URLs, and images β€” each processed into a structured summary with intent classification (`learn` / `act` / `reference` / `ephemeral`) and semantic tags
- **ASK** β€” semantic search across your knowledge base with LLM synthesis, follow-up questions, and Feynman self-testing
- **BRIEF** β€” daily digest of what you saved, with synthesis across captures and a weekly thread
- **REVIEW** β€” spaced repetition (SM-2) targeting specific claims from your own notes, not generic flashcards
- **GRAPH** β€” visual map of how your ideas connect via embedding similarity

## How it works

1. You capture a note, URL, or image
2. **NVIDIA Nemotron-Mini-4B** extracts the core insight, classifies intent, generates tags and recall questions
3. **Qwen2.5-VL-7B** handles image captures β€” describe a whiteboard, diagram, or screenshot
4. **BGE-base-en-v1.5** embeds summaries into a 768-dim vector space
5. Related captures link automatically via cosine similarity
6. The surface engine resurfaces what you should revisit, weighted by intent and time

## Tech

- **LLM**: `nvidia/Nemotron-Mini-4B-Instruct` via HF Transformers + ZeroGPU
- **Vision**: `Qwen/Qwen2.5-VL-7B-Instruct` for image capture
- **Embeddings**: `BAAI/bge-base-en-v1.5` (768-dim, top MTEB retrieval)
- **Backend**: FastAPI + SQLite (persistent at `/data/mind.db`)
- **Frontend**: React + TypeScript + Tailwind CSS



##
# Mycelium

**A local-first personal knowledge agent that captures, connects, and surfaces what matters β€” when it matters.**

![Mycelium UI](assets/image.png)

πŸš€ **[Live demo](https://huggingface.co/spaces/build-small-hackathon/mycelium)** Β· πŸ“Ή **[Demo video](https://www.youtube.com/watch?v=Kr7LxRm0JBs)** Β· πŸ““ **[Field Notes](https://huggingface.co/blog/build-small-hackathon/mycelium)**

---

## The Problem

Everyone saves things. Nobody revisits them. Screenshots, bookmarks, notes-to-self β€” all gone dark in a week. The capture habit exists. The recall loop doesn't.

Mycelium fixes the recall loop.

---

## What It Does

- **Capture** β€” notes, links, images. Each processed by a local LLM into a structured summary with intent classification (`learn` / `act` / `reference` / `ephemeral`) and semantic tags.
- **ASK** β€” semantic search across your knowledge base with LLM synthesis, gap analysis, Feynman self-testing, and learning arc.
- **BRIEF** β€” daily digest with synthesis across captures and a weekly thread.
- **REVIEW** β€” spaced repetition (SM-2) targeting specific claims from your own notes.
- **GRAPH** β€” visual map of how your ideas connect via embedding similarity.

---

## Quick Start

### Prerequisites

- Python 3.11+
- Node 18+
- [LM Studio](https://lmstudio.ai) β€” for local LLM inference

### 1. Clone and install

```bash
git clone https://github.com/ajit3259/Mycelium
cd Mycelium
python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -r requirements.txt
```

### 2. Set up LM Studio

1. Download [LM Studio](https://lmstudio.ai)
2. Load a **chat model** β€” recommended: `google/gemma-3-4b-it` or any instruction-tuned model under 8B
3. Load an **embedding model** β€” recommended: `BAAI/bge-base-en-v1.5` (search it in LM Studio's Discover tab, download the GGUF version)
4. Start the Local Server (default: `http://localhost:1234`)


Repace LM with

Set up GGUF Llama Server

1. Start your GGUF chat model server

Example:

llama-server \
  -m model.gguf \
  --host 0.0.0.0 \
  --port 8080

API:
http://localhost:8080/v1

2. (Optional) Start an embedding model server

If embeddings are required, run a BGE embedding GGUF:

llama-server \
  -m bge-base-en-v1.5-q8_0.gguf \
  --embedding \
  --port 8081

Embedding API:
http://localhost:8081/v1

3. Update application settings

Chat API:
http://localhost:8080/v1

Embedding API:
http://localhost:8081/v1

### 3. Initialize the database

```bash
python -c "from db import init_db; init_db()"
```

Optionally seed with 22 example captures to explore the UI:
```bash
python seed.py
```

### 4. Start the backend

```bash
uvicorn main:app --port 8000
```

### 5. Build the frontend

```bash
cd frontend
npm install
npm run build   # outputs to ../static/, served by FastAPI
```

Open [http://localhost:8000](http://localhost:8000).

> **Dev mode (hot reload):** `npm run dev` in the frontend folder β€” runs on port 5173 with proxy to backend.

---

## Configuration

All config is in `config.py` and can be overridden with environment variables:

| Variable | Default | Description |
|---|---|---|
| `LM_STUDIO_URL` | `http://localhost:1234/v1` | LM Studio server URL |
| `LM_MODEL` | auto-detected | Chat model name (leave blank to use whatever is loaded) |
| `EMBED_MODEL` | `BAAI/bge-base-en-v1.5` | Sentence-transformer embedding model |
| `DB_PATH` | `./mind.db` | SQLite database path |
| `UPLOADS_DIR` | `./uploads` | Directory for uploaded images |

---

## How It Works

```
Capture β†’ LLM enrichment β†’ Embed β†’ Connect β†’ Surface β†’ Review
```

1. You capture a note, URL, or image
2. LM Studio extracts summary, tags, intent, claims, and a recall question
3. `BAAI/bge-base-en-v1.5` embeds the summary into a 768-dim vector
4. Related captures link automatically via cosine similarity (rank-based, top 2)
5. Surface engine resurfaces captures by intent + recency scoring
6. SM-2 spaced repetition schedules review of what you should remember

---

## Project Structure

```
.
β”œβ”€β”€ main.py          # FastAPI app β€” all API endpoints
β”œβ”€β”€ lm.py            # Unified LLM interface (LM Studio + HF Transformers)
β”œβ”€β”€ db.py            # SQLite schema + all queries
β”œβ”€β”€ surface.py       # Intent-weighted surfacing + scoring
β”œβ”€β”€ config.py        # Config β€” auto-detects HF Spaces vs local
β”œβ”€β”€ seed.py          # Optional: seed 22 example captures
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ FIELD_NOTES.md   # Build post-mortem
β”œβ”€β”€ frontend/        # React + TypeScript + Vite + Tailwind CSS
β”‚   └── src/
β”‚       β”œβ”€β”€ App.tsx
β”‚       β”œβ”€β”€ api.ts
β”‚       β”œβ”€β”€ types.ts
β”‚       └── components/
β”‚           β”œβ”€β”€ CaptureBar.tsx      # Note / Link / Image capture
β”‚           β”œβ”€β”€ Feed.tsx            # Recent captures
β”‚           β”œβ”€β”€ AskScreen.tsx       # Semantic search + synthesis
β”‚           β”œβ”€β”€ BriefScreen.tsx     # Daily digest
β”‚           β”œβ”€β”€ ReviewScreen.tsx    # Spaced repetition
β”‚           β”œβ”€β”€ GraphView.tsx       # Knowledge graph
β”‚           └── Card.tsx            # Shared capture card
└── static/          # Built frontend (served by FastAPI)
```

---