Local cross-project knowledge and research library for LLM workflows
Project description
OpenLMlib
Local knowledge and research library for LLM workflows
Store, retrieve, and collaborate on findings with semantic search, full-text search, and multi-agent collaboration sessions.
๐ Full Documentation ยท Quickstart ยท MCP Tools ยท CollabSessions
Features
- Knowledge Base: SQLite metadata + JSON findings + FAISS/Numpy vector index
- Semantic Retrieval: Multi-phase retrieval with semantic + lexical search, deduplication, and reranking
- MCP Server: 58 tools for AI assistants (17 core + 10 memory + 31 collaboration)
- CollabSessions: Multi-agent collaboration with message passing, artifacts, and templates
- CLI: Full command-line interface for management and diagnostics
- Portable: Findings exportable as JSON, easy backup and restore
Quickstart
Installation
npm install -g openlmlib
openlmlib setup # Interactive wizard with React TUI
Other options:
pipx (Python only)
pipx install openlmlib
openlmlib setup
From Source
git clone https://github.com/Vedant9500/LMlib.git
cd LMlib
pip install -e .
openlmlib setup
Note: The embedding model (~100-500MB) downloads during
setup, not installation.
First Steps
# Check health
openlmlib doctor
# Add a finding
openlmlib add \
--project myproj \
--claim "Contextual chunking improves retrieval by 15-30%" \
--confidence 0.85 \
--evidence "https://arxiv.org/example" \
--reasoning "Benchmarks show context-aware chunking outperforms fixed-size"
# Search
openlmlib query "retrieval techniques" --final-k 5
# List findings
openlmlib list --limit 20
Configure AI Assistants
# Interactive setup (recommended)
openlmlib setup
# Or configure specific IDEs
openlmlib mcp-config --ide vscode --ide cursor
Supported clients: VS Code, Cursor, Claude Desktop, Claude Code, Gemini CLI, Aider, Windsurf, Zed, Cline, and more.
What Can You Do?
๐ Build a Knowledge Base
Store findings from research, experiments, or analysis with structured metadata:
openlmlib add \
--project retrieval \
--claim "Dynamic chunk sizing reduces hallucination by 20%" \
--confidence 0.78 \
--evidence "https://example.com/study" \
--reasoning "Adaptive chunk size based on query complexity..." \
--caveats "Requires query complexity estimation" \
--tags retrieval,chunking,evaluation
๐ Retrieve with Context
Multi-phase retrieval combines semantic similarity, lexical matching, and recency:
# Semantic search with reasoning traces
openlmlib query "contextual retrieval" \
--final-k 5 \
--reasoning-trace
# With filters
openlmlib query "retrieval" \
--project myproj \
--tags retrieval \
--confidence-min 0.8
๐ค Use with AI Assistants
58 MCP tools let AI assistants securely access and modify your knowledge base:
Core Tools (17):
init_library,health- Setup and diagnosticssave_finding,delete_finding- Write operations (require confirmation)retrieve_findings,search_findings,search_knowledge- Retrieval and searchlist_findings,get_finding- Browse findingsretrieve_context- Format findings for LLM promptsstart_research,end_session- Composite workflow toolscheck_context,save_finding_auto- Convenience toolsevaluate_retrieval,get_usage_analytics,help_library- Utilities
๐ See all 58 tools โ
๐ฅ Multi-Agent Collaboration
CollabSessions enable structured collaboration between multiple LLM agents:
# Create session from template
openlmlib-mcp --call create_from_template '{
"template_id": "deep_research",
"title": "Research on Retrieval",
"created_by": "gpt-4"
}'
# Join session
openlmlib-mcp --call join_session '{
"session_id": "sess_20260409_abc12345",
"model": "claude-3",
"role": "worker"
}'
# Send and receive messages
openlmlib-mcp --call send_message '{...}'
openlmlib-mcp --call poll_messages '{...}'
# Add artifacts (reports, analysis)
openlmlib-mcp --call save_artifact '{...}'
Available Templates:
deep_research- Comprehensive research (5 steps, 5 agents)code_review- Multi-agent code review (5 steps, 4 agents)market_analysis- Market/competitor analysis (4 steps, 4 agents)incident_investigation- Root cause analysis (4 steps, 3 agents)literature_review- Academic literature review (6 steps, 5 agents)
๐ Full CollabSessions guide โ
๐ง Memory System (Session Persistence & Retrieval)
OpenLMlib includes a powerful memory system that persists session knowledge across work sessions, enabling AI assistants to "remember" what happened in previous sessions and continue work seamlessly.
Key Features:
- Session Lifecycle: Start/end sessions with automatic context injection and summarization
- Progressive Retrieval: 3-layer disclosure (search index โ timeline โ full details) for token efficiency
- Retroactive Ingestion: Auto-ingest session activity from git history โ no manual logging needed!
- Caveman Compression: Ultra-compressed context injection (46% token savings)
Memory Tools (10 tools):
session_start - Start session with context from previous sessions
session_end - End session and auto-generate summary
log_observation - Log tool executions for memory building
search_memory - Layer 1: Search index (~75 tokens/result)
memory_timeline - Layer 2: Chronological context (~200 tokens/result)
get_observations - Layer 3: Full details (~750 tokens/result)
inject_context - Auto-inject relevant context at session start
session_recap - Synthesized recap of recent sessions (~150-250 tokens)
topic_context - Deep dive on specific topics (~500-800 tokens)
ingest_git_history - Auto-ingest from git history (no manual logging!)
Example Workflow:
# Start of session - automatically loads relevant context
session_start(
session_id="sess_20260414_001",
query="memory retrieval optimization"
)
# Returns: Context from previous sessions with relevant observations
# During work - observations are logged automatically
log_observation(
session_id="sess_20260414_001",
tool_name="Edit",
tool_input="Modified memory_retriever.py",
tool_output="Added auto_inject_context method"
)
# End of session - auto-generates summary
session_end(session_id="sess_20260414_001")
# Creates synthesized knowledge: files touched, decisions, next steps
# Next session - continue seamlessly
session_recap(limit=3)
# Returns: Structured knowledge from last 3 sessions
Token Efficiency:
- Layer 1 only: 75 tokens/result (search index for filtering)
- Layer 1+2: 275 tokens/result (timeline context)
- Layer 1+2+3: 1,025 tokens/result (full details only for relevant items)
- vs. full dump: 3-13x token savings!
Architecture
OpenLMlib
โโโ Knowledge Base
โ โโโ SQLite (metadata, full-text search)
โ โโโ FAISS/Numpy (vector index)
โ โโโ JSON findings (portable, human-readable)
โ
โโโ MCP Server (58 tools)
โ โโโ 17 core library tools
โ โโโ 10 memory tools (session lifecycle, progressive retrieval, retroactive ingestion)
โ โโโ 31 collaboration tools
โ
โโโ CLI
โ โโโ Setup and configuration
โ โโโ Finding management
โ โโโ Diagnostics (doctor command)
โ
โโโ CollabSessions
โโโ Message bus (SQLite + JSONL)
โโโ Artifact store
โโโ Session templates
โโโ Context compaction
Documentation
๐ Complete documentation is in the docs/ folder:
- docs/README.md - Documentation index and quick reference
- docs/MCP_TOOLS.md - Complete reference for all 58 MCP tools
- docs/COLLAB_SESSIONS.md - Multi-agent collaboration guide
- docs/SYSTEM_PROMPT.md - Agent instruction templates
CLI Reference
# Setup and diagnostics
openlmlib setup # First-run bootstrap
openlmlib doctor # Health check
openlmlib --version # Show version
# Knowledge base
openlmlib init # Initialize storage
openlmlib add # Add finding
openlmlib list # List findings
openlmlib get # Get finding details
openlmlib query # Semantic retrieval
openlmlib delete # Delete finding
# Collaboration
openlmlib-mcp # MCP server (auto-configured)
# Backup and restore
openlmlib backup # Create backup
openlmlib restore # Restore from backup
Configuration
Global Install
- Settings:
~/.openlmlib/config/settings.json - Data:
~/.openlmlib/data/
Local/Dev Install
- Pass
--settings /path/to/settings.json
Uninstallation
# Remove package
npm uninstall -g openlmlib # if installed via npm
pipx uninstall openlmlib # if installed via pipx
pip uninstall openlmlib # if installed from source
# Remove data (optional)
rm -rf ~/.openlmlib # global install data
rm -rf data/ # local install data
Development
git clone https://github.com/Vedant9500/LMlib.git
cd LMlib
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev,faiss]"
# Run tests
python -m pytest tests/ -v
# Run MCP server manually
python -m openlmlib.mcp_server --settings ./config/settings.json
Notes
- Vector Search: Uses FAISS if installed, otherwise Numpy fallback
- Embedding Model:
sentence-transformers/all-MiniLM-L6-v2(default) - Python: Requires 3.10+
- Global vs Local: Global installs use
~/.openlmlib/, local uses projectdata/
Releases
- Versioning: Semantic versioning (MAJOR.MINOR.PATCH)
- Changelog: CHANGELOG.md
- Release process: RELEASE.md
Contributing
See CONTRIBUTING.md for development workflow and guidelines.
License
MIT License - see LICENSE
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openlmlib-0.2.6.tar.gz.
File metadata
- Download URL: openlmlib-0.2.6.tar.gz
- Upload date:
- Size: 204.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16ed379a5bc36525e94f315ab7802e2801b1b2d7f7211997d7d343bb75aaea3a
|
|
| MD5 |
594d001e89e0e20f375aba1430e715c8
|
|
| BLAKE2b-256 |
569df92b44869c1f7d4465a892dc129d422532ead87037b69cbe5082f8e61df4
|
Provenance
The following attestation bundles were made for openlmlib-0.2.6.tar.gz:
Publisher:
release.yml on Vedant9500/OpenLMlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openlmlib-0.2.6.tar.gz -
Subject digest:
16ed379a5bc36525e94f315ab7802e2801b1b2d7f7211997d7d343bb75aaea3a - Sigstore transparency entry: 1563505115
- Sigstore integration time:
-
Permalink:
Vedant9500/OpenLMlib@ac995cd78a721fad8adffab941d50373cca97429 -
Branch / Tag:
refs/tags/v0.2.6 - Owner: https://github.com/Vedant9500
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ac995cd78a721fad8adffab941d50373cca97429 -
Trigger Event:
push
-
Statement type:
File details
Details for the file openlmlib-0.2.6-py3-none-any.whl.
File metadata
- Download URL: openlmlib-0.2.6-py3-none-any.whl
- Upload date:
- Size: 194.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3636a5d53488e8e540edf6de13f8dfe52eebb4c482df7d62682f5688f485a099
|
|
| MD5 |
dd4c923552e4a645f925355334b3c0d9
|
|
| BLAKE2b-256 |
debdad4747a3482d376d85c8f74369fc63c12dd2a89c7c07e5e19e3dbd1d48b2
|
Provenance
The following attestation bundles were made for openlmlib-0.2.6-py3-none-any.whl:
Publisher:
release.yml on Vedant9500/OpenLMlib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openlmlib-0.2.6-py3-none-any.whl -
Subject digest:
3636a5d53488e8e540edf6de13f8dfe52eebb4c482df7d62682f5688f485a099 - Sigstore transparency entry: 1563505150
- Sigstore integration time:
-
Permalink:
Vedant9500/OpenLMlib@ac995cd78a721fad8adffab941d50373cca97429 -
Branch / Tag:
refs/tags/v0.2.6 - Owner: https://github.com/Vedant9500
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ac995cd78a721fad8adffab941d50373cca97429 -
Trigger Event:
push
-
Statement type: