A modular, offline-first RAG system for local notes powered by Ollama. Chat with your notes using AI - everything runs locally.
- Vault-based Storage: Store notes as
.mdfiles in thevault/folder - Rich Text Editor: TipTap-powered editor with formatting toolbar
- Auto-Indexing: Automatic re-indexing when files change (chokidar)
- RAG Pipeline: Keyword retrieval + Ollama AI generation
- Modular Architecture: Clean separation for easy extension
- Local-first: No external APIs - runs entirely on your machine
Smart notes/
├── index.js # Main entry point
├── package.json # Dependencies
├── build-editor.js # TipTap bundle builder
├── db.json # Indexed chunks (auto-generated)
├── src/
│ ├── storage/ # Vault operations (CRUD)
│ ├── indexing/ # Note chunking (150-200 words)
│ ├── retrieval/ # Keyword-based retrieval
│ ├── ai/ # Ollama integration
│ ├── watcher/ # File system watcher (chokidar)
│ └── server/ # Express API server
├── public/
│ ├── index.html # Web interface
│ └── vendor/
│ └── editor.js # Bundled TipTap editor
└── vault/ # Your notes (.md files)
npm installnpm run build-editorOr: node build-editor.js
ollama servenpm startNavigate to: http://localhost:3000
- Click + New Note in the Notes panel
- Enter a filename (e.g.,
my-notes.md) - Use the toolbar to format text (Bold, Italic, Headings, Lists, etc.)
- Click Save
- Type your question in the chat input
- Press Enter or click Send
- The AI answers based on your notes
- Sources are shown below the answer
- Click Edit on any note to modify it
- Click Del to delete a note
- Auto-indexing updates the search index automatically
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/ask |
Ask a question about your notes |
| GET | /api/health |
Server status and health check |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/notes |
List all notes |
| GET | /api/notes/:filename |
Read a specific note |
| POST | /api/notes |
Create a new note |
| PUT | /api/notes/:filename |
Update a note |
| DELETE | /api/notes/:filename |
Delete a note |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/sources |
List all note sources |
| GET | /api/chunks |
View all indexed chunks |
| POST | /api/reindex |
Manually trigger re-indexing |
┌─────────────────────────────────────────────────────────────┐
│ User Query │
│ "What is Node.js?" │
└─────────────────────────────┬───────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ RETRIEVAL LAYER │
│ 1. Tokenize query into keywords │
│ 2. Score each chunk by keyword overlap │
│ 3. Return top-3 most relevant chunks │
└─────────────────────────────┬───────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ AI LAYER (Ollama) │
│ Build prompt with retrieved context │
│ Send to qwen2.5-coder:1.5b model │
│ Return generated answer │
└─────────────────────────────┬───────────────────────────────┘
│
▼
Answer + Sources
- Purpose: CRUD operations for vault files
- Methods:
listNotes(),readNote(),writeNote(),deleteNote() - Location:
vault/directory
- Purpose: Split notes into searchable chunks
- Config: 150-200 words per chunk
- Output: Stored in
db.json
- Purpose: Find relevant chunks for queries
- Method: Keyword overlap scoring
- Output: Top-3 matching chunks
- Purpose: Generate responses using Ollama
- Model: qwen2.5-coder:1.5b
- Config: Temperature=0.3, top_p=0.9
- Purpose: Monitor vault for changes
- Library: chokidar
- Trigger: Auto re-indexing on add/change/delete
- Purpose: Express REST API
- Endpoints: All API routes defined here
- Purpose: TipTap rich text editor
- Build: Bundled with esbuild to
public/vendor/editor.js
The TipTap editor supports:
- Bold, Italic,
Strikethrough - Headings (H1, H2, H3)
- Bullet Lists & Numbered Lists
- Blockquotes
- Inline Code & Code Blocks
- Undo/Redo
This modular structure makes it easy to add:
- Vector Search: Replace keyword retrieval with embeddings
- FAISS Integration: Add similarity search at scale
- Multiple Models: Support for different Ollama models
- Better Chunking: Overlapping chunks, semantic splitting
- Caching: Cache frequent queries
- Sync: Cloud sync for vault files
Ollama not running:
ollama servePort already in use:
# Find and kill the process on port 3000
netstat -ano | findstr :3000
taskkill /PID <pid> /FNo notes found:
- Add
.mdor.txtfiles to thevault/directory - Call
POST /api/reindexto trigger indexing
MIT