sigmap 6.0.3 → 6.2.0

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/AGENTS.md CHANGED
@@ -13,10 +13,25 @@ Use this marker block for all appendable context files:
13
13
  <!-- Updated by gen-context.js -->
14
14
  # Code signatures
15
15
 
16
- ## changes (last 5 commits — 3 minutes ago)
16
+ ## SigMap commands
17
+
18
+ | When | Command |
19
+ |------|---------|
20
+ | Before answering a question | `sigmap ask "<your question>"` |
21
+ | After code changes | `sigmap validate` |
22
+ | To query by topic | `sigmap --query "<topic>"` |
23
+
24
+ Always run `sigmap ask` or `sigmap --query` before searching for files relevant to a task.
25
+ ## changes (last 5 commits — 21 minutes ago)
17
26
  ```
18
- src/extractors/typescript.js ~extractInterfaceMembers ~extractClassMembers
27
+ src/learning/weights.js +exportWeights +importWeights ~resetWeights
28
+ packages/adapters/claude.js ~format
19
29
  packages/adapters/codex.js ~format
30
+ packages/adapters/gemini.js ~format
31
+ packages/adapters/copilot.js ~format
32
+ packages/adapters/openai.js ~format
33
+ packages/adapters/cursor.js ~format
34
+ packages/adapters/windsurf.js ~format
20
35
  ```
21
36
 
22
37
  ## packages
@@ -44,6 +59,38 @@ function format(context, opts)
44
59
  function write(context, cwd, opts)
45
60
  ```
46
61
 
62
+ ### packages/core/README.md
63
+ ```
64
+ h1 sigmap-core
65
+ h2 Installation
66
+ h2 Quick start
67
+ h2 API reference
68
+ h3 `extract(src, language)` → `string[]`
69
+ h3 `rank(query, sigIndex, opts?)` → `Result[]`
70
+ h3 `buildSigIndex(cwd)` → `Map<string, string[]>`
71
+ h3 `scan(sigs, filePath)` → `{ safe: string[], redacted: boolean }`
72
+ h3 `score(cwd)` → `HealthResult`
73
+ h2 Migration from v2.3 and earlier
74
+ h2 v3.0 — Multi-Adapter Architecture (released)
75
+ h2 Zero dependencies
76
+ code-fence bash
77
+ code-fence plain
78
+ code-fence js
79
+ code-fence ---
80
+ ```
81
+
82
+ ### packages/core/index.js
83
+ ```
84
+ module.exports = { extract, rank, buildSigIndex, scan, score, adapt }
85
+ function _resolveExtractor(language)
86
+ function extract(src, language) → string[]
87
+ function rank(query, sigIndex, opts) → { file: string, score: nu
88
+ function buildSigIndex(cwd) → Map<string, string[]>
89
+ function scan(sigs, filePath) → { safe: string[], redacte
90
+ function score(cwd) → { * score: number, * grad
91
+ function adapt(context, adapterName, opts = {}) → string
92
+ ```
93
+
47
94
  ### packages/adapters/claude.js
48
95
  ```
49
96
  module.exports = { name, format, outputPath, write }
@@ -53,30 +100,30 @@ function outputPath(cwd) → string
53
100
  function write(context, cwd, opts = {})
54
101
  ```
55
102
 
56
- ### packages/adapters/copilot.js
103
+ ### packages/adapters/codex.js
57
104
  ```
58
105
  module.exports = { name, format, outputPath, write }
59
106
  function format(context, opts = {}) → string
60
- function _confidenceMeta(opts)
61
107
  function outputPath(cwd) → string
62
108
  function write(context, cwd, opts = {})
63
109
  ```
64
110
 
65
- ### packages/adapters/cursor.js
111
+ ### packages/adapters/gemini.js
66
112
  ```
67
- module.exports = { name, format, outputPath }
113
+ module.exports = { name, format, outputPath, write }
68
114
  function format(context, opts = {}) → string
69
- function _confidenceMeta(opts)
70
115
  function outputPath(cwd) → string
116
+ function write(context, cwd, opts = {})
117
+ function _confidenceMeta(opts)
71
118
  ```
72
119
 
73
- ### packages/adapters/gemini.js
120
+ ### packages/adapters/copilot.js
74
121
  ```
75
122
  module.exports = { name, format, outputPath, write }
76
123
  function format(context, opts = {}) → string
124
+ function _confidenceMeta(opts)
77
125
  function outputPath(cwd) → string
78
126
  function write(context, cwd, opts = {})
79
- function _confidenceMeta(opts)
80
127
  ```
81
128
 
82
129
  ### packages/adapters/openai.js
@@ -87,7 +134,7 @@ function outputPath(cwd) → string
87
134
  function _confidenceMeta(opts)
88
135
  ```
89
136
 
90
- ### packages/adapters/windsurf.js
137
+ ### packages/adapters/cursor.js
91
138
  ```
92
139
  module.exports = { name, format, outputPath }
93
140
  function format(context, opts = {}) → string
@@ -95,54 +142,16 @@ function _confidenceMeta(opts)
95
142
  function outputPath(cwd) → string
96
143
  ```
97
144
 
98
- ### packages/core/README.md
99
- ```
100
- h1 sigmap-core
101
- h2 Installation
102
- h2 Quick start
103
- h2 API reference
104
- h3 `extract(src, language)` → `string[]`
105
- h3 `rank(query, sigIndex, opts?)` → `Result[]`
106
- h3 `buildSigIndex(cwd)` → `Map<string, string[]>`
107
- h3 `scan(sigs, filePath)` → `{ safe: string[], redacted: boolean }`
108
- h3 `score(cwd)` → `HealthResult`
109
- h2 Migration from v2.3 and earlier
110
- h2 v3.0 — Multi-Adapter Architecture (released)
111
- h2 Zero dependencies
112
- code-fence bash
113
- code-fence plain
114
- code-fence js
115
- code-fence ---
116
- ```
117
-
118
- ### packages/core/index.js
119
- ```
120
- module.exports = { extract, rank, buildSigIndex, scan, score, adapt }
121
- function _resolveExtractor(language)
122
- function extract(src, language) → string[]
123
- function rank(query, sigIndex, opts) → { file: string, score: nu
124
- function buildSigIndex(cwd) → Map<string, string[]>
125
- function scan(sigs, filePath) → { safe: string[], redacte
126
- function score(cwd) → { * score: number, * grad
127
- function adapt(context, adapterName, opts = {}) → string
128
- ```
129
-
130
- ### packages/adapters/codex.js
145
+ ### packages/adapters/windsurf.js
131
146
  ```
132
- module.exports = { name, format, outputPath, write }
147
+ module.exports = { name, format, outputPath }
133
148
  function format(context, opts = {}) → string
149
+ function _confidenceMeta(opts)
134
150
  function outputPath(cwd) → string
135
- function write(context, cwd, opts = {})
136
151
  ```
137
152
 
138
153
  ## src
139
154
 
140
- ### src/routing/hints.js
141
- ```
142
- module.exports = { TIERS, formatRoutingSection }
143
- function formatRoutingSection(groups) → string
144
- ```
145
-
146
155
  ### src/security/patterns.js
147
156
  ```
148
157
  module.exports = { PATTERNS }
@@ -551,21 +560,6 @@ function extractContextFiles(context, cwd)
551
560
  function judge(response, context, opts = {})
552
561
  ```
553
562
 
554
- ### src/learning/weights.js
555
- ```
556
- module.exports = { BASELINE, DECAY, MAX_MULT, MIN_MULT, weightsPath, clampMultiplier, normalizeFile, loadWeights, saveWeights, updateWeights, boostFiles, penalizeFiles, resetWeights }
557
- function weightsPath(cwd)
558
- function clampMultiplier(value)
559
- function normalizeFile(cwd, filePath)
560
- function sanitizeWeights(cwd, weights)
561
- function loadWeights(cwd)
562
- function saveWeights(cwd, weights)
563
- function updateWeights(cwd, opts = {})
564
- function boostFiles(cwd, files, amount = 0.15)
565
- function penalizeFiles(cwd, files, amount = 0.10)
566
- function resetWeights(cwd)
567
- ```
568
-
569
563
  ### src/format/benchmark-report.js
570
564
  ```
571
565
  module.exports = { loadBenchmarkReports, buildBenchmarkSummary, generateBenchmarkReportHtml, writeBenchmarkReport }
@@ -662,3 +656,20 @@ function respondError(id, code, message)
662
656
  function dispatch(msg, cwd)
663
657
  function start(cwd)
664
658
  ```
659
+
660
+ ### src/learning/weights.js
661
+ ```
662
+ module.exports = { BASELINE, DECAY, MAX_MULT, MIN_MULT, weightsPath, clampMultiplier, normalizeFile, loadWeights, saveWeights, updateWeights, boostFiles, penalizeFiles, resetWeights, exportWeights, importWeights }
663
+ function weightsPath(cwd)
664
+ function clampMultiplier(value)
665
+ function normalizeFile(cwd, filePath)
666
+ function sanitizeWeights(cwd, weights)
667
+ function loadWeights(cwd)
668
+ function saveWeights(cwd, weights)
669
+ function updateWeights(cwd, opts = {})
670
+ function boostFiles(cwd, files, amount = 0.15)
671
+ function penalizeFiles(cwd, files, amount = 0.10)
672
+ function resetWeights(cwd)
673
+ function exportWeights(cwd, outputPath)
674
+ function importWeights(cwd, importPath, replace)
675
+ ```
package/CHANGELOG.md CHANGED
@@ -10,6 +10,22 @@ Format: [Semantic Versioning](https://semver.org/)
10
10
 
11
11
  ---
12
12
 
13
+ ## [6.2.0] — 2026-04-22
14
+
15
+ ### Added
16
+
17
+ - **`--setup` MCP auto-wire for 4 new targets** — `sigmap --setup` now registers the MCP server in `.vscode/mcp.json` (GitHub Copilot in VS Code 1.99+), `opencode.json` and `~/.config/opencode/config.json` (OpenCode), `~/.gemini/settings.json` (Gemini CLI), and `~/.codex/config.yaml` (Codex CLI — YAML format). All 5 new targets are idempotent and only written if the file already exists. Total `--setup` targets: 5 → 10.
18
+
19
+ ---
20
+
21
+ ## [6.1.0] — 2026-04-22
22
+
23
+ ### Added
24
+
25
+ - **Tool instructions in every adapter (Level 1)** — each adapter's `format()` now embeds native-format SigMap command guidance: markdown table (copilot, codex), bullet list (claude), `#` comments (cursor, windsurf), instruction sentence (openai, gemini). Agents get `sigmap ask`, `sigmap validate`, and `sigmap judge` hints automatically in every generated context file.
26
+
27
+ ---
28
+
13
29
  ## [6.0.3] — 2026-04-21
14
30
 
15
31
  ### Added
package/README.md CHANGED
@@ -76,14 +76,14 @@ Ask → Rank → Context → Validate → Judge → Learn
76
76
  ## Benchmark
77
77
 
78
78
  ```
79
- Benchmark : sigmap-v5.9-main
79
+ Benchmark : sigmap-v6.0-main
80
80
  Date : 2026-04-19
81
81
 
82
- Hit@5 : 80.0% (baseline 13.6% — 5.9× lift)
82
+ Hit@5 : 80.0% (baseline 13.6% — 5.8× lift)
83
83
  Prompt reduction : 40.8%
84
84
  Task success : 52.2% (baseline 10%)
85
85
  Prompts / task : 1.68 (baseline 2.84)
86
- Token reduction: 40–98% (avg 97.6% across 18 real repos)
86
+ Token reduction: 40–98% (avg 96.9% across 18 real repos)
87
87
  ```
88
88
 
89
89
  Measured on 90 coding tasks across 18 real public repos. No LLM API — fully reproducible.
package/gen-context.js CHANGED
@@ -5387,7 +5387,7 @@ __factories["./src/mcp/server"] = function(module, exports) {
5387
5387
 
5388
5388
  const SERVER_INFO = {
5389
5389
  name: 'sigmap',
5390
- version: '6.0.3',
5390
+ version: '6.2.0',
5391
5391
  description: 'SigMap MCP server — code signatures on demand',
5392
5392
  };
5393
5393
 
@@ -6753,6 +6753,14 @@ __factories["./packages/adapters/copilot"] = function(module, exports) {
6753
6753
  `<!-- Updated: ${timestamp} -->`,
6754
6754
  `<!-- Do not edit below — regenerate with: node gen-context.js -->`,
6755
6755
  '',
6756
+ '## SigMap commands',
6757
+ '',
6758
+ '| When | Command |',
6759
+ '|------|---------|',
6760
+ '| Before answering a question about code | `sigmap ask "<your question>"` |',
6761
+ '| After changing config or source dirs | `sigmap validate` |',
6762
+ '| To verify an AI answer is grounded | `sigmap judge --response <file>` |',
6763
+ '',
6756
6764
  '# Code signatures',
6757
6765
  '',
6758
6766
  context,
@@ -6785,7 +6793,17 @@ __factories["./packages/adapters/claude"] = function(module, exports) {
6785
6793
  if (!context || typeof context !== 'string') return '';
6786
6794
  const version = (opts && opts.version) || 'unknown';
6787
6795
  const timestamp = new Date().toISOString();
6788
- return [`<!-- Generated by SigMap v${version} — ${timestamp} -->`, '', context].join('\n');
6796
+ return [
6797
+ '## SigMap',
6798
+ '- Before searching for files, run `sigmap ask "<query>"` — ranks by TF-IDF relevance',
6799
+ '- After config changes, run `sigmap validate` to confirm coverage',
6800
+ '- To verify answer groundedness, run `sigmap judge --response <file> --context CLAUDE.md`',
6801
+ '- For PR-scoped context, run `sigmap --diff`',
6802
+ '',
6803
+ `<!-- Generated by SigMap v${version} — ${timestamp} -->`,
6804
+ '',
6805
+ context,
6806
+ ].join('\n');
6789
6807
  }
6790
6808
  function outputPath(cwd) { return path.join(cwd, 'CLAUDE.md'); }
6791
6809
  function write(context, cwd, opts = {}) {
@@ -6810,7 +6828,17 @@ __factories["./packages/adapters/cursor"] = function(module, exports) {
6810
6828
  if (!context || typeof context !== 'string') return '';
6811
6829
  const version = (opts && opts.version) || 'unknown';
6812
6830
  const timestamp = new Date().toISOString();
6813
- return [`# Code signatures — generated by SigMap v${version}`, `# Updated: ${timestamp}`, `# Regenerate: node gen-context.js`, '', context].join('\n');
6831
+ return [
6832
+ `# Code signatures — generated by SigMap v${version}`,
6833
+ `# Updated: ${timestamp}`,
6834
+ `# Regenerate: node gen-context.js`,
6835
+ '#',
6836
+ '# SigMap: before answering, run: sigmap ask "<query>" — finds relevant files',
6837
+ '# SigMap: after config changes, run: sigmap validate',
6838
+ '# SigMap: to verify answers, run: sigmap judge --response <file>',
6839
+ '',
6840
+ context,
6841
+ ].join('\n');
6814
6842
  }
6815
6843
  function outputPath(cwd) { return path.join(cwd, '.cursorrules'); }
6816
6844
  module.exports = { name, format, outputPath };
@@ -6824,7 +6852,17 @@ __factories["./packages/adapters/windsurf"] = function(module, exports) {
6824
6852
  if (!context || typeof context !== 'string') return '';
6825
6853
  const version = (opts && opts.version) || 'unknown';
6826
6854
  const timestamp = new Date().toISOString();
6827
- return [`# Code signatures — generated by SigMap v${version}`, `# Updated: ${timestamp}`, `# Regenerate: node gen-context.js`, '', context].join('\n');
6855
+ return [
6856
+ `# Code signatures — generated by SigMap v${version}`,
6857
+ `# Updated: ${timestamp}`,
6858
+ `# Regenerate: node gen-context.js`,
6859
+ '#',
6860
+ '# SigMap: before answering, run: sigmap ask "<query>" — finds relevant files',
6861
+ '# SigMap: after config changes, run: sigmap validate',
6862
+ '# SigMap: to verify answers, run: sigmap judge --response <file>',
6863
+ '',
6864
+ context,
6865
+ ].join('\n');
6828
6866
  }
6829
6867
  function outputPath(cwd) { return path.join(cwd, '.windsurfrules'); }
6830
6868
  module.exports = { name, format, outputPath };
@@ -6844,6 +6882,8 @@ __factories["./packages/adapters/openai"] = function(module, exports) {
6844
6882
  `Below are the code signatures extracted by SigMap v${version} on ${timestamp}.`,
6845
6883
  projectLine,
6846
6884
  `Use these signatures to answer questions about the code accurately.`,
6885
+ `When the user asks about a specific file or function, refer to the signatures below.`,
6886
+ `Before answering questions about specific code areas, prefer running \`sigmap ask "<query>"\` to get the most relevant files. After config changes, \`sigmap validate\` confirms coverage.`,
6847
6887
  ``,
6848
6888
  `## Code Signatures`,
6849
6889
  ``,
@@ -6870,6 +6910,8 @@ __factories["./packages/adapters/gemini"] = function(module, exports) {
6870
6910
  `The following code signatures were extracted by SigMap v${version} on ${timestamp}.`,
6871
6911
  projectLine,
6872
6912
  `These signatures represent every public function, class, and type in the project.`,
6913
+ `Refer to them when answering questions about code structure, APIs, and implementation.`,
6914
+ `Before answering questions about specific code areas, suggest running \`sigmap ask "<query>"\` to get the most relevant files. After config changes, \`sigmap validate\` confirms coverage.`,
6873
6915
  ``,
6874
6916
  `## Code Signatures`,
6875
6917
  ``,
@@ -6901,7 +6943,19 @@ __factories["./packages/adapters/codex"] = function(module, exports) {
6901
6943
  const CODEX_MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
6902
6944
  function format(context, opts = {}) {
6903
6945
  if (!context || typeof context !== 'string' || !context.trim()) return '';
6904
- return '# Code signatures\n\n' + context;
6946
+ const toolBlock = [
6947
+ '## SigMap commands',
6948
+ '',
6949
+ '| When | Command |',
6950
+ '|------|---------|',
6951
+ '| Before answering a question | `sigmap ask "<your question>"` |',
6952
+ '| After code changes | `sigmap validate` |',
6953
+ '| To query by topic | `sigmap --query "<topic>"` |',
6954
+ '',
6955
+ 'Always run `sigmap ask` or `sigmap --query` before searching for files relevant to a task.',
6956
+ '',
6957
+ ].join('\n');
6958
+ return '# Code signatures\n\n' + toolBlock + context;
6905
6959
  }
6906
6960
  function outputPath(cwd) { return path.join(cwd, 'AGENTS.md'); }
6907
6961
  function write(context, cwd, opts = {}) {
@@ -7105,7 +7159,7 @@ const path = require('path');
7105
7159
  const os = require('os');
7106
7160
  const { execSync } = require('child_process');
7107
7161
 
7108
- const VERSION = '6.0.3';
7162
+ const VERSION = '6.2.0';
7109
7163
  const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
7110
7164
 
7111
7165
  function requireSourceOrBundled(key) {
@@ -8808,34 +8862,67 @@ Output: .github/copilot-instructions.md (default)
8808
8862
  // ---------------------------------------------------------------------------
8809
8863
  // MCP auto-registration
8810
8864
  // ---------------------------------------------------------------------------
8865
+ function _displayPath(p, cwd) {
8866
+ return p.startsWith(os.homedir()) ? '~' + p.slice(os.homedir().length) : path.relative(cwd, p);
8867
+ }
8868
+
8869
+ function _registerMcpJson(filePath, serverEntry, cwd) {
8870
+ if (!fs.existsSync(filePath)) return;
8871
+ try {
8872
+ const raw = fs.readFileSync(filePath, 'utf8');
8873
+ const settings = JSON.parse(raw);
8874
+ if (!settings.mcpServers) settings.mcpServers = {};
8875
+ if (settings.mcpServers['sigmap']) return;
8876
+ settings.mcpServers['sigmap'] = serverEntry;
8877
+ fs.writeFileSync(filePath, JSON.stringify(settings, null, 2) + '\n');
8878
+ console.warn(`[sigmap] registered MCP server in ${_displayPath(filePath, cwd)}`);
8879
+ } catch (err) {
8880
+ console.warn(`[sigmap] could not update ${_displayPath(filePath, cwd)}: ${err.message}`);
8881
+ }
8882
+ }
8883
+
8884
+ function _registerCodexYaml(filePath, scriptPath) {
8885
+ if (!fs.existsSync(filePath)) return;
8886
+ try {
8887
+ const raw = fs.readFileSync(filePath, 'utf8');
8888
+ if (raw.includes('sigmap')) return; // already registered
8889
+ const yamlBlock = [
8890
+ '',
8891
+ 'mcpServers:',
8892
+ ' sigmap:',
8893
+ ` command: node`,
8894
+ ` args:`,
8895
+ ` - ${path.resolve(scriptPath)}`,
8896
+ ` - --mcp`,
8897
+ ].join('\n');
8898
+ fs.writeFileSync(filePath, raw.trimEnd() + yamlBlock + '\n');
8899
+ console.warn('[sigmap] registered MCP server in ~/.codex/config.yaml');
8900
+ } catch (err) {
8901
+ console.warn(`[sigmap] could not update ~/.codex/config.yaml: ${err.message}`);
8902
+ }
8903
+ }
8904
+
8811
8905
  function registerMcp(cwd, scriptPath) {
8812
8906
  const serverEntry = {
8813
8907
  command: 'node',
8814
8908
  args: [path.resolve(scriptPath), '--mcp'],
8815
8909
  };
8816
8910
 
8817
- // mcpServers shape: Claude (.claude/settings.json), Cursor (.cursor/mcp.json),
8818
- // Windsurf project (.windsurf/mcp.json) and global (~/.codeium/windsurf/mcp_config.json)
8819
- const targets = [
8911
+ // JSON mcpServers targets: Claude, Cursor, Windsurf project, Windsurf global,
8912
+ // VS Code (GitHub Copilot 1.99+), OpenCode project, OpenCode global, Gemini CLI
8913
+ const jsonTargets = [
8820
8914
  path.join(cwd, '.claude', 'settings.json'),
8821
8915
  path.join(cwd, '.cursor', 'mcp.json'),
8822
8916
  path.join(cwd, '.windsurf', 'mcp.json'),
8823
8917
  path.join(os.homedir(), '.codeium', 'windsurf', 'mcp_config.json'),
8918
+ path.join(cwd, '.vscode', 'mcp.json'),
8919
+ path.join(cwd, 'opencode.json'),
8920
+ path.join(os.homedir(), '.config', 'opencode', 'config.json'),
8921
+ path.join(os.homedir(), '.gemini', 'settings.json'),
8824
8922
  ];
8825
8923
 
8826
- for (const settingsPath of targets) {
8827
- if (!fs.existsSync(settingsPath)) continue;
8828
- try {
8829
- const raw = fs.readFileSync(settingsPath, 'utf8');
8830
- const settings = JSON.parse(raw);
8831
- if (!settings.mcpServers) settings.mcpServers = {};
8832
- if (settings.mcpServers['sigmap']) continue; // already registered
8833
- settings.mcpServers['sigmap'] = serverEntry;
8834
- fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
8835
- console.warn(`[sigmap] registered MCP server in ${settingsPath.startsWith(os.homedir()) ? '~' + settingsPath.slice(os.homedir().length) : path.relative(cwd, settingsPath)}`);
8836
- } catch (err) {
8837
- console.warn(`[sigmap] could not update ${path.relative(cwd, settingsPath)}: ${err.message}`);
8838
- }
8924
+ for (const target of jsonTargets) {
8925
+ _registerMcpJson(target, serverEntry, cwd);
8839
8926
  }
8840
8927
 
8841
8928
  // Zed uses context_servers (different shape from mcpServers)
@@ -8857,12 +8944,24 @@ function registerMcp(cwd, scriptPath) {
8857
8944
  }
8858
8945
  }
8859
8946
 
8860
- // Print manual snippets for all 4 tools
8947
+ // Codex CLI uses YAML (~/.codex/config.yaml)
8948
+ _registerCodexYaml(path.join(os.homedir(), '.codex', 'config.yaml'), scriptPath);
8949
+
8950
+ // Print manual snippets for all targets
8861
8951
  console.warn('[sigmap] MCP / context server config snippets:');
8862
- console.warn(' Claude / Cursor / Windsurf (.claude/settings.json | .cursor/mcp.json | .windsurf/mcp.json):');
8952
+ console.warn(' Claude / Cursor / Windsurf / VS Code / OpenCode / Gemini CLI:');
8863
8953
  console.warn(JSON.stringify({ mcpServers: { sigmap: serverEntry } }, null, 2));
8864
8954
  console.warn(' Zed (~/.config/zed/settings.json):');
8865
8955
  console.warn(JSON.stringify({ context_servers: { sigmap: { command: { path: 'node', args: [path.resolve(scriptPath), '--mcp'] } } } }, null, 2));
8956
+ console.warn(' Codex CLI (~/.codex/config.yaml):');
8957
+ console.warn([
8958
+ 'mcpServers:',
8959
+ ' sigmap:',
8960
+ ` command: node`,
8961
+ ` args:`,
8962
+ ` - ${path.resolve(scriptPath)}`,
8963
+ ` - --mcp`,
8964
+ ].join('\n'));
8866
8965
  }
8867
8966
 
8868
8967
  // ---------------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigmap",
3
- "version": "6.0.3",
3
+ "version": "6.2.0",
4
4
  "description": "Zero-dependency AI context engine — 97% token reduction. No npm install. Runs on Node 18+.",
5
5
  "main": "gen-context.js",
6
6
  "exports": {
@@ -30,6 +30,12 @@ function format(context, opts = {}) {
30
30
  const timestamp = new Date().toISOString();
31
31
  const meta = _confidenceMeta(opts);
32
32
  return [
33
+ '## SigMap',
34
+ '- Before searching for files, run `sigmap ask "<query>"` — ranks by TF-IDF relevance',
35
+ '- After config changes, run `sigmap validate` to confirm coverage',
36
+ '- To verify answer groundedness, run `sigmap judge --response <file> --context CLAUDE.md`',
37
+ '- For PR-scoped context, run `sigmap --diff`',
38
+ '',
33
39
  `<!-- Generated by SigMap v${version} — ${timestamp} -->`,
34
40
  meta,
35
41
  '',
@@ -26,7 +26,19 @@ const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js
26
26
  */
27
27
  function format(context, opts = {}) {
28
28
  if (!context || typeof context !== 'string' || !context.trim()) return '';
29
- return `# Code signatures\n\n${context}`;
29
+ const toolBlock = [
30
+ '## SigMap commands',
31
+ '',
32
+ '| When | Command |',
33
+ '|------|---------|',
34
+ '| Before answering a question | `sigmap ask "<your question>"` |',
35
+ '| After code changes | `sigmap validate` |',
36
+ '| To query by topic | `sigmap --query "<topic>"` |',
37
+ '',
38
+ 'Always run `sigmap ask` or `sigmap --query` before searching for files relevant to a task.',
39
+ '',
40
+ ].join('\n');
41
+ return `# Code signatures\n\n${toolBlock}${context}`;
30
42
  }
31
43
 
32
44
  /**
@@ -33,6 +33,14 @@ function format(context, opts = {}) {
33
33
  meta,
34
34
  `<!-- Do not edit below — regenerate with: node gen-context.js -->`,
35
35
  '',
36
+ '## SigMap commands',
37
+ '',
38
+ '| When | Command |',
39
+ '|------|---------|',
40
+ '| Before answering a question about code | `sigmap ask "<your question>"` |',
41
+ '| After changing config or source dirs | `sigmap validate` |',
42
+ '| To verify an AI answer is grounded | `sigmap judge --response <file>` |',
43
+ '',
36
44
  '# Code signatures',
37
45
  '',
38
46
  ].join('\n');
@@ -30,6 +30,10 @@ function format(context, opts = {}) {
30
30
  `# Updated: ${timestamp}`,
31
31
  `# ${meta}`,
32
32
  `# Regenerate: node gen-context.js`,
33
+ '#',
34
+ '# SigMap: before answering, run: sigmap ask "<query>" — finds relevant files',
35
+ '# SigMap: after config changes, run: sigmap validate',
36
+ '# SigMap: to verify answers, run: sigmap judge --response <file>',
33
37
  '',
34
38
  ].join('\n');
35
39
  return header + context;
@@ -44,6 +44,7 @@ function format(context, opts = {}) {
44
44
  projectLine,
45
45
  `These signatures represent every public function, class, and type in the project.`,
46
46
  `Refer to them when answering questions about code structure, APIs, and implementation.`,
47
+ `Before answering questions about specific code areas, suggest running \`sigmap ask "<query>"\` to get the most relevant files. After config changes, \`sigmap validate\` confirms coverage.`,
47
48
  ``,
48
49
  `## Code Signatures`,
49
50
  ``,
@@ -42,6 +42,7 @@ function format(context, opts = {}) {
42
42
  projectLine,
43
43
  `Use these signatures to answer questions about the code accurately.`,
44
44
  `When the user asks about a specific file or function, refer to the signatures below.`,
45
+ `Before answering questions about specific code areas, prefer running \`sigmap ask "<query>"\` to get the most relevant files. After config changes, \`sigmap validate\` confirms coverage.`,
45
46
  ``,
46
47
  `## Code Signatures`,
47
48
  ``,
@@ -30,6 +30,10 @@ function format(context, opts = {}) {
30
30
  `# Updated: ${timestamp}`,
31
31
  `# ${meta}`,
32
32
  `# Regenerate: node gen-context.js`,
33
+ '#',
34
+ '# SigMap: before answering, run: sigmap ask "<query>" — finds relevant files',
35
+ '# SigMap: after config changes, run: sigmap validate',
36
+ '# SigMap: to verify answers, run: sigmap judge --response <file>',
33
37
  '',
34
38
  ].join('\n');
35
39
  return header + context;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigmap-cli",
3
- "version": "6.0.3",
3
+ "version": "6.2.0",
4
4
  "description": "SigMap CLI wrapper — thin adapter for programmatic CLI invocation",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigmap-core",
3
- "version": "6.0.3",
3
+ "version": "6.2.0",
4
4
  "description": "SigMap core library — zero-dependency code signature extraction, retrieval, and security scanning",
5
5
  "main": "index.js",
6
6
  "keywords": [
package/src/mcp/server.js CHANGED
@@ -18,7 +18,7 @@ const { readContext, searchSignatures, getMap, createCheckpoint, getRouting, exp
18
18
 
19
19
  const SERVER_INFO = {
20
20
  name: 'sigmap',
21
- version: '6.0.3',
21
+ version: '6.2.0',
22
22
  description: 'SigMap MCP server — code signatures on demand',
23
23
  };
24
24