Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Memory Links

Links connect loci in the wisdom graph, forming typed relationships that shape how knowledge is retrieved and weighted.

Link Types

Five link types, ordered from weakest to strongest effect:

related_to

General association between two loci. No side effects on confidence scoring. Use when knowledge is connected but does not modify the target.

extends

Adds detail to another locus. No side effects on confidence. The extending locus is returned alongside the target during retrieval.

derived_from

Indicates the source locus was created because of the target. Auto-created for constraint, rule, and constraint_violation events when a context_id is present.

reinforces

Confirms another locus. Each reinforces link increases the target's confidence by +0.05, capped at 1.0. Use when new evidence supports existing knowledge.

contradicts

Conflicts with another locus. Each contradicts link decreases the target's confidence by -0.10, with a floor of 0.2. The target is never fully removed — low-confidence loci are deprioritized in retrieval instead.

Confidence adjustments from reinforces and contradicts are applied during admission. They compound: three reinforces links add +0.15 to the target's confidence.

Link Layers

Links operate across three layers:

LayerConnectsExample
Locus → LocusTwo individual knowledge nodesA decision reinforces a fact
Locus → ContextA node to a context scopeA skill locus extends a session context
Context → ContextTwo context scopesA project context is related_to a skill context

Example: Graduation Chain

Links enable knowledge to evolve. Here is how a mistake graduates into a skill:

  1. Mistake recorded. The agent stores an observation: "Used var instead of const in React component."

  2. Pattern detected. After seeing this twice, the agent stores a fact: "Repeated use of var in React." It links this to the original observation with derived_from.

  3. Skill formed. The agent stores a decision: "Always use const or let in React components." It links this to the pattern with extends and to the original mistake with reinforces — confirming the learned lesson.

observation: "used var"
    ← derived_from ← fact: "repeated var pattern"
        ← extends ← decision: "always use const/let"
            → reinforces → observation: "used var"

The wisdom graph now returns the skill-level decision in retrieval, backed by the full chain of evidence.

Creating Links

Pass links when storing an event:

{
  "event_kind": "fact",
  "source": "agent",
  "payload": { "topic": "const_usage", "value": "always use const in React" },
  "links": [
    { "type": "reinforces", "target": "locus_abc123" },
    { "type": "derived_from", "target": "locus_def456" }
  ]
}

Next

Context Engineering
Design effective context strategies for your agents.
Workflows
Build multi-step knowledge pipelines.