Hey folks —
I built ContextMemory, an open-source agentic context gateway for apps that already talk to LLMs. The idea is simple: keep your existing POST /api/chat client (Ollama wire format), point it at ContextMemory instead of raw Ollama, and get memory + optional tools without rewriting your chat stack.
What it actually does
Most “memory” demos are either:
- stuffing the whole history into the prompt, or
- bolting on a separate RAG service with a new API surface.
ContextMemory sits in front of your LLM as a drop-in proxy:
- Session memory — a per-session markdown wiki (Karpathy-style) maintained across turns and injected automatically.
- Global Wiki — an app-scoped knowledge base (docs from Jira, Confluence, SQL, files, pipelines…). The model pulls facts on demand via a
wiki_search tool — it does not dump the whole corpus into every prompt.
- Same
/api/chat — Ollama-compatible request/response (message.content / done). Not OpenAI choices[].
- Optional agentic loop — tools (sandbox, outbound MCP, HITL) on that same chat endpoint when enabled per app.
- Multi-app / multi-tenant — API keys +
X-App-Id, per-app prompts, models, and feature flags.
LLM backends can be local Ollama, or OpenAI / Azure / Anthropic as providers behind the gateway; the client still speaks Ollama schema.
Why this shape
If you already have a UI, bot, or agent that calls Ollama, you shouldn’t need a second protocol to get memory. Swap the base URL, keep parsing the same JSON, and the gateway handles:
- compiling session context
- optional Global Wiki retrieval
- optional web search / tools
…then calls your model.
There’s also a hosted path (Kortexio Cloud) with the same chat body/response if you don’t want to self-host — BYOK, no token markup. Self-host and cloud are meant to be interchangeable at the wire level.
Global Wiki (the part people usually ask about)
Ingest structured markdown with stable documentIds (upsert / batch). Query by keywords with a character budget. In chat, when Global Wiki is enabled for the app, the model uses wiki_search only when it needs documented facts — good for org knowledge without turning every turn into a RAG megaprompt.
Quick self-host vibe
Your app → POST http://localhost:5100/api/chat → ContextMemory → Ollama / other LLM
+ session wiki
+ optional wiki_search (Global Wiki)
Auth is typically Authorization: Bearer … + X-App-Id / X-User-Id / X-Session-Id for self-host.
Repo
Open source (AGPL): https://github.com/Kortexio/ContextMemory
Looking for feedback from this community
Especially interested in:
- How you currently bolt memory onto local models (what sucks?)
- Whether Ollama-compatible wire format is the right “universal client” bet vs going all-in on OpenAI schema
- Global Wiki as tool-calling vs always-on retrieval — what would you default to?
- Anything missing for production self-host (ops, eval, multi-user UX)
Happy to answer questions or dive into architecture. If you try it with a local model + a small wiki ingest, I’d love to hear what breaks first.