Skip to content

ldclabs/KIP

Repository files navigation

๐Ÿงฌ KIP (Knowledge Interaction Protocol)

English | ไธญๆ–‡

A graph-oriented interaction protocol designed specifically for Large Language Models,
bridging the gap between LLM and Knowledge Graph.


What is KIP?

KIP (Knowledge Interaction Protocol) is a standard interaction protocol that bridges the gap between LLM (Probabilistic Reasoning Engine) and Knowledge Graph (Deterministic Knowledge Base). It is not merely a database interface, but a set of memory and cognitive operation primitives designed specifically for intelligent agents.

Large Language Models (LLMs) have demonstrated remarkable capabilities in general reasoning and generation. However, their "Stateless" essence results in a lack of long-term memory, while their probability-based generation mechanism often leads to uncontrollable "hallucinations" and knowledge obsolescence.

KIP was born to solve this problem through Neuro-Symbolic AI approach.

Key Benefits

  • ๐Ÿง  Memory Persistence: Transform conversations, observations, and reasoning results into structured "Knowledge Capsules"
  • ๐Ÿ“ˆ Knowledge Evolution: Complete CRUD and metadata management for autonomous learning and error correction
  • ๐Ÿ” Explainable Interaction: Make every answer traceable and every decision logically transparent
  • โšก LLM-Optimized: Protocol syntax optimized for Transformer architectures with native JSON structures

Quick Start

// Query: Find all drugs that treat headache
FIND(?drug.name)
WHERE {
  ?drug {type: "Drug"}
  (?drug, "treats", {name: "Headache"})
}
LIMIT 10
// Store: Create a new knowledge capsule
UPSERT {
  CONCEPT ?aspirin {
    {type: "Drug", name: "Aspirin"}
    SET ATTRIBUTES { molecular_formula: "C9H8O4", risk_level: 2 }
    SET PROPOSITIONS { ("treats", {type: "Symptom", name: "Headache"}) }
  }
}
WITH METADATA { source: "FDA", confidence: 0.95 }
// Explore: Discover schema
DESCRIBE PRIMER

Documentation

Document Description
๐Ÿ“– Specification Complete KIP protocol specification (English)
๐Ÿ“– ่ง„่Œƒๆ–‡ๆกฃ ๅฎŒๆ•ด็š„ KIP ๅ่ฎฎ่ง„่Œƒ (ไธญๆ–‡)
๐Ÿค– Agent Instructions Operational guide for AI agents using KIP
โš™๏ธ System Instructions System-level maintenance and hygiene guide
๐Ÿ“‹ Function Definition execute_kip function schema for LLM integration

Core Concepts

Cognitive Nexus

A knowledge graph composed of Concept Nodes and Proposition Links, serving as the AI Agent's unified memory brain.

graph LR
    subgraph "Cognitive Nexus"
        A[Drug: Aspirin] -->|treats| B[Symptom: Headache]
        A -->|is_class_of| C[DrugClass: NSAID]
        A -->|has_side_effect| D[Symptom: Stomach Upset]
    end
Loading

KIP Instruction Sets

Instruction Set Purpose Examples
KQL (Query) Knowledge retrieval and reasoning FIND, WHERE, FILTER
KML (Manipulation) Knowledge evolution and learning UPSERT, DELETE
META (Discovery) Schema exploration and grounding DESCRIBE, SEARCH

Schema Bootstrapping

KIP uses a self-describing schema where type definitions are stored within the graph itself:

  • $ConceptType: Meta-type for defining concept node types
  • $PropositionType: Meta-type for defining proposition predicates
  • Domain: Organizational units for knowledge

Resources

This repository includes ready-to-use resources for building KIP-powered AI agents:

๐Ÿ“ฆ Knowledge Capsules (capsules/)

Pre-built knowledge capsules for bootstrapping your Cognitive Nexus:

Capsule Description
Genesis.kip Foundational capsule that bootstraps the entire type system
Person.kip Person concept type for actors (AI, Human, Organization)
Event.kip Event concept type for episodic memory
persons/self.kip The $self concept instance
persons/system.kip The $system concept instances

๐Ÿ”Œ MCP Server (mcp/)

kip-mcp-server - Model Context Protocol server that exposes KIP tools over stdio:

  • Tools: execute_kip, list_logs
  • Resources: kip://docs/SelfInstructions.md, kip://docs/KIPSyntax.md
  • Prompt: kip_bootstrap for ready-to-inject system prompt

๐ŸŽฏ Agent Skills (skill/)

kip-cognitive-nexus - Publishable skill for AI agents:

  • Python client script for anda_cognitive_nexus_server
  • Complete syntax reference and agent workflow guide

๐Ÿง  Hippocampus (hippocampus/)

A dedicated LLM layer that manages the Cognitive Nexus on behalf of business agents โ€” no KIP knowledge required:

File Description
HippocampusFormation.md System prompt for memory encoding (messages โ†’ structured knowledge)
HippocampusRecall.md System prompt for memory retrieval (natural language โ†’ KIP โ†’ answer)
HippocampusMaintenance.md System prompt for memory maintenance (sleep mode)
RecallFunctionDefinition.json recall_memory function schema for business agent integration
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Business Agent    โ”‚  โ† No KIP knowledge needed
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚ Natural Language
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚    Hippocampus      โ”‚  โ† Formation / Recall / Maintenance
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚ KIP (KQL/KML/META)
         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Cognitive Nexus    โ”‚  โ† Persistent Knowledge Graph
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Implementations

Project Description
Anda KIP SDK Rust SDK for building AI knowledge memory systems
Anda Cognitive Nexus Rust implementation of KIP based on Anda DB
Anda Hippocampus Autonomous Graph Memory for AI Agents
Anda Cognitive Nexus Python Python binding for Anda Cognitive Nexus
Anda Cognitive Nexus HTTP Server An Rust-based HTTP server that exposes KIP via a small JSON-RPC API (GET /, POST /kip)
Anda App AI Agent client app based on KIP

Version History

Version Date Changes
v1.0-RC4 2026-03-09 v1.0 Release Candidate 4: Added IN, IS_NULL, IS_NOT_NULL FILTER operators; clarified UNION variable scope semantics; defined batch response structure; added temporal and UNION query examples
v1.0-RC3 2026-01-09 v1.0 Release Candidate 3๏ผšOptimized documentation; optimized instructions; optimized knowledge capsules
v1.0-RC2 2025-12-31 Parameter placeholder prefix changed to :; batch command execution
... ... ...
v1.0-draft1 2025-06-09 Initial Draft

Full version history โ†’

About Us

License

Copyright ยฉ 2025 LDC Labs.

Licensed under the MIT License. See LICENSE for details.

About

๐Ÿงฌ KIP is a Knowledge-memory Interaction Protocol designed for LLMs, aiming to build a sustainable learning and self-evolving memory system for AI Agents.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors