sigmap 5.1.0 → 5.3.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
@@ -12,27 +12,62 @@ Use this marker block for all appendable context files:
12
12
  ## Auto-generated signatures
13
13
  <!-- Updated by gen-context.js -->
14
14
  You are a coding assistant with full knowledge of this codebase.
15
- Below are the code signatures extracted by SigMap v5.1.0 on 2026-04-16T21:33:38.411Z.
15
+ Below are the code signatures extracted by SigMap v5.2.0 on 2026-04-16T23:13:56.540Z.
16
16
 
17
17
  Use these signatures to answer questions about the code accurately.
18
18
 
19
19
  ## Code Signatures
20
20
 
21
- <!-- Generated by SigMap gen-context.js v5.1.0 -->
21
+ <!-- Generated by SigMap gen-context.js v5.2.0 -->
22
22
  <!-- DO NOT EDIT below the marker line — run gen-context.js to regenerate -->
23
23
 
24
24
  # Code signatures
25
25
 
26
- ## changes (last 5 commits — 16 minutes ago)
26
+ ## changes (last 5 commits — 46 minutes ago)
27
27
  ```
28
28
  src/config/loader.js +loadBaseConfig ~loadConfig ~deepClone
29
29
  src/format/dashboard.js ~computeExtractorCoverage ~readBenchmarkTrend
30
- src/judge/judge-engine.js +tokenize +groundedness +judge
31
- src/retrieval/ranker.js +detectIntent ~formatRankJSON
30
+ src/judge/judge-engine.js +tokenize +groundedness +extractContextFiles +judge
31
+ src/learning/weights.js +weightsPath +clampMultiplier +normalizeFile +sanitizeWeights
32
+ src/mcp/handlers.js ~queryContext ~getImpact
33
+ src/retrieval/ranker.js ~scoreFile ~rank
34
+ packages/core/index.js ~extract
32
35
  ```
33
36
 
34
37
  ## packages
35
38
 
39
+ ### packages/core/README.md
40
+ ```
41
+ h1 sigmap-core
42
+ h2 Installation
43
+ h2 Quick start
44
+ h2 API reference
45
+ h3 `extract(src, language)` → `string[]`
46
+ h3 `rank(query, sigIndex, opts?)` → `Result[]`
47
+ h3 `buildSigIndex(cwd)` → `Map<string, string[]>`
48
+ h3 `scan(sigs, filePath)` → `{ safe: string[], redacted: boolean }`
49
+ h3 `score(cwd)` → `HealthResult`
50
+ h2 Migration from v2.3 and earlier
51
+ h2 v3.0 — Multi-Adapter Architecture (released)
52
+ h2 Zero dependencies
53
+ code-fence bash
54
+ code-fence plain
55
+ code-fence js
56
+ code-fence ---
57
+ ```
58
+
59
+ ### packages/core/index.js
60
+ ```
61
+ module.exports = { extract, rank, buildSigIndex, scan, score, adapt }
62
+ function _resolveExtractor(language)
63
+ function extract(src, language) → string[]
64
+ function rank(query, sigIndex, opts) → { file: string, score: nu
65
+ function buildSigIndex(cwd) → Map<string, string[]>
66
+ function scan(sigs, filePath) → { safe: string[], redacte
67
+ function score(cwd) → { * score: number, * grad
68
+ function adapt(context, adapterName, opts = {}) → string
69
+ ```
70
+
36
71
  ### packages/adapters/claude.js
37
72
  ```
38
73
  module.exports = { name, format, outputPath, write }
@@ -115,38 +150,6 @@ module.exports = { CLI_ENTRY, run }
115
150
  function run(argv, cwd) → void
116
151
  ```
117
152
 
118
- ### packages/core/README.md
119
- ```
120
- h1 sigmap-core
121
- h2 Installation
122
- h2 Quick start
123
- h2 API reference
124
- h3 `extract(src, language)` → `string[]`
125
- h3 `rank(query, sigIndex, opts?)` → `Result[]`
126
- h3 `buildSigIndex(cwd)` → `Map<string, string[]>`
127
- h3 `scan(sigs, filePath)` → `{ safe: string[], redacted: boolean }`
128
- h3 `score(cwd)` → `HealthResult`
129
- h2 Migration from v2.3 and earlier
130
- h2 v3.0 — Multi-Adapter Architecture (released)
131
- h2 Zero dependencies
132
- code-fence bash
133
- code-fence plain
134
- code-fence js
135
- code-fence ---
136
- ```
137
-
138
- ### packages/core/index.js
139
- ```
140
- module.exports = { extract, rank, buildSigIndex, scan, score, adapt }
141
- function _resolveExtractor(language)
142
- function extract(src, language) → string[]
143
- function rank(query, sigIndex, opts) → { file: string, score: nu
144
- function buildSigIndex(cwd) → Map<string, string[]>
145
- function scan(sigs, filePath) → { safe: string[], redacte
146
- function score(cwd) → { * score: number, * grad
147
- function adapt(context, adapterName, opts = {}) → string
148
- ```
149
-
150
153
  ## src
151
154
 
152
155
  ### src/config/loader.js
@@ -183,9 +186,39 @@ function renderHistoryCharts(cwd, health)
183
186
  module.exports = { groundedness, judge }
184
187
  function tokenize(text)
185
188
  function groundedness(response, context)
189
+ function extractContextFiles(context, cwd)
186
190
  function judge(response, context, opts = {})
187
191
  ```
188
192
 
193
+ ### src/learning/weights.js
194
+ ```
195
+ module.exports = { BASELINE, DECAY, MAX_MULT, MIN_MULT, weightsPath, clampMultiplier, normalizeFile, loadWeights, saveWeights, updateWeights, boostFiles, penalizeFiles, resetWeights }
196
+ function weightsPath(cwd)
197
+ function clampMultiplier(value)
198
+ function normalizeFile(cwd, filePath)
199
+ function sanitizeWeights(cwd, weights)
200
+ function loadWeights(cwd)
201
+ function saveWeights(cwd, weights)
202
+ function updateWeights(cwd, opts = {})
203
+ function boostFiles(cwd, files, amount = 0.15)
204
+ function penalizeFiles(cwd, files, amount = 0.10)
205
+ function resetWeights(cwd)
206
+ ```
207
+
208
+ ### src/mcp/handlers.js
209
+ ```
210
+ module.exports = { readContext, searchSignatures, getMap, createCheckpoint, getRouting, explainFile, listModules, queryContext, getImpact }
211
+ function readContext(args, cwd)
212
+ function searchSignatures(args, cwd)
213
+ function getMap(args, cwd)
214
+ function createCheckpoint(args, cwd)
215
+ function getRouting(args, cwd)
216
+ function explainFile(args, cwd)
217
+ function listModules(args, cwd)
218
+ function queryContext(args, cwd)
219
+ function getImpact(args, cwd)
220
+ ```
221
+
189
222
  ### src/mcp/server.js
190
223
  ```
191
224
  module.exports = { start }
@@ -625,20 +658,6 @@ function shouldSkipFile(rel)
625
658
  function analyze(files, cwd)
626
659
  ```
627
660
 
628
- ### src/mcp/handlers.js
629
- ```
630
- module.exports = { readContext, searchSignatures, getMap, createCheckpoint, getRouting, explainFile, listModules, queryContext, getImpact }
631
- function readContext(args, cwd)
632
- function searchSignatures(args, cwd)
633
- function getMap(args, cwd)
634
- function createCheckpoint(args, cwd)
635
- function getRouting(args, cwd)
636
- function explainFile(args, cwd)
637
- function listModules(args, cwd)
638
- function queryContext(args, cwd)
639
- function getImpact(args, cwd)
640
- ```
641
-
642
661
  ### src/mcp/tools.js
643
662
  ```
644
663
  module.exports = { TOOLS }
package/CHANGELOG.md CHANGED
@@ -10,6 +10,34 @@ Format: [Semantic Versioning](https://semver.org/)
10
10
 
11
11
  ---
12
12
 
13
+ ## [5.3.0] — 2026-04-17
14
+
15
+ ### Added
16
+
17
+ - **MCP auto-wire: Windsurf** — `sigmap --setup` now registers the MCP server in `.windsurf/mcp.json` (project-level) and `~/.codeium/windsurf/mcp_config.json` (global) using the standard `mcpServers` shape.
18
+ - **MCP auto-wire: Zed** — `sigmap --setup` now registers a context server in `~/.config/zed/settings.json` using Zed's `context_servers` shape (`command.path` / `command.args`).
19
+ - **Updated `--setup` snippet** — help output now prints manual config snippets for all four tools: Claude, Cursor, Windsurf, and Zed.
20
+
21
+ ### Changed
22
+
23
+ - `registerMcp()` skips each target when the file does not exist and never overwrites an already-registered `sigmap` entry (idempotent).
24
+
25
+ ---
26
+
27
+ ## [5.2.0] — 2026-04-17
28
+
29
+ ### Added
30
+
31
+ - **Learning engine** — new local-only weight store at `.context/weights.json` with path-normalized per-file multipliers, clamp safety (`0.30..3.00`), and decay on every non-reset mutation.
32
+ - **`sigmap learn`** — manually boost or penalize ranked files with `--good <files...>`, `--bad <files...>`, and `--reset`. Invalid or out-of-repo paths are skipped with warnings; the command exits non-zero when no valid targets remain.
33
+ - **`sigmap weights [--json]`** — explainability view for learned ranking multipliers. Human mode prints a compact table and reset hint; JSON mode emits the raw learned-weight object.
34
+ - **Opt-in judge learning** — `sigmap judge --response <file> --context <file> --learn` now extracts file headings from query/generated context files and applies small boosts or penalties when groundedness is confidently high or low.
35
+
36
+ ### Changed
37
+
38
+ - **Ranker learned weighting** — `rank(query, sigIndex, { cwd })` now loads `.context/weights.json` and multiplies non-empty-query scores by learned file multipliers. Empty-query fallback ordering is unchanged.
39
+ - **Learning-aware rank call sites** — `sigmap ask`, `sigmap --query`, `sigmap validate --query`, and MCP `query_context` now pass `cwd` into the ranker so learned weights apply consistently across CLI and MCP flows.
40
+
13
41
  ## [5.1.0] — 2026-04-16
14
42
 
15
43
  ### Added
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  </div>
13
13
 
14
14
  <div align="center">
15
- <img src="docs/impact-banner.svg" alt="SigMap — better answers, 97% fewer tokens, fewer prompts" width="760" />
15
+ <img src="docs/impact-banner.svg" alt="SigMap — grounded AI coding context with fewer prompts and smaller context windows" width="760" />
16
16
  </div>
17
17
 
18
18
  ```sh
@@ -21,11 +21,28 @@ npx sigmap # 10 seconds. zero config. your AI never reads the wrong file again
21
21
 
22
22
  **What you get in ~10 seconds**
23
23
  - A compact signature map of your codebase
24
- - The right file in context far more often (84.4% hit@5 vs 13.6% random)
25
- - Fewer retries (1.59 vs 2.84 prompts per task)
24
+ - The right file in context far more often (78.9% hit@5 vs 13.6% random)
25
+ - Fewer retries (1.69 vs 2.84 prompts per task)
26
26
  - Far smaller context (~2K–4K tokens instead of ~80K)
27
27
 
28
- > Latest: **v4.1.0** — Smart Budget. Token budget now auto-scales to your repo size, targeting 80% source-file coverage by default. No config change needed it just works.
28
+ > Latest: **v5.3.0** — Learning engine + workflow-first release. Use `ask`, `validate`, `judge`, `learn`, `weights`, `compare`, and `share` on top of the core signature pipeline.
29
+
30
+ **What is new in v5.2**
31
+ - `sigmap ask` creates task-focused context in one step
32
+ - `sigmap validate` checks config health and query coverage
33
+ - `sigmap judge` scores groundedness against the supplied context
34
+ - `sigmap learn` and `sigmap weights` add safe local-only ranking feedback
35
+ - `node scripts/run-benchmark-matrix.mjs --save --skip-clone` now writes an HTML benchmark dashboard
36
+
37
+ **Daily workflow**
38
+
39
+ ```bash
40
+ npx sigmap
41
+ sigmap ask "explain the auth flow"
42
+ sigmap validate --query "auth login token"
43
+ sigmap judge --response response.txt --context .context/query-context.md
44
+ sigmap weights
45
+ ```
29
46
 
30
47
  <div align="center">
31
48
  <img src="demo.gif" alt="SigMap demo — reducing 80K tokens to 4K in under 10 seconds" width="760" />
@@ -61,11 +78,11 @@ npx sigmap # 10 seconds. zero config. your AI never reads the wrong file again
61
78
 
62
79
  | | Without SigMap | With SigMap |
63
80
  |---|:---:|:---:|
64
- | Task success | 10% | **59%** |
65
- | Prompts per task | 2.84 | **1.59** |
81
+ | Task success | 10% | **52.2%** |
82
+ | Prompts per task | 2.84 | **1.69** |
66
83
  | Tokens per session | ~80,000 | **~2,000** |
67
- | Right file found | 13.6% | **84.4%** |
68
- | Hallucination risk | 92% | **0%** |
84
+ | Right file found | 13.6% | **78.9%** |
85
+ | Hidden-symbol risk | 74.7% | **context surfaced locally** |
69
86
 
70
87
  Measured on 90 coding tasks across 18 real public repos. Full methodology and raw benchmark pages are linked below.
71
88
 
@@ -82,7 +99,7 @@ Measured on 90 coding tasks across 18 real public repos. Full methodology and ra
82
99
  | [Standalone binaries](docs/readmes/binaries.md) | macOS, Linux, Windows — no Node required |
83
100
  | [VS Code extension](#-vs-code-extension) | Status bar, stale alerts, commands |
84
101
  | [JetBrains plugin](#-jetbrains-plugin) | IntelliJ IDEA, WebStorm, PyCharm support |
85
- | [Languages supported](#-languages-supported) | 25 languages |
102
+ | [Languages supported](#-languages-supported) | 29 languages |
86
103
  | [Context strategies](#-context-strategies) | full / per-module / hot-cold |
87
104
  | [MCP server](#-mcp-server) | 8 on-demand tools |
88
105
  | [CLI reference](#-cli-reference) | All flags |
@@ -105,7 +122,7 @@ SigMap scans your source files and extracts only the **function and class signat
105
122
  Your codebase
106
123
 
107
124
 
108
- sigmap ─────────► extracts signatures from 25 languages
125
+ sigmap ─────────► extracts signatures from 29 languages
109
126
 
110
127
 
111
128
  .github/copilot-instructions.md ◄── auto-read by Copilot / Claude / Cursor
@@ -126,7 +143,7 @@ AI agent session starts with full context
126
143
  | **SigMap signatures** | **~4,000** | **95%** |
127
144
  | SigMap + MCP (`hot-cold`) | ~200 | **99.75%** |
128
145
 
129
- > **97% fewer tokens. The same codebase understanding.**
146
+ > **98.1% fewer tokens in the latest saved benchmark snapshot.**
130
147
 
131
148
  ### Benchmark: real-world repos
132
149
 
@@ -153,7 +170,7 @@ Reproduced with `node scripts/run-benchmark.mjs` on public repos:
153
170
  | fastify | JavaScript | 54.4K | 2.6K | **95.3%** |
154
171
  | fastapi | Python | 178.4K | 5.2K | **97.1%** |
155
172
 
156
- **Average: 97.6% reduction across 18 repos (16 languages).** See [`benchmarks/reports/token-reduction.md`](benchmarks/reports/token-reduction.md) or reproduce with `node scripts/run-benchmark.mjs`.
173
+ **Average: 97.6% reduction across 18 repos (16 languages).** See [`benchmarks/reports/token-reduction.md`](benchmarks/reports/token-reduction.md), open `benchmarks/reports/benchmark-report.html` after a matrix run, or reproduce with `node scripts/run-benchmark.mjs`.
157
174
 
158
175
  ---
159
176
 
@@ -503,12 +520,12 @@ Compatible with **IntelliJ IDEA 2024.1+** (Community & Ultimate), **WebStorm**,
503
520
 
504
521
  ## 🌐 Languages supported
505
522
 
506
- > 25 languages. All implemented with zero external dependencies — pure regex + Node built-ins.
523
+ > 29 languages and formats. All implemented with zero external dependencies — pure regex + Node built-ins.
507
524
  >
508
525
  > Also includes lightweight config/doc extraction for `.toml`, `.properties`, `.xml`, and `.md` to improve real-repo coverage beyond source-code files.
509
526
 
510
527
  <details>
511
- <summary><strong>Show all 25 languages</strong></summary>
528
+ <summary><strong>Show all 29 languages</strong></summary>
512
529
 
513
530
  | Language | Extensions | Extracts |
514
531
  |---|---|---|
@@ -737,7 +754,7 @@ Copy `gen-context.config.json.example` to `gen-context.config.json`:
737
754
  - **`secretScan`** — redact secrets (AWS keys, tokens, etc.) from output
738
755
  - **`strategy`** — output mode: `full` (default) | `per-module` | `hot-cold`
739
756
 
740
- **Token budget (v4.1.0 — auto-scaling):**
757
+ **Token budget (auto-scaling):**
741
758
 
742
759
  | Key | Default | Description |
743
760
  |---|---|---|
@@ -788,13 +805,13 @@ If `output` is omitted, the default `.github/copilot-instructions.md` is used.
788
805
 
789
806
  ## 📊 Observability
790
807
 
791
- ### Coverage score (v4.0)
808
+ ### Coverage score
792
809
 
793
810
  Every run now prints a coverage line alongside token reduction:
794
811
 
795
812
  ```
796
813
  ───────────────────────────────────────────
797
- SigMap v4.1.0
814
+ SigMap v5.3.0
798
815
  Files scanned : 76
799
816
  Symbols found : 332
800
817
  Token reduction: 94% (65,227 → 4,103)
@@ -813,7 +830,7 @@ sigmap --report
813
830
 
814
831
  ```
815
832
  [sigmap] report:
816
- version : 4.1.0
833
+ version : 5.3.0
817
834
  files processed : 76
818
835
  reduction : 93.7%
819
836
  coverage : A (97%) — 76 of 78 source files included
@@ -857,7 +874,7 @@ sigmap --health --json
857
874
  Every output file now carries a metadata line so you can inspect freshness at a glance:
858
875
 
859
876
  ```
860
- <!-- sigmap: version=4.0.0 confidence=HIGH coverage=97% dropped=2 commit=8540612 -->
877
+ <!-- sigmap: version=5.3.0 confidence=HIGH coverage=97% dropped=2 commit=8540612 -->
861
878
  ```
862
879
 
863
880
  ### Diff risk score