{"_id":"@abderraouf-yt/got-mcp","_rev":"4-caa2c41f68a1a1cb23efe5870c9dd1c2","name":"@abderraouf-yt/got-mcp","dist-tags":{"latest":"4.0.1"},"versions":{"3.2.0":{"name":"@abderraouf-yt/got-mcp","version":"3.2.0","keywords":["mcp","model-context-protocol","graph-of-thoughts","got","reasoning","ai-agents","dag","beam-search","weighted-aggregation","thought-graph"],"author":{"name":"Abderraouf-yt"},"license":"MIT","_id":"@abderraouf-yt/got-mcp@3.2.0","maintainers":[{"name":"abderraouf-yt","email":"toumi221095@gmail.com"}],"homepage":"https://github.com/Abderraouf-yt/got-mcp#readme","bugs":{"url":"https://github.com/Abderraouf-yt/got-mcp/issues"},"bin":{"got-mcp":"dist/index.js"},"dist":{"shasum":"c7d3e855bb736e3984d8ae09a105e69136e5484e","tarball":"https://registry.npmjs.org/@abderraouf-yt/got-mcp/-/got-mcp-3.2.0.tgz","fileCount":15,"integrity":"sha512-FXumev+rKd970I6tc+Ph4cOPfCbFXmkQeeHgR4i54n9YHvRF7V2WTGQEmZE43XS28sD/8Gq6t/5xi087tfyxyQ==","signatures":[{"sig":"MEUCIBLkuahDMIY24BDFZIcWFxXYy3MAciDSsC5f4GLDTtCdAiEAyujaJ3i43IcKlBdVrjVRoMcrFJOYERkuQhqiXe4R3fw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":79658},"main":"dist/index.js","type":"module","engines":{"node":">=20.0.0"},"gitHead":"dc8486679d63cb8514d4d212a4ca06ded73c00dc","scripts":{"dev":"tsc --watch","build":"tsc","start":"node dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"abderraouf-yt","email":"toumi221095@gmail.com"},"repository":{"url":"git+https://github.com/Abderraouf-yt/got-mcp.git","type":"git"},"_npmVersion":"11.9.0","description":"Graph of Thoughts (GoT) MCP Server — bounded, auditable reasoning for AI agents","directories":{},"_nodeVersion":"25.6.1","dependencies":{"zod":"^3.22.4","cors":"^2.8.5","express":"^4.21.0","@modelcontextprotocol/sdk":"^1.26.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/cors":"^2.8.17","@types/node":"^20.19.30","@types/express":"^4.17.21"},"_npmOperationalInternal":{"tmp":"tmp/got-mcp_3.2.0_1771975255917_0.7986952365396705","host":"s3://npm-registry-packages-npm-production"}},"3.2.1":{"name":"@abderraouf-yt/got-mcp","version":"3.2.1","keywords":["mcp","model-context-protocol","graph-of-thoughts","got","reasoning","ai-agents","dag","beam-search","weighted-aggregation","thought-graph"],"author":{"name":"Abderraouf-yt"},"license":"MIT","_id":"@abderraouf-yt/got-mcp@3.2.1","maintainers":[{"name":"abderraouf-yt","email":"toumi221095@gmail.com"}],"homepage":"https://github.com/Abderraouf-yt/got-mcp#readme","bugs":{"url":"https://github.com/Abderraouf-yt/got-mcp/issues"},"bin":{"got-mcp":"dist/index.js"},"dist":{"shasum":"140ca5796c65f240ade9c59ec2579b2426346afd","tarball":"https://registry.npmjs.org/@abderraouf-yt/got-mcp/-/got-mcp-3.2.1.tgz","fileCount":17,"integrity":"sha512-s8WFwBrFZQWY9XSyumPa9N2d6W+lmz8mv12L2EKjC9LLPbK2oaa4VRTzdCXE7PX9x1ah8FOhyvno0ME0dq70cg==","signatures":[{"sig":"MEYCIQDmt4w+GfCGu2afsXBkZ5cOyEAMaFxT4Afou/68TgPUWgIhAMFKMEAC7jM3oIMYZXJb9z3s+vdeAwbcrlRROH1RLdnh","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":94975},"main":"dist/index.js","type":"module","engines":{"node":">=20.0.0"},"gitHead":"e0fb45350303d1f9b6ceced1bde1512807e9131a","scripts":{"dev":"tsc --watch","build":"tsc","start":"node dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"abderraouf-yt","email":"toumi221095@gmail.com"},"repository":{"url":"git+https://github.com/Abderraouf-yt/got-mcp.git","type":"git"},"_npmVersion":"11.9.0","description":"Graph of Thoughts (GoT) MCP Server — bounded, auditable reasoning for AI agents","directories":{},"_nodeVersion":"25.6.1","dependencies":{"zod":"^4.3.6","cors":"^2.8.5","express":"^4.21.0","@modelcontextprotocol/sdk":"^1.26.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/cors":"^2.8.17","@types/node":"^20.19.30","@types/express":"^4.17.21"},"_npmOperationalInternal":{"tmp":"tmp/got-mcp_3.2.1_1772460800784_0.933233297656225","host":"s3://npm-registry-packages-npm-production"}},"4.0.0":{"name":"@abderraouf-yt/got-mcp","version":"4.0.0","keywords":["mcp","model-context-protocol","graph-of-thoughts","got","reasoning","ai-agents","dag","beam-search","weighted-aggregation","thought-graph"],"author":{"name":"Abderraouf-yt"},"license":"MIT","_id":"@abderraouf-yt/got-mcp@4.0.0","maintainers":[{"name":"abderraouf-yt","email":"toumi221095@gmail.com"}],"homepage":"https://github.com/Abderraouf-yt/got-mcp#readme","bugs":{"url":"https://github.com/Abderraouf-yt/got-mcp/issues"},"bin":{"got-mcp":"dist/index.js"},"dist":{"shasum":"0051f948cb79a4170621b72553b44b9734c7818e","tarball":"https://registry.npmjs.org/@abderraouf-yt/got-mcp/-/got-mcp-4.0.0.tgz","fileCount":17,"integrity":"sha512-9ZsvH98Q2/FnlPSyAUuiY6/7BeS/V8gAddQMKDRQ/I2ukhiO3GrvC2txKWuyJM6Epz9i1IukJ2d2+CtjCoVnhA==","signatures":[{"sig":"MEUCIBaf67bJiX2N6YYdWY5Mi/ZKnFRE0v4SA2x1gh7m9h5hAiEAtEZKz6zXUUWkHCgvzKGBIkTjLFgOtroeT2Tpk/ZiVPw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":107516},"main":"dist/index.js","type":"module","engines":{"node":">=20.0.0"},"gitHead":"72260e034eb802b61ac878e263eb37c7564a938e","scripts":{"dev":"tsc --watch","build":"tsc","start":"node dist/index.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"abderraouf-yt","email":"toumi221095@gmail.com"},"repository":{"url":"git+https://github.com/Abderraouf-yt/got-mcp.git","type":"git"},"_npmVersion":"11.9.0","description":"Graph of Thoughts (GoT) MCP Server — bounded, auditable reasoning for AI agents","directories":{},"_nodeVersion":"25.6.1","dependencies":{"zod":"^4.3.6","express":"^4.21.0","@modelcontextprotocol/sdk":"^1.26.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/node":"^20.19.30","@types/express":"^4.17.21"},"_npmOperationalInternal":{"tmp":"tmp/got-mcp_4.0.0_1772511666308_0.45797915313066917","host":"s3://npm-registry-packages-npm-production"}},"4.0.1":{"name":"@abderraouf-yt/got-mcp","version":"4.0.1","description":"Graph of Thoughts (GoT) MCP Server — bounded, auditable reasoning for AI agents","main":"dist/index.js","bin":{"got-mcp":"dist/index.js"},"publishConfig":{"access":"public"},"type":"module","license":"MIT","author":{"name":"Abderraouf-yt"},"repository":{"type":"git","url":"git+https://github.com/Abderraouf-yt/got-mcp.git"},"homepage":"https://github.com/Abderraouf-yt/got-mcp#readme","bugs":{"url":"https://github.com/Abderraouf-yt/got-mcp/issues"},"keywords":["mcp","model-context-protocol","graph-of-thoughts","got","reasoning","ai-agents","dag","beam-search","weighted-aggregation","thought-graph"],"engines":{"node":">=20.0.0"},"scripts":{"build":"tsc","start":"node dist/index.js","dev":"tsc --watch","prepublishOnly":"npm run build"},"dependencies":{"@modelcontextprotocol/sdk":"^1.26.0","express":"^4.21.0","zod":"^4.3.6"},"devDependencies":{"@types/express":"^4.17.21","@types/node":"^20.19.30","typescript":"^5.9.3"},"gitHead":"bacbd3de0cf140a454878e96a92c5378c21544fd","_id":"@abderraouf-yt/got-mcp@4.0.1","_nodeVersion":"25.6.1","_npmVersion":"11.9.0","dist":{"integrity":"sha512-qn3mdas/wBBJzjq6SV5IRvAGUonj//lPEpYpH+kcYDet2gVVRFkSccF+1nAWfA+GKVKWFveY1yug/RENdTM9Tw==","shasum":"347ad50c8c01233ea6d7ec6b03c3eda9b09fa0e6","tarball":"https://registry.npmjs.org/@abderraouf-yt/got-mcp/-/got-mcp-4.0.1.tgz","fileCount":17,"unpackedSize":107739,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCAiQxGSx8h9WS0sTD3kh4JqJI5/1b44uAAk8sJ1bxn3QIgZnVtyG47yneaUvZn+qUus1pUIKg+UvFRAYlKv0++UiY="}]},"_npmUser":{"name":"abderraouf-yt","email":"toumi221095@gmail.com"},"directories":{},"maintainers":[{"name":"abderraouf-yt","email":"toumi221095@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/got-mcp_4.0.1_1772665987154_0.1969549952552443"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-24T23:20:55.723Z","modified":"2026-03-04T23:13:07.490Z","3.2.0":"2026-02-24T23:20:56.089Z","3.2.1":"2026-03-02T14:13:20.935Z","4.0.0":"2026-03-03T04:21:06.455Z","4.0.1":"2026-03-04T23:13:07.366Z"},"bugs":{"url":"https://github.com/Abderraouf-yt/got-mcp/issues"},"author":{"name":"Abderraouf-yt"},"license":"MIT","homepage":"https://github.com/Abderraouf-yt/got-mcp#readme","keywords":["mcp","model-context-protocol","graph-of-thoughts","got","reasoning","ai-agents","dag","beam-search","weighted-aggregation","thought-graph"],"repository":{"type":"git","url":"git+https://github.com/Abderraouf-yt/got-mcp.git"},"description":"Graph of Thoughts (GoT) MCP Server — bounded, auditable reasoning for AI agents","maintainers":[{"name":"abderraouf-yt","email":"toumi221095@gmail.com"}],"readme":"<p align=\"center\">\r\n  <img src=\"docs/assets/hero-complex-graph.png\" alt=\"GoT MCP — 13-node reasoning DAG visualized in cyber-industrial UI\" width=\"100%\" />\r\n</p>\r\n\r\n<h1 align=\"center\">🧠 GOT MCP</h1>\r\n\r\n<p align=\"center\">\r\n  <strong>Graph of Thoughts MCP Server — Bounded, Auditable Reasoning for AI Agents</strong>\r\n</p>\r\n\r\n<p align=\"center\">\r\n  <a href=\"https://www.npmjs.com/package/@abderraouf-yt/got-mcp\"><img src=\"https://img.shields.io/npm/v/@abderraouf-yt/got-mcp?style=flat-square&color=00e5ff&label=npm\" alt=\"npm version\" /></a>\r\n  <a href=\"https://github.com/Abderraouf-yt/got-mcp\"><img src=\"https://img.shields.io/github/stars/Abderraouf-yt/got-mcp?style=flat-square&color=ff00ff&label=stars\" alt=\"GitHub stars\" /></a>\r\n  <a href=\"#\"><img src=\"https://img.shields.io/badge/node-%3E%3D20-00e5ff?style=flat-square\" alt=\"Node.js\" /></a>\r\n  <a href=\"#\"><img src=\"https://img.shields.io/badge/MCP-1.26+-ff00ff?style=flat-square\" alt=\"MCP SDK\" /></a>\r\n  <a href=\"#\"><img src=\"https://img.shields.io/badge/tools-16-00ff88?style=flat-square\" alt=\"Tools\" /></a>\r\n  <a href=\"LICENSE\"><img src=\"https://img.shields.io/badge/license-MIT-yellow?style=flat-square\" alt=\"License\" /></a>\r\n  <a href=\"https://arxiv.org/abs/2308.09687\"><img src=\"https://img.shields.io/badge/GoT-Besta%20et%20al.%202023-ff6b6b?style=flat-square\" alt=\"GoT Paper\" /></a>\r\n</p>\r\n\r\n<p align=\"center\">\r\n  <a href=\"#-quick-start\">⚡ Quick Start</a> •\r\n  <a href=\"#-tools-16\">🛠 Tools</a> •\r\n  <a href=\"#-how-it-thinks\">🧬 How It Thinks</a> •\r\n  <a href=\"#-governance\">🔒 Governance</a> •\r\n  <a href=\"#-visualizer\">📊 Visualizer</a>\r\n</p>\r\n\r\n---\r\n\r\n## What is this?\r\n\r\n> **Chain of Thought** reasons in a line. **Tree of Thought** can branch. **Graph of Thoughts** can branch, merge, contradict, prune dead ends, and converge on the winning path.\r\n\r\nThought Graph is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that gives AI agents **non-linear reasoning** — a directed acyclic graph where thoughts can branch into alternatives, get contradicted by evidence, and converge through weighted aggregation.\r\n\r\n```\r\nTraditional AI:    A → B → C → D          (linear, no backtracking)\r\nTree of Thought:   A → B₁, B₂             (branching, no merging)  \r\nGraph of Thoughts: A → B₁ ←contradiction→ C₁, B₂ →aggregate→ D  ← THIS\r\n```\r\n\r\n<table>\r\n<tr>\r\n<td width=\"33%\" align=\"center\"><strong>🔗 Chain of Thought</strong><br/>Linear • No backtrack</td>\r\n<td width=\"33%\" align=\"center\"><strong>🌲 Tree of Thoughts</strong><br/>Branching • No merge</td>\r\n<td width=\"33%\" align=\"center\"><strong>🧠 Graph of Thoughts</strong><br/>Branch • Merge • Prune • Converge</td>\r\n</tr>\r\n</table>\r\n\r\n---\r\n\r\n## ⚡ Quick Start\r\n\r\n### Option 1: Install from npm\r\n\r\n```bash\r\nnpm install -g @abderraouf-yt/got-mcp\r\n```\r\n\r\n### Option 2: Clone & Build\r\n\r\n```bash\r\ngit clone https://github.com/Abderraouf-yt/got-mcp.git\r\ncd got-mcp\r\nnpm install && npm run build\r\n```\r\n\r\n### Configure your IDE\r\n\r\nAdd to your MCP config (`~/.gemini/settings.json`, VS Code `mcp.json`, etc.):\r\n\r\n```json\r\n{\r\n  \"got-mcp\": {\r\n    \"command\": \"npx\",\r\n    \"args\": [\"-y\", \"@abderraouf-yt/got-mcp\"],\r\n    \"env\": { \"THOUGHT_GRAPH_HTTP_PORT\": \"3001\" }\r\n  }\r\n}\r\n```\r\n\r\n---\r\n\r\n## 🎬 Live Demo\r\n\r\n**Problem:** *\"Should we use CRDTs or Operational Transformation for a collaborative editor?\"*\r\n\r\nThe agent explored 3 branches, evaluated 13 nodes, rejected dead ends, and converged on a hybrid solution — all visible in the graph:\r\n\r\n```mermaid\r\ngraph TD\r\n    classDef validated fill:#00ff88,stroke:#00ff88,color:#000\r\n    classDef rejected fill:#ff4444,stroke:#ff4444,color:#fff\r\n    classDef active fill:#00e5ff,stroke:#00e5ff,color:#000\r\n    classDef winner fill:#ffd700,stroke:#ffd700,color:#000\r\n\r\n    N1[\"🎯 CRDTs vs OT?<br/>80%\"]:::validated\r\n\r\n    N2[\"📖 CRDT Research<br/>85%\"]:::validated\r\n    N3[\"📖 OT Research<br/>70%\"]:::active\r\n\r\n    N4[\"🌿 Branch A: Yjs<br/>90%\"]:::validated\r\n    N5[\"❌ Branch B: ShareDB<br/>40%\"]:::rejected\r\n    N11[\"🌿 Branch C: Hybrid<br/>95%\"]:::validated\r\n\r\n    N6[\"✅ TypeScript + ProseMirror<br/>sub-100ms sync · 95%\"]:::validated\r\n    N7[\"⚠️ Memory overhead<br/>10x state size · 65%\"]:::active\r\n\r\n    N8[\"❌ MongoDB persistence<br/>50%\"]:::rejected\r\n    N9[\"💀 Cannot work offline<br/>90%\"]:::validated\r\n\r\n    N10[\"🔧 Y.Doc compaction<br/>90% size reduction · 92%\"]:::validated\r\n    N12[\"✅ Liveblocks + Tiptap<br/>+ Hocuspocus · 88%\"]:::validated\r\n    N13[\"🏆 WINNER: Yjs +<br/>y-websocket + Hocuspocus<br/>100%\"]:::winner\r\n\r\n    N1 -->|refinement| N2\r\n    N1 -->|refinement| N3\r\n    N1 -->|branch| N11\r\n\r\n    N2 -->|branch| N4\r\n    N3 -->|branch| N5\r\n\r\n    N4 -->|support| N6\r\n    N4 -->|contradiction| N7\r\n\r\n    N5 -->|support| N8\r\n    N5 -->|contradiction| N9\r\n\r\n    N7 -->|refinement| N10\r\n\r\n    N11 -->|support| N12\r\n    N11 -->|refinement| N13\r\n```\r\n\r\n> **Result:** OT branch rejected (offline failure). CRDT memory concern contradicted then resolved via compaction. Hybrid path wins at 100%.\r\n\r\n<details>\r\n<summary>🔁 <strong>Load this demo yourself</strong></summary>\r\n\r\n```bash\r\ncp docs/assets/demo-state.json thought-graph-state.json\r\nnpm run start\r\n# Open visualizer → http://localhost:5173\r\n```\r\n\r\nThe demo state ships with the repo in `docs/assets/demo-state.json`.\r\n\r\n</details>\r\n\r\n---\r\n\r\n## 🛠 Tools (16)\r\n\r\n<table>\r\n<tr><th>Tool</th><th>What it does</th><th>Category</th></tr>\r\n<tr><td><code>propose_thought</code></td><td>Add a reasoning node with optional parent + relation</td><td>🧠 Core</td></tr>\r\n<tr><td><code>evaluate_thought</code></td><td>Score (0.0–1.0) + critique. Omit score → autonomous LLM audit</td><td>🧠 Core</td></tr>\r\n<tr><td><code>get_thought_graph</code></td><td>Retrieve the full DAG state</td><td>🧠 Core</td></tr>\r\n<tr><td><code>reset_graph</code></td><td>Clear graph for new session</td><td>🧠 Core</td></tr>\r\n<tr><td><code>aggregate_thoughts</code></td><td>Merge 2+ nodes → weighted synthesis <code>Σ(score×weight)/Σ(weights)</code></td><td>⚡ GoT</td></tr>\r\n<tr><td><code>prune_branch</code></td><td>Hard (reject+zero) or Soft (score decay) pruning</td><td>⚡ GoT</td></tr>\r\n<tr><td><code>find_winning_path</code></td><td>Greedy DFS or beam search (k-best paths) with threshold gating</td><td>⚡ GoT</td></tr>\r\n<tr><td><code>get_graph_metrics</code></td><td>Node count, max depth, prune ratio, avg score, status breakdown</td><td>📊 Ops</td></tr>\r\n<tr><td><code>export_snapshot</code></td><td>Full graph serialization for replay/recovery</td><td>🔁 Replay</td></tr>\r\n<tr><td><code>restore_snapshot</code></td><td>Restore from previously exported snapshot</td><td>🔁 Replay</td></tr>\r\n<tr><td><code>reflect_and_refine</code></td><td>Self-reflection: 4-axis confidence + auto-critique + branch</td><td>🔬 v4.0</td></tr>\r\n<tr><td><code>context_set</code></td><td>Write key-value to shared context store with provenance</td><td>📦 v4.0</td></tr>\r\n<tr><td><code>context_get</code></td><td>Read value + source from shared context store</td><td>📦 v4.0</td></tr>\r\n<tr><td><code>context_list</code></td><td>List all context store entries and their sources</td><td>📦 v4.0</td></tr>\r\n<tr><td><code>export_reasoning_trace</code></td><td>Export winning path as Long CoT trace (DeepSeek-R1/o3 format)</td><td>📤 v4.0</td></tr>\r\n<tr><td><code>run_controller_loop</code></td><td>Autonomous GoT orchestrator: seed → evaluate → branch → reflect → prune → converge</td><td>🔄 v4.0</td></tr>\r\n</table>\r\n\r\n### Edge Relations\r\n\r\n`refinement` · `contradiction` · `support` · `branch` · `aggregation` · `reflection`\r\n\r\n### Node Statuses\r\n\r\n`active` · `validated` · `rejected` · `branching`\r\n\r\n---\r\n\r\n## 🧬 How It Thinks\r\n\r\n```\r\nAgent: I need to decide between PostgreSQL and MongoDB.\r\n\r\n→ propose_thought(\"PostgreSQL vs MongoDB for user data store?\")\r\n→ propose_thought(\"PostgreSQL: ACID, strong schema\", parent: \"node_1\", relation: \"branch\")\r\n→ propose_thought(\"MongoDB: flexible schema, horizontal scaling\", parent: \"node_1\", relation: \"branch\")\r\n→ propose_thought(\"Our data has relational patterns: user→orders→items\", parent: \"node_2\", relation: \"support\")\r\n→ propose_thought(\"MongoDB can't enforce referential integrity\", parent: \"node_3\", relation: \"contradiction\")\r\n→ evaluate_thought(\"node_3\", score: 0.3, status: \"rejected\")\r\n→ prune_branch(\"node_3\", reason: \"Relational data needs relational DB\")\r\n→ find_winning_path(beamWidth: 2, scoreThreshold: 0.5)\r\n  ↳ Winner: node_1 → node_2 → node_4 (PostgreSQL path, score: 2.75)\r\n```\r\n\r\n---\r\n\r\n## 🔒 Governance\r\n\r\nEngine-level guards — enforced in the graph engine, not the tool layer:\r\n\r\n| Guard | Default | Enforcement |\r\n|-------|---------|-------------|\r\n| **Node cap** | 200 | `addNode()` throws at limit |\r\n| **Depth cap** | 15 | `addEdge()` validates depth |\r\n| **Branch cap** | 5 children/node | `addEdge()` limits branching |\r\n| **Cycle detection** | Always on | BFS reachability in `addEdge()` |\r\n| **Thought length** | 5,000 chars | `addNode()` + Zod schema |\r\n| **Aggregation limit** | 10 inputs | `aggregateNodes()` |\r\n| **Prune cascade** | 50 nodes | `pruneFromNode()` |\r\n| **Confidence clamp** | [0, 1] | `aggregateNodes()` |\r\n\r\n<details>\r\n<summary>⚙️ <strong>Custom Limits</strong></summary>\r\n\r\nOverride defaults via constructor:\r\n\r\n```typescript\r\nconst graph = new ThoughtGraph(persistPath, {\r\n  maxNodes: 500,\r\n  maxDepth: 25,\r\n  maxBranchFactor: 8,\r\n  maxThoughtLength: 10000,\r\n  maxAggregationInputs: 20,\r\n  maxPruneCascade: 100,\r\n});\r\n```\r\n\r\n</details>\r\n\r\n### Session Isolation\r\n\r\nEach session gets its own isolated graph with separate persistence:\r\n\r\n```typescript\r\nconst alice = getGraphInstance(\"user-alice\");  // → thought-graph-state-user-alice.json\r\nconst bob   = getGraphInstance(\"user-bob\");    // → thought-graph-state-user-bob.json\r\n// Alice and Bob never share state\r\n```\r\n\r\n### Concurrency Safety\r\n\r\nAll mutations run under an async mutex:\r\n\r\n```typescript\r\nawait graph.withLock(async () => {\r\n  graph.addNode(\"Safe concurrent mutation\");\r\n});\r\n```\r\n\r\n### Snapshot Replay\r\n\r\n```typescript\r\nconst snapshot = graph.exportSnapshot();\r\n// { nodes, edges, nodeCounter, timestamp, version: \"3.0.0\", stateVersion: 42 }\r\n\r\ngraph.restoreSnapshot(snapshot);  // Deterministic replay\r\n```\r\n\r\n---\r\n\r\n## 📊 Visualizer\r\n\r\n**[🌐 Live Demo →](https://got-mcp-visualizer.netlify.app)**\r\n\r\nA React 19 + Vite dashboard with a **cyber-industrial UI** — real-time graph rendering via React Flow + Dagre layout.\r\n\r\n| Feature | Detail |\r\n|---------|--------|\r\n| **Layout** | Dagre hierarchical DAG |\r\n| **Live sync** | SWR polling (2s interval) |\r\n| **Node colors** | 🟢 Validated · 🔵 Active · 🔴 Rejected · 🟣 Branching |\r\n| **Edge types** | Animated (branch) · Dashed (contradiction) · Solid (support) · Dotted (aggregation) |\r\n| **Score bars** | Per-node confidence (0–100%) |\r\n| **Minimap** | Bottom-right overview |\r\n\r\n```bash\r\ncd visualizer && npm install && npm run dev\r\n# → http://localhost:5173\r\n```\r\n\r\n### Architecture\r\n\r\n```\r\n┌─────────────────┐     Stdio      ┌──────────────────┐\r\n│   AI Agent      │ ◄────────────► │  MCP Server      │\r\n│ (Gemini/Cursor) │                │  (index.ts)      │\r\n└─────────────────┘                │                  │\r\n                                   │  Session Registry │\r\n┌─────────────────┐    HTTP:3001   │  ThoughtGraph[]  │\r\n│   Visualizer    │ ◄────────────► │                  │\r\n│  React + Vite   │   /api/graph   │  Express Bridge  │\r\n│  :5173          │                └──────────────────┘\r\n└─────────────────┘                        │\r\n                              thought-graph-state-{session}.json\r\n                              (per-session file persistence)\r\n```\r\n\r\n---\r\n\r\n## 🔬 GoT Compliance\r\n\r\nBased on [Besta et al., 2023 — \"Graph of Thoughts\"](https://arxiv.org/abs/2308.09687):\r\n\r\n| Primitive | Implementation | Version |\r\n|-----------|---------------|---------|\r\n| **Generate** | `propose_thought` | v1.0 |\r\n| **Evaluate** | `evaluate_thought` | v1.0 |\r\n| **Backtrack** | `evaluate_thought(status: rejected)` | v1.0 |\r\n| **Aggregate** | `aggregate_thoughts` — weighted synthesis | v3.0 |\r\n| **Prune** | `prune_branch` — hard + soft modes | v3.0 |\r\n| **Converge** | `find_winning_path` — beam search | v3.0 |\r\n| **Governance** | Engine-level guards + session isolation | v3.0 |\r\n| **Replay** | `export_snapshot` / `restore_snapshot` | v3.0 |\r\n| **Self-Reflect** | `reflect_and_refine` — 4-axis confidence | v4.0 |\r\n| **Context Store** | `context_set` / `context_get` / `context_list` | v4.0 |\r\n| **Reasoning Trace** | `export_reasoning_trace` — Long CoT export | v4.0 |\r\n| **Controller Loop** | `run_controller_loop` — autonomous orchestrator | v4.0 |\r\n\r\n---\r\n\r\n## 🏗 Tech Stack\r\n\r\n| Layer | Technology |\r\n|-------|-----------|\r\n| Runtime | TypeScript · Node.js v20+ |\r\n| Protocol | `@modelcontextprotocol/sdk` ^1.26 |\r\n| Validation | Zod schemas with `.max()` length guards |\r\n| Governance | Engine-level: node/depth/branch caps, cycle detection |\r\n| HTTP Bridge | Express |\r\n| Visualizer | React 19 · Vite · `@xyflow/react` · Dagre · SWR |\r\n| Persistence | Session-scoped JSON with `fs.watchFile` sync |\r\n| Concurrency | Async mutex (`withLock`) per session |\r\n\r\n## 📁 Structure\r\n\r\n```\r\nthought-graph/\r\n├── src/\r\n│   ├── index.ts              # Bootstrap (Stdio + HTTP)\r\n│   ├── server/\r\n│   │   ├── mcp.ts            # 16 MCP tool registrations\r\n│   │   └── http.ts           # Express bridge (minimal inline CORS)\r\n│   ├── graph/\r\n│   │   ├── ThoughtGraph.ts   # Core DAG engine + governance\r\n│   │   └── index.ts          # Session registry exports\r\n│   ├── context/\r\n│   │   ├── ContextStore.ts   # Shared context store (CA-MCP)\r\n│   │   └── index.ts          # Context singleton export\r\n│   └── types.ts              # GraphLimits, ConfidenceVector, ReasoningTrace\r\n├── visualizer/               # React + Vite dashboard (local only)\r\n├── evaluations/              # XML evaluation framework\r\n├── tests/                    # Unit tests\r\n├── docs/assets/              # Demo screenshots & state\r\n└── dist/                     # Compiled output\r\n```\r\n\r\n## 📜 License\r\n\r\nMIT\r\n\r\n---\r\n\r\n<p align=\"center\">\r\n  <sub>Evolution of sequential thinking — because the best ideas don't come in a straight line.</sub>\r\n</p>\r\n","readmeFilename":"README.md"}