segreant 0.0.0-stage → 0.1.0

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 (302) hide show
  1. package/LICENSE +116 -0
  2. package/LICENSING.md +60 -0
  3. package/README.md +277 -2
  4. package/baselines/lift-baselines.json +22 -0
  5. package/bin/publication-lock.mjs +748 -0
  6. package/bin/runtime-snapshot.mjs +266 -0
  7. package/bin/segreant.mjs +85 -0
  8. package/dist/alerts/detect.js +232 -0
  9. package/dist/alerts/notify.js +66 -0
  10. package/dist/alloc/apply.js +0 -0
  11. package/dist/alloc/epistemic.js +154 -0
  12. package/dist/alloc/exact.js +714 -0
  13. package/dist/alloc/rules.js +0 -0
  14. package/dist/billing/countermodels.js +123 -0
  15. package/dist/billing/epistemic.js +632 -0
  16. package/dist/billing/importer.js +56 -0
  17. package/dist/billing/mapping.js +239 -0
  18. package/dist/billing/openaiCosts.js +352 -0
  19. package/dist/billing/openaiCostsCoverage.js +108 -0
  20. package/dist/billing/readiness.js +68 -0
  21. package/dist/billing/reconcile.js +324 -0
  22. package/dist/billing/scope.js +61 -0
  23. package/dist/billing/types.js +180 -0
  24. package/dist/budget/allocate.js +100 -0
  25. package/dist/budget/capDecision.js +457 -0
  26. package/dist/budget/controlLock.js +71 -0
  27. package/dist/budget/enforceability.js +39 -0
  28. package/dist/budget/guard.js +284 -0
  29. package/dist/budget/onlineControl.js +404 -0
  30. package/dist/budget/recommend.js +153 -0
  31. package/dist/capital.js +220 -0
  32. package/dist/causal/assignment.js +179 -0
  33. package/dist/causal/design.js +161 -0
  34. package/dist/causal/epistemic.js +428 -0
  35. package/dist/causal/estimand.js +64 -0
  36. package/dist/causal/estimate.js +237 -0
  37. package/dist/causal/family.js +61 -0
  38. package/dist/causal/identity.js +18 -0
  39. package/dist/causal/inference-ledger.js +400 -0
  40. package/dist/causal/ledger.js +201 -0
  41. package/dist/causal/measurement.js +150 -0
  42. package/dist/causal/ope.js +297 -0
  43. package/dist/causal/precision.js +206 -0
  44. package/dist/causal/producer.js +774 -0
  45. package/dist/causal/protocol.js +962 -0
  46. package/dist/causal/qualification.js +260 -0
  47. package/dist/causal/records.js +416 -0
  48. package/dist/causal/registry.js +58 -0
  49. package/dist/causal/sequential.js +679 -0
  50. package/dist/causal/transport.js +138 -0
  51. package/dist/causal/types.js +10 -0
  52. package/dist/cli/allocCmd.js +271 -0
  53. package/dist/cli/backupCmd.js +99 -0
  54. package/dist/cli/billingCmd.js +948 -0
  55. package/dist/cli/capitalCmd.js +64 -0
  56. package/dist/cli/causalCmd.js +340 -0
  57. package/dist/cli/connectCmd.js +425 -0
  58. package/dist/cli/controlCmd.js +341 -0
  59. package/dist/cli/diagnosticsCmd.js +41 -0
  60. package/dist/cli/economicCmd.js +384 -0
  61. package/dist/cli/egressCmd.js +236 -0
  62. package/dist/cli/evidenceCmd.js +154 -0
  63. package/dist/cli/featuresCmd.js +53 -0
  64. package/dist/cli/flags.js +60 -0
  65. package/dist/cli/importCmd.js +501 -0
  66. package/dist/cli/launchCmd.js +89 -0
  67. package/dist/cli/marketCmd.js +178 -0
  68. package/dist/cli/opsCmd.js +288 -0
  69. package/dist/cli/outcomeCmd.js +120 -0
  70. package/dist/cli/packCmd.js +172 -0
  71. package/dist/cli/pluginCmd.js +145 -0
  72. package/dist/cli/retention.js +28 -0
  73. package/dist/cli/runCmd.js +439 -0
  74. package/dist/cli/showCmd.js +474 -0
  75. package/dist/cli/teamCmd.js +760 -0
  76. package/dist/cli/ui.js +112 -0
  77. package/dist/cli/valueCmd.js +826 -0
  78. package/dist/cli.js +547 -0
  79. package/dist/config.js +588 -0
  80. package/dist/connect/claudeCode.js +178 -0
  81. package/dist/connect/codex.js +283 -0
  82. package/dist/connect/connectors.js +285 -0
  83. package/dist/connect/importShared.js +230 -0
  84. package/dist/connect/opencode.js +186 -0
  85. package/dist/cost/coverage.js +53 -0
  86. package/dist/cost/exactPricing.js +129 -0
  87. package/dist/cost/pricing.js +784 -0
  88. package/dist/dashboard/claim-support.js +268 -0
  89. package/dist/dashboard/contracts.js +191 -0
  90. package/dist/dashboard/routes.js +1136 -0
  91. package/dist/dashboard/server.js +76 -0
  92. package/dist/dashboard/settings.js +108 -0
  93. package/dist/dashboard/shared-types.js +6 -0
  94. package/dist/dashboard/static.js +111 -0
  95. package/dist/dashboard/web/app/components/claimInspector.js +137 -0
  96. package/dist/dashboard/web/app/components/drawer.js +214 -0
  97. package/dist/dashboard/web/app/components/spine.js +133 -0
  98. package/dist/dashboard/web/app/core/actions.js +310 -0
  99. package/dist/dashboard/web/app/core/api.js +128 -0
  100. package/dist/dashboard/web/app/core/chain.js +33 -0
  101. package/dist/dashboard/web/app/core/claimLayers.js +264 -0
  102. package/dist/dashboard/web/app/core/claimTypes.js +192 -0
  103. package/dist/dashboard/web/app/core/dom.js +138 -0
  104. package/dist/dashboard/web/app/core/fmt.js +142 -0
  105. package/dist/dashboard/web/app/core/focus.js +10 -0
  106. package/dist/dashboard/web/app/core/generated-contract.js +191 -0
  107. package/dist/dashboard/web/app/core/generated-payload-contract.js +3100 -0
  108. package/dist/dashboard/web/app/core/generated-types.js +8 -0
  109. package/dist/dashboard/web/app/core/registry.js +304 -0
  110. package/dist/dashboard/web/app/core/signal.js +140 -0
  111. package/dist/dashboard/web/app/main.js +180 -0
  112. package/dist/dashboard/web/app/views/allocation.js +90 -0
  113. package/dist/dashboard/web/app/views/control.js +208 -0
  114. package/dist/dashboard/web/app/views/data.js +136 -0
  115. package/dist/dashboard/web/app/views/evidence.js +304 -0
  116. package/dist/dashboard/web/app/views/spend.js +128 -0
  117. package/dist/dashboard/web/app/views/system.js +40 -0
  118. package/dist/dashboard/web/app/views/value.js +488 -0
  119. package/dist/dashboard/web/classic.html +2139 -0
  120. package/dist/dashboard/web/index.html +51 -0
  121. package/dist/dashboard/web/styles/app.css +823 -0
  122. package/dist/decision/assurance.js +425 -0
  123. package/dist/decision/control.js +336 -0
  124. package/dist/decision/countermodels.js +118 -0
  125. package/dist/decision/engine.js +382 -0
  126. package/dist/decision/epistemic.js +546 -0
  127. package/dist/demo/seed.js +602 -0
  128. package/dist/diagnostics.js +236 -0
  129. package/dist/economics/attribution.js +201 -0
  130. package/dist/economics/close.js +133 -0
  131. package/dist/economics/corrections.js +120 -0
  132. package/dist/economics/epistemic.js +164 -0
  133. package/dist/economics/events.js +294 -0
  134. package/dist/economics/fx.js +245 -0
  135. package/dist/economics/ledger.js +1516 -0
  136. package/dist/economics/money.js +177 -0
  137. package/dist/economics/rate.js +331 -0
  138. package/dist/economics/request.js +89 -0
  139. package/dist/economics/serialization.js +99 -0
  140. package/dist/egress/policy.js +68 -0
  141. package/dist/egress/proxyHealth.js +36 -0
  142. package/dist/egress/receipts.js +871 -0
  143. package/dist/egress/ruleValidation.js +127 -0
  144. package/dist/egress/transport.js +395 -0
  145. package/dist/epistemic/abstract.js +432 -0
  146. package/dist/epistemic/admissibility.js +213 -0
  147. package/dist/epistemic/assumption.js +134 -0
  148. package/dist/epistemic/claim-uses.js +202 -0
  149. package/dist/epistemic/claim.js +264 -0
  150. package/dist/epistemic/countermodel.js +278 -0
  151. package/dist/epistemic/dag.js +421 -0
  152. package/dist/epistemic/derivation.js +391 -0
  153. package/dist/epistemic/evidence.js +254 -0
  154. package/dist/epistemic/grain.js +82 -0
  155. package/dist/epistemic/issuance-map.js +260 -0
  156. package/dist/epistemic/ledger.js +1489 -0
  157. package/dist/epistemic/obligation.js +149 -0
  158. package/dist/epistemic/preservation.js +178 -0
  159. package/dist/epistemic/profile.js +61 -0
  160. package/dist/epistemic/revocation.js +65 -0
  161. package/dist/epistemic/scope.js +66 -0
  162. package/dist/epistemic/serialization.js +171 -0
  163. package/dist/epistemic/state.js +46 -0
  164. package/dist/epistemic/time.js +37 -0
  165. package/dist/epistemic/ux.js +104 -0
  166. package/dist/epistemic/witness.js +176 -0
  167. package/dist/export/billingCsv.js +32 -0
  168. package/dist/export/csv.js +44 -0
  169. package/dist/export/economic.js +101 -0
  170. package/dist/export/focusBilling.js +66 -0
  171. package/dist/git/completeness.js +78 -0
  172. package/dist/git/contribution.js +598 -0
  173. package/dist/git/correlate.js +209 -0
  174. package/dist/git/quality.js +384 -0
  175. package/dist/githubActionsEvidence.js +234 -0
  176. package/dist/guide.js +154 -0
  177. package/dist/judge/call.js +161 -0
  178. package/dist/judge/orchestrate.js +127 -0
  179. package/dist/judge/payload.js +47 -0
  180. package/dist/judge/tier.js +107 -0
  181. package/dist/judge/transcript.js +324 -0
  182. package/dist/market/consensus.js +181 -0
  183. package/dist/market/market.js +323 -0
  184. package/dist/market/refresh.js +119 -0
  185. package/dist/market/sources.js +236 -0
  186. package/dist/market/zip.js +98 -0
  187. package/dist/measurement/completeness.js +125 -0
  188. package/dist/measurement/model.js +113 -0
  189. package/dist/measurement/registry.js +166 -0
  190. package/dist/measurement/surrogate.js +325 -0
  191. package/dist/outcomes/contract.js +107 -0
  192. package/dist/outcomes/registry.js +259 -0
  193. package/dist/outcomes/work-unit.js +42 -0
  194. package/dist/pack/canonical.js +63 -0
  195. package/dist/pack/export.js +120 -0
  196. package/dist/pack/index.js +5 -0
  197. package/dist/pack/manifest.js +77 -0
  198. package/dist/pack/signature.js +69 -0
  199. package/dist/pack/types.js +455 -0
  200. package/dist/pack/verifier.js +275 -0
  201. package/dist/plugins/contract.js +497 -0
  202. package/dist/plugins/host.js +333 -0
  203. package/dist/plugins/index.js +4 -0
  204. package/dist/plugins/intake.js +137 -0
  205. package/dist/plugins/invocation.js +158 -0
  206. package/dist/plugins/isolation.js +203 -0
  207. package/dist/proxy/server.js +771 -0
  208. package/dist/proxy/stream-proposals.js +249 -0
  209. package/dist/proxy/usage.js +208 -0
  210. package/dist/research/complexity/calibration.js +110 -0
  211. package/dist/research/complexity/lab.js +134 -0
  212. package/dist/research/complexity/profile.js +78 -0
  213. package/dist/research/economics/budgetRisk.js +100 -0
  214. package/dist/research/economics/capital.js +101 -0
  215. package/dist/research/economics/decisionLedger.js +103 -0
  216. package/dist/research/economics/decomposition.js +106 -0
  217. package/dist/research/economics/execution.js +42 -0
  218. package/dist/research/economics/frontier.js +113 -0
  219. package/dist/research/economics/metricSafety.js +74 -0
  220. package/dist/research/economics/offPolicy.js +120 -0
  221. package/dist/research/economics/promotion.js +85 -0
  222. package/dist/scan/knownApps.js +109 -0
  223. package/dist/scan/scan.js +211 -0
  224. package/dist/store/allocation.js +529 -0
  225. package/dist/store/backup.js +368 -0
  226. package/dist/store/billing.js +919 -0
  227. package/dist/store/causal.js +2547 -0
  228. package/dist/store/causalLineage.js +912 -0
  229. package/dist/store/causalProducer.js +462 -0
  230. package/dist/store/db.js +2501 -0
  231. package/dist/store/economicReadModel.js +270 -0
  232. package/dist/store/ope.js +67 -0
  233. package/dist/store/realization.js +315 -0
  234. package/dist/store/rows.js +52 -0
  235. package/dist/store/schema.js +2160 -0
  236. package/dist/team/ledger-evidence.js +82 -0
  237. package/dist/team/rollup.js +496 -0
  238. package/dist/team/standardize.js +115 -0
  239. package/dist/util/json.js +24 -0
  240. package/dist/util/quiet.js +18 -0
  241. package/dist/util/resource-limits.js +113 -0
  242. package/dist/util/statements.js +61 -0
  243. package/dist/util/transaction.js +68 -0
  244. package/dist/value/anytime.js +106 -0
  245. package/dist/value/characterization.js +77 -0
  246. package/dist/value/cohort.js +212 -0
  247. package/dist/value/drift.js +211 -0
  248. package/dist/value/epistemic.js +448 -0
  249. package/dist/value/frontier.js +513 -0
  250. package/dist/value/gates.js +276 -0
  251. package/dist/value/instrumentationSensitivity.js +76 -0
  252. package/dist/value/lenses.js +398 -0
  253. package/dist/value/lift.js +206 -0
  254. package/dist/value/liftBaseline.js +355 -0
  255. package/dist/value/liftEfficiency.js +68 -0
  256. package/dist/value/marginal.js +154 -0
  257. package/dist/value/proposals.js +263 -0
  258. package/dist/value/realization.js +868 -0
  259. package/dist/value/receipt.js +222 -0
  260. package/dist/value/receiptReconciliation.js +117 -0
  261. package/dist/value/reliability.js +101 -0
  262. package/dist/value/report.js +318 -0
  263. package/dist/value/selfReported.js +223 -0
  264. package/dist/value/sourceDepth.js +25 -0
  265. package/dist/value/taskType.js +46 -0
  266. package/dist/value/timeReclaimed.js +90 -0
  267. package/dist/value/usage.js +281 -0
  268. package/dist/version.js +20 -0
  269. package/docs/ALLOCATION.md +263 -0
  270. package/docs/ARCHITECTURE.md +448 -0
  271. package/docs/BILLING-EVIDENCE-IMPORT.md +274 -0
  272. package/docs/CAPABILITY-EVIDENCE-CONTRACT.md +198 -0
  273. package/docs/CAUSAL-EVIDENCE-PROTOCOL.md +295 -0
  274. package/docs/CAUSAL-PRODUCER-CONTRACT.md +128 -0
  275. package/docs/COMPATIBILITY.md +64 -0
  276. package/docs/DATA-BOUNDARIES.md +240 -0
  277. package/docs/EVIDENCE-PROVENANCE.md +40 -0
  278. package/docs/FAQ.md +241 -0
  279. package/docs/FOCUS-COMPATIBILITY.md +15 -0
  280. package/docs/GETTING-STARTED.md +229 -0
  281. package/docs/GUIDE.md +767 -0
  282. package/docs/INTEGRATIONS.md +233 -0
  283. package/docs/MARKET-SOURCES.md +142 -0
  284. package/docs/METHODOLOGY.md +165 -0
  285. package/docs/NEUTRALITY.md +95 -0
  286. package/docs/PROVIDER-RECONCILIATION.md +260 -0
  287. package/docs/README.md +51 -0
  288. package/docs/REAL-PROVIDER-RECONCILIATION-RUNBOOK.md +44 -0
  289. package/docs/RELEASE-GATE.md +637 -0
  290. package/docs/RELEASE-PROCESS.md +68 -0
  291. package/docs/RELIABILITY-PERFORMANCE.md +149 -0
  292. package/docs/RETURN-ON-INTELLIGENCE.md +808 -0
  293. package/docs/SUPPORT.md +37 -0
  294. package/docs/THE-STANDARD.md +235 -0
  295. package/docs/THREAT-MODEL.md +113 -0
  296. package/market/consensus-fits.json +1 -0
  297. package/market/snapshot.json +1 -0
  298. package/package.json +78 -4
  299. package/pricing/models.json +94 -0
  300. package/standalone/segreantpack-verifier.d.mts +61 -0
  301. package/standalone/segreantpack-verifier.mjs +715 -0
  302. package/web/assets/brand/mark-256.png +0 -0
package/LICENSE ADDED
@@ -0,0 +1,116 @@
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: GamingDragonwastaken (https://github.com/GamingDragonwastaken)
6
+
7
+ Licensed Work: Segreant
8
+ The Licensed Work is (c) 2026 GamingDragonwastaken.
9
+
10
+ Additional Use Grant: You may make production use of the Licensed Work,
11
+ including inside a company, for paid work, and as part
12
+ of another product or service that you build and sell,
13
+ provided that you do not:
14
+
15
+ (a) offer the Licensed Work, or a modified version of
16
+ it, to third parties as a hosted, managed or
17
+ software-as-a-service offering; or
18
+
19
+ (b) sell, rent, sublicense or otherwise charge a fee for
20
+ the Licensed Work itself or a modified version of
21
+ it, including a product that is substantially the
22
+ Licensed Work offered under another name.
23
+
24
+ Charging for your own product or service that uses or
25
+ includes the Licensed Work is permitted when that
26
+ product or service is not substantially the Licensed
27
+ Work. Running the Licensed Work for your own
28
+ organization, its employees and its contractors is not
29
+ an offering to third parties.
30
+
31
+ Change Date: For each version of the Licensed Work, two years after
32
+ the date that version is first publicly distributed.
33
+
34
+ Change License: Apache License, Version 2.0
35
+
36
+ For information about alternative licensing arrangements for the Licensed Work,
37
+ please contact the Licensor through
38
+ https://github.com/GamingDragonwastaken/Segreant/discussions.
39
+
40
+ Notice
41
+
42
+ The Business Source License (this document, or the "License") is not an Open
43
+ Source license. However, the Licensed Work will eventually be made available
44
+ under an Open Source License, as stated in this License.
45
+
46
+ -----------------------------------------------------------------------------
47
+
48
+ License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
49
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
50
+
51
+ Terms
52
+
53
+ The Licensor hereby grants you the right to copy, modify, create derivative
54
+ works, redistribute, and make non-production use of the Licensed Work. The
55
+ Licensor may make an Additional Use Grant, above, permitting limited
56
+ production use.
57
+
58
+ Effective on the Change Date, or the fourth anniversary of the first publicly
59
+ available distribution of a specific version of the Licensed Work under this
60
+ License, whichever comes first, the Licensor hereby grants you rights under
61
+ the terms of the Change License, and the rights granted in the paragraph
62
+ above terminate.
63
+
64
+ If your use of the Licensed Work does not comply with the requirements
65
+ currently in effect as described in this License, you must purchase a
66
+ commercial license from the Licensor, its affiliated entities, or authorized
67
+ resellers, or you must refrain from using the Licensed Work.
68
+
69
+ All copies of the original and modified Licensed Work, and derivative works
70
+ of the Licensed Work, are subject to this License. This License applies
71
+ separately for each version of the Licensed Work and the Change Date may vary
72
+ for each version of the Licensed Work released by Licensor.
73
+
74
+ You must conspicuously display this License on each original or modified copy
75
+ of the Licensed Work. If you receive the Licensed Work in original or
76
+ modified form from a third party, the terms and conditions set forth in this
77
+ License apply to your use of that work.
78
+
79
+ Any use of the Licensed Work in violation of this License will automatically
80
+ terminate your rights under this License for the current and all other
81
+ versions of the Licensed Work.
82
+
83
+ This License does not grant you any right in any trademark or logo of
84
+ Licensor or its affiliates (provided that you may use a trademark or logo of
85
+ Licensor as expressly required by this License).
86
+
87
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
88
+ AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
89
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
90
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
91
+ TITLE.
92
+
93
+ MariaDB hereby grants you permission to use this License’s text to license
94
+ your works, and to refer to it using the trademark “Business Source License”,
95
+ as long as you comply with the Covenants of Licensor below.
96
+
97
+ Covenants of Licensor
98
+
99
+ In consideration of the right to use this License’s text and the “Business
100
+ Source License” name and trademark, Licensor covenants to MariaDB, and to all
101
+ other recipients of the licensed work to be provided by Licensor:
102
+
103
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
104
+ or a license that is compatible with GPL Version 2.0 or a later version,
105
+ where “compatible” means that software provided under the Change License can
106
+ be included in a program with software provided under GPL Version 2.0 or a
107
+ later version. Licensor may specify additional Change Licenses without
108
+ limitation.
109
+
110
+ 2. To either: (a) specify an additional grant of rights to use that does not
111
+ impose any additional restriction on the right granted in this License, as
112
+ the Additional Use Grant; or (b) insert the text “None”.
113
+
114
+ 3. To specify a Change Date.
115
+
116
+ 4. Not to modify this License in any other way.
package/LICENSING.md ADDED
@@ -0,0 +1,60 @@
1
+ # Licensing, in plain words
2
+
3
+ Segreant is published under the [Business Source License 1.1](LICENSE) with an
4
+ Additional Use Grant. The LICENSE file is the binding text; this page explains
5
+ what it means.
6
+
7
+ ## What you can do, free
8
+
9
+ - **Use it for anything**, as a person or as a company: on your own projects,
10
+ at work, on paid client work, across your whole organization, with a team
11
+ server for your own staff.
12
+ - **Change it, share it and contribute** to it.
13
+ - **Build your own product on it and sell that product**, as long as your
14
+ product is more than Segreant under another name.
15
+
16
+ No account, key, payment or permission is needed for any of that.
17
+
18
+ ## The two things you may not do
19
+
20
+ 1. **Offer Segreant as a service.** You may not run it, or a modified version
21
+ of it, as a hosted or managed service for other people or other companies.
22
+ Running it for your own organization is fine.
23
+ 2. **Sell Segreant itself.** You may not sell, rent or charge a licence fee for
24
+ Segreant or a modified version of it, including a copy relabelled under
25
+ another name.
26
+
27
+ ## Every version becomes fully open source
28
+
29
+ Two years after a version of Segreant is first published, that version
30
+ switches to the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0),
31
+ an Open Source license, and both limits above end for it. Each later version
32
+ follows on its own two-year clock.
33
+
34
+ Until then, Segreant is *source-available*, not *open source* in the strict
35
+ (OSI) sense. We say so plainly rather than borrow a label it has not earned yet.
36
+
37
+ ## Why these terms
38
+
39
+ The goal of Segreant is to move AI from paying for tokens to paying for value,
40
+ and that needs as many people and organizations as possible measuring their own
41
+ AI work, building on the measurement and improving it. The only thing these
42
+ terms hold back is someone else turning this project into a paid service or a
43
+ resold copy before it is fully open.
44
+
45
+ ## Something else in mind
46
+
47
+ If you want to do something the two limits forbid, or you need different
48
+ terms, open a
49
+ [discussion](https://github.com/GamingDragonwastaken/Segreant/discussions).
50
+
51
+ ## Earlier versions
52
+
53
+ - Commits up to `28dc6dd` on `main` were published under the MIT license and
54
+ remain available under it.
55
+ - Commits after that and before the change to this license were published
56
+ under the PolyForm Noncommercial License 1.0.0 (from 2026-10-08 with an
57
+ individual use permission). Those copies keep the terms they were published
58
+ with; every later version is under the terms above.
59
+
60
+ *This page explains the license; it is not legal advice.*
package/README.md CHANGED
@@ -1,3 +1,278 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <img src="web/assets/brand/mark-256.png" alt="The Segreant mark: a gold griffin rearing, on black" width="112" />
4
+
5
+ # Segreant
6
+
7
+ **Govern the spend. Not the developer.**
8
+
9
+ The financial control layer for AI coding agents, running on your own machine.
10
+ Every dollar your agents spend is metered, capped, checked against the
11
+ provider's bill, assigned to the budget it belongs to, and traced to the work
12
+ it produced. And every number tells you exactly how much it can be trusted.
13
+
14
+ `local-first` · `zero runtime dependencies` · `2,300+ tests` · `Node 24+` · `free for personal use`
15
+
16
+ [![CI](https://github.com/GamingDragonwastaken/Segreant/actions/workflows/ci.yml/badge.svg)](https://github.com/GamingDragonwastaken/Segreant/actions/workflows/ci.yml)
17
+
18
+ </div>
19
+
20
+ ---
21
+
22
+ ## The problem
23
+
24
+ Coding agents bill by the token, and they fail expensively. An agent stuck in a
25
+ loop overnight doesn't raise an error; it sends an invoice. Your monitoring
26
+ can't see it, because a `$0.002` request and a `$0.40` retry loop look
27
+ identical when all you measure is latency and errors.
28
+
29
+ Then finance asks a simple question, *"what is AI costing us, and is it worth
30
+ it?"*, and every tool answers with one confident number. That number is
31
+ usually an estimate dressed as a bill, or a bill with no owner, or a value
32
+ figure nobody can defend.
33
+
34
+ ## Four numbers, never one
35
+
36
+ Segreant is built on a single refusal: **it will not collapse four different
37
+ questions into one number.**
38
+
39
+ | | The question | Where the answer comes from |
40
+ |---|---|---|
41
+ | **Metered usage** | What did the traffic use, at list price? | Segreant's proxy or your tools' own logs, priced from a versioned local rate card |
42
+ | **Provider-billed cost** | What did the provider actually charge? | The provider's cost export or Costs API (OpenAI today), imported and kept separate |
43
+ | **Allocated cost** | Whose budget does it belong to? | Allocation rules you write, reported together with what they left unallocated |
44
+ | **Value** | Did the spend become shipped, kept work? | Outcome evidence from git, tests and your reports |
45
+
46
+ Every figure on every screen says which of the four it is. When the evidence
47
+ for a number is missing, Segreant shows **unknown**. It never fills in a guess.
48
+
49
+ ## What makes it different
50
+
51
+ Most cost tools are dashboards. Segreant is an accounting system with an
52
+ evidence model underneath, and it behaves like one.
53
+
54
+ - **Every row carries its provenance.** Each priced request records the exact
55
+ rate-card SHA-256 and whether the price was an exact, family or fallback
56
+ match. Repricing appends a before/after event; nothing is silently
57
+ overwritten.
58
+ - **Budgets fail closed.** If the budget config is malformed or the ledger
59
+ can't be read, Segreant stops forwarding. A broken meter never becomes an
60
+ unlimited one.
61
+ - **Reconciliation shows its residual.** When metered spend and the
62
+ provider's bill disagree, the gap is reported with the conditions that
63
+ explain it and what it can and cannot bound. It is never forced to zero.
64
+ - **Allocation conserves money.** Allocated plus unallocated equals the ledger
65
+ total to the microdollar, checked on every run. A run that doesn't balance
66
+ is refused.
67
+ - **Model comparisons know when they're confounded.** Cheaper-model trials use
68
+ anytime-valid intervals, correct for multiple comparisons, and flag
69
+ themselves when the work sizes differ, the sample spans a price change, or
70
+ the commits came from too few sessions.
71
+ - **Evidence you can hand to someone else.** Realized work produces
72
+ ed25519-signed value receipts. The whole evidence ledger exports as a
73
+ `.segreantpack` that a standalone verifier checks offline, without trusting
74
+ Segreant.
75
+ - **A kernel that can't be talked into certainty.** Claims live in a small
76
+ trusted core that tracks four evidence states: unknown, supported, refuted
77
+ and conflicted. It refuses derivations that would strengthen a claim beyond
78
+ its evidence, and revoking a source revokes everything built on it.
79
+ - **Zero runtime dependencies.** Node's built-in SQLite and nothing else. CI
80
+ proves it with a CycloneDX SBOM on every build.
81
+
82
+ ## See it in 30 seconds
83
+
84
+ No API key, no account, no setup. With Node 24 or newer:
85
+
86
+ ```bash
87
+ npx segreant demo --serve # labelled synthetic data; opens the dashboard
88
+ ```
89
+
90
+ Open **http://localhost:8091**. You'll see spend by project and model, budget
91
+ controls and governance alerts, the Return on Intelligence view, and a
92
+ review-only cheaper-model trial. It all runs on an isolated `demo.db` and is
93
+ labelled as synthetic. Clear it with `segreant demo --clear`.
94
+
95
+ ## Use it on your real work
96
+
97
+ Install the `segreant` command (it has no runtime dependencies):
98
+
99
+ ```bash
100
+ npm install -g segreant
101
+ ```
102
+
103
+ **Option A: no wiring at all.** If you use Claude Code, Codex or opencode,
104
+ Segreant reads the usage those tools already log on your machine, including
105
+ subscription usage a proxy never sees:
106
+
107
+ ```bash
108
+ segreant scan # finds your AI tools and git repos; changes nothing
109
+ segreant scan --setup # imports that usage and groups it by project
110
+ segreant today # what today cost, by model, project and tool
111
+ ```
112
+
113
+ **Option B: route traffic through Segreant** to meter it live and enforce budgets:
114
+
115
+ ```bash
116
+ segreant start # proxy on :8090, dashboard on :8091
117
+ ```
118
+
119
+ ```bash
120
+ segreant launch -- claude # or codex, opencode, aider, ...
121
+ ```
122
+
123
+ `launch` points only that one tool at the proxy, and only while the proxy is
124
+ running. If the proxy is stopped, the tool starts unmetered with a warning, or
125
+ not at all when a budget cap is set. To point a shell at it yourself instead:
126
+
127
+ ```bash
128
+ export ANTHROPIC_BASE_URL="http://localhost:8090"
129
+ export OPENAI_BASE_URL="http://localhost:8090/v1"
130
+ ```
131
+
132
+ A tool pointed at the proxy this way cannot connect while Segreant is stopped.
133
+
134
+ Segreant starts **locked**: it forwards nothing to a cloud provider until you
135
+ grant that exact route with `segreant egress apply`; the two commands for OpenAI
136
+ and Anthropic are in [GETTING-STARTED.md](docs/GETTING-STARTED.md). Then set a
137
+ cap:
138
+
139
+ ```bash
140
+ segreant budget --daily 25 --soft 18 --runaway 2 # hard cap, warning, loop guard
141
+ ```
142
+
143
+ Caps are opt-in. A fresh install meters but never blocks. Unset the two
144
+ variables and Segreant is out of the path.
145
+
146
+ Per-tool recipes (Cursor, aider, opencode, Antigravity, your own SDK scripts):
147
+ [docs/INTEGRATIONS.md](docs/INTEGRATIONS.md).
148
+
149
+ ## What you can do with it
150
+
151
+ - **See the spend.** By day, project, model, tool and developer, in the
152
+ terminal (`segreant today`, `week`, `month`) or the dashboard. Export CSV for
153
+ your own BI.
154
+ - **Stop runaway agents.** Daily, per-session and velocity caps on proxied
155
+ traffic.
156
+ - **Check against the real bill.** Import an OpenAI cost export, or pull
157
+ OpenAI's Costs API read-only, and reconcile it against what Segreant metered
158
+ at project-day level. See [PROVIDER-RECONCILIATION.md](docs/PROVIDER-RECONCILIATION.md).
159
+ - **Allocate to cost centres.** Versioned, effective-dated rules, reported as
160
+ showback. See [ALLOCATION.md](docs/ALLOCATION.md).
161
+ - **Measure what the spend produced.** Return on Intelligence follows each
162
+ commit through tested, merged, shipped and survived. See
163
+ [RETURN-ON-INTELLIGENCE.md](docs/RETURN-ON-INTELLIGENCE.md).
164
+ - **Try a cheaper model, carefully.** `segreant frontier` compares models on the
165
+ same kind of task. It never changes your routing for you.
166
+ - **Keep your data yours.** SQLite on your disk, verified backup and restore,
167
+ and evidence packs you can sign and verify.
168
+
169
+ Every command, flag and design detail is in the **[Segreant guide](docs/GUIDE.md)**.
170
+
171
+ ## For teams and enterprises
172
+
173
+ The same local tool scales up without sending prompts or code anywhere:
174
+
175
+ - **Team rollups.** Each machine signs and pushes per-project value and spend
176
+ summaries to a team server *you* run. Per-developer views are opt-in,
177
+ distribution-only and k-anonymous.
178
+ - **Finance-ready output.** Cost-centre allocation with conservation checks,
179
+ provider-billed evidence with digests and coverage declarations, and a
180
+ [FOCUS](docs/FOCUS-COMPATIBILITY.md)-compatible billing export.
181
+ - **Identity and storage.** The team server supports OIDC sign-in and
182
+ PostgreSQL.
183
+
184
+ The team server is implemented and tested, but it has not yet been validated in
185
+ a production deployment; see [team-server/README.md](team-server/README.md)
186
+ before exposing it to a network.
187
+
188
+ ## What Segreant will not claim
189
+
190
+ Built to be believed, so it is strict about what it says.
191
+
192
+ - **A local estimate is not a bill.** Metered amounts are list-price estimates.
193
+ Provider figures are imported separately, and reconciled cost never feeds
194
+ budgets or recommendations.
195
+ - **Value is not causation.** The dollar figure in the value view is an
196
+ **Observed value scenario**: manual-equivalent value under assumptions you
197
+ set. It is not a causal return. A causal net benefit result is separate and
198
+ requires a registered randomized study (see
199
+ [CAUSAL-EVIDENCE-PROTOCOL.md](docs/CAUSAL-EVIDENCE-PROTOCOL.md)).
200
+ - **Attribution labels are declarations, not verified identity.** Each label
201
+ records how it was obtained, and a missing one stays missing.
202
+ - **Not surveillance.** Personal views are for self-improvement. Team views
203
+ are opt-in and aggregate-only.
204
+
205
+ The complete, test-enforced list of what is supported, intended and not
206
+ offered is [CAPABILITY-EVIDENCE-CONTRACT.md](docs/CAPABILITY-EVIDENCE-CONTRACT.md).
207
+
208
+ ## Privacy
209
+
210
+ Segreant has no hosted service and sends no telemetry by default. The ledger
211
+ lives under `~/.segreant`, and the dashboard loads nothing from third parties:
212
+ no CDNs, fonts or analytics. Requests you route through the proxy still go to
213
+ the AI provider you configured, and your API keys pass through without being
214
+ stored. Every other outbound path (price-card refresh, alert webhooks, team
215
+ rollups) is opt-in and listed in [DATA-BOUNDARIES.md](docs/DATA-BOUNDARIES.md).
216
+
217
+ ## Status
218
+
219
+ Segreant is **pre-release (0.1.0)**, published on npm as `segreant`. CI covers Linux, macOS and Windows, including a packaged-install
220
+ smoke test, a browser accessibility pass and supply-chain checks.
221
+ Reconciliation and outcome measurement are implemented and tested but have not
222
+ yet been validated against real provider accounts or with outside users. That
223
+ is what the first users will prove.
224
+
225
+ If you try it, what confused you or what broke is the most useful thing you
226
+ can send: [open an issue](https://github.com/GamingDragonwastaken/Segreant/issues)
227
+ or [start a discussion](https://github.com/GamingDragonwastaken/Segreant/discussions).
228
+
229
+ ## Documentation
230
+
231
+ | Start here | Go deeper | Trust and boundaries |
232
+ |---|---|---|
233
+ | [Getting started](docs/GETTING-STARTED.md) | [Segreant guide](docs/GUIDE.md) | [Data boundaries](docs/DATA-BOUNDARIES.md) |
234
+ | [Integrations](docs/INTEGRATIONS.md) | [Architecture](docs/ARCHITECTURE.md) | [Capability contract](docs/CAPABILITY-EVIDENCE-CONTRACT.md) |
235
+ | [FAQ](docs/FAQ.md) | [Methodology (plain language)](docs/METHODOLOGY.md) | [Threat model](docs/THREAT-MODEL.md) |
236
+
237
+ The full index is in [docs/README.md](docs/README.md).
238
+
239
+ ## By the numbers
240
+
241
+ | | |
242
+ |---|---|
243
+ | Product code | ~88,000 lines of strict TypeScript |
244
+ | Tests | ~70,000 lines, 2,300+ test cases across the CLI, dashboard and team server |
245
+ | Runtime dependencies | 0 |
246
+ | CI | 11 jobs on every pull request: three operating systems, the team server against real PostgreSQL, a packaged install, supply chain, accessibility, and exact-head verification |
247
+
248
+ ## Development
249
+
250
+ ```bash
251
+ npm install # dev-only: typescript + @types/node
252
+ npm run build # compile to dist/
253
+ npm test # the full suite
254
+ npm run typecheck # strict TypeScript
255
+ npm run demo # rebuilds, then the demo dashboard from this checkout
256
+ npm run start # rebuilds, then the proxy and dashboard from this checkout
257
+ ```
258
+
259
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for how changes are verified,
260
+ [GOVERNANCE.md](GOVERNANCE.md) for who decides what, [SECURITY.md](SECURITY.md)
261
+ for reporting a vulnerability, [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md)
262
+ for what stays stable, and [docs/RELEASE-PROCESS.md](docs/RELEASE-PROCESS.md)
263
+ for how a release is gated.
264
+
265
+ ## Supporting Segreant
266
+
267
+ Segreant is built independently and is free to use for everyone, people and
268
+ organizations alike ([LICENSING.md](LICENSING.md)). Paying never unlocks features
269
+ ([docs/NEUTRALITY.md](docs/NEUTRALITY.md) makes that a checkable commitment).
270
+
271
+ ## License
272
+
273
+ [Business Source License 1.1](LICENSE) with an Additional Use Grant: **anyone,
274
+ person or company, may use, change and build on Segreant for free**, including
275
+ selling their own products built on it. The two things not allowed are
276
+ offering Segreant as a hosted service and selling Segreant itself. Two years
277
+ after each version is published, it becomes Apache 2.0 open source. Plain
278
+ words: [LICENSING.md](LICENSING.md).
@@ -0,0 +1,22 @@
1
+ {
2
+ "schema_version": 1,
3
+ "curated": "2026-07-10",
4
+ "unit": "minutes",
5
+ "source": {
6
+ "title": "Task-Completion Time Horizons of Frontier AI Models (METR, Time Horizon 1.1)",
7
+ "url": "https://metr.org/time-horizons/",
8
+ "arxiv": "https://arxiv.org/abs/2503.14499",
9
+ "asOf": "2026-05-08",
10
+ "note": "METR times skilled professional software engineers (~5 years' experience) completing real software tasks, using the geometric mean of successful completion times, then reports the task LENGTH (in that human-timed unit) at which frontier models succeed 50%/80% of the time. As of Time Horizon 1.1 (page updated 2026-05-08, benchmark METR-Horizon-v1.1 released 2026-04-07), the highest 80%-reliability horizon among tested models is ~186 minutes (Claude Mythos Preview Early) — verified against METR's own published benchmark data, not estimated. METR does NOT publish a breakdown of their task suite by category matching this table's task-type taxonomy (feature/fix/refactor/...) — the per-task-type minutes below are this project's own calibration against that published human-timed scale, not a METR output. These values are unchanged from this project's earlier illustrative defaults; the METR anchor (feature=240min sits modestly above the current ~186min frontier-model horizon) is an order-of-magnitude sanity check on them, not a re-derivation from METR data. Treat this as a cited industry anchor, not a precise measurement. Refreshable via `segreant baseline --refresh --url <manifest>` (no default source — you must supply one you trust; see docs/RETURN-ON-INTELLIGENCE.md §7.1) and, per project, blended with your own git history when enough pre-tracking commits exist — see src/value/liftBaseline.ts."
11
+ },
12
+ "baselineMinutes": {
13
+ "feature": 240,
14
+ "fix": 90,
15
+ "refactor": 120,
16
+ "test": 60,
17
+ "docs": 45,
18
+ "perf": 120,
19
+ "chore": 30,
20
+ "other": 90
21
+ }
22
+ }