From b3e4324656cd6885debf8831579edeb0261fec16 Mon Sep 17 00:00:00 2001 From: Darknode-Official Date: Sat, 31 Oct 2026 13:47:15 -0700 Subject: [PATCH] Rename /cheaper to /costtips "/cheaper" read like a stronger "/cheap", but it only shows tips and changes nothing, while /cheap actually turns the lossless savers on. The tips panel is now /costtips. /cheaper still works as a hidden alias (left out of the menu and the generated docs), so typing /chea only suggests /cheap. --- darknode.js | 12 ++++++------ docs/NEXUS-COMMANDS.md | 6 +++--- lib/cli/ledger.js | 4 ++-- lib/cli/nexus-docs.js | 7 +++++-- test/run.js | 2 +- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/darknode.js b/darknode.js index e6a0bb3..77040c4 100755 --- a/darknode.js +++ b/darknode.js @@ -68,7 +68,7 @@ const Composer = require("./lib/cli/composer"); // pure composer model + key dis const Ask = require("./lib/cli/ask"); // pure renderer + key reducer for the model's ask_user multiple-choice prompt (lib/cli/ask.js) const CompactAnim = require("./lib/cli/compact-anim"); const Ledger = require("./lib/cli/ledger"); -const TokCount = require("./lib/cli/tokcount"); // pure /tokens estimator — price files before @-attaching them (lib/cli/tokcount.js) // pure per-session cost ledger (/turns) + lossless cost advisor (/cheaper) (lib/cli/ledger.js) // pure renderer for the live compaction "condenser" animation (lib/cli/compact-anim.js) +const TokCount = require("./lib/cli/tokcount"); // pure /tokens estimator — price files before @-attaching them (lib/cli/tokcount.js) // pure per-session cost ledger (/turns) + lossless cost advisor (/costtips) (lib/cli/ledger.js) // pure renderer for the live compaction "condenser" animation (lib/cli/compact-anim.js) const CacheWarm = require("./lib/cli/cachewarm"); // pure prompt-cache TTL countdown for the status chip + /warm (lib/cli/cachewarm.js) const Agents = require("./lib/cli/agents"); // pure renderer + key reducer for the Agents panel (live sub-agent list under the prompt bar) (lib/cli/agents.js) const { idleWatchdog, engineWaits } = require("./lib/nexus/engine-watchdog"); // engine hang guard: idle-based, paused while the user answers a popup @@ -2800,7 +2800,7 @@ function nexusTui(engine, cwd, nexusMd, autoResume, launch) { // keyboard (-1 = composer has focus); `agentView` is the open transcript // overlay { i, scroll } or null. addAgent/finishAgent feed the registry. let agents = [], agentSel = -1, agentView = null; - let turnLog = []; // one entry per finished paid/local turn this session — feeds /turns + /cheaper (never persisted, no prompt text beyond a short label) + let turnLog = []; // one entry per finished paid/local turn this session — feeds /turns + /costtips (never persisted, no prompt text beyond a short label) const cacheWarm = { lastAt: 0, ttl: 0 }; // when a claude call last touched the prompt cache + which TTL it wrote (status chip + /warm) let bypassCacheOnce = false; // /retry sets this so the next send skips the exact-repeat cache and really re-runs let aliases = {}; // loaded from ~/.nexus/settings.json once the settings store exists (below) @@ -2987,7 +2987,7 @@ function nexusTui(engine, cwd, nexusMd, autoResume, launch) { ["/help", "commands, input prefixes & keys · /help searches them"], ["/clear", "start a fresh chat"], ["/chat-clear", "clear the screen, keep the conversation memory"], ["/compact", "summarize & shrink the context"], ["/trust", "trust this workspace's .nexus MCP servers, hooks + allow rules"], ["/connect", "connect an AI: local model · Claude (API) · any provider"], - ["/context", "show token / context usage"], ["/cost", "session cost at exact list prices"], ["/turns", "per-turn cost ledger for this session"], ["/cheaper", "tips only: how this session could cost less, changes nothing"], ["/warm", "prompt-cache countdown + warm-vs-cold follow-up cost"], ["/tokens", "estimate what @-attaching a file/dir costs"], ["/alias", "make a shortcut: /alias name = text|/cmd"], ["/retry", "re-run your last prompt (fresh, no cache)"], ["/pricing", "exact per-model prices (USD per million tokens)"], ["/budget", "set a spend cap in USD"], + ["/context", "show token / context usage"], ["/cost", "session cost at exact list prices"], ["/turns", "per-turn cost ledger for this session"], ["/costtips", "tips only: how this session could cost less, changes nothing"], ["/warm", "prompt-cache countdown + warm-vs-cold follow-up cost"], ["/tokens", "estimate what @-attaching a file/dir costs"], ["/alias", "make a shortcut: /alias name = text|/cmd"], ["/retry", "re-run your last prompt (fresh, no cache)"], ["/pricing", "exact per-model prices (USD per million tokens)"], ["/budget", "set a spend cap in USD"], ["/report", "cost & usage report for chargeback (/report json|save|since )"], ["/compliance", "write a signed audit+usage compliance bundle (SOC2/review)"], ["/undo", "revert the last turn's file changes"], ["/rewind", "restore a specific checkpoint (/rewind N)"], ["/checkpoints", "list undo checkpoints"], @@ -3570,7 +3570,7 @@ function nexusTui(engine, cwd, nexusMd, autoResume, launch) { const fuzzyCmds = (q) => { q = q.toLowerCase(); const cmds = allCmds(); const pre = cmds.filter((c) => c[0].startsWith(q)); - if (pre.length) return pre.sort((a, b) => (b[0] === q) - (a[0] === q)); // an exact name always wins (typing /cheap must not run /cheaper) + if (pre.length) return pre.sort((a, b) => (b[0] === q) - (a[0] === q)); // an exact name always wins (typing /cheap must not run /cheaper, the old /costtips alias) const needle = q.replace(/^\//, ""); if (!needle) return []; const scored = []; for (const c of cmds) { @@ -5123,7 +5123,7 @@ function nexusTui(engine, cwd, nexusMd, autoResume, launch) { // open in the /btw side panel instead of the chat, and run INSTANTLY even mid- // turn (everything else typed during a turn is queued). Each is synchronous and // only reads state, so it is safe to run while the agent is working. - const SIDE_CMDS = new Set(["/cost", "/status", "/context", "/turns", "/ledger", "/cheaper", "/tokens", "/warm", "/savings", "/impact", "/session", "/activity", "/keys", "/compat", "/estimate", "/recent", "/tree", "/stats", "/pins", "/help", "/docs"]); + const SIDE_CMDS = new Set(["/cost", "/status", "/context", "/turns", "/ledger", "/costtips", "/cheaper", "/tokens", "/warm", "/savings", "/impact", "/session", "/activity", "/keys", "/compat", "/estimate", "/recent", "/tree", "/stats", "/pins", "/help", "/docs"]); const sideName = (t) => { const m = /^\/[^\s]+/.exec(String(t || "").trim()); return m ? m[0].toLowerCase() : ""; }; const isInstant = (t) => { const c = sideName(t); if (aliases[c] || customCmds[c]) return false; return c === "/btw" || c === "/pager" || c === "/less" || c === "/find" || SIDE_CMDS.has(c); }; // your alias/custom command of the same name wins (it may start a turn) let _inSide = false; @@ -5386,7 +5386,7 @@ function nexusTui(engine, cwd, nexusMd, autoResume, launch) { if (busy) transcript.push({ role: "system", text: "a turn is still running — wait for it to finish, then /retry" }); else { let last = null; for (let i = transcript.length - 1; i >= 0; i--) if (transcript[i].role === "user") { last = transcript[i].text; break; } if (last == null) transcript.push({ role: "system", text: "nothing to retry yet" }); else if (/^\//.test(last)) transcript.push({ role: "system", text: "the last thing you ran was the command " + last.split(/\s+/)[0] + " — run it again directly (↑ recalls it); /retry re-sends a prompt to the model" }); else { bypassCacheOnce = true; transcript.push({ role: "system", text: gray("re-running your last prompt (fresh, skipping the exact-repeat cache)…") }); submit(last); } } } - else if (cmd === "/cheaper") { + else if (cmd === "/costtips" || cmd === "/cheaper") { // /cheaper = old name, kept as a hidden alias transcript.push({ role: "system", lines: Ledger.renderAdvice(turnLog, { paid: !!PAID[engine], cacheOn, effort, engine, autoCompact, ctxPct: (sess.ctxUsed / (sess.ctxWindow || 200000)) * 100 }, { cyan, gray, bold, dim, green, yellow, mag }) }); } else if (cmd === "/compact") doCompact(false); diff --git a/docs/NEXUS-COMMANDS.md b/docs/NEXUS-COMMANDS.md index 9e39cb9..49dd5dc 100644 --- a/docs/NEXUS-COMMANDS.md +++ b/docs/NEXUS-COMMANDS.md @@ -38,7 +38,7 @@ Pasting an image path or attaching one with @ shows 'attached N image(s)' and se In the card: type a follow-up and press Enter to ask it · Enter or Esc on an empty field closes · Esc clears a typed follow-up · Left/Right step through earlier side answers · Up/Down, PgUp/PgDn and the mouse wheel scroll · Ctrl+Y copies the answer · Ctrl+X forgets all side questions. /btw with no question reopens the last one. -Read-only lookups open in the same card instantly, even mid-turn, without touching the chat: /activity /cheaper /compat /context /cost /docs /estimate /help /impact /keys /ledger /pins /recent /savings /session /stats /status /tokens /tree /turns /warm. +Read-only lookups open in the same card instantly, even mid-turn, without touching the chat: /activity /compat /context /cost /costtips /docs /estimate /help /impact /keys /ledger /pins /recent /savings /session /stats /status /tokens /tree /turns /warm. ### Agents panel and agent conversations @@ -52,7 +52,7 @@ A Claude sub-agent's messages appear only in its own view, not in the main reply ### Cost and tokens -The status bar shows context use and, on the claude engine, the prompt-cache countdown ('cache 4m'). /cost is exact list-price cost, /turns the per-turn ledger, /tokens the breakdown, /warm the cache countdown with warm-vs-cold follow-up cost, /cheaper lossless ways to spend less. +The status bar shows context use and, on the claude engine, the prompt-cache countdown ('cache 4m'). /cost is exact list-price cost, /turns the per-turn ledger, /tokens the breakdown, /warm the cache countdown with warm-vs-cold follow-up cost, /costtips tips on spending less (changes nothing). /cheap turns on lossless savings only (no quality loss). Limiting features (budget cap, auto-compact) are OFF by default; toggles you set are remembered in ~/.nexus/settings.json. @@ -77,7 +77,7 @@ File tools are confined to the project folder; secrets are blocked from being wr - `/context` — show token / context usage (opens in the side panel) - `/cost` — session cost at exact list prices (opens in the side panel) - `/turns` — per-turn cost ledger for this session (opens in the side panel) -- `/cheaper` — tips only: how this session could cost less, changes nothing (opens in the side panel) +- `/costtips` — tips only: how this session could cost less, changes nothing (opens in the side panel) - `/warm` — prompt-cache countdown + warm-vs-cold follow-up cost (opens in the side panel) - `/tokens` — estimate what @-attaching a file/dir costs (opens in the side panel) - `/alias` — make a shortcut: /alias name = text|/cmd diff --git a/lib/cli/ledger.js b/lib/cli/ledger.js index ddff638..0448176 100644 --- a/lib/cli/ledger.js +++ b/lib/cli/ledger.js @@ -1,7 +1,7 @@ "use strict"; // ============================================================================ // ledger — PURE helpers for the per-session cost ledger (`/turns`) and the -// lossless cost advisor (`/cheaper`). The host records one plain entry per +// lossless cost advisor (`/costtips`). The host records one plain entry per // finished turn; everything here is a function of that array (+ the current // settings), so it is fully snapshot-testable. No I/O, no module state. // @@ -69,7 +69,7 @@ function renderTurns(turns, opt) { out.push(" " + line); }); if (start > 0) out.push(t.dim(" … " + start + " earlier turn" + (start === 1 ? "" : "s") + " above")); - if (s.topCostIdx >= 0 && turns[s.topCostIdx] && (turns[s.topCostIdx].cost || 0) > 0) out.push(t.gray(" ▲ priciest: turn " + (s.topCostIdx + 1) + " at " + money(turns[s.topCostIdx].cost) + " — ") + t.dim("/cheaper for ways to spend less")); + if (s.topCostIdx >= 0 && turns[s.topCostIdx] && (turns[s.topCostIdx].cost || 0) > 0) out.push(t.gray(" ▲ priciest: turn " + (s.topCostIdx + 1) + " at " + money(turns[s.topCostIdx].cost) + " — ") + t.dim("/costtips for ways to spend less")); return out; } diff --git a/lib/cli/nexus-docs.js b/lib/cli/nexus-docs.js index f32116d..30def17 100644 --- a/lib/cli/nexus-docs.js +++ b/lib/cli/nexus-docs.js @@ -43,7 +43,7 @@ const GUIDE = [ "A Claude sub-agent's messages appear only in its own view, not in the main reply.", ]], ["Cost and tokens", [ - "The status bar shows context use and, on the claude engine, the prompt-cache countdown ('cache 4m'). /cost is exact list-price cost, /turns the per-turn ledger, /tokens the breakdown, /warm the cache countdown with warm-vs-cold follow-up cost, /cheaper lossless ways to spend less.", + "The status bar shows context use and, on the claude engine, the prompt-cache countdown ('cache 4m'). /cost is exact list-price cost, /turns the per-turn ledger, /tokens the breakdown, /warm the cache countdown with warm-vs-cold follow-up cost, /costtips tips on spending less (changes nothing).", "/cheap turns on lossless savings only (no quality loss). Limiting features (budget cap, auto-compact) are OFF by default; toggles you set are remembered in ~/.nexus/settings.json.", ]], ["Checkpoints and safety", [ @@ -64,9 +64,12 @@ const clean = (s) => String(s == null ? "" : s).replace(/\x1b\[[0-9;]*m/g, ""); // help [{ title, rows:[[k,v]] }] the /help sections keys same shape (/keys) // side [name] commands that open in the side panel // topics { key: { title, body } } the /docs topics custom [[name, desc]] +// Old command names kept working as aliases but left out of the docs. +const HIDDEN_ALIASES = new Set(["/cheaper"]); // renamed to /costtips + function buildReference(d) { d = d || {}; - const side = (d.side || []).slice().sort(); + const side = (d.side || []).filter((n) => !HIDDEN_ALIASES.has(n)).sort(); const out = ["# Nexus reference", "", "How Nexus works and every command it has. Generated from the live command tables — do not edit by hand.", ""]; out.push("## How it works", ""); for (const [title, paras] of GUIDE) { diff --git a/test/run.js b/test/run.js index f0d2077..4c49512 100644 --- a/test/run.js +++ b/test/run.js @@ -3416,7 +3416,7 @@ ok("shouldCheck: first launch runs; throttled within 4h; runs after", shouldChec ok("long paths are truncated keeping the end", (() => { const r = T.renderTokens([{ path: "a/very/deeply/nested/" + "x".repeat(90) + "/file.js", chars: 400 }], { price: { in: 5 }, paid: true, width: 60 }); return r.every((x) => x.replace(/\x1b\[[0-9;]*m/g, "").length <= 60) && r.some((x) => /file\.js/.test(x)); })()); } - group("cost ledger + advisor (/turns, /cheaper)"); + group("cost ledger + advisor (/turns, /costtips)"); { const L = require("../lib/cli/ledger"); const turns = [