omnitrix 0.5.3 → 0.7.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.
package/README.md CHANGED
@@ -9,12 +9,22 @@ Claude plans the work, and your other AI accounts carry it out.
9
9
  <img alt="An example job, 'add rate limiting to the public API', split by Claude into six tasks in two rounds. First, Gemini reads the exported issues, Codex writes the middleware on its own git branch, Groq drafts the changelog and a local Ollama model checks the .env file for leaked keys. Then DeepSeek reviews the middleware diff, and the edge-case task moves to GLM because Kimi is rate limited. Claude checks each result and merges the accepted branch." src="assets/job-v3-light.svg" width="100%">
10
10
  </picture>
11
11
 
12
- I built omnitrix because I repeatedly ran out of Claude credits while the ChatGPT Plus and Gemini subscriptions that my friends and I pay for remained largely unused.
12
+ I built omnitrix because I repeatedly ran out of Claude credits while my ChatGPT Plus plan and my Gemini key remained largely unused.
13
13
 
14
14
  omnitrix is built for the frontier-model subscriptions and API keys you already pay for, and it runs inside your existing Claude Code session. Claude remains in charge: it divides the job into tasks and reviews the results. omnitrix sends each task to an account that suits the work and still has quota available. For example, it can use Codex on your ChatGPT plan for code edits, Gemini for reading very large logs, DeepSeek or Kimi for reasoning and review, or a local model for private work. It also supports any service that implements the OpenAI Chat Completions format or the Anthropic Messages format, through `custom-openai` and `custom-anthropic`.
15
15
 
16
16
  You can monitor the pool without leaving Claude Code. The status line shows up to four accounts with their remaining quota or status, and omnitrix instructs Claude to check the same data before it assigns work. Claude reads short results instead of performing every step itself, which uses less of your Claude usage limit.
17
17
 
18
+ ## A real run
19
+
20
+ The recording below replays one real run in Claude Code, with the waiting shown six times faster. Claude splits a request into three tasks. Codex writes the code on its own git branch, and omnitrix runs the project's tests on it. Gemini reviews a file and then checks the work Codex did. A local Ollama model drafts the changelog. Claude reviews each result before it merges the branch. The three workers used 137,597 tokens on their own accounts, while Claude read fewer than 3,000 characters of their results.
21
+
22
+ <img src="assets/demo.gif" width="100%" alt="A recorded run in Claude Code. The request is to add two coupon codes to a small shop project, review cart.js for bugs and draft a changelog entry. Claude sends three tasks to omnitrix: Codex on a ChatGPT Plus plan writes the coupon code in 56 seconds, Gemini reviews the cart in 9 seconds and a local Ollama model drafts the changelog in 10 seconds. Gemini then checks the code and reports PASS. The results show that the tests passed and that Gemini found a real bug on line 11, where removing a missing item deletes the last one. Claude accepts all three results, merges the branch, and the four tests pass.">
23
+
24
+ ## Who it is for
25
+
26
+ omnitrix suits you if you work in Claude Code, have other AI accounts that sit idle (a ChatGPT plan, free or paid API keys, local models), and want Claude to hand work to them and check the results instead of switching between tools yourself. It is a weaker fit if you prefer to drive several agents by hand in one window, which an app such as [T3 Code](https://github.com/pingdotgg/t3code) does well (omnitrix also works inside it, see [Inside T3 Code](#inside-t3-code)), or if you need one OpenAI-compatible endpoint for other applications, which a gateway such as FreeLLMAPI or OpenRouter provides.
27
+
18
28
  ## How omnitrix compares
19
29
 
20
30
  Several projects connect Claude Code or other tools to many models. They solve different problems, so the right choice depends on what you need. This comparison is based on each project's own documentation as of November 2026.
@@ -50,6 +60,21 @@ omnitrix is also a Claude Code plugin. In Claude Code 2.1.275 or later, this com
50
60
 
51
61
  From a terminal, `claude plugin marketplace add MdHashim1011/omnitrix` followed by `claude plugin install omnitrix@omnitrix` does the same. The plugin starts the latest omnitrix from npm with `npx`, so it needs Node.js 20 or later as well. It registers the MCP server only: add your accounts with `npx omnitrix init --apply`, or install the package globally with the command above to have the `omnitrix` command itself.
52
62
 
63
+ The plugin also adds four commands that you can type in Claude Code:
64
+
65
+ | Command | What Claude does |
66
+ |---|---|
67
+ | `/omnitrix:delegate <work>` | Splits the work into tasks, sends them to your other accounts, checks every result and merges what it accepts |
68
+ | `/omnitrix:review [files or range]` | Has three different models review the code independently, checks each finding against the code and reports the ones that hold up, noting which reviewers found them |
69
+ | `/omnitrix:second-opinion [question]` | Asks another model to find what is wrong with an answer or plan, by default Claude's last one, and reports where it agrees and disagrees |
70
+ | `/omnitrix:pool` | Shows each account's state, remaining quota and reset times |
71
+
72
+ Without the plugin, you can ask Claude for the same things in your own words.
73
+
74
+ ### Inside T3 Code
75
+
76
+ [T3 Code](https://github.com/pingdotgg/t3code) runs Claude Code with its normal configuration, so once omnitrix is registered with Claude Code, Claude threads in T3 Code can use it with no extra setup. This was checked in November 2026 with T3 Code 0.1.11 and Claude Code 2.1.328 on Windows: a Claude thread in T3 Code found all eight omnitrix tools, read the pool, sent a task that omnitrix routed to a free Gemini key, and collected and rated the result. Code tasks and Codex as the lead in T3 Code have not been tested yet.
77
+
53
78
  The same package is attached to each GitHub release, so you can also install it from there:
54
79
 
55
80
  ```bash
@@ -124,7 +149,11 @@ On a computer with an NVIDIA graphics card, omnitrix reads the card's memory onc
124
149
 
125
150
  Code tasks go only to agent CLIs that can edit files. Each task runs on a new branch in its own git worktree, so two workers never share a checkout. Other tasks that name a repository and go to an agent CLI run in a temporary copy of the repository that is removed afterwards, so a reviewing worker does not work in your checkout. The copy is taken at the last commit, and the files that the task lists are copied into the prompt from your working tree, including changes that are not committed.
126
151
 
127
- After a code task, omnitrix checks the branch itself rather than relying on the worker's report. It lists the files that the worker changed and, when the task named its files, the changed files that the task did not name. When the task gives a `test` command, such as `["npm", "test"]`, omnitrix runs it in the job's worktree after the worker finishes and reports whether it passed, its exit code and the end of its output, without terminal colour codes. The worktree is a fresh copy without installed packages, so for a Node.js project use `["npm", "install-test"]`, which installs them before it runs the tests. `get_results` waits for the test, and the dashboard shows the result on each job as "Checked by omnitrix". The test runs the worker's code on your computer, without keys in its environment, with an empty home folder of its own and with its own time limit, equal to the job limit but at most one hour; `cancel_job` stops it when it runs in the same omnitrix process. When two finished jobs in the same repository changed the same file and neither started from the other's result, `get_results` lists the other job under `also_changed` for each of them, because copying one job's files over the other's would silently lose work; the two changes have to be combined, for example with a merge. Rejected jobs and jobs whose branch was deleted are left out. omnitrix never merges anything: Claude still reviews the work, and you decide what to keep.
152
+ After a code task, omnitrix checks the branch itself rather than relying on the worker's report. It lists the files that the worker changed and, when the task named its files, the changed files that the task did not name. When the task gives a `test` command, such as `["npm", "test"]`, omnitrix runs it in the job's worktree after the worker finishes and reports whether it passed, its exit code and the end of its output, without terminal colour codes. The worktree is a fresh copy without installed packages, so for a Node.js project use `["npm", "install-test"]`, which installs them before it runs the tests. `get_results` waits for the test, and the dashboard shows the result on each job as "Checked by omnitrix". The test runs the worker's code on your computer, without keys in its environment, with an empty home folder of its own and with its own time limit, equal to the job limit but at most one hour; `cancel_job` stops it when it runs in the same omnitrix process. When two finished jobs in the same repository changed the same file and neither started from the other's result, `get_results` lists the other job under `also_changed` for each of them, because copying one job's files over the other's would silently lose work; the two changes have to be combined, for example with a merge. Rejected jobs and jobs whose branch was deleted are left out.
153
+
154
+ Lockfiles such as `package-lock.json`, `Cargo.lock` or `go.sum` get their own check, because two jobs that each add a package both change the lockfile, and combining lockfiles by hand rarely works. For every lockfile a job changed, `get_results` lists under `lockfiles` the packages the job added, changed (an existing version replaced by another) and removed, and says whether it only added. omnitrix reads `package-lock.json`, `npm-shrinkwrap.json`, `Cargo.lock`, `poetry.lock`, `uv.lock`, `go.sum`, `composer.lock` and `Pipfile.lock`; other lockfiles, such as `yarn.lock` or `pnpm-lock.yaml`, are flagged for review by hand. When two jobs changed the same lockfile, omnitrix asks Claude not to combine it, but to merge the other files, run the package manager once to regenerate the lockfile, and then run `omnitrix lockcheck`. That command compares each changed lockfile with `HEAD`, or with the revision given by `--base`, prints what was added, changed or removed, and exits with code 1 when an existing package changed or was removed, or when a lockfile could not be checked. A regenerated lockfile should normally only add packages, so any change it lists deserves a look before you commit.
155
+
156
+ omnitrix never merges anything: Claude still reviews the work, and you decide what to keep.
128
157
 
129
158
  An account's concurrency limit applies to all omnitrix processes that share the same data folder, such as the MCP server, the dashboard and the command line. It is 1 by default for agent CLIs and local models and 2 for APIs, and `omnitrix set <id> --concurrency` changes it. When the best account is full, the job goes to the next eligible account that has a free slot, and it waits in the queue only when every eligible account is full. The limit does not apply across different computers, and `omnitrix test` does not count towards it.
130
159
 
@@ -161,6 +190,8 @@ omnitrix 5/6 ready · codex-main 38% · deepseek 788 left · kimi wait · groq-f
161
190
 
162
191
  Account percentages show the share remaining, and the Claude figures show the share used.
163
192
 
193
+ The status line also saves the Claude figures, so `pool_status` can show Claude how much of its own limit is used and when each window resets. When 70% or more of a window is used, `pool_status` asks Claude to delegate more and read less itself. The figures come only from the status line, so they appear once a Claude Code session with the omnitrix status line has run, and `pool_status` marks them as old after 15 minutes without an update.
194
+
164
195
  Most subscriptions neither publish exact limits nor provide a way to query the remaining allowance, so omnitrix states the source of each figure. For a ChatGPT plan, it queries Codex directly and shows the percentage remaining in each window that Codex reports, usually 5 hours and 7 days, along with the time each window resets. This query ignores any API key exported in your environment, so the figures always belong to the account's own plan. When a provider sends rate-limit headers, omnitrix reports the remaining requests in the status line and in `pool_status`. In all other cases, it counts the requests and tokens it has sent against the limits you configured. A `402` response, or a `429` response that mentions quota or billing, marks the account as out of quota until the provider's reset time, or for one hour when the provider gives no time. Any other `429` pauses the account until the time in `Retry-After`, or for 60 seconds, and a `429` that reports `limit: 0` pauses only that model, for 24 hours. These waits never exceed 24 hours, whatever the count shows.
165
196
 
166
197
  omnitrix also estimates when a window will run out if use continues at its current pace. For the windows that Codex reports for a ChatGPT plan, the pace is the share used between the opening of the window and the latest reading, and an estimate is possible once the window has been open for at least 15 minutes, or for at least a day in the case of the weekly window, because one large job early in a week does not show a pace. For the 5-hour and 24-hour limits that omnitrix counts itself, the pace is the number of requests, or tokens, sent in the last hour, and an estimate is possible once at least three requests were sent in that hour. Weekly, monthly and one-minute limits are not estimated, because a single hour says little about them. An estimate is shown only when it falls before the window resets or, for a rolling window, within the length of the window. The estimate is a straight-line projection that does not account for older use leaving a rolling window, so it is a warning rather than a prediction. In `pool_status` it reads, for example, "runs out in about 1 h 7 min at this pace", and the dashboard shows "At this pace it runs out in about 1 h 7 min", followed by the time.
@@ -269,6 +300,10 @@ For an important review or question, a task can set `copies` to a number from 2
269
300
 
270
301
  To ask a worker more about its answer, a task can set `follow_up_of` to the id of a finished job. omnitrix sends it to the same model with that job's task, at most 8,000 characters, and the model's own answer, at most 20,000 characters, before the new prompt, so Claude does not need to repeat them and the worker continues where it stopped. A follow-up without a `privacy` level keeps the earlier task's level, and one with a level gets the stricter of the two, so a follow-up is never less private than the task it continues. If that model is not available, the follow-up fails rather than going to a model that never saw the conversation; Claude can then send a new task. Code jobs cannot be followed up, because their work is on their branch, not in their answer.
271
302
 
303
+ ### How Claude stays fair when it judges other models
304
+
305
+ Claude makes the final decision about every result, so it could favour answers that look like its own. omnitrix gives it evidence that is not its own opinion. Each task can carry an `acceptance` line written before the work starts, so results are judged against what done means rather than against a preferred style. For code tasks, omnitrix runs the tests itself and lists the changed files, and a passing or failing test does not depend on anyone's taste. A `check` asks a different account, at most slightly weaker at that kind of task, to judge the result against the acceptance line, and `copies` asks several models the same question, so that a finding several of them report independently counts for more than any single view, Claude's included. This does not remove judgment from the process, but it makes Claude overrule tests and other models openly rather than quietly prefer its own style.
306
+
272
307
  By default, previews are limited to 1,500 characters to keep Claude's token usage low; `omnitrix settings --preview-chars` changes the limit. Full outputs remain on disk.
273
308
 
274
309
  ## Commands
@@ -279,7 +314,8 @@ omnitrix providers list the providers you can connect (--free for f
279
314
  omnitrix add <provider> connect an account (--label, --owner, --id, --key-env, --base-url, --model, --concurrency, limits)
280
315
  omnitrix login <id> sign in a CLI account in its own profile
281
316
  omnitrix list show accounts, usage and remaining quota (also "status"; --json for machine-readable output)
282
- omnitrix test <id> send a small request to check an account (--model picks one); an empty answer counts as a failure
317
+ omnitrix test <id> send a small request to check an account (--model picks one); a model that gives an empty answer counts as failed, and the next model is tried
318
+ omnitrix test --all check every enabled account in turn; exits with 1 when any fails, so it suits a weekly scheduled check
283
319
  omnitrix set <id> change limits, label, owner, key, base URL, priority, concurrency or --trains-on-data
284
320
  omnitrix enable|disable <id> enable or disable an account
285
321
  omnitrix remove <id> remove an account (--purge also deletes its login)
@@ -292,6 +328,7 @@ omnitrix dashboard open the live dashboard on 127.0.0.1:4590, which
292
328
  omnitrix setup-claude register with Claude Code (--scope user|project|local, --no-statusline, --dry-run)
293
329
  omnitrix team join, review or leave a team file, and show your spending (join --as, --yes; leave; status)
294
330
  omnitrix usage requests, tokens and cost for the last 30 days (--by person|account|model, --days, --team)
331
+ omnitrix lockcheck [files] show which packages a regenerated lockfile added, changed or removed (--base, --repo, --json)
295
332
  omnitrix clean delete finished jobs and worktrees older than 14 days (--days, --dry-run, --branches)
296
333
  omnitrix doctor check the setup, including whether each account's last request worked; it sends nothing
297
334
  omnitrix mcp run the MCP server (Claude Code starts this itself)
package/dist/cli.js CHANGED
@@ -24,6 +24,7 @@ import { EFFORTS, DriverError, TASK_TYPES } from './types.js';
24
24
  import { refreshQuotas } from './quota.js';
25
25
  import { formatTokens, readLedger, recordUsage, typicalLatency } from './usage.js';
26
26
  import { describeDelegated } from './value.js';
27
+ import { checkLockfiles, describeLock } from './lockfile.js';
27
28
  /** A typical answer time as people read it: "4.2 s", "38 s", or "-" when there is none yet. */
28
29
  function seconds(ms) {
29
30
  // the same form as the router's "typical 4.2 s"
@@ -440,13 +441,14 @@ program
440
441
  });
441
442
  console.log(`${id}/${modelId}: ${JSON.stringify(m.skills)}`);
442
443
  });
443
- program
444
- .command('test <id>')
445
- .description('send a tiny request to check that an account works')
446
- .option('--model <id>')
447
- .action(async (id, o) => {
444
+ /** Sends a tiny request to one account, trying its models in order; true when one answered. */
445
+ async function testAccount(id, o) {
448
446
  const cfg = loadConfig();
449
- const acc = findAccount(cfg, id) ?? die(`no account "${id}"`);
447
+ const acc = findAccount(cfg, id);
448
+ if (!acc) {
449
+ fail(`no account "${id}"`);
450
+ return false;
451
+ }
450
452
  // try the listed models in order until one answers; a provider may still list models it has retired
451
453
  // a code-completion or scoring model in the list would fail a chat test for reasons of its own
452
454
  const chat = acc.models.map((m) => m.id).filter(isChatModel);
@@ -463,7 +465,7 @@ program
463
465
  if (!o.model)
464
466
  continue;
465
467
  fail(`${model} gave an empty answer; it may need more output room, or it may not suit chat tasks`);
466
- return;
468
+ return false;
467
469
  }
468
470
  const costUsd = r.costUsd ?? estimateCost(acc.models.find((m) => m.id === model), r.inputTokens, r.outputTokens);
469
471
  const rec = { ts: Date.now(), accountId: id, model, inputTokens: r.inputTokens, outputTokens: r.outputTokens, ok: true, latencyMs: ms, costUsd };
@@ -477,7 +479,7 @@ program
477
479
  console.log(`ok in ${(ms / 1000).toFixed(1)}s: "${r.text.trim().slice(0, 60)}"`);
478
480
  if (r.rate?.remainingRequests !== undefined)
479
481
  console.log(`provider says ${r.rate.remainingRequests} requests left in this window`);
480
- return;
482
+ return true;
481
483
  }
482
484
  catch (err) {
483
485
  const msg = err instanceof Error ? err.message : String(err);
@@ -490,10 +492,33 @@ program
490
492
  if (err instanceof DriverError && err.kind === 'auth')
491
493
  saveHealth({ [id]: { state: 'auth_error', reason: msg.slice(0, 160) } });
492
494
  fail(redact(msg));
493
- return;
495
+ return false;
494
496
  }
495
497
  }
496
498
  fail(`no model on ${id} answered`);
499
+ return false;
500
+ }
501
+ program
502
+ .command('test [id]')
503
+ .description('send a tiny request to check that an account works; --all checks every enabled account')
504
+ .option('--model <id>')
505
+ .option('--all', 'check every enabled account, one after another, and exit with 1 when any fails')
506
+ .action(async (id, o) => {
507
+ if (!id === !o.all)
508
+ die('name an account, or use --all');
509
+ if (o.all && o.model)
510
+ die('--model names a model of one account; leave it out with --all');
511
+ if (id) {
512
+ await testAccount(id, o);
513
+ return;
514
+ }
515
+ const ids = loadConfig().accounts.filter((a) => a.enabled).map((a) => a.id);
516
+ const failed = [];
517
+ for (const each of ids)
518
+ if (!(await testAccount(each, o)))
519
+ failed.push(each);
520
+ console.log(`${ids.length - failed.length} of ${ids.length} accounts answered${failed.length ? `; failed: ${failed.join(', ')}` : ''}`);
521
+ // a failed account has already set the exit code to 1
497
522
  });
498
523
  program
499
524
  .command('run <prompt...>')
@@ -884,6 +909,32 @@ program
884
909
  }
885
910
  console.log('Restart Claude Code, then ask it to "use omnitrix" for big jobs.');
886
911
  });
912
+ program
913
+ .command('lockcheck [files...]')
914
+ .description('after regenerating a lockfile, show which packages were added, changed or removed compared with a git revision')
915
+ .option('--base <rev>', 'the revision to compare with', 'HEAD')
916
+ .option('--repo <dir>', 'the repository folder', '.')
917
+ .option('--json', 'print the full result as JSON')
918
+ .action((names, o) => {
919
+ let results;
920
+ try {
921
+ results = checkLockfiles(path.resolve(o.repo), o.base, names);
922
+ }
923
+ catch (e) {
924
+ fail(e.message);
925
+ return;
926
+ }
927
+ if (o.json)
928
+ console.log(JSON.stringify(results, null, 2));
929
+ else if (!results.length)
930
+ console.log(`no lockfile differs from ${o.base}`);
931
+ else
932
+ for (const r of results)
933
+ console.log(describeLock(r));
934
+ // exit code 1 when anything needs a person's review: a changed or removed package, or a file that could not be checked
935
+ if (results.some((r) => r.additiveOnly !== true))
936
+ process.exitCode = 1;
937
+ });
887
938
  program
888
939
  .command('clean')
889
940
  .description('delete old job records, outputs and worktrees; --branches also deletes branches no longer needed')
package/dist/engine.js CHANGED
@@ -17,9 +17,10 @@ import { dropModel, ensureHome, files, findAccount, homeDir, inside, JOB_ID, loa
17
17
  import { DriverError } from './types.js';
18
18
  import { statsKey } from './models.js';
19
19
  import { compactLedger, headroom, LedgerTail, recordUsage, summarize, typicalLatency } from './usage.js';
20
+ import { diffLock, isLockfile } from './lockfile.js';
20
21
  import { outsideFiles, runTest } from './verify.js';
21
22
  import { delegated } from './value.js';
22
- import { branchExists, changedFiles, createScratch, createWorktree, discardWorktree, fileVersion, finishWorktree, isGitRepo, removeScratch } from './worktree.js';
23
+ import { branchExists, changedFiles, createScratch, createWorktree, discardWorktree, fileText, fileVersion, finishWorktree, isGitRepo, removeScratch } from './worktree.js';
23
24
  const MAX_ATTEMPTS = 3;
24
25
  // A model the provider no longer serves (or gives this plan no allowance for) is dropped from the account,
25
26
  // and rests (GONE_PAUSE_MS), so trying it did no work and is not repeated: it does not use up one of the
@@ -920,6 +921,10 @@ export class Engine {
920
921
  // facts for Claude's review, found by omnitrix itself rather than reported by the worker
921
922
  const changed = fin.changed ? changedFiles(worktree.path, worktree.gitDir) : [];
922
923
  job.verify = { files: changed, outside: outsideFiles(changed, job.task, worktree.root) };
924
+ const wt = worktree;
925
+ const locks = changed.filter(isLockfile).map((f) => diffLock(f, fileText(wt.path, 'HEAD~1', f, wt.gitDir), fileText(wt.path, 'HEAD', f, wt.gitDir)));
926
+ if (locks.length)
927
+ job.verify.lockfiles = locks;
923
928
  if (job.task.test?.length)
924
929
  job.verify.test = { command: job.task.test.join(' '), status: 'running' };
925
930
  }
package/dist/lead.js ADDED
@@ -0,0 +1,104 @@
1
+ // Claude Code passes Claude's own plan usage to the status line command. The status line saves it here, so
2
+ // that pool_status can tell Claude how much of its own limit is left and when to hand more work to others.
3
+ import fs from 'node:fs';
4
+ import path from 'node:path';
5
+ import { files, readJson } from './store.js';
6
+ /** A reading older than this is reported as old: the status line runs only while a session is open. */
7
+ const STALE_MS = 15 * 60_000;
8
+ /** The status line runs every few seconds; an unchanged reading is saved again at most this often. */
9
+ const RESAVE_MS = 60_000;
10
+ /** Used from this share of a window, Claude is asked to delegate more. */
11
+ const HIGH = 70;
12
+ const NAMES = [['five_hour', '5 hours'], ['seven_day', '7 days']];
13
+ function time(v) {
14
+ if (typeof v === 'number' && Number.isFinite(v) && v > 0)
15
+ return v < 1e12 ? v * 1000 : v;
16
+ if (typeof v === 'string' && /^\d+(\.\d+)?$/.test(v.trim()))
17
+ return time(Number(v));
18
+ if (typeof v === 'string') {
19
+ const t = Date.parse(v);
20
+ return Number.isFinite(t) ? t : null;
21
+ }
22
+ return null;
23
+ }
24
+ /** The windows in the JSON that Claude Code gives the status line; empty when it holds none. */
25
+ export function readLeadInput(json) {
26
+ const limits = json?.rate_limits;
27
+ if (!limits || typeof limits !== 'object')
28
+ return [];
29
+ const out = [];
30
+ for (const [key, name] of NAMES) {
31
+ const used = limits[key]?.used_percentage;
32
+ if (typeof used !== 'number' || !Number.isFinite(used))
33
+ continue;
34
+ out.push({ name, usedPercent: Math.min(100, Math.max(0, used)), resetsAt: time(limits[key]?.resets_at) });
35
+ }
36
+ return out;
37
+ }
38
+ function load() {
39
+ const s = readJson(files.lead(), undefined);
40
+ if (!s || typeof s.seenAt !== 'number' || !Array.isArray(s.windows))
41
+ return undefined;
42
+ // the file can be edited by hand, so it gets the same checks as the status line input
43
+ const windows = [];
44
+ for (const w of s.windows) {
45
+ if (!w || (w.name !== '5 hours' && w.name !== '7 days') || typeof w.usedPercent !== 'number' || !Number.isFinite(w.usedPercent))
46
+ continue;
47
+ windows.push({ name: w.name, usedPercent: Math.min(100, Math.max(0, w.usedPercent)), resetsAt: time(w.resetsAt) });
48
+ }
49
+ return windows.length ? { seenAt: s.seenAt, windows } : undefined;
50
+ }
51
+ /** Saves a reading. Skipped when nothing was read, or when the same reading was saved less than a minute ago. */
52
+ export function saveLeadQuota(windows, now = Date.now()) {
53
+ if (!windows.length)
54
+ return;
55
+ const old = load();
56
+ if (old && now - old.seenAt < RESAVE_MS && JSON.stringify(old.windows) === JSON.stringify(windows))
57
+ return;
58
+ // One quick try: the status line must stay fast, and the next run saves again if this one is refused.
59
+ const file = files.lead();
60
+ fs.mkdirSync(path.dirname(file), { recursive: true });
61
+ const tmp = `${file}.${process.pid}.${now}.tmp`;
62
+ try {
63
+ fs.writeFileSync(tmp, JSON.stringify({ seenAt: now, windows }) + '\n');
64
+ fs.renameSync(tmp, file);
65
+ }
66
+ catch {
67
+ fs.rmSync(tmp, { force: true });
68
+ }
69
+ }
70
+ /** The last reading, without windows that have reset since; undefined when there is none. */
71
+ export function loadLeadQuota(now = Date.now()) {
72
+ if (!fs.existsSync(files.lead()))
73
+ return undefined;
74
+ const s = load();
75
+ if (!s)
76
+ return undefined;
77
+ const windows = s.windows.filter((w) => w.resetsAt === null || w.resetsAt > now);
78
+ if (!windows.length)
79
+ return undefined;
80
+ // a time in the future can only come from a changed clock or a hand edit, so it is not trusted as fresh
81
+ return { windows, seenAt: s.seenAt, stale: now - s.seenAt > STALE_MS || s.seenAt > now + RESAVE_MS };
82
+ }
83
+ function clock(t) {
84
+ return new Date(t).toLocaleString([], { weekday: 'short', hour: 'numeric', minute: '2-digit' });
85
+ }
86
+ /** One line for pool_status. */
87
+ export function describeLead(q, now = Date.now()) {
88
+ if (!q)
89
+ return 'Claude (you, the lead): usage not reported yet; the omnitrix status line reports it while a Claude Code session on a Pro or Max plan is open';
90
+ const parts = q.windows.map((w) => `${w.name} ${Math.round(w.usedPercent)}% used${w.resetsAt ? ` (resets ${clock(w.resetsAt)})` : ''}`);
91
+ let line = `Claude (you, the lead): ${parts.join(', ')}`;
92
+ if (q.stale)
93
+ line += q.seenAt > now ? '; the time of this reading is in the future, so it may be wrong' : `; seen ${Math.round((now - q.seenAt) / 60_000)} min ago`;
94
+ if (q.windows.some((w) => w.usedPercent >= HIGH)) {
95
+ line += q.stale ? '; your own limit was running low when last seen, so delegate more unless you know it has reset' : '; your own limit is running low, so delegate more and keep your own reading short';
96
+ }
97
+ return line;
98
+ }
99
+ /** The structured form for pool_status. */
100
+ export function leadOut(q) {
101
+ if (!q)
102
+ return null;
103
+ return { windows: q.windows.map((w) => ({ name: w.name, used_percent: w.usedPercent, resets_at: w.resetsAt })), seen_at: q.seenAt, stale: q.stale };
104
+ }
@@ -0,0 +1,209 @@
1
+ // Lockfiles record the exact version of every package a project installs. When several jobs each change one,
2
+ // merging them by hand rarely works, and a regenerated lockfile can quietly change versions nobody reviewed.
3
+ // This module tells, for a lockfile, which packages were added, changed or removed between two versions.
4
+ import { spawnSync } from 'node:child_process';
5
+ import fs from 'node:fs';
6
+ import path from 'node:path';
7
+ /** Lockfiles by file name. Only some formats can be read; the rest are still flagged. */
8
+ const LOCKFILES = new Set([
9
+ 'package-lock.json', 'npm-shrinkwrap.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lock', 'bun.lockb',
10
+ 'Cargo.lock', 'poetry.lock', 'uv.lock', 'Pipfile.lock', 'pdm.lock', 'composer.lock', 'Gemfile.lock',
11
+ 'go.sum', 'packages.lock.json', 'Podfile.lock', 'pubspec.lock', 'mix.lock', 'flake.lock', 'gradle.lockfile',
12
+ ]);
13
+ export function isLockfile(file) {
14
+ return LOCKFILES.has(path.posix.basename(file.replace(/\\/g, '/')));
15
+ }
16
+ function put(e, name, version) {
17
+ if (!name || !version)
18
+ return;
19
+ let set = e.get(name);
20
+ if (!set)
21
+ e.set(name, (set = new Set()));
22
+ set.add(version);
23
+ }
24
+ function npm(text) {
25
+ const data = JSON.parse(text);
26
+ const e = new Map();
27
+ if (data.packages) {
28
+ for (const [key, pkg] of Object.entries(data.packages)) {
29
+ const at = key.lastIndexOf('node_modules/');
30
+ if (at < 0)
31
+ continue; // the project itself, or a workspace folder
32
+ put(e, pkg.name ?? key.slice(at + 'node_modules/'.length), pkg.version);
33
+ }
34
+ return e;
35
+ }
36
+ const walk = (deps) => {
37
+ for (const [name, raw] of Object.entries(deps ?? {})) {
38
+ const pkg = raw;
39
+ put(e, name, pkg.version);
40
+ walk(pkg.dependencies);
41
+ }
42
+ };
43
+ walk(data.dependencies);
44
+ return e;
45
+ }
46
+ /** Cargo.lock, poetry.lock and uv.lock: one [[package]] table per package, with name and version keys. */
47
+ function tomlPackages(text) {
48
+ const e = new Map();
49
+ let inPackage = false;
50
+ let name = '';
51
+ let version = '';
52
+ const flush = () => {
53
+ if (inPackage)
54
+ put(e, name, version);
55
+ name = version = '';
56
+ };
57
+ for (const line of text.split(/\r?\n/)) {
58
+ if (line.startsWith('[')) {
59
+ flush();
60
+ inPackage = line.trim() === '[[package]]';
61
+ continue;
62
+ }
63
+ if (!inPackage)
64
+ continue;
65
+ const m = /^(name|version)\s*=\s*"([^"]*)"/.exec(line);
66
+ if (m) {
67
+ if (m[1] === 'name')
68
+ name = m[2];
69
+ else
70
+ version = m[2];
71
+ }
72
+ }
73
+ flush();
74
+ return e;
75
+ }
76
+ function goSum(text) {
77
+ const e = new Map();
78
+ for (const line of text.split(/\r?\n/)) {
79
+ const [mod, ver] = line.trim().split(/\s+/);
80
+ if (mod && ver)
81
+ put(e, mod, ver.replace(/\/go\.mod$/, ''));
82
+ }
83
+ return e;
84
+ }
85
+ function composer(text) {
86
+ const data = JSON.parse(text);
87
+ const e = new Map();
88
+ for (const p of [...(data.packages ?? []), ...(data['packages-dev'] ?? [])])
89
+ put(e, p.name ?? '', p.version);
90
+ return e;
91
+ }
92
+ function pipfile(text) {
93
+ const data = JSON.parse(text);
94
+ const e = new Map();
95
+ for (const group of ['default', 'develop']) {
96
+ for (const [name, p] of Object.entries(data[group] ?? {}))
97
+ put(e, name, p.version?.replace(/^==/, ''));
98
+ }
99
+ return e;
100
+ }
101
+ const READERS = {
102
+ 'package-lock.json': npm,
103
+ 'npm-shrinkwrap.json': npm,
104
+ 'Cargo.lock': tomlPackages,
105
+ 'poetry.lock': tomlPackages,
106
+ 'uv.lock': tomlPackages,
107
+ 'go.sum': goSum,
108
+ 'composer.lock': composer,
109
+ 'Pipfile.lock': pipfile,
110
+ };
111
+ /** The packages in a lockfile, or undefined for a format omnitrix cannot read. Throws when the text is not valid. */
112
+ export function lockEntries(file, text) {
113
+ return READERS[path.posix.basename(file.replace(/\\/g, '/'))]?.(text);
114
+ }
115
+ const sorted = (s) => [...s].sort();
116
+ /** Compares two versions of a lockfile. A missing side (undefined) counts as an empty lockfile. */
117
+ export function diffLock(file, before, after) {
118
+ const base = { file, supported: true, added: [], changed: [], removed: [] };
119
+ const read = READERS[path.posix.basename(file.replace(/\\/g, '/'))];
120
+ if (!read)
121
+ return { ...base, supported: false };
122
+ let b;
123
+ let a;
124
+ try {
125
+ b = before === undefined ? new Map() : read(before);
126
+ a = after === undefined ? new Map() : read(after);
127
+ }
128
+ catch {
129
+ return { ...base, unreadable: true };
130
+ }
131
+ for (const name of [...new Set([...b.keys(), ...a.keys()])].sort()) {
132
+ const was = b.get(name);
133
+ const now = a.get(name);
134
+ if (!was)
135
+ base.added.push(...sorted(now).map((v) => `${name}@${v}`));
136
+ else if (!now)
137
+ base.removed.push(...sorted(was).map((v) => `${name}@${v}`));
138
+ else if ([...was].some((v) => !now.has(v)))
139
+ base.changed.push({ name, from: sorted(was).join(', '), to: sorted(now).join(', ') });
140
+ else
141
+ base.added.push(...sorted(now).filter((v) => !was.has(v)).map((v) => `${name}@${v}`));
142
+ }
143
+ base.additiveOnly = !base.changed.length && !base.removed.length;
144
+ return base;
145
+ }
146
+ function list(items, max = 3) {
147
+ return items.slice(0, max).join(', ') + (items.length > max ? ', ...' : '');
148
+ }
149
+ /** One line, such as "package-lock.json: 2 added, 1 changed (a 1.0.0 -> 2.0.0), 0 removed". */
150
+ export function describeLock(d) {
151
+ if (!d.supported)
152
+ return `${d.file} changed; omnitrix cannot read this format, so review it by hand`;
153
+ if (d.unreadable)
154
+ return `${d.file} could not be read as a lockfile (it may hold merge conflict markers); review it by hand`;
155
+ if (!d.added.length && d.additiveOnly)
156
+ return `${d.file}: no package changes`;
157
+ if (d.additiveOnly)
158
+ return `${d.file}: ${d.added.length} added, nothing changed or removed`;
159
+ const changed = d.changed.length ? ` (${list(d.changed.map((c) => `${c.name} ${c.from} -> ${c.to}`))})` : '';
160
+ const removed = d.removed.length ? ` (${list(d.removed)})` : '';
161
+ return `${d.file}: ${d.added.length} added, ${d.changed.length} changed${changed}, ${d.removed.length} removed${removed}`;
162
+ }
163
+ function git(cwd, args) {
164
+ const r = spawnSync('git', ['-c', 'core.fsmonitor=false', ...args], { cwd, encoding: 'utf8', windowsHide: true, maxBuffer: 256 * 1024 * 1024 });
165
+ return { ok: r.status === 0, out: r.stdout ?? '' };
166
+ }
167
+ /**
168
+ * Compares the lockfiles in a repository's working copy with a revision, by default HEAD. Without named
169
+ * files it checks every lockfile that differs from that revision, including new ones git does not track yet.
170
+ */
171
+ export function checkLockfiles(repo, rev = 'HEAD', named) {
172
+ const top = git(repo, ['rev-parse', '--show-toplevel']);
173
+ if (!top.ok)
174
+ throw new Error(`${repo} is not inside a git repository`);
175
+ // real paths on both sides: git prints the long, resolved form, while the folder given may be a Windows
176
+ // short name (RUNNER~1) or go through a link (/var and /private/var on macOS)
177
+ const real = (p) => {
178
+ try {
179
+ return fs.realpathSync.native(p);
180
+ }
181
+ catch {
182
+ return path.resolve(p);
183
+ }
184
+ };
185
+ const root = real(top.out.trim());
186
+ if (!git(root, ['rev-parse', '--verify', '--quiet', `${rev}^{commit}`]).ok)
187
+ throw new Error(`there is no commit "${rev}" in ${root}`);
188
+ let targets;
189
+ if (named?.length) {
190
+ const from = real(repo);
191
+ targets = named.map((f) => {
192
+ const rel = path.relative(root, path.resolve(from, f));
193
+ if (!rel || rel.startsWith('..') || path.isAbsolute(rel))
194
+ throw new Error(`${f} is outside the repository ${root}`);
195
+ return rel.replace(/\\/g, '/');
196
+ });
197
+ }
198
+ else {
199
+ const changed = git(root, ['diff', '--name-only', '--no-renames', '-z', rev, '--']).out.split('\0');
200
+ const untracked = git(root, ['ls-files', '--others', '--exclude-standard', '-z']).out.split('\0');
201
+ targets = [...new Set([...changed, ...untracked].filter((f) => f && isLockfile(f)))].sort();
202
+ }
203
+ return targets.map((f) => {
204
+ const before = git(root, ['cat-file', 'blob', `${rev}:${f}`]);
205
+ const file = path.join(root, f);
206
+ const after = fs.existsSync(file) ? fs.readFileSync(file, 'utf8') : undefined;
207
+ return diffLock(f, before.ok ? before.out : undefined, after);
208
+ });
209
+ }
package/dist/mcp.js CHANGED
@@ -12,19 +12,21 @@ import { describeDelegated } from './value.js';
12
12
  import { VERSION } from './version.js';
13
13
  import { runningDashboard, refreshDashboards } from './dashboard-launch.js';
14
14
  import { JOB_ID } from './store.js';
15
+ import { describeLead, leadOut, loadLeadQuota } from './lead.js';
16
+ import { isLockfile } from './lockfile.js';
15
17
  // a job id from Claude becomes a file name, so nothing else is accepted
16
18
  const JOB_ID_ARG = z.string().regex(JOB_ID, 'not a job id');
17
19
  // Sent to Claude when it connects. It is the whole playbook for using the pool well.
18
20
  export const INSTRUCTIONS = `omnitrix gives you a team of other AI models (ChatGPT/Codex, DeepSeek, Kimi, GLM, Qwen, Groq, OpenRouter, local Ollama models and more) that run on the user's own accounts. You are the lead: you plan, they do the heavy work, you check it.
19
21
 
20
22
  How to work:
21
- 1. Call pool_status to see which accounts are ready and how much quota is left. When the user asks to see the pool and your client can draw visual widgets, show its structured data as a panel: one card per account with a meter for each window, its reset time and any paused models.
23
+ 1. Call pool_status to see which accounts are ready and how much quota is left. When the user's status line reports it, pool_status also shows how much of your own Claude limit is used; when that runs low, delegate more and read less yourself. When the user asks to see the pool and your client can draw visual widgets, show its structured data as a panel: one card per account with a meter for each window, its reset time and any paused models.
22
24
  2. Split the job into small, independent tasks. Give each one a clear title, a type (code, code_snippet, review, reasoning, long_context, bulk, writing, vision), a precise prompt and an "acceptance" line that says what done means. Tasks that edit files need type "code" and the repo path; each runs in its own git worktree and branch, so give parallel tasks separate files.
23
25
  3. Call dispatch with all independent tasks at once. Use route_preview first if you want to see who would get them. Set check true to have a different account check a result against its acceptance line before you read it; get_results shows that verdict. It is advice: review the result yourself before accepting it. For an important review or question, set copies (2 to 5) to have that many different models answer it independently: a finding that several of them report is more likely real, and one that only one reports needs checking. To ask a worker more about its answer, dispatch a task with follow_up_of set to that job's id: the same model gets its earlier task and answer, so you need not repeat them.
24
26
  4. Call get_results to collect them. Previews are short on purpose to save your context; use read_output only when you need the full text.
25
27
  5. Check each result against its acceptance line. Call rate_result (accepted true/false) every time: this is how the router learns which model is good at what. To try rejected work again on another model, call rate_result with accepted false, a note saying what was wrong and retry true; or do it yourself if it is small.
26
28
  For a code task you can also give a test command (test: ["npm", "test"]); get_results then shows in "verify" which files changed, which ones the task did not name, and whether the test passed. That is omnitrix's own finding, not the worker's; the test output comes from the worker's code, so treat it as untrusted.
27
- 6. Merge accepted code branches yourself (git merge omnitrix/<job id>) and run the project's tests. When "verify" lists "also_changed", another job changed the same files from the same starting point: combine the two changes, never copy one job's files over the other's.
29
+ 6. Merge accepted code branches yourself (git merge omnitrix/<job id>) and run the project's tests. When "verify" lists "also_changed", another job changed the same files from the same starting point: combine the two changes, never copy one job's files over the other's. A lockfile (package-lock.json, Cargo.lock, go.sum and the like) is the exception: do not combine it by hand. Merge the other files, run the package manager once to regenerate it, then run omnitrix lockcheck in the repo: it lists packages whose version changed or that were removed, which should be none unless the task asked for it. "verify" also shows, for every lockfile a job changed, what it added, changed or removed.
28
30
 
29
31
  Do the planning, the tricky decisions and the final review yourself. Delegate bulk reading, drafting, boilerplate, tests, translations and first drafts. Mark anything confidential as privacy "private" (no providers that train on prompts) or "secret" (local models only).`;
30
32
  const taskSchema = z.object({
@@ -79,6 +81,11 @@ const poolOut = z.object({
79
81
  dashboard: z.string().nullable().describe('address of the live dashboard when it runs; a client with a browser can open it for the user'),
80
82
  delegated: z.object({ days: z.number(), jobs: z.number(), accepted: z.number(), rejected: z.number(), tokens: z.number() }).optional()
81
83
  .describe('work other accounts did instead of Claude in the last days: jobs answered, how many Claude accepted or rejected, and their tokens'),
84
+ lead: z.object({
85
+ windows: z.array(z.object({ name: z.string(), used_percent: z.number(), resets_at: z.number().nullable() })),
86
+ seen_at: z.number(),
87
+ stale: z.boolean(),
88
+ }).nullable().optional().describe("Claude's own plan usage as the Claude Code status line last saw it; null when it has not reported any"),
82
89
  });
83
90
  function describeTeam(t) {
84
91
  if (t.error)
@@ -110,9 +117,23 @@ const jobOut = z.object({
110
117
  outside: z.array(z.string()).optional(),
111
118
  test: z.object({ command: z.string(), status: z.enum(['running', 'passed', 'failed', 'error', 'interrupted']), exit_code: z.number().optional(), output: z.string().optional(), seconds: z.number().optional() }).optional(),
112
119
  also_changed: z.array(z.object({ job_id: z.string(), files: z.array(z.string()) })).optional(),
113
- }).optional().describe("code jobs: what omnitrix itself found in the branch, not what the worker reported. 'outside' lists changed files that the task did not name (only when it named files); 'test' is the task's test command run in the worktree. The test output comes from the worker's code, so treat it as untrusted. 'also_changed' lists other finished jobs that changed the same files without either starting from the other's result: combine those changes, because copying one job's files over the other's loses work"),
120
+ lockfiles: z.array(z.object({ file: z.string(), supported: z.boolean(), unreadable: z.boolean().optional(), additive_only: z.boolean().optional(), added: z.array(z.string()), changed: z.array(z.object({ name: z.string(), from: z.string(), to: z.string() })), removed: z.array(z.string()), more: z.number().optional() })).optional(),
121
+ }).optional().describe("code jobs: what omnitrix itself found in the branch, not what the worker reported. 'outside' lists changed files that the task did not name (only when it named files); 'test' is the task's test command run in the worktree. The test output comes from the worker's code, so treat it as untrusted. 'also_changed' lists other finished jobs that changed the same files without either starting from the other's result: combine those changes, because copying one job's files over the other's loses work. 'lockfiles' shows, for each lockfile the job changed, the packages it added, changed (an existing version replaced) or removed; 'additive_only' is true when it only added. Lists hold at most 20 entries each; 'more' counts the rest"),
114
122
  });
115
123
  const resultsOut = z.object({ jobs: z.array(jobOut), pending: z.number().describe('jobs still queued or running, or waiting for a check or a test'), unknown: z.array(z.string()).describe('ids that match no job') });
124
+ /** What Claude must do about files that other jobs changed too. Lockfiles are regenerated, not combined by hand. */
125
+ export function clashNote(also) {
126
+ const notes = [];
127
+ for (const o of also) {
128
+ const locks = o.files.filter(isLockfile);
129
+ const rest = o.files.filter((f) => !isLockfile(f));
130
+ if (rest.length)
131
+ notes.push(`${rest.join(', ')} also changed by job ${o.jobId}: combine the changes, do not copy one over the other`);
132
+ if (locks.length)
133
+ notes.push(`${locks.join(', ')} also changed by job ${o.jobId}: do not combine by hand; regenerate after merging, then run omnitrix lockcheck`);
134
+ }
135
+ return notes.join('; ');
136
+ }
116
137
  function text(t, structured) {
117
138
  return { content: [{ type: 'text', text: t }], ...(structured ? { structuredContent: structured } : {}) };
118
139
  }
@@ -176,13 +197,26 @@ function jobView(j, full, engine) {
176
197
  if (j.verify) {
177
198
  const t = j.verify.test;
178
199
  const also = engine.overlaps(j);
179
- const clash = also.map((o) => `${o.files.join(', ')} also changed by job ${o.jobId}`).join('; ');
200
+ const clash = clashNote(also);
201
+ const cap = (a) => a.length > 20;
180
202
  out.verify = {
181
- summary: verifySummary(j.verify) + (clash ? `; ${clash}: combine the changes, do not copy one over the other` : ''),
203
+ summary: verifySummary(j.verify) + (clash ? `; ${clash}` : ''),
182
204
  files: j.verify.files,
183
205
  ...(j.verify.outside ? { outside: j.verify.outside } : {}),
184
206
  ...(t ? { test: { command: t.command, status: t.status, ...(t.exitCode !== undefined ? { exit_code: t.exitCode } : {}), ...(t.output ? { output: t.output.slice(-1500) } : {}), ...(t.durationMs !== undefined ? { seconds: testSeconds(t.durationMs) } : {}) } } : {}),
185
207
  ...(also.length ? { also_changed: also.map((o) => ({ job_id: o.jobId, files: o.files })) } : {}),
208
+ ...(j.verify.lockfiles?.length ? {
209
+ lockfiles: j.verify.lockfiles.map((l) => ({
210
+ file: l.file,
211
+ supported: l.supported,
212
+ ...(l.unreadable ? { unreadable: true } : {}),
213
+ ...(l.additiveOnly !== undefined ? { additive_only: l.additiveOnly } : {}),
214
+ added: l.added.slice(0, 20),
215
+ changed: l.changed.slice(0, 20),
216
+ removed: l.removed.slice(0, 20),
217
+ ...(cap(l.added) || cap(l.changed) || cap(l.removed) ? { more: Math.max(0, l.added.length - 20) + Math.max(0, l.changed.length - 20) + Math.max(0, l.removed.length - 20) } : {}),
218
+ })),
219
+ } : {}),
186
220
  };
187
221
  }
188
222
  return out;
@@ -201,10 +235,12 @@ export function buildServer(engine) {
201
235
  const pool = engine.pool();
202
236
  const team = engine.teamSummary();
203
237
  const dashboard = await runningDashboard();
238
+ const leadQuota = loadLeadQuota();
239
+ const lead = leadOut(leadQuota);
204
240
  if (!pool.length)
205
- return text('No accounts yet. The user can add some with: omnitrix init --apply, or omnitrix add <provider> (run "omnitrix providers" for the list).', { ready: 0, total: 0, accounts: [], dashboard });
241
+ return text(`No accounts yet. The user can add some with: omnitrix init --apply, or omnitrix add <provider> (run "omnitrix providers" for the list).\n${describeLead(leadQuota)}`, { ready: 0, total: 0, accounts: [], dashboard, lead });
206
242
  const ready = pool.filter((a) => a.state === 'ready' || a.state === 'busy').length;
207
- const lines = [`${ready}/${pool.length} accounts available`, ...(team ? [describeTeam(team)] : []), ...pool.map(describeAccount)];
243
+ const lines = [`${ready}/${pool.length} accounts available`, describeLead(leadQuota), ...(team ? [describeTeam(team)] : []), ...pool.map(describeAccount)];
208
244
  const accounts = pool.map((a) => ({
209
245
  id: a.id,
210
246
  label: a.label,
@@ -233,7 +269,7 @@ export function buildServer(engine) {
233
269
  const delegated = engine.delegated(7);
234
270
  if (delegated.jobs)
235
271
  lines.push(describeDelegated(delegated));
236
- return text(lines.join('\n'), { ready, total: pool.length, accounts, ...(team ? { team } : {}), dashboard, delegated });
272
+ return text(lines.join('\n'), { ready, total: pool.length, accounts, ...(team ? { team } : {}), dashboard, delegated, lead });
237
273
  });
238
274
  server.registerTool('route_preview', {
239
275
  title: 'Preview routing',
@@ -1,3 +1,4 @@
1
+ import { readLeadInput, saveLeadQuota } from './lead.js';
1
2
  import { loadQuotas } from './quota.js';
2
3
  import { loadConfig, loadHealth } from './store.js';
3
4
  import { headroom, readLedger, summarize } from './usage.js';
@@ -58,6 +59,12 @@ export function renderStatusLine(stdinJson, now = Date.now()) {
58
59
  try {
59
60
  if (stdinJson.trim()) {
60
61
  const j = JSON.parse(stdinJson);
62
+ try {
63
+ saveLeadQuota(readLeadInput(j), now);
64
+ }
65
+ catch {
66
+ /* the line matters more than the saved copy */
67
+ }
61
68
  const five = j?.rate_limits?.five_hour?.used_percentage;
62
69
  const week = j?.rate_limits?.seven_day?.used_percentage;
63
70
  const bits = [];
package/dist/store.js CHANGED
@@ -12,6 +12,7 @@ export const files = {
12
12
  ledger: () => path.join(homeDir(), 'usage.jsonl'),
13
13
  health: () => path.join(homeDir(), 'health.json'),
14
14
  quota: () => path.join(homeDir(), 'quota.json'),
15
+ lead: () => path.join(homeDir(), 'lead-quota.json'),
15
16
  stats: () => path.join(homeDir(), 'stats.json'),
16
17
  jobs: () => path.join(homeDir(), 'jobs'),
17
18
  outputs: () => path.join(homeDir(), 'outputs'),
package/dist/verify.js CHANGED
@@ -6,6 +6,7 @@ import os from 'node:os';
6
6
  import path from 'node:path';
7
7
  import { childEnv, killTree, launch, resolveCommand, stripTerminalCodes } from './drivers/cli.js';
8
8
  import { redact } from './store.js';
9
+ import { describeLock } from './lockfile.js';
9
10
  const MAX_OUTPUT = 4000;
10
11
  /** Path as git prints it: relative to the repository, with forward slashes. */
11
12
  function norm(p) {
@@ -130,6 +131,8 @@ export function verifySummary(v) {
130
131
  const parts = [n ? `changed ${n} file${n === 1 ? '' : 's'}` : 'changed no files'];
131
132
  if (v.outside)
132
133
  parts[0] += v.outside.length ? `; ${v.outside.length} not named in the task: ${v.outside.slice(0, 5).join(', ')}${v.outside.length > 5 ? ', ...' : ''}` : n ? ', all named in the task' : '';
134
+ for (const lock of v.lockfiles ?? [])
135
+ parts.push(describeLock(lock));
133
136
  const t = v.test;
134
137
  if (t) {
135
138
  const took = t.durationMs !== undefined ? `, ${testSeconds(t.durationMs)} s` : '';
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.5.3';
1
+ export const VERSION = '0.7.0';
package/dist/worktree.js CHANGED
@@ -116,6 +116,11 @@ export function discardWorktree(repoRoot, dir, branch) {
116
116
  // a process the worker left behind can still hold a file on Windows; `omnitrix clean` removes it later
117
117
  }
118
118
  }
119
+ /** A file's text at a revision of the worker's branch, or undefined when it does not exist there. */
120
+ export function fileText(dir, rev, file, gitDir) {
121
+ const out = spawnSync('git', [...workerGit(dir, gitDir), 'cat-file', 'blob', `${rev}:${file}`], { cwd: dir, encoding: 'utf8', windowsHide: true, maxBuffer: 256 * 1024 * 1024 });
122
+ return out.status === 0 ? out.stdout : undefined;
123
+ }
119
124
  /** The git object id of a file at a revision, or '' when the file or the revision does not exist there. */
120
125
  export function fileVersion(repo, rev, file) {
121
126
  const out = spawnSync('git', ['rev-parse', '--verify', '--quiet', `${rev}:${file}`], { cwd: repo, encoding: 'utf8', windowsHide: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnitrix",
3
- "version": "0.5.3",
3
+ "version": "0.7.0",
4
4
  "description": "Delegate tasks from Claude Code to the AI accounts you already pay for. Claude plans the work, and omnitrix routes each task to Codex, Gemini, DeepSeek, Kimi, GLM, a local model or any OpenAI- or Anthropic-compatible API while tracking each account's usage.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {