Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 69 additions & 33 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,78 @@
},
"favicon": "/favicon.svg",
"navigation": {
"groups": [
"tabs": [
{
"group": "Get Started",
"pages": [
"index",
"quickstart",
"concepts",
"use-cases"
"tab": "Documentation",
"groups": [
{
"group": "Get Started",
"pages": [
"index",
"why-open-index",
"quickstart",
"concepts",
"use-cases"
]
},
{
"group": "Build a Brain",
"pages": [
"guides/creating-a-brain",
"guides/populating-entities",
"guides/entity-management",
"guides/search-configuration"
]
},
{
"group": "Agents & Connectors",
"pages": [
"agents/mcp",
"agents/connectors"
]
},
{
"group": "Deploy",
"pages": [
"deployment"
]
},
{
"group": "Reference",
"pages": [
"reference/cli"
]
}
]
},
{
"group": "Build a Brain",
"pages": [
"guides/creating-a-brain",
"guides/populating-entities",
"guides/entity-management",
"guides/search-configuration"
]
},
{
"group": "Agents & Connectors",
"pages": [
"agents/mcp",
"agents/connectors"
]
},
{
"group": "Deploy",
"pages": [
"deployment"
]
},
{
"group": "Reference",
"pages": [
"reference/cli"
"tab": "Agent Guide",
"groups": [
{
"group": "Foundations",
"pages": [
"guide/index",
"guide/what-are-autonomous-agents",
"guide/the-harness"
]
},
{
"group": "Context Engineering",
"pages": [
"guide/context-poisoning",
"guide/context-search-accuracy",
"guide/conflicts-and-staleness",
"guide/provenance"
]
},
{
"group": "Autonomy",
"pages": [
"guide/human-steering",
"guide/determinism",
"guide/self-learning-loops"
]
}
]
}
]
Expand All @@ -62,7 +98,7 @@
],
"primary": {
"type": "button",
"label": "GitHub",
"label": "Star on GitHub",
"href": "https://github.com/DrDroidLab/open-index"
}
},
Expand Down
85 changes: 85 additions & 0 deletions docs/guide/conflicts-and-staleness.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
title: How to avoid staleness and conflicts in your knowledge window
description: 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:

<Steps>
<Step title="One record per fact, addressed by id">
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)
</Step>
<Step title="Incremental update and delete per doc_type">
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)
</Step>
<Step title="Explicit edges instead of implied links">
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)
</Step>
</Steps>

## 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.

<Warning>
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)
</Warning>

## 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.

<Card title="Next: Provenance" icon="fingerprint" href="/guide/provenance">
Making every fact traceable to its source.
</Card>
90 changes: 90 additions & 0 deletions docs/guide/context-poisoning.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
title: How to reduce context poisoning in your agents
description: 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.

<Warning>
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.
</Warning>

## The fix: structure the model, shrink the surface

Three shifts move context poisoning from "constant" to "rare":

<Steps>
<Step title="Structured documents, not prose">
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)
</Step>
<Step title="Retrieve narrow, not broad">
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)
</Step>
<Step title="Make correlations explicit and typed">
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)
</Step>
</Steps>

## 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
{
"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.

<Note>
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.
</Note>

## 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.

<Card title="Next: Context search accuracy" icon="magnifying-glass" href="/guide/context-search-accuracy">
Making the agent's own retrieval reliable.
</Card>
86 changes: 86 additions & 0 deletions docs/guide/context-search-accuracy.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
title: How to improve context search accuracy
description: 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.

<Info>
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.
</Info>

## 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:

<AccordionGroup>
<Accordion title="Per-field boosts" icon="sliders">
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)
</Accordion>
<Accordion title="Hybrid keyword + semantic" icon="layer-group">
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.
</Accordion>
</AccordionGroup>

## 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.

<Card title="Next: Conflicts & staleness" icon="code-merge" href="/guide/conflicts-and-staleness">
Keeping retrieved context correct as it grows.
</Card>
Loading
Loading