context-mode 2.0.0-next.29 → 2.0.0-next.30
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +84 -83
- package/SHA256SUMS +19 -19
- package/claude-code/skills/ctx-stats/SKILL.md +2 -2
- package/cli.mjs +20 -0
- package/codex/skills/ctx-stats/SKILL.md +2 -2
- package/copilot/plugin.json +1 -1
- package/gemini-extension.json +1 -1
- package/hook.mjs +71 -71
- package/opencode/plugin.js +501 -234
- package/package.json +1 -1
- package/pi/index.js +580 -314
- package/pi/skills/ctx-stats/SKILL.md +2 -2
- package/qwen-extension.json +1 -1
- package/run.mjs +21 -1
- package/search.mjs +21 -1
- package/server.mjs +529 -263
- package/skills/ctx-stats/SKILL.md +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ctx-stats
|
|
3
|
-
description: Show how much context context-mode saved, as a
|
|
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
|
|
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.
|
package/qwen-extension.json
CHANGED
package/run.mjs
CHANGED
|
@@ -256,7 +256,26 @@ 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
|
+
["cmd", "Tool runs"],
|
|
266
|
+
["index", "Content indexed"],
|
|
267
|
+
["edit", "File edits"],
|
|
268
|
+
["toolerr", "Errors kept"],
|
|
269
|
+
["decision", "Your decisions"],
|
|
270
|
+
["prompt", "Your prompts"]
|
|
271
|
+
]);
|
|
272
|
+
var STATS_JOURNAL_HINTS = Object.freeze([
|
|
273
|
+
"ctx_resume brings back your last task, files changed and open errors",
|
|
274
|
+
"after a compact or a restart; ctx_search finds indexed content by words."
|
|
275
|
+
]);
|
|
259
276
|
var PURGE_SCOPES = Object.freeze(["session", "source", "project"]);
|
|
277
|
+
var RELEASE_REPO_URL = "https://github.com/mksglu/context-mode.git";
|
|
278
|
+
var RELEASE_BRANCH = "release";
|
|
260
279
|
var DOCTOR_CHECK_ORDER = Object.freeze(["D1", "D2", "D3", "D4", "D5", "D5b", "D6", "D7", "D8", "D9", "D10", "D11"]);
|
|
261
280
|
var DOCTOR_LABEL = Object.freeze({
|
|
262
281
|
D1: "version",
|
|
@@ -275,6 +294,7 @@ var DOCTOR_LABEL = Object.freeze({
|
|
|
275
294
|
var ECHO_MAX_BYTES = 256;
|
|
276
295
|
var REPORT_SOURCE_LABEL = "ctx_doctor:report";
|
|
277
296
|
var REPORT_POINTER = `ctx_search({queries:["FAIL","PASS","UNKNOWN"], source:${JSON.stringify(REPORT_SOURCE_LABEL)}})`;
|
|
297
|
+
var D1_GIT_CHECK_FIX = `git ls-remote ${RELEASE_REPO_URL} ${RELEASE_BRANCH}`;
|
|
278
298
|
var D2_NODE_FIX = `install Node ${NODE_MIN} or later`;
|
|
279
299
|
var D3_PARTS = Object.freeze(["MCP entry", "hook entries", "hook timeout"]);
|
|
280
300
|
var AGENT_HOME_DIR = Object.freeze({
|
|
@@ -4936,7 +4956,7 @@ var TOOL_DESCRIPTIONS = Object.freeze({
|
|
|
4936
4956
|
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
4957
|
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
4958
|
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
|
|
4959
|
+
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.",
|
|
4940
4960
|
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.",
|
|
4941
4961
|
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
4962
|
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.'
|
package/search.mjs
CHANGED
|
@@ -256,7 +256,26 @@ 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
|
+
["cmd", "Tool runs"],
|
|
266
|
+
["index", "Content indexed"],
|
|
267
|
+
["edit", "File edits"],
|
|
268
|
+
["toolerr", "Errors kept"],
|
|
269
|
+
["decision", "Your decisions"],
|
|
270
|
+
["prompt", "Your prompts"]
|
|
271
|
+
]);
|
|
272
|
+
var STATS_JOURNAL_HINTS = Object.freeze([
|
|
273
|
+
"ctx_resume brings back your last task, files changed and open errors",
|
|
274
|
+
"after a compact or a restart; ctx_search finds indexed content by words."
|
|
275
|
+
]);
|
|
259
276
|
var PURGE_SCOPES = Object.freeze(["session", "source", "project"]);
|
|
277
|
+
var RELEASE_REPO_URL = "https://github.com/mksglu/context-mode.git";
|
|
278
|
+
var RELEASE_BRANCH = "release";
|
|
260
279
|
var DOCTOR_CHECK_ORDER = Object.freeze(["D1", "D2", "D3", "D4", "D5", "D5b", "D6", "D7", "D8", "D9", "D10", "D11"]);
|
|
261
280
|
var DOCTOR_LABEL = Object.freeze({
|
|
262
281
|
D1: "version",
|
|
@@ -275,6 +294,7 @@ var DOCTOR_LABEL = Object.freeze({
|
|
|
275
294
|
var ECHO_MAX_BYTES = 256;
|
|
276
295
|
var REPORT_SOURCE_LABEL = "ctx_doctor:report";
|
|
277
296
|
var REPORT_POINTER = `ctx_search({queries:["FAIL","PASS","UNKNOWN"], source:${JSON.stringify(REPORT_SOURCE_LABEL)}})`;
|
|
297
|
+
var D1_GIT_CHECK_FIX = `git ls-remote ${RELEASE_REPO_URL} ${RELEASE_BRANCH}`;
|
|
278
298
|
var D2_NODE_FIX = `install Node ${NODE_MIN} or later`;
|
|
279
299
|
var D3_PARTS = Object.freeze(["MCP entry", "hook entries", "hook timeout"]);
|
|
280
300
|
var AGENT_HOME_DIR = Object.freeze({
|
|
@@ -4936,7 +4956,7 @@ var TOOL_DESCRIPTIONS = Object.freeze({
|
|
|
4936
4956
|
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
4957
|
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
4958
|
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
|
|
4959
|
+
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.",
|
|
4940
4960
|
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.",
|
|
4941
4961
|
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
4962
|
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.'
|