dsh-context-mode 0.5.2 → 0.5.3

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/README.md CHANGED
@@ -8,8 +8,9 @@ DeepSeek Harness tools. It registers the full `ctx_*` catalog at runtime and
8
8
  adds model-facing routing guidance, so dsh-TUI can use sandboxed execution,
9
9
  indexing, FTS5 retrieval, and web fetching without a second MCP client. It also
10
10
  registers the eight user-invocable skills from the upstream package, so the
11
- DSH skill surface includes `/context-mode`, `/ctx-doctor`, `/ctx-index`,
12
- `/ctx-insight`, `/ctx-purge`, `/ctx-search`, `/ctx-stats`, and `/ctx-upgrade`.
11
+ DSH skill surface includes `/context-mode`, `/ctx-index`, `/ctx-purge`,
12
+ `/ctx-search`, and `/ctx-upgrade`; the diagnostics, analytics, and statistics
13
+ skills are off by default with their tools.
13
14
 
14
15
  > **Part of a pair.** This is the *tool* half: the `ctx_*` tools, plus the
15
16
  > archiver that files each compaction's transcript into the knowledge base.
@@ -77,6 +78,7 @@ The default patch starts the bridge with:
77
78
  - the current working directory as the project directory
78
79
  - `~/.dsh/context-mode` as the isolated database root
79
80
  - a 60-second initialize and tool-catalog timeout
81
+ - `disabledTools: [ctx_doctor, ctx_insight, ctx_stats]`
80
82
 
81
83
  Override the row's `config` in a profile patch when needed:
82
84
 
@@ -88,8 +90,20 @@ Override the row's `config` in a profile patch when needed:
88
90
  projectDir: /absolute/path/to/worktree
89
91
  storageDir: /absolute/path/to/context-mode-data
90
92
  handshakeTimeoutMs: 120000
93
+ disabledTools: [] # opt the maintenance tools back in
91
94
  ```
92
95
 
96
+ ### Why some tools are off by default
97
+
98
+ Every registered tool ships its full schema on every request, so a tool nobody
99
+ calls is a permanent token tax. `ctx_doctor`, `ctx_insight`, and `ctx_stats`
100
+ report on context-mode itself rather than on the user's work — a human runs
101
+ them deliberately. Their skills are suppressed with them, since a skill that
102
+ teaches a model to call an unregistered tool helps nobody.
103
+
104
+ The tools behind `disabledTools` stay in the vendored engine; only their DSH
105
+ registration is skipped. Set `disabledTools: []` to restore all eleven.
106
+
93
107
  `serverPath` is available for local development and pinned deployments. It may
94
108
  be an absolute path or a path relative to the profile process directory.
95
109
 
@@ -103,10 +117,12 @@ when the Cordis plugin is disposed.
103
117
  Context-mode analysis, indexing, search, and diagnostics tools are marked concurrency-safe so independent model tool calls may overlap. `ctx_insight`, `ctx_purge`, and `ctx_upgrade` remain exclusive because they open external UI or mutate installation and stored data.
104
118
  `ctx_batch_execute` additionally parallelizes its own command batch through its `concurrency` parameter.
105
119
 
106
- All eleven `ctx_*` capabilities are exposed on DSH — `ctx_execute`,
107
- `ctx_execute_file`, `ctx_batch_execute`, `ctx_fetch_and_index`, `ctx_index`,
108
- `ctx_search`, `ctx_stats`, `ctx_doctor`, `ctx_upgrade`, `ctx_purge`, and
109
- `ctx_insight`. Each registered tool carries DSH-specific routing guidance in its
120
+ Eight of the eleven `ctx_*` capabilities are exposed on DSH by default
121
+ `ctx_execute`, `ctx_execute_file`, `ctx_batch_execute`, `ctx_fetch_and_index`,
122
+ `ctx_index`, `ctx_search`, `ctx_upgrade`, and `ctx_purge`. `ctx_stats`,
123
+ `ctx_doctor`, and `ctx_insight` are held back by `disabledTools` (see
124
+ [Configuration](#configuration)). Each registered tool carries DSH-specific
125
+ routing guidance in its
110
126
  description, and the plugin injects a routing section plus a bundled
111
127
  `context-mode` skill so the model reaches for these tools by default.
112
128
 
@@ -24,6 +24,15 @@ export interface Config {
24
24
  * `ctx_search` can still reach what the compaction summary drops.
25
25
  */
26
26
  precompact?: boolean;
27
+ /**
28
+ * Tool names to keep out of the model's catalog and the skill list.
29
+ *
30
+ * Every registered tool ships its full schema on every request, so a tool
31
+ * nobody calls is a permanent token tax. Defaults to the maintenance-only
32
+ * tools: diagnostics, analytics, and statistics are things a human runs
33
+ * deliberately, not something the model should reach for mid-task.
34
+ */
35
+ disabledTools?: string[];
27
36
  }
28
37
  export declare const Config: Schemastery<Config>;
29
38
  export declare const ROUTING_TEXT: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAYlD,eAAO,MAAM,IAAI,qBAAqB,CAAA;AAEtC,qDAAqD;AACrD,MAAM,WAAW,MAAM;IACrB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,+DAA+D;IAC/D,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,MAAM,CAOrC,CAAA;AAWF,eAAO,MAAM,YAAY,QAMb,CAAA;AA6EZ,+EAA+E;AAC/E,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAoF5E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAYlD,eAAO,MAAM,IAAI,qBAAqB,CAAA;AAEtC,qDAAqD;AACrD,MAAM,WAAW,MAAM;IACrB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,+DAA+D;IAC/D,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;CACzB;AAWD,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,MAAM,CAQrC,CAAA;AAWF,eAAO,MAAM,YAAY,QAMb,CAAA;AA6EZ,+EAA+E;AAC/E,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,MAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAsF5E"}
@@ -17,6 +17,14 @@ import { installPrecompactArchive } from './precompact.js';
17
17
  import { installBashRoutingGuard } from './routing.js';
18
18
  import { installSessionMemory } from './session-memory.js';
19
19
  export const name = 'dsh-context-mode';
20
+ /**
21
+ * Maintenance-only tools that are off unless a deployment opts back in.
22
+ *
23
+ * `ctx_doctor`, `ctx_insight`, and `ctx_stats` report on context-mode itself;
24
+ * the model has never needed them to do the user's work, and each one's schema
25
+ * is carried on every request.
26
+ */
27
+ const DEFAULT_DISABLED_TOOLS = ['ctx_doctor', 'ctx_insight', 'ctx_stats'];
20
28
  export const Config = z.object({
21
29
  enabled: z.boolean().default(true),
22
30
  serverPath: z.string().default(''),
@@ -24,6 +32,7 @@ export const Config = z.object({
24
32
  storageDir: z.string().default(''),
25
33
  handshakeTimeoutMs: z.number().step(1).min(1_000).default(60_000),
26
34
  precompact: z.boolean().default(true),
35
+ disabledTools: z.array(z.string()).default([...DEFAULT_DISABLED_TOOLS]),
27
36
  });
28
37
  const OUTPUT_SCHEMA = {
29
38
  type: 'object',
@@ -108,6 +117,7 @@ export async function apply(ctx, config = {}) {
108
117
  storageDir: config.storageDir?.trim() || join(homedir(), '.dsh', 'context-mode'),
109
118
  handshakeTimeoutMs: config.handshakeTimeoutMs ?? 60_000,
110
119
  precompact: config.precompact ?? true,
120
+ disabledTools: new Set(config.disabledTools ?? DEFAULT_DISABLED_TOOLS),
111
121
  };
112
122
  if (!resolved.enabled)
113
123
  return;
@@ -133,7 +143,7 @@ export async function apply(ctx, config = {}) {
133
143
  disposers.push(memoryDisposer);
134
144
  const precompactDisposer = installPrecompactArchive(ctx, () => client, { enabled: resolved.precompact });
135
145
  disposers.push(precompactDisposer);
136
- const skillDisposer = registerBundledSkills(ctx);
146
+ const skillDisposer = registerBundledSkills(ctx, resolved.disabledTools);
137
147
  if (skillDisposer !== undefined)
138
148
  disposers.push(skillDisposer);
139
149
  try {
@@ -156,6 +166,8 @@ export async function apply(ctx, config = {}) {
156
166
  for (const tool of catalog) {
157
167
  if (disposed)
158
168
  return;
169
+ if (resolved.disabledTools.has(tool.name))
170
+ continue;
159
171
  try {
160
172
  disposers.push(tools.register(toDefinition(tool, bridge)));
161
173
  }
@@ -179,12 +191,16 @@ export async function apply(ctx, config = {}) {
179
191
  ctx.logger.warn(`dsh-context-mode: bridge unavailable; plugin is inactive (${errorMessage(error)})`);
180
192
  }
181
193
  }
182
- function registerBundledSkills(ctx) {
194
+ function registerBundledSkills(ctx, disabledTools) {
183
195
  const skills = ctx.get('skills', false);
184
196
  if (skills === undefined)
185
197
  return undefined;
186
198
  const disposers = [];
187
199
  for (const skill of BUNDLED_SKILLS) {
200
+ // A skill whose tool is not registered would only teach the model to call
201
+ // something that is not there.
202
+ if (skill.name !== name && disabledTools.has(skill.name.replace(/-/g, '_')))
203
+ continue;
188
204
  try {
189
205
  const content = readFileSync(new URL(`../../${skill.path}`, import.meta.url), 'utf8');
190
206
  disposers.push(skills.register({ ...skill, content }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-context-mode",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Expose context-mode MCP tools as native DeepSeek Harness tools",
5
5
  "keywords": [
6
6
  "dsh",