# Connectors Source: https://open-index.io/agents/connectors Pull entities from someone else's MCP server into your brain on a schedule. Everything in [Open Index as a context layer](/agents/mcp) is about exposing **your brain** over MCP. A *connector* is the reverse: a script in `/connectors/*.py` that calls **someone else's** MCP server and turns the results into entities. ```python theme={null} from open_index.connectors import Connector, EntitySpec class LinearConnector(Connector): name = "linear-issues" # Where the source MCP server lives. ${ENV} refs are resolved at run time, # so the URL and token stay out of git. mcp_url = "${LINEAR_MCP_URL}" mcp_auth_headers = {"Authorization": "Bearer ${LINEAR_TOKEN}"} schedule = "daily" # manual | hourly | daily | weekly | 6h | 30m | 1w def extract_issues(self): for item in self.paginate("list_issues", result_key="issues"): yield EntitySpec( doc_type="issue", id=f"issue:{item['id']}", name=item["title"], fields={"status": item["state"]}, related_to=[(f"product:{item['project']}", "belongs to product")], ) ``` ## Where do you get `mcp_url`? From whoever runs that server: * A hosted vendor MCP server — from their docs (e.g. `https://mcp.vendor.com/mcp`). * Another Open Index brain — its `open-index serve` URL, i.e. `http://host:8080/mcp`. * A local stdio-only MCP server — **not supported here.** Connectors speak streamable HTTP/SSE over `httpx` only. It needs an HTTP endpoint. The URL must be the full endpoint path — the same one an agent would use. ## Running connectors ```bash theme={null} export LINEAR_MCP_URL=https://mcp.linear.app/mcp export LINEAR_TOKEN=... open-index list-connectors # what's discovered, and its URL open-index ingest linear-issues # run it now open-index run # run everything whose schedule is due open-index run --loop 3600 # or wire `open-index run` into cron/CI ``` `open-index run` tracks last-run times in a gitignored `.open_index_state.json`, so it decides *whether* a connector is due — your cron drives the clock. # Open Index as your agent's context layer Source: https://open-index.io/agents/mcp Expose a brain over MCP so agents can read domain context and keep it current. `open-index mcp` runs an MCP server (stdio) exposing the brain to any MCP client — **read and write by default**. ## The tools * The server publishes dynamic, brain-specific instructions as part of the agent prompt so supporting hosts can navigate the domain before the first tool call. Refresh the domain guide after the index or schema changes — reports doc\_types, fields, and the relationship vocabulary of *your* brain. Retrieve domain context by query, optionally scoped to doc\_types. Fetch a single entity by its `:` id. Add or update entities — validated, honoring the storage policy. `put_entities` writes a whole batch in one call with a shared `provenance` block. Define a new concept from the agent side. ## Read-only mode Use `open-index mcp --read-only` (or `open-index serve --read-only`) to opt out when an agent should retrieve domain context but never maintain it. ```bash theme={null} open-index mcp --brain ./my-brain # read + write (default) open-index mcp --brain ./my-brain --read-only # retrieval only ``` ## Local context-fetch analytics CLI and MCP searches, entity fetches, and navigation-guide reads are recorded in the user's local state directory (`~/.local/state/open-index/`), outside the brain checkout. The Analytics tab shows fetch counts by client/operation, frequently fetched queries or entity IDs, latency, failures, zero-result searches, and recent activity. This file stays local and is never sent to Open Index's creators. ## Claude Code conveniences `open-index init` includes optional Claude Code conveniences: `.mcp.json`, a `CLAUDE.md` describing durable editing workflows (not runtime navigation), and an **`edit-brain` skill**. They are one client integration, not a requirement for building legal, marketing, support, or other specialized agents on Open Index. ## Portable agent setup skill `skills/setup-open-index/SKILL.md` follows the portable Agent Skills `SKILL.md` format used by agent runtimes including OpenClaw, Hermes, and Claude Code. Give or install this skill in the selected runtime when the agent should set up Open Index itself. It covers installation, domain-brain initialization, generic MCP wiring, default read/write verification, the `--read-only` opt-out, and production guardrails. ## Connecting a client For the exact config block per client (Claude Code, Claude Desktop, Cursor) and the remote HTTP path, see [Deployment → Connecting your agent](/deployment#5-connecting-your-agent). # Core concepts Source: https://open-index.io/concepts The four primitives a brain is built from, and how entities link into a graph. A brain is built from four primitives. Everything else in Open Index is a way to create, store, search, or maintain them. A concept you want to track and maintain — `service`, `customer`, `issue`. The fields stored for a given doc\_type, plus how each is searched and weighted. One instance of a doc\_type, stored per its schema and linked to others. An optional source you extract entities from, e.g. an MCP server. ## doc\_type A **doc\_type** is an empirical representation of the kind of object you want to store in your brain. Sample doc\_types by domain: * **infra** — `service`, `datastore`, `dashboard`, `runbook`, `alert` * **sales** — `lead`, `deal`, `account` * **lending** — `loan`, `borrower`, `application` * **personal** — `goal`, `project`, `person`, `area`, `note` Each doc\_type is one YAML file in `doc_types/`. It declares a schema, an optional display config, and an optional relationship vocabulary. ## doc\_schema The **schema** lists the fields a doc\_type stores. Per field you set the data `type`, how it's searched (`syntactic`, `semantic`, or `none`), and a ranking `boost`. See [Search configuration](/guides/search-configuration) for the full field reference. ## entity An **entity** is one instance of a doc\_type. Its `id` must be `:` (e.g. `service:checkout`). Every entity carries the reserved **`related_to`** field — the correlation field present on all entities. It defines the graph edges: each edge is a `target` plus a free-text `relationship_edge_meaning`. ```json theme={null} { "doc_type": "service", "id": "service:checkout", "name": "Checkout", "related_to": [ { "target": "datastore:postgres-main", "relationship_edge_meaning": "writes to" }, { "target": "dashboard:checkout-latency", "relationship_edge_meaning": "is monitored by" } ] } ``` This is how you say "this ticket is about that service" without any graph database. The explorer's **Map** tab renders these edges directly. ## connector A **connector** is an optional ingestion script in `/connectors/*.py` that pulls from someone else's MCP server on a schedule and turns the results into entities. See [Connectors](/agents/connectors). ## Where entities live: `storage: file | index` Each doc\_type declares its source of truth, so curated and machine-generated data don't fight over git. JSON files under `entities//` are the source of truth — git-tracked and PR-reviewable. Right for curated, human- or agent-authored entities. `open-index index` reconciles these from disk on each run. The search DB owns these entities; they are **not** written to files. Right for connector-pulled, high-volume, or temporal data (hundreds of services, memories, alerts) that would otherwise churn the repo. `open-index index` reconciles **file**-backed types from disk and leaves **index**-backed entities untouched. Match how a type is written to how it's declared, or the next `index` run will wipe DB-written entities on a `file` type. See [Search configuration](/guides/search-configuration) for the decision table. # Deployment Source: https://open-index.io/deployment Deploy a brain and connect your agent — local, remote, Docker, TLS, and the exact config to paste. This guide answers three questions, in order: 1. [Which setup do I want?](#1-which-setup-do-i-want) — local vs remote, SQLite vs OpenSearch 2. How do I run it — [local](#2-local-brain-stdio), [remote without Docker](#3-remote-brain-without-docker), [remote with Docker](#4-remote-brain-with-docker) 3. [How do I get the MCP details into my agent?](#5-connecting-your-agent) — the part that is easy to get wrong There is a second, unrelated use of "MCP" in Open Index — *connectors*, which pull data **from** someone else's MCP server into your brain. That's [Connectors](/agents/connectors). ## 1. Which setup do I want? Two independent choices. Pick one from each column. **Where does the brain run?** | | Local (stdio) | Remote (HTTP) | | ---------------------- | -------------------------------------------------------------------- | -------------------------------------------- | | How the agent connects | It launches `open-index mcp` itself | It connects to a URL you host | | Needs a URL or token | No | Yes | | Who can use it | One agent, on your machine | Any agent that can reach the host | | Use when | You're the only user; the brain lives in a repo you have checked out | A team, cloud agents, or CI shares one brain | **Which search backend?** | | SQLite (default) | OpenSearch | | ------------------ | ----------------------------------------------------- | ---------------------------------------- | | External services | None — one `brain.db` file | An OpenSearch cluster | | Concurrent writers | **One.** SQLite is single-writer | Many | | Semantic search | Brute-force cosine scan, fine to \~10k entities | Native k-NN, scales past that | | Extras | Native per-field boosting, fuzzy/typo-tolerant search | | | Use when | Local brains, single agent, trials, read-mostly | Several agents writing, or >10k entities | **Rule of thumb:** local + SQLite to start. Move to remote + OpenSearch when a *second writer* appears — that's the line SQLite can't cross, not entity count. **OpenSearch is only set up for you in the Docker path.** Running it outside Docker means operating a cluster yourself; Open Index will happily connect to one ([config below](#opensearch-without-docker)), but this repo only ships a ready-made cluster in `docker-compose.yml`. Switching backends does **not** require editing `brain.yaml` — set `OPEN_INDEX_SEARCH_BACKEND=sqlite|opensearch` in the environment and it wins over the file. That's what the compose profiles do. ## 2. Local brain (stdio) Nothing to host. The agent starts the server itself over stdio. ```bash theme={null} pip install -e '.[all]' open-index init my-brain open-index index --brain my-brain ``` `open-index init` already writes a `.mcp.json` into the brain directory, so if you open Claude Code **in that folder**, it connects automatically — no further setup. To connect from somewhere else (a different repo, Claude Desktop, Cursor), get the config block: ```bash theme={null} open-index mcp-config --brain ./my-brain ``` ```json theme={null} { "mcpServers": { "open-index": { "command": "open-index", "args": ["mcp", "--brain", "/absolute/path/to/my-brain"] } } } ``` The path is absolutized deliberately: your agent's working directory is usually not the brain directory, and a relative `--brain .` quietly opens the wrong place (or an empty one). See [Connecting your agent](#5-connecting-your-agent) for where this block goes. ## 3. Remote brain, without Docker Use this when you have a VM and don't want containers. The brain becomes an HTTP MCP endpoint that any agent can register by URL. ### Install and run ```bash theme={null} # On the host pip install 'open-index[serve]' # add ,opensearch if using OpenSearch git clone /srv/acme-brain # your doc_types + entities open-index index --brain /srv/acme-brain # load file-backed entities export OPEN_INDEX_TOKEN=$(openssl rand -hex 32) open-index serve --brain /srv/acme-brain --port 8080 ``` `serve` prints exactly what to connect to: ``` open-index · brain 'acme' · read+write · search backend: sqlite listening on 0.0.0.0:8080 on this machine http://127.0.0.1:8080/mcp from another machine http://10.0.1.42:8080/mcp auth: Authorization: Bearer 9f3a…****** agent config: open-index mcp-config --url http://10.0.1.42:8080 --token $OPEN_INDEX_TOKEN ``` **`0.0.0.0` is not an address.** It's the *bind* address — "listen on every interface". It is never what you paste into an agent. That's why the banner prints the reachable addresses separately. ### The token is not optional `serve` exposes `put_entity` and `create_doc_type`. Without a token, anyone who can reach the port can rewrite your brain. Either set `OPEN_INDEX_TOKEN`, or pass `--read-only` to drop the write tools: ```bash theme={null} open-index serve --brain /srv/acme-brain --read-only # queryable, not writable ``` A common shape is two endpoints: a read-only one on an open port, and an authenticated read+write one for the agents allowed to author. ### Keep it running (systemd) ```ini theme={null} # /etc/systemd/system/open-index.service [Unit] Description=open-index brain (MCP) After=network-online.target [Service] User=openindex WorkingDirectory=/srv/acme-brain Environment=OPEN_INDEX_TOKEN= # Uncomment to use an OpenSearch cluster instead of SQLite: # Environment=OPEN_INDEX_SEARCH_BACKEND=opensearch # Environment=OPEN_INDEX_OPENSEARCH_HOSTS=https://opensearch.internal:9200 ExecStartPre=/usr/local/bin/open-index index --brain /srv/acme-brain ExecStart=/usr/local/bin/open-index serve --brain /srv/acme-brain --port 8080 Restart=on-failure [Install] WantedBy=multi-user.target ``` `ExecStartPre` matters: file-backed entities live in git, not in the index. After a `git pull` or a fresh machine, the index is empty until `open-index index` runs and the brain answers every query with nothing. ### TLS / behind a proxy `serve` speaks plain HTTP. For TLS, terminate at nginx/Caddy and forward to it. Streamable HTTP uses long-lived responses, so disable response buffering: ```nginx theme={null} location /mcp { proxy_pass http://127.0.0.1:8080/mcp; proxy_http_version 1.1; proxy_set_header Connection ""; proxy_set_header Authorization $http_authorization; proxy_buffering off; # required — SSE/streaming responses proxy_read_timeout 3600s; } ``` Then tell `serve` its public name so the banner and `mcp-config` print the URL agents should actually use, rather than the internal one: ```bash theme={null} open-index serve --brain /srv/acme-brain --public-url https://brain.acme.com/mcp ``` ### OpenSearch without Docker Point `brain.yaml` at your existing cluster. Secrets stay as `${ENV}` refs, resolved when the connection is opened: ```yaml theme={null} search: backend: opensearch hosts: ["https://opensearch.internal:9200"] index: open_index_acme # optional; defaults to open_index_ username: "${OPENSEARCH_USER}" password: "${OPENSEARCH_PASSWORD}" use_ssl: true verify_certs: true ``` Or leave `brain.yaml` on SQLite and override per-environment: ```bash theme={null} export OPEN_INDEX_SEARCH_BACKEND=opensearch export OPEN_INDEX_OPENSEARCH_HOSTS=https://opensearch.internal:9200 ``` ## 4. Remote brain, with Docker The shortest path to a shared brain, and the only path where OpenSearch is set up for you. ```bash theme={null} cp .env.example .env # Set OPEN_INDEX_TOKEN (openssl rand -hex 32) and BRAIN_DIR (path to your brain). ``` No external services: ```bash theme={null} docker compose --profile sqlite up --build ``` Adds a single-node cluster with a persistent volume: ```bash theme={null} docker compose --profile opensearch up --build ``` Both serve `http://localhost:8080/mcp`. The only difference is `OPEN_INDEX_SEARCH_BACKEND`; your `brain.yaml` is identical either way, so you can switch by changing the profile and nothing else. Add the explorer UI on `:8501` alongside either: ```bash theme={null} docker compose --profile opensearch --profile ui up ``` ### What the container does on start The brain directory is **mounted, not baked in** (`BRAIN_DIR:/brain`) — doc\_types and entities stay in your git repo. On start the entrypoint: 1. fails fast with a clear message if `/brain/brain.yaml` isn't there, 2. waits for OpenSearch to report healthy when that backend is selected, 3. runs `open-index index` so file-backed entities are loaded (skip with `OPEN_INDEX_SKIP_INDEX=1`), 4. execs `open-index serve`. ### Permissions on the mounted brain directory The container runs as uid **10001** (not root), so a bind-mounted brain directory owned by your user is not writable by it — indexing fails on the first write. Give the container ownership and keep group access for yourself: ```bash theme={null} sudo chown -R 10001:"$(id -g)" /path/to/my-brain chmod -R g+rwX /path/to/my-brain ``` You can still read and edit the files; writes from inside the container land as uid 10001 with your group. ### Many brains from one process `serve --brain ` runs one brain. For more than a handful, `--brains ` serves every brain under a directory from a single process, each at `//mcp`: ```bash theme={null} open-index serve --brains /srv/brains --port 8080 # /srv/brains/support/ → /support/mcp # /srv/brains/sales/ → /sales/mcp ``` This matters because of what is *not* duplicated. A process per brain re-loads the Python runtime and a \~250MB resident embedding model each time, so a modest host tops out at a handful. In one process the model is loaded once and a brain costs only its config and doc\_types. Measured on the bundled example brain, SQLite-backed: | Brains | One process | One process per brain | | ------ | ----------- | --------------------- | | 50 | 345 MB | \~13 GB | | 200 | **373 MB** | \~53 GB | That is **1.8MB of marginal cost per brain**, and 200 mount in \~4 seconds. Each brain keeps its own storage, its own read/write policy and its own token — `OPEN_INDEX_TOKEN_` gates one brain (`OPEN_INDEX_TOKEN_SALES_EU` for `sales-eu/`), and `--token` covers any without one. Nothing is shared between brains except the process and the model. Two extras come with it: `GET /` lists every brain with its URL, entity count and doc\_types, and `GET /healthz` is an unauthenticated probe for a load balancer. **Prefer SQLite here.** With OpenSearch, every brain is a separate cluster index and therefore a shard; the working guidance is \~20 shards per GB of heap, so hundreds of brains would hit that ceiling long before RAM. SQLite gives each brain its own file and no shard cost at all. Use OpenSearch for the few brains that genuinely need concurrent writers or >10k entities. ### Running one-off commands ```bash theme={null} docker compose --profile sqlite run --rm brain-sqlite validate docker compose --profile sqlite run --rm brain-sqlite search "checkout latency" docker compose --profile sqlite run --rm brain-sqlite ingest my-connector ``` `--brain /brain` is added for you. ### Plain `docker run`, no compose ```bash theme={null} docker build -t open-index . docker run -p 8080:8080 \ -v "$PWD/my-brain:/brain" \ -e OPEN_INDEX_TOKEN=secret \ open-index serve ``` ### Notes for real deployments * **Persistence.** SQLite: `brain.db` is inside your mounted brain dir — back that up. OpenSearch: the `opensearch-data` named volume. Index-backed entities (`storage: index`) exist **only** there; they are not in git and are not recreated by `open-index index`. Back it up or be able to re-ingest. * **The OpenSearch cluster here has security disabled** (`DISABLE_SECURITY_PLUGIN=true`) and binds to loopback. That's fine for a single host where only the brain container talks to it; enable the security plugin and set `search.username`/`password` before putting it on a shared network. * **Behind a proxy**, set `OPEN_INDEX_PUBLIC_URL` in `.env` so the printed connection details are the ones agents can actually use. ## 5. Connecting your agent You need two things: the **URL** (remote) or **brain path** (local), and the **token** (remote only). `mcp-config` assembles both into the right block. ```bash theme={null} # Local brain open-index mcp-config --brain ./my-brain # Remote brain — host:port, or a full URL; /mcp is appended if you omit it open-index mcp-config --url brain.acme.internal:8080 --token $OPEN_INDEX_TOKEN # As a `claude mcp add` one-liner instead of JSON open-index mcp-config --url https://brain.acme.com/mcp --token $TOKEN --cli ``` It writes to stdout, so it pipes straight where it belongs: ```bash theme={null} open-index mcp-config --brain ./my-brain > .mcp.json ``` ### Where the block goes | Client | Location | | --------------------------- | ----------------------------------------------------------- | | **Claude Code** (project) | `.mcp.json` in the repo root — shared with the team via git | | **Claude Code** (user-wide) | `claude mcp add …` (use `--cli` to get the exact command) | | **Claude Desktop** | `claude_desktop_config.json` — same `mcpServers` shape | | **Cursor** | `.cursor/mcp.json` — same `mcpServers` shape | | **Anything else** | Any MCP client that speaks stdio or streamable HTTP | A remote block looks like this: ```json theme={null} { "mcpServers": { "open-index": { "type": "http", "url": "https://brain.acme.com/mcp", "headers": { "Authorization": "Bearer " } } } } ``` Committing a token into `.mcp.json` puts it in git history. For a shared repo, prefer a per-developer user-scoped entry, or a read-only endpoint with no token for the committed config. ### Check it works before blaming the agent ```bash theme={null} # 401 = the server is up and your token is wrong or missing. # 406/400 = you reached the MCP endpoint (it wants a proper MCP handshake). Good. curl -i -X POST https://brain.acme.com/mcp \ -H "Authorization: Bearer $OPEN_INDEX_TOKEN" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","id":"1","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"curl","version":"0"}}}' ``` Once connected, the agent should call `navigation_guidelines()` first — it reports the doc\_types, fields, and relationship vocabulary of *your* brain. ### Troubleshooting | Symptom | Cause | | --------------------------------------- | ----------------------------------------------------------------------------------------------------- | | Agent can't connect at all | You used the bind address (`0.0.0.0`) instead of a reachable one. Re-read the `serve` banner. | | `401 unauthorized` | Token missing/wrong. The header must be exactly `Authorization: Bearer `. | | Connects, but `404` | Missing the `/mcp` path. `mcp-config` appends it; hand-written URLs often don't. | | Connects, but every search is empty | `open-index index` never ran on this host, so file-backed entities aren't loaded. | | Tools are read-only unexpectedly | The server was started with `--read-only`. | | Writes fail with "unknown doc\_type" | Create the doc\_type first (`create_doc_type`), or check `navigation_guidelines()` for existing ones. | | Local stdio server opens an empty brain | Relative `--brain .` resolved against the agent's cwd. Use an absolute path — `mcp-config` emits one. | | Hangs/timeouts behind nginx | Response buffering is on. Set `proxy_buffering off`. | # How to avoid staleness and conflicts in your knowledge window Source: https://open-index.io/guide/conflicts-and-staleness Why distributed markdown knowledge self-contradicts over time, and how per-concept structured updates and time-decay keep a knowledge base correct. A knowledge base is only useful while it's *correct*. The failure mode that erodes trust fastest isn't missing information — it's **stale or conflicting** information the agent treats as current. Two documents disagree; the agent picks one; the user can't tell it was wrong until it's too late. ## Why files rot When context is spread across many markdown files, updates are non-trivial: * **Related context is duplicated across documents.** The same fact — an owner, a policy, a threshold — appears in several files. Update one, miss the others, and now your knowledge base disagrees with itself. * **There's no deterministic link between related facts.** Nothing says "these three paragraphs describe the same thing," so there's no reliable way to find everything that must change together. * **Nothing expires.** Old notes sit forever with the same weight as fresh ones. The agent has no signal that a two-year-old runbook is stale. The result is a knowledge base that gets *less* trustworthy as it grows — the opposite of what you want. ## Structure updates around concepts, not documents The fix is to make the **concept** the unit of truth, not the document: Each entity has a stable id (`service:checkout`). A fact about checkout lives in *one* place and is updated in one place — no hunting through documents for duplicated copies. → [entities](/concepts) Update or delete a single record without touching a monolithic context document. Writes are validated against the schema, so an update can't silently break shape. → [put\_entity](/agents/mcp) Related facts connect through typed `related_to` edges. When something changes, you can traverse the edges to find exactly what else is affected — deterministically, not by full-text guessing. → [related\_to](/concepts) ## Handle temporal data with decay, not deletion Some knowledge is inherently time-bound — alerts, deployments, incidents. Keeping it forever is noise; deleting it loses signal. The right pattern is **exponential decay with time**: recent records dominate retrieval, old ones fade, and flushing the tail doesn't hurt quality. Model high-volume temporal data as **index-owned** (generated, DB-resident) rather than git-tracked files, so it doesn't churn your repo — and let it decay. Curated, long-lived knowledge stays **file-backed** and reviewable. Matching the storage policy to the data's lifespan is half the battle. → [storage: file vs index](/guides/search-configuration) ## Choose the right write cadence Staleness is often *self-inflicted* by creating entities too fast: * Track things that change at a **human pace** (a service, a policy, an account), not ephemeral ones (a pod, a single request). An entity per ephemeral object is pure churn. * Over-population creates two costs: **noise** in retrieval and **maintenance overhead** removing stale records later. See [Entity management](/guides/entity-management) for the full cadence guidance. ## Checklist * [ ] Each fact lives in exactly one addressable record — no duplication across docs. * [ ] Updates and deletes are per-concept and schema-validated. * [ ] Related facts link through typed edges, so change impact is traceable. * [ ] Temporal data decays with time instead of accumulating. * [ ] Write cadence matches how fast the underlying thing actually changes. Making every fact traceable to its source. # How to reduce context poisoning in your agents Source: https://open-index.io/guide/context-poisoning Why markdown/file-based context makes agents drift, and how a structured, discoverable context model contains the blast radius. **Context poisoning** is when irrelevant or unintended context leaks into the agent's working set and pulls it off task — a stray instruction in a document, a tangentially-related file, an old note that contradicts a new one. The agent picks it up, treats it as relevant, and drifts. It's the single most common reason "autonomous" agents need a human watching them. ## Why it happens with files Teams usually start with markdown files, organized by folder. It works at 5 files. At 50+, it doesn't — and adding structure the *file* way makes it worse: * **Co-location leaks.** Two unrelated instructions in the same document both enter context together. The folder boundary doesn't help once a file is open. * **Navigation invites wandering.** Build an Obsidian-style web of interlinks and the agent follows links into documents it didn't need, accumulating unrelated instructions on the way. * **Prose hides intent.** Markdown is written for humans. An agent can't cheaply tell which paragraph is a hard rule, which is background, and which is stale. The instinct to fix poisoning with *more structure in the same medium* — more folders, more interlinks, more navigational paths — usually increases surface area for drift. The medium is the problem, not the organization. ## The fix: structure the model, shrink the surface Three shifts move context poisoning from "constant" to "rare": Store context as **JSON / structured records** with named fields, not markdown. Agents navigate structured data far more reliably — it looks like code, and the boundaries between facts are explicit. → [doc\_types & schemas](/concepts) Instead of loading files, the agent **searches** for exactly the records it needs and gets those back — nothing co-located, nothing adjacent. A search that returns three entities can't poison the way a folder of thirty documents can. → [Context search accuracy](/guide/context-search-accuracy) Related facts link through **declared edges** (a target plus a stated meaning), not through "these files are near each other." The agent traverses a relationship on purpose, not by proximity. → [related\_to edges](/concepts) ## What this looks like in practice Instead of a `payments/` folder the agent browses, each service is a record it retrieves by name, with typed edges to exactly the things it relates to: ```json theme={null} { "doc_type": "service", "id": "service:checkout", "name": "Checkout", "owner": "payments-team", "related_to": [ { "target": "runbook:checkout-oncall", "relationship_edge_meaning": "has runbook" } ] } ``` When the agent needs the checkout runbook, it follows *that edge* — it never has to open a folder where an unrelated "always escalate to legal" note happens to live. This is one of the three moves behind [Open Index](/why-open-index): structured entities, agentic search instead of pre-injection, and per-concept updates. Each independently reduces the poisoning surface. ## Checklist * [ ] Context lives in structured records, not free-form markdown. * [ ] The agent retrieves narrow result sets by search, not whole files/folders. * [ ] Relationships are explicit, typed edges — not folder co-location. * [ ] Instructions and reference data are separated, so reference can't read as a command. Making the agent's own retrieval reliable. # How to improve context search accuracy Source: https://open-index.io/guide/context-search-accuracy Why agentic search with navigation beats pre-injected RAG, and how field boosts, hybrid ranking, and schemas make retrieval precise. An agent is only as good as the context it retrieves. If search returns plausible-but-wrong records, the agent reasons confidently over the wrong facts — and no amount of prompting fixes bad retrieval. This page is about making the agent's own search accurate enough to trust. ## Stop pre-injecting. Let the agent search. The common pattern is: your system runs RAG or prompt expansion, picks some chunks, and injects them into the prompt. This has three problems: * **You guess wrong.** Your retrieval heuristic decides what's relevant *before* the agent knows what it needs for this specific step. * **It poisons.** Injected chunks the agent didn't ask for are exactly the surface for [context poisoning](/guide/context-poisoning). * **It's opaque.** Neither you nor the user can tell what actually drove the answer. The better model: **give the agent a search tool plus navigational meta-information**, and make discovery its responsibility. It searches, reads what it got, decides whether to search again or drill into a relationship — the same way a good analyst works. This is agentic search over *all* your structured content, not a bolt-on RAG index. In [Open Index](/agents/mcp) the agent gets `navigation_guidelines()` (what doc\_types, fields, and relationships exist), `search_brain()`, and `get_entity()` — enough to navigate a domain it's never seen. ## Give the agent a map before the first query Retrieval accuracy jumps when the agent knows the *shape* of what it's searching. Before its first query, hand it navigational context: * Which **doc\_types** exist (`service`, `runbook`, `incident`…) and what each means. * Which **fields** each carries, and which are searchable. * Which **relationships** connect them, so it can traverse on purpose. With that map, the agent scopes searches (`search only incidents`), follows edges deliberately, and stops guessing. Without it, every query is a blind shot. ## Tune ranking so the right record wins Precision is also a ranking problem. Two levers matter most: Weight a match in `name` far above a match in a long `description`. A genuine multiplier — a hit in a `boost: 6` title outranks a `boost: 1` body hit 6-to-1 — so the record whose *identity* matches the query surfaces first. → [Search configuration](/guides/search-configuration) Keyword search nails exact names and identifiers; semantic search rescues queries that describe a thing in different words than the record uses ("checkout is slow" → "latency spike at payment"). Blend them — keyword-dominant by default, with a semantic weight you raise when users describe rather than name. ## Design schemas for retrieval Search accuracy starts at the schema, not the query: * Mark identity fields (`name`, `owner`, `status`) **syntactic** — exact/prefix matching, high boost. * Mark prose fields (`description`, `summary`) **semantic** — matched by meaning. * Mark opaque blobs and internal ids **`none`** — stored but never searched, so they can't add noise to results. A field that shouldn't influence ranking simply isn't indexed. That's the cheapest precision win there is. ## Checklist * [ ] The agent searches; you don't pre-inject a guessed context blob. * [ ] It gets navigational meta-info (doc\_types, fields, relationships) up front. * [ ] Identity fields are boosted; noise fields are `search: none`. * [ ] Ranking blends keyword + semantic to match both names and descriptions. Keeping retrieved context correct as it grows. # How to increase determinism in your AI agents Source: https://open-index.io/guide/determinism You can't make an LLM deterministic, but you can push variance out of everything around it — retrieval, control flow, and grounding — so behavior becomes repeatable. **Determinism** is: same input, same output. LLMs are probabilistic, so you'll never get bit-for-bit determinism from the model itself — and that's fine. The goal isn't a deterministic *model*, it's a **repeatable system**: given the same situation, the agent reliably does the same reasonable thing. Most of the variance you actually feel comes from *around* the model, and that part you can control. ## Where non-determinism actually comes from If the agent sees different context on different runs, it behaves differently — even at temperature 0. Fuzzy, wide, or ranked-by-vibes retrieval is the largest source of "why did it do something different this time?" When the harness lets the model decide *everything* — including steps that should be fixed — you get a different path each run. Some decisions belong in code, not in the prompt. Ungrounded reasoning fills gaps by guessing, and guesses vary. Grounded reasoning over retrieved facts converges. Temperature and sampling. Real, but usually the *smallest* contributor — and the one people reach for first while ignoring the larger three. ## Push variance out of the loop Deterministic ranking (explicit [field boosts](/guides/search-configuration), not opaque relevance), narrow result sets, and addressed records mean the agent tends to see the *same* context for the same query. Stable inputs → stable behavior. → [Context search accuracy](/guide/context-search-accuracy) Encode the parts of the workflow that are genuinely fixed as **control flow**, and let the model decide only the genuinely open parts. Determinism where you can afford it buys you reliability where you can't. → [The harness](/guide/the-harness) An agent reasoning over specific, cited entities converges far more than one improvising from a vague prompt. Grounding is a determinism lever, not just an accuracy one. → [Provenance](/guide/provenance) A critic sub-agent that rejects outputs unsupported by context collapses the tail of weird one-off behaviors into a consistent "checked" band. ## A useful reframing > You don't make the model deterministic. You shrink the space it's allowed to be > non-deterministic in — by stabilizing its inputs (retrieval), fixing its scaffolding > (harness), and grounding its reasoning (context). The more of the surrounding system is structured and repeatable, the more the model's residual randomness stops mattering. Agents that improve with use without drifting. # What is human steering, and how to reduce it Source: https://open-index.io/guide/human-steering Human steering is the hidden tax on agent autonomy. What causes it, why it caps value, and the context and harness changes that reduce it. **Human steering** is every moment a person has to step in mid-task to redirect an agent — clarifying an ambiguous instruction, pointing it at the right document, approving a step it should have taken itself, or nudging it past a point where it stalled. A little is fine. A lot is the difference between an agent that saves time and one that just relocates the work. ## Why steering is the real bottleneck When human steering is required for a task, it caps the **autonomy, speed, and value** the agent delivers inside the workflow the human was trying to hand off. You wanted to delegate the task; instead you're babysitting it. Three costs stack up: * **Throughput** — the agent runs only as fast as a human can attend to it. * **Scale** — one operator can supervise a handful of agents, not hundreds. * **Trust** — a system that needs constant correction never earns the autonomy to run unattended, so it stays stuck at "supervised." The value of agents shows up specifically when you cross from *steered* to *autonomous*. See the [autonomy spectrum](/guide/what-are-autonomous-agents). ## Where steering comes from Most steering traces back to a handful of root causes — and notably, most are **context and harness** problems, not model problems: | The human steps in because… | Root cause | Fix | | ----------------------------------------------- | ------------------------------------------------------- | --------------------------------------------------------- | | "That's the wrong document / not what I meant" | Bad retrieval; guessed context | [Context search accuracy](/guide/context-search-accuracy) | | The agent drifted onto an unrelated instruction | [Context poisoning](/guide/context-poisoning) | Structured, narrow retrieval | | It stalled on a fuzzy multi-step decision | Weak harness; no drill-down | [The harness](/guide/the-harness) | | "I don't trust this — show me why" | No [provenance](/guide/provenance) | Per-fact attribution | | It acted on stale/contradictory info | [Conflicts & staleness](/guide/conflicts-and-staleness) | Per-concept updates + decay | ## How to reduce it The most common steering — "you're looking at the wrong thing" — disappears when the agent searches structured context itself instead of relying on a human (or a guessed pre-injection) to hand it the right document. Structured records and typed edges stop the agent wandering into unrelated instructions, which removes a whole class of "why did it do that?" interventions. Soft gates keep it from exiting early on fuzzy tasks; critic sub-agents catch bad reasoning before a human has to. The agent recovers on its own instead of waiting for a nudge. Provenance lets the human verify *after* the fact instead of supervising *during* it — moving them from the inner loop to the outer loop. Reducing steering isn't about a smarter model. It's about removing the reasons a human *has* to intervene — most of which live in the context layer and the harness around the model. Making the agent's behavior repeatable enough to trust unattended. # Building autonomous agents Source: https://open-index.io/guide/index A practical guide to the failure modes of autonomous agents and the context-engineering practices that fix them. Most agent demos work. Most agents in production stall — they drift off task, need a human to steer them past the hard step, or confidently act on stale context nobody can trace. This guide is about the gap between the two, and specifically about the **context layer**, which is where most of that gap lives. This guide is vendor-neutral on the harness but grounded in a real system. Where a practice maps onto a concrete capability, we point at how [Open Index](/why-open-index) implements it — Open Index is the open-source context engine we extracted from doing this work at scale. ## The two halves of an agent An autonomous agent is a loop over two things: 1. **A harness** — the control flow, gates, retries, sub-agents, and evals that keep the loop honest. See [The harness](/guide/the-harness). 2. **A context layer** — how the agent finds the right knowledge, keeps it current, and cites it. This is where the rest of this guide focuses. Get the harness right and a wrong context layer still produces confident nonsense. Get the context layer right and a thin harness suddenly goes a lot further without a human in the loop. ## What breaks, and where it's covered The agent picks up unrelated instructions and drifts. Fix it at the data model, not with more folders. Retrieval that returns plausible-but-wrong context. Make discovery the agent's job, with navigation. Knowledge that self-contradicts as it grows. Structure updates per concept. Users can't trust what they can't trace. Attach a source to every fact. The autonomy tax. What steering is, why it happens, and how to reduce it. Same input, different output. Where to push variance out of the loop. Agents that get better with use by writing back what they learn. Soft gates, critic sub-agents, and in-session evals around the context layer. ## The one idea underneath all of it If there's a single thread through this guide, it's this: > **Don't feed your agent context. Give it structured, searchable, attributable > context and make discovery its job.** Everything else — less poisoning, less steering, more determinism, real provenance — follows from that shift. The next pages break it down failure mode by failure mode. # How to ensure provenance in your AI agents Source: https://open-index.io/guide/provenance Why users can't trust context they can't trace, and how per-fact attribution and citable retrieval build a proof-of-work agents can defend. Users don't trust an agent because it sounds confident. They trust it when they can **see why it did what it did** — the specific piece of context behind the action. Provenance is that trail. Without it, every answer is "trust me," and adoption stalls exactly where the stakes are highest: legal, healthcare, finance, infrastructure. ## The problem provenance solves As you collate more documents, finding *which* reference the agent used gets harder: * The agent read across several documents; which sentence actually drove the action? * Was that fact current, or an old copy from a stale file? * Who asserted it, and how confident should we be? When you can't answer those on demand, you can't put a **proof-of-work** in front of the user — and without proof-of-work, they can't trust the output. That single gap caps how much you can hand off to the agent. ## Attribution belongs on the fact, not the document The fix is to attach provenance to each **fact**, so it travels with the fact into every answer: Each entity has a stable id. An answer can cite `service:checkout` precisely — not "somewhere in the payments folder." → [entities](/concepts) Attach the source and confidence when a fact is written — a connector, an import, an agent, a human. In [Open Index](/agents/mcp), writes carry a provenance block (`asserted_by`, `confidence`), and bulk imports attribute a whole batch at once (`--asserted-by import:jira`). → [populating entities](/guides/populating-entities) Because the agent retrieves discrete, addressed records — not a blob of merged text — every retrieved fact can be shown to the user with its id and source. The proof-of-work assembles itself from what was actually fetched. → [Context search accuracy](/guide/context-search-accuracy) ## Provenance is also an audit tool for *you* The same trail that builds user trust lets you debug the agent. Local fetch analytics record what context each client retrieved, how often, which queries returned nothing, and where latency or failures cluster. When an agent acts wrong, you can see the context it pulled — instead of reconstructing what it "must have" used. → [MCP analytics](/agents/mcp) Zero-result searches are a gift: they show precisely what your users asked for that your knowledge base couldn't answer — i.e. what to model next. ## Checklist * [ ] Every fact is individually addressable and citable. * [ ] Writes carry source + confidence (who asserted this, how sure). * [ ] The agent can produce a proof-of-work listing the exact records it used. * [ ] You can audit, after the fact, what context an action was based on. Reducing the autonomy tax now that context is trustworthy. # How to build self-learning loops in your AI agents Source: https://open-index.io/guide/self-learning-loops Agents that get better with use by writing what they learn back into a structured, validated knowledge base — without the drift of appending to prompts or markdown. A **self-learning loop** is an agent that gets better the more it's used — not by retraining the model, but by **capturing what it learns and making that learning available to its future self** (and to every other agent on the same knowledge base). Done well, it's compounding. Done naively, it's how agents poison themselves. ## The naive version (and why it drifts) The tempting approach is to append learnings to a prompt or a running markdown file: "remember that checkout uses the new payment provider." It works for a day, then: * The file grows unbounded and starts [poisoning](/guide/context-poisoning) context. * New learnings [contradict](/guide/conflicts-and-staleness) old ones with no resolution. * There's no [provenance](/guide/provenance) — you can't tell what the agent taught itself versus what a human verified. Unstructured write-back turns your knowledge base into exactly the mess this whole guide is about avoiding. ## The structured version Close the loop through the **same structured, validated store** the agent reads from — so learning is a first-class write, not a growing text blob: When the agent discovers something durable, it writes an **entity** (or updates one) — validated against the schema, addressed by id, carrying provenance. Not a line appended to a doc. → [put\_entity](/agents/mcp) A new fact about `service:checkout` **updates** that record. The knowledge base stays correct instead of growing a pile of contradictory notes. → [Conflicts & staleness](/guide/conflicts-and-staleness) Wire the write-back to fire at the end of a session — e.g. a Stop hook that records what was learned via `put_entity`. That's the "continuously improving" part: it happens without anyone remembering to do it. → [populating entities](/guides/populating-entities) Provenance (`asserted_by`, `confidence`) marks what the agent taught itself versus what a human confirmed — so you can trust, review, or decay agent-written facts differently. → [Provenance](/guide/provenance) ## Why the store matters more than the trigger The trigger (a hook, a cron, an end-of-task step) is easy. What makes the loop *safe* is that it writes into a store that **validates, addresses, and attributes** every fact — so more usage makes the knowledge base sharper, not noisier. A learning loop over unstructured files amplifies drift; a learning loop over a structured brain compounds quality. Because every agent on the same brain reads the same store, one agent's learning becomes every agent's context. The loop isn't just self-improving — it's *fleet*-improving. → [connected knowledge layer](/why-open-index) ## Checklist * [ ] Learnings are written as validated, addressed entities — not appended text. * [ ] New facts update existing records instead of accumulating. * [ ] Write-back is triggered automatically (hook / end-of-session). * [ ] Agent-asserted vs human-verified facts are distinguishable via provenance. * [ ] Agent-written facts are subject to review and/or decay. See how every piece fits into building an autonomous agent. # The harness for autonomous agents Source: https://open-index.io/guide/the-harness The control-flow scaffolding around the model — soft gates, critic sub-agents, in-session evals — and where the context layer fits. The model is the engine. The **harness** is everything around it that turns a capable-but-erratic engine into a reliable system: the control flow, the guardrails, the retries, the sub-agents, and the evals. A strong harness is often the difference between an agent that demos and one that ships. The [context layer](/why-open-index) is *one component* of the harness — a critical one, but not the whole thing. This page covers the rest, and how it wraps the context layer. ## Components that earn their keep ### Soft gates against early exits Agents love to declare victory early — returning a partial answer, skipping a verification step, or stopping before the task is actually done. A **soft gate** is a checkpoint that asks "are the exit conditions genuinely met?" before the agent is allowed to finish, and sends it back if not. Unlike a hard rule, a soft gate is itself a judgment step — it can reason about whether the work is complete for *this* task, which is what makes it robust to fuzzy, non-repeated workflows (the same ones where agents otherwise stall — see [Drill-down limitations](/why-open-index)). ### Critic sub-agents for in-session evals A second agent whose only job is to **attack the first agent's output** before it reaches the user: does the reasoning follow from the retrieved context? Is any claim unsupported? Did it use stale or conflicting knowledge? Running evals *in-session* — not just offline on a benchmark — catches failures at the moment they happen, when they're still cheap to fix. Independent critics also counter the single-model failure mode where the agent is confidently wrong and has no mechanism to notice. ### Retrieval as a tool, not a preamble The harness should give the agent a **search tool** and let it discover context, rather than pre-computing context and stuffing it into the prompt. This is both a harness decision and a context-layer decision — covered in [Context search accuracy](/guide/context-search-accuracy). ## How the pieces compose ``` ┌─────────────────────────────────────────────┐ │ Harness │ │ │ │ soft gates ─┐ ┌─ critic sub-agents │ │ ▼ ▼ │ │ ┌────────────────┐ │ │ task ───▶ │ agent loop │ ───▶ output │ │ └────────────────┘ │ │ │ ▲ │ │ search │ │ facts + provenance │ │ ▼ │ │ │ ┌────────────────┐ │ │ │ context layer │ ◀── the brain │ │ └────────────────┘ │ └─────────────────────────────────────────────┘ ``` The context layer is the agent's memory and knowledge; the harness is its judgment and self-control. You need both — a perfect harness over a poisoned context layer still ships confident nonsense, and a perfect context layer under a naive harness still exits early and never checks its work. ## Where to start If you're building a domain agent from scratch, the highest-leverage order is usually: Structured, searchable, attributable context removes the largest class of failures. Start at [Why Open Index](/why-open-index). One sub-agent reviewing outputs against retrieved context catches most of what slips through. Stop early exits on the fuzzy, multi-step tasks where autonomy matters most. Let the agent write back what it learns. See [Self-learning loops](/guide/self-learning-loops). # What are autonomous agents? Source: https://open-index.io/guide/what-are-autonomous-agents A working definition of autonomous agents, the human-in-the-loop spectrum, and what it actually takes to remove the human. An **autonomous agent** is a system that pursues a goal by repeatedly deciding its own next action — choosing tools, gathering information, and adapting — rather than executing a fixed script. The word doing the work is *deciding*: a workflow follows steps you wrote; an agent chooses steps you didn't. ## The autonomy spectrum "Autonomous" is not binary. Most real systems sit somewhere on a spectrum defined by **how often a human has to intervene**: | Level | The human… | Example | | ---------- | -------------------------------------- | ------------------------------------ | | Assisted | drives; the agent suggests | Autocomplete, copilots | | Supervised | approves each meaningful action | "Agent proposes, human clicks run" | | Steered | is pulled in when the agent gets stuck | Most "agents" in production today | | Autonomous | reviews outcomes, not steps | Handles the whole task, reports back | The jump that creates business value is **Steered → Autonomous** — and the thing that blocks it is almost never raw model capability. It's the context layer and the harness around the model. See [Human steering](/guide/human-steering). ## Removing the human in the loop "Remove the human" is a misleading goal if it means *no human ever*. The right goal is to **move the human from the inner loop to the outer loop** — from approving every step to reviewing outcomes and correcting the system. Three things have to be true before that's safe: No pre-injection, no human deciding what to paste in. The agent searches and discovers. See [Context search accuracy](/guide/context-search-accuracy). Facts are current, non-conflicting, and carry provenance, so an outcome can be audited without a human reconstructing what the agent "must have" used. See [Provenance](/guide/provenance) and [Conflicts & staleness](/guide/conflicts-and-staleness). Soft gates stop early exits; critic sub-agents catch bad reasoning in-session, before it reaches the user. See [The harness](/guide/the-harness). Get those three right and the human's job shifts from *steering* to *supervising the system* — which is where autonomy actually pays off. ## Domain agents raise the bar General agents can lean on the model's world knowledge. **Domain agents** — legal, healthcare, sales, infrastructure — can't: the knowledge they need is private, structured, and changing. That's exactly why the context layer matters more the more specialized the agent is, and why a [structured context engine](/why-open-index) tends to be the highest-leverage investment for a domain agent. What sits around the model to make the loop reliable. # Creating a brain Source: https://open-index.io/guides/creating-a-brain Scaffold a brain, define doc_types, and author entities step by step. `open-index init ` scaffolds a brain directory; then you author two kinds of file — **doc\_types** (schemas) and **entities** (instances). ``` my-brain/ brain.yaml # name + storage/search backend doc_types/*.yaml # one schema per doc_type entities/**/*.json # entities, with related_to edges connectors/*.py # optional ingestion scripts ``` ## 1. Define a doc\_type A doc\_type is a concept plus its schema — one YAML file in `doc_types/`: ```yaml doc_types/service.yaml theme={null} doc_type: service description: A deployed service. storage: file # file = git source of truth · index = DB-owned (default) display: label_field: name color: "#7c3aed" schema: fields: - { name: name, type: string, search: syntactic, boost: 6 } # weighted 6× in ranking - { name: description, type: text, search: semantic } - { name: owner, type: string, search: syntactic } relationships: # the correlations this type uses — optional but recommended - { name: "writes to", target_doc_type: datastore } - { name: "is monitored by", target_doc_type: dashboard } ``` * **`boost`** sets per-field search weight — a hit in a `boost: 6` title outranks a `boost: 1` description hit 6-to-1. Optional; defaults to 1. * **`relationships`** declares the edge vocabulary so correlations are discoverable (shown in the UI + navigation guide) and lightly validated (right target type). Optional — entities may still use undeclared meanings. Create one with `open-index add-doc-type service` (writes a stub you edit), or ask your agent. ## 2. Add entities An entity is one instance. For `storage: file` types, write one JSON per entity under `entities//`: ```json entities/service/checkout.json theme={null} { "doc_type": "service", "id": "service:checkout", "name": "Checkout", "owner": "payments-team", "related_to": [ { "target": "datastore:postgres-main", "relationship_edge_meaning": "writes to" }, { "target": "dashboard:checkout-latency", "relationship_edge_meaning": "is monitored by" } ] } ``` * `id` must be `:`. * **`related_to`** is the reserved correlation field present on **every** entity — it defines the graph edges (`target` + `relationship_edge_meaning`). This is how you say "this ticket is about that service" without any graph database. Then load and validate: ```bash theme={null} open-index index # loads file-backed entities open-index validate # validates brain.yaml, schemas, and every entity file ``` ## 3. Explore `open-index ui` opens a read-only explorer. The sidebar always shows every doc\_type with its count and storage policy, so the structure is visible without navigating anywhere. Four tabs: Search + browse + drill into an entity's relationships. Auto-anchored on the most-connected entities — click any node to expand it. What context CLI/MCP/UI clients fetched, and how often. Zero-result searches show what to model next. Connectors and their schedules. ## Next Manual, bulk import, connectors, and agent write-back. Field search kinds, boosts, and semantic weighting. # Entity management Source: https://open-index.io/guides/entity-management How often to create entities, how many, and how to keep a brain from filling with noise. A doc\_type is the type of object you store; an entity is an actual instance of it. Once you can create entities, the question becomes *how many* and *how often* — because a brain's quality depends as much on what you leave out as what you put in. ## Recommendation on cadence Typically, create doc\_types whose new instances are added at a **human pace** (once a day, once a week) rather than a real-time pace. Deployments change at a non-real-time pace — a great doc\_type to track. Pods are ephemeral. An entity per pod churns the brain with no lasting value. The same logic scales the `customer` doc\_type: an entity per customer is a poor fit for a B2C company, but reasonable for B2B enterprise sales where the customer count is in the thousands. ## Why not create too many entities Over-populating a brain has two costs: 1. **Bloat and noise** — more entities means more low-signal hits diluting search. 2. **Stale-data overhead** — removing entities that no longer matter gets challenging over time. ## Exception: valuable temporal data Some temporal data is worth keeping centrally — for example, **alerts and deployments** in a brain used for AI troubleshooting. In those cases, model the data so it **decays exponentially with time**. That way, flushing old data doesn't hurt the brain's quality — the recent, relevant slice always dominates. ## How entities get created * Manual entry / upload from the UI. * Talking to an agent connected to the brain via CLI / MCP. * A webhook or API trigger from a script on your end. * A recurring cron defined in the brain configuration. For each MCP server you add as a source, you define what data to extract and which doc\_type to store it in, then run it once to generate the entities — optionally on a schedule. See [Populating entities](/guides/populating-entities) and [Connectors](/agents/connectors). # Populating entities Source: https://open-index.io/guides/populating-entities Four ways to add entities to a brain, all landing in one validated store. There are four ways to populate a brain, and they all write through the same validated store that honors each doc\_type's storage policy. Write JSON directly, or open Claude Code in the folder and let it call `put_entity` / `create_doc_type` over MCP. Import a file directly, or let an agent write a batch in one call with `put_entities`. `connectors/*.py` pull from an MCP server on a `schedule`; run with `open-index ingest ` or `open-index run`. A Stop hook that records learnings via `put_entity` — the "continuously improving" loop. ## Bulk import ```bash theme={null} open-index import issues.csv --doc-type issue --asserted-by import:jira open-index import export.jsonl --dry-run # validate first, write nothing ``` JSON arrays, JSONL, and CSV all work: * Bare slugs are qualified (`checkout` → `product:checkout`). * CSV scalars are coerced to their declared types. * A `related_to` column takes `target|meaning` pairs separated by `;`. * A bad row is reported and skipped — the rest still land. * `--asserted-by` / `--confidence` attribute the whole batch once instead of per row. ## Ways to create entities Create a JSON object representing the entity you want to store, and add it from the explorer. Talk to an agent connected to the brain; it validates and writes for you. A script on your end pushes entities into the brain. A connector defined in the brain configuration runs on a schedule. ## Distilling from unstructured documents To extract or distill information from unstructured documents into entities: * **Git repo knowledge bases** — connect an agent to the brain via an MCP server and prompt it to extract information from the repo. * **Commercial tools** (Notion, Confluence, …) — connect an agent to both the brain (via MCP) and the source tool (via MCP server / CLI). * **Scripted** — use a script that connects to the brain via an API and extracts information from documents. For distilled knowledge from an existing knowledge base, the recommendation is to connect that source's MCP server to a Claude Code instance also connected to the brain. ## Next Read [Entity management](/guides/entity-management) for guidance on cadence, scale, and decay — the difference between a brain that stays sharp and one that fills with noise. # Search configuration Source: https://open-index.io/guides/search-configuration Where entities live, which engine stores them, and how search behaves. Three decisions, in the order you'll hit them: 1. [Where each doc\_type's entities live](#1-where-entities-live-file-vs-index) — `storage: file | index` 2. [Which engine stores and searches them](#2-which-engine-sqlite-vs-opensearch) — `search.backend` 3. [How search behaves](#3-tuning-search) — field `search` kind, `boost`, `semantic_weight` The first is per **doc\_type** and is the one people get wrong. The other two are per **brain**. ## 1. Where entities live: `file` vs `index` Set on each doc\_type, in `doc_types/.yaml`: ```yaml theme={null} doc_type: service storage: file # or: index ``` | | `storage: file` | `storage: index` (default) | | --------------------------- | ----------------------------------- | -------------------------------------- | | Source of truth | JSON under `entities//` | The search DB | | In git? | Yes — reviewable in PRs | No | | Written by `put_entity`? | Writes a JSON file | DB only, no file | | `open-index index` | Deletes and reloads these from disk | Leaves them alone | | Survives losing `brain.db`? | Yes, reload from git | **No** — re-ingest or restore a backup | **Pick `file` when** a human or agent authors the entity and you want the change reviewable: services, runbooks, products, policies. Curated knowledge belongs in git. **Pick `index` when** the data is generated, high-volume, or temporal: alerts, deployments, memories, anything a connector pulls on a schedule. Hundreds of rows churning through git helps nobody. **The trap:** `open-index index` reconciles file-backed types *from disk*. If a doc\_type is `file` and you wrote entities to it only via the DB, the next `index` run deletes them. Conversely, JSON files for an `index` type are ignored. Match how a type is written to how it's declared. Changing the policy later is fine, but move the data with it — switch to `file` and the existing DB rows will be wiped on the next `index` unless you export them to JSON first. ## 2. Which engine: SQLite vs OpenSearch One key decides both storage and search: ```yaml theme={null} search: backend: sqlite # or: opensearch ``` There is no `storage.backend`. `storage:` only sets the SQLite file path. (Older brains that set `storage.backend` still load; it never did anything, and now logs a warning.) | | SQLite (default) | OpenSearch | | --------------------- | ------------------------------------------ | ----------------------- | | External services | None — one `brain.db` | A cluster | | Concurrent writers | **One** | Many | | Semantic search | Brute-force cosine, fine to \~10k entities | Native k-NN | | Fuzzy / typo-tolerant | No | Yes | | Per-field boosting | Computed in Python | Native | | Set up for you | — | In `docker-compose.yml` | **The line is writers, not size.** SQLite is single-writer: the moment a second agent (or a connector running while an agent writes) needs to write, move to OpenSearch. Entity count matters only for semantic search, where SQLite scans brute-force. Switch per environment without editing `brain.yaml`: ```bash theme={null} export OPEN_INDEX_SEARCH_BACKEND=opensearch export OPEN_INDEX_OPENSEARCH_HOSTS=https://opensearch.internal:9200 ``` Or commit it, keeping secrets as `${ENV}` refs resolved at connect time: ```yaml theme={null} search: backend: opensearch hosts: ["https://opensearch:9200"] index: open_index_acme # defaults to open_index_ username: "${OPENSEARCH_USER}" password: "${OPENSEARCH_PASSWORD}" use_ssl: true verify_certs: true ``` Running it in containers → [Deployment](/deployment). ### Environment overrides | Variable | Overrides | | ----------------------------- | -------------------------------- | | `OPEN_INDEX_SEARCH_BACKEND` | `search.backend` | | `OPEN_INDEX_OPENSEARCH_HOSTS` | `search.hosts` (comma-separated) | | `OPEN_INDEX_OPENSEARCH_INDEX` | `search.index` | | `OPEN_INDEX_DB_PATH` | `storage.path` | Empty values don't override, so `docker compose` passing an unset variable through as `""` leaves the file's value alone. ## 3. Tuning search ### Per field ```yaml theme={null} schema: fields: - { name: name, type: string, search: syntactic, boost: 6 } - { name: description, type: text, search: semantic } - { name: internal_id, type: string, search: none } ``` | Key | Values | Meaning | | ------------ | ---------------------------------------------- | -------------------------------------------- | | `type` | `string` `text` `number` `boolean` `timestamp` | Data type. Validated on write. | | `processing` | `keyword` `text` `timestamp` | `keyword` = exact/filter, `text` = tokenized | | `search` | `syntactic` `semantic` `none` | How (and whether) the field is searched | | `boost` | number > 0, default 1 | Ranking weight | | `required` | `true` / `false` | Reject entities missing it | * **`syntactic`** — keyword and prefix matching. Right for names, owners, statuses, anything you'd filter on. * **`semantic`** — the field is embedded and matched by meaning, so "checkout is slow" finds an entity that says "latency spike at payment". Right for prose. * **`none`** — stored but never searched. Right for opaque ids and blobs that would only add noise. **`boost` is a genuine multiplier.** A match in a `boost: 6` field outranks one in a `boost: 1` field 6-to-1 — not approximately. The usual shape is a high boost on `name`, a moderate one on a summary, and 1 everywhere else. ### Per brain ```yaml theme={null} search: semantic_weight: 0.3 # 0 = keyword only · 1 = semantic only embedding_model: BAAI/bge-small-en-v1.5 ``` `semantic_weight` blends the two scores. The default `0.3` keeps keyword matches dominant and lets semantic similarity rescue queries that use different words than the text. Raise it if your users describe things rather than name them; set `0` to turn vectors off at query time. ### Embeddings Semantic search needs a provider. Without one the backends log a warning once and fall back to keyword-only — search still works, just less well. ```bash theme={null} pip install 'open-index[semantic]' # local ONNX, BAAI/bge-small-en-v1.5 (384-D) ``` Or point at any OpenAI-compatible API: ```bash theme={null} export OPEN_INDEX_EMBEDDING_BASE_URL=https://api.openai.com/v1 export OPEN_INDEX_EMBEDDING_API_KEY=... export OPEN_INDEX_EMBEDDING_MODEL=text-embedding-3-small export OPEN_INDEX_EMBEDDING_DIM=1536 ``` **Re-embed after any change that invalidates existing vectors** — enabling semantic search on a populated brain, switching models, or changing dimensions: ```bash theme={null} open-index index --reembed ``` Changing dimensions on OpenSearch also needs the index recreated, since the `knn_vector` mapping is fixed at creation. ## Worked examples **Local, single agent, curated knowledge** — the default. SQLite, `storage: file` on everything, semantic on prose fields. ```yaml theme={null} storage: { path: ./brain.db } search: { backend: sqlite, semantic_weight: 0.3 } ``` **Shared team brain with connectors** — OpenSearch (several writers), curated types in git, pulled types DB-only. ```yaml theme={null} search: backend: opensearch hosts: ["https://opensearch.internal:9200"] username: "${OPENSEARCH_USER}" password: "${OPENSEARCH_PASSWORD}" ``` ```yaml theme={null} # doc_types/runbook.yaml → curated, reviewed in PRs storage: file # doc_types/alert.yaml → pulled every 15m, would drown git storage: index ``` **Exact-match lookup only** — no embedding dependency at all: ```yaml theme={null} search: { backend: sqlite, semantic_weight: 0 } ``` ## Troubleshooting | Symptom | Cause | | ---------------------------------------------------- | ---------------------------------------------------------------------------------------------- | | Entities vanish after `open-index index` | They were DB-written to a `storage: file` type. Files are the source of truth there. | | JSON files are ignored | The doc\_type is `storage: index`; the DB owns it. | | "Semantic fields declared but no embedding provider" | Install `open-index[semantic]` or set `OPEN_INDEX_EMBEDDING_*`. | | Semantic search returns nothing sensible | Vectors were never built. Run `open-index index --reembed`. | | `database is locked` | Two writers on SQLite. Move to OpenSearch. | | Semantic search slow past \~10k entities | SQLite scans brute-force. Move to OpenSearch. | | Ranking ignores your important field | Check its `search` isn't `none`, and raise its `boost`. | | `unknown search backend` | Typo in `search.backend` or `OPEN_INDEX_SEARCH_BACKEND`. Only `sqlite` and `opensearch` exist. | # Open Index Source: https://open-index.io/index Build domain-specific, structured context that agents can actually operate on — and keep it correct as things change. **Open Index** is a tool for building domain-specific, accurate, structured data that agents can actually operate on — and for keeping that data correct as things change. You use Open Index to build a **brain**: a searchable, continuously-improving context graph of your domain. A brain is **domain-agnostic** — model a support org (`product → "has common issue" → issue`), a sales pipeline (`customer → order`), your infrastructure (`service → runbook`), or anything else. You define the concepts; Open Index stores them, searches them, and draws the map.