README

README

Cognitive Context Protocol (CCP)

The World’s First Cognitive Architecture for AI Agents

Transform AI from passive context consumers into self-aware, contract-driven cognitive agents.

CCP provides the missing cognitive layer for Large Language Models. It acts as a Hippocampus for episodic memory, a Prefrontal Cortex for meta-cognition, and now a Frontal Lobe Executive for enforced, contract-driven task execution. By tracking confidence, confusion, causal relationships, and now verified execution contracts, CCP enables agents that don’t just retrieve data, but remember, reason, plan, and guarantee outcomes over time.

MCP Compatible
31 Tools
Ollama
Claude Skills
COGP
Version


🌟 The Problem We Solve

Current AI systems suffer from cognitive blindness:

ProblemTraditional AICCP-Enabled AI
Self-AwarenessNone – operates blindlyKnows what it understands and what it doesn’t
ConfidenceOverconfident or underconfidentCalibrated confidence from outcome tracking
MemoryStateless or simple RAGEpisodic memory with emotional valence and decay
LearningRequires retrainingContinuous learning from every interaction
ReasoningCorrelationalCausal β€” can answer “what if?” questions
ContextFixed window, dump everythingHierarchical, load-adaptive, attention-gated
ExecutionAd-hoc, unverified stepsContract-enforced plans with preconditions & repair

πŸ’‘ What Makes CCP Revolutionary

1. Cognitive State Awareness

Unlike any existing system, CCP maintains a multi-dimensional cognitive state vector that tracks:

{
  understanding_depth: 0.85,    // How deeply the AI comprehends the task
  confidence_score: 0.72,       // Calibrated via Rescorla-Wagner prediction error
  cognitive_load: 0.63,         // Current processing demands
  knowledge_gaps: [             // Explicit awareness of unknowns
    { domain: "user_preferences", severity: "moderate", impact: 0.45 }
  ],
  meta_cognitive_flags: {
    needs_clarification: false,  // Should it ask questions?
    exploration_required: true,  // Should it seek more context?
    confidence_threshold_met: true
  }
}

This is the first AI system that knows when it doesn’t know. It employs a Bayesian-inspired learning model (Rescorla-Wagner) where confidence is updated based on prediction error, dampened by high cognitive load, and accelerated by surprise.


2. Episodic Memory Architecture

CCP doesn’t just retrieve contextβ€”it forms semantic episodes that mirror human memory:

{
  id: "ep_2025_11_18_001",
  type: "problem_solving_session",
  semantic_summary: "User requested budget analysis with focus on Q4 anomalies",
  cognitive_elements: {
    entities: ["budget", "Q4", "anomaly_detection"],
    relationships: [
      { type: "causal", from: "spending_increase", to: "budget_overrun" }
    ],
    outcomes: { success: true, user_satisfaction: 0.9 }
  },
  emotional_valence: 0.7,        // Positive experience
  relevance_decay: {
    function: "exponential",
    half_life: "30_days"
  },
  associative_links: ["ep_2025_oct_12_043", "ep_2025_nov_01_089"]
}

Episodes are linked, decayed, and retrieved by analogyβ€”just like human memory.


3. Causal Cognitive Modeling (Breakthrough)

CCP doesn’t just find correlationsβ€”it builds causal graphs and reasons counterfactually:

Q: "What would have happened if we hadn't added caching?"
A: "Based on causal analysis of 47 similar episodes:
    - Response time would be 340% higher (confidence: 0.84)
    - User satisfaction would drop to 0.45 (confidence: 0.71)
    - Causal path: no_cache β†’ slow_queries β†’ timeout_errors β†’ user_frustration"

This is the first AI that can answer “what if?” questions about its own experiences.


4. Hierarchical Context Abstraction (Breakthrough)

CCP organizes information across 4 abstraction levels, dynamically selecting based on task:

Level 4: Strategic Insight    β”‚ "Market shift toward sustainability"
Level 3: Tactical Summary     β”‚ "Q3 +12%, Q4 +8%, driven by green products"
Level 2: Operational Detail   β”‚ "Product A: $2.4M +15%; Product B: $1.8M +8%"
Level 1: Complete Data        β”‚ [Full transaction records, timestamps, etc.]

For strategic planning β†’ L3-L4. For debugging β†’ L1-L2. Automatic.

This is the first AI that compresses context hierarchically like human working memory.


5. Gated Attention Filtering (Breakthrough)

Instead of dumping all context, CCP uses 5 learned attention heads to filter:

HeadWhat It Prioritizes

| Recency | Recent experiences | | Causal Importance | Episodes with clear cause-effect | | Domain Similarity | Related knowledge domains | | Outcome Relevance | Successful past experiences | | Semantic Match | Query-relevant content |

Weights are learned from outcomesβ€”the system gets better at filtering over time.

This is the first AI with learned, multi-head context attention.


6. Episodic Drift & Continuous Learning (Breakthrough)

CCP updates its understanding continuously without retraining:

Initial belief: "Marketing campaigns increase sales" (confidence: 0.6)
    ↓ 50 campaigns later
Updated: "Campaigns + seasonal timing explains 73% of variance" (confidence: 0.82)
    ↓ 200 campaigns later  
Refined: "Effectiveness varies by channel, timing, product category (RΒ²=0.89)"

With safety guardrails:

  • Reversal protection (70% evidence required)
  • Drift bounds (max 15% change per cycle)
  • Paradigm shift detection with human review triggers

This is the first AI that learns incrementally while maintaining stability.


7. Contract-Oriented Graph Prompting (COGP) (v2.0 β€” Phase 11)

CCP now natively enforces the COGP protocol β€” a three-phase execution discipline that turns ad-hoc AI reasoning into machine-verifiable, contract-driven plans:

Phase 1 β€” Contract Synthesis
  AI calls ccp_cogp_plan() with a DAG of ContractNodes, each specifying:
    goal, preconditions, successCriteria, failurePolicy, tool, dependencies

Phase 2 β€” Contract Execution  
  Nodes execute one at a time in dependency order:
    ccp_cogp_execute_node(action="start")   β†’ marks node running
    ccp_cogp_execute_node(action="succeed") β†’ persists output to shared state
    ccp_cogp_execute_node(action="fail")    β†’ applies failure policy atomically
      β”œβ”€β”€ retry     β†’ resets node to pending for another attempt
      β”œβ”€β”€ skip      β†’ marks skipped, unlocks dependents
      β”œβ”€β”€ escalate  β†’ triggers Phase 3 reflection immediately
      └── abort     β†’ halts the entire graph

Phase 3 β€” Contract Reflection
  Critic reviews all executed nodes:
    ccp_cogp_reflect() β†’ scores every node, identifies failures,
                         returns shouldContinue + repair actions

Why this matters: Previous prompting techniques (Chain-of-Thought, ReAct, Tree-of-Thoughts) structured thinking but couldn’t enforce it. COGP provides the runtime layer β€” precondition verification, dependency scheduling, atomically applied failure policies, and a shared blackboard state β€” all as first-class MCP tools. No external Python orchestrator. No LangGraph. No Swarm middleware. Pure MCP.

// Example: 3-node contract graph
await mcp.callTool('ccp_cogp_plan', {
  task: 'Analyze codebase and create PR',
  nodes: [
    { id: 'analyze',  role: 'executor', kind: 'tool_step',
      goal: 'Read src/ and identify refactor targets',
      tool: { name: 'read', params: { path: 'src/' } },
      successCriteria: ['at least one file analyzed'],
      failurePolicy: 'retry', maxRetries: 2, dependencies: [] },
    { id: 'plan',     role: 'planner',  kind: 'thought',
      goal: 'Produce a ranked list of changes with rationale',
      successCriteria: ['list has β‰₯1 item'],
      failurePolicy: 'escalate', dependencies: ['analyze'] },
    { id: 'pr',       role: 'executor', kind: 'tool_step',
      goal: 'Create pull request with the planned changes',
      tool: { name: 'create_pull_request', params: {} },
      successCriteria: ['PR URL returned'],
      failurePolicy: 'abort', dependencies: ['plan'] }
  ]
});
// β†’ graph_id returned; ready_nodes: [analyze]
// Execute nodes as they become ready, reflect after each wave

πŸ› οΈ The 31 MCP Tools

Core Cognitive Tools (7)

ToolWhat It Does
ccp_query_stateGet current cognitive state (understanding, confidence, gaps)
ccp_update_stateUpdate state with outcome-based calibration
ccp_create_episodeForm episodic memory with embedding
ccp_retrieve_memorySemantic + temporal + emotional retrieval
ccp_adaptive_contextLoad-aware progressive disclosure
ccp_meta_decideShould I proceed, clarify, or explore?
ccp_multimodal_fuseUnify text + visual + contextual data

Breakthrough Tools (Phases 5-8)

ToolWhat It Does
ccp_causal_analyzeBuild causal graphs, counterfactuals, root cause
ccp_hierarchical_contextL1-L4 dynamic abstraction
ccp_gated_attentionMulti-head attention filtering
ccp_drift_detectContinuous learning + paradigm shifts

Advanced Cognitive Tools (Phase 9+)

ToolWhat It Does
ccp_inject_rulesNeuro-symbolic reasoning with rule injection
ccp_meta_decide_reflectiveIterative reflection with self-critique
ccp_query_state_introspectiveIntrospective state with reasoning chains
ccp_fuse_efficientMixture-of-Experts multimodal routing
ccp_model_agent_beliefTheory of Mind β€” model agent beliefs
ccp_meta_learningTask signatures and transfer learning
ccp_simulate_futureWorld model simulation and planning
ccp_temporal_queryAllen’s Interval Algebra temporal reasoning
ccp_adaptive_biometricEEG/HRV biometric-aware context

Claude Skills Integration (8)

ToolWhat It Does
ccp_discover_skillsList available Claude skills with metadata
ccp_activate_skillProgressive skill activation (L1/L2/L3)
ccp_find_skillsSemantic search for task-matching skills
ccp_ingest_skillsIngest skills from directory or GitHub
ccp_load_skill_resourceLoad specific script/reference from skill
ccp_execute_skill_scriptRun skill scripts in sandbox
ccp_record_skill_outcomeRecord effectiveness for meta-learning
ccp_skill_recommendationsGet recommendations from usage history

COGP β€” Contract-Oriented Graph Prompting (4) ✨ New in v2.0

ToolWhat It Does
ccp_cogp_planPhase 1 β€” Submit a contract graph (DAG of nodes with preconditions, tools, failure policies). Validates dependencies; returns the first wave of ready nodes.
ccp_cogp_execute_nodePhase 2 β€” Report start / succeed / fail for each node. Failure policy applied atomically: retry resets, skip unlocks dependents, escalate triggers reflection, abort halts graph.
ccp_cogp_reflectPhase 3 β€” Critic evaluates all executed nodes against success criteria. Returns per-node verdicts, overall quality score, critical issues, and repair recommendations.
ccp_cogp_statusAny phase β€” Inspect progress counters, shared blackboard state, and next schedulable node wave for any graph.

πŸš€ Quick Start

1. Start the Server

cd server
npm install
npm run dev        # stdio MCP server (default)
npm run build      # compile to dist/
npm start          # production build

2. Add to Your MCP Config

{
  "ccp-server": {
    "command": "npx",
    "args": ["tsx", "path/to/ccp/server/src/mcp-server.ts"],
    "env": {
      "OLLAMA_BASE_URL": "http://localhost:11434",
      "OLLAMA_EMBED_MODEL": "nomic-embed-text"
    }
  }
}

3. Start Using Cognitive AI

// ── Know what you don't know ──────────────────────────────────────
const state = await mcp.callTool('ccp_query_state', {});
console.log(`Confidence: ${state.confidence_score}`);
console.log(`Knowledge gaps: ${state.knowledge_gaps.length}`);

// ── Remember and learn ────────────────────────────────────────────
await mcp.callTool('ccp_create_episode', {
  type: 'debugging',
  semantic_summary: 'Fixed race condition in auth flow',
  entities: ['auth', 'race_condition', 'async'],
  success: true
});

// ── Ask "what if?" ────────────────────────────────────────────────
const counterfactual = await mcp.callTool('ccp_causal_analyze', {
  mode: 'counterfactual',
  intervention: 'remove async call',
  target: 'race condition'
});

// ── Execute a COGP contract graph ─────────────────────────────────
const { graph_id, ready_nodes } = await mcp.callTool('ccp_cogp_plan', {
  task: 'Analyze repo and open a PR',
  nodes: [
    { id: 'read',     role: 'executor', kind: 'tool_step',
      goal: 'Read source files',
      tool: { name: 'read', params: { path: 'src/' } },
      successCriteria: ['files returned'],
      failurePolicy: 'retry', maxRetries: 2, dependencies: [] },
    { id: 'analyze',  role: 'planner',  kind: 'thought',
      goal: 'Identify top 3 improvement areas',
      successCriteria: ['list has β‰₯1 item'],
      failurePolicy: 'escalate', dependencies: ['read'] },
    { id: 'pr',       role: 'executor', kind: 'tool_step',
      goal: 'Create pull request',
      tool: { name: 'create_pull_request', params: {} },
      successCriteria: ['PR URL returned'],
      failurePolicy: 'abort', dependencies: ['analyze'] }
  ]
});

// Execute each ready node, then reflect
await mcp.callTool('ccp_cogp_execute_node',
  { graph_id, node_id: 'read', action: 'start' });
// … perform work …
await mcp.callTool('ccp_cogp_execute_node',
  { graph_id, node_id: 'read', action: 'succeed', output: { files: ['index.ts'] } });

// After a wave completes, run the critic
const report = await mcp.callTool('ccp_cogp_reflect', { graph_id });
console.log(`Quality score: ${report.overallScore}`);
console.log(`Continue: ${report.shouldContinue}`);

πŸ“¦ SDKs

Note: The SDKs are optional client libraries for easier integration with the CCP server. The server runs independently and can be accessed directly via MCP tools without the SDKs.

TypeScript

import { CCPClient } from '@ccp/sdk';

const ccp = new CCPClient(mcpClient);

// Cognitive state
const state = await ccp.queryState();

// Causal reasoning
const result = await ccp.counterfactual({
  intervention: 'double team size',
  target: 'project velocity'
});

// Continuous learning
const insights = await ccp.getLearningInsights();
console.log(`Model health: ${insights.modelHealth}`);

Python

from ccp import CCPClient

ccp = CCPClient(mcp_call_tool)

# Hierarchical context
context = await ccp.hierarchical_context(
    task_type='strategic_planning',
    cognitive_load=0.7
)
print(f"Abstraction level: {context['level_name']}")

# Drift detection
drift = await ccp.detect_drift()
if drift['paradigmShifts']:
    print("Major learning shift detected!")

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         MCP Interface Layer                          β”‚
β”‚                   (31 Tools + 3 Resources for AI Agents)             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                             β”‚                                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚  COGP Engine  (NEW)  β”‚   β”‚   β”‚       Meta-Cognitive Reasoner    β”‚ β”‚
β”‚  β”‚  Phase 1: Plan graph β”‚   β”‚   β”‚  (Reflection, Self-Critique,     β”‚ β”‚
β”‚  β”‚  Phase 2: Exec nodes β”‚   β”‚   β”‚   Iterative Refinement)         β”‚ β”‚
β”‚  β”‚  Phase 3: Reflect    β”‚   β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚  β”‚  FailurePolicy engineβ”‚   β”‚                  β”‚                    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚             β”‚               β”‚   β”‚  Causal Engine + World Model     β”‚ β”‚
β”‚             β”‚               β”‚   β”‚  (Counterfactuals, Simulation,   β”‚ β”‚
β”‚             β”‚               β”‚   β”‚   Neuro-Symbolic Rules)          β”‚ β”‚
β”‚             β”‚               β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚             β”‚               β”‚                                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                    Cognitive State Manager                           β”‚
β”‚        (Understanding, Confidence, Gaps, Load, Introspection)        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                      Episodic Memory Engine                          β”‚
β”‚     (Vector Embeddings + Semantic Episodes + Temporal Algebra)       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Hierarchical    β”‚    Gated Attention     β”‚    Antigravity Bridge     β”‚
β”‚  Context (L1-L4) β”‚  (5 Learned Heads)    β”‚  (Multi-Agent + ToM)      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚    Episodic Drift   β”‚   Meta-Learning   β”‚   Biometric Adaptation     β”‚
β”‚   (Continuous Learn)β”‚ (Task Signatures) β”‚  (EEG/HRV/GSR)             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€-──
β”‚            Claude Skills Integration (Discover, Activate, Execute)   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                Persistence (SQLite + Ollama Embeddings)              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‹ Current Implementation

What’s Built

CCP is a fully functional MCP server with 31 cognitive tools, implemented across 11 development phases:

PhaseFeatureStatusFiles
Phase 1Core Cognitive State (Bayesian)βœ… CompletecognitiveState.ts
Phase 2MCP Server β€” sole entrypointβœ… Completemcp-server.ts
Phase 3Vector Embeddingsβœ… Completeembeddings.ts, persistence.ts
Phase 5Causal Cognitive Modelingβœ… CompletecausalEngine.ts
Phase 6Hierarchical Contextβœ… CompletehierarchicalContext.ts
Phase 7Gated Attentionβœ… CompletegatedAttention.ts
Phase 8Episodic Driftβœ… CompleteepisodicDrift.ts
Phase 9.1Neuro-Symbolic AIβœ… CompletecausalEngine.ts (enhanced)
Phase 9.2Reflection & Self-Critiqueβœ… CompletemetaReasoner.ts (enhanced)
Phase 9.3Introspective Awarenessβœ… CompletecognitiveState.ts (enhanced)
Phase 9.4Efficient Multimodal (MoE)βœ… Completemultimodal.ts (enhanced)
Phase 9.6Meta-Learningβœ… CompleteepisodicDrift.ts (enhanced)
Phase 9.7World Modelsβœ… CompleteworldModel.ts
Phase 9.8Temporal Reasoningβœ… CompleteepisodicMemory.ts (enhanced)
Phase 9.9Biometric Cognitionβœ… CompleteadaptiveContext.ts (enhanced)
Phase 10Claude Skills Integrationβœ… CompleteskillLoader.ts, skill-executor.ts
Phase 11COGP β€” Contract Execution βœ¨βœ… v2.0cogpEngine.ts, schemas.ts

Code Structure

server/src/
β”œβ”€β”€ mcp-server.ts              # Sole MCP entrypoint β€” 31 Tools, 3 resources
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ cogpEngine.ts          # ✨ NEW: COGP 3-phase contract execution engine
β”‚   β”œβ”€β”€ cognitiveState.ts      # Cognitive state + introspection
β”‚   β”œβ”€β”€ episodicMemory.ts      # Episodic memory + temporal reasoning
β”‚   β”œβ”€β”€ embeddings.ts          # Ollama integration (nomic-embed-text)
β”‚   β”œβ”€β”€ persistence.ts         # SQLite storage (sql.js)
β”‚   β”œβ”€β”€ adaptiveContext.ts     # Load-aware + biometric + skills
β”‚   β”œβ”€β”€ metaReasoner.ts        # Meta-cognitive + reflection + skills
β”‚   β”œβ”€β”€ multimodal.ts          # Multi-modal + MoE routing
β”‚   β”œβ”€β”€ causalEngine.ts        # Causal + neuro-symbolic
β”‚   β”œβ”€β”€ hierarchicalContext.ts # L1-L4 abstraction
β”‚   β”œβ”€β”€ gatedAttention.ts      # Multi-head attention
β”‚   β”œβ”€β”€ episodicDrift.ts       # Continuous learning + meta-learning
β”‚   β”œβ”€β”€ worldModel.ts          # World simulation + planning
β”‚   └── skillLoader.ts         # Claude Skills ingestion
β”œβ”€β”€ integration/
β”‚   └── skill-executor.ts      # Sandboxed skill script execution
└── protocol/
    β”œβ”€β”€ schemas.ts             # ✨ UPDATED: TypeScript types + COGP contract types
    └── ccp.capnp              # Binary schema

Total: ~8,500+ lines of TypeScript + 302 lines Cap’n Proto

v2.0 change: The Express/WebSocket HTTP REST server (index.ts) has been removed. mcp-server.ts is the single, canonical entrypoint. All intelligence β€” including COGP contract execution β€” is surfaced as MCP tools with no external orchestration framework required.

Cap’n Proto Schema

We’ve implemented a complete Cap’n Proto schema (ccp.capnp) for high-performance binary serialization:

# Core types defined
struct CognitiveStateVector { ... }    # Understanding, confidence, gaps
struct Episode { ... }                  # Episodic memory with embeddings
struct AdaptiveContextRequest { ... }   # Load-adaptive retrieval
struct MetaCognitiveDecision { ... }    # Reasoning about reasoning

# RPC interfaces ready for binary transport
interface CognitiveStateService { ... }
interface EpisodicMemoryService { ... }
interface AdaptiveContextService { ... }
interface MetaCognitiveService { ... }
interface AgentCoordinationService { ... }

Current Transport: JSON-RPC 2.0 (MCP standard)
Future Option: Cap’n Proto binary transport for zero-copy, sub-millisecond latency

SDKs

SDKLanguageStatusFeatures
TypeScript@ccp/sdkβœ… CompleteType-safe wrappers, 290 lines
Pythonccp-sdkβœ… CompleteAsync + type hints, 320 lines

Dependencies

DependencyPurpose
@modelcontextprotocol/sdkMCP protocol implementation
sql.jsPure-JS SQLite for persistence
zodRuntime type validation
uuidUnique IDs for contract graphs and nodes

Roadmap

  • Neuro-Symbolic AI: Hybrid neural+symbolic reasoning with rule injection
  • Reflection & Self-Critique: Iterative decision refinement with quality rubrics
  • Theory of Mind: Epistemic modeling of agent beliefs
  • World Models: Physics-aware simulation and planning
  • Temporal Reasoning: Allen’s Interval Algebra for time-aware queries
  • Claude Skills Integration: Ingest, activate, and execute Claude Skills
  • COGP Contract Execution: Native 3-phase contract graph enforcement as MCP tools
  • Binary Transport: Enable Cap’n Proto for 50-70% smaller payloads
  • Distributed Memory: Sharded episodic memory across agent pools
  • COGP Persistence: Durable graph state surviving server restarts

πŸ“š Documentation

DocumentDescription

| Cognitive Breakthrough Spec | Full 1100-line protocol specification | | Cap’n Proto + MCP Integration | Binary transport design | | TypeScript SDK | Type-safe client with examples | | Python SDK | Async client with type hints |


πŸ”§ Configuration

VariableDefaultDescription

| OLLAMA_BASE_URL | http://localhost:11434 | Ollama API | | OLLAMA_EMBED_MODEL | nomic-embed-text | 768-dim embeddings |


License

MIT


Built for the next generation of AI

CCP: Because AI should understand itself

Developed and Engineered by Anthony Cavanaugh for Cavanaugh Design Studio

[cavanaughdesignstudio.com]

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Posts


Post Archive


Catogery Tags