From 6f5bfd898247e21f28342ac052da9d33bbc5fdd8 Mon Sep 17 00:00:00 2001 From: Darknode-Official Date: Wed, 11 Nov 2026 13:24:11 -0800 Subject: [PATCH] Neutral model wording in /cheap and the docs - /cheap description no longer says "vs Opus". - /cheap status compares your measured tokens with the latest model of every other family, cheapest first, instead of only Opus 5.5 and Opus 5. - The engine overview no longer calls the claude engine "strongest". --- darknode.js | 6 +++--- docs/NEXUS-COMMANDS.md | 4 ++-- lib/nexus/cheap.js | 14 +++++++++----- lib/nexus/pricing.js | 2 +- test/run.js | 5 +++-- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/darknode.js b/darknode.js index b198fef..5bf7a1f 100755 --- a/darknode.js +++ b/darknode.js @@ -1523,7 +1523,7 @@ const { coderShell } = require("./lib/nexus/shell-run"); // ---------- Nexus documentation (shared by `darknode docs` and the TUI /docs browser) ---------- const NEXUS_DOCS = { __proto__: null, overview: { title: "Overview", body: - "Nexus is a terminal AI coding agent built into the Darknode CLI. It drives one of six\nengines from a single dependency-free binary:\n claude — the Claude Code CLI in the cloud (strongest; needs `claude` installed + logged in)\n gemini · codex · opencode · aider — those vendors' CLIs, same interface\n ollama — a free, private, local model on your machine (needs Ollama)\n\nIt reads & writes files, runs commands, checkpoints every change, shows real token cost\nlive, saves tokens by delegating cheap work to a weaker/local model, and keeps secrets off\nthe cloud. Launch it with `darknode nexus --tui`. Type / inside for the command menu." }, + "Nexus is a terminal AI coding agent built into the Darknode CLI. It drives one of six\nengines from a single dependency-free binary:\n claude — the Claude Code CLI (needs `claude` installed + logged in)\n gemini · codex · opencode · aider — those vendors' CLIs, same interface\n ollama — a free, private, local model on your machine (needs Ollama)\n\nIt reads & writes files, runs commands, checkpoints every change, shows real token cost\nlive, saves tokens by delegating cheap work to a weaker/local model, and keeps secrets off\nthe cloud. Launch it with `darknode nexus --tui`. Type / inside for the command menu." }, quickstart: { title: "Quick start", body: " darknode init scaffold .nexus/ (project context Nexus reads each session)\n darknode nexus --tui full-screen agent (Claude if installed, else local)\n darknode nexus --tui -e ollama drive a 100% local, private, free agent\n darknode nexus \"add tests to server.js and run them\" one-shot task\n\nFree local setup:\n curl -fsSL https://ollama.com/install.sh | sh\n ollama pull gpt-oss:20b # fast local agent (~14GB); pull gpt-oss:120b for max power (~63GB)" }, engines: { title: "Engines & models", body: @@ -3033,7 +3033,7 @@ function nexusTui(engine, cwd, nexusMd, autoResume, launch) { ["/ensemble", "all engines answer, then synthesize the best"], ["/settings", "all options, neatly arranged (alias /options /config)"], ["/jobs", "background commands the agent started (run_background)"], ["/loop", "autonomous goal loop: /loop [-n rounds] until GOAL-DONE"], ["/team", "multi-model workspace: architect + builder + reviewer, loops to PASS"], ["/policy", "show the enterprise security policy (org + local)"], ["/audit", "audited tool actions · /audit verify (tamper check)"], ["/bench", "speed / tokens / cost table per engine"], ["/explain", "explain the diff or a file in plain English"], ["/test", "generate & run unit tests for a file"], ["/refactor", "restructure code for clarity without changing behavior"], ["/migrate", "migrate code: /migrate to "], ["/pr", "AI-write a PR title+body from the diff and open it (gh)"], ["/index", "index the repo for code search; /index finds the code it is about"], ["/map", "show the repo map; /map ranks it for a task; /map on|off"], ["/verify", "detect + run this project's tests/build"], ["/radar", "codebase complexity + hotspot map"], ["/review-fast", "fast rule-based review of changed code (no AI)"], ["/diffexplain", "explain the current git diff"], ["/testgen", "scaffold tests for a function/file"], ["/snippet", "save / use a prompt macro"], ["/snippets", "list saved prompt macros"], ["/plan", "make & run an editable task checklist"], ["/git", "branch, status & recent commits"], ["/blame", "who last changed a file's lines"], - ["/cowork", "strong model codes, weak model does cheap work"], ["/cheap", "lossless savers + measured spend vs Opus · /cheap status · /cheap off"], ["/tight", "surgical edits — change only what differs (lossless)"], ["/lean", "ask for minimal output (saves output tokens) · /lean on|off"], ["/style", "output style: concise·explanatory·review·tdd·secure·teacher"], ["/effort", "claude thinking level — interactive slider (or low|medium|high|xhigh|max|ultracode)"], ["/estimate", "rough token/cost of a prompt before sending"], ["/fallback", "auto-switch model on rate-limit"], + ["/cowork", "strong model codes, weak model does cheap work"], ["/cheap", "lossless savers + measured spend · /cheap status · /cheap off"], ["/tight", "surgical edits — change only what differs (lossless)"], ["/lean", "ask for minimal output (saves output tokens) · /lean on|off"], ["/style", "output style: concise·explanatory·review·tdd·secure·teacher"], ["/effort", "claude thinking level — interactive slider (or low|medium|high|xhigh|max|ultracode)"], ["/estimate", "rough token/cost of a prompt before sending"], ["/fallback", "auto-switch model on rate-limit"], ["/guard", "preflight destructive commands (enforce|warn|off)"], ["/permissions", "allow/deny tool rules — /allow /deny "], ["/impact", "same as /savings — cost-savings analysis"], ["/savings", "cross-session cost-savings analysis + 30d projection"], ["/cache", "serve exact-repeat read-only answers free (on/off/clear)"], ["/models", "list cloud & local models"], ["/api", "drive ANY model via an OpenAI-compatible API (OpenRouter, Groq, …)"], ["/recent", "recently changed files"], ["/keys", "keyboard shortcuts"], ["/docs", "Nexus docs: /docs or /docs to search every command & key"], ["/gaps", "list TODO/FIXME markers · /gaps plan"], ["/dream", "consolidate the session into NEXUS.md memory"], ["/tree", "show the project file tree"], ["/theme", "change the color theme"], ["/color", "set the accent color · /color · /color reset"], ["/colors", "list accent colors"], ["/gradient", "set the logo gradient · /gradient "], ["/mouse", "toggle mouse capture · /mouse off to select & copy text"], @@ -5947,7 +5947,7 @@ function nexusTui(engine, cwd, nexusMd, autoResume, launch) { if (cacheOn && tightEdits && cheapSide && engine === "claude") Cheap.refreshUse(NHOME).catch(() => {}); const trimmed = Object.keys(Cheap.overridesFor(NHOME, cwd) || {}).length; const isClaude = engine === "claude", localOnly = isClaude ? gray(" (local engines only)") : "", spend = isClaude ? Cheap.spendReport(sess.byModel) : null, usd = (n) => "$" + n.toFixed(n < 1 ? 4 : 2); - const measured = !isClaude ? "" : !spend ? "\n " + gray("no claude usage measured yet this session — send a message, then /cheap status") : "\n measured on " + cyan(spend.model) + ": " + fmtK(spend.read) + " read from cache (" + Math.round(spend.hitRate * 100) + "%), " + fmtK(spend.written) + " written, " + fmtK(spend.output) + " output = " + bold(usd(spend.cost)) + gray(" at list price") + "\n " + gray("same tokens on Opus 5.5: " + usd(spend.opus55) + " · on Opus 5: " + usd(spend.opus5) + (onPlan(engine) ? " · on a subscription these are list-price equivalents" : "")); + const measured = !isClaude ? "" : !spend ? "\n " + gray("no claude usage measured yet this session — send a message, then /cheap status") : "\n measured on " + cyan(spend.model) + ": " + fmtK(spend.read) + " read from cache (" + Math.round(spend.hitRate * 100) + "%), " + fmtK(spend.written) + " written, " + fmtK(spend.output) + " output = " + bold(usd(spend.cost)) + gray(" at list price") + "\n " + gray("same tokens on other models: " + spend.others.map((o) => o.label + " " + usd(o.cost)).join(" · ") + (onPlan(engine) ? " · on a subscription these are list-price equivalents" : "")); const lossy = [["lean", lean], ["minimizeCalls", minimizeCalls], ["stepCap", stepCap], ["trimOutput", trimOutput], ["autoCompact", autoCompact]].filter((x) => x[1]).map((x) => x[0]); transcript.push({ role: "system", text: "cheap mode " + (on ? green("ON") : sub === "off" ? red("OFF") : yellow("PARTIAL")) + " — token savers that keep full quality (" + green("●") + " on " + gray("○") + " off " + cyan("◆") + " always on):\n" + [ row(tightEdits, "surgical edits — change only what differs, never rewrite whole lines"), diff --git a/docs/NEXUS-COMMANDS.md b/docs/NEXUS-COMMANDS.md index 1970886..fb72e3e 100644 --- a/docs/NEXUS-COMMANDS.md +++ b/docs/NEXUS-COMMANDS.md @@ -152,7 +152,7 @@ File tools are confined to the project folder; secrets are blocked from being wr - `/git` — branch, status & recent commits - `/blame` — who last changed a file's lines - `/cowork` — strong model codes, weak model does cheap work -- `/cheap` — lossless savers + measured spend vs Opus · /cheap status · /cheap off +- `/cheap` — lossless savers + measured spend · /cheap status · /cheap off - `/tight` — surgical edits — change only what differs (lossless) - `/lean` — ask for minimal output (saves output tokens) · /lean on|off - `/style` — output style: concise·explanatory·review·tdd·secure·teacher @@ -320,7 +320,7 @@ File tools are confined to the project folder; secrets are blocked from being wr ``` Nexus is a terminal AI coding agent built into the Darknode CLI. It drives one of six engines from a single dependency-free binary: - claude — the Claude Code CLI in the cloud (strongest; needs `claude` installed + logged in) + claude — the Claude Code CLI (needs `claude` installed + logged in) gemini · codex · opencode · aider — those vendors' CLIs, same interface ollama — a free, private, local model on your machine (needs Ollama) diff --git a/lib/nexus/cheap.js b/lib/nexus/cheap.js index 8730a08..a304ace 100644 --- a/lib/nexus/cheap.js +++ b/lib/nexus/cheap.js @@ -8,11 +8,10 @@ // ============================================================================ const fs = require("fs"), path = require("path"); -const { costOf, priceOf, claudeKey } = require("./pricing"); +const { costOf, priceOf, claudeKey, CLAUDE_LATEST } = require("./pricing"); const HOUR_MS = 60 * 60 * 1000; const HOLD_MS = 60 * 1000; // repeat the same /model within this window to confirm -const OPUS_55 = "claude-opus-5-5", OPUS_5 = "claude-opus-5"; // Settings /cheap changes; /cheap off puts these back. Effort is deliberately // absent: it is the user's choice, and clearing it can raise spend. @@ -128,8 +127,13 @@ function mainBucket(byModel) { return best; } -// Real tokens, priced for the model used and for the Opus models on the same -// tokens. Returns null until something was measured. +// Real tokens, priced for the model used and, for comparison, for the latest +// model of every other family, cheapest first. Returns null until something was measured. +function otherModels(model, t) { + const own = (claudeKey(model) || {}).key; + return Object.values(CLAUDE_LATEST).filter((k) => k !== own).map((k) => ({ label: priceOf(k).label, cost: costOf(k, t) })).sort((a, b) => a.cost - b.cost); +} + function spendReport(byModel) { const model = mainBucket(byModel); if (!model) return null; @@ -137,7 +141,7 @@ function spendReport(byModel) { const written = (t.cacheWrite5m || 0) + (t.cacheWrite1h || 0), read = t.cacheRead || 0, input = t.input || 0, output = t.output || 0; if (!written && !read && !input && !output) return null; const prompt = written + read + input; - return { model, input, written, read, output, hitRate: prompt ? read / prompt : 0, cost: costOf(model, t), opus55: costOf(OPUS_55, t), opus5: costOf(OPUS_5, t) }; + return { model, input, written, read, output, hitRate: prompt ? read / prompt : 0, cost: costOf(model, t), others: otherModels(model, t) }; } // What a model switch adds: each model has its own cache, so the whole context diff --git a/lib/nexus/pricing.js b/lib/nexus/pricing.js index f0ac366..330ab87 100644 --- a/lib/nexus/pricing.js +++ b/lib/nexus/pricing.js @@ -259,4 +259,4 @@ function shouldDelegate(estOutTok, estInTok, strong, weak) { return saved > overhead; } -module.exports = { MODEL_PRICE, CLAUDE_PRICES, PRICING_SOURCE, PRICING_CHECKED, claudeKey, priceOf, costOf, usageBuckets, pricingTable, isMechanical, shouldDelegate, detectBilling, createCostTracker, BILLING_TYPES }; +module.exports = { MODEL_PRICE, CLAUDE_PRICES, CLAUDE_LATEST, PRICING_SOURCE, PRICING_CHECKED, claudeKey, priceOf, costOf, usageBuckets, pricingTable, isMechanical, shouldDelegate, detectBilling, createCostTracker, BILLING_TYPES }; diff --git a/test/run.js b/test/run.js index 87f1a6e..3c7b6d9 100644 --- a/test/run.js +++ b/test/run.js @@ -3766,8 +3766,9 @@ ok("shouldCheck: first launch runs; throttled within 4h; runs after", shouldChec const r = CH.spendReport({ "claude-haiku-5-5": { input: 10, output: 10, cacheWrite5m: 0, cacheWrite1h: 0, cacheRead: 0 }, "claude-fable-5-2": t }); eq("main bucket is the costliest model", r.model, "claude-fable-5-2"); ok("list price: fable 16 + 2 + 40", Math.abs(r.cost - 58) < 1e-6); - ok("same tokens on opus 5.5: 8 + 2 + 20", Math.abs(r.opus55 - 30) < 1e-6); - ok("same tokens on opus 5: 10 + 5 + 25", Math.abs(r.opus5 - 40) < 1e-6); + const oth = Object.fromEntries(r.others.map((o) => [o.label, o.cost])); + ok("same tokens on opus 5.5: 8 + 2 + 20", Math.abs(oth["Claude Opus 5.5"] - 30) < 1e-6); + ok("compares every other family's latest model, never the one used, cheapest first", r.others.length === 4 && !("Claude Fable 5.2" in oth) && "Claude Sonnet 5.5" in oth && "Claude Haiku 5.5" in oth && r.others.every((o, i, a) => !i || a[i - 1].cost <= o.cost)); ok("nothing measured = null", CH.spendReport({}) === null); const base = { cheap: true, engine: "claude", sid: "s", warm: true, ctxTok: 1e6, ttl: 3600000, from: "claude-opus-5-5", to: "claude-fable-5-2", pending: null, now: 1000 }; const h = CH.switchHold(base);