thinkstack-core 4.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. thinkstack_core/__init__.py +158 -0
  2. thinkstack_core/aggphi_textual.py +275 -0
  3. thinkstack_core/alerts/__init__.py +23 -0
  4. thinkstack_core/alerts/base.py +46 -0
  5. thinkstack_core/alerts/config.py +60 -0
  6. thinkstack_core/alerts/dispatcher.py +110 -0
  7. thinkstack_core/alerts/jira.py +96 -0
  8. thinkstack_core/alerts/linear.py +72 -0
  9. thinkstack_core/alerts/pagerduty.py +66 -0
  10. thinkstack_core/alerts/slack.py +81 -0
  11. thinkstack_core/alerts/teams.py +70 -0
  12. thinkstack_core/audit/__init__.py +43 -0
  13. thinkstack_core/audit/exporter.py +297 -0
  14. thinkstack_core/audit/privacy.py +101 -0
  15. thinkstack_core/audit/scrubber.py +149 -0
  16. thinkstack_core/audit/service.py +67 -0
  17. thinkstack_core/audit/signing.py +127 -0
  18. thinkstack_core/broadcast/__init__.py +4 -0
  19. thinkstack_core/broadcast/broadcaster.py +100 -0
  20. thinkstack_core/broadcast/watcher.py +71 -0
  21. thinkstack_core/capability.py +639 -0
  22. thinkstack_core/cloud/__init__.py +1 -0
  23. thinkstack_core/cloud/client_config.py +472 -0
  24. thinkstack_core/cloud/client_configs/.claude-opencode-fallback.json +8 -0
  25. thinkstack_core/cloud/client_configs/.claude-stdio.json +13 -0
  26. thinkstack_core/cloud/client_configs/.cursor-mcp.json +13 -0
  27. thinkstack_core/cloud/client_configs/.opencode-bridge.json +13 -0
  28. thinkstack_core/cloud/client_configs/.opencode.json +15 -0
  29. thinkstack_core/cloud/client_configs/.vscode-mcp.json +13 -0
  30. thinkstack_core/cloud/mcp_client.py +229 -0
  31. thinkstack_core/cloud/setup.py +144 -0
  32. thinkstack_core/cloud/sync.py +143 -0
  33. thinkstack_core/cloud/sync_bundle.py +639 -0
  34. thinkstack_core/cloud/sync_conflicts.py +183 -0
  35. thinkstack_core/cloud/sync_state.py +159 -0
  36. thinkstack_core/cloud/team_sync.py +337 -0
  37. thinkstack_core/cloud/thinkstack-mcp-bridge.js +357 -0
  38. thinkstack_core/codex/__init__.py +9 -0
  39. thinkstack_core/codex/__main__.py +97 -0
  40. thinkstack_core/codex/capture.py +208 -0
  41. thinkstack_core/codex/proxy.py +412 -0
  42. thinkstack_core/compat.py +103 -0
  43. thinkstack_core/concept_catalog.py +209 -0
  44. thinkstack_core/consolidation/__init__.py +3 -0
  45. thinkstack_core/consolidation/synthesizer.py +87 -0
  46. thinkstack_core/consolidation/workflow.py +175 -0
  47. thinkstack_core/daemon/__init__.py +27 -0
  48. thinkstack_core/daemon/supervisor.py +293 -0
  49. thinkstack_core/daemon/watcher.py +244 -0
  50. thinkstack_core/dashboard_api.py +2012 -0
  51. thinkstack_core/deltaf.py +97 -0
  52. thinkstack_core/disclosure.py +50 -0
  53. thinkstack_core/divergence/__init__.py +3 -0
  54. thinkstack_core/divergence/detector.py +166 -0
  55. thinkstack_core/gateway/__init__.py +32 -0
  56. thinkstack_core/gateway/key_manager.py +124 -0
  57. thinkstack_core/gateway/metrics_webhook.py +252 -0
  58. thinkstack_core/gateway/policy.py +262 -0
  59. thinkstack_core/gateway/server.py +727 -0
  60. thinkstack_core/gateway/sso.py +233 -0
  61. thinkstack_core/gcc.py +1246 -0
  62. thinkstack_core/github/__init__.py +35 -0
  63. thinkstack_core/github/app.py +240 -0
  64. thinkstack_core/github/comment_builder.py +113 -0
  65. thinkstack_core/github/pat.py +76 -0
  66. thinkstack_core/github/pr_parser.py +82 -0
  67. thinkstack_core/github/pr_reporter.py +555 -0
  68. thinkstack_core/gitlab/__init__.py +177 -0
  69. thinkstack_core/hitl/__init__.py +4 -0
  70. thinkstack_core/hitl/channels.py +129 -0
  71. thinkstack_core/hitl/orchestrator.py +95 -0
  72. thinkstack_core/hooks/__init__.py +17 -0
  73. thinkstack_core/hooks/claude_code.py +228 -0
  74. thinkstack_core/hooks/git_capture.py +341 -0
  75. thinkstack_core/hooks/git_commit.py +182 -0
  76. thinkstack_core/hooks/installer.py +850 -0
  77. thinkstack_core/hooks/pre_commit.py +157 -0
  78. thinkstack_core/hooks/runner.py +386 -0
  79. thinkstack_core/identity/__init__.py +4 -0
  80. thinkstack_core/identity/agent.py +86 -0
  81. thinkstack_core/identity/providers.py +85 -0
  82. thinkstack_core/invariants.py +182 -0
  83. thinkstack_core/mcp/__init__.py +10 -0
  84. thinkstack_core/mcp/auth.py +177 -0
  85. thinkstack_core/mcp/server.py +1215 -0
  86. thinkstack_core/metrics/__init__.py +35 -0
  87. thinkstack_core/metrics/aggregate.py +215 -0
  88. thinkstack_core/metrics/calibrate.py +198 -0
  89. thinkstack_core/metrics/calibration.py +125 -0
  90. thinkstack_core/metrics/credibility.py +288 -0
  91. thinkstack_core/metrics/delivery_time.py +70 -0
  92. thinkstack_core/metrics/dhs.py +126 -0
  93. thinkstack_core/metrics/mcs.py +96 -0
  94. thinkstack_core/metrics/roi.py +88 -0
  95. thinkstack_core/metrics/session_writer.py +81 -0
  96. thinkstack_core/metrics/shadow_ai.py +117 -0
  97. thinkstack_core/metrics/sprint_writer.py +243 -0
  98. thinkstack_core/observability/__init__.py +78 -0
  99. thinkstack_core/observability/datadog.py +157 -0
  100. thinkstack_core/observability/formatter.py +119 -0
  101. thinkstack_core/observability/report.py +264 -0
  102. thinkstack_core/observability/servicenow.py +147 -0
  103. thinkstack_core/observability/splunk.py +218 -0
  104. thinkstack_core/observability/webhook.py +227 -0
  105. thinkstack_core/parser/__init__.py +30 -0
  106. thinkstack_core/parser/blocks.py +216 -0
  107. thinkstack_core/parser/inference.py +159 -0
  108. thinkstack_core/parser/thinking.py +112 -0
  109. thinkstack_core/projects.py +169 -0
  110. thinkstack_core/prompt_artifact.py +76 -0
  111. thinkstack_core/proxy/__init__.py +9 -0
  112. thinkstack_core/proxy/routes/__init__.py +1 -0
  113. thinkstack_core/proxy/routes/anthropic.py +264 -0
  114. thinkstack_core/proxy/routes/azure_openai.py +336 -0
  115. thinkstack_core/proxy/routes/gemini.py +331 -0
  116. thinkstack_core/proxy/routes/groq.py +284 -0
  117. thinkstack_core/proxy/routes/ollama.py +279 -0
  118. thinkstack_core/proxy/routes/openai.py +287 -0
  119. thinkstack_core/proxy/server.py +356 -0
  120. thinkstack_core/query/__init__.py +15 -0
  121. thinkstack_core/query/grep.py +181 -0
  122. thinkstack_core/query/hybrid.py +86 -0
  123. thinkstack_core/query/semantic.py +157 -0
  124. thinkstack_core/rdp.py +105 -0
  125. thinkstack_core/reasoning/__init__.py +4 -0
  126. thinkstack_core/reasoning/entry.py +31 -0
  127. thinkstack_core/reasoning/store.py +122 -0
  128. thinkstack_core/reasoning_plus/__init__.py +70 -0
  129. thinkstack_core/reasoning_plus/augmenter.py +337 -0
  130. thinkstack_core/reasoning_plus/capture.py +51 -0
  131. thinkstack_core/reasoning_plus/config.py +313 -0
  132. thinkstack_core/reasoning_plus/context.py +262 -0
  133. thinkstack_core/reasoning_plus/learning/__init__.py +125 -0
  134. thinkstack_core/reasoning_plus/learning/analytics.py +141 -0
  135. thinkstack_core/reasoning_plus/learning/api.py +784 -0
  136. thinkstack_core/reasoning_plus/learning/chain.py +285 -0
  137. thinkstack_core/reasoning_plus/learning/composer.py +141 -0
  138. thinkstack_core/reasoning_plus/learning/conflicts.py +184 -0
  139. thinkstack_core/reasoning_plus/learning/context_collector.py +194 -0
  140. thinkstack_core/reasoning_plus/learning/cross_project.py +234 -0
  141. thinkstack_core/reasoning_plus/learning/deny_list.py +108 -0
  142. thinkstack_core/reasoning_plus/learning/embeddings.py +209 -0
  143. thinkstack_core/reasoning_plus/learning/evolution.py +119 -0
  144. thinkstack_core/reasoning_plus/learning/extractor.py +271 -0
  145. thinkstack_core/reasoning_plus/learning/filter_five_layer.py +95 -0
  146. thinkstack_core/reasoning_plus/learning/models.py +149 -0
  147. thinkstack_core/reasoning_plus/learning/org_store.py +156 -0
  148. thinkstack_core/reasoning_plus/learning/pii.py +142 -0
  149. thinkstack_core/reasoning_plus/learning/promotion.py +58 -0
  150. thinkstack_core/reasoning_plus/learning/provenance.py +126 -0
  151. thinkstack_core/reasoning_plus/learning/recorder.py +81 -0
  152. thinkstack_core/reasoning_plus/learning/relevance.py +122 -0
  153. thinkstack_core/reasoning_plus/learning/state.py +86 -0
  154. thinkstack_core/reasoning_plus/learning/store.py +178 -0
  155. thinkstack_core/reasoning_plus/learning/theta_learning_bridge.py +94 -0
  156. thinkstack_core/reasoning_plus/prompt.py +90 -0
  157. thinkstack_core/rep.py +134 -0
  158. thinkstack_core/rep_network/__init__.py +25 -0
  159. thinkstack_core/rep_network/merge.py +70 -0
  160. thinkstack_core/rep_network/node.py +137 -0
  161. thinkstack_core/rep_network/server.py +140 -0
  162. thinkstack_core/rep_network/sync.py +207 -0
  163. thinkstack_core/sensitivity.py +182 -0
  164. thinkstack_core/serve.py +258 -0
  165. thinkstack_core/session/__init__.py +39 -0
  166. thinkstack_core/session/disagreement.py +188 -0
  167. thinkstack_core/session/models.py +114 -0
  168. thinkstack_core/session/orchestrator.py +182 -0
  169. thinkstack_core/session/planner.py +169 -0
  170. thinkstack_core/session/simulator.py +132 -0
  171. thinkstack_core/signing.py +290 -0
  172. thinkstack_core/sis.py +197 -0
  173. thinkstack_core/skills/pr-reviewer/SKILL.md +204 -0
  174. thinkstack_core/skills/thinkstack-auto-sync/SKILL.md +175 -0
  175. thinkstack_core/skills/thinkstack-session-start/SKILL.md +136 -0
  176. thinkstack_core/storage.py +308 -0
  177. thinkstack_core/templates/__init__.py +6 -0
  178. thinkstack_core/templates/engine.py +122 -0
  179. thinkstack_core/templates/go.py +18 -0
  180. thinkstack_core/templates/infra.py +19 -0
  181. thinkstack_core/templates/library/__init__.py +18 -0
  182. thinkstack_core/templates/library/api_design.md +27 -0
  183. thinkstack_core/templates/library/bug_fix.md +27 -0
  184. thinkstack_core/templates/library/decision_record.md +27 -0
  185. thinkstack_core/templates/library/engine.py +228 -0
  186. thinkstack_core/templates/library/security_review.md +30 -0
  187. thinkstack_core/templates/python.py +19 -0
  188. thinkstack_core/templates/react.py +18 -0
  189. thinkstack_core/templates/typescript.py +18 -0
  190. thinkstack_core/theta.py +221 -0
  191. thinkstack_core/theta_synthesis.py +268 -0
  192. thinkstack_core/topics.py +320 -0
  193. thinkstack_core/variance.py +219 -0
  194. thinkstack_core/wrapper/__init__.py +52 -0
  195. thinkstack_core/wrapper/anthropic.py +487 -0
  196. thinkstack_core/wrapper/base.py +562 -0
  197. thinkstack_core/wrapper/bedrock.py +342 -0
  198. thinkstack_core/wrapper/gemini.py +422 -0
  199. thinkstack_core/wrapper/ollama.py +527 -0
  200. thinkstack_core/wrapper/openai.py +461 -0
  201. thinkstack_core-4.0.0.dist-info/METADATA +868 -0
  202. thinkstack_core-4.0.0.dist-info/RECORD +205 -0
  203. thinkstack_core-4.0.0.dist-info/WHEEL +5 -0
  204. thinkstack_core-4.0.0.dist-info/entry_points.txt +2 -0
  205. thinkstack_core-4.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,868 @@
1
+ Metadata-Version: 2.4
2
+ Name: thinkstack-core
3
+ Version: 4.0.0
4
+ Summary: ThinkStack — AI reasoning capture, audit trail, and governance for agent-assisted development (core library)
5
+ Author-email: Hemant Joshi <hemant@flotorch.ai>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/hemantcgi/ThinkStack
8
+ Project-URL: Repository, https://github.com/hemantcgi/ThinkStack
9
+ Project-URL: Documentation, https://github.com/hemantcgi/ThinkStack/blob/main/Implementation/README.md
10
+ Keywords: ai,agents,governance,audit,llm,reasoning,thinkstack
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
24
+ Requires-Dist: boto3>=1.34.0; extra == "dev"
25
+ Requires-Dist: pyyaml>=6.0; extra == "dev"
26
+ Requires-Dist: pdfminer.six>=20221105; extra == "dev"
27
+ Provides-Extra: wrapper
28
+ Requires-Dist: anthropic>=0.40.0; extra == "wrapper"
29
+ Requires-Dist: openai>=1.50.0; extra == "wrapper"
30
+ Requires-Dist: google-generativeai>=0.8.0; extra == "wrapper"
31
+ Requires-Dist: boto3>=1.35.0; extra == "wrapper"
32
+ Requires-Dist: tiktoken>=0.7.0; extra == "wrapper"
33
+ Provides-Extra: proxy
34
+ Requires-Dist: fastapi>=0.115.0; extra == "proxy"
35
+ Requires-Dist: uvicorn[standard]>=0.32.0; extra == "proxy"
36
+ Requires-Dist: httpx>=0.27.0; extra == "proxy"
37
+ Requires-Dist: pydantic>=2.9.0; extra == "proxy"
38
+ Provides-Extra: embeddings
39
+ Requires-Dist: sentence-transformers>=3.0.0; extra == "embeddings"
40
+ Provides-Extra: mcp
41
+ Requires-Dist: mcp>=1.0.0; extra == "mcp"
42
+ Provides-Extra: audit
43
+ Requires-Dist: cryptography>=42.0.0; extra == "audit"
44
+ Requires-Dist: reportlab>=4.0.0; extra == "audit"
45
+ Requires-Dist: presidio-analyzer>=2.2.0; extra == "audit"
46
+ Provides-Extra: cloud
47
+ Requires-Dist: fastapi>=0.111.0; extra == "cloud"
48
+ Requires-Dist: uvicorn[standard]>=0.29.0; extra == "cloud"
49
+ Requires-Dist: boto3>=1.34.0; extra == "cloud"
50
+ Requires-Dist: PyJWT>=2.8.0; extra == "cloud"
51
+ Requires-Dist: cryptography>=42.0.0; extra == "cloud"
52
+ Requires-Dist: PyNaCl>=1.5.0; extra == "cloud"
53
+ Requires-Dist: azure-storage-blob>=12.19.0; extra == "cloud"
54
+ Provides-Extra: broadcast
55
+ Requires-Dist: watchdog>=3.0.0; extra == "broadcast"
56
+ Provides-Extra: all
57
+ Requires-Dist: thinkstack-core[audit,cloud,embeddings,mcp,proxy,wrapper]; extra == "all"
58
+
59
+ # ThinkStack
60
+
61
+ **Local-first AI agent governance.** ThinkStack gives multi-agent systems a shared on-disk audit trail, coordination vector, privacy controls, and LLM integration layer — all without a remote service.
62
+
63
+ > **Latest release:** `thinkstack-core` and `thinkstack-cli` **3.0.2** — Local-first AI governance split into a core SDK (`thinkstack-core`) and a CLI (`thinkstack-cli`). Install or upgrade with `pip install -U thinkstack-cli`.
64
+
65
+ ```bash
66
+ pip install -U thinkstack-cli>=3.0.1
67
+ thinkstack init
68
+ thinkstack setup # connects to Claude Code, Cursor, or Antigravity
69
+ thinkstack debug timeline
70
+ ```
71
+
72
+ ---
73
+
74
+ ## What it does
75
+
76
+ | Concern | ThinkStack feature |
77
+ |---------|-----------------|
78
+ | Reasoning audit trail | Append-only `.GCC/events.log.jsonl` with SHA-256 hash chain |
79
+ | Multi-agent coordination | Coordination vector Θ — shared sensitivity map across agents |
80
+ | Privacy compliance | RDP ε-budget tracking; `[PRIVATE]` span suppression; SIS-TC quarantine |
81
+ | LLM integration | SDK wrappers, HTTP proxy, Claude Code MCP server + hooks |
82
+ | Cloud MCP server | Multi-tenant SSE endpoint; AWS S3, Azure Blob, Cloudflare R2 storage; API key + GitHub OAuth + SSO/JWKS auth |
83
+ | Governance observability | Structured reports, browser dashboard, VS Code extension (Antigravity-compatible) |
84
+ | Alerting | Slack, Jira, PagerDuty outbound webhooks |
85
+ | Metrics | MCS, DHS, ROI — all traceable to citations or explicit design choices |
86
+
87
+ ### Reasoning Plus
88
+
89
+ Reasoning Plus is ThinkStack’s default augmentation mode: before every LLM call, it gathers smart context from your workspace, asks the model to produce inline `<thinking>` reasoning, and learns from previous calls by re-injecting relevant reasoning into subsequent prompts. The reasoning is captured to `.GCC/` automatically and stripped from the response your tool sees.
90
+
91
+ ```bash
92
+ thinkstack reasoning-plus status # show current settings
93
+ thinkstack reasoning-plus enable # turn on per project
94
+ thinkstack reasoning-plus disable # turn off per project
95
+ thinkstack reasoning-plus config --smart-top-n 3 --smart-max-lines 150 --learning-top-n 3
96
+ ```
97
+
98
+ Set `THINKSTACK_REASONING_PLUS=0` to disable it for a single session. See [REASONING_PLUS.md](REASONING_PLUS.md) for details.
99
+
100
+ Everything lives in `.GCC/` — a local directory in your project. No database, no network service, no telemetry.
101
+
102
+ ---
103
+
104
+ ## Install
105
+
106
+ ```bash
107
+ pip install thinkstack-cli
108
+ ```
109
+
110
+ **Requirements:** Python 3.10+
111
+
112
+ One-liner installer (Linux/macOS/WSL):
113
+
114
+ ```bash
115
+ curl -fsSL https://raw.githubusercontent.com/hemantcgi/ThinkStack/main/Implementation/scripts/install.sh | bash
116
+ ```
117
+
118
+ This installs `thinkstack-cli` into an isolated virtual environment at `~/.thinkstack-venv` and links `thinkstack` onto PATH. It also supports `pip install` if you prefer to manage your own environment.
119
+
120
+ For optional extras:
121
+
122
+ ```bash
123
+ pip install thinkstack-cli[wrapper] # SDK wrappers (Anthropic, OpenAI, Gemini, Bedrock, Ollama)
124
+ pip install thinkstack-cli[proxy] # HTTP proxy + dashboard API (FastAPI)
125
+ pip install thinkstack-cli[all] # everything
126
+ ```
127
+
128
+ > PyPI packages are `thinkstack-core` (library/SDK) and `thinkstack-cli` (CLI). The CLI command and import paths remain `thinkstack` / `thinkstack_core`.
129
+
130
+ ---
131
+
132
+ ## Upgrade from an older version
133
+
134
+ ThinkStack preserves your `.GCC/` store across upgrades. Newer releases add IDE configs, hooks, or governance instructions, so you should re-run `thinkstack setup` after upgrading.
135
+
136
+ **Upgrade any time:**
137
+
138
+ ```bash
139
+ pip install -U thinkstack-cli>=3.0.1
140
+ cd /path/to/your/project
141
+ thinkstack setup # or: thinkstack setup --target <ide>
142
+ thinkstack doctor
143
+ ```
144
+
145
+ `thinkstack setup` is idempotent:
146
+ - It rewrites `CLAUDE.md` / `AGENTS.md` with the latest governance instructions.
147
+ - It regenerates IDE-specific config files (`.claude/settings.json`, `.cursor/mcp.json`, `opencode.json`, etc.).
148
+ - It leaves existing `.GCC/` data untouched.
149
+
150
+ **If you use the cloud MCP server**, re-run the client config installer after upgrade to get the latest bridge and fallback settings:
151
+
152
+ ```bash
153
+ export THINKSTACK_MCP_DOMAIN=thinkstack-mcp.your-domain.com
154
+ thinkstack cloud client-config <ide> --org <org> --repo <repo> --api-key <api-key>
155
+ ```
156
+
157
+ Supported `<ide>` values: `opencode`, `claude`, `cursor`, `vscode`, `stdio`.
158
+
159
+ ---
160
+
161
+ ## Getting Started
162
+
163
+ ThinkStack takes **5 minutes to set up**. Pick your AI coding tool below.
164
+
165
+ > **Prerequisites:** Python 3.10+, pip, and the AI tool you plan to use.
166
+
167
+ ---
168
+
169
+ ### Claude Code
170
+
171
+ Claude Code is the highest-fidelity integration — hooks fire on every file write, MCP tools give Claude native governance commands, and `CLAUDE.md` carries persistent instructions across sessions.
172
+
173
+ **Step 1 — Install ThinkStack**
174
+ ```bash
175
+ pip install thinkstack-cli
176
+ ```
177
+
178
+ **Step 2 — Go to your project and run setup**
179
+ ```bash
180
+ cd /path/to/your/project
181
+ thinkstack setup
182
+ ```
183
+
184
+ This single command:
185
+ - Initialises `.GCC/` (the local governance store)
186
+ - Writes `.claude/hooks.json` so hooks fire on every Write, Edit, Bash, and Stop event
187
+ - Adds the ThinkStack MCP server to `.claude/settings.json`
188
+ - Writes governance instructions into `CLAUDE.md`
189
+
190
+ **Step 3 — Verify**
191
+ ```bash
192
+ thinkstack doctor
193
+ ```
194
+
195
+ Expected output: all checks green. If any check fails, the doctor output tells you exactly what to fix.
196
+
197
+ **Step 4 — Start using Claude Code**
198
+
199
+ Open Claude Code in your project. On the first task Claude will call `thinkstack_context` to load prior reasoning, and `thinkstack_commit` before any file edit. The `.GCC/` store captures everything automatically.
200
+
201
+ **What you get:** Full RACP integration — reasoning commits, sensitivity events, coordination vector Θ, divergence detection, HITL conflict resolution.
202
+
203
+ > **Updating from an older version:** `pip install -U thinkstack-cli>=3.0.1 && thinkstack setup` will rewrite `.claude/hooks.json`, `.claude/settings.json`, and `CLAUDE.md` with the latest versions.
204
+
205
+ ---
206
+
207
+ ### Cursor
208
+
209
+ Cursor is a VS Code fork with native MCP support. ThinkStack integrates via MCP tools and the VS Code sidebar extension.
210
+
211
+ **Step 1 — Install ThinkStack**
212
+ ```bash
213
+ pip install thinkstack-cli
214
+ ```
215
+
216
+ **Step 2 — Run setup**
217
+ ```bash
218
+ cd /path/to/your/project
219
+ thinkstack setup --target cursor
220
+ ```
221
+
222
+ This creates `.cursor/mcp.json` wiring the ThinkStack MCP server into Cursor, initialises `.GCC/`, and writes `CLAUDE.md` with governance instructions.
223
+
224
+ **Step 3 — Add Cursor rules**
225
+
226
+ Create `.cursor/rules/thinkstack.mdc`:
227
+ ```
228
+ ---
229
+ alwaysApply: true
230
+ ---
231
+ Before any file edit, call thinkstack_commit with your reasoning and the concepts you are touching.
232
+ Call thinkstack_context at the start of each task to load prior decisions.
233
+ Call thinkstack_sensitivity_add when touching auth, payments, schema, secrets, or PII.
234
+ ```
235
+
236
+ **Step 4 — Install the VS Code extension (optional but recommended)**
237
+
238
+ In Cursor: `Cmd+Shift+P` → "Extensions: Install from VSIX" → select `extensions/vscode/thinkstack-0.1.0.vsix` from the ThinkStack source directory. This adds a live sidebar panel showing `.GCC/` state, Θ hot zones, and the event feed.
239
+
240
+ **Step 5 — Verify**
241
+ ```bash
242
+ thinkstack doctor
243
+ ```
244
+
245
+ **What you get:** MCP tools, VS Code sidebar, optional HTTP proxy for passive capture of all LLM calls (`thinkstack proxy start`).
246
+
247
+ > **Updating from an older version:** `pip install -U thinkstack-cli>=3.0.1 && thinkstack setup --target cursor` will regenerate `.cursor/mcp.json` and update `CLAUDE.md`.
248
+
249
+ ---
250
+
251
+ ### Google Antigravity
252
+
253
+ Google Antigravity is a VS Code fork with a multi-agent orchestration layer. It reads `AGENTS.md` for persistent AI instructions and supports MCP servers.
254
+
255
+ **Step 1 — Install ThinkStack**
256
+ ```bash
257
+ pip install thinkstack-cli
258
+ ```
259
+
260
+ **Step 2 — Run setup**
261
+ ```bash
262
+ cd /path/to/your/project
263
+ thinkstack setup --target antigravity
264
+ ```
265
+
266
+ This initialises `.GCC/`, writes the ThinkStack MCP server config for Antigravity, and writes governance instructions into `AGENTS.md`.
267
+
268
+ **Step 3 — Install the VS Code extension**
269
+
270
+ In Antigravity: `Cmd+Shift+P` → "Extensions: Install from VSIX" → select `extensions/vscode/thinkstack-0.1.0.vsix`.
271
+
272
+ **Step 4 — Verify**
273
+ ```bash
274
+ thinkstack doctor
275
+ ```
276
+
277
+ **What you get:** Full RACP integration. The multi-agent nature of Antigravity makes Θ accumulation especially valuable — multiple agents share the same reasoning state through `thinkstack_context`.
278
+
279
+ > **Updating from an older version:** `pip install -U thinkstack-cli>=3.0.1 && thinkstack setup --target antigravity` will regenerate the MCP config and update `AGENTS.md`.
280
+
281
+ ---
282
+
283
+ ### OpenCode
284
+
285
+ OpenCode connects to ThinkStack through the local stdio ↔ SSE bridge. The bridge talks to the cloud MCP server first, and if the cloud is unreachable or slow it automatically falls back to the local `thinkstack` CLI so your `.GCC/` audit trail is never lost.
286
+
287
+ **Step 1 — Install ThinkStack**
288
+ ```bash
289
+ pip install thinkstack-cli
290
+ ```
291
+
292
+ **Step 2 — Create an API key and install the client config**
293
+
294
+ Run from the project you want to govern:
295
+
296
+ ```bash
297
+ thinkstack cloud key create --org myorg --repo myrepo
298
+ # Copy the printed API key — it will not be shown again.
299
+
300
+ export THINKSTACK_MCP_DOMAIN=thinkstack-mcp.your-domain.com
301
+ thinkstack cloud client-config opencode --org myorg --repo myrepo --api-key <api-key>
302
+ ```
303
+
304
+ This creates:
305
+ - `opencode.json` — the OpenCode MCP server config (uses the local bridge)
306
+ - `AGENTS.md` — ThinkStack governance instructions for the model
307
+
308
+ **Step 3 — Verify**
309
+ ```bash
310
+ thinkstack doctor
311
+ ```
312
+
313
+ Open the project in OpenCode. The ThinkStack MCP tools will be listed, and the model will be instructed to call `thinkstack_context` at the start of each task and `thinkstack_commit` before every file edit.
314
+
315
+ **What you get:** Cloud-hosted MCP server integration with automatic local fallback, automatic reasoning commits via `AGENTS.md` instructions, and a shared Θ state across sessions.
316
+
317
+ > **Updating from an older version:** `pip install -U thinkstack-cli>=3.0.1 && thinkstack cloud client-config opencode --org <org> --repo <repo> --api-key <api-key>` will regenerate `opencode.json` with the latest bridge and fallback settings. **Restart OpenCode** after updating the config.
318
+
319
+ ---
320
+
321
+ ### VS Code (with GitHub Copilot)
322
+
323
+ VS Code + Copilot has **partial integration only**. Copilot's API is closed — ThinkStack cannot intercept completions or inject RACP context. What works: the sidebar panel showing `.GCC/` state, and git-commit-level capture via the git hook.
324
+
325
+ **Step 1 — Install ThinkStack**
326
+ ```bash
327
+ pip install thinkstack-cli
328
+ cd /path/to/your/project
329
+ thinkstack init
330
+ thinkstack hooks install
331
+ ```
332
+
333
+ **Step 2 — Install the VS Code extension**
334
+
335
+ `Cmd+Shift+P` → "Extensions: Install from VSIX" → select `extensions/vscode/thinkstack-0.1.0.vsix`.
336
+
337
+ The sidebar shows your branch, last commit, Θ hot zones, and the live event feed from `.GCC/`.
338
+
339
+ **Step 3 — Record reasoning manually**
340
+
341
+ Since Copilot's internal reasoning cannot be captured automatically, record your own reasoning commits:
342
+ ```bash
343
+ thinkstack commit -m "Chose JWT over sessions — stateless service, no session store needed"
344
+ thinkstack sensitivity add --source you --concept auth --confidence 0.9 --disclosure PROTECTED -m "Token expiry logic is security-critical"
345
+ ```
346
+
347
+ **What you get:** Sidebar panel (read-only), git-commit-level event capture, manual reasoning commits. Full capture requires switching to Claude Code, Cursor, Kiro, or Antigravity.
348
+
349
+ > **Updating from an older version:** `pip install -U thinkstack-cli>=3.0.1 && thinkstack setup` will reinstall the git hook and update the governance instructions.
350
+
351
+ ---
352
+
353
+ ### AWS Kiro
354
+
355
+ Kiro is Amazon's AI IDE. It uses steering documents and hooks — analogous to `CLAUDE.md` and `hooks.json`. Full ThinkStack integration is available via manual configuration.
356
+
357
+ **Step 1 — Install ThinkStack**
358
+ ```bash
359
+ pip install thinkstack-cli
360
+ cd /path/to/your/project
361
+ thinkstack init
362
+ ```
363
+
364
+ **Step 2 — Add the MCP server**
365
+
366
+ Create `.kiro/settings/mcp.json`:
367
+ ```json
368
+ {
369
+ "mcpServers": {
370
+ "thinkstack": {
371
+ "command": "/absolute/path/to/.venv/bin/thinkstack",
372
+ "args": ["mcp-server"],
373
+ "env": {}
374
+ }
375
+ }
376
+ }
377
+ ```
378
+
379
+ Replace `/absolute/path/to/.venv/bin/thinkstack` with the output of `which thinkstack`.
380
+
381
+ **Step 3 — Add steering document**
382
+
383
+ Create `.kiro/steering/thinkstack.md` with `inclusion: always`:
384
+ ```markdown
385
+ ---
386
+ inclusion: always
387
+ ---
388
+
389
+ # ThinkStack Governance
390
+
391
+ Before any file edit, call `thinkstack_commit` with your reasoning and the concepts you are touching.
392
+ Call `thinkstack_context` at the start of each task to load prior decisions.
393
+ Call `thinkstack_sensitivity_add` when touching auth, payments, schema, secrets, or PII.
394
+ ```
395
+
396
+ **Step 4 — Add agent hook**
397
+
398
+ Create `.kiro/hooks/thinkstack-capture.md`:
399
+ ```markdown
400
+ ---
401
+ name: thinkstack-capture
402
+ trigger: after-file-write
403
+ ---
404
+ Run: thinkstack hooks run post-tool-use
405
+ ```
406
+
407
+ **Step 5 — Verify**
408
+ ```bash
409
+ thinkstack doctor
410
+ ```
411
+
412
+ **What you get:** Full RACP integration equivalent to Claude Code — MCP tools, steering-document governance, agent action hooks.
413
+
414
+ > **Updating from an older version:** `pip install -U thinkstack-cli>=3.0.1`, then re-run the manual steps above and refresh your steering document with the latest `AGENTS.md` text.
415
+
416
+ ---
417
+
418
+ ### AWS Bedrock (Python SDK)
419
+
420
+ ThinkStack integrates at the `boto3` call level with a one-line change.
421
+
422
+ **Step 1 — Install**
423
+ ```bash
424
+ pip install thinkstack-cli[wrapper] boto3
425
+ cd /path/to/your/project
426
+ thinkstack init
427
+ ```
428
+
429
+ **Step 2 — Wrap your Bedrock client**
430
+ ```python
431
+ # Before
432
+ import boto3
433
+ client = boto3.client("bedrock-runtime", region_name="us-east-1")
434
+
435
+ # After — one import change, same API
436
+ from thinkstack_core.wrapper.bedrock import ThinkStackBedrock
437
+ client = ThinkStackBedrock(region_name="us-east-1")
438
+ ```
439
+
440
+ All `invoke_model()` and `converse()` calls are identical. ThinkStack injects the RACP system prefix and captures responses automatically.
441
+
442
+ **Step 3 — Verify**
443
+ ```bash
444
+ thinkstack doctor
445
+ ```
446
+
447
+ > **Updating from an older version:** `pip install -U thinkstack-cli[wrapper]>=3.0.1`.
448
+
449
+ ---
450
+
451
+ ### Azure AI Foundry (Python SDK)
452
+
453
+ **Step 1 — Install**
454
+ ```bash
455
+ pip install thinkstack-cli[wrapper] openai
456
+ cd /path/to/your/project
457
+ thinkstack init
458
+ ```
459
+
460
+ **Step 2 — Wrap your Azure OpenAI client**
461
+ ```python
462
+ # Before
463
+ from openai import AzureOpenAI
464
+
465
+ # After — one import change, all kwargs pass through unchanged
466
+ from thinkstack_core.wrapper.openai import ThinkStackOpenAI as AzureOpenAI
467
+
468
+ client = AzureOpenAI(
469
+ azure_endpoint="https://my-resource.openai.azure.com/",
470
+ api_version="2024-02-01",
471
+ api_key=os.environ["AZURE_OPENAI_KEY"],
472
+ )
473
+ # All chat.completions.create() calls are identical
474
+ ```
475
+
476
+ **Step 3 — Verify**
477
+ ```bash
478
+ thinkstack doctor
479
+ ```
480
+
481
+ > **Updating from an older version:** `pip install -U thinkstack-cli[wrapper]>=3.0.1`.
482
+
483
+ ---
484
+
485
+ ### OpenAI Codex CLI
486
+
487
+ **Step 1 — Install**
488
+ ```bash
489
+ pip install thinkstack-cli
490
+ cd /path/to/your/project
491
+ thinkstack init
492
+ ```
493
+
494
+ **Step 2 — Start the proxy**
495
+ ```bash
496
+ thinkstack proxy start # runs on localhost:8765
497
+ ```
498
+
499
+ **Step 3 — Point Codex at the proxy**
500
+ ```bash
501
+ export OPENAI_BASE_URL=http://localhost:8765/v1
502
+ codex "Add error handling to the payment service"
503
+ ```
504
+
505
+ All Codex calls are intercepted by the proxy, which injects the RACP prefix and captures responses into `.GCC/`.
506
+
507
+ > **Updating from an older version:** `pip install -U thinkstack-cli>=3.0.1`.
508
+
509
+ ---
510
+
511
+ ### Ollama (local models)
512
+
513
+ **Step 1 — Install Ollama and pull a model**
514
+ ```bash
515
+ # Install Ollama from https://ollama.com
516
+ ollama pull llama3.2
517
+ ```
518
+
519
+ **Step 2 — Install ThinkStack**
520
+ ```bash
521
+ pip install thinkstack-cli[wrapper]
522
+ cd /path/to/your/project
523
+ thinkstack init
524
+ ```
525
+
526
+ **Step 3 — Wrap your Ollama client**
527
+ ```python
528
+ from thinkstack_core.wrapper.ollama import ThinkStackOllama
529
+
530
+ client = ThinkStackOllama(model="llama3.2") # any model in `ollama list`
531
+ response = client.chat(messages=[{"role": "user", "content": "Explain this function"}])
532
+ ```
533
+
534
+ **Step 4 — Verify**
535
+ ```bash
536
+ thinkstack doctor
537
+ ```
538
+
539
+ No API key required. Fully local — RACP context and captures stay on-device.
540
+
541
+ > **Updating from an older version:** `pip install -U thinkstack-cli[wrapper]>=3.0.1`.
542
+
543
+ ---
544
+
545
+ ### Cloud MCP server (team-wide shared governance)
546
+
547
+ For teams that want a single shared reasoning backend across all projects and machines, ThinkStack provides a Cloudflare Worker MCP server. It stores `.GCC/` in Cloudflare R2 and exposes an HTTPS SSE endpoint that every IDE can connect to.
548
+
549
+ **Deploy once, use everywhere:**
550
+
551
+ ```bash
552
+ cd /path/to/ThinkStack/Implementation/deploy/cloudflare-worker
553
+ cp .env.example .env
554
+ # Fill in R2_ACCOUNT_ID, R2_BUCKET, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY
555
+ # Optionally set OPENAI_API_KEY for the DRPL openai embedding backend
556
+ source .env
557
+ ./setup-mcp-server.sh
558
+ ```
559
+
560
+ The script will:
561
+
562
+ 1. Ensure the R2 bucket exists.
563
+ 2. Deploy the Cloudflare Worker.
564
+ 3. Create an org/repo-scoped API key.
565
+ 4. Install the MCP client config for your IDE.
566
+ 5. Run a health check.
567
+
568
+ For CI/CD, the same script runs non-interactively:
569
+
570
+ ```bash
571
+ ./setup-mcp-server.sh --non-interactive \
572
+ --org myorg \
573
+ --repo myproject \
574
+ --ide opencode \
575
+ --openai-key "$OPENAI_API_KEY"
576
+ ```
577
+
578
+ The repository also includes `.github/workflows/deploy-cloudflare-worker.yml`, which runs on every `v*` tag and deploys the Worker (skipping key creation and client config).
579
+
580
+ **Live URL:**
581
+
582
+ ```text
583
+ https://thinkstack-mcp.YOUR_ACCOUNT.workers.dev
584
+ ```
585
+
586
+ **Create a per-project API key:**
587
+
588
+ ```bash
589
+ export THINKSTACK_STORAGE=r2
590
+ export R2_ACCOUNT_ID=... R2_BUCKET=... R2_ACCESS_KEY_ID=... R2_SECRET_ACCESS_KEY=...
591
+ thinkstack cloud key create --org myorg --repo myproject
592
+ ```
593
+
594
+ **Wire any IDE in one command:**
595
+
596
+ ```bash
597
+ export THINKSTACK_MCP_DOMAIN=thinkstack-mcp.YOUR_ACCOUNT.workers.dev
598
+ thinkstack cloud client-config <ide> --org myorg --repo myproject --api-key <api-key>
599
+ ```
600
+
601
+ Supported `<ide>` values: `opencode`, `claude`, `cursor`, `vscode`, `stdio`.
602
+
603
+ **Full walkthrough:** `deploy/cloudflare-worker/README.md` has manual setup details and the full tool list. `IDE_SETUP.md` has step-by-step setup for OpenCode, Claude Code, Cursor, VS Code, Kiro, Antigravity, JetBrains, and generic MCP clients.
604
+
605
+ > **Updating from an older version:** You do **not** need to redeploy the Cloudflare Worker for client-side changes. Just regenerate the IDE config on each machine after upgrading `thinkstack-cli`:
606
+ > ```bash
607
+ > > pip install -U thinkstack-cli>=3.0.1
608
+ > > export THINKSTACK_MCP_DOMAIN=thinkstack-mcp.YOUR_ACCOUNT.workers.dev
609
+ > > thinkstack cloud client-config <ide> --org <org> --repo <repo> --api-key <api-key>
610
+ > > ```
611
+
612
+ ---
613
+
614
+ ### Platform comparison
615
+
616
+ | Platform | Setup command | MCP tools | Auto-capture | Sidebar | Notes |
617
+ |---|---|---|---|---|---|
618
+ | Claude Code | `thinkstack setup` | ✅ | ✅ hooks | ✅ | Highest fidelity |
619
+ | Cursor | `thinkstack setup --target cursor` | ✅ | ✅ proxy | ✅ | Near-full |
620
+ | Google Antigravity | `thinkstack setup --target antigravity` | ✅ | ✅ | ✅ | Full |
621
+ | AWS Kiro | Manual (5 steps) | ✅ | ✅ hooks | ✅ | Full — not yet automated |
622
+ | VS Code + Copilot | `thinkstack init` + extension | ❌ | ❌ git only | ✅ | Partial — Copilot API closed |
623
+ | AWS Bedrock | SDK wrapper | — | ✅ SDK | — | Python SDK only |
624
+ | Azure AI Foundry | SDK wrapper or proxy | — | ✅ SDK | — | Python SDK only |
625
+ | OpenAI Codex CLI | HTTP proxy | — | ✅ proxy | — | |
626
+ | Ollama | SDK wrapper | — | ✅ SDK | — | Fully local |
627
+
628
+ ---
629
+
630
+ ## LLM integration
631
+
632
+ ### Option 1 — SDK wrapper (you own the code)
633
+
634
+ ```python
635
+ # One-line change — same API, governance captured automatically
636
+ from thinkstack_core.wrapper.anthropic import ThinkStackAnthropic
637
+ client = ThinkStackAnthropic() # replaces anthropic.Anthropic()
638
+
639
+ # OpenAI
640
+ from thinkstack_core.wrapper.openai import ThinkStackOpenAI
641
+ client = ThinkStackOpenAI()
642
+
643
+ # Local models via Ollama (no API key required)
644
+ from thinkstack_core.wrapper.ollama import ThinkStackOllama
645
+ client = ThinkStackOllama(model="llama3.2") # any model in `ollama list`
646
+
647
+ # Google Gemini
648
+ from thinkstack_core.wrapper.gemini import ThinkStackGemini
649
+ client = ThinkStackGemini(model_name="gemini-1.5-pro")
650
+
651
+ # AWS Bedrock
652
+ from thinkstack_core.wrapper.bedrock import ThinkStackBedrock
653
+ client = ThinkStackBedrock(region_name="us-east-1")
654
+ ```
655
+
656
+ See `OLLAMA_SETUP.md` for the full Ollama guide.
657
+
658
+ ### Option 2 — HTTP proxy (Cursor, JetBrains, closed-source IDEs)
659
+
660
+ ```bash
661
+ thinkstack proxy install # installs as macOS LaunchAgent or Linux systemd service
662
+ thinkstack proxy start # runs on localhost:8765
663
+ ```
664
+
665
+ Configure your IDE to use `http://localhost:8765/anthropic` (or `/openai`, `/gemini`). The proxy injects RACP context and captures responses with zero latency penalty.
666
+
667
+ ### Option 3 — MCP server + hooks (Claude Code, Cursor, Kiro, Antigravity)
668
+
669
+ ```bash
670
+ thinkstack setup # one command: init + hooks + MCP config + CLAUDE.md + AGENTS.md
671
+ ```
672
+
673
+ Claude Code / Cursor / Kiro / Antigravity then call `thinkstack_commit`, `thinkstack_sensitivity_add`, `thinkstack_context`, and `thinkstack_theta_read` as native MCP tools. See `IDE_SETUP.md` for per-IDE instructions.
674
+
675
+ ### Option 4 — OpenAI Codex CLI proxy
676
+
677
+ ```bash
678
+ # Start the Codex-specific proxy on localhost:8766
679
+ python -m thinkstack_core.codex start
680
+
681
+ # Point Codex CLI at it
682
+ export OPENAI_BASE_URL=http://localhost:8766/v1
683
+ codex "Add error handling to the payment service"
684
+ ```
685
+
686
+ See `CODEX_SETUP.md` for the full guide.
687
+
688
+ ### Option 5 — Org gateway (enterprise, multi-developer)
689
+
690
+ ```bash
691
+ cd deploy/
692
+ cp .env.example .env # set ANTHROPIC_API_KEY and/or OPENAI_API_KEY
693
+ docker compose up # gateway on :8080, dashboard on :3000
694
+ ```
695
+
696
+ Developers point their IDE proxy URL to the gateway instead of api.openai.com. The gateway handles central API key management, SSO attribution, governance policy enforcement, and metrics aggregation. See `deploy/README.md` for Helm and Docker Compose instructions.
697
+
698
+ ---
699
+
700
+ ## Cloud Deployment
701
+
702
+ The ThinkStack cloud MCP server is a multi-tenant SSE endpoint that hosts the full governance toolkit in your own cloud account. Multiple agents and developers connect simultaneously; storage is backed by AWS S3, Azure Blob, or Cloudflare R2.
703
+
704
+ **AWS ECS Fargate + S3:**
705
+ ```bash
706
+ export AWS_REGION=us-east-1 AWS_ACCOUNT_ID=123456789012
707
+ export THINKSTACK_ORG_ID=myorg AWS_S3_BUCKET=thinkstack-myorg
708
+ export VPC_SUBNET_IDS=subnet-xxx VPC_SECURITY_GROUP_IDS=sg-xxx
709
+ ./deploy/aws/deploy.sh
710
+ ```
711
+
712
+ **Azure Container Apps + Blob:**
713
+ ```bash
714
+ export AZURE_RESOURCE_GROUP=thinkstack-rg AZURE_LOCATION=eastus
715
+ export THINKSTACK_ORG_ID=myorg THINKSTACK_AZURE_CONTAINER=thinkstack
716
+ export AZURE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=..."
717
+ ./deploy/azure/deploy.sh
718
+ ```
719
+
720
+ See `deploy/README.md` for full instructions, API key setup, GitHub repository connection, and environment variable reference.
721
+
722
+ ---
723
+
724
+ ## Architecture
725
+
726
+ ```
727
+ thinkstack_core/ Pure library — all business logic
728
+ gcc.py GCCRepository: .GCC/ layout, event log, commits, branches
729
+ sensitivity.py Sensitivity events + SensitivityStore
730
+ theta.py Coordination vector Θ + AggPhi
731
+ capability.py OmegaCapability (A1), Lipschitz bound, PST runner
732
+ invariants.py I1 (commit-backed), I3 (semantic grounding)
733
+ variance.py f_max formula, rolling monitor, VARIANCE_ALERT
734
+ rep.py REP ledger — append-only local transport
735
+ sis.py SIS-TC corpus evaluation + quarantine
736
+ rdp.py RDP ε-budget tracking
737
+ disclosure.py [PRIVATE] span suppression
738
+ prompt_artifact.py RACP system prompt artifact store
739
+ deltaf.py Δf estimation
740
+ parser/ XML block extractor, thinking tokens, inference
741
+ wrapper/ SDK drop-in wrappers (Anthropic, OpenAI, Gemini, Bedrock)
742
+ proxy/ HTTP reverse proxy (localhost:8765)
743
+ mcp/ MCP/JSON-RPC server
744
+ hooks/ Claude Code hooks + git commit-msg hook
745
+ metrics/ MCS, DHS, ROI, calibration, citation registry
746
+ observability/ Structured reports + enterprise metrics webhook
747
+ alerts/ Slack, Jira, PagerDuty outbound alerting
748
+ rep_network/ Multi-node REP ledger sync
749
+ github/ GitHub App webhook + PR comment builder
750
+ dashboard_api.py REST API for browser dashboard
751
+
752
+ thinkstack_cli/
753
+ main.py Thin argparse wrapper over thinkstack_core
754
+
755
+ extensions/vscode/ VS Code extension (read-only sidebar; installs in Antigravity via .vsix)
756
+ dashboard/ React browser dashboard (Developer/Lead/CISO views)
757
+ tests/ 637 tests across all sprints (S0–S18)
758
+ examples/ end-to-end scenario examples
759
+ ```
760
+
761
+ ---
762
+
763
+ ## On-disk layout (`.GCC/`)
764
+
765
+ ```
766
+ .GCC/
767
+ VERSION # format version
768
+ events.log.jsonl # append-only audit stream (hash chain)
769
+ main.md / log.md # reasoning roadmap + chronological log
770
+ refs/HEAD # current branch
771
+ refs/branches/<name> # branch tip commit ID
772
+ commits/<id>.json # commit objects
773
+ sensitivities/events.jsonl # raw sensitivity events
774
+ theta.json # coordination vector Θ
775
+ capabilities/omega.json # A1 capability state
776
+ variance/ # calibration_report.json, live_state.json
777
+ rep/rep_ledger.jsonl # REP transport ledger
778
+ rep/peers.json # peer list for multi-node sync
779
+ sis/ # SIS-TC corpus, reports, quarantine events
780
+ rdp/rdp_state.json # RDP ε-budget
781
+ concepts/<name>.json # I3 concept definitions
782
+ prompts/ # RACP system prompt artifact
783
+ deltaf/ # Δf report
784
+ calibration.json # team-specific metric calibration
785
+ context_bundles/ # MECW-bounded context snapshots
786
+ NODE_STATE # node state machine
787
+ ```
788
+
789
+ ---
790
+
791
+ ## Key safety properties
792
+
793
+ | Property | Mechanism |
794
+ |----------|-----------|
795
+ | Commit-backed decisions (I1) | Merge/unlock blocked unless branch tips exist in commits/ and events log |
796
+ | Semantic grounding (I3) | Operations using concepts_used require matching definitions in concepts/ |
797
+ | Capability gate (A1) | Textual mode requires valid OmegaCapability + passing PST |
798
+ | Variance control (A2) | f_max=0 forces deterministic mode; A1 gate blocks textual_mode |
799
+ | Privacy budget (RDP) | epsilon exhaustion flips read_only=true in rdp_state.json |
800
+ | Proxy trust boundary | Proxy binds to 127.0.0.1 only; API keys pass through, never stored |
801
+
802
+ ---
803
+
804
+ ## Run the tests
805
+
806
+ ```bash
807
+ python3 -m venv .venv && source .venv/bin/activate
808
+ pip install -e .[dev,proxy]
809
+ pytest tests/ # 637 tests
810
+ ```
811
+
812
+ ---
813
+
814
+ ## Configuration reference
815
+
816
+ | Env var | Purpose |
817
+ |---------|---------|
818
+ | `THINKSTACK_DISABLE=1` | Disable all injection and capture (wrapper/proxy become transparent) |
819
+ | `THINKSTACK_SLACK_WEBHOOK_URL` | Slack alert delivery |
820
+ | `THINKSTACK_JIRA_URL` / `_PROJECT_KEY` / `_API_TOKEN` / `_EMAIL` | Jira issue creation |
821
+ | `THINKSTACK_PAGERDUTY_ROUTING_KEY` | PagerDuty event trigger |
822
+ | `THINKSTACK_ALERT_MIN_SEVERITY` | Minimum severity to alert on (`info`/`warning`/`critical`) |
823
+ | `THINKSTACK_METRICS_WEBHOOK_URL` | Enterprise metrics webhook endpoint |
824
+ | `THINKSTACK_ORG_ID` | Org identifier in metrics payloads |
825
+ | `THINKSTACK_METRICS_API_KEY` | Auth for metrics webhook |
826
+ | `THINKSTACK_GITHUB_WEBHOOK_SECRET` | HMAC secret for GitHub App webhook |
827
+
828
+ ---
829
+
830
+ ## Documentation
831
+
832
+ | File | Contents |
833
+ |------|----------|
834
+ | `DOCS.md` | Architecture deep-dive, Sprint 4–6 feature reference, conformance matrix |
835
+ | `OBSERVABILITY.md` | Observability pillars, daily-recall pattern, shell audit script template |
836
+ | `CONTRIBUTING.md` | Dev environment, test commands, sprint structure, PR checklist |
837
+ | `THREAT_MODEL.md` | Trust model, hash chain integrity, proxy trust boundary, known limitations |
838
+ | `DESIGN_THOUGHTS.md` | Design decisions Q1–Q14 with full citation validation |
839
+ | `IDE_SETUP.md` | VS Code, Cursor, Kiro, and Antigravity setup instructions |
840
+ | `ANTIGRAVITY_SETUP.md` | Google Antigravity step-by-step onboarding |
841
+ | `CLAUDE_CODE_QUICKSTART.md` | Claude Code step-by-step onboarding |
842
+ | `OLLAMA_SETUP.md` | Local model setup with Ollama (Llama, Mistral, Gemma, Phi, Qwen) |
843
+ | `CODEX_SETUP.md` | OpenAI Codex CLI proxy setup |
844
+ | `AGENTS.md` | Persistent AI instructions for Antigravity/Kiro |
845
+ | `deploy/README.md` | Enterprise org gateway — Docker Compose and Helm deployment |
846
+ | `thinkstack_core/metrics/README.md` | MCS/DHS/ROI formulas and calibration guide |
847
+ | `thinkstack_core/proxy/README.md` | HTTP proxy deployment options |
848
+ | `thinkstack_core/wrapper/README.md` | SDK wrapper quick-start for all providers |
849
+ | `dashboard/README.md` | Browser dashboard setup and API reference |
850
+
851
+ ---
852
+
853
+ ## Metrics credibility
854
+
855
+ ThinkStack is explicit about what every number is based on:
856
+
857
+ - **15 min context switch** — Parnin & Rugaber (2011), *Software Quality Journal*. DOI: [10.1007/s11219-010-9104-9](https://doi.org/10.1007/s11219-010-9104-9). Measured for programming tasks only.
858
+ - **Auditor rate** — BLS SOC 13-2011 (2023): $39–40/hr employed staff. External rates ($75–400/hr) not used as defaults.
859
+ - **MCS/DHS weights** — Design choices. No external benchmark. Calibrate with your team's data.
860
+ - **Developer hourly rate** — No default. You must set it: `thinkstack calibrate --set developer_hourly_rate=<value>`
861
+
862
+ See `thinkstack_core/metrics/credibility.py` for the full citation registry.
863
+
864
+ ---
865
+
866
+ ## License
867
+
868
+ Apache 2.0