rightmodeler 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.
@@ -0,0 +1,503 @@
1
+ # Commands
2
+
3
+ This file is generated from the CLI definitions. Run `pnpm docs:generate` after changing a command.
4
+
5
+ See [Getting started](getting-started.md) for the shortest complete workflow and [Exit codes](exit-codes.md) for automation behavior.
6
+
7
+ ## `rightmodeler`
8
+
9
+ ```text
10
+ Usage: rightmodeler [options] [command]
11
+
12
+ Find and prove safe model substitutions.
13
+
14
+ Options:
15
+ -V, --version output the version number
16
+ --repo <dir> repository to analyze (default:
17
+ ".")
18
+ --store <dir> store directory
19
+ --output <mode> output mode (choices: "human", "json", "jsonl", default:
20
+ "human")
21
+ -h, --help display help for command
22
+
23
+ Commands:
24
+ init [options] run the resumable Phase A pipeline
25
+ estimate [options] project replay spend before paid model calls
26
+ scan [options] run through the scan stage
27
+ ingest [options] run through the ingest stage
28
+ reconcile [options] run through the reconcile stage
29
+ scrub [options] run through the scrub stage
30
+ shortlist [options] run through the shortlist stage
31
+ replay [options] run through the replay stage
32
+ aggregate [options] run through the aggregate stage
33
+ confirm [options] run through the confirm stage
34
+ corpus [options] build or import the replay corpus
35
+ export [options] export trials and verdicts to an evaluation provider
36
+ audit manage the reference audit
37
+ apply [options] open a draft pull request for proven model swaps
38
+ rollback [options] open a draft pull request restoring a prior model swap
39
+ drift [options] detect drift against the active replay corpus
40
+ watch [options] reconcile one open model-swap pull request
41
+ report write report.md and report.json
42
+ status [options] summarize the current store
43
+ help [command] display help for command
44
+ ```
45
+
46
+ ## `rightmodeler init`
47
+
48
+ ```text
49
+ Usage: rightmodeler init [options]
50
+
51
+ run the resumable Phase A pipeline
52
+
53
+ Options:
54
+ --traces <path> trace input file
55
+ --include-free include zero-priced models in candidate
56
+ shortlists
57
+ --modeb-config <path> versioned Mode B runtime configuration
58
+ JSON file
59
+ --base-url <url> OpenAI-compatible provider base URL
60
+ --api-key-env <name> environment variable containing the
61
+ provider API key
62
+ --max-cost-usd <amount> optional hard spend cap in USD; omit to
63
+ run uncapped so every case and judge cell
64
+ completes
65
+ --evaluator <provider> external evaluator provider (choices:
66
+ "braintrust", "langfuse", "langsmith",
67
+ "promptfoo")
68
+ --evaluator-base-url <url> external evaluator API base URL
69
+ --evaluator-api-key-env <name> environment variable containing the
70
+ evaluator API key
71
+ --evaluator-public-key-env <name> environment variable containing the
72
+ Langfuse public key
73
+ --evaluator-project-id <id> Braintrust project or LangSmith dataset
74
+ identifier
75
+ --evaluator-command <path> promptfoo executable path or command
76
+ --evaluator-config <path> promptfoo assertions configuration file
77
+ --evaluator-scorer <name> external evaluator scorer name
78
+ (repeatable)
79
+ --evaluator-gate-metric <name> scorer metric used for release gates
80
+ --evaluator-gate-threshold <value> fallback pass threshold when the evaluator
81
+ omits a pass decision
82
+ --plan print stage states without executing
83
+ --through <stage> stop after this stage (choices: "scan",
84
+ "ingest", "reconcile", "scrub", "corpus",
85
+ "audit-sample", "shortlist", "replay",
86
+ "aggregate", "confirm", "report")
87
+ --yes accept defaults (reserved for future
88
+ prompts)
89
+ -h, --help display help for command
90
+ ```
91
+
92
+ ## `rightmodeler estimate`
93
+
94
+ ```text
95
+ Usage: rightmodeler estimate [options]
96
+
97
+ project replay spend before paid model calls
98
+
99
+ Options:
100
+ --traces <path> trace input file
101
+ --include-free include zero-priced models in candidate
102
+ shortlists
103
+ --modeb-config <path> versioned Mode B runtime configuration
104
+ JSON file
105
+ --base-url <url> OpenAI-compatible provider base URL
106
+ --api-key-env <name> environment variable containing the
107
+ provider API key
108
+ --max-cost-usd <amount> optional hard spend cap in USD; omit to
109
+ run uncapped so every case and judge cell
110
+ completes
111
+ --evaluator <provider> external evaluator provider (choices:
112
+ "braintrust", "langfuse", "langsmith",
113
+ "promptfoo")
114
+ --evaluator-base-url <url> external evaluator API base URL
115
+ --evaluator-api-key-env <name> environment variable containing the
116
+ evaluator API key
117
+ --evaluator-public-key-env <name> environment variable containing the
118
+ Langfuse public key
119
+ --evaluator-project-id <id> Braintrust project or LangSmith dataset
120
+ identifier
121
+ --evaluator-command <path> promptfoo executable path or command
122
+ --evaluator-config <path> promptfoo assertions configuration file
123
+ --evaluator-scorer <name> external evaluator scorer name
124
+ (repeatable)
125
+ --evaluator-gate-metric <name> scorer metric used for release gates
126
+ --evaluator-gate-threshold <value> fallback pass threshold when the evaluator
127
+ omits a pass decision
128
+ --approved-run <digest> scope projection to one merged approved
129
+ swap
130
+ -h, --help display help for command
131
+ ```
132
+
133
+ ## `rightmodeler scan`
134
+
135
+ ```text
136
+ Usage: rightmodeler scan [options]
137
+
138
+ run through the scan stage
139
+
140
+ Options:
141
+ --traces <path> trace input file
142
+ --include-free include zero-priced models in candidate shortlists
143
+ --modeb-config <path> versioned Mode B runtime configuration JSON file
144
+ -h, --help display help for command
145
+ ```
146
+
147
+ ## `rightmodeler ingest`
148
+
149
+ ```text
150
+ Usage: rightmodeler ingest [options]
151
+
152
+ run through the ingest stage
153
+
154
+ Options:
155
+ --traces <path> trace input file
156
+ --include-free include zero-priced models in candidate shortlists
157
+ --modeb-config <path> versioned Mode B runtime configuration JSON file
158
+ -h, --help display help for command
159
+ ```
160
+
161
+ ## `rightmodeler reconcile`
162
+
163
+ ```text
164
+ Usage: rightmodeler reconcile [options]
165
+
166
+ run through the reconcile stage
167
+
168
+ Options:
169
+ --traces <path> trace input file
170
+ --include-free include zero-priced models in candidate shortlists
171
+ --modeb-config <path> versioned Mode B runtime configuration JSON file
172
+ -h, --help display help for command
173
+ ```
174
+
175
+ ## `rightmodeler scrub`
176
+
177
+ ```text
178
+ Usage: rightmodeler scrub [options]
179
+
180
+ run through the scrub stage
181
+
182
+ Options:
183
+ --traces <path> trace input file
184
+ --include-free include zero-priced models in candidate shortlists
185
+ --modeb-config <path> versioned Mode B runtime configuration JSON file
186
+ -h, --help display help for command
187
+ ```
188
+
189
+ ## `rightmodeler shortlist`
190
+
191
+ ```text
192
+ Usage: rightmodeler shortlist [options]
193
+
194
+ run through the shortlist stage
195
+
196
+ Options:
197
+ --traces <path> trace input file
198
+ --include-free include zero-priced models in candidate shortlists
199
+ --modeb-config <path> versioned Mode B runtime configuration JSON file
200
+ -h, --help display help for command
201
+ ```
202
+
203
+ ## `rightmodeler replay`
204
+
205
+ ```text
206
+ Usage: rightmodeler replay [options]
207
+
208
+ run through the replay stage
209
+
210
+ Options:
211
+ --traces <path> trace input file
212
+ --include-free include zero-priced models in candidate
213
+ shortlists
214
+ --modeb-config <path> versioned Mode B runtime configuration
215
+ JSON file
216
+ --base-url <url> OpenAI-compatible provider base URL
217
+ --api-key-env <name> environment variable containing the
218
+ provider API key
219
+ --max-cost-usd <amount> optional hard spend cap in USD; omit to
220
+ run uncapped so every case and judge cell
221
+ completes
222
+ --evaluator <provider> external evaluator provider (choices:
223
+ "braintrust", "langfuse", "langsmith",
224
+ "promptfoo")
225
+ --evaluator-base-url <url> external evaluator API base URL
226
+ --evaluator-api-key-env <name> environment variable containing the
227
+ evaluator API key
228
+ --evaluator-public-key-env <name> environment variable containing the
229
+ Langfuse public key
230
+ --evaluator-project-id <id> Braintrust project or LangSmith dataset
231
+ identifier
232
+ --evaluator-command <path> promptfoo executable path or command
233
+ --evaluator-config <path> promptfoo assertions configuration file
234
+ --evaluator-scorer <name> external evaluator scorer name
235
+ (repeatable)
236
+ --evaluator-gate-metric <name> scorer metric used for release gates
237
+ --evaluator-gate-threshold <value> fallback pass threshold when the evaluator
238
+ omits a pass decision
239
+ --detach enqueue replay and return its run
240
+ identifier
241
+ --approved-run <digest> regression-test one merged approved swap
242
+ -h, --help display help for command
243
+ ```
244
+
245
+ ## `rightmodeler aggregate`
246
+
247
+ ```text
248
+ Usage: rightmodeler aggregate [options]
249
+
250
+ run through the aggregate stage
251
+
252
+ Options:
253
+ --traces <path> trace input file
254
+ --include-free include zero-priced models in candidate shortlists
255
+ --modeb-config <path> versioned Mode B runtime configuration JSON file
256
+ -h, --help display help for command
257
+ ```
258
+
259
+ ## `rightmodeler confirm`
260
+
261
+ ```text
262
+ Usage: rightmodeler confirm [options]
263
+
264
+ run through the confirm stage
265
+
266
+ Options:
267
+ --traces <path> trace input file
268
+ --include-free include zero-priced models in candidate
269
+ shortlists
270
+ --modeb-config <path> versioned Mode B runtime configuration
271
+ JSON file
272
+ --base-url <url> OpenAI-compatible provider base URL
273
+ --api-key-env <name> environment variable containing the
274
+ provider API key
275
+ --max-cost-usd <amount> optional hard spend cap in USD; omit to
276
+ run uncapped so every case and judge cell
277
+ completes
278
+ --evaluator <provider> external evaluator provider (choices:
279
+ "braintrust", "langfuse", "langsmith",
280
+ "promptfoo")
281
+ --evaluator-base-url <url> external evaluator API base URL
282
+ --evaluator-api-key-env <name> environment variable containing the
283
+ evaluator API key
284
+ --evaluator-public-key-env <name> environment variable containing the
285
+ Langfuse public key
286
+ --evaluator-project-id <id> Braintrust project or LangSmith dataset
287
+ identifier
288
+ --evaluator-command <path> promptfoo executable path or command
289
+ --evaluator-config <path> promptfoo assertions configuration file
290
+ --evaluator-scorer <name> external evaluator scorer name
291
+ (repeatable)
292
+ --evaluator-gate-metric <name> scorer metric used for release gates
293
+ --evaluator-gate-threshold <value> fallback pass threshold when the evaluator
294
+ omits a pass decision
295
+ -h, --help display help for command
296
+ ```
297
+
298
+ ## `rightmodeler corpus`
299
+
300
+ ```text
301
+ Usage: rightmodeler corpus [options] [command]
302
+
303
+ build or import the replay corpus
304
+
305
+ Options:
306
+ --traces <path> trace input file
307
+ --include-free include zero-priced models in candidate shortlists
308
+ --modeb-config <path> versioned Mode B runtime configuration JSON file
309
+ -h, --help display help for command
310
+
311
+ Commands:
312
+ import [options] import a curated provider dataset
313
+ ```
314
+
315
+ ## `rightmodeler corpus import`
316
+
317
+ ```text
318
+ Usage: rightmodeler corpus import [options]
319
+
320
+ import a curated provider dataset
321
+
322
+ Options:
323
+ --from <provider:dataset> provider and dataset
324
+ --base-url <url> dataset provider API base URL
325
+ --api-key-env <name> environment variable containing the dataset
326
+ provider API key
327
+ --public-key-env <name> environment variable containing the Langfuse public
328
+ key
329
+ -h, --help display help for command
330
+ ```
331
+
332
+ ## `rightmodeler export`
333
+
334
+ ```text
335
+ Usage: rightmodeler export [options]
336
+
337
+ export trials and verdicts to an evaluation provider
338
+
339
+ Options:
340
+ --to <provider> result sink provider (choices: "braintrust",
341
+ "langfuse")
342
+ --base-url <url> result sink API base URL
343
+ --api-key-env <name> environment variable containing the result sink API
344
+ key
345
+ --public-key-env <name> environment variable containing the Langfuse public
346
+ key
347
+ --project-id <id> Braintrust project identifier
348
+ --dataset-id <id> Langfuse dataset identifier
349
+ -h, --help display help for command
350
+ ```
351
+
352
+ ## `rightmodeler audit`
353
+
354
+ ```text
355
+ Usage: rightmodeler audit [options] [command]
356
+
357
+ manage the reference audit
358
+
359
+ Options:
360
+ -h, --help display help for command
361
+
362
+ Commands:
363
+ sample [options] write the audit worksheet without blocking
364
+ tabulate [options] tabulate a completed audit worksheet
365
+ help [command] display help for command
366
+ ```
367
+
368
+ ## `rightmodeler audit sample`
369
+
370
+ ```text
371
+ Usage: rightmodeler audit sample [options]
372
+
373
+ write the audit worksheet without blocking
374
+
375
+ Options:
376
+ --traces <path> trace input file
377
+ --include-free include zero-priced models in candidate shortlists
378
+ --modeb-config <path> versioned Mode B runtime configuration JSON file
379
+ -h, --help display help for command
380
+ ```
381
+
382
+ ## `rightmodeler audit tabulate`
383
+
384
+ ```text
385
+ Usage: rightmodeler audit tabulate [options]
386
+
387
+ tabulate a completed audit worksheet
388
+
389
+ Options:
390
+ --worksheet <path> completed worksheet JSON file
391
+ -h, --help display help for command
392
+ ```
393
+
394
+ ## `rightmodeler apply`
395
+
396
+ ```text
397
+ Usage: rightmodeler apply [options]
398
+
399
+ open a draft pull request for proven model swaps
400
+
401
+ Options:
402
+ --owner <owner> GitHub repository owner
403
+ --github-base-url <url> GitHub API base URL
404
+ --github-token-env <name> environment variable containing the GitHub token
405
+ --dry-run run all machine gates without writing GitHub state
406
+ -h, --help display help for command
407
+ ```
408
+
409
+ ## `rightmodeler rollback`
410
+
411
+ ```text
412
+ Usage: rightmodeler rollback [options]
413
+
414
+ open a draft pull request restoring a prior model swap
415
+
416
+ Options:
417
+ --owner <owner> GitHub repository owner
418
+ --pr <number> merged pull request number
419
+ --github-base-url <url> GitHub API base URL
420
+ --github-token-env <name> environment variable containing the GitHub token
421
+ -h, --help display help for command
422
+ ```
423
+
424
+ ## `rightmodeler drift`
425
+
426
+ ```text
427
+ Usage: rightmodeler drift [options] [command]
428
+
429
+ detect drift against the active replay corpus
430
+
431
+ Options:
432
+ --traces <path> new trace batch
433
+ -h, --help display help for command
434
+
435
+ Commands:
436
+ approve [options] approve a stored corpus drift proposal
437
+ publish [options] publish an approved corpus drift proposal
438
+ ```
439
+
440
+ ## `rightmodeler drift approve`
441
+
442
+ ```text
443
+ Usage: rightmodeler drift approve [options]
444
+
445
+ approve a stored corpus drift proposal
446
+
447
+ Options:
448
+ --proposal <id> drift proposal SHA-256 identifier
449
+ --actor <name> approving actor
450
+ --reason <text> approval reason
451
+ -h, --help display help for command
452
+ ```
453
+
454
+ ## `rightmodeler drift publish`
455
+
456
+ ```text
457
+ Usage: rightmodeler drift publish [options]
458
+
459
+ publish an approved corpus drift proposal
460
+
461
+ Options:
462
+ --proposal <id> drift proposal SHA-256 identifier
463
+ -h, --help display help for command
464
+ ```
465
+
466
+ ## `rightmodeler watch`
467
+
468
+ ```text
469
+ Usage: rightmodeler watch [options]
470
+
471
+ reconcile one open model-swap pull request
472
+
473
+ Options:
474
+ --owner <owner> GitHub repository owner
475
+ --github-repo <repo> GitHub repository name
476
+ --pr <number> pull request number
477
+ --github-base-url <url> GitHub API base URL
478
+ --github-token-env <name> environment variable containing the GitHub token
479
+ -h, --help display help for command
480
+ ```
481
+
482
+ ## `rightmodeler report`
483
+
484
+ ```text
485
+ Usage: rightmodeler report [options]
486
+
487
+ write report.md and report.json
488
+
489
+ Options:
490
+ -h, --help display help for command
491
+ ```
492
+
493
+ ## `rightmodeler status`
494
+
495
+ ```text
496
+ Usage: rightmodeler status [options]
497
+
498
+ summarize the current store
499
+
500
+ Options:
501
+ --run <runId> report one detached replay run
502
+ -h, --help display help for command
503
+ ```
@@ -0,0 +1,16 @@
1
+ # Evaluators
2
+
3
+ The default evaluator is the built-in judge selected from the configured provider catalog. Candidate and reference families are excluded when choosing the judge.
4
+
5
+ An external evaluator can be requested with `--evaluator braintrust`. Configure it with:
6
+
7
+ - `--evaluator-project-id <id>` (required)
8
+ - one or more `--evaluator-scorer <name>` options (required)
9
+ - `--evaluator-api-key-env <name>` (defaults to `BRAINTRUST_API_KEY`)
10
+ - `--evaluator-base-url <url>` (defaults to the provider API)
11
+ - `--evaluator-gate-metric <name>` when more than one scorer is configured
12
+ - `--evaluator-gate-threshold <value>` when the evaluator does not return a pass decision
13
+
14
+ The gate metric must name one of the configured scorers. If the external evaluator is unavailable, the pipeline warns and uses the built-in judge. If a reachable evaluator run fails or omits required case results, the pipeline records the missing assessments instead of fabricating scores.
15
+
16
+ See [Commands](commands.md) for the complete option text and [Getting started](getting-started.md) for provider setup.
@@ -0,0 +1,26 @@
1
+ # Exit codes
2
+
3
+ Rightmodeler reserves exit codes `0` through `3` for machine-readable outcomes. Runtime and command-line failures use `10` or greater.
4
+
5
+ ## Pipeline commands
6
+
7
+ - `0`: the command completed and no recommendation is being reported. Planning and partial `--through` runs also return `0` when successful.
8
+ - `1`: a complete `init` or `report` found an actionable recommendation.
9
+ - `2`: the run needs input at a resumable boundary, such as missing traces, provider configuration, or required confirmation configuration.
10
+ - `3`: the cost budget was reached at a resumable boundary.
11
+ - `10` or greater: command-line or runtime failure.
12
+
13
+ ## Apply
14
+
15
+ - `0`: changes were applied, or a dry run was clean.
16
+ - `1`: the change was refused by a machine gate.
17
+ - `10` or greater: runtime failure.
18
+
19
+ ## Watch
20
+
21
+ - `0`: no action was required.
22
+ - `1`: review or continuous-integration actions were taken.
23
+ - `2`: another watcher holds the lock.
24
+ - `10` or greater: runtime failure.
25
+
26
+ Use `--output json` for one result object or `--output jsonl` for stage events followed by the result. Errors use the selected machine-readable mode on standard error. See [Commands](commands.md) for command-specific options.
@@ -0,0 +1,33 @@
1
+ # Getting started
2
+
3
+ Rightmodeler analyzes recorded model calls, replays them against cheaper candidates, evaluates the outputs, and writes a recommendation report. The intended public package name is `rightmodeler`.
4
+
5
+ ## Requirements
6
+
7
+ - Node.js 24 or newer.
8
+ - A Git repository to analyze.
9
+ - Trace input in a supported format.
10
+ - An OpenAI-compatible provider base URL and the name of an environment variable containing its API key before replay begins.
11
+
12
+ ## Preview without changing the repository
13
+
14
+ ```sh
15
+ npx rightmodeler init --plan --output json --repo /path/to/repository
16
+ ```
17
+
18
+ ## Run through the free corpus stage
19
+
20
+ ```sh
21
+ npx rightmodeler init --through corpus --traces /path/to/traces.json --output json --repo /path/to/repository
22
+ ```
23
+
24
+ ## Run the complete pipeline
25
+
26
+ ```sh
27
+ export RIGHTMODELER_API_KEY="provider-key"
28
+ npx rightmodeler init --traces /path/to/traces.json --base-url https://provider.example/v1 --output json --repo /path/to/repository
29
+ ```
30
+
31
+ The default store is `.rightmodeler/` inside the analyzed repository. Completed stages resume when their inputs and outputs are still current. A complete run writes `.rightmodeler/project/reports/report.md` and `.rightmodeler/project/reports/report.json`.
32
+
33
+ Read the generated [command reference](commands.md), the [evaluator guide](evaluators.md), [Mode B configuration](modeb.md), and the [exit-code convention](exit-codes.md) before automating a full run.
package/docs/modeb.md ADDED
@@ -0,0 +1,31 @@
1
+ # Mode B configuration
2
+
3
+ Mode B runs confirmation cases inside a container when a recommendation can affect downstream model-authored steps. Pass a JSON file with `--modeb-config`.
4
+
5
+ ```json
6
+ {
7
+ "version": "1",
8
+ "image": "my-agent:latest",
9
+ "appSpec": {
10
+ "mountPath": ".",
11
+ "command": ["node", "/rightmodeler/app/driver.mjs", "{caseFile}"],
12
+ "installCommand": ["pnpm", "install", "--offline"]
13
+ },
14
+ "stepMap": {
15
+ "canonical-step-id": "runtime-step-header"
16
+ },
17
+ "confirmMaxRunSets": 20
18
+ }
19
+ ```
20
+
21
+ ## Contract
22
+
23
+ - `version` must be the string `"1"`.
24
+ - `image` is the non-empty container image name.
25
+ - `appSpec.mountPath` is resolved relative to the configuration file and mounted read-only at `/rightmodeler/app`.
26
+ - `appSpec.command` is a non-empty array of non-empty arguments. At least one argument must contain `{caseFile}`; the harness replaces every occurrence with the in-container case file path.
27
+ - `appSpec.installCommand` is optional. When present, it is a non-empty array of non-empty arguments run before the workload.
28
+ - `stepMap` maps at least one canonical scanner step ID to the runtime step header emitted by the application. Runtime headers must be unique.
29
+ - `confirmMaxRunSets` is optional and must be a non-negative integer.
30
+
31
+ See [Commands](commands.md) for where `--modeb-config` is accepted and [Exit codes](exit-codes.md) for blocked or failed runs.
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "rightmodeler",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "bin": {
6
+ "rightmodeler": "./dist-bundle/cli.js"
7
+ },
8
+ "exports": "./dist-bundle/cli.js",
9
+ "files": [
10
+ "dist-bundle",
11
+ "docs"
12
+ ],
13
+ "engines": {
14
+ "node": ">=24"
15
+ }
16
+ }