A local-first code snippets manager for developers.
Your data stays on your machine as plain Markdown files.
ahaCode is a fork of massCode by Anton Reshetov, licensed under AGPL-3.0.
This repository is maintained as an independent, experimental downstream of massCode. It is not endorsed by or affiliated with the upstream project. All original copyrights remain with their respective authors; modifications in this repository are contributed under the same AGPL-3.0 license.
- The original
LICENSE(AGPL-3.0) is preserved unchanged in this repository. - Upstream attribution is retained in this README, the commit history, and the
CHANGELOG.md. - Any source files that contained original copyright headers are preserved.
- Modifications made in this fork are themselves licensed under AGPL-3.0 — if you run a modified version of this software over a network, you must make the corresponding source code available to users of that service, as required by the AGPL.
- The upstream project's trademarks (if any) are not claimed by this fork. The name "ahaCode" is used to clearly distinguish this fork from the upstream app.
If you want the canonical, actively-maintained upstream, go to massCode.
A focused snippet workspace with multi-level folders, tags, and fragments for organizing reusable code across projects and languages.
- 160+ syntax grammars out of the box (600+ supported via
.tmLanguage) - Integrated Prettier for code formatting
- Real-time HTML & CSS preview
- JSON visualizer for exploring nested structures as interactive graphs
- Export snippets as images with customizable themes
Your snippets live as plain .md files on disk with YAML frontmatter. The data is readable, portable, and yours.
- Git-friendly — track changes and sync via any Git remote
- Cloud sync — works with iCloud, Dropbox, Google Drive, Syncthing
- Live sync — the app watches the vault and picks up external changes in real time
- No vendor lock-in
Customize the app UI and editor syntax highlighting with JSON theme files. Supports light and dark themes with live reload.
ahaCode ships an in-process Model Context Protocol server so AI assistants (Claude Desktop, Cursor, Continue, Zed, etc.) can read from and write to your snippet library directly. Two tools are exposed over JSON-RPC:
ingest_snippet— create a snippet (name, folder, one or more labelled language/value fragments). The new snippet is automatically embedded and added to the RAG index.rag_query— ask "do I have something like X?" and get the top-K most relevant snippets back, ranked by semantic similarity — not just substring match.
The RAG stack is 100% local — no API keys, no data leaves the machine:
- Embeddings:
Xenova/bge-small-en-v1.5runs on-device via@huggingface/transformers. First query warms the model (~30 MB); subsequent queries are ~tens of ms. - Vector store:
sqlite-vec— cosine similarity k-NN over an embedded SQLite database. No external service, no network round-trip. - Live index: every snippet create / update / delete syncs to the RAG index automatically, so what you query is always in sync with what you see.
Practical effect: your coding agent can search your private snippet library the way it searches the web, with zero latency and zero data exposure.
The server listens on http://127.0.0.1:4322/ by default (change it under Preferences → API → MCP port). The app must be running for clients to connect.
Claude Desktop — ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) / %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"ahaCode": {
"url": "http://127.0.0.1:4322/"
}
}
}Cursor — Settings → MCP, or ~/.cursor/mcp.json:
{
"mcpServers": {
"ahaCode": {
"url": "http://127.0.0.1:4322/"
}
}
}Claude Code / Codex CLI — add to your project's .mcp.json or the global config:
{
"mcpServers": {
"ahaCode": {
"type": "http",
"url": "http://127.0.0.1:4322/"
}
}
}Zed — settings.json:
{
"context_servers": {
"ahaCode": {
"source": "custom",
"url": "http://127.0.0.1:4322/"
}
}
}After saving the config, restart the client. You should see the ingest_snippet and rag_query tools become available. Quick sanity-check from a shell:
curl -s http://127.0.0.1:4322/ \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'- Node.js
>= 20.16.0 - pnpm
>= 10.0.0
pnpm installpnpm dev# current platform
pnpm build
# specific platform
pnpm build:mac
pnpm build:win
pnpm build:linuxmacOS: "ahaCode cannot be opened because the developer cannot be verified"
ahaCode builds are ad-hoc signed (no paid Apple Developer ID), so Gatekeeper shows a warning on first launch. Bypass it once with any of:
Right-click → Open (easiest)
- In Finder, right-click (or Control-click)
ahaCode.app - Choose Open
- Click Open in the dialog. After this the app launches normally every time.
System Settings (macOS 13+)
- Try to open the app once (it will be blocked)
- Open System Settings → Privacy & Security
- Scroll to the bottom, find the ahaCode block, click Open Anyway
Terminal
sudo xattr -r -d com.apple.quarantine /Applications/ahaCode.appCopyright (c) 2019–present, Anton Reshetov and contributors to the upstream massCode project.
Copyright (c) 2026, sinksmell and contributors to the ahaCode fork.

