opencontextDeepSeek Harness plugin
A temporal context graph, a memory API, retrieval primitives, and a multiple-platform integration mesh — designed to be embedded into any host process.
- Stars
- 71
- Forks
- 5
- License
- Apache-2.0
- Last commit
- Sep 2, 2026
Overview
A temporal context graph, a memory API, retrieval primitives, and a multiple-platform integration mesh — designed to be embedded into any host process.
Original README
Cached from the project repository on Sep 3, 2026. This is source content, separate from the Agents.md review above.
OpenContext
The agentic context runtime, powering applications that act on your behalf.
A temporal context graph, a memory API, retrieval primitives, and a multi-platform integration mesh — designed to be embedded into any host process or agents.
⭐ If you find opencontext useful, please consider giving us a star on GitHub! It helps more people discover the project and motivates us to keep building. 🙏
What is OpenContext?
OpenContext is the agentic context runtime that sits underneath an agentic application — and the substrate you build your own agent on top of. It is not a UI, a chat surface, or a model provider — it is the glue between the things that make an agent useful: durable memory, retrieval, context correction, multi-platform connectivity, scheduled awareness, and a deterministic loop engine, all behind one dependency.
→ Read docs/architecture.md for the full
data model, the lifecycle of a fact, and the transport surface map.
Who is it for?
OpenContext fits teams who need to engineer their context — that is, teams whose day-to-day work runs straight into the problems OpenContext was built to solve. Each bullet spells out the pain and how OpenContext addresses it:
- Software engineering teams. Decisions scatter across GitHub PRs, Linear tickets, Slack threads, and Notion docs — across people, tools, and quarters. New hires ask "why did we pick X?" and no one can answer. OpenContext's temporal graph stores every fact with
valid_from / valid_until, so "what did we believe last quarter?" is a real, citable query — not a guess. - Efficiency / productivity engineering teams. The people building internal automation for the rest of the company. They don't want another SaaS — they want a runtime they can drop into a CLI, an MCP server, or a daemon. OpenContext is library-first, and the deterministic Loop engine only invokes the LLM when there is real work, so it does not become a token-burning always-on loop.
- Office-assistant products. Assistants that live inside Telegram, iMessage, WhatsApp, Lark/Feishu, and friends. Same agent code, same context across channels.
IntegrationRecordhides credentials, rate-limits, and reconnect logic, whileplatform + messageIdis the natural audit trail for personal and work data. - Financial trading teams. Every order, rebalance, and risk decision needs to be traceable and auditable. The temporal graph plus append-only corrections mean "what was the strategy in April?" is a queryable fact, not a buried guess — and the trail lines up with MiFID II / SEC retention rules.
- Legal, healthcare and other audited domains. Law firms, hospitals, and similar teams where every judgement needs per-fact provenance, append-only corrections, and exportable compliance evidence.
- Multi-agent and autonomous-workflow authors. Need scheduled, deterministic wake-up instead of an LLM loop all the way down.
packages/loopships exactly that separation.
Features
| Capability | What it does | |
|---|---|---|
| 🧠 | Temporal Context Graph | A directed acyclic graph where every fact has valid_from / valid_until. Supersession, contradiction, and merge are first-class edges — corrections are append-only, not destructive. |
| 🔌 | Platform Integration Mesh | One uniform IntegrationRecord shape across Gmail, Slack, Telegram, Linear, Jira, iMessage, Feishu, Weixin, … — credential rotation, rate-limit handling, and reconnect logic live behind the adapter. |
| ⏰ | Deterministic Loop Engine | A scheduler that wakes up, decides whether there is real work, and only then calls into the agent runtime. LLM calls are not the foundation — they are the last step. |
| 🔍 | Retrieval Primitives | Chunking, embeddings, parsers (PDF/ZIP/text), sqlite-vec + pgvector + Chroma adapters. Mix backends without rewriting the recall pipeline. |
| 🤖 | Agent Runtime | AI SDK wrappers, sandbox providers (native / Claude / Vercel), MCP server, memory-consolidation job, image + audio generation. |
| 🪶 | Library-First API | Install once with pnpm add @melandlabs/opencontext and get the contracts, memory store, retrieval primitives, loop engine, and agent runtime. |
| 🛡️ | Audit + Encrypted Storage | Structured audit logging to ~/.opencontext/logs/audit.jsonl, Fernet symmetric encryption for secrets, URL allowlist/blocklist for outbound calls. |
Benchmarks
Third-party memory and long-context recall benchmarks (numbers current as of 2026-08):
| Benchmark | Score | What it measures |
|---|---|---|
| LongMemEval-S | 97.6% | Long-term memory recall across long sessions |
| LoCoMo-V2 | 97.4% | QA over long multimodal conversations |
| BEAM @ 10M | 67.0% | Factual recall at a 10M-token context window |
Scores above are opencontext self-evaluations on the public datasets, produced by our own harnesses under
benchmark/. They are not Agent Memory Leaderboard (AML) results — AML evaluates against private refined datasets on its own platform. Official AML scores, once our hosted submission completes, will appear on the leaderboard card; seebenchmark/aml-local/for the submission.
Quick Start
There are several ways to get opencontext into your project. Pick the one that matches what you're building.
1. Embed the runtime into your own app
bashpnpm add @melandlabs/opencontext
A 30-second example of the memory API:
ts1import { createMemoryStore, getRawMessageManager } from "@melandlabs/opencontext"; 2 3// The store defaults to SQLite at MEMORY_STORE_DB_PATH (./memory.db by 4// default). Each call returns an awaitable handle. 5const store = await createMemoryStore(); 6const messages = await getRawMessageManager(); 7 8// A message is one fact: a single piece of content attributed to a user. 9// `messageId` makes the call idempotent across re-ingest. 10const now = Date.now(); 11await messages.storeMessages([ 12 { 13 messageId: "msg-1", 14 userId: "u-42", 15 content: "User prefers dark mode in all tools", 16 platform: "test", 17 botId: "bot-1", 18 timestamp: now, 19 createdAt: now, 20 }, 21]); 22 23// Unified search fans out to memory + insights + knowledge. Sources you 24// haven't wired up just emit a warning — fine for a single-backend deploy. 25const hits = await store.search({ 26 userId: "u-42", 27 query: "What does the user prefer?", 28 limit: 5, 29}); 30// hits.count — number of results 31// hits.sources — which sub-indexes were actually consulted 32// hits.warnings — per-source degradation (e.g. missing embedder)
2. Manage memory from the CLI
Write and query memory straight from the command line. add writes a
single raw message to the active manager with no LLM roundtrip, and
search runs a unified read across memory, insights, and knowledge.
bash1pnpm add -g @melandlabs/opencontext # puts the `opencontext` bin on PATH 2 3# Write a fact (auto-fills messageId, platform="cli", timestamp=now) 4opencontext add --text "Rust achieves memory safety without GC" 5 6# Write with full provenance for later consolidation 7opencontext add \ 8 --text "Discussed Q4 roadmap with the team" \ 9 --source "meeting://2026-08-20" --kind experience \ 10 --tag topic=roadmap --tag team=eng 11 12# Plain hybrid search (RRF across memory + insights + knowledge) 13opencontext search --query "memory safety" --k 5 14 15# Inspect what would have been sent to the LLM, no synthesis call 16opencontext search --query "what did we chat about last weekend" --context-only 17 18# Script-friendly JSON 19opencontext search --query "x" --json | jq '.results[].id'
add accepts --user (default "default"), --bot (default "default"),
--platform, --channel, --person, --source, --kind, --at,
and repeatable --tag key=value. search accepts --mode {auto|lex|sem},
--k, --threshold, repeatable --bot / --kind, --since / --until,
and --explain to surface reasoning + warnings alongside the hits.
Run opencontext <command> --help for the full flag list. See the
Getting Started tutorial
for the full flag reference and worked examples.
3. Run the HTTP daemon from npm
bashpnpm add -g @melandlabs/opencontext # puts the `opencontext` bin on PATH opencontext http \ --embedding-provider local \ --memory-backend sqlite-vec \ --host 127.0.0.1 --port 7421 # Or, without a global install, via npx: npx -y @melandlabs/opencontext http \ --embedding-provider local --memory-backend sqlite-vec curl http://127.0.0.1:7421/health
4. Wire the MCP server into Claude Desktop / Cursor
bashopencontext mcp \ --embedding-provider local \ --memory-backend sqlite-vec
5. Use with DeepSeek Harness (DSH)
OpenContext is available as a DSH plugin that gives any DSH agent durable memory and retrieval-augmented context:
bash# Install the plugin from npm dsh plugin --profile web add dsh-opencontext # Confirm it's mounted dsh --profile web --dump-config | grep dsh-opencontext # ... should contain `id: dsh-opencontext` # Start DSH web and verify dsh web # Visit http://127.0.0.1:3080/plugins and confirm dsh-opencontext shows "Enabled"
The plugin exposes 16 oc_* tools (e.g., oc_search, oc_remember, oc_memory_list) and automatically:
- Runs a recall waterfall on each turn to inject relevant historical context
- Captures user messages into durable memory
- Summarizes sessions at natural breakpoints (opt-in)
See plugins/dsh-opencontext/README.md for configuration options and the full tool reference.
6. Diagnose the install
bashopencontext doctor # human-readable health checks opencontext doctor --json # CI-friendly { ok, exit, results } envelope opencontext doctor --section memory-store
doctor is read-only and exits 0 on a healthy install. It scans nine
sections (runtime, filesystem, loop, memory-store, embedding,
policies, audit, security, integrations) and reports pass /
warn / fail for each. No auto-fix in v1.
Next: Tutorials — get started, user guide, developer guide, advanced patterns, and best practices
Examples
The examples/ workspace ships a runnable example per
capability area. Clone, install, and run:
bashgit clone https://github.com/melandlabs/opencontext.git cd opencontext/examples pnpm install pnpm test
See examples/README.md for the full walkthrough.
Why It Is Different
OpenContext is not a memory library and not a vector DB. It is a
runtime substrate — the @melandlabs/opencontext package bundles
contracts, memory-store, retrieval primitives, the loop engine, and
the agent runtime behind one dependency.
| Compared with… | opencontext adds |
|---|---|
| A flat vector DB (Pinecone, Weaviate, Qdrant) | A temporal graph — facts have valid_from / valid_until and get superseded, not just similarity-matched |
| A context/memory library | A runtime, not a library — HTTP daemon, MCP server, CLI, plus the integrations mesh and the loop engine |
| Wiring your own agent loop | A separable Loop engine that schedules when to wake the agent, instead of an LLM loop all the way down |
| Embedding opencontext just to get its integrations | Single-package install — one pnpm add gets every capability, no React/Next/Tauri required to use |
Architecture
┌────────────────────────────┐
│ Host application │ ← your UI, CLI, or daemon
│ (a reference app, │
│ or your own embedder) │
└─────────────┬──────────────┘
│
┌────────────────────────┴────────────────────────┐
│ @melandlabs/opencontext │
│ contracts · memory · rag · loop · agent │
└────────────────────────┬────────────────────────┘
│
┌─────────────────────────────┴─────────────────────────────┐
│ Storage backends │
│ sqlite-vec · postgres · indexeddb · chroma · pgvector │
└─────────────────────────────┬─────────────────────────────┘
│
┌─────────────────────────────┴─────────────────────────────┐
│ Integrations mesh (gmail, slack, …) │
└───────────────────────────────────────────────────────────┘
Full data-flow diagrams, transport surfaces, and storage backends are
in docs/architecture.md.
Documentation
Tutorials (Start Here)
docs/tutorials/README.md— Tutorial index and learning pathdocs/tutorials/00-getting-started.md— Get up and running in 5 minutesdocs/tutorials/01-user-guide.md— Understand the four verbs and temporal memorydocs/tutorials/02-developer-guide.md— Integrate OpenContext into your appdocs/tutorials/03-advanced-usage.md— Production patterns and advanced featuresdocs/tutorials/04-best-practices.md— Tips and common pitfallsdocs/tutorials/use-cases/README.md— Real-world use cases: personal assistant, support agent, research tracker
Architecture & Design
docs/architecture.md— data model, lifecycle, data plane and control planedocs/philosophy.md— why this shape- Each package's
README.md— API surface, examples, migration notes
Contributing
See CONTRIBUTING.md.
License
Apache-2.0. © 2026 Meland Labs.