loadout-ai 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 (125) hide show
  1. package/LICENSE +21 -0
  2. package/MASTER_PLAN.md +1711 -0
  3. package/README.md +453 -0
  4. package/SECURITY.md +18 -0
  5. package/SIMPLE_PLAN.md +44 -0
  6. package/catalog/discovered.json +10469 -0
  7. package/catalog/packages.json +1150 -0
  8. package/dashboard/app.js +607 -0
  9. package/dashboard/index.html +249 -0
  10. package/dashboard/styles.css +384 -0
  11. package/dist/src/cli.js +2735 -0
  12. package/dist/src/core/active-policy.js +233 -0
  13. package/dist/src/core/active-set.js +382 -0
  14. package/dist/src/core/adapters.js +254 -0
  15. package/dist/src/core/adopt.js +92 -0
  16. package/dist/src/core/agent-health-score.js +475 -0
  17. package/dist/src/core/agent-inspection.js +152 -0
  18. package/dist/src/core/agent-versions.js +131 -0
  19. package/dist/src/core/api.js +90 -0
  20. package/dist/src/core/atomic-file.js +22 -0
  21. package/dist/src/core/audit.js +174 -0
  22. package/dist/src/core/benchmark-campaign.js +496 -0
  23. package/dist/src/core/benchmark-evidence.js +458 -0
  24. package/dist/src/core/benchmark-fixtures.js +1157 -0
  25. package/dist/src/core/benchmark-runner.js +301 -0
  26. package/dist/src/core/benchmark-trust.js +795 -0
  27. package/dist/src/core/canary.js +77 -0
  28. package/dist/src/core/candidate-intelligence.js +661 -0
  29. package/dist/src/core/catalog-coverage.js +85 -0
  30. package/dist/src/core/catalog-install.js +186 -0
  31. package/dist/src/core/catalog-release.js +286 -0
  32. package/dist/src/core/catalog.js +327 -0
  33. package/dist/src/core/codex-mcp.js +122 -0
  34. package/dist/src/core/community.js +86 -0
  35. package/dist/src/core/compatibility-intelligence.js +465 -0
  36. package/dist/src/core/completion.js +160 -0
  37. package/dist/src/core/components.js +138 -0
  38. package/dist/src/core/conversion.js +56 -0
  39. package/dist/src/core/credentials.js +377 -0
  40. package/dist/src/core/demo.js +136 -0
  41. package/dist/src/core/diff.js +83 -0
  42. package/dist/src/core/discovery-connector.js +165 -0
  43. package/dist/src/core/doctor.js +95 -0
  44. package/dist/src/core/ecosystem-import.js +1072 -0
  45. package/dist/src/core/evaluate.js +72 -0
  46. package/dist/src/core/file-lock.js +140 -0
  47. package/dist/src/core/freshness-alerts.js +230 -0
  48. package/dist/src/core/github-discovery.js +97 -0
  49. package/dist/src/core/github.js +148 -0
  50. package/dist/src/core/head-to-head.js +437 -0
  51. package/dist/src/core/health-score-evidence.js +169 -0
  52. package/dist/src/core/health.js +129 -0
  53. package/dist/src/core/improve.js +223 -0
  54. package/dist/src/core/install.js +233 -0
  55. package/dist/src/core/intelligence-feed-build.js +59 -0
  56. package/dist/src/core/intelligence-feed.js +353 -0
  57. package/dist/src/core/loadout-badge.js +55 -0
  58. package/dist/src/core/loadout-card.js +87 -0
  59. package/dist/src/core/manifest.js +307 -0
  60. package/dist/src/core/mcp-recipes.js +419 -0
  61. package/dist/src/core/mcp-registry-discovery.js +455 -0
  62. package/dist/src/core/mcp.js +287 -0
  63. package/dist/src/core/model-config.js +102 -0
  64. package/dist/src/core/observations.js +87 -0
  65. package/dist/src/core/outcomes.js +164 -0
  66. package/dist/src/core/package.js +225 -0
  67. package/dist/src/core/paths.js +214 -0
  68. package/dist/src/core/portable.js +130 -0
  69. package/dist/src/core/private-discovery.js +45 -0
  70. package/dist/src/core/profiles.js +255 -0
  71. package/dist/src/core/provenance.js +278 -0
  72. package/dist/src/core/ranking.js +104 -0
  73. package/dist/src/core/recommend.js +181 -0
  74. package/dist/src/core/registry-api.js +97 -0
  75. package/dist/src/core/registry.js +316 -0
  76. package/dist/src/core/release-claims.js +175 -0
  77. package/dist/src/core/remove.js +122 -0
  78. package/dist/src/core/review-queue.js +200 -0
  79. package/dist/src/core/runtime-tool-recipe.js +315 -0
  80. package/dist/src/core/runtime-tools.js +453 -0
  81. package/dist/src/core/safety.js +234 -0
  82. package/dist/src/core/sandbox.js +78 -0
  83. package/dist/src/core/scheduler.js +264 -0
  84. package/dist/src/core/share-report.js +85 -0
  85. package/dist/src/core/signing.js +115 -0
  86. package/dist/src/core/skill-compare.js +239 -0
  87. package/dist/src/core/skill-inventory.js +193 -0
  88. package/dist/src/core/skill-security.js +340 -0
  89. package/dist/src/core/skills-sh-discovery.js +336 -0
  90. package/dist/src/core/skills.js +208 -0
  91. package/dist/src/core/snapshot.js +210 -0
  92. package/dist/src/core/source.js +305 -0
  93. package/dist/src/core/state.js +300 -0
  94. package/dist/src/core/sync.js +348 -0
  95. package/dist/src/core/terminal.js +53 -0
  96. package/dist/src/core/transaction.js +211 -0
  97. package/dist/src/core/update-watch.js +39 -0
  98. package/dist/src/core/update.js +216 -0
  99. package/dist/src/core/upgrade.js +207 -0
  100. package/dist/src/dashboard.js +418 -0
  101. package/dist/src/shared/schemas.js +336 -0
  102. package/dist/src/shared/types.js +1 -0
  103. package/docs/ACTIVE_SET.md +53 -0
  104. package/docs/ACTIVE_SET_POLICY.md +45 -0
  105. package/docs/CANDIDATE_INTELLIGENCE.md +139 -0
  106. package/docs/CATALOG.md +78 -0
  107. package/docs/CATALOG_POLICY.md +41 -0
  108. package/docs/COMMUNITY_DISCOVERY.md +14 -0
  109. package/docs/COMPATIBILITY_POLICY.md +22 -0
  110. package/docs/CONVERSION_AND_SANDBOX.md +27 -0
  111. package/docs/CREDENTIAL_AND_UPDATE_POLICY.md +31 -0
  112. package/docs/DISCOVERED.md +280 -0
  113. package/docs/EVALUATION_PROTOCOL.md +40 -0
  114. package/docs/EVALUATION_PROTOCOL_V1.md +300 -0
  115. package/docs/FEATURE_TEST_MATRIX.md +802 -0
  116. package/docs/GITHUB_AUTHORIZATION.md +38 -0
  117. package/docs/HEAD_TO_HEAD_EVALUATION.md +79 -0
  118. package/docs/PROVENANCE_AND_COMPARISON.md +72 -0
  119. package/docs/PROVIDER_CONFIGURATION.md +45 -0
  120. package/docs/RELEASE_REVIEW.md +117 -0
  121. package/docs/SAFE_UPDATE_DEMO.md +25 -0
  122. package/docs/SCHEMA_DECISIONS.md +25 -0
  123. package/docs/TEAM_POLICY.md +18 -0
  124. package/docs/TESTING.md +190 -0
  125. package/package.json +82 -0
@@ -0,0 +1,300 @@
1
+ # Loadout evaluation protocol v1
2
+
3
+ Status: engineering foundation. Protocol identifier: `loadout-evaluation-v1`.
4
+
5
+ This protocol defines how Loadout may plan a paired baseline-versus-candidate
6
+ benchmark without turning a single model run into a universal ranking. The current
7
+ implementation validates metadata, derives a deterministic schedule, previews the
8
+ worst-case budget, and validates resumable run records. It does **not** send model
9
+ requests, resolve credentials, store prompts or outputs, execute candidate content, or
10
+ promote a package.
11
+
12
+ The machine contract lives in `src/core/benchmark-campaign.ts`. The existing
13
+ head-to-head harness remains the deterministic scoring and signed-evidence boundary;
14
+ provider execution, if it is added later, must remain a separate explicitly approved
15
+ adapter.
16
+
17
+ The module also exposes deterministic campaign and schedule hashes plus structured
18
+ and plain-text campaign summaries. These helpers are content-free integration points
19
+ for a future CLI: they validate and describe a plan but cannot authorize or execute it.
20
+
21
+ ## 1. Safety and authority boundaries
22
+
23
+ The protocol separates five authorities:
24
+
25
+ 1. **Campaign author:** selects immutable synthetic fixtures, two reviewed candidate
26
+ instruction references, a declared provider/model version, sampling controls, and
27
+ hard ceilings.
28
+ 2. **Budget reviewer:** verifies the deterministic worst-case preview before any
29
+ provider adapter is authorized.
30
+ 3. **Runner:** may later execute only the approved schedule. The v1 foundation has no
31
+ runner and therefore cannot spend money.
32
+ 4. **Evidence signer:** signs deterministic scored evidence after completeness,
33
+ integrity, and privacy verification.
34
+ 5. **Human promoter:** may approve a category-scoped catalog or active-set change.
35
+ Signed evidence alone never installs, enables, updates, removes, or promotes.
36
+
37
+ No one authority silently implies the next. In particular, campaign validation is not
38
+ execution approval, execution is not evidence signing, and signing is not promotion.
39
+
40
+ ## 2. Paired methodology
41
+
42
+ Every campaign contains exactly two immutable references:
43
+
44
+ - `baseline`: the current reviewed package/skill being compared;
45
+ - `candidate`: the reviewed alternative being evaluated.
46
+
47
+ Each reference contains only a candidate id, package id, portable skill path, full
48
+ 40-character reviewed Git commit, and instruction SHA-256. Instruction text and
49
+ repository files are not embedded in campaign or run state.
50
+
51
+ A trial pair sends the same synthetic fixture, rubric version, model version, sampling
52
+ settings, token ceilings, timeout, isolation policy, and tool policy to both roles.
53
+ There must be at least five pairs. A pair is the unit of comparison: unpaired successes
54
+ cannot be used to manufacture a preferred result.
55
+
56
+ The campaign identifies both the fixture and rubric by SHA-256. Changing a seeded
57
+ defect, hidden constraint, rubric weight, or fixture byte requires a new hash and thus
58
+ a different campaign hash.
59
+
60
+ ## 3. Randomization and blinding
61
+
62
+ The only v1 strategy is `paired-balanced-sha256-v1`:
63
+
64
+ 1. Hash the public 64-hex seed, campaign id, and zero-based pair index.
65
+ 2. Use the first digest byte to choose baseline-first or candidate-first for that pair.
66
+ 3. Derive each request id from the complete canonical campaign hash, pair index, and
67
+ role.
68
+ 4. Conceal role labels from any grader. `concealCandidateLabels` must be `true`.
69
+
70
+ The strategy removes author discretion from request order and makes the schedule
71
+ reproducible. The seed is public reproducibility metadata, not a secret. Reusing a seed
72
+ with changed campaign content still produces different request ids because the full
73
+ campaign hash is included.
74
+
75
+ Order randomization does not remove every source of model variance. Results must still
76
+ report model version, sampling parameters, failures, retries, and uncertainty.
77
+
78
+ ## 4. Isolation
79
+
80
+ Every v1 campaign is structurally fixed to:
81
+
82
+ - `toolPolicy: none`;
83
+ - `networkPolicy: disabled`;
84
+ - `candidatePolicy: instructions-as-data`;
85
+ - `fixturePolicy: synthetic-only`.
86
+
87
+ Candidate repositories, scripts, hooks, binaries, lifecycle commands, MCP servers,
88
+ plugins, tools, and network instructions are never run by the benchmark foundation.
89
+ The model, if a future approved runner is added, receives only a separately reviewed
90
+ synthetic fixture and static candidate instructions. It receives no real project,
91
+ home directory, credential, shell, browser, repository checkout, or agent profile.
92
+
93
+ Relaxing one of these policies requires a new protocol version, threat model, and
94
+ review. It cannot be expressed as an optional v1 field.
95
+
96
+ ## 5. Provider neutrality
97
+
98
+ Campaigns name a provider id, model id, and immutable or release-specific model
99
+ version. They do not contain:
100
+
101
+ - an endpoint or arbitrary URL;
102
+ - a credential value or credential reference;
103
+ - request headers;
104
+ - provider-specific request bodies;
105
+ - prompts, messages, or model outputs; or
106
+ - a client or execution callback.
107
+
108
+ Strict unknown-field rejection prevents these values from being smuggled into the v1
109
+ schema. Provider/model metadata is descriptive. A future provider adapter must map it
110
+ to a separately approved credential reference at execution time without writing that
111
+ reference or its resolved value into campaign, run, logs, errors, or evidence.
112
+
113
+ ## 6. Deterministic budget preview
114
+
115
+ Campaigns declare:
116
+
117
+ - pairs and maximum retries per request;
118
+ - per-attempt input and output token caps;
119
+ - request, total input-token, total output-token, and USD ceilings; and
120
+ - declared input/output USD rates per million tokens.
121
+
122
+ The preview uses worst-case arithmetic:
123
+
124
+ ```text
125
+ scheduled requests = pairs * 2
126
+ worst-case requests = scheduled requests * (1 + retries per request)
127
+ worst-case input = worst-case requests * input cap per request
128
+ worst-case output = worst-case requests * output cap per request
129
+ worst-case cost = input/1M * input rate + output/1M * output rate
130
+ ```
131
+
132
+ Cost is rounded to six decimal places after the complete calculation. The preview
133
+ reports every exceeded ceiling rather than stopping at the first. It performs no
134
+ request and does not claim that declared pricing is current; the campaign author must
135
+ obtain and review the provider's applicable rate. A campaign whose preview is over
136
+ budget is valid metadata but is not execution-ready.
137
+
138
+ Retry ceilings are included in the preview even if the first attempt is expected to
139
+ succeed. A runner may never treat an optimistic average as an authorization limit.
140
+
141
+ ## 7. Campaign schema
142
+
143
+ The top-level campaign fields are:
144
+
145
+ | Field | Purpose |
146
+ | ------------------------------------- | ------------------------------------------------------------------------ |
147
+ | `schemaVersion` | Integer `1`. |
148
+ | `protocolVersion` | Exact string `loadout-evaluation-v1`. |
149
+ | `campaignId`, `createdAt`, `category` | Stable identity, canonical UTC timestamp, and category scope. |
150
+ | `fixture` | Fixture id/version plus fixture and rubric SHA-256. |
151
+ | `candidates` | Exactly one baseline and one candidate immutable reference. |
152
+ | `model`, `sampling` | Provider-neutral model identity and fixed sampling/token controls. |
153
+ | `trials`, `randomization` | Pair/retry/timeout ceilings and reproducible blinded ordering. |
154
+ | `isolation` | Fixed no-tool, no-network, static-data, synthetic-fixture boundary. |
155
+ | `budget` | Hard request/token/USD limits and declared pricing inputs. |
156
+ | `decision` | Minimum successful pairs, practical delta, and human promotion boundary. |
157
+
158
+ All objects reject unknown and missing fields. Identifiers and portable paths are
159
+ bounded. Hashes and commits must be lowercase full-length values. Numbers must be
160
+ finite; counts are bounded integers. Timestamps must equal their canonical ISO-8601
161
+ UTC representation.
162
+
163
+ The minimum practical score delta is category-specific evidence policy. It is not a
164
+ promise that a candidate is globally better. `minimumSuccessfulPairs` must be at least
165
+ five and cannot exceed planned pairs.
166
+
167
+ ## 8. Run schema and resumability
168
+
169
+ A run is metadata tied to one exact campaign and schedule. It contains:
170
+
171
+ - run and campaign ids;
172
+ - canonical campaign and deterministic schedule SHA-256;
173
+ - canonical creation/update timestamps and lifecycle status;
174
+ - terminal completion records keyed by deterministic request id;
175
+ - uncertainty and safety-boundary statements.
176
+
177
+ Completion records contain only:
178
+
179
+ - terminal `succeeded` or retry-exhausted status;
180
+ - attempts used;
181
+ - aggregate input/output tokens, duration, and reported cost;
182
+ - output SHA-256 for success; or
183
+ - a bounded failure code for exhausted attempts.
184
+
185
+ Raw inputs and outputs are excluded. A success hash can later bind a separately
186
+ protected observation artifact without putting its text in resumable state.
187
+
188
+ The parser recomputes campaign and schedule hashes, rejects unknown request ids and
189
+ duplicates, validates per-attempt token ceilings, enforces retry exhaustion, and
190
+ checks aggregate request/token/cost ceilings. A `planned` run must have no completed
191
+ requests. A `completed` run must account for every scheduled request.
192
+
193
+ `pendingBenchmarkRequests` recomputes the schedule and subtracts terminal request ids.
194
+ It never trusts a caller-provided “next index.” This permits a paused process to resume
195
+ without duplicating completed work or changing order. Completed and cancelled runs
196
+ have no resumable requests.
197
+
198
+ Run records should be written atomically by a future runner. Concurrent runners must
199
+ use an exclusive campaign/run lock; this foundation deliberately provides no runner
200
+ or persistence function.
201
+
202
+ ## 9. Deterministic verification and tamper response
203
+
204
+ Before any resume, scoring, or signing step:
205
+
206
+ 1. Strictly parse the campaign.
207
+ 2. Recompute its canonical SHA-256.
208
+ 3. Recompute the complete request schedule and schedule SHA-256.
209
+ 4. Strictly parse the run against that campaign.
210
+ 5. Recompute remaining request ids rather than trusting progress counters.
211
+ 6. Confirm recorded usage is within both per-attempt and campaign ceilings.
212
+ 7. Confirm successful outputs are referenced only by SHA-256.
213
+
214
+ Any changed candidate commit, instruction hash, fixture, rubric, model version,
215
+ sampling control, seed, isolation policy, pricing input, or budget changes the campaign
216
+ hash and invalidates the run. Any changed request id or schedule hash is rejected.
217
+ Duplicate terminal records and early “exhausted” records are rejected.
218
+
219
+ The run schema is not itself signed evidence. After observations have been scored by a
220
+ deterministic harness, the complete evidence envelope must be signed with the existing
221
+ Ed25519 mechanism. Signature verification must cover scores, category, fixture/rubric
222
+ hashes, candidate hashes, model metadata, usage, failures, uncertainty, and audit
223
+ status. Tampering invalidates the envelope rather than being repaired silently.
224
+
225
+ ## 10. Privacy and data minimization
226
+
227
+ Campaign and run JSON may be shareable only because the schema excludes content.
228
+ They must never contain:
229
+
230
+ - prompts, conversations, model outputs, rationales, or user queries;
231
+ - project paths, project source, repository contents, or real diffs;
232
+ - usernames, home directories, organization metadata, or telemetry identifiers;
233
+ - credential values, credential references, endpoints, or headers; or
234
+ - unredacted provider errors.
235
+
236
+ Fixtures must be synthetic and reviewed for secrets before hashing. Candidate
237
+ instructions are referred to by immutable commit/path/hash and remain data. If a
238
+ future execution adapter needs transient prompt construction, it must happen in
239
+ memory, under an explicit budget approval, and outside serialized campaign/run state.
240
+
241
+ Failure codes must be categorical (for example `timeout` or `provider-unavailable`),
242
+ not copied provider error bodies. Output hashes are not a license to retain sensitive
243
+ raw output indefinitely; retention needs a separate policy.
244
+
245
+ ## 11. Uncertainty and reporting
246
+
247
+ At minimum, final evidence must disclose:
248
+
249
+ - synthetic-fixture scope;
250
+ - exact successful and failed pair counts;
251
+ - model/provider/version and sampling controls;
252
+ - retries, durations, input/output tokens, and reported cost;
253
+ - category-specific mean, median, variance, and confidence interval;
254
+ - blocking safety failures;
255
+ - minimum practical delta; and
256
+ - whether a human audited the evidence.
257
+
258
+ Fewer than the declared minimum successful pairs is `insufficient-evidence`. A safety
259
+ failure blocks preference regardless of average score. An interval that does not clear
260
+ the practical delta is a tie or mixed result. One fixture, category, model, judge,
261
+ campaign, or campaign author cannot establish universal superiority.
262
+
263
+ Provider non-determinism is never hidden behind deterministic scheduling. Reproducible
264
+ metadata makes differences inspectable; it does not make stochastic outputs identical.
265
+
266
+ ## 12. Promotion boundary
267
+
268
+ The only v1 promotion policy is
269
+ `signed-evidence-plus-human-approval`. Promotion requires all of:
270
+
271
+ 1. complete paired evidence meeting minimum successful-pair rules;
272
+ 2. no blocking safety failure;
273
+ 3. a practical delta supported by the declared uncertainty analysis;
274
+ 4. a valid trusted signature over the evidence;
275
+ 5. a human review of usefulness, permissions, compatibility, cost, and limitations;
276
+ 6. a normal Loadout preview and rollback checkpoint; and
277
+ 7. explicit approval for the exact category-scoped change.
278
+
279
+ Even then, the valid statement is “preferred for this declared category, fixture set,
280
+ model version, and policy.” The protocol never supports “best skill,” “best agent,” or
281
+ automatic global replacement.
282
+
283
+ ## 13. What is intentionally not implemented
284
+
285
+ The v1 foundation does not include:
286
+
287
+ - a CLI command;
288
+ - provider SDK integration;
289
+ - credential or environment resolution;
290
+ - prompt construction or prompt persistence;
291
+ - a model judge;
292
+ - candidate/tool/script execution;
293
+ - raw observation storage;
294
+ - background or scheduled evaluation;
295
+ - automatic retry execution;
296
+ - evidence promotion; or
297
+ - catalog/active-set mutation.
298
+
299
+ Those omissions are safety properties, not missing implicit behavior. Each future
300
+ layer needs its own explicit plan, tests, authorization boundary, and budget review.