agentorch 0.1.0__tar.gz

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 (128) hide show
  1. agentorch-0.1.0/PKG-INFO +335 -0
  2. agentorch-0.1.0/README.md +296 -0
  3. agentorch-0.1.0/agentorch.egg-info/PKG-INFO +335 -0
  4. agentorch-0.1.0/agentorch.egg-info/SOURCES.txt +126 -0
  5. agentorch-0.1.0/agentorch.egg-info/dependency_links.txt +1 -0
  6. agentorch-0.1.0/agentorch.egg-info/entry_points.txt +2 -0
  7. agentorch-0.1.0/agentorch.egg-info/requires.txt +22 -0
  8. agentorch-0.1.0/agentorch.egg-info/top_level.txt +10 -0
  9. agentorch-0.1.0/benchmarks/hidden_profile/run_baseline.py +139 -0
  10. agentorch-0.1.0/benchmarks/hidden_profile/run_devtorch.py +153 -0
  11. agentorch-0.1.0/benchmarks/hidden_profile/score.py +260 -0
  12. agentorch-0.1.0/benchmarks/swe_bench/compare.py +239 -0
  13. agentorch-0.1.0/benchmarks/swe_bench/run_baseline.py +187 -0
  14. agentorch-0.1.0/benchmarks/swe_bench/run_devtorch.py +252 -0
  15. agentorch-0.1.0/benchmarks/swe_bench/seed_gcc.py +127 -0
  16. agentorch-0.1.0/devtorch_cli/__init__.py +1 -0
  17. agentorch-0.1.0/devtorch_cli/main.py +1357 -0
  18. agentorch-0.1.0/devtorch_core/__init__.py +154 -0
  19. agentorch-0.1.0/devtorch_core/aggphi_textual.py +275 -0
  20. agentorch-0.1.0/devtorch_core/alerts/__init__.py +13 -0
  21. agentorch-0.1.0/devtorch_core/alerts/base.py +46 -0
  22. agentorch-0.1.0/devtorch_core/alerts/config.py +50 -0
  23. agentorch-0.1.0/devtorch_core/alerts/dispatcher.py +104 -0
  24. agentorch-0.1.0/devtorch_core/alerts/jira.py +96 -0
  25. agentorch-0.1.0/devtorch_core/alerts/pagerduty.py +66 -0
  26. agentorch-0.1.0/devtorch_core/alerts/slack.py +81 -0
  27. agentorch-0.1.0/devtorch_core/capability.py +386 -0
  28. agentorch-0.1.0/devtorch_core/codex/__init__.py +9 -0
  29. agentorch-0.1.0/devtorch_core/codex/__main__.py +97 -0
  30. agentorch-0.1.0/devtorch_core/codex/capture.py +208 -0
  31. agentorch-0.1.0/devtorch_core/codex/proxy.py +412 -0
  32. agentorch-0.1.0/devtorch_core/dashboard_api.py +1285 -0
  33. agentorch-0.1.0/devtorch_core/deltaf.py +97 -0
  34. agentorch-0.1.0/devtorch_core/disclosure.py +50 -0
  35. agentorch-0.1.0/devtorch_core/gateway/__init__.py +30 -0
  36. agentorch-0.1.0/devtorch_core/gateway/metrics_webhook.py +176 -0
  37. agentorch-0.1.0/devtorch_core/gateway/policy.py +198 -0
  38. agentorch-0.1.0/devtorch_core/gateway/server.py +624 -0
  39. agentorch-0.1.0/devtorch_core/gateway/sso.py +183 -0
  40. agentorch-0.1.0/devtorch_core/gcc.py +1173 -0
  41. agentorch-0.1.0/devtorch_core/github/__init__.py +19 -0
  42. agentorch-0.1.0/devtorch_core/github/app.py +114 -0
  43. agentorch-0.1.0/devtorch_core/github/comment_builder.py +113 -0
  44. agentorch-0.1.0/devtorch_core/github/pr_parser.py +82 -0
  45. agentorch-0.1.0/devtorch_core/hooks/__init__.py +17 -0
  46. agentorch-0.1.0/devtorch_core/hooks/claude_code.py +228 -0
  47. agentorch-0.1.0/devtorch_core/hooks/git_commit.py +182 -0
  48. agentorch-0.1.0/devtorch_core/hooks/installer.py +313 -0
  49. agentorch-0.1.0/devtorch_core/hooks/runner.py +172 -0
  50. agentorch-0.1.0/devtorch_core/invariants.py +182 -0
  51. agentorch-0.1.0/devtorch_core/mcp/__init__.py +10 -0
  52. agentorch-0.1.0/devtorch_core/mcp/server.py +365 -0
  53. agentorch-0.1.0/devtorch_core/metrics/__init__.py +35 -0
  54. agentorch-0.1.0/devtorch_core/metrics/calibrate.py +185 -0
  55. agentorch-0.1.0/devtorch_core/metrics/calibration.py +125 -0
  56. agentorch-0.1.0/devtorch_core/metrics/credibility.py +288 -0
  57. agentorch-0.1.0/devtorch_core/metrics/dhs.py +126 -0
  58. agentorch-0.1.0/devtorch_core/metrics/mcs.py +96 -0
  59. agentorch-0.1.0/devtorch_core/metrics/roi.py +88 -0
  60. agentorch-0.1.0/devtorch_core/metrics/session_writer.py +69 -0
  61. agentorch-0.1.0/devtorch_core/metrics/shadow_ai.py +117 -0
  62. agentorch-0.1.0/devtorch_core/metrics/sprint_writer.py +80 -0
  63. agentorch-0.1.0/devtorch_core/observability/__init__.py +47 -0
  64. agentorch-0.1.0/devtorch_core/observability/formatter.py +119 -0
  65. agentorch-0.1.0/devtorch_core/observability/report.py +264 -0
  66. agentorch-0.1.0/devtorch_core/observability/webhook.py +227 -0
  67. agentorch-0.1.0/devtorch_core/parser/__init__.py +30 -0
  68. agentorch-0.1.0/devtorch_core/parser/blocks.py +188 -0
  69. agentorch-0.1.0/devtorch_core/parser/inference.py +159 -0
  70. agentorch-0.1.0/devtorch_core/parser/thinking.py +112 -0
  71. agentorch-0.1.0/devtorch_core/prompt_artifact.py +61 -0
  72. agentorch-0.1.0/devtorch_core/proxy/__init__.py +9 -0
  73. agentorch-0.1.0/devtorch_core/proxy/routes/__init__.py +1 -0
  74. agentorch-0.1.0/devtorch_core/proxy/routes/anthropic.py +264 -0
  75. agentorch-0.1.0/devtorch_core/proxy/routes/gemini.py +331 -0
  76. agentorch-0.1.0/devtorch_core/proxy/routes/openai.py +287 -0
  77. agentorch-0.1.0/devtorch_core/proxy/server.py +317 -0
  78. agentorch-0.1.0/devtorch_core/rdp.py +105 -0
  79. agentorch-0.1.0/devtorch_core/rep.py +134 -0
  80. agentorch-0.1.0/devtorch_core/rep_network/__init__.py +23 -0
  81. agentorch-0.1.0/devtorch_core/rep_network/node.py +137 -0
  82. agentorch-0.1.0/devtorch_core/rep_network/server.py +140 -0
  83. agentorch-0.1.0/devtorch_core/rep_network/sync.py +207 -0
  84. agentorch-0.1.0/devtorch_core/sensitivity.py +180 -0
  85. agentorch-0.1.0/devtorch_core/sis.py +197 -0
  86. agentorch-0.1.0/devtorch_core/theta.py +221 -0
  87. agentorch-0.1.0/devtorch_core/theta_synthesis.py +268 -0
  88. agentorch-0.1.0/devtorch_core/variance.py +219 -0
  89. agentorch-0.1.0/devtorch_core/wrapper/__init__.py +52 -0
  90. agentorch-0.1.0/devtorch_core/wrapper/anthropic.py +317 -0
  91. agentorch-0.1.0/devtorch_core/wrapper/base.py +302 -0
  92. agentorch-0.1.0/devtorch_core/wrapper/bedrock.py +234 -0
  93. agentorch-0.1.0/devtorch_core/wrapper/gemini.py +284 -0
  94. agentorch-0.1.0/devtorch_core/wrapper/ollama.py +419 -0
  95. agentorch-0.1.0/devtorch_core/wrapper/openai.py +294 -0
  96. agentorch-0.1.0/pyproject.toml +61 -0
  97. agentorch-0.1.0/setup.cfg +4 -0
  98. agentorch-0.1.0/tests/test_s0_gcc.py +115 -0
  99. agentorch-0.1.0/tests/test_s11_codex.py +388 -0
  100. agentorch-0.1.0/tests/test_s11_hooks_installer.py +350 -0
  101. agentorch-0.1.0/tests/test_s12_github.py +369 -0
  102. agentorch-0.1.0/tests/test_s13_dashboard_api.py +395 -0
  103. agentorch-0.1.0/tests/test_s13_forensic.py +410 -0
  104. agentorch-0.1.0/tests/test_s14_audit_export.py +292 -0
  105. agentorch-0.1.0/tests/test_s14_ciso_api.py +326 -0
  106. agentorch-0.1.0/tests/test_s15_rep_network.py +644 -0
  107. agentorch-0.1.0/tests/test_s16_alerts.py +382 -0
  108. agentorch-0.1.0/tests/test_s17a_metrics.py +638 -0
  109. agentorch-0.1.0/tests/test_s17b_observability.py +447 -0
  110. agentorch-0.1.0/tests/test_s18_credibility.py +208 -0
  111. agentorch-0.1.0/tests/test_s1_branch_merge.py +130 -0
  112. agentorch-0.1.0/tests/test_s2_context.py +77 -0
  113. agentorch-0.1.0/tests/test_s3_sensitivity.py +1000 -0
  114. agentorch-0.1.0/tests/test_s4_invariants.py +143 -0
  115. agentorch-0.1.0/tests/test_s4_variance_lock.py +208 -0
  116. agentorch-0.1.0/tests/test_s5_privacy_disclosure.py +99 -0
  117. agentorch-0.1.0/tests/test_s5_rep_sis.py +116 -0
  118. agentorch-0.1.0/tests/test_s6_debug.py +108 -0
  119. agentorch-0.1.0/tests/test_s7_mcp_hooks.py +616 -0
  120. agentorch-0.1.0/tests/test_s7_ollama_wrapper.py +755 -0
  121. agentorch-0.1.0/tests/test_s7_parser.py +550 -0
  122. agentorch-0.1.0/tests/test_s7_proxy.py +590 -0
  123. agentorch-0.1.0/tests/test_s7_wrappers.py +926 -0
  124. agentorch-0.1.0/tests/test_s7ent_gateway.py +559 -0
  125. agentorch-0.1.0/tests/test_s8_aggphi.py +213 -0
  126. agentorch-0.1.0/tests/test_s8_theta_synthesis.py +425 -0
  127. agentorch-0.1.0/tests/test_s9_gaps.py +161 -0
  128. agentorch-0.1.0/tests/test_setup_command.py +318 -0
@@ -0,0 +1,335 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentorch
3
+ Version: 0.1.0
4
+ Summary: DevTorch — AI reasoning capture, audit trail, and governance for agent-assisted development
5
+ Author-email: Hemant Joshi <hemant@flotorch.ai>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/hemantcgi/DevTorch
8
+ Project-URL: Repository, https://github.com/hemantcgi/DevTorch
9
+ Project-URL: Documentation, https://github.com/hemantcgi/DevTorch/blob/main/Implementation/README.md
10
+ Keywords: ai,agents,governance,audit,llm,reasoning,devtorch
11
+ Classifier: Development Status :: 4 - Beta
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
+ Provides-Extra: wrapper
25
+ Requires-Dist: anthropic>=0.40.0; extra == "wrapper"
26
+ Requires-Dist: openai>=1.50.0; extra == "wrapper"
27
+ Requires-Dist: google-generativeai>=0.8.0; extra == "wrapper"
28
+ Requires-Dist: boto3>=1.35.0; extra == "wrapper"
29
+ Requires-Dist: tiktoken>=0.7.0; extra == "wrapper"
30
+ Provides-Extra: proxy
31
+ Requires-Dist: fastapi>=0.115.0; extra == "proxy"
32
+ Requires-Dist: uvicorn[standard]>=0.32.0; extra == "proxy"
33
+ Requires-Dist: httpx>=0.27.0; extra == "proxy"
34
+ Requires-Dist: pydantic>=2.9.0; extra == "proxy"
35
+ Provides-Extra: mcp
36
+ Requires-Dist: mcp>=1.0.0; extra == "mcp"
37
+ Provides-Extra: all
38
+ Requires-Dist: agentorch[mcp,proxy,wrapper]; extra == "all"
39
+
40
+ # DevTorch
41
+
42
+ **Local-first AI agent governance.** DevTorch gives multi-agent systems a shared on-disk audit trail, coordination vector, privacy controls, and LLM integration layer — all without a remote service.
43
+
44
+ ```
45
+ pip install devtorch
46
+ devtorch init
47
+ devtorch commit -m "Add payments service"
48
+ devtorch debug timeline
49
+ ```
50
+
51
+ ---
52
+
53
+ ## What it does
54
+
55
+ | Concern | DevTorch feature |
56
+ |---------|-----------------|
57
+ | Reasoning audit trail | Append-only `.GCC/events.log.jsonl` with SHA-256 hash chain |
58
+ | Multi-agent coordination | Coordination vector Θ — shared sensitivity map across agents |
59
+ | Privacy compliance | RDP ε-budget tracking; `[PRIVATE]` span suppression; SIS-TC quarantine |
60
+ | LLM integration | SDK wrappers, HTTP proxy, Claude Code MCP server + hooks |
61
+ | Governance observability | Structured reports, browser dashboard, VS Code extension (Antigravity-compatible) |
62
+ | Alerting | Slack, Jira, PagerDuty outbound webhooks |
63
+ | Metrics | MCS, DHS, ROI — all traceable to citations or explicit design choices |
64
+
65
+ Everything lives in `.GCC/` — a local directory in your project. No database, no network service, no telemetry.
66
+
67
+ ---
68
+
69
+ ## Install
70
+
71
+ ```bash
72
+ python3 -m venv .venv && source .venv/bin/activate
73
+
74
+ # Core CLI only
75
+ pip install devtorch
76
+
77
+ # With SDK wrappers (Anthropic, OpenAI, Gemini, Bedrock)
78
+ pip install devtorch[wrapper]
79
+
80
+ # With HTTP proxy + dashboard API (FastAPI)
81
+ pip install devtorch[proxy]
82
+
83
+ # Everything
84
+ pip install devtorch[all]
85
+ ```
86
+
87
+ **Requirements**: Python 3.10+
88
+
89
+ ---
90
+
91
+ ## Quick start
92
+
93
+ ```bash
94
+ cd /path/to/your/project
95
+ devtorch init
96
+
97
+ # Record reasoning commits
98
+ devtorch commit -m "Chose idempotent transfer endpoint design"
99
+
100
+ # Add per-agent branches
101
+ devtorch branch app
102
+ devtorch branch dba
103
+ devtorch branch security-review
104
+
105
+ # Add sensitivity information
106
+ devtorch sensitivity add \
107
+ --source agent-app \
108
+ --concept api_contract \
109
+ --confidence 0.9 \
110
+ --disclosure PUBLIC \
111
+ -m "API shape depends on transaction schema"
112
+
113
+ # Inspect state
114
+ devtorch status
115
+ devtorch debug timeline
116
+ devtorch debug branch-compare app dba
117
+ ```
118
+
119
+ ---
120
+
121
+ ## LLM integration
122
+
123
+ ### Option 1 — SDK wrapper (you own the code)
124
+
125
+ ```python
126
+ # One-line change — same API, governance captured automatically
127
+ from devtorch_core.wrapper.anthropic import DevTorchAnthropic
128
+ client = DevTorchAnthropic() # replaces anthropic.Anthropic()
129
+
130
+ # OpenAI
131
+ from devtorch_core.wrapper.openai import DevTorchOpenAI
132
+ client = DevTorchOpenAI()
133
+
134
+ # Local models via Ollama (no API key required)
135
+ from devtorch_core.wrapper.ollama import DevTorchOllama
136
+ client = DevTorchOllama(model="llama3.2") # any model in `ollama list`
137
+
138
+ # Google Gemini
139
+ from devtorch_core.wrapper.gemini import DevTorchGemini
140
+ client = DevTorchGemini(model_name="gemini-1.5-pro")
141
+
142
+ # AWS Bedrock
143
+ from devtorch_core.wrapper.bedrock import DevTorchBedrock
144
+ client = DevTorchBedrock(region_name="us-east-1")
145
+ ```
146
+
147
+ See `OLLAMA_SETUP.md` for the full Ollama guide.
148
+
149
+ ### Option 2 — HTTP proxy (Cursor, JetBrains, closed-source IDEs)
150
+
151
+ ```bash
152
+ devtorch proxy install # installs as macOS LaunchAgent or Linux systemd service
153
+ devtorch proxy start # runs on localhost:8765
154
+ ```
155
+
156
+ Configure your IDE to use `http://localhost:8765/anthropic` (or `/openai`, `/gemini`). The proxy injects RACP context and captures responses with zero latency penalty.
157
+
158
+ ### Option 3 — MCP server + hooks (Claude Code, Cursor, Kiro, Antigravity)
159
+
160
+ ```bash
161
+ devtorch setup # one command: init + hooks + MCP config + CLAUDE.md + AGENTS.md
162
+ ```
163
+
164
+ Claude Code / Cursor / Kiro / Antigravity then call `devtorch_commit`, `devtorch_sensitivity_add`, `devtorch_context`, and `devtorch_theta_read` as native MCP tools. See `IDE_SETUP.md` for per-IDE instructions.
165
+
166
+ ### Option 4 — OpenAI Codex CLI proxy
167
+
168
+ ```bash
169
+ # Start the Codex-specific proxy on localhost:8766
170
+ python -m devtorch_core.codex start
171
+
172
+ # Point Codex CLI at it
173
+ export OPENAI_BASE_URL=http://localhost:8766/v1
174
+ codex "Add error handling to the payment service"
175
+ ```
176
+
177
+ See `CODEX_SETUP.md` for the full guide.
178
+
179
+ ### Option 5 — Org gateway (enterprise, multi-developer)
180
+
181
+ ```bash
182
+ cd deploy/
183
+ cp .env.example .env # set ANTHROPIC_API_KEY and/or OPENAI_API_KEY
184
+ docker compose up # gateway on :8080, dashboard on :3000
185
+ ```
186
+
187
+ 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.
188
+
189
+ ---
190
+
191
+ ## Architecture
192
+
193
+ ```
194
+ devtorch_core/ Pure library — all business logic
195
+ gcc.py GCCRepository: .GCC/ layout, event log, commits, branches
196
+ sensitivity.py Sensitivity events + SensitivityStore
197
+ theta.py Coordination vector Θ + AggPhi
198
+ capability.py OmegaCapability (A1), Lipschitz bound, PST runner
199
+ invariants.py I1 (commit-backed), I3 (semantic grounding)
200
+ variance.py f_max formula, rolling monitor, VARIANCE_ALERT
201
+ rep.py REP ledger — append-only local transport
202
+ sis.py SIS-TC corpus evaluation + quarantine
203
+ rdp.py RDP ε-budget tracking
204
+ disclosure.py [PRIVATE] span suppression
205
+ prompt_artifact.py RACP system prompt artifact store
206
+ deltaf.py Δf estimation
207
+ parser/ XML block extractor, thinking tokens, inference
208
+ wrapper/ SDK drop-in wrappers (Anthropic, OpenAI, Gemini, Bedrock)
209
+ proxy/ HTTP reverse proxy (localhost:8765)
210
+ mcp/ MCP/JSON-RPC server
211
+ hooks/ Claude Code hooks + git commit-msg hook
212
+ metrics/ MCS, DHS, ROI, calibration, citation registry
213
+ observability/ Structured reports + enterprise metrics webhook
214
+ alerts/ Slack, Jira, PagerDuty outbound alerting
215
+ rep_network/ Multi-node REP ledger sync
216
+ github/ GitHub App webhook + PR comment builder
217
+ dashboard_api.py REST API for browser dashboard
218
+
219
+ devtorch_cli/
220
+ main.py Thin argparse wrapper over devtorch_core
221
+
222
+ extensions/vscode/ VS Code extension (read-only sidebar; installs in Antigravity via .vsix)
223
+ dashboard/ React browser dashboard (Developer/Lead/CISO views)
224
+ tests/ 637 tests across all sprints (S0–S18)
225
+ examples/ end-to-end scenario examples
226
+ ```
227
+
228
+ ---
229
+
230
+ ## On-disk layout (`.GCC/`)
231
+
232
+ ```
233
+ .GCC/
234
+ VERSION # format version
235
+ events.log.jsonl # append-only audit stream (hash chain)
236
+ main.md / log.md # reasoning roadmap + chronological log
237
+ refs/HEAD # current branch
238
+ refs/branches/<name> # branch tip commit ID
239
+ commits/<id>.json # commit objects
240
+ sensitivities/events.jsonl # raw sensitivity events
241
+ theta.json # coordination vector Θ
242
+ capabilities/omega.json # A1 capability state
243
+ variance/ # calibration_report.json, live_state.json
244
+ rep/rep_ledger.jsonl # REP transport ledger
245
+ rep/peers.json # peer list for multi-node sync
246
+ sis/ # SIS-TC corpus, reports, quarantine events
247
+ rdp/rdp_state.json # RDP ε-budget
248
+ concepts/<name>.json # I3 concept definitions
249
+ prompts/ # RACP system prompt artifact
250
+ deltaf/ # Δf report
251
+ calibration.json # team-specific metric calibration
252
+ context_bundles/ # MECW-bounded context snapshots
253
+ NODE_STATE # node state machine
254
+ ```
255
+
256
+ ---
257
+
258
+ ## Key safety properties
259
+
260
+ | Property | Mechanism |
261
+ |----------|-----------|
262
+ | Commit-backed decisions (I1) | Merge/unlock blocked unless branch tips exist in commits/ and events log |
263
+ | Semantic grounding (I3) | Operations using concepts_used require matching definitions in concepts/ |
264
+ | Capability gate (A1) | Textual mode requires valid OmegaCapability + passing PST |
265
+ | Variance control (A2) | f_max=0 forces deterministic mode; A1 gate blocks textual_mode |
266
+ | Privacy budget (RDP) | epsilon exhaustion flips read_only=true in rdp_state.json |
267
+ | Proxy trust boundary | Proxy binds to 127.0.0.1 only; API keys pass through, never stored |
268
+
269
+ ---
270
+
271
+ ## Run the tests
272
+
273
+ ```bash
274
+ python3 -m venv .venv && source .venv/bin/activate
275
+ pip install -e .[dev,proxy]
276
+ pytest tests/ # 637 tests
277
+ ```
278
+
279
+ ---
280
+
281
+ ## Configuration reference
282
+
283
+ | Env var | Purpose |
284
+ |---------|---------|
285
+ | `DEVTORCH_DISABLE=1` | Disable all injection and capture (wrapper/proxy become transparent) |
286
+ | `DEVTORCH_SLACK_WEBHOOK_URL` | Slack alert delivery |
287
+ | `DEVTORCH_JIRA_URL` / `_PROJECT_KEY` / `_API_TOKEN` / `_EMAIL` | Jira issue creation |
288
+ | `DEVTORCH_PAGERDUTY_ROUTING_KEY` | PagerDuty event trigger |
289
+ | `DEVTORCH_ALERT_MIN_SEVERITY` | Minimum severity to alert on (`info`/`warning`/`critical`) |
290
+ | `DEVTORCH_METRICS_WEBHOOK_URL` | Enterprise metrics webhook endpoint |
291
+ | `DEVTORCH_ORG_ID` | Org identifier in metrics payloads |
292
+ | `DEVTORCH_METRICS_API_KEY` | Auth for metrics webhook |
293
+ | `DEVTORCH_GITHUB_WEBHOOK_SECRET` | HMAC secret for GitHub App webhook |
294
+
295
+ ---
296
+
297
+ ## Documentation
298
+
299
+ | File | Contents |
300
+ |------|----------|
301
+ | `DOCS.md` | Architecture deep-dive, Sprint 4–6 feature reference, conformance matrix |
302
+ | `OBSERVABILITY.md` | Observability pillars, daily-recall pattern, shell audit script template |
303
+ | `CONTRIBUTING.md` | Dev environment, test commands, sprint structure, PR checklist |
304
+ | `THREAT_MODEL.md` | Trust model, hash chain integrity, proxy trust boundary, known limitations |
305
+ | `DESIGN_THOUGHTS.md` | Design decisions Q1–Q14 with full citation validation |
306
+ | `IDE_SETUP.md` | VS Code, Cursor, Kiro, and Antigravity setup instructions |
307
+ | `ANTIGRAVITY_SETUP.md` | Google Antigravity step-by-step onboarding |
308
+ | `CLAUDE_CODE_QUICKSTART.md` | Claude Code step-by-step onboarding |
309
+ | `OLLAMA_SETUP.md` | Local model setup with Ollama (Llama, Mistral, Gemma, Phi, Qwen) |
310
+ | `CODEX_SETUP.md` | OpenAI Codex CLI proxy setup |
311
+ | `AGENTS.md` | Persistent AI instructions for Antigravity/Kiro |
312
+ | `deploy/README.md` | Enterprise org gateway — Docker Compose and Helm deployment |
313
+ | `devtorch_core/metrics/README.md` | MCS/DHS/ROI formulas and calibration guide |
314
+ | `devtorch_core/proxy/README.md` | HTTP proxy deployment options |
315
+ | `devtorch_core/wrapper/README.md` | SDK wrapper quick-start for all providers |
316
+ | `dashboard/README.md` | Browser dashboard setup and API reference |
317
+
318
+ ---
319
+
320
+ ## Metrics credibility
321
+
322
+ DevTorch is explicit about what every number is based on:
323
+
324
+ - **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.
325
+ - **Auditor rate** — BLS SOC 13-2011 (2023): $39–40/hr employed staff. External rates ($75–400/hr) not used as defaults.
326
+ - **MCS/DHS weights** — Design choices. No external benchmark. Calibrate with your team's data.
327
+ - **Developer hourly rate** — No default. You must set it: `devtorch calibrate --set developer_hourly_rate=<value>`
328
+
329
+ See `devtorch_core/metrics/credibility.py` for the full citation registry.
330
+
331
+ ---
332
+
333
+ ## License
334
+
335
+ Apache 2.0
@@ -0,0 +1,296 @@
1
+ # DevTorch
2
+
3
+ **Local-first AI agent governance.** DevTorch gives multi-agent systems a shared on-disk audit trail, coordination vector, privacy controls, and LLM integration layer — all without a remote service.
4
+
5
+ ```
6
+ pip install devtorch
7
+ devtorch init
8
+ devtorch commit -m "Add payments service"
9
+ devtorch debug timeline
10
+ ```
11
+
12
+ ---
13
+
14
+ ## What it does
15
+
16
+ | Concern | DevTorch feature |
17
+ |---------|-----------------|
18
+ | Reasoning audit trail | Append-only `.GCC/events.log.jsonl` with SHA-256 hash chain |
19
+ | Multi-agent coordination | Coordination vector Θ — shared sensitivity map across agents |
20
+ | Privacy compliance | RDP ε-budget tracking; `[PRIVATE]` span suppression; SIS-TC quarantine |
21
+ | LLM integration | SDK wrappers, HTTP proxy, Claude Code MCP server + hooks |
22
+ | Governance observability | Structured reports, browser dashboard, VS Code extension (Antigravity-compatible) |
23
+ | Alerting | Slack, Jira, PagerDuty outbound webhooks |
24
+ | Metrics | MCS, DHS, ROI — all traceable to citations or explicit design choices |
25
+
26
+ Everything lives in `.GCC/` — a local directory in your project. No database, no network service, no telemetry.
27
+
28
+ ---
29
+
30
+ ## Install
31
+
32
+ ```bash
33
+ python3 -m venv .venv && source .venv/bin/activate
34
+
35
+ # Core CLI only
36
+ pip install devtorch
37
+
38
+ # With SDK wrappers (Anthropic, OpenAI, Gemini, Bedrock)
39
+ pip install devtorch[wrapper]
40
+
41
+ # With HTTP proxy + dashboard API (FastAPI)
42
+ pip install devtorch[proxy]
43
+
44
+ # Everything
45
+ pip install devtorch[all]
46
+ ```
47
+
48
+ **Requirements**: Python 3.10+
49
+
50
+ ---
51
+
52
+ ## Quick start
53
+
54
+ ```bash
55
+ cd /path/to/your/project
56
+ devtorch init
57
+
58
+ # Record reasoning commits
59
+ devtorch commit -m "Chose idempotent transfer endpoint design"
60
+
61
+ # Add per-agent branches
62
+ devtorch branch app
63
+ devtorch branch dba
64
+ devtorch branch security-review
65
+
66
+ # Add sensitivity information
67
+ devtorch sensitivity add \
68
+ --source agent-app \
69
+ --concept api_contract \
70
+ --confidence 0.9 \
71
+ --disclosure PUBLIC \
72
+ -m "API shape depends on transaction schema"
73
+
74
+ # Inspect state
75
+ devtorch status
76
+ devtorch debug timeline
77
+ devtorch debug branch-compare app dba
78
+ ```
79
+
80
+ ---
81
+
82
+ ## LLM integration
83
+
84
+ ### Option 1 — SDK wrapper (you own the code)
85
+
86
+ ```python
87
+ # One-line change — same API, governance captured automatically
88
+ from devtorch_core.wrapper.anthropic import DevTorchAnthropic
89
+ client = DevTorchAnthropic() # replaces anthropic.Anthropic()
90
+
91
+ # OpenAI
92
+ from devtorch_core.wrapper.openai import DevTorchOpenAI
93
+ client = DevTorchOpenAI()
94
+
95
+ # Local models via Ollama (no API key required)
96
+ from devtorch_core.wrapper.ollama import DevTorchOllama
97
+ client = DevTorchOllama(model="llama3.2") # any model in `ollama list`
98
+
99
+ # Google Gemini
100
+ from devtorch_core.wrapper.gemini import DevTorchGemini
101
+ client = DevTorchGemini(model_name="gemini-1.5-pro")
102
+
103
+ # AWS Bedrock
104
+ from devtorch_core.wrapper.bedrock import DevTorchBedrock
105
+ client = DevTorchBedrock(region_name="us-east-1")
106
+ ```
107
+
108
+ See `OLLAMA_SETUP.md` for the full Ollama guide.
109
+
110
+ ### Option 2 — HTTP proxy (Cursor, JetBrains, closed-source IDEs)
111
+
112
+ ```bash
113
+ devtorch proxy install # installs as macOS LaunchAgent or Linux systemd service
114
+ devtorch proxy start # runs on localhost:8765
115
+ ```
116
+
117
+ Configure your IDE to use `http://localhost:8765/anthropic` (or `/openai`, `/gemini`). The proxy injects RACP context and captures responses with zero latency penalty.
118
+
119
+ ### Option 3 — MCP server + hooks (Claude Code, Cursor, Kiro, Antigravity)
120
+
121
+ ```bash
122
+ devtorch setup # one command: init + hooks + MCP config + CLAUDE.md + AGENTS.md
123
+ ```
124
+
125
+ Claude Code / Cursor / Kiro / Antigravity then call `devtorch_commit`, `devtorch_sensitivity_add`, `devtorch_context`, and `devtorch_theta_read` as native MCP tools. See `IDE_SETUP.md` for per-IDE instructions.
126
+
127
+ ### Option 4 — OpenAI Codex CLI proxy
128
+
129
+ ```bash
130
+ # Start the Codex-specific proxy on localhost:8766
131
+ python -m devtorch_core.codex start
132
+
133
+ # Point Codex CLI at it
134
+ export OPENAI_BASE_URL=http://localhost:8766/v1
135
+ codex "Add error handling to the payment service"
136
+ ```
137
+
138
+ See `CODEX_SETUP.md` for the full guide.
139
+
140
+ ### Option 5 — Org gateway (enterprise, multi-developer)
141
+
142
+ ```bash
143
+ cd deploy/
144
+ cp .env.example .env # set ANTHROPIC_API_KEY and/or OPENAI_API_KEY
145
+ docker compose up # gateway on :8080, dashboard on :3000
146
+ ```
147
+
148
+ 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.
149
+
150
+ ---
151
+
152
+ ## Architecture
153
+
154
+ ```
155
+ devtorch_core/ Pure library — all business logic
156
+ gcc.py GCCRepository: .GCC/ layout, event log, commits, branches
157
+ sensitivity.py Sensitivity events + SensitivityStore
158
+ theta.py Coordination vector Θ + AggPhi
159
+ capability.py OmegaCapability (A1), Lipschitz bound, PST runner
160
+ invariants.py I1 (commit-backed), I3 (semantic grounding)
161
+ variance.py f_max formula, rolling monitor, VARIANCE_ALERT
162
+ rep.py REP ledger — append-only local transport
163
+ sis.py SIS-TC corpus evaluation + quarantine
164
+ rdp.py RDP ε-budget tracking
165
+ disclosure.py [PRIVATE] span suppression
166
+ prompt_artifact.py RACP system prompt artifact store
167
+ deltaf.py Δf estimation
168
+ parser/ XML block extractor, thinking tokens, inference
169
+ wrapper/ SDK drop-in wrappers (Anthropic, OpenAI, Gemini, Bedrock)
170
+ proxy/ HTTP reverse proxy (localhost:8765)
171
+ mcp/ MCP/JSON-RPC server
172
+ hooks/ Claude Code hooks + git commit-msg hook
173
+ metrics/ MCS, DHS, ROI, calibration, citation registry
174
+ observability/ Structured reports + enterprise metrics webhook
175
+ alerts/ Slack, Jira, PagerDuty outbound alerting
176
+ rep_network/ Multi-node REP ledger sync
177
+ github/ GitHub App webhook + PR comment builder
178
+ dashboard_api.py REST API for browser dashboard
179
+
180
+ devtorch_cli/
181
+ main.py Thin argparse wrapper over devtorch_core
182
+
183
+ extensions/vscode/ VS Code extension (read-only sidebar; installs in Antigravity via .vsix)
184
+ dashboard/ React browser dashboard (Developer/Lead/CISO views)
185
+ tests/ 637 tests across all sprints (S0–S18)
186
+ examples/ end-to-end scenario examples
187
+ ```
188
+
189
+ ---
190
+
191
+ ## On-disk layout (`.GCC/`)
192
+
193
+ ```
194
+ .GCC/
195
+ VERSION # format version
196
+ events.log.jsonl # append-only audit stream (hash chain)
197
+ main.md / log.md # reasoning roadmap + chronological log
198
+ refs/HEAD # current branch
199
+ refs/branches/<name> # branch tip commit ID
200
+ commits/<id>.json # commit objects
201
+ sensitivities/events.jsonl # raw sensitivity events
202
+ theta.json # coordination vector Θ
203
+ capabilities/omega.json # A1 capability state
204
+ variance/ # calibration_report.json, live_state.json
205
+ rep/rep_ledger.jsonl # REP transport ledger
206
+ rep/peers.json # peer list for multi-node sync
207
+ sis/ # SIS-TC corpus, reports, quarantine events
208
+ rdp/rdp_state.json # RDP ε-budget
209
+ concepts/<name>.json # I3 concept definitions
210
+ prompts/ # RACP system prompt artifact
211
+ deltaf/ # Δf report
212
+ calibration.json # team-specific metric calibration
213
+ context_bundles/ # MECW-bounded context snapshots
214
+ NODE_STATE # node state machine
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Key safety properties
220
+
221
+ | Property | Mechanism |
222
+ |----------|-----------|
223
+ | Commit-backed decisions (I1) | Merge/unlock blocked unless branch tips exist in commits/ and events log |
224
+ | Semantic grounding (I3) | Operations using concepts_used require matching definitions in concepts/ |
225
+ | Capability gate (A1) | Textual mode requires valid OmegaCapability + passing PST |
226
+ | Variance control (A2) | f_max=0 forces deterministic mode; A1 gate blocks textual_mode |
227
+ | Privacy budget (RDP) | epsilon exhaustion flips read_only=true in rdp_state.json |
228
+ | Proxy trust boundary | Proxy binds to 127.0.0.1 only; API keys pass through, never stored |
229
+
230
+ ---
231
+
232
+ ## Run the tests
233
+
234
+ ```bash
235
+ python3 -m venv .venv && source .venv/bin/activate
236
+ pip install -e .[dev,proxy]
237
+ pytest tests/ # 637 tests
238
+ ```
239
+
240
+ ---
241
+
242
+ ## Configuration reference
243
+
244
+ | Env var | Purpose |
245
+ |---------|---------|
246
+ | `DEVTORCH_DISABLE=1` | Disable all injection and capture (wrapper/proxy become transparent) |
247
+ | `DEVTORCH_SLACK_WEBHOOK_URL` | Slack alert delivery |
248
+ | `DEVTORCH_JIRA_URL` / `_PROJECT_KEY` / `_API_TOKEN` / `_EMAIL` | Jira issue creation |
249
+ | `DEVTORCH_PAGERDUTY_ROUTING_KEY` | PagerDuty event trigger |
250
+ | `DEVTORCH_ALERT_MIN_SEVERITY` | Minimum severity to alert on (`info`/`warning`/`critical`) |
251
+ | `DEVTORCH_METRICS_WEBHOOK_URL` | Enterprise metrics webhook endpoint |
252
+ | `DEVTORCH_ORG_ID` | Org identifier in metrics payloads |
253
+ | `DEVTORCH_METRICS_API_KEY` | Auth for metrics webhook |
254
+ | `DEVTORCH_GITHUB_WEBHOOK_SECRET` | HMAC secret for GitHub App webhook |
255
+
256
+ ---
257
+
258
+ ## Documentation
259
+
260
+ | File | Contents |
261
+ |------|----------|
262
+ | `DOCS.md` | Architecture deep-dive, Sprint 4–6 feature reference, conformance matrix |
263
+ | `OBSERVABILITY.md` | Observability pillars, daily-recall pattern, shell audit script template |
264
+ | `CONTRIBUTING.md` | Dev environment, test commands, sprint structure, PR checklist |
265
+ | `THREAT_MODEL.md` | Trust model, hash chain integrity, proxy trust boundary, known limitations |
266
+ | `DESIGN_THOUGHTS.md` | Design decisions Q1–Q14 with full citation validation |
267
+ | `IDE_SETUP.md` | VS Code, Cursor, Kiro, and Antigravity setup instructions |
268
+ | `ANTIGRAVITY_SETUP.md` | Google Antigravity step-by-step onboarding |
269
+ | `CLAUDE_CODE_QUICKSTART.md` | Claude Code step-by-step onboarding |
270
+ | `OLLAMA_SETUP.md` | Local model setup with Ollama (Llama, Mistral, Gemma, Phi, Qwen) |
271
+ | `CODEX_SETUP.md` | OpenAI Codex CLI proxy setup |
272
+ | `AGENTS.md` | Persistent AI instructions for Antigravity/Kiro |
273
+ | `deploy/README.md` | Enterprise org gateway — Docker Compose and Helm deployment |
274
+ | `devtorch_core/metrics/README.md` | MCS/DHS/ROI formulas and calibration guide |
275
+ | `devtorch_core/proxy/README.md` | HTTP proxy deployment options |
276
+ | `devtorch_core/wrapper/README.md` | SDK wrapper quick-start for all providers |
277
+ | `dashboard/README.md` | Browser dashboard setup and API reference |
278
+
279
+ ---
280
+
281
+ ## Metrics credibility
282
+
283
+ DevTorch is explicit about what every number is based on:
284
+
285
+ - **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.
286
+ - **Auditor rate** — BLS SOC 13-2011 (2023): $39–40/hr employed staff. External rates ($75–400/hr) not used as defaults.
287
+ - **MCS/DHS weights** — Design choices. No external benchmark. Calibrate with your team's data.
288
+ - **Developer hourly rate** — No default. You must set it: `devtorch calibrate --set developer_hourly_rate=<value>`
289
+
290
+ See `devtorch_core/metrics/credibility.py` for the full citation registry.
291
+
292
+ ---
293
+
294
+ ## License
295
+
296
+ Apache 2.0