t3-auto-build 2.0.0 → 2.0.2

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/CHANGELOG.md CHANGED
@@ -4,6 +4,24 @@ All notable changes to this project are documented here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
5
5
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.0.1] - 2026-11-26
8
+
9
+ ### Added
10
+
11
+ - `check-models` prints one `provider:model status` line per configured model.
12
+ - Lock rechecks: locks longer than 6 hours carry `setAt` and `recheckAfter`. Due provider locks are
13
+ probed (Claude, Codex) or reported as `recheck-via-t3` for a canary delegation. New
14
+ `check-models --recheck-locks`.
15
+
16
+ ### Changed
17
+
18
+ - Codex `free` and `go` are CLI tiers with `gpt-6-luna`, `gpt-5.6-terra` and `gpt-5.6-luna`, one
19
+ parallel builder and no warning.
20
+
21
+ ### Fixed
22
+
23
+ - `quota clear` accepts `provider:<provider>`.
24
+
7
25
  ## [2.0.0] - 2026-11-26
8
26
 
9
27
  ### Added
@@ -91,6 +109,7 @@ See [Migrating from v1](README.md#migrating-from-v1).
91
109
  - Hardened the recursive `rm` guard, cooldown handling, the pre-compact state boundary and
92
110
  `sync-models --force`.
93
111
 
112
+ [2.0.1]: https://github.com/mirceas94/t3-auto-build/compare/v2.0.0...v2.0.1
94
113
  [2.0.0]: https://github.com/mirceas94/t3-auto-build/compare/v1.0.1...v2.0.0
95
114
  [1.0.1]: https://github.com/mirceas94/t3-auto-build/compare/v1.0.0...v1.0.1
96
115
  [1.0.0]: https://github.com/mirceas94/t3-auto-build/releases/tag/v1.0.0
package/README.md CHANGED
@@ -84,8 +84,8 @@ v1 config. At least one provider needs a CLI-capable tier.
84
84
  | claude | `team-premium` | yes | `claude-haiku-5-5`, `claude-sonnet-5-5`, `claude-opus-5-5` | – | 2 | – |
85
85
  | claude | `api` | yes | `claude-haiku-5-5`, `claude-sonnet-5-5`, `claude-opus-5-5` | `claude-fable-5-2` | 3 | API usage is billed per token |
86
86
  | codex | `none` | no | – | – | 0 | no Codex subscription selected |
87
- | codex | `free` | no | – | – | 0 | desktop-only; Codex CLI unavailable |
88
- | codex | `go` | no | – | – | 0 | desktop-only; Codex CLI unavailable |
87
+ | codex | `free` | yes | `gpt-6-luna`, `gpt-5.6-terra`, `gpt-5.6-luna` | – | 1 | – |
88
+ | codex | `go` | yes | `gpt-6-luna`, `gpt-5.6-terra`, `gpt-5.6-luna` | – | 1 | – |
89
89
  | codex | `plus` | yes | `gpt-6-luna`, `gpt-6.1-terra` | – | 1 | – |
90
90
  | codex | `pro-100` | yes | `gpt-6-luna`, `gpt-6.1-terra`, `gpt-6.1-sol` | `gpt-6-astra` | 2 | – |
91
91
  | codex | `pro-200` | yes | `gpt-6-luna`, `gpt-6.1-terra`, `gpt-6.1-sol` | `gpt-6-astra` | 2 | – |
@@ -121,7 +121,9 @@ An `api` tier counts only with `--allow-usage-credits`.
121
121
 
122
122
  `--parent fable` selects `claude-fable-5-2`, from the scarce `fable` pool. `init` writes `model` and
123
123
  `effortLevel` to `settings.json` only when the key is absent or still holds the value it wrote
124
- before. Without an eligible Claude tier, no parent is set.
124
+ before. Without an eligible Claude tier, no parent is set. This sets Claude Code's default session
125
+ model; in T3 Code you can still start a `$auto-build` thread on any allowlisted model (see
126
+ [Starting model](#starting-model)).
125
127
 
126
128
  ### Cross-hosted overflow
127
129
 
@@ -153,6 +155,22 @@ The skill runs `t3-auto-build check-models` at the start of every run. Results g
153
155
  - A live manual mark beats discovery and probe results. Its `--ttl` is one number plus `m`, `h` or
154
156
  `d`, above zero and at most `30d` (default `24h`).
155
157
  - Antigravity has no probe support.
158
+ - After its summary line, `check-models` prints one `provider:model status` line per configured model:
159
+ `available` (nothing speaks against it), `rate-limited` (locked or limited), `plan-restricted`,
160
+ `unavailable` or `skipped-scarce`.
161
+
162
+ ### Lock rechecks
163
+
164
+ A lock lasting more than 6 hours gets `setAt` and `recheckAfter` (6 hours later). Once a provider lock
165
+ is past `recheckAfter`, or for every provider lock with `--recheck-locks`, `check-models` tests the
166
+ cheapest configured standard model:
167
+
168
+ - With a Claude or Codex CLI installed, it sends one probe. Success clears the lock; any other result
169
+ moves `recheckAfter` 6 hours ahead.
170
+ - Otherwise (such as Antigravity) it prints `recheck-via-t3: <provider> (<model>)`. The skill then
171
+ clears the lock, sends a one-word canary `delegate_task`, and re-locks only on a rate limit.
172
+
173
+ Model and pool locks are not rechecked.
156
174
 
157
175
  ```sh
158
176
  t3-auto-build availability mark antigravity:claude-opus-5-5 plan-restricted --ttl 24h --reason "not in plan"
@@ -258,12 +276,42 @@ resume later.
258
276
  | `--reset-cooldowns` | Clear all locks first. |
259
277
  | `--<provider>-only` | Use only that provider's models. |
260
278
 
279
+ ### Starting model
280
+
281
+ You can start a `$auto-build` conversation in T3 Code on **any allowlisted model** (for example
282
+ `gemini-4-neon`), not only the configured Claude [parent model](#parent-model). The starting model
283
+ acts as the orchestrator/coordinator: it runs triage, tracks waves and checks, and delegates
284
+ builders, testers, and auditors along the configured ladders rather than doing all edits itself.
285
+
286
+ Choose a starting model that fits the task and your active quotas (check `t3-auto-build check-models`
287
+ and `t3-auto-build quota status` to avoid models under active provider locks or plan/availability
288
+ restrictions):
289
+
290
+ | Goal / task type | Practical starting models |
291
+ |---|---|
292
+ | Saving primary quota, lightweight triage, or small tasks | `gemini-4-neon`, `gpt-6-luna` |
293
+ | General multi-file or UI orchestration | `claude-sonnet-5-5`, `gemini-4-neon` |
294
+ | Deeper debugging, architecture, or high-risk `L2`/`L3` coordination | `gpt-5.6-terra`, `claude-opus-5-5`, `gemini-4-carbon` |
295
+
296
+ Two practical nuances to keep in mind:
297
+
298
+ - **Hook enforcement scope:** [`pre-tool-use.mjs`](#hooks) enforces allowlist, ban, restriction,
299
+ speed-mode, and cooldown guards on `delegate_task` and guarded tools (`Edit`, `Write`,
300
+ `MultiEdit`, `Bash`), not on T3 Code's UI thread model picker. Choosing a non-allowlisted or
301
+ locked model in the picker is not blocked by the hook itself; enforcement happens when guarded
302
+ tools or `delegate_task` calls run.
303
+ - **Follow-up messages without `$auto-build`:** Subsequent messages in the same thread that omit
304
+ `$auto-build` follow the **Follow-Up Refinement Rule** rather than always launching a fresh full
305
+ `$auto-build` pipeline—questions are answered directly from thread context, `L0` micro-tweaks
306
+ take the fast single-builder path, and only substantive `L1`–`L3` changes re-run the full
307
+ pipeline.
308
+
261
309
  ## CLI
262
310
 
263
311
  ```text
264
312
  t3-auto-build init
265
313
  t3-auto-build upgrade [--yes]
266
- t3-auto-build check-models [--refresh] [--probe-scarce] [--json]
314
+ t3-auto-build check-models [--refresh] [--probe-scarce] [--recheck-locks] [--json]
267
315
  t3-auto-build sync-models [--auto] [--refresh] [--probe-scarce] [--apply]
268
316
  t3-auto-build availability mark <provider:model> <available|plan-restricted|unavailable> [--ttl 24h] [--reason <text>]
269
317
  t3-auto-build availability status
@@ -307,6 +355,7 @@ t3-auto-build uninstall
307
355
  | `--force` | init, sync-models | Back up your changed files to `<file>.bak`, then overwrite. For `sync-models`, this covers a hand-edited `SKILL.md`. |
308
356
  | `--refresh` | check-models, sync-models | Ignore the probe cache TTL. `sync-models` without `--apply` always probes. |
309
357
  | `--probe-scarce` | check-models, sync-models | Also probe scarce-pool models. |
358
+ | `--recheck-locks` | check-models | Recheck every active provider lock now. |
310
359
  | `--json` | check-models | Machine-readable result. |
311
360
  | `--auto` | sync-models | Write without confirmation, like `--yes`. |
312
361
  | `--apply` | sync-models | Promote newer versions from recorded drift. |
@@ -454,7 +503,7 @@ t3-auto-build quota check [provider]
454
503
  pool.
455
504
  - Reset times parsed from rate-limit messages are capped at 14 days. A manual `--until` is not capped.
456
505
  - `status` drops expired locks and prints the rest.
457
- - `clear <provider>` removes its provider and pool locks, not its model locks. `clear <model>`
506
+ - `clear <provider>` (or `clear provider:<provider>`) removes its provider and pool locks, not its model locks. `clear <model>`
458
507
  removes that model's lock. `--all` deletes the file, even a corrupt one.
459
508
  - `check` runs `claude auth status` and `codex login status` (Antigravity has no status command). It
460
509
  reports login state only, unless the output explicitly says usage is exhausted; only then does it
@@ -487,7 +536,7 @@ Legacy `tier:<p>:heavy` keys are still read, and `quota check` or a probe may st
487
536
  ```
488
537
 
489
538
  `scope` is `model`, `provider` or `tier`. `window` is `burst`, `5h`, `weekly` or `custom`. Legacy
490
- `until_utc` is read. A key without a prefix needs a `scope` field, or it locks nothing. A malformed
539
+ `until_utc` is read. Long locks also carry `setAt` and `recheckAfter` (see [lock rechecks](#lock-rechecks)). A key without a prefix needs a `scope` field, or it locks nothing. A malformed
491
540
  entry (such as one without a valid time) is skipped with a warning and kept in the file until it is
492
541
  overwritten or cleared (`quota clear <name>` or `--all`). A file that is not a JSON object is
493
542
  unreadable: hooks warn and ignore it. A write that leaves no entries removes the file.
package/bin/cli.mjs CHANGED
@@ -51,6 +51,7 @@ init only:
51
51
  check-models only:
52
52
  --refresh ignore the probe cache TTL
53
53
  --probe-scarce also probe scarce quota models
54
+ --recheck-locks retest every active provider lock now
54
55
  --json print machine-readable results
55
56
 
56
57
  sync-models only:
@@ -82,11 +83,11 @@ Examples:
82
83
  Overflow to cross-hosted models requires an explicit provider, e.g. antigravity:claude-opus-5-5.`;
83
84
 
84
85
  const VALUE_FLAGS = ['target', 'preset', 'modules', 'compaction', 'tiers', 'providers', 'until', 'reason', 'parent', 'claude-tier', 'codex-tier', 'antigravity-tier', 'ttl', 'pool'];
85
- const SWITCHES = ['yes', 'force', 'help', 'version', 'probe', 'dry-run', 'all', 'auto', 'refresh', 'probe-scarce', 'apply', 'json', 'allow-usage-credits', 'allow-fast-modes', 'verified-org', ...QUOTA_WINDOWS];
86
+ const SWITCHES = ['yes', 'force', 'help', 'version', 'probe', 'dry-run', 'all', 'auto', 'refresh', 'probe-scarce', 'recheck-locks', 'apply', 'json', 'allow-usage-credits', 'allow-fast-modes', 'verified-org', ...QUOTA_WINDOWS];
86
87
  const COMMAND_FLAGS = {
87
88
  init: ['preset', 'modules', 'compaction', 'tiers', 'probe', 'yes', 'force', ...Object.values(TIER_FLAGS).map((f) => f.slice(2)), 'parent', 'allow-usage-credits', 'allow-fast-modes', 'verified-org'],
88
89
  upgrade: ['yes'], doctor: [], uninstall: [],
89
- 'check-models': ['refresh', 'probe-scarce', 'json'],
90
+ 'check-models': ['refresh', 'probe-scarce', 'recheck-locks', 'json'],
90
91
  'sync-models': ['dry-run', 'providers', 'yes', 'auto', 'force', 'refresh', 'probe-scarce', 'apply'],
91
92
  'availability mark': ['ttl', 'reason'], 'availability status': [],
92
93
  'quota set': [...QUOTA_WINDOWS, 'until', 'reason', 'pool'],
@@ -185,10 +186,16 @@ async function init(target, flags) {
185
186
 
186
187
  async function check(target, flags) {
187
188
  const config = rawConfig(target);
188
- const result = await checkModels({ configDir: target, config, refresh: flags.refresh, probeScarce: flags['probe-scarce'] });
189
+ const result = await checkModels({
190
+ configDir: target, config, refresh: flags.refresh, probeScarce: flags['probe-scarce'], recheckLocks: flags['recheck-locks'],
191
+ });
189
192
  if (flags.json) console.log(JSON.stringify(result, null, 2));
190
193
  else {
191
194
  console.log(`availability ${result.stale ? 'stale' : 'fresh'}; probed ${result.probed.length}; skipped scarce ${result.skippedScarce.length}`);
195
+ for (const { ref, status } of result.statuses) console.log(`${ref} ${status}`);
196
+ for (const { key, provider, model, result: outcome } of result.rechecked) {
197
+ console.log(outcome === 'via-t3' ? `recheck-via-t3: ${provider} (${model})` : `rechecked ${key} with ${model}: ${outcome}`);
198
+ }
192
199
  for (const entry of result.availability.discoveredNew ?? []) console.log(`discovered ${entry.provider}:${entry.model}${entry.supersedes ? ` supersedes ${entry.supersedes}` : ' (unknown family)'}`);
193
200
  }
194
201
  }
package/hooks/_quota.mjs CHANGED
@@ -10,6 +10,15 @@ const MINUTE = 60_000;
10
10
  const DAY = 24 * 60 * MINUTE;
11
11
  // A parsed reset time comes from message text, so it can never lock for longer than this.
12
12
  const MAX_LOCK = 14 * DAY;
13
+ export const RECHECK_AFTER = 360 * MINUTE;
14
+
15
+ /** A lock lasting more than RECHECK_AFTER past setAt gets a recheckAfter time; others are returned unchanged. */
16
+ export function withRecheck(entry, now = Date.now()) {
17
+ if (!Number.isNaN(Date.parse(entry.recheckAfter))) return entry;
18
+ const setAt = Date.parse(entry.setAt) || now;
19
+ if (!(Date.parse(entry.until) - setAt > RECHECK_AFTER)) return entry;
20
+ return { ...entry, setAt: new Date(setAt).toISOString(), recheckAfter: new Date(setAt + RECHECK_AFTER).toISOString() };
21
+ }
13
22
 
14
23
  const HEAVY_MODELS = { claude: ['Claude Opus 5.5'], codex: ['gpt-6-luna'], antigravity: ['Gemini 4 Carbon'] };
15
24
  export const SCARCE_POOL = { claude: 'fable', codex: 'astra', antigravity: 'third-party-claude' };
@@ -79,10 +88,11 @@ export function readCooldowns(file, onInvalid = (key) =>
79
88
  * Atomic replace; an empty map removes the file. Invalid entries already in the file are kept as they are,
80
89
  * unless data replaces their key or `remove` names it.
81
90
  */
82
- export function writeCooldowns(file, data, { remove = [] } = {}) {
91
+ export function writeCooldowns(file, data, { remove = [], now = Date.now() } = {}) {
83
92
  const invalid = Object.entries(readRaw(file))
84
93
  .filter(([key, value]) => !Object.hasOwn(data, key) && !remove.includes(key) && !isValid(key, value));
85
- const entries = { ...canonicalAll(data), ...Object.fromEntries(invalid) };
94
+ const stamped = Object.entries(canonicalAll(data)).map(([key, entry]) => [key, withRecheck(entry, now)]);
95
+ const entries = Object.fromEntries([...stamped, ...invalid]);
86
96
  if (Object.keys(entries).length === 0) {
87
97
  fs.rmSync(file, { force: true });
88
98
  return;
package/hooks/_shared.mjs CHANGED
@@ -91,6 +91,9 @@ export const PROVIDER_ALIASES = new Map([
91
91
  ['claudeagent', 'claude'], ['claude', 'claude'], ['codex', 'codex'], ['antigravity', 'antigravity'],
92
92
  ]);
93
93
 
94
+ /** Like canonicalProvider without the prefix match: custom instances and model names are null. */
95
+ export const exactProvider = (id) => PROVIDER_ALIASES.get(String(id).toLowerCase().replace(/[^a-z0-9]/g, '')) ?? null;
96
+
94
97
  /** 'claude' | 'codex' | 'antigravity' from a provider or instance id, else null. */
95
98
  export function canonicalProvider(id) {
96
99
  if (typeof id !== 'string') return null;
package/lib/discover.mjs CHANGED
@@ -4,13 +4,13 @@ import fs from 'node:fs';
4
4
  import os from 'node:os';
5
5
  import path from 'node:path';
6
6
  import {
7
- AVAILABILITY_FILE, COOLDOWN_FILE, RETIRED_MODELS, canonicalProvider, inferProvider, isBanned, isObject, isStringList,
8
- matchRetired, modelKeys, normalizeModel, readAvailability, warn, which as findOnPath,
7
+ AVAILABILITY_FILE, COOLDOWN_FILE, RETIRED_MODELS, canonicalProvider, exactProvider, inferProvider, isBanned, isObject, isStringList,
8
+ matchRetired, modelKeys, normalizeModel, readAvailability, restrictedBy, warn, which as findOnPath,
9
9
  } from '../hooks/_shared.mjs';
10
- import { prune, readCooldowns, writeCooldowns } from '../hooks/_quota.mjs';
10
+ import { isLocked, prune, readCooldowns, RECHECK_AFTER, withRecheck, writeCooldowns } from '../hooks/_quota.mjs';
11
11
  import { CliError } from './paths.mjs';
12
- import { MODELS, PROVIDERS, supersedes } from './plans.mjs';
13
- import { probeModels } from './probe.mjs';
12
+ import { cheapestModel, MODELS, PROVIDERS, supersedes } from './plans.mjs';
13
+ import { PROBES, probeModels } from './probe.mjs';
14
14
 
15
15
  const UNIT_MS = { m: 60_000, h: 3_600_000, d: 86_400_000 };
16
16
  const MAX_TTL = 30 * UNIT_MS.d;
@@ -248,7 +248,7 @@ function put(models, provider, model, entry, now) {
248
248
  models[`${provider}:${model}`] = entry;
249
249
  }
250
250
 
251
- /** Drops expired locks and adds new ones without ever shortening an existing lock. */
251
+ /** Drops expired locks, adds new ones without ever shortening an existing lock, and stamps missing recheck times. */
252
252
  function updateCooldowns(configDir, now, locks = []) {
253
253
  const file = path.join(configDir, COOLDOWN_FILE);
254
254
  let stored;
@@ -265,15 +265,93 @@ function updateCooldowns(configDir, now, locks = []) {
265
265
  kept[key] = entry;
266
266
  added += 1;
267
267
  }
268
- if (added || Object.keys(removed).length > 0) writeCooldowns(file, kept, { remove: Object.keys(removed) });
268
+ const unstamped = Object.values(kept).some((entry) => withRecheck(entry, now) !== entry);
269
+ if (added || unstamped || Object.keys(removed).length > 0) {
270
+ writeCooldowns(file, kept, { remove: Object.keys(removed), now });
271
+ }
272
+ }
273
+
274
+ const isExcluded = (model, config) => matchRetired(model, retiredPatterns(config)) || isBanned(model, bannedTerms(config));
275
+
276
+ /** "plan-restricted" or "unavailable" when the config or a live availability entry blocks the model, else null. */
277
+ function restriction(config, availability, provider, model, now) {
278
+ const refs = list(config?.planRestrictedModels);
279
+ if (refs.includes(model) || refs.includes(`${provider}:${model}`)) return 'plan-restricted';
280
+ return restrictedBy(availability, provider, model, now)?.status ?? null;
281
+ }
282
+
283
+ /** The stored locks, or {} when the file cannot be read (updateCooldowns has already warned). */
284
+ function storedCooldowns(configDir) {
285
+ try {
286
+ return readCooldowns(path.join(configDir, COOLDOWN_FILE), () => {});
287
+ } catch {
288
+ return {};
289
+ }
290
+ }
291
+
292
+ /**
293
+ * Tests provider locks that are due (all of them when force is set) against the cheapest standard model. Without a
294
+ * probeable local CLI the lock is left for the orchestrator ("via-t3"). Model and pool locks are not rechecked: a
295
+ * cheap standard model proves nothing about them.
296
+ */
297
+ async function recheckLocks({ configDir, config, binaries, force, now, runner, which, probe }) {
298
+ const outcomes = [];
299
+ for (const [key, entry] of Object.entries(storedCooldowns(configDir))) {
300
+ const provider = entry.scope === 'provider' ? exactProvider(key.replace(/^provider:/i, '')) : null;
301
+ if (!provider || !(Date.parse(entry.until) > now)) continue;
302
+ if (!force && !(Date.parse(entry.recheckAfter) <= now)) continue;
303
+ const availability = readAvailabilityFile(configDir);
304
+ // A model under its own model or pool lock is no test of the provider, and the hook would block its canary.
305
+ const narrower = Object.fromEntries(Object.entries(storedCooldowns(configDir))
306
+ .filter(([, other]) => other.scope !== 'provider'));
307
+ const model = cheapestModel(provider, configuredModels(config)
308
+ .filter((item) => item.provider === provider && !item.scarceQuota && !isExcluded(item.model, config)
309
+ && !restriction(config, availability, provider, item.model, now)
310
+ && !isLocked(narrower, { provider, model: item.model, config }, now))
311
+ .map((item) => item.model));
312
+ if (!model) continue;
313
+ if (!binaries[provider]?.found || !Object.hasOwn(PROBES, provider)) {
314
+ outcomes.push({ key, provider, model, result: 'via-t3' });
315
+ continue;
316
+ }
317
+ const { results } = await probe({ config, candidates: { [provider]: [model] }, runner, which, now });
318
+ const cleared = results[0]?.state === 'available';
319
+ // Read again: a lock replaced while the probe ran is left alone.
320
+ const current = storedCooldowns(configDir);
321
+ if (current[key]?.until !== entry.until) continue;
322
+ if (cleared) delete current[key];
323
+ else current[key] = { ...current[key], recheckAfter: new Date(now + RECHECK_AFTER).toISOString() };
324
+ writeCooldowns(path.join(configDir, COOLDOWN_FILE), current, { remove: cleared ? [key] : [], now });
325
+ outcomes.push({ key, provider, model, result: cleared ? 'cleared' : 'still-locked' });
326
+ }
327
+ return outcomes;
328
+ }
329
+
330
+ /** One status per configured model; a model nothing speaks against counts as available. */
331
+ function modelStatuses({ configDir, config, availability, results, probeScarce, now }) {
332
+ const cooldowns = storedCooldowns(configDir);
333
+ return configuredModels(config).map(({ provider, model, scarceQuota }) => {
334
+ const ref = `${provider}:${model}`;
335
+ const result = results.find((r) => canonicalProvider(r.provider) === provider && r.model === model);
336
+ // A failed probe (no CLI, logged out, timeout) blocks nothing, so it never reports "unavailable".
337
+ const cached = availability.models[ref]?.status;
338
+ const status = restriction(config, availability, provider, model, now)
339
+ || (isExcluded(model, config) && 'unavailable')
340
+ || (isLocked(cooldowns, { provider, model, config }, now) && 'rate-limited')
341
+ || (result?.state === 'rate-limited' && 'rate-limited')
342
+ || (STATUSES.includes(cached) && cached)
343
+ || (scarceQuota && !probeScarce ? 'skipped-scarce' : 'available');
344
+ return { ref, status };
345
+ });
269
346
  }
270
347
 
271
348
  /** Configured models worth spending a probe on, grouped by provider, and the scarce ones left out. */
272
- function probeCandidates(config, probeScarce) {
349
+ function probeCandidates(config, probeScarce, cooldowns, now) {
273
350
  const candidates = {};
274
351
  const skippedScarce = [];
275
352
  for (const { provider, model, scarceQuota } of configuredModels(config)) {
276
- if (matchRetired(model, retiredPatterns(config)) || isBanned(model, bannedTerms(config))) continue;
353
+ // A locked model is left to recheckLocks: probing it again would spend quota and could extend the lock.
354
+ if (isExcluded(model, config) || isLocked(cooldowns, { provider, model, config }, now)) continue;
277
355
  if (scarceQuota && !probeScarce) skippedScarce.push(`${provider}:${model}`);
278
356
  else (candidates[provider] ??= []).push(model);
279
357
  }
@@ -285,18 +363,21 @@ function probeCandidates(config, probeScarce) {
285
363
  * checkedAt dates the last probe run, so discovery alone never keeps the cache fresh.
286
364
  */
287
365
  export async function checkModels({
288
- configDir, config, refresh = false, probeScarce = false, ttlMs = CACHE_TTL, now = Date.now(), runner, which,
289
- probe = probeModels,
366
+ configDir, config, refresh = false, probeScarce = false, recheckLocks: force = false, ttlMs = CACHE_TTL,
367
+ now = Date.now(), runner, which, probe = probeModels,
290
368
  } = {}) {
291
369
  updateCooldowns(configDir, now);
292
370
  const found = await discover({ config, runner, which, now });
371
+ const rechecked = await recheckLocks({
372
+ configDir, config, binaries: found.binaries, force, now, runner, which, probe,
373
+ });
293
374
  const checkedAt = readAvailabilityFile(configDir)?.checkedAt;
294
375
  const stale = !(now - Date.parse(checkedAt) <= ttlMs);
295
376
  const probing = stale || refresh;
296
377
  let results = [];
297
378
  let skippedScarce = [];
298
379
  if (probing) {
299
- const selected = probeCandidates(config, probeScarce);
380
+ const selected = probeCandidates(config, probeScarce, storedCooldowns(configDir), now);
300
381
  skippedScarce = selected.skippedScarce;
301
382
  ({ results } = await probe({
302
383
  config, candidates: selected.candidates, probeScarce, runner, which, now,
@@ -325,7 +406,8 @@ export async function checkModels({
325
406
  missingConfigured: found.missingConfigured,
326
407
  });
327
408
  const probed = results.filter((r) => !r.skipped).map((r) => `${canonicalProvider(r.provider)}:${r.model}`);
328
- return { availability, probed, skippedScarce, stale };
409
+ const statuses = modelStatuses({ configDir, config, availability, results, probeScarce, now });
410
+ return { availability, probed, skippedScarce, stale, statuses, rechecked };
329
411
  }
330
412
 
331
413
  /** Records a manual status for one hosting of a model, effective immediately and until the ttl ends. */
package/lib/plans.mjs CHANGED
@@ -29,6 +29,8 @@ export const MODELS = deepFreeze({
29
29
  'gpt-6.1-terra': model('codex', 'gpt-terra', '6.1'),
30
30
  'gpt-6.1-sol': model('codex', 'gpt-sol', '6.1'),
31
31
  'gpt-6-astra': model('codex', 'gpt-astra', '6', 'astra'),
32
+ 'gpt-5.6-terra': model('codex', 'gpt-terra', '5.6'),
33
+ 'gpt-5.6-luna': model('codex', 'gpt-luna', '5.6'),
32
34
  'gemini-4-hydrogen': model('antigravity', 'gemini-hydrogen', '4'),
33
35
  'gemini-4-neon': model('antigravity', 'gemini-neon', '4'),
34
36
  'gemini-4-carbon': model('antigravity', 'gemini-carbon', '4'),
@@ -44,11 +46,11 @@ const PREFERENCE = {
44
46
  auditor: ['claude-opus-5-5', 'claude-sonnet-5-5', 'claude-fable-5-2'],
45
47
  },
46
48
  codex: {
47
- triage: ['gpt-6-luna', 'gpt-6.1-terra'],
48
- planner: ['gpt-6.1-sol', 'gpt-6.1-terra', 'gpt-6-luna', 'gpt-6-astra'],
49
- builder: ['gpt-6.1-terra', 'gpt-6.1-sol', 'gpt-6-luna', 'gpt-6-astra'],
50
- tester: ['gpt-6-luna', 'gpt-6.1-terra', 'gpt-6.1-sol', 'gpt-6-astra'],
51
- auditor: ['gpt-6.1-sol', 'gpt-6.1-terra', 'gpt-6-luna', 'gpt-6-astra'],
49
+ triage: ['gpt-6-luna', 'gpt-6.1-terra', 'gpt-5.6-luna', 'gpt-5.6-terra'],
50
+ planner: ['gpt-6.1-sol', 'gpt-6.1-terra', 'gpt-5.6-terra', 'gpt-6-luna', 'gpt-5.6-luna', 'gpt-6-astra'],
51
+ builder: ['gpt-6.1-terra', 'gpt-6.1-sol', 'gpt-5.6-terra', 'gpt-6-luna', 'gpt-5.6-luna', 'gpt-6-astra'],
52
+ tester: ['gpt-6-luna', 'gpt-6.1-terra', 'gpt-6.1-sol', 'gpt-5.6-luna', 'gpt-5.6-terra', 'gpt-6-astra'],
53
+ auditor: ['gpt-6.1-sol', 'gpt-6.1-terra', 'gpt-5.6-terra', 'gpt-6-luna', 'gpt-5.6-luna', 'gpt-6-astra'],
52
54
  },
53
55
  antigravity: {
54
56
  triage: ['gemini-4-hydrogen', 'gemini-4-neon'],
@@ -131,13 +133,13 @@ function claudeTiers() {
131
133
  function codexTiers() {
132
134
  const base = ['gpt-6-luna', 'gpt-6.1-terra'];
133
135
  const all = [...base, 'gpt-6.1-sol', 'gpt-6-astra'];
134
- const desktopOnly = 'desktop-only; Codex CLI unavailable';
136
+ const starter = ['gpt-6-luna', 'gpt-5.6-terra', 'gpt-5.6-luna'];
135
137
  const make = (id, label, options) => tier('codex', id, label, options);
136
138
  const full = (id, label, builders) => make(id, label, { ids: all, builders, subCaps: { astra: 'weekly' } });
137
139
  return [
138
140
  make('none', 'No Codex plan'),
139
- make('free', 'ChatGPT Free', { warning: desktopOnly }),
140
- make('go', 'ChatGPT Go', { warning: desktopOnly }),
141
+ make('free', 'ChatGPT Free', { ids: starter, builders: 1 }),
142
+ make('go', 'ChatGPT Go', { ids: starter, builders: 1 }),
141
143
  make('plus', 'ChatGPT Plus', { ids: base, builders: 1 }),
142
144
  full('pro-100', 'ChatGPT Pro $100', 2),
143
145
  full('pro-200', 'ChatGPT Pro $200', 2),
@@ -169,6 +171,13 @@ const byId = (tiers) => Object.fromEntries(tiers.map((t) => [t.id, t]));
169
171
 
170
172
  export const CATALOG = deepFreeze({ claude: byId(claudeTiers()), codex: byId(codexTiers()), antigravity: byId(antigravityTiers()) });
171
173
 
174
+ /** The provider's cheapest (triage order) standard-pool model among ids, else null. */
175
+ export function cheapestModel(provider, ids) {
176
+ // Models outside the triage list rank last, in the given order.
177
+ const rank = (id) => (PREFERENCE[provider].triage.indexOf(id) + 1) || Number.MAX_SAFE_INTEGER;
178
+ return ids.filter((id) => !MODELS[id]?.scarceQuota).sort((a, b) => rank(a) - rank(b))[0] ?? null;
179
+ }
180
+
172
181
  export function getTier(provider, tierId) {
173
182
  if (!PROVIDERS.includes(provider)) throw new Error(`unknown provider "${provider}"; expected one of ${PROVIDERS.join(', ')}`);
174
183
  if (!Object.hasOwn(CATALOG[provider], tierId)) {
package/lib/probe.mjs CHANGED
@@ -17,7 +17,7 @@ const TIMEOUT = 20_000;
17
17
 
18
18
  // Flags confirmed by `claude --help` and `codex exec --help`: one-word prompt, no tools or writes, nothing saved.
19
19
  // There is no documented Antigravity probe. The prompt has no spaces so it survives a cmd.exe shim.
20
- const PROBES = {
20
+ export const PROBES = {
21
21
  claude: (id) => ['-p', 'ok', '--model', id, '--tools', '', '--safe-mode', '--no-session-persistence', '--output-format', 'text'],
22
22
  codex: (id) => ['exec', '--model', id, '--sandbox', 'read-only', '--ephemeral', '--skip-git-repo-check',
23
23
  '--ignore-user-config', '--ignore-rules', '--color', 'never', 'ok'],
package/lib/quota.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import fs from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import {
5
- COOLDOWN_FILE, canonicalProvider, cliModelId, inferProvider, loadConfig, modelKeys, normalizeModel, which as findOnPath,
5
+ COOLDOWN_FILE, canonicalProvider, cliModelId, exactProvider, inferProvider, loadConfig, modelKeys, normalizeModel, which as findOnPath,
6
6
  } from '../hooks/_shared.mjs';
7
7
  import { isLocked, parseRateLimit, prune, readCooldowns, SCARCE_POOL, writeCooldowns } from '../hooks/_quota.mjs';
8
8
  import { HEAVY_MODELS } from './detect.mjs';
@@ -111,7 +111,7 @@ export function quotaSet(target, subject, { window, until, reason, pool, heavy =
111
111
  scope, window: span, until: limit.until, reason: reason ?? `manual lock (${span})`, source: 'manual',
112
112
  ...(scope === 'tier' && { tier: poolKey }),
113
113
  };
114
- writeCooldowns(cooldownPath(target), { ...prune(load(target), now).kept, [key]: entry });
114
+ writeCooldowns(cooldownPath(target), { ...prune(load(target), now).kept, [key]: entry }, { now });
115
115
  log(`locked ${key} until ${entry.until} (${span})`);
116
116
  return { key, entry };
117
117
  }
@@ -130,7 +130,7 @@ function countdown(ms) {
130
130
  /** Drops expired locks and prints the rest. Returns the active ones. */
131
131
  export function quotaStatus(target, { now = Date.now(), log = console.log } = {}) {
132
132
  const { kept, removed } = prune(load(target), now);
133
- if (Object.keys(removed).length) writeCooldowns(cooldownPath(target), kept);
133
+ if (Object.keys(removed).length) writeCooldowns(cooldownPath(target), kept, { now });
134
134
  const locks = Object.entries(kept).map(([key, entry]) => ({ key, ...entry }));
135
135
  if (!locks.length) log('no active cooldowns');
136
136
  for (const { key, window, until, reason, source } of locks) {
@@ -148,7 +148,9 @@ export function quotaClear(target, subject, { log = console.log } = {}) {
148
148
  return null;
149
149
  }
150
150
  const config = loadConfig(target);
151
- const targetRef = resolveSubject(subject, config);
151
+ // "provider:<p>" is the lock key as quota status prints it.
152
+ const named = String(subject ?? '').trim().replace(/^provider:/i, '');
153
+ const targetRef = resolveSubject(exactProvider(named) ? named : subject, config);
152
154
  const { provider, model, qualified } = targetRef;
153
155
  const bad = [];
154
156
  const data = load(target, (key) => bad.push(key));
@@ -159,7 +161,7 @@ export function quotaClear(target, subject, { log = console.log } = {}) {
159
161
  }]);
160
162
  const removed = [...Object.entries(data), ...stubs].filter(([key, entry]) => {
161
163
  if (provider && !model && entry.scope === 'tier') return key.toLowerCase().startsWith(`tier:${provider}:`);
162
- if (provider && !model && entry.scope === 'provider') return key.toLowerCase() === `provider:${provider}`;
164
+ if (provider && !model && entry.scope === 'provider') return exactProvider(key.replace(/^provider:/i, '')) === provider;
163
165
  if (model && entry.scope === 'tier') return false;
164
166
  if (model && entry.scope === 'model' && qualified) {
165
167
  return key.toLowerCase() === `model:${provider}:${targetRef.id}` || key.toLowerCase() === `model:${targetRef.id}`;
@@ -234,7 +236,7 @@ export async function quotaCheck(target, { providers, runner, which = findOnPath
234
236
  // An existing lock that lasts longer is never shortened.
235
237
  const longer = Object.entries(locks).filter(([key, { until }]) => !(Date.parse(stored[key]?.until) >= Date.parse(until)));
236
238
  const next = { ...stored, ...Object.fromEntries(longer) };
237
- writeCooldowns(cooldownPath(target), next);
239
+ writeCooldowns(cooldownPath(target), next, { now });
238
240
  for (const key of Object.keys(locks)) log(`${key}: usage exhausted; locked until ${next[key].until}`);
239
241
  } catch (error) {
240
242
  log(`warning: lockout not recorded: ${error.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "t3-auto-build",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Cross-platform installer and $auto-build orchestration suite for T3 Code: subscription-aware cross-provider routing with quota and availability tracking.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -3,7 +3,7 @@ name: auto-build
3
3
  description: Smart-lean multi-model orchestrator for T3 Code using delegate_task with shared REPO_BRIEF and cached repo-profile, task-shape/risk L0-L3 routing, wave-based parallel builds, resumable state, diff-scoped BLOCKER/NIT audits, strict output budgets, targeted-first tests, lint-gated L3 dual audit, opposite-provider blind edge-case tests, evidence-only rejections, oscillation escalation, follow-up auto-scaling, full inline flag controls, cross-thread quota lockouts, and full-spectrum cross-provider failover across {{modelCount}} allowlisted models.
4
4
  ---
5
5
 
6
- You are the autonomous orchestrator for T3 Code. Execute the full pipeline using native `delegate_task` calls without pausing to ask the user between steps (unless `--plan-only` or `--dry-run` is specified).
6
+ You are the autonomous orchestrator for T3 Code, regardless of which allowlisted model started this thread. Coordinate the run and execute the full pipeline using native `delegate_task` calls along the configured ladders (rather than doing implementation edits yourself) without pausing to ask the user between steps (unless `--plan-only` or `--dry-run` is specified).
7
7
 
8
8
  Rendered by t3-auto-build from `{{configPath}}`. Edit that file and re-run `t3-auto-build init` instead of editing this skill.
9
9
 
@@ -75,7 +75,7 @@ Select models by **Work Shape** and **Pipeline Role**, walking the full cross-pr
75
75
  Lockouts persist across threads in `{{cooldownsPath}}`, combined with an in-run `EXHAUSTED` list:
76
76
  - **Keys:** `model:<id>` (all hostings) | `model:<provider>:<id>` (that hosting only) | `provider:<p>` | `tier:<p>:<pool>` (scarce pools `fable`, `astra`, `third-party-claude`; legacy `tier:<p>:heavy` is still read). Model ids may be display names.
77
77
  - **Entry:** `{ "scope": "model|provider|tier", "window": "burst|5h|weekly|custom", "until": "<ISO-8601 UTC>", "reason": "<short reason>", "source": "<who recorded it>" }`. Legacy entries (bare model/provider key with `scope` and `until_utc`) are still read.
78
- - **Locked means unavailable:** An unexpired entry removes every model it covers from every ladder (a hook blocks locked models). Never retry or override a lock.
78
+ - **Locked means unavailable:** An unexpired entry removes every model it covers from every ladder (a hook blocks locked models). Never retry or override a lock, except for the `recheck-via-t3` canary in Step 0.
79
79
 
80
80
  1. **Permanent Plan Errors** (model not in the plan/subscription, not entitled, unknown or unsupported model): Add to `EXHAUSTED`, fail over immediately, record NO cooldown, run `t3-auto-build availability mark <provider:model> plan-restricted --ttl 24h`, and advise the user to run `t3-auto-build sync-models`.
81
81
  2. **Quota & Rate Limits:** Classify the error and record it with `t3-auto-build quota set <provider|model|provider:model> --burst|--5h|--weekly`:
@@ -89,6 +89,7 @@ Lockouts persist across threads in `{{cooldownsPath}}`, combined with an in-run
89
89
 
90
90
  ### Step 0: Lockout Check, Baseline Snapshot & Resume
91
91
  1. **Before any delegation:** Apply `--reset-cooldowns` if present, then run `t3-auto-build check-models` (every run; TTL-cached and fast; never add `--probe-scarce` unless the user asked), `t3-auto-build quota status` (and `t3-auto-build quota check` if available). CLI not on PATH: read `{{availabilityPath}}` and `{{cooldownsPath}}` directly and ignore expired entries. Automatically skip every locked, `plan-restricted` or `unavailable` model and every provider at 0% remaining quota. Show the subscriptions in the run plan: {{subscriptionSummary}}.
92
+ - **`recheck-via-t3: <provider> (<model>)`** (a long provider lock is due and has no local CLI probe; skip under `--dry-run` or when a `--*-only` flag excludes the provider): note the `until` of the lock and of any `tier:<provider>:<pool>` lock from `t3-auto-build quota status`, run `t3-auto-build quota clear provider:<provider>`, restore each pool lock (`t3-auto-build quota set <provider> --pool <pool> --until <noted until>`), then send one canary `delegate_task` (that provider and model, `low` effort, prompt `Reply with one word: ok`). Only if it fails with a rate or usage limit, re-lock with `t3-auto-build quota set <provider> --until <noted until, or a later reset time from the error>`; any other outcome leaves it cleared (handle plan errors as in section 4).
92
93
  2. Run `git status --short` to record pre-existing modified/untracked files.
93
94
  3. **`--resume`:** Read `.claude/auto-build-state.json`, restore its `flags` (newly typed flags win), skip `completedWaves`, keep `modifiedFiles` in this run's diff scope, and continue with `remaining` and `blockers` (rebuild `REPO_BRIEF` first). If the file is missing or invalid, say so and stop.
94
95
  - **State File (runs that edit code, plus `--plan-only`):** After each wave/step, overwrite `.claude/auto-build-state.json` with compact JSON `{"flags":[],"completedWaves":[],"modifiedFiles":[],"remaining":[],"blockers":[]}` (`remaining` names each pending wave/step and its files). Ensure it is gitignored: if `git check-ignore -q` on it fails, append its path to the file printed by `git rev-parse --git-path info/exclude`.