Skip to main content
Glama

Project Christina:自主认知放大器

Python 3.11+ License: MIT Dependencies Tests FastMCP Compliant Code Style: Ponytail Ultra

Host: Google Antigravity Host: OpenCode Host: Claude Desktop Host: OpenAI Codex CLI

[快速开始](#- 1-command-zero-friction-installation) • 架构 • MCP 工具 • CLI 参考 • 文档 • 贡献指南


🌟 执行摘要:消除上下文腐化

现代 AI 编码智能体在大规模代码库($10\text{M}+$ tokens)上失败,原因不在于推理能力,而在于Context Rot(上下文腐化):注意力分散、未索引的提示词污染、上下文清空后架构约束丢失,以及不协调的集群冲突。

Project Christina 通过一套集成的高性能认知三位一体方案来解决这些问题:

  1. RLM(递归语言模型——上下文即变量):将大规模代码库移出对话提示词,放入沙箱化的堆变量(context)中。智能体执行有界子查询($D \le 2, N \le 20$)和带自动回滚的事务式写时复制(CoW)Python 控制循环。

  2. Graphify(确定性 CPG 与 AST 雷达):构建内存 SQLite3 WAL 调用图,实现 亚 0.3ms 递归 CTE 查询、传递性爆炸半径分析和中心性极高的 Node 节点排名,带来 71.5x 的 token 发现量缩减。

  3. OKF(持久语义记忆与认知进化):亚微秒级正则 frontmatter 解析($6.72\ \mu\text{s}$/doc)、正式 AGM 信念修正、艾宾浩斯遗忘曲线,以及带 $\le 400$-token 自动压缩后记忆恢复锚点的 Mark-and-Sweep 语义垃圾回收。

  4. 跨项目认知蒸馏:将专有代码匿名化为数学原型,具备严格的零信息泄漏不变量($\mathcal{I} = 0$)、多进制 Shannon 熵秘密清洗机制,以及跨代码库的贝叶斯不变量聚合。

  5. 集群并发控制:使用 Kung-Robinson 乐观并发控制(OCC)、Tree-CRDT 三方 AST 合并以及 Linda 元组空间黑板机制,实现去中心化多智能体执行。


Related MCP server: Cordyceps Search

🏛️ 三支柱认知架构

                                  ┌─────────────────────────────────────────┐
                                  │           SUPERVISOR / AGENT            │
                                  │  (Antigravity / OpenCode / Claude / AI) │
                                  └────────────────────┬────────────────────┘
                                                       │ JSON-RPC 2.0 (stdio)
                                                       ▼
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                            PROJECT CHRISTINA FAST-MCP GATEWAY                                     │
├──────────────────────────────────────┬────────────────────────────────────┬───────────────────────────────────────┤
│          PILLAR 1: RLM ENGINE        │       PILLAR 2: GRAPHIFY CPG       │        PILLAR 3: OKF MEMORY           │
│         (Context as Variable)        │          (AST Code Radar)          │         (Semantic Evolution)          │
├──────────────────────────────────────┼────────────────────────────────────┼───────────────────────────────────────┤
│ • Out-of-core Heap Variables         │ • In-Memory SQLite3 WAL Graph      │ • Sub-microsecond OKF Regex Parser    │
│ • Transactional CoW Rollback         │ • Sub-0.3ms Transitive Blast Query │ • Formal AGM Belief Revision          │
│ • 3-Phase EGRI Invariant Linter      │ • Composite God-Node Centrality    │ • Ebbinghaus Forgetting & GC          │
│ • Dynamic Governor (D<=2, N<=20)     │ • Circular Dependency & Wave Sort  │ • Symbol-to-ADR Constraints           │
└──────────────────────────────────────┴────────────────────────────────────┴───────────────────────────────────────┘
                                                       │
                                                       ▼
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                        DECENTRALIZED SWARM & DISTILLERY                                           │
├───────────────────────────────────────────────────────────────────┬───────────────────────────────────────────────┤
│                    SWARM CONCURRENCY BLACKBOARD                   │         GLOBAL EPISTEMIC DISTILLERY           │
├───────────────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤
│ • Kung-Robinson Optimistic Concurrency Control (OCC)              │ • Zero-Information Leakage (I = 0)           │
│ • Semantic Tree-CRDT 3-Way AST Merge Resolution                   │ • Multi-Base Shannon Entropy Secret Redaction │
│ • Linda Tuple Space (`out`, `rd`, `in`, `eval`, `digest`)         │ • Bayesian Invariant Distillation (0700 Fence)│
└───────────────────────────────────────────────────────────────────┴───────────────────────────────────────────────┘

Mermaid 流程图

flowchart TD
    Host[Host Agent Context] -->|JSON-RPC 2.0 stdio| MCP[Christina FastMCP Server]
    
    subgraph Trinity["Autonomous Cognitive Trinity"]
        MCP -->|cpg_query| CPG[Graphify CPG Radar<br/><i>sub-0.3ms SQLite WAL</i>]
        MCP -->|rlm_execute| RLM[RLM Sandbox<br/><i>Transactional CoW REPL</i>]
        MCP -->|memory_evolve| OKF[OKF Semantic Memory<br/><i>AGM Revision & Epistemic GC</i>]
    end
    
    subgraph SwarmDistill["Swarm & Cross-Project Substrate"]
        MCP -->|swarm_blackboard| OCC[Swarm Concurrency<br/><i>Kung-Robinson OCC + Tree-CRDT</i>]
        OKF -->|distill_global| Distill[Global Epistemic Distillery<br/><i>Anonymized Archetypes (I=0)</i>]
    end

    CPG -.->|Blast Radius & Waves| OCC
    RLM -.->|Isolated Sub-Calls| Host
    OKF -.->|ADR Anchor <=400 Tokens| Host

🚀 一条命令,零摩擦安装

Christina 可在数秒内完成安装,无需后台守护进程、本地编译或 root 权限:

cd christina
./install.sh

自动化诊断预检

./install.sh doctor
================================================================
 Christina Cognitive Amplifier Diagnostics (v1.0.0)
================================================================
✓ Python Version: 3.11+ (Requirement satisfied)
✓ SQLite3 in-memory WAL Engine: Ready
✓ OKF Semantic Memory Engine: Ready
✓ Google Antigravity Plugin: Registered
✓ OpenCode Plugin: Registered
✓ Global memory directory: ~/.config/christina/global_memory (0700 fenced)
================================================================
✅ All systems functional.

运行完整测试套件(62/62 通过,耗时小于 <1.2s)

./install.sh test
# Or with pytest directly:
pytest tests/ -v

🛠️ 标准 FastMCP 工具矩阵

Christina 提供 4 个统一 JSON-RPC 2.0 stdio 工具,兼容任何 MCP 主机:

工具

类别

关键能力与模式

性能上界

cpg_query

AST 代码雷达

blast_radius, def_use, cfg, vinterfaces, god_nodes, cycles, waves, info

内存遍历 <0.3ms

rlm_execute

沙箱化执行

子智能体 MapReduce、事务式 CoW REPL、三阶段 EGRI linting 检查、计算资源抑制器目标

递归边界 $D \le 2, N \le 20$

memory_evolve

语义记忆

search, persist, revise(AGM), gc(Ebbinghaus 标记-清除), distill_global, query_global

$6.72\ \mu\text{s}$/文档解析

swarm_blackboard

集群并发控制

out, rd, in, eval, occ_validate(Kung-Robinson OCC), tree_merge(Tree-CRDT), digest

无锁乐观并发验证验证

MCP 工具调用

1. 爆炸半径分析(cpg_query)

{
  "name": "cpg_query",
  "arguments": {
    "symbol": "PaymentGateway",
    "mode": "blast_radius",
    "depth": 3
  }
}

2. 事务式子查询执行(rlm_execute)

{
  "name": "rlm_execute",
  "arguments": {
    "query": "Audit error recovery handling in database connection pool",
    "scope_paths": ["src/db/", "src/pools/"]
  }
}

3. 带符号约束的语义记忆搜索(memory_evolve)

{
  "name": "memory_evolve",
  "arguments": {
    "action": "search",
    "query": "zero-trust authentication policy",
    "linked_symbols": ["AuthMiddleware"]
  }
}

4. 集群 OCC 冲突校验(swarm_blackboard)

{
  "name": "swarm_blackboard",
  "arguments": {
    "action": "occ_validate",
    "worker_id": "worker_security_audit",
    "read_version": 4,
    "read_set": ["AuthMiddleware", "SessionToken"],
    "write_set": ["AuthMiddleware"]
  }
}

⚡ CLI 快速参考

# 1. Scan codebase and index AST knowledge graph into in-memory SQLite3 WAL
python3 -m christina.cli scan .

# 2. Calculate static blast radius for a target symbol
python3 -m christina.cli blast AuthService --depth 3

# 3. List top God Nodes ranked by composite degree centrality
python3 -m christina.cli god-nodes --limit 10

# 4. Search OKF institutional memory, ADRs, and symbol constraints
python3 -m christina.cli memory "connection pool timeout" --symbol DatabasePool

# 5. Run FastMCP JSON-RPC 2.0 stdio server
python3 -m christina.cli serve

# 6. Execute system diagnostics
python3 -m christina.cli doctor

🔌 多主机兼容与配置

1. Google Antigravity CLI(agy)

自动符号链接到 ~/.gemini/antigravity-cli/plugins/christina,并注册到 ~/.gemini/antigravity-cli/mcp_config.json。

2. OpenCode

自动注册到 ~/.config/opencode/plugins/christina 以及 ~/.config/opencode/opencode.json。

3. Claude Desktop

自动配置到 ~/.claude/claude_desktop_config.json(macOS 上为 ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "christina": {
      "command": "python3",
      "args": ["-m", "christina.bridge.mcp_server"],
      "env": {
        "PYTHONPATH": "/path/to/christina"
      }
    }
  }
}

4. OpenAI Codex CLI

自动注册到 ~/.config/codex/config.json。


🪮 Ponytail Ultra:零依赖保证

Project Christina 严格遵循 Ponytail Ultra 规范设计:

  • 零外部运行时依赖:仅使用标准 Python 库(ast, sqlite3, re, json, hashlib, fcntl, math, pathlib, typing)。

  • 零重型守护进程:不依赖 Docker、Neo4j、ChromaDB 或 Redis。内存 SQLite3 WAL 和 POSIX 文件锁可提供亚毫秒级执行,空闲后台内存占用为 $0\text{MB}$。

  • 严格代码精简:每个模块精简(不足 250 行代码)、内聚且自包含。


📚 文档与指南

文档

描述

入门指南

分步安装、验证和首个 Agent 工作流。

技能分类

渐进式揭示的技能定义(cpg, rlm, memory, swarm)。

Contributing 指南

Ponytail Ultra 开发规范、Nix 环境、测试套件和 ADR 工作流说明。

安全策略

零信息泄漏不变量($\mathcal{I} = 0$)、Shannon 熵敏感信息净化与隔离机制。

更新日志

详细的发布说明与版本历史。


📜 许可证

Project Christina 以开源 MIT 许可证 形式分发。

© 2026 Christina Engineering Swarm 与贡献者。

Available Tools

4 tools
cpg_queryC

CPG & AST radar: def-use chains, CFG, virtual interfaces, blast radius.

Inputs: code, mode, depth, symbol.

memory_evolveC

Semantic memory: AGM revision, GC, distill_global, query_global, search, persist.

Inputs: code, tags, query, title, +6 more.

rlm_executeC

Sandboxed RLM REPL executor with transactional CoW rollback, 3-phase EGRI linter, governor.

Inputs: code, query, scope_paths.

swarm_blackboardD

Swarm blackboard & OCC concurrency: Kung-Robinson OCC validation, Tree-CRDT 3-way merge, Linda tuple space.

Inputs: action, channel, payload, read_set, +4 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.6/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool targets a completely different subsystem: static code analysis, sandboxed execution, semantic memory, and concurrency/blackboard coordination. There is no overlap or plausible confusion between them.

    Naming Consistency4/5

    All tools follow a readable two-part snake_case format with domain-specific prefixes. However, the suffixes mix verbs (query, execute, evolve) with a noun (blackboard), creating a minor deviation from a fully uniform pattern.

    Tool Count5/5

    Four tools is a reasonable, focused count for a server whose scope appears to be a coordinated agent runtime: analyze, execute, remember, and coordinate. Each tool earns its place and none feel redundant.

    Completeness4/5

    The tool surface covers the major capabilities one would expect from this kind of system: code understanding, safe execution, memory persistence, and shared-state coordination. There are minor gaps such as explicit file/API interaction, but the broad sub-operations embedded in each tool make the overall surface feel fairly complete.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides AI coding agents with an embedded knowledge graph and architecture governance tools, enabling blast radius analysis, compliance checks, and smart context extraction from codebases.
      Apache 2.0
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables developer agents to perform semantic codebase search, dependency and impact analysis, cross-file refactoring, and full-stack API tracing through a unified query DSL over a high-performance graph engine.
      1
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides persistent cross-session AI memory, code graph analysis, and subagent context compression so coding agents can resume work instantly and avoid re-reading the codebase.
      Elastic 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to maintain a persistent knowledge graph of a project, providing dependency context, impact analysis, side-effect discovery, and session recording for more informed coding decisions.
      5
      MIT