cognitive-substrate について
cognitive-substrateは、エージェント向けのMCPサーバー兼Pythonパッケージです。検証付きの28層推論基盤、セッションをまたぐTree-of-Thoughtsメモリ、テレメトリー、他エージェント向けツールを備えています。
主な機能
- 01検証付き28層推論基盤
- 02セッション間のTree-of-Thoughtsメモリ
- 037種類の推論パラダイム
- 04セッションのツリー状態テレメトリー
- 05他エージェントの発見とオーケストレーション
活用シーン
- 01階層スキーマに沿ったエージェント推論の検証
- 02枝刈りされた推論から得た教訓の再利用
- 03セッション内の有効・枝刈り済み経路の確認
- 04他エージェントの発見と連携
MCP 対応
`cognitive-substrate` CLIでstdio MCPサーバーを起動します。推論、メモリ、テレメトリー、解析、A2A機能をツールとして公開します。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
mcp-cognitive-substrate
mcp-name: io.github.JaysonAIOnline/cognitive-substrate
セッションをまたいだ思考の木(ToT)進化型メモリ、条件付きセルフテレメトリー、MCP エージェント向けのA2A ツールを備えた、28層の認知基盤です。
検証済みの28層基盤を通じてエージェントが推論し、セッションをまたいでメモリを進化させ、他のエージェントと通信できるようにします。すべてを1つの pip でインストール可能なパッケージにまとめています。
特長
- Pydantic 検証機能を備えた28層の認知基盤 —
CognitiveSubstrateは6つのファミリー/28層を通じて推論を検証します。 - セッションをまたいだ ToT 進化型メモリ — SQLite を利用した思考の木ノードと基盤の履歴を備えています。刈り込まれた分岐は、次回以降のセッションで活用する教訓になります。
- 堅牢なスタックベースの JSON パーサー — 正規表現を使わず、ネストされた括弧、エスケープされた文字列、埋め込みのコードフェンス(
robust_slice/robust_json_slice)を処理します。 - セルフテレメトリーツール —
get_cognitive_tree_stateは、セッションのアクティブなパスと刈り込まれた分岐を返します。 - 実行後の保存ループ —
store_5key_telemetryは、コンパクトな5キーのテレメトリー(基礎、メタ認知、防御、リソース、ユーティリティ)を自動保存します。 - 7つの推論パラダイム — 演繹、帰納、アブダクション、類推、因果、三段論法、反証。
- A2A ツール — 他のエージェントの一覧表示、検出、呼び出し、オーケストレーションに対応します。
- MCP サーバー —
cognitive-substrateCLI を介して、すべての機能をツールとして公開します。
インストール
pip install mcp-cognitive-substrate
または、ソースからインストールします。
git clone https://github.com/JaysonAIOnline/mcp-cognitive-substrate.git
cd mcp-cognitive-substrate
pip install -e .[test]
Python >= 3.11 が必要です。
クイックスタート
from mcp_cognitive_substrate.substrate import CognitiveSubstrate
from mcp_cognitive_substrate.memory import get_cognitive_tree_state, store_5key_telemetry
substrate = CognitiveSubstrate()
response = substrate.run("Your user prompt here")
print(response["layers_applied"], "layers applied")
print(response["substrate_verdict"])
使い方
28層の基盤
from mcp_cognitive_substrate import substrate
# Layer count and schema
print(substrate.layer_count()) # 28
print(substrate.SUBSTRATE_SCHEMA) # the full 6-family schema
# Validate a prompt through the substrate
result = substrate.CognitiveSubstrate(session_id="s1").run("deploy safely")
print(result["substrate_verdict"]) # heuristic pruning verdict
# Run a single paradigm
from mcp_cognitive_substrate import run_paradigm
print(run_paradigm("14_idempotency_side_effect_audit", {"evaluate_branch": True}))
セッションをまたいだ ToT 進化型メモリ
from mcp_cognitive_substrate.memory import (
store_5key_telemetry,
get_cognitive_tree_state,
prune_failed_approach,
)
node_id = store_5key_telemetry(
session_id="session-a",
payload={
"foundations": {"premise_validation": "assuming deps", "state_hash": "h", "falsification_notes": "deps missing"},
"defensive": {"blast_radius": "unpredictable", "is_idempotent": True, "invariant_rule": "r"},
"resource": {"big_o": "o(n)", "latency_bottleneck": "none"},
"utility": {"load_summary": "pin versions to deploy", "checklist_verified": True},
"metacognition": {"self_critique": "c", "drift_pct": 0.1},
},
score_delta=-110.0,
)
prune_failed_approach(node_id)
state = get_cognitive_tree_state("session-a", include_pruned=True)
print(state["active_path_count"], state["pruned_branch_count"])
スタックベースの JSON パーサー
from mcp_cognitive_substrate.memory import robust_slice, robust_json_slice
cleaned, payload = robust_slice('prefix {"a": {"b": [1, 2]}, "c": "x"} suffix')
# payload == {"a": {"b": [1, 2]}, "c": "x"}; cleaned == "prefix suffix"
7つの推論パラダイム+A2A
from mcp_cognitive_substrate import reason, a2a_list, a2a_call, a2a_orchestrate
print(reason("Solve X", reasoning_type="abductive", depth=3)["steps"])
print(a2a_list())
print(a2a_call("peer-agent", "hello"))
print(a2a_orchestrate("hi", capability="memory"))
MCP サーバーとして
cognitive-substrate # starts stdio MCP server
cognitive-substrate --info # prints package summary
上記のすべて(基盤のパラダイム、抽出/評価、メモリの保存/想起、ToT の教訓、ツリー状態のテレメトリー、JSON 解析、推論プラン、A2A)は、MCP ツールとして公開されます。
テスト
pip install -e .[test]
python -m pytest src/tests -q # 16 tests
ライセンス
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。