
Bridges the gap between LLM probabilistic reasoning and deterministic knowledge graphs through a graph-oriented query language. Exposes KQL for queries (FIND, WHERE, FILTER), KML for knowledge manipulation (UPSERT, DELETE), and META instructions for schema discovery. Think of it as giving your LLM a persistent memory layer where conversations and observations become structured "Knowledge Capsules" stored in a Cognitive Nexus graph. The protocol returns JSON and uses Prolog-style syntax optimized for Transformer models. Reach for this when you need explainable AI interactions, long-term memory across sessions, or want to eliminate hallucinations by grounding responses in a queryable knowledge base. Includes pre-built capsules for bootstrapping and a Hippocampus layer that lets business agents use natural language without knowing KIP syntax.
The open experience learning protocol for AI agents —
turning interaction into memory, knowledge, skill, and better action.
KIP 2.0 is in draft — start here → Belief becomes an explicit projection over competing assertions instead of a stored field, evidence and provenance become first-class elements, and a proactivity layer lets a Brain act on a state differential rather than a timer:
Watch,action_gate,LIST DEPENDENTS,PURGE PAYLOAD. v1.0-RC11 below remains the shipping contract; two independent engines — Rust and Cloudflare Durable Objects — already track the draft.
An intelligence that cannot accumulate experience cannot truly learn.
Today's AI can reason brilliantly inside one session and still repeat the same mistake tomorrow. Larger context windows postpone forgetting; vector retrieval can return related text. Neither, by itself, explains what the agent was trying to achieve, which action changed the situation, where reality contradicted expectation, or how the past should change the next action.
KIP is an open protocol for the whole learning loop:
Experience → Memory → Knowledge → Skill → Action
▲ │
└────────────── new feedback ──────────┘
The protocol connects two complementary kinds of machine intelligence:
The model interprets and acts; the graph preserves and reorganizes what matters; KIP is the language through which the past changes the future. It is not a database driver. It provides cognitive primitives for remembering, replaying, associating, reinforcing, correcting, consolidating, compiling skills, and forgetting.
$self can retain identity, values, lessons, commitments, and a history of changed behavior.The Cognitive Nexus is a graph. Concept Nodes are the things worth remembering; Proposition Links are typed assertions connecting them. Assertions can themselves be subjects or objects, so KIP can represent provenance, attribution, disagreement, and evolving belief.
The LLM operates the graph through three compact instruction sets:
| Instruction set | Purpose | Statements |
|---|---|---|
| KQL | Retrieval and graph reasoning | FIND, WHERE, FILTER |
| KML | Formation, correction, and evolution | UPSERT, UPDATE, MERGE, DELETE |
| META | Grounding, discovery, and portability | DESCRIBE, SEARCH, EXPORT |
Remember a fact with provenance:
UPSERT {
CONCEPT ?dark_mode {
{type: "Preference", name: "Dark Mode"}
SET ATTRIBUTES { description: "Prefers dark UI themes in all apps" }
}
CONCEPT ?alice {
{type: "Person", name: "Alice"}
SET PROPOSITIONS { ("prefers", ?dark_mode) }
}
}
WITH METADATA {
source: "conversation:2026-06-11",
author: "$self",
confidence: 0.95,
memory_strength: 0.80
}
Recall the strongest current assertions:
FIND(?pref.name, ?link.metadata.confidence, ?link.metadata.memory_strength)
WHERE {
?alice {type: "Person", name: "Alice"}
?link (?alice, "prefers", ?pref)
FILTER(IS_NULL(?link.metadata.superseded) || ?link.metadata.superseded == false)
}
ORDER BY ?link.metadata.memory_strength DESC, ?link.metadata.confidence DESC
LIMIT 10
Associate without knowing the schema in advance:
FIND(?predicate, ?neighbor)
WHERE {
?link ({type: "Person", name: "Alice"}, ?predicate, ?neighbor)
}
LIMIT 50
When an agent wakes inside a graph it has never seen, DESCRIBE PRIMER tells it who it is, which domains exist, and which types and predicates it can use. The graph describes itself.
KIP Core remains a general graph protocol. Experience learning is an additive, self-described Cognitive Memory Profile built with ordinary KIP capsules. No KQL, KML, or META syntax changes are required.
| Concept | Canonical question | Representation |
|---|---|---|
Event | What happened? | Time-bounded occurrence or interaction summary |
Experience | What goal was pursued, what changed, and what was learned? | Goal-directed trajectory |
ExperienceStep | What was observed, decided, done, or returned at this point? | Ordered trajectory record |
Insight | What declarative lesson should be remembered? | Self-contained reflective knowledge |
Skill | In this kind of state, what policy should guide action? | Procedural memory |
An Event and an Experience may refer to the same real-world interval, but they are not interchangeable. Event is observer-oriented; Experience is subject-oriented. A conversation with no meaningful goal/action/feedback dynamics should remain an Event. A deployment attempt with hypotheses, tool actions, failures, revised state, and a terminal outcome should be an Experience.
Memory, Knowledge, and Action name functional roles in the learning loop, not mandatory universal Concept Types. Domain capsules define concrete semantic types; the Experience Learning Profile adds three Concept Types (Experience, ExperienceStep, Skill) and four Proposition Types (has_step, caused_by, derived_insight, compiled_to).
graph LR
X["Experience"] -->|"has_step"| S1["ExperienceStep 0<br/>observation"]
X -->|"has_step"| S2["ExperienceStep 1<br/>action"]
X -->|"has_step"| S3["ExperienceStep 2<br/>feedback"]
S3 -->|"caused_by"| S2
X -->|"consolidated_to"| K["Knowledge"]
X -->|"derived_insight"| I["Insight"]
X -->|"compiled_to"| P["Skill"]
P -->|"conditions"| A["Future action"]
A -->|"creates"| NX["New Experience"]
ExperienceStep.index establishes temporal order. caused_by is optional and explicit: earlier does not mean causal.
Experience becomes especially valuable where the world violates the subject's model:
expected observation → actual observation → prediction error → policy update
ExperienceStep therefore supports expected_observation, actual_observation, and prediction_error. The parent Experience may carry an aggregate surprise_score, which contributes to salience and consolidation priority.
The profile separates three independent signals:
| Signal | Meaning | Typical change |
|---|---|---|
metadata.confidence | How strongly evidence warrants believing an assertion | New evidence, contradiction, correction |
metadata.memory_strength | How accessible a memory currently is and how strongly it competes for recall | Reinforcement, successful reuse, time-based decay |
attributes.salience_score | How urgently an Event or Experience deserves encoding or consolidation | Goal relevance, surprise, outcome magnitude, novelty, emotion, reusability |
A true but rarely useful fact may retain high confidence while its memory strength falls. A vivid new Experience may have high salience and memory strength while its causal interpretation remains low-confidence. Maintenance must never use confidence as a proxy for retrieval frequency or forgetting.
Procedural consolidation compares trajectories instead of summarizing a single transcript:
Skill with trigger conditions, preconditions, procedure, decision rules, success criteria, and failure signals.compiled_to and inverse derived_from provenance.Skill.execution_mode is a capability boundary (advisory, supervised, or autonomous), not permission to bypass an application's authorization or safety policy.
Recall should not stop at “what is related?” Before a consequential action, an Action Briefing can assemble:
This is the functional test for memory: if removing a past item cannot change any relevant future state, prediction, or action, it is archive material rather than active memory.
The following uses only existing KIP Core syntax. Load the profile capsules first.
UPSERT {
CONCEPT ?observe_failure {
{type: "ExperienceStep", name: "Experience:2026-08-13T09:00:deploy-v2:Step:00"}
SET ATTRIBUTES {
index: 0,
kind: "observation",
summary: "The v2 service failed its health check after deployment",
timestamp: "2026-08-13T09:00:00Z",
actual_observation: "health endpoint returned 503"
}
SET PROPOSITIONS { ("belongs_to_domain", {type: "Domain", name: "Unsorted"}) }
}
WITH METADATA {
source: "execution-trace:deploy-v2", author: "$self",
created_at: "2026-08-13T09:10:00Z", observed_at: "2026-08-13T09:00:00Z",
confidence: 0.95, memory_strength: 0.90,
memory_tier: "short-term", expires_at: "2026-09-12T09:10:00Z"
}
CONCEPT ?check_database {
{type: "ExperienceStep", name: "Experience:2026-08-13T09:00:deploy-v2:Step:01"}
SET ATTRIBUTES {
index: 1,
kind: "action",
summary: "Checked the active database target before retrying migration",
timestamp: "2026-08-13T09:03:00Z",
tool: "database-inspector",
expected_observation: "the service points to the migrated database",
actual_observation: "the service points to the old database",
prediction_error: "the assumed migration problem was actually a connection-target problem",
success: true
}
SET PROPOSITIONS { ("belongs_to_domain", {type: "Domain", name: "Unsorted"}) }
}
WITH METADATA {
source: "execution-trace:deploy-v2", author: "$self",
created_at: "2026-08-13T09:10:00Z", observed_at: "2026-08-13T09:03:00Z",
confidence: 0.95, memory_strength: 0.90,
memory_tier: "short-term", expires_at: "2026-09-12T09:10:00Z"
}
CONCEPT ?experience {
{type: "Experience", name: "Experience:2026-08-13T09:00:deploy-v2"}
SET ATTRIBUTES {
experience_class: "problem_solving",
goal: "Deploy service v2 with a healthy database connection",
initial_state: {service_version: "v2", assumed_database: "migrated-primary"},
status: "completed",
outcome: "Corrected the database target and completed the deployment",
success: true,
prediction_error: "The service was connected to the old database, not the migrated primary",
surprise_score: 82,
learning_value: 91,
started_at: "2026-08-13T09:00:00Z",
ended_at: "2026-08-13T09:10:00Z",
consolidation_status: "pending",
salience_score: 86
}
SET PROPOSITIONS {
("involves", {type: "Person", name: "$self"})
("belongs_to_domain", {type: "Domain", name: "Unsorted"})
("has_step", ?observe_failure) WITH METADATA {
source: "execution-trace:deploy-v2", author: "$self",
created_at: "2026-08-13T09:10:00Z", confidence: 0.95,
memory_strength: 0.90, expires_at: "2026-09-12T09:10:00Z"
}
("has_step", ?check_database) WITH METADATA {
source: "execution-trace:deploy-v2", author: "$self",
created_at: "2026-08-13T09:10:00Z", confidence: 0.95,
memory_strength: 0.90, expires_at: "2026-09-12T09:10:00Z"
}
}
}
WITH METADATA {
source: "execution-trace:deploy-v2", author: "$self",
created_at: "2026-08-13T09:10:00Z", observed_at: "2026-08-13T09:10:00Z",
confidence: 0.95, memory_strength: 0.90,
memory_tier: "short-term", expires_at: "2026-09-12T09:10:00Z"
}
}
UPSERT {
CONCEPT ?experience {
{type: "Experience", name: "Experience:2026-08-13T09:00:deploy-v2"}
}
CONCEPT ?skill {
{type: "Skill", name: "Skill:deployment:verify-database-target"}
SET ATTRIBUTES {
skill_class: "diagnostic",
description: "Verify the active database target before treating a deployment failure as a migration failure",
goal: "Distinguish database-target failures from migration failures early",
trigger_conditions: ["new deployment fails startup or health checks", "database schema error is suspected"],
preconditions: ["database target is inspectable"],
procedure: ["read the service's active database target", "compare it with the migrated target", "only then inspect or rerun migrations"],
expected_outcome: "database target mismatch is confirmed or ruled out before mutation",
success_criteria: ["active target identity is verified", "no migration is rerun against an unverified target"],
failure_signals: ["target identity cannot be read", "multiple environments share ambiguous credentials"],
recovery_strategy: "stop and request environment-owner verification",
execution_mode: "supervised",
maturity: "candidate",
evidence_count: 1,
success_count: 1,
failure_count: 0,
last_validated_at: "2026-08-13T09:10:00Z"
}
SET PROPOSITIONS {
("derived_from", ?experience)
("belongs_to_domain", {type: "Domain", name: "Unsorted"})
}
}
WITH METADATA {
source: "ProceduralConsolidation",
author: "$system",
created_at: "2026-08-13T10:00:00Z",
confidence: 0.72,
memory_strength: 0.85
}
PROPOSITION ?compilation {
(?experience, "compiled_to", ?skill)
}
WITH METADATA {
source: "ProceduralConsolidation",
author: "$system",
created_at: "2026-08-13T10:00:00Z",
confidence: 0.72,
memory_strength: 0.85
}
}
┌─────────────────────┐
│ Business Agent │ ← goals, decisions, actions, user interaction
└────────┬────────────┘
│ natural language + structured traces
▼
┌─────────────────────┐
│ Brain │ ← Formation / Recall / Maintenance
└────────┬────────────┘
│ KIP (KQL / KML / META)
▼
┌─────────────────────┐
│ Cognitive Nexus │ ← Event / Experience / Knowledge / Skill / Self
└─────────────────────┘
The Experience Learning Profile is deliberately additive:
id or {type, name}; propositions still use id or (subject, predicate, object).UPSERT and can be safely replayed.involves, mentions, consolidated_to, and derived_from retain all previous valid subject/object combinations while adding Experience-aware ones.KIP Core specifies the protocol. Capsules define the cognitive vocabulary. Anda Brain implements the Experience Learning Loop as agent behavior.
DESCRIBE PRIMER grounds an agent without out-of-band schema knowledge. (Spec §2.9)caused_by links require evidence.EXPORT turns subgraphs into portable, idempotent capsules that users can own and move. (Spec §5.3)Person, Event, Preference, Insight, Commitment, and SleepTask, plus the shared episodic/provenance predicate capsules involves, mentions, consolidated_to, and derived_from.Experience, ExperienceStep, and Skill, then the four Experience-specific predicate capsules. The recommended deterministic order is shown below.execute_kip, or put the Brain layer or MCP server in front of KIP.capsules/Genesis.kip
capsules/Person.kip
capsules/Event.kip
capsules/Preference.kip
capsules/Insight.kip
capsules/Commitment.kip
capsules/SleepTask.kip
capsules/Experience.kip
capsules/ExperienceStep.kip
capsules/Skill.kip
capsules/involves.kip
capsules/mentions.kip
capsules/consolidated_to.kip
capsules/derived_from.kip
capsules/has_step.kip
capsules/caused_by.kip
capsules/derived_insight.kip
capsules/compiled_to.kip
The type capsules precede predicate capsules so schema references are already grounded. All writes are idempotent, so the complete sequence may be replayed. An Event-only deployment loads the core type capsules plus the four shared predicate capsules and stops there; the Experience entries in their subject_types / object_types stay dormant until the profile types are registered.
| Document | Description |
|---|---|
| 📖 Specification | Complete KIP Core protocol specification |
| 📖 规范文档 | KIP Core protocol specification in Chinese |
| 📐 Syntax Reference | Condensed KQL / KML / META syntax for prompts |
| 🧠 Brain Overview | Formation / Recall / Maintenance architecture |
| 🤖 Agent Instructions | $self operational guide |
| ⚙️ System Instructions | $system maintenance guide |
| 📋 Function Definition | execute_kip function schema |
| 🗣 Domain Language | Canonical Experience Learning vocabulary |
capsules/)| Capsule | Description |
|---|---|
| Genesis.kip | Bootstraps the self-describing KIP type system |
| Person.kip | Actors: AI, Human, Organization |
| Event.kip | Objective episodic occurrences |
| Experience.kip | Goal-directed trajectories |
| ExperienceStep.kip | Ordered observation, decision, action, and feedback records |
| Skill.kip | Procedural memory and action-selecting policy |
| involves.kip | Event / Experience → Person participation |
| mentions.kip | Event / Experience → concept non-participant references |
| consolidated_to.kip | Event / Experience → semantic knowledge consolidation |
| derived_from.kip | Inverse provenance back to source Events / Experiences |
| has_step.kip | Experience → ExperienceStep membership |
| caused_by.kip | Evidence-backed causal links between steps |
| derived_insight.kip | Experience → Insight consolidation |
| compiled_to.kip | Experience → Skill procedural consolidation |
| Preference.kip | Stable preference facts |
| Insight.kip | Declarative lessons and self-reflection |
| Commitment.kip | Prospective promises, reminders, and deadlines |
| SleepTask.kip | Maintenance work, including compile_to_skill |
| persons/self.kip | The $self concept instance |
| persons/system.kip | The $system concept instance |
brain/)| File | Description |
|---|---|
| BrainFormation.md | Messages and structured traces → Event / Experience / Knowledge |
| BrainRecall.md | Natural language → associative recall / replay / Action Briefing |
| BrainMaintenance.md | Semantic and procedural consolidation, correction, decay, and forgetting |
| RecallFunctionDefinition.json | Read-only memory interface for business agents |
| Tool | Description |
|---|---|
| kip-mcp-server | MCP bridge from compatible clients to a KIP backend |
| vscode-kip | .kip syntax highlighting, formatting, diagnostics, and folding |
| Project | Description |
|---|---|
| Anda KIP SDK | Rust SDK for KIP applications |
| Anda Cognitive Nexus | Anda DB-based KIP implementation (Rust reference engine) |
| KIP on Durable Objects | KIP 2.0 Cognitive Nexus on SQLite-backed Cloudflare Durable Objects — one Nexus per object; a sibling engine, not a binding |
| Anda Brain | Autonomous memory and experience-learning layer for AI agents |
| Anda Cognitive Nexus Python | Python wrapper over the Rust engine |
| Anda Bot | AI agent built with KIP and Anda Brain |
The next Core revision is being drafted in v2/. It is not released: v1.0-RC11 above remains the shipping contract, and existing clients need to change nothing today.
KIP 2.0 rebuilds Core around five element kinds — Concept, Proposition, Assertion, Evidence, Activity — so that this statement exists and this statement is believed stop being the same fact. Belief becomes an explicit Epistemic Projection (BELIEF / BELIEF SLOT) over competing Assertions, evidence and provenance become first-class elements rather than metadata, and schema moves into versioned, digest-pinned packages. Migrating from 1.x →
It also gives a Brain the half of memory that runs when nobody is asking. Watch is durable attention state evaluated against committed Change Envelopes — including silence watches that fire when nothing arrives in time — so proactivity is a state differential rather than a timer, and firing grants attention, never authority. action_gate records what the gate decided: act, ask, defer, or deliberate silence. LIST DEPENDENTS makes the cognition compiled from a revised root discoverable instead of quietly stale (§57.5). And PURGE PAYLOAD destroys observed bytes while keeping the Evidence record, its digest and its citations — data minimization that costs no provenance. The full picture →
| Document | Description |
|---|---|
| 📖 Specification 2.0 | The normative draft (中文) |
| 🏛 Architecture 2.0 | Design rationale behind the Specification (中文) |
| 📐 Syntax Reference 2.0 | LLM-facing KQL / KML / META card (中文) |
| 🧩 Cognitive Memory Profile 2.0 | Experience, Skill, Commitment, and the rest of the memory types |
| 🧠 Brain 2.0 | Formation / Recall / Maintenance for 2.0 (中文) |
🤖 $self / ⚙️ $system | Compact single-agent prompt pair ($system) |
| 🗂 Design Notes | Ten informative per-subsystem documents |
| 🔤 Grammars & Schemas | Normative EBNF, plus the wire schemas |
| 🧪 Conformance Suite | 298 portable vectors across 13 conformance profiles |
| 🔬 Formal Verification | Alloy and TLA+ models, and what they proved |
Every document in v2/ is bilingual: each X.md has an X_CN.md twin.
KIP Core and Cognitive Memory Profiles evolve independently:
The Experience Learning Profile therefore does not rename KIP or invalidate existing v1.0-RC11 clients. It makes the protocol's learning purpose explicit while preserving every existing Core command.
Full KIP Core version history →
Copyright © 2026 LDC Labs.
Licensed under the MIT License. See LICENSE for details.
KIP_BACKEND_URL*HTTP URL for the KIP backend endpoint
KIP_API_KEYsecretYour API key for the service