context-mode 2.0.0-next.29 → 2.0.0-next.32

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ctx-stats
3
- description: Show how much context context-mode saved, as a table.
3
+ description: Show how much context context-mode saved, as a detailed report.
4
4
  disable-model-invocation: true
5
5
  ---
6
- Call the ctx_stats tool and show its table to the user unchanged. Add one sentence under the table that names the largest saving.
6
+ Call the ctx_stats tool and show the text block of its reply to the user unchanged, inside a code block so the columns stay aligned. Add one sentence under it that names the largest saving.
@@ -12,5 +12,5 @@
12
12
  }
13
13
  },
14
14
  "name": "context-mode",
15
- "version": "2.0.0-next.29"
15
+ "version": "2.0.0-next.32"
16
16
  }
package/run.mjs CHANGED
@@ -256,7 +256,34 @@ var READ_PATH_KEYS = Object.freeze(["file_path", "absolute_path", "path"]);
256
256
  var EDIT_TOOLS = Object.freeze(["Write", "Edit"]);
257
257
  var EDIT_PATH_KEYS = Object.freeze(["file_path", "path"]);
258
258
  var STATS_COLUMNS = Object.freeze(["Scope", "Produced", "Returned", "Saved", "Reduction %"]);
259
+ var STATS_EMPTY_LINES = Object.freeze([
260
+ "Ready. Your savings show up here after the first tool call.",
261
+ "Large outputs from ctx_execute, ctx_batch and ctx_index stay in the",
262
+ "sandbox, and only the short answer goes to the chat."
263
+ ]);
264
+ var STATS_KIND_LABELS = Object.freeze([
265
+ // D-STATS-FIX-1 (8): the first five rows are call kinds, so they add up to the calls of the scope line.
266
+ ["index", "Content indexed"],
267
+ ["edit", "File edits"],
268
+ ["toolerr", "Issues kept"],
269
+ ["decision", "Your decisions"],
270
+ ["cmd", "Other tool calls"],
271
+ ["prompt", "Your prompts"]
272
+ ]);
273
+ var STATS_JOURNAL_HINTS = Object.freeze([
274
+ "ctx_resume brings back your last task, files changed and open issues",
275
+ "after a compact or a restart; ctx_search finds indexed content by words."
276
+ ]);
277
+ var STATS_WAYS = Object.freeze([
278
+ ["sandbox", "\u2588", "sandbox run"],
279
+ ["index", "\u2593", "index + search"],
280
+ ["redirect", "\u2592", "hook sent to sandbox"],
281
+ ["replace", "\u2591", "hook cut down"]
282
+ ]);
283
+ var STATS_INDEX_TOOLS = Object.freeze(["ctx_index", "ctx_search"]);
259
284
  var PURGE_SCOPES = Object.freeze(["session", "source", "project"]);
285
+ var RELEASE_REPO_URL = "https://github.com/mksglu/context-mode.git";
286
+ var RELEASE_BRANCH = "release";
260
287
  var DOCTOR_CHECK_ORDER = Object.freeze(["D1", "D2", "D3", "D4", "D5", "D5b", "D6", "D7", "D8", "D9", "D10", "D11"]);
261
288
  var DOCTOR_LABEL = Object.freeze({
262
289
  D1: "version",
@@ -275,6 +302,7 @@ var DOCTOR_LABEL = Object.freeze({
275
302
  var ECHO_MAX_BYTES = 256;
276
303
  var REPORT_SOURCE_LABEL = "ctx_doctor:report";
277
304
  var REPORT_POINTER = `ctx_search({queries:["FAIL","PASS","UNKNOWN"], source:${JSON.stringify(REPORT_SOURCE_LABEL)}})`;
305
+ var D1_GIT_CHECK_FIX = `git ls-remote ${RELEASE_REPO_URL} ${RELEASE_BRANCH}`;
278
306
  var D2_NODE_FIX = `install Node ${NODE_MIN} or later`;
279
307
  var D3_PARTS = Object.freeze(["MCP entry", "hook entries", "hook timeout"]);
280
308
  var AGENT_HOME_DIR = Object.freeze({
@@ -380,7 +408,7 @@ var V1_REASON = Object.freeze({
380
408
  dataDir: "old context-mode data dir <agent home>/context-mode/",
381
409
  dataDirShared: "old context-mode data dir ~/.gemini/context-mode/: delete only after a prompt (Antigravity shares it)",
382
410
  dataRoot: "old context-mode content under ~/.context-mode/",
383
- tmpFile: "old context-mode temp file context-mode-* under the OS temp dir: report only, no action needed"
411
+ tmpFile: "old context-mode temp file context-mode-* under the OS temp dir: report only, safe to keep"
384
412
  });
385
413
  var UPGRADE_REPORT_ONLY_REASONS = Object.freeze([V1_REASON.statusLine, V1_REASON.vscodeMcp, V1_REASON.dataDirShared, V1_REASON.tmpFile, V1_REASON.kiroSteering]);
386
414
  var OPENCODE_TOOL_PREFIX = SERVER_KEY + "_";
@@ -404,6 +432,59 @@ var OWN_MCP_ENTRY = Object.freeze({
404
432
  var REPORT_ENV_ENUMS = Object.freeze({
405
433
  NODE_ENV: Object.freeze(["development", "production", "test"])
406
434
  });
435
+ var DOCTOR_ENV_PREFIX = "Environment: ";
436
+ var DOCTOR_DOCS_LABEL = "Docs: ";
437
+ var DOCTOR_REPORT_LINE = "Report file: ";
438
+ var DOCTOR_GH_LINE = "File it: ";
439
+ var DOCTOR_URL_LINE = "Or open: ";
440
+ var DOCTOR_GH_NEXT = " --";
441
+ var DOCTOR_NOTE_PREFIXES = Object.freeze([
442
+ DOCTOR_ENV_PREFIX,
443
+ DOCTOR_DOCS_LABEL,
444
+ DOCTOR_REPORT_LINE,
445
+ DOCTOR_GH_LINE,
446
+ DOCTOR_GH_NEXT.trim(),
447
+ DOCTOR_URL_LINE
448
+ ]);
449
+ var ISSUE_REPO_SLUG = "mksglu/context-mode";
450
+ var ISSUE_FORM_FILE = "agent-report.yml";
451
+ var ISSUE_FORM_HEADINGS = Object.freeze([
452
+ "Summary",
453
+ "ctx-report",
454
+ "What happened",
455
+ "Hook errors",
456
+ "Journal rows",
457
+ "Agent config",
458
+ "Expected",
459
+ "Steps",
460
+ "Environment"
461
+ ]);
462
+ var DOCTOR_ENV_NAMES = Object.freeze([
463
+ "CODEX_HOME",
464
+ "CLAUDE_CONFIG_DIR",
465
+ "CLAUDE_PLUGIN_ROOT",
466
+ "COPILOT_HOME",
467
+ "KIRO_HOME",
468
+ "OPENCODE_CONFIG_DIR",
469
+ "PI_CODING_AGENT_DIR",
470
+ "XDG_CONFIG_HOME",
471
+ "SHELL"
472
+ ]);
473
+ var DOCTOR_PATH_TOOLS = Object.freeze(["node", "git", "sh"]);
474
+ var DOCTOR_SECRET_WORDS = Object.freeze(["token", "secret", "password", "apikey", "api_key", "authorization", "bearer"]);
475
+ var NATIVE_INSTALL = Object.freeze({
476
+ "claude-code": ["claude plugin marketplace add mksglu/context-mode#release", "claude plugin install context-mode@context-mode"],
477
+ codex: ["codex plugin marketplace add mksglu/context-mode@release", "codex plugin add context-mode@context-mode"],
478
+ gemini: ["gemini extensions install https://github.com/mksglu/context-mode --ref release"],
479
+ qwen: ["qwen extensions install https://github.com/mksglu/context-mode:context-mode --ref release"],
480
+ opencode: ["opencode plugin add context-mode@next"],
481
+ pi: ["pi install npm:context-mode@next"],
482
+ "copilot-cli": ["npm i -g context-mode@next", "context-mode setup --agents copilot-cli"],
483
+ vscode: ["npm i -g context-mode@next", "context-mode setup --agents vscode"],
484
+ kiro: ["npm i -g context-mode@next", "context-mode setup --agents kiro"],
485
+ zcode: ["npm i -g context-mode@next", "context-mode setup --agents zcode"]
486
+ });
487
+ var ISSUE_FORM_URL = `https://github.com/${ISSUE_REPO_SLUG}/issues/new?template=${ISSUE_FORM_FILE}`;
407
488
 
408
489
  // src/core/tools/run-wrapper.ts
409
490
  import { randomUUID } from "node:crypto";
@@ -4936,8 +5017,8 @@ var TOOL_DESCRIPTIONS = Object.freeze({
4936
5017
  ctx_index: 'Example: `ctx_index({path:"docs/api.md"})`. Required: one of path, content, url.\nStores content so it can be searched later: a local file or folder (nested .gitignore files are respected), raw text, or a URL, which is fetched and converted to Markdown. Use it for documentation or large files you will query more than once, then use ctx_search instead of reading the content again. Returns the source label and how many chunks were stored.',
4937
5018
  ctx_search: 'Example: `ctx_search({queries:["auth middleware"]})`. Required: queries.\nSearches content stored with ctx_index and earlier sandbox output in this project. Pass several queries in one call. By default it searches the current worktree; set `scope` to `project` for all worktrees or `session` for this session only. Results from the current session rank first, then by relevance, ranked with measurably better recall than plain keyword search. Set `sort` to `timeline` for oldest-first order across this session, prior sessions and memory, paged with `after`; `offset` is for relevance order only. Set `source` to `decision` to search only rows where the user answered a question. Every hit names its source. When nothing matches, the reply states the scope and how many sources are indexed.',
4938
5019
  ctx_resume: "Example: `ctx_resume({})`. Required: none.\nReturns a summary of up to 2 KB for this session: the last task and user request, files changed, open errors, and search terms for ctx_search. A large row is shown as a pointer line instead of its full text; call `ctx_resume(seq: N)` with that line's number to read the full row. Call it with no `seq` to get the state block on demand. Use it after the conversation was compacted or resumed, before you repeat earlier work.",
4939
- ctx_stats: "Example: `ctx_stats({})`. Required: none.\nReports how many bytes context-mode kept out of the conversation in this session and in this project, per agent, as a Markdown table. Show the table to the user as it is. Use it when the user asks what context-mode saved.",
4940
- ctx_doctor: "Example: `ctx_doctor({})`. Required: none.\nChecks this context-mode install and reports a table with one row per check: version, Node and node:sqlite, host config and hooks for this agent, MCP connection, project and worktree, database health, index contents, and hook timing. Each failed row names its cause and the fix in one line. It changes nothing. Use it when the user asks whether context-mode works, or after a context-mode error.",
5020
+ ctx_stats: "Example: `ctx_stats({})`. Required: none.\nReports the bytes context-mode kept out of the chat: a text report (bars, per tool, per agent) and a Markdown table. Show the text block to the user unchanged, in a code block. Use it when the user asks what it saved.",
5021
+ ctx_doctor: "Example: `ctx_doctor({})`. Required: none.\nChecks this context-mode install and reports a table with one row per check: version, Node and node:sqlite, host config and hooks for this agent, MCP connection, project and worktree, database health, index contents, and hook timing. Each failed row names its cause, the fix and a docs link. Use it when the user asks whether context-mode works, or after a context-mode error. Run each Fix first, then call ctx_doctor again. If a FAIL stays, show the user the report file it names (it holds paths and environment details) and ask before you run the printed gh issue command.\n",
4941
5022
  ctx_upgrade: "Example: `ctx_upgrade({})`. Required: none.\nUpdates context-mode to the latest release for this agent and rewrites only context-mode's own entries in the host config. User entries and user settings such as hook timeouts are kept, and old entries are erased. Returns a table of what changed and whether a restart is needed. Use it only when the user asks to update context-mode.",
4942
5023
  ctx_purge: 'Example: `ctx_purge({source:"old-docs"})`. Required: one of session, source, project.\nDeletes stored data: one session, one indexed source, or everything stored for this project. This cannot be undone. Use it only when the user asks to forget or reset data.'
4943
5024
  });
package/search.mjs CHANGED
@@ -256,7 +256,34 @@ var READ_PATH_KEYS = Object.freeze(["file_path", "absolute_path", "path"]);
256
256
  var EDIT_TOOLS = Object.freeze(["Write", "Edit"]);
257
257
  var EDIT_PATH_KEYS = Object.freeze(["file_path", "path"]);
258
258
  var STATS_COLUMNS = Object.freeze(["Scope", "Produced", "Returned", "Saved", "Reduction %"]);
259
+ var STATS_EMPTY_LINES = Object.freeze([
260
+ "Ready. Your savings show up here after the first tool call.",
261
+ "Large outputs from ctx_execute, ctx_batch and ctx_index stay in the",
262
+ "sandbox, and only the short answer goes to the chat."
263
+ ]);
264
+ var STATS_KIND_LABELS = Object.freeze([
265
+ // D-STATS-FIX-1 (8): the first five rows are call kinds, so they add up to the calls of the scope line.
266
+ ["index", "Content indexed"],
267
+ ["edit", "File edits"],
268
+ ["toolerr", "Issues kept"],
269
+ ["decision", "Your decisions"],
270
+ ["cmd", "Other tool calls"],
271
+ ["prompt", "Your prompts"]
272
+ ]);
273
+ var STATS_JOURNAL_HINTS = Object.freeze([
274
+ "ctx_resume brings back your last task, files changed and open issues",
275
+ "after a compact or a restart; ctx_search finds indexed content by words."
276
+ ]);
277
+ var STATS_WAYS = Object.freeze([
278
+ ["sandbox", "\u2588", "sandbox run"],
279
+ ["index", "\u2593", "index + search"],
280
+ ["redirect", "\u2592", "hook sent to sandbox"],
281
+ ["replace", "\u2591", "hook cut down"]
282
+ ]);
283
+ var STATS_INDEX_TOOLS = Object.freeze(["ctx_index", "ctx_search"]);
259
284
  var PURGE_SCOPES = Object.freeze(["session", "source", "project"]);
285
+ var RELEASE_REPO_URL = "https://github.com/mksglu/context-mode.git";
286
+ var RELEASE_BRANCH = "release";
260
287
  var DOCTOR_CHECK_ORDER = Object.freeze(["D1", "D2", "D3", "D4", "D5", "D5b", "D6", "D7", "D8", "D9", "D10", "D11"]);
261
288
  var DOCTOR_LABEL = Object.freeze({
262
289
  D1: "version",
@@ -275,6 +302,7 @@ var DOCTOR_LABEL = Object.freeze({
275
302
  var ECHO_MAX_BYTES = 256;
276
303
  var REPORT_SOURCE_LABEL = "ctx_doctor:report";
277
304
  var REPORT_POINTER = `ctx_search({queries:["FAIL","PASS","UNKNOWN"], source:${JSON.stringify(REPORT_SOURCE_LABEL)}})`;
305
+ var D1_GIT_CHECK_FIX = `git ls-remote ${RELEASE_REPO_URL} ${RELEASE_BRANCH}`;
278
306
  var D2_NODE_FIX = `install Node ${NODE_MIN} or later`;
279
307
  var D3_PARTS = Object.freeze(["MCP entry", "hook entries", "hook timeout"]);
280
308
  var AGENT_HOME_DIR = Object.freeze({
@@ -380,7 +408,7 @@ var V1_REASON = Object.freeze({
380
408
  dataDir: "old context-mode data dir <agent home>/context-mode/",
381
409
  dataDirShared: "old context-mode data dir ~/.gemini/context-mode/: delete only after a prompt (Antigravity shares it)",
382
410
  dataRoot: "old context-mode content under ~/.context-mode/",
383
- tmpFile: "old context-mode temp file context-mode-* under the OS temp dir: report only, no action needed"
411
+ tmpFile: "old context-mode temp file context-mode-* under the OS temp dir: report only, safe to keep"
384
412
  });
385
413
  var UPGRADE_REPORT_ONLY_REASONS = Object.freeze([V1_REASON.statusLine, V1_REASON.vscodeMcp, V1_REASON.dataDirShared, V1_REASON.tmpFile, V1_REASON.kiroSteering]);
386
414
  var OPENCODE_TOOL_PREFIX = SERVER_KEY + "_";
@@ -404,6 +432,59 @@ var OWN_MCP_ENTRY = Object.freeze({
404
432
  var REPORT_ENV_ENUMS = Object.freeze({
405
433
  NODE_ENV: Object.freeze(["development", "production", "test"])
406
434
  });
435
+ var DOCTOR_ENV_PREFIX = "Environment: ";
436
+ var DOCTOR_DOCS_LABEL = "Docs: ";
437
+ var DOCTOR_REPORT_LINE = "Report file: ";
438
+ var DOCTOR_GH_LINE = "File it: ";
439
+ var DOCTOR_URL_LINE = "Or open: ";
440
+ var DOCTOR_GH_NEXT = " --";
441
+ var DOCTOR_NOTE_PREFIXES = Object.freeze([
442
+ DOCTOR_ENV_PREFIX,
443
+ DOCTOR_DOCS_LABEL,
444
+ DOCTOR_REPORT_LINE,
445
+ DOCTOR_GH_LINE,
446
+ DOCTOR_GH_NEXT.trim(),
447
+ DOCTOR_URL_LINE
448
+ ]);
449
+ var ISSUE_REPO_SLUG = "mksglu/context-mode";
450
+ var ISSUE_FORM_FILE = "agent-report.yml";
451
+ var ISSUE_FORM_HEADINGS = Object.freeze([
452
+ "Summary",
453
+ "ctx-report",
454
+ "What happened",
455
+ "Hook errors",
456
+ "Journal rows",
457
+ "Agent config",
458
+ "Expected",
459
+ "Steps",
460
+ "Environment"
461
+ ]);
462
+ var DOCTOR_ENV_NAMES = Object.freeze([
463
+ "CODEX_HOME",
464
+ "CLAUDE_CONFIG_DIR",
465
+ "CLAUDE_PLUGIN_ROOT",
466
+ "COPILOT_HOME",
467
+ "KIRO_HOME",
468
+ "OPENCODE_CONFIG_DIR",
469
+ "PI_CODING_AGENT_DIR",
470
+ "XDG_CONFIG_HOME",
471
+ "SHELL"
472
+ ]);
473
+ var DOCTOR_PATH_TOOLS = Object.freeze(["node", "git", "sh"]);
474
+ var DOCTOR_SECRET_WORDS = Object.freeze(["token", "secret", "password", "apikey", "api_key", "authorization", "bearer"]);
475
+ var NATIVE_INSTALL = Object.freeze({
476
+ "claude-code": ["claude plugin marketplace add mksglu/context-mode#release", "claude plugin install context-mode@context-mode"],
477
+ codex: ["codex plugin marketplace add mksglu/context-mode@release", "codex plugin add context-mode@context-mode"],
478
+ gemini: ["gemini extensions install https://github.com/mksglu/context-mode --ref release"],
479
+ qwen: ["qwen extensions install https://github.com/mksglu/context-mode:context-mode --ref release"],
480
+ opencode: ["opencode plugin add context-mode@next"],
481
+ pi: ["pi install npm:context-mode@next"],
482
+ "copilot-cli": ["npm i -g context-mode@next", "context-mode setup --agents copilot-cli"],
483
+ vscode: ["npm i -g context-mode@next", "context-mode setup --agents vscode"],
484
+ kiro: ["npm i -g context-mode@next", "context-mode setup --agents kiro"],
485
+ zcode: ["npm i -g context-mode@next", "context-mode setup --agents zcode"]
486
+ });
487
+ var ISSUE_FORM_URL = `https://github.com/${ISSUE_REPO_SLUG}/issues/new?template=${ISSUE_FORM_FILE}`;
407
488
 
408
489
  // src/core/tools/run-wrapper.ts
409
490
  import { randomUUID } from "node:crypto";
@@ -4936,8 +5017,8 @@ var TOOL_DESCRIPTIONS = Object.freeze({
4936
5017
  ctx_index: 'Example: `ctx_index({path:"docs/api.md"})`. Required: one of path, content, url.\nStores content so it can be searched later: a local file or folder (nested .gitignore files are respected), raw text, or a URL, which is fetched and converted to Markdown. Use it for documentation or large files you will query more than once, then use ctx_search instead of reading the content again. Returns the source label and how many chunks were stored.',
4937
5018
  ctx_search: 'Example: `ctx_search({queries:["auth middleware"]})`. Required: queries.\nSearches content stored with ctx_index and earlier sandbox output in this project. Pass several queries in one call. By default it searches the current worktree; set `scope` to `project` for all worktrees or `session` for this session only. Results from the current session rank first, then by relevance, ranked with measurably better recall than plain keyword search. Set `sort` to `timeline` for oldest-first order across this session, prior sessions and memory, paged with `after`; `offset` is for relevance order only. Set `source` to `decision` to search only rows where the user answered a question. Every hit names its source. When nothing matches, the reply states the scope and how many sources are indexed.',
4938
5019
  ctx_resume: "Example: `ctx_resume({})`. Required: none.\nReturns a summary of up to 2 KB for this session: the last task and user request, files changed, open errors, and search terms for ctx_search. A large row is shown as a pointer line instead of its full text; call `ctx_resume(seq: N)` with that line's number to read the full row. Call it with no `seq` to get the state block on demand. Use it after the conversation was compacted or resumed, before you repeat earlier work.",
4939
- ctx_stats: "Example: `ctx_stats({})`. Required: none.\nReports how many bytes context-mode kept out of the conversation in this session and in this project, per agent, as a Markdown table. Show the table to the user as it is. Use it when the user asks what context-mode saved.",
4940
- ctx_doctor: "Example: `ctx_doctor({})`. Required: none.\nChecks this context-mode install and reports a table with one row per check: version, Node and node:sqlite, host config and hooks for this agent, MCP connection, project and worktree, database health, index contents, and hook timing. Each failed row names its cause and the fix in one line. It changes nothing. Use it when the user asks whether context-mode works, or after a context-mode error.",
5020
+ ctx_stats: "Example: `ctx_stats({})`. Required: none.\nReports the bytes context-mode kept out of the chat: a text report (bars, per tool, per agent) and a Markdown table. Show the text block to the user unchanged, in a code block. Use it when the user asks what it saved.",
5021
+ ctx_doctor: "Example: `ctx_doctor({})`. Required: none.\nChecks this context-mode install and reports a table with one row per check: version, Node and node:sqlite, host config and hooks for this agent, MCP connection, project and worktree, database health, index contents, and hook timing. Each failed row names its cause, the fix and a docs link. Use it when the user asks whether context-mode works, or after a context-mode error. Run each Fix first, then call ctx_doctor again. If a FAIL stays, show the user the report file it names (it holds paths and environment details) and ask before you run the printed gh issue command.\n",
4941
5022
  ctx_upgrade: "Example: `ctx_upgrade({})`. Required: none.\nUpdates context-mode to the latest release for this agent and rewrites only context-mode's own entries in the host config. User entries and user settings such as hook timeouts are kept, and old entries are erased. Returns a table of what changed and whether a restart is needed. Use it only when the user asks to update context-mode.",
4942
5023
  ctx_purge: 'Example: `ctx_purge({source:"old-docs"})`. Required: one of session, source, project.\nDeletes stored data: one session, one indexed source, or everything stored for this project. This cannot be undone. Use it only when the user asks to forget or reset data.'
4943
5024
  });