Store and retrieve knowledge using semantic search, powered by local embeddings. No external API keys required.
β¨ Features
- π Semantic Search β Find knowledge using vector embeddings (BGE-small-en-v1.5)
- π Text Search β Keyword-based search fallback
- π·οΈ Tag Organization β Categorize entries with tags
- π Plug-and-Play β No external services required (embeddings run 100% locally)
- πΎ Persistent Storage β Data stored in
~/.local/share/opencode-personal-knowledge/ - π Automatic Indexing β Entries are vectorized on creation
π Quick Start
Opencode Integration (Recommended)
Add to ~/.config/opencode/opencode.jsonc:
{
"mcp": {
"personal-knowledge": {
"type": "local",
"command": ["bunx", "opencode-personal-knowledge"],
"enabled": true
}
}
}
Restart Opencode β the MCP tools will be available immediately.
Source Installation (Development)
git clone https://github.com/NocturnLabs/opencode-personal-knowledge.git
cd opencode-personal-knowledge
bun install
bun run mcp # Start MCP server
π οΈ MCP Tools
Knowledge Tools
Session Memory Tools
Log and search across entire OpenCode sessions.
π Example Usage
Storing Knowledge
User: "store a knowledge entry about Opencode Features"
Agent: Researches and stores entry:
β
Stored knowledge entry #2: "Opencode Features"
π Indexed for semantic search
Searching Knowledge
User: "@search_knowledge for opencode"
Agent: Returns semantic matches:
Found 1 similar entry:
### 1. Opencode Features (85% similar)
Opencode is an open source AI coding agent...
Session Memory
User: "Start logging this session, call it 'auth debugging'"
Agent: Starts session and logs all exchanges:
β
Started session #1: "auth debugging"
User: "Search this session for JWT"
Agent: Returns semantic matches from the session:
Found 2 matches in session #1:
### 1. [user] (92% match)
The JWT token expires too fast...
### 2. [agent] (88% match)
The TTL is set to 60 instead of 3600...
βοΈ Configuration
Data Location
By default, data is stored in:
~/.local/share/opencode-personal-knowledge/
βββ knowledge.db # SQLite database
βββ vectors/ # LanceDB vector store
Override with environment variable:
export OPENCODE_PK_DATA_DIR=/custom/path
Embedding Model
Uses BGE-small-en-v1.5 via FastEmbed (auto-downloads on first use).
ποΈ Technology Stack
- Runtime: Bun / Node.js
- Vector DB: LanceDB (embedded)
- Embeddings: FastEmbed (ONNX Runtime)
- MCP SDK: @modelcontextprotocol/sdk
- Database: SQLite (via Bun)
π License
MIT Β© NocturnLabs