Knowledge store with weighted 4-way RRF retrieval, multi-tenant scope isolation, multi-dimensional cyclic temporal gravity, and autonomous cross-referencing. Built for AI workflows that need to remember.
ctx gives your LLM a persistent, searchable memory. Store knowledge blocks, query them with hybrid retrieval (semantic + bilingual fulltext + trigram), then rerank with multi-dimensional cyclic gravity — each temporal cycle (weekday, month, quarter, week, monthday, seasonal, daily) scored as its own Gaussian field. Queries like "immer dienstags" or "Weihnachten" activate specific dimensions.
Every block carries anchors from both its content (dates mentioned in text) AND its created_at timestamp, so a note about "Meeting am Dienstag" is findable by the day it discusses and the day it was written. Dream Mode runs as a continuous background loop — autonomously discovering relationships between blocks, marking outdated information, and promoting high-quality content. Your knowledge base grows, self-organizes, and stays current.
It speaks MCP, a CLI, and a plain HTTP API, ships an embedded web UI, and isolates multiple tenants down to the individual block.
| Capability | What it is |
|---|---|
| 4-way RRF retrieval | Reciprocal-rank fusion of semantic + EN/DE fulltext + trigram, type-policy-parameterised — architecture |
| Cyclic temporal gravity | 7 cyclic dimensions with per-dimension Gaussian decay + forward telescoping — architecture |
| Dream Mode | Continuous autonomous cross-referencing, supersedes detection, parallel race-safe workers — architecture |
| Block-type registry | Declarative per-type behaviour (retrieval, guard, dream, digest), hot-reloadable — architecture |
| Multi-tenancy | Three-level tenant/scope/block isolation, grants, quotas, self-service onboarding — multi-tenancy |
| Issues & forge sync | Per-project issue/comment corpus (own scope = own repo), kanban board, policy-validated workflow-status transitions, and GitHub pull/push sync — api · cli |
| Sealed secrets | AES-256-GCM provider credentials + trust×sensitivity egress gating — security |
| Web UI | Embedded Svelte 5 admin SPA: settings, graph, corpus, status, chat, issues, type-registry admin — development |
| MCP / CLI / HTTP | Three access paths to the same store, OAuth 2.1 for remote MCP — api |
# Binary (Linux/macOS/Windows)
curl -fsSL https://github.com/GottZ/ctx/releases/latest/download/ctx-$(uname -s | tr A-Z a-z)-$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/') -o /usr/local/bin/ctx && chmod +x /usr/local/bin/ctx
# Or with Go
go install github.com/GottZ/ctx/cmd/ctx@latestPoint the CLI at your ctx host:
mkdir -p ~/.config/ctx
cat > ~/.config/ctx/config << 'EOF'
CTX_BASE_URL=https://your-ctx-host.example
CTX_KEY=your-api-key-here
EOF
ctx health # DB + Ollama connectivityRunning the server (Go daemon + PostgreSQL 18 + pgvector) is docker compose up -d ctx. Full setup, env vars and Claude Code integration are in operations; building from source in development.
ctx is designed to be the persistent memory layer for LLM agents. Five primitives, composable:
| Use case | Tool | When |
|---|---|---|
| Retrieve prior knowledge before answering | ctx query "question" |
Whenever the answer might depend on past sessions, project state, or stored decisions |
| Persist a new finding | ctx save <category> <title> - <content> |
After non-obvious discoveries, architecture decisions, resolved bugs, config changes |
| Update an existing block | ctx save with same <category> <title> |
category+title is the upsert key — re-saving replaces |
| Browse without LLM cost | ctx search [category] [query:text] |
Listing, sanity-checking, lightweight lookups |
| Inspect a specific block | ctx get <block-id> |
Following an id from query sources or another block |
Categories (semantic, not enforced): infrastructure, decisions, projects, reference, learnings, agent-briefing, index. Pick by intent: one fact per block, precise title, tags for cross-cutting. ~1–1.5k chars max — split, don't grow.
Access paths (in order of preference for LLM agents):
- MCP —
claude.ai ctxserver (Streamable HTTP transport). Tools:query,store,search,get,recent. JSON-schemas, no shell-quoting. Use this in Claude Code / claude.ai sessions. - CLI —
/usr/local/bin/ctx— shell pipelines, cron, scripts. Config in~/.config/ctx/config. - HTTP —
POST /api/{query,store,search,manage}direct — fallback when MCP/CLI unavailable.
Using a shared memory well takes discipline against drift — see using ctx effectively.
| Doc | Contents |
|---|---|
| Architecture | Retrieval pipeline, cyclic temporal model, Dream Mode, Guard, block-type registry, backend pool |
| Multi-tenancy | Model C (tenant/scope/block), grants, admin tiers, per-tenant settings/secrets/quotas, self-service onboarding |
| HTTP API | Endpoints, manage actions, graph API, settings API, backend pool, web-chat sessions |
| CLI reference | Every ctx subcommand, incl. tenant / quota / keys / block-grant |
| Security | Admin tier, sealed secrets & break-glass, trust×sensitivity gating, sensitivity classification |
| Operations | Setup, environment variables, boot validation, backups, deploy & migrations |
| Development | Building, the Svelte web UI, tests, visual baseline governance, git hooks |
| Using ctx effectively | Memory drift, agent discipline, RLHF calibration |
ctx is built by AI agents working against a published RLHF-warnings calibration — a 22-axis map of LLM failure modes (memory drift, unattributed certainty, median-user caution) with concrete exemplars. It is the methodology reference behind this project's way of working: gottz.de/warnings.md. Background in using ctx effectively.