omnitrix 0.6.0 → 0.7.1

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
@@ -15,6 +15,12 @@ omnitrix is built for the frontier-model subscriptions and API keys you already
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
+
18
24
  ## Who it is for
19
25
 
20
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.
@@ -84,6 +90,24 @@ shasum -a 256 omnitrix.tgz
84
90
 
85
91
  The first command is for Windows and the second for macOS and Linux. The value it prints must match the one in `omnitrix.tgz.sha256`. Then install the file you checked with `npm install -g ./omnitrix.tgz`.
86
92
 
93
+ ### In other MCP apps
94
+
95
+ omnitrix is an ordinary MCP server, so other apps that run local MCP servers can use it as well. `omnitrix mcp-config` prints the entry to add, with the full paths of Node.js and omnitrix on your computer, so the app needs neither your PATH nor the npm command shim. On a Mac with Node.js from nodejs.org, it looks like this:
96
+
97
+ ```json
98
+ {
99
+ "mcpServers": {
100
+ "omnitrix": {
101
+ "type": "stdio",
102
+ "command": "/usr/local/bin/node",
103
+ "args": ["/usr/local/lib/node_modules/omnitrix/dist/cli.js", "mcp"]
104
+ }
105
+ }
106
+ }
107
+ ```
108
+
109
+ Cursor reads this entry from `~/.cursor/mcp.json`, or from `.cursor/mcp.json` inside a project. The GitHub Copilot agent in VS Code reads the same shape from `~/.copilot/mcp-config.json`, while the older `.vscode/mcp.json` file uses the key `servers` instead of `mcpServers`. Other apps keep the file elsewhere, so check their MCP documentation. These apps have not been tested yet; only Claude Code and T3 Code have. In another app, its own model takes Claude's place as the lead, and the figures for Claude's own limit are not available, because they come from the Claude Code status line.
110
+
87
111
  ## Quick start
88
112
 
89
113
  ```bash
@@ -184,6 +208,8 @@ omnitrix 5/6 ready · codex-main 38% · deepseek 788 left · kimi wait · groq-f
184
208
 
185
209
  Account percentages show the share remaining, and the Claude figures show the share used.
186
210
 
211
+ 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. The dashboard shows them on a card of their own, next to the other accounts. 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.
212
+
187
213
  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.
188
214
 
189
215
  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.
@@ -306,7 +332,8 @@ omnitrix providers list the providers you can connect (--free for f
306
332
  omnitrix add <provider> connect an account (--label, --owner, --id, --key-env, --base-url, --model, --concurrency, limits)
307
333
  omnitrix login <id> sign in a CLI account in its own profile
308
334
  omnitrix list show accounts, usage and remaining quota (also "status"; --json for machine-readable output)
309
- omnitrix test <id> send a small request to check an account (--model picks one); an empty answer counts as a failure
335
+ 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
336
+ omnitrix test --all check every enabled account in turn; exits with 1 when any fails, so it suits a weekly scheduled check
310
337
  omnitrix set <id> change limits, label, owner, key, base URL, priority, concurrency or --trains-on-data
311
338
  omnitrix enable|disable <id> enable or disable an account
312
339
  omnitrix remove <id> remove an account (--purge also deletes its login)
@@ -317,6 +344,7 @@ omnitrix run <prompt> run one task and print the answer (--type, --pri
317
344
  omnitrix settings set the mode, private protection, pins, bans, the job time limit and the preview length
318
345
  omnitrix dashboard open the live dashboard on 127.0.0.1:4590, which runs in the background (--stop, --port, --no-open, --serve)
319
346
  omnitrix setup-claude register with Claude Code (--scope user|project|local, --no-statusline, --dry-run)
347
+ omnitrix mcp-config print the MCP server entry for other apps, such as Cursor or VS Code
320
348
  omnitrix team join, review or leave a team file, and show your spending (join --as, --yes; leave; status)
321
349
  omnitrix usage requests, tokens and cost for the last 30 days (--by person|account|model, --days, --team)
322
350
  omnitrix lockcheck [files] show which packages a regenerated lockfile added, changed or removed (--base, --repo, --json)
package/dist/cli.js CHANGED
@@ -441,13 +441,14 @@ program
441
441
  });
442
442
  console.log(`${id}/${modelId}: ${JSON.stringify(m.skills)}`);
443
443
  });
444
- program
445
- .command('test <id>')
446
- .description('send a tiny request to check that an account works')
447
- .option('--model <id>')
448
- .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) {
449
446
  const cfg = loadConfig();
450
- 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
+ }
451
452
  // try the listed models in order until one answers; a provider may still list models it has retired
452
453
  // a code-completion or scoring model in the list would fail a chat test for reasons of its own
453
454
  const chat = acc.models.map((m) => m.id).filter(isChatModel);
@@ -464,7 +465,7 @@ program
464
465
  if (!o.model)
465
466
  continue;
466
467
  fail(`${model} gave an empty answer; it may need more output room, or it may not suit chat tasks`);
467
- return;
468
+ return false;
468
469
  }
469
470
  const costUsd = r.costUsd ?? estimateCost(acc.models.find((m) => m.id === model), r.inputTokens, r.outputTokens);
470
471
  const rec = { ts: Date.now(), accountId: id, model, inputTokens: r.inputTokens, outputTokens: r.outputTokens, ok: true, latencyMs: ms, costUsd };
@@ -478,7 +479,7 @@ program
478
479
  console.log(`ok in ${(ms / 1000).toFixed(1)}s: "${r.text.trim().slice(0, 60)}"`);
479
480
  if (r.rate?.remainingRequests !== undefined)
480
481
  console.log(`provider says ${r.rate.remainingRequests} requests left in this window`);
481
- return;
482
+ return true;
482
483
  }
483
484
  catch (err) {
484
485
  const msg = err instanceof Error ? err.message : String(err);
@@ -491,10 +492,33 @@ program
491
492
  if (err instanceof DriverError && err.kind === 'auth')
492
493
  saveHealth({ [id]: { state: 'auth_error', reason: msg.slice(0, 160) } });
493
494
  fail(redact(msg));
494
- return;
495
+ return false;
495
496
  }
496
497
  }
497
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
498
522
  });
499
523
  program
500
524
  .command('run <prompt...>')
@@ -832,6 +856,14 @@ program
832
856
  }
833
857
  console.log('\nCosts are those reported by the provider, or estimated from model prices where they are known.');
834
858
  });
859
+ program
860
+ .command('mcp-config')
861
+ .description('print the MCP server entry for other apps, such as Cursor or VS Code, with the paths on this computer')
862
+ .action(() => {
863
+ // the full paths of node and of this file, so the app needs neither PATH nor the npm shim
864
+ const entry = { type: 'stdio', command: process.execPath, args: [fileURLToPath(import.meta.url), 'mcp'] };
865
+ console.log(JSON.stringify({ mcpServers: { omnitrix: entry } }, null, 2));
866
+ });
835
867
  program
836
868
  .command('setup-claude')
837
869
  .description('register omnitrix in Claude Code and add the status line')
package/dist/dashboard.js CHANGED
@@ -8,6 +8,7 @@ import { refreshQuotas } from './quota.js';
8
8
  import { ensureHome, homeDir, writeJson } from './store.js';
9
9
  import { verifySummary } from './verify.js';
10
10
  import { ICON_SVG } from './icon.js';
11
+ import { leadOut, loadLeadQuota } from './lead.js';
11
12
  import { VERSION } from './version.js';
12
13
  /** The newest jobs for the page. A second check is shown on the job it checks, not as a job of its own. */
13
14
  export function recentJobs(engine, limit = 30) {
@@ -48,7 +49,7 @@ export function startDashboard(port) {
48
49
  let latest = '';
49
50
  let slowAt = 0;
50
51
  let openedAt = 0;
51
- const snapshot = () => JSON.stringify({ version: VERSION, accounts: engine.pool(), jobs: recentJobs(engine), delegated: engine.delegated(7) });
52
+ const snapshot = () => JSON.stringify({ version: VERSION, accounts: engine.pool(), jobs: recentJobs(engine), delegated: engine.delegated(7), lead: leadOut(loadLeadQuota()) });
52
53
  // Quota reads and local server probes run in the background and are throttled; the page never waits for them.
53
54
  const slowChecks = () => {
54
55
  if (Date.now() - slowAt < SLOW_MS)
@@ -135,7 +136,7 @@ export function startDashboard(port) {
135
136
  }
136
137
  if (req.url === '/api/status') {
137
138
  slowChecks();
138
- json(res, { version: VERSION, now: Date.now(), accounts: engine.pool(), jobs: recentJobs(engine), delegated: engine.delegated(7) });
139
+ json(res, { version: VERSION, now: Date.now(), accounts: engine.pool(), jobs: recentJobs(engine), delegated: engine.delegated(7), lead: leadOut(loadLeadQuota()) });
139
140
  return;
140
141
  }
141
142
  if (req.url === '/api/ping') {
@@ -336,6 +337,7 @@ var ago=function(t){var s=Math.round((Date.now()-t)/1000);return s<60?s+' s ago'
336
337
  function icon(name){
337
338
  var p={terminal:'<rect x="3" y="4" width="18" height="16" rx="2.5"/><path d="M7 9l3 3-3 3M12 15h5"/>',
338
339
  cloud:'<path d="M7 18a4.5 4.5 0 0 1-.5-9 6 6 0 0 1 11.5 1.5A3.75 3.75 0 0 1 17.5 18z"/>',
340
+ lead:'<path d="M12 3l2.2 5.6L20 10l-5.8 1.4L12 17l-2.2-5.6L4 10l5.8-1.4z"/><path d="M18 16l.8 2.2L21 19l-2.2.8L18 22l-.8-2.2L15 19l2.2-.8z"/>',
339
341
  chip:'<rect x="6" y="6" width="12" height="12" rx="2"/><path d="M9 2v4M15 2v4M9 18v4M15 18v4M2 9h4M2 15h4M18 9h4M18 15h4"/>'}[name];
340
342
  return '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">'+p+'</svg>';
341
343
  }
@@ -386,6 +388,18 @@ function cardHtml(a,open){
386
388
  +(u.stale&&u.updatedAt?'<div class="note warn">omnitrix could not read these numbers again. They are from '+esc(clock(u.updatedAt))+' and may be out of date.</div>':'')
387
389
  +modelHtml+'</article>';
388
390
  }
391
+ // Claude itself, from the figures the Claude Code status line saved; drawn only when there are some
392
+ function leadHtml(l){
393
+ if(!l||!l.windows||!l.windows.length)return '';
394
+ var high=l.windows.some(function(w){return w.used_percent>=70});
395
+ var wins=l.windows.map(function(w){return windowHtml({name:w.name,unit:'percent',remaining:100-w.used_percent,resetsAt:w.resets_at})}).join('');
396
+ var notes=l.stale?'<div class="note warn">These figures are from '+esc(clock(l.seen_at))+'. They update only while a Claude Code session is open, so they may be out of date.</div>':'';
397
+ if(high)notes+='<div class="note warn">'+(l.stale?'Claude was running low when last seen.':'Claude is running low.')+' omnitrix asks it to hand more work to the other accounts.</div>';
398
+ return '<article class="card" aria-label="Claude, the lead">'
399
+ +'<div class="head"><div class="title">'+icon('lead')+'<div><h3>Claude</h3><div class="sub">The lead: plans the work and checks every result</div></div></div><span class="state s-busy"><i aria-hidden="true"></i>Lead</span></div>'
400
+ +'<div>'+wins+'</div>'+notes
401
+ +'<div class="stats"><span class="prov">From the Claude Code status line'+(l.stale?'':', updated '+esc(ago(l.seen_at)))+'</span></div></article>';
402
+ }
389
403
  var JOB={done:['Done','s-ok'],running:['Running','s-busy'],queued:['Waiting','s-idle'],failed:['Failed','s-bad'],cancelled:['Cancelled','s-idle']};
390
404
  function jobHtml(j,open){
391
405
  var st=JOB[j.status]||[j.status,'s-idle'];
@@ -435,8 +449,8 @@ function draw(d){
435
449
  +(function(g){g=g||{jobs:0,tokens:0,accepted:0};return '<div class="kpi"><span>Done by other accounts, 7 days</span><b>'+g.jobs+' job'+(g.jobs===1?'':'s')+'</b><small>'+esc(fmt(g.tokens))+' tokens'+(g.accepted?', '+g.accepted+' accepted':'')+'</small></div>'})(d.delegated)
436
450
  +'<div class="kpi"><span>Known cost, last 24 h</span><b>'+esc(money(sum('costToday')))+'</b></div>';
437
451
  document.getElementById('acc-sub').textContent=acc.length?acc.length+' connected':'';
438
- document.getElementById('accounts').innerHTML=acc.length?acc.map(function(a){return cardHtml(a,open)}).join('')
439
- :'<div class="empty"><h3>Connect your first account</h3>omnitrix has no accounts yet. In a terminal:<ol><li><code>omnitrix init --apply</code> connects the AI tools, API keys and local models it finds on this PC</li><li><code>omnitrix providers</code> lists what you can connect</li><li><code>omnitrix add ollama</code> adds models on this PC</li><li><code>omnitrix setup-claude</code> connects omnitrix to Claude Code</li></ol></div>';
452
+ document.getElementById('accounts').innerHTML=leadHtml(d.lead)+(acc.length?acc.map(function(a){return cardHtml(a,open)}).join('')
453
+ :'<div class="empty"><h3>Connect your first account</h3>omnitrix has no accounts yet. In a terminal:<ol><li><code>omnitrix init --apply</code> connects the AI tools, API keys and local models it finds on this PC</li><li><code>omnitrix providers</code> lists what you can connect</li><li><code>omnitrix add ollama</code> adds models on this PC</li><li><code>omnitrix setup-claude</code> connects omnitrix to Claude Code</li></ol></div>');
440
454
  document.getElementById('jobs').innerHTML=d.jobs.length?'<ul class="jobs">'+d.jobs.map(function(j){return jobHtml(j,open)}).join('')+'</ul>'
441
455
  :'<div class="empty"><h3>No jobs yet</h3>Ask Claude to hand out a task, and it shows up here.</div>';
442
456
  if(focusKey){var again=document.querySelector('details[data-key="'+focusKey+'"] summary');if(again)again.focus({preventScroll:true})}
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
+ }
package/dist/mcp.js CHANGED
@@ -12,6 +12,7 @@ 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';
15
16
  import { isLockfile } from './lockfile.js';
16
17
  // a job id from Claude becomes a file name, so nothing else is accepted
17
18
  const JOB_ID_ARG = z.string().regex(JOB_ID, 'not a job id');
@@ -19,7 +20,7 @@ const JOB_ID_ARG = z.string().regex(JOB_ID, 'not a job id');
19
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.
20
21
 
21
22
  How to work:
22
- 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.
23
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.
24
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.
25
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.
@@ -80,6 +81,11 @@ const poolOut = z.object({
80
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'),
81
82
  delegated: z.object({ days: z.number(), jobs: z.number(), accepted: z.number(), rejected: z.number(), tokens: z.number() }).optional()
82
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"),
83
89
  });
84
90
  function describeTeam(t) {
85
91
  if (t.error)
@@ -229,10 +235,12 @@ export function buildServer(engine) {
229
235
  const pool = engine.pool();
230
236
  const team = engine.teamSummary();
231
237
  const dashboard = await runningDashboard();
238
+ const leadQuota = loadLeadQuota();
239
+ const lead = leadOut(leadQuota);
232
240
  if (!pool.length)
233
- 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 });
234
242
  const ready = pool.filter((a) => a.state === 'ready' || a.state === 'busy').length;
235
- 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)];
236
244
  const accounts = pool.map((a) => ({
237
245
  id: a.id,
238
246
  label: a.label,
@@ -261,7 +269,7 @@ export function buildServer(engine) {
261
269
  const delegated = engine.delegated(7);
262
270
  if (delegated.jobs)
263
271
  lines.push(describeDelegated(delegated));
264
- 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 });
265
273
  });
266
274
  server.registerTool('route_preview', {
267
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/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.6.0';
1
+ export const VERSION = '0.7.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnitrix",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
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": {