sigmap 6.2.0 → 6.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 +54 -29
- package/CHANGELOG.md +8 -0
- package/gen-context.js +67 -4
- package/package.json +1 -1
- package/packages/adapters/claude.js +42 -0
- package/packages/adapters/codex.js +48 -0
- package/packages/cli/package.json +1 -1
- package/packages/core/package.json +1 -1
- package/src/mcp/server.js +1 -1
package/AGENTS.md
CHANGED
|
@@ -9,28 +9,53 @@ When writing generated signature content, never overwrite human-written notes ab
|
|
|
9
9
|
Use this marker block for all appendable context files:
|
|
10
10
|
|
|
11
11
|
```
|
|
12
|
+
## Tools
|
|
13
|
+
|
|
14
|
+
<!-- sigmap-tools -->
|
|
15
|
+
|
|
16
|
+
```json
|
|
17
|
+
[
|
|
18
|
+
{
|
|
19
|
+
"name": "sigmap_ask",
|
|
20
|
+
"description": "Rank source files by relevance to a natural-language query. Run before exploring the codebase.",
|
|
21
|
+
"command": "sigmap ask \"$QUERY\""
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "sigmap_validate",
|
|
25
|
+
"description": "Validate SigMap config and measure context coverage. Run after changing config or source dirs.",
|
|
26
|
+
"command": "sigmap validate"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "sigmap_judge",
|
|
30
|
+
"description": "Score an LLM response for groundedness against source context. Use to verify answer quality.",
|
|
31
|
+
"command": "sigmap judge --response \"$RESPONSE\" --context \"$CONTEXT\""
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "sigmap_query",
|
|
35
|
+
"description": "Rank all files by relevance using TF-IDF and write a focused mini-context.",
|
|
36
|
+
"command": "sigmap --query \"$QUERY\" --context"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "sigmap_weights",
|
|
40
|
+
"description": "Show learned file-ranking multipliers accumulated from past sessions.",
|
|
41
|
+
"command": "sigmap weights"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
```
|
|
45
|
+
|
|
12
46
|
## Auto-generated signatures
|
|
13
47
|
<!-- Updated by gen-context.js -->
|
|
14
48
|
# Code signatures
|
|
15
49
|
|
|
16
|
-
##
|
|
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)
|
|
50
|
+
## changes (last 5 commits — 0 seconds ago)
|
|
26
51
|
```
|
|
27
52
|
src/learning/weights.js +exportWeights +importWeights ~resetWeights
|
|
28
|
-
packages/adapters/
|
|
29
|
-
packages/adapters/
|
|
53
|
+
packages/adapters/codex.js ~write ~format
|
|
54
|
+
packages/adapters/claude.js ~format ~write
|
|
30
55
|
packages/adapters/gemini.js ~format
|
|
31
56
|
packages/adapters/copilot.js ~format
|
|
32
|
-
packages/adapters/openai.js ~format
|
|
33
57
|
packages/adapters/cursor.js ~format
|
|
58
|
+
packages/adapters/openai.js ~format
|
|
34
59
|
packages/adapters/windsurf.js ~format
|
|
35
60
|
```
|
|
36
61
|
|
|
@@ -91,19 +116,19 @@ function score(cwd) → { * score: number, * grad
|
|
|
91
116
|
function adapt(context, adapterName, opts = {}) → string
|
|
92
117
|
```
|
|
93
118
|
|
|
94
|
-
### packages/adapters/
|
|
119
|
+
### packages/adapters/codex.js
|
|
95
120
|
```
|
|
96
121
|
module.exports = { name, format, outputPath, write }
|
|
97
122
|
function format(context, opts = {}) → string
|
|
98
|
-
function _confidenceMeta(opts)
|
|
99
123
|
function outputPath(cwd) → string
|
|
100
124
|
function write(context, cwd, opts = {})
|
|
101
125
|
```
|
|
102
126
|
|
|
103
|
-
### packages/adapters/
|
|
127
|
+
### packages/adapters/claude.js
|
|
104
128
|
```
|
|
105
129
|
module.exports = { name, format, outputPath, write }
|
|
106
130
|
function format(context, opts = {}) → string
|
|
131
|
+
function _confidenceMeta(opts)
|
|
107
132
|
function outputPath(cwd) → string
|
|
108
133
|
function write(context, cwd, opts = {})
|
|
109
134
|
```
|
|
@@ -126,20 +151,20 @@ function outputPath(cwd) → string
|
|
|
126
151
|
function write(context, cwd, opts = {})
|
|
127
152
|
```
|
|
128
153
|
|
|
129
|
-
### packages/adapters/
|
|
154
|
+
### packages/adapters/cursor.js
|
|
130
155
|
```
|
|
131
156
|
module.exports = { name, format, outputPath }
|
|
132
157
|
function format(context, opts = {}) → string
|
|
133
|
-
function outputPath(cwd) → string
|
|
134
158
|
function _confidenceMeta(opts)
|
|
159
|
+
function outputPath(cwd) → string
|
|
135
160
|
```
|
|
136
161
|
|
|
137
|
-
### packages/adapters/
|
|
162
|
+
### packages/adapters/openai.js
|
|
138
163
|
```
|
|
139
164
|
module.exports = { name, format, outputPath }
|
|
140
165
|
function format(context, opts = {}) → string
|
|
141
|
-
function _confidenceMeta(opts)
|
|
142
166
|
function outputPath(cwd) → string
|
|
167
|
+
function _confidenceMeta(opts)
|
|
143
168
|
```
|
|
144
169
|
|
|
145
170
|
### packages/adapters/windsurf.js
|
|
@@ -648,15 +673,6 @@ function extractClassMembers(block)
|
|
|
648
673
|
function normalizeParams(params)
|
|
649
674
|
```
|
|
650
675
|
|
|
651
|
-
### src/mcp/server.js
|
|
652
|
-
```
|
|
653
|
-
module.exports = { start }
|
|
654
|
-
function respond(id, result)
|
|
655
|
-
function respondError(id, code, message)
|
|
656
|
-
function dispatch(msg, cwd)
|
|
657
|
-
function start(cwd)
|
|
658
|
-
```
|
|
659
|
-
|
|
660
676
|
### src/learning/weights.js
|
|
661
677
|
```
|
|
662
678
|
module.exports = { BASELINE, DECAY, MAX_MULT, MIN_MULT, weightsPath, clampMultiplier, normalizeFile, loadWeights, saveWeights, updateWeights, boostFiles, penalizeFiles, resetWeights, exportWeights, importWeights }
|
|
@@ -673,3 +689,12 @@ function resetWeights(cwd)
|
|
|
673
689
|
function exportWeights(cwd, outputPath)
|
|
674
690
|
function importWeights(cwd, importPath, replace)
|
|
675
691
|
```
|
|
692
|
+
|
|
693
|
+
### src/mcp/server.js
|
|
694
|
+
```
|
|
695
|
+
module.exports = { start }
|
|
696
|
+
function respond(id, result)
|
|
697
|
+
function respondError(id, code, message)
|
|
698
|
+
function dispatch(msg, cwd)
|
|
699
|
+
function start(cwd)
|
|
700
|
+
```
|
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,14 @@ Format: [Semantic Versioning](https://semver.org/)
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
+
## [6.3.0] — 2026-04-22
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **Native tool registration (Level 3)** — `codex.write()` injects a `## Tools` JSON block into AGENTS.md with 5 named sigmap shell tools (`sigmap_ask`, `sigmap_validate`, `sigmap_judge`, `sigmap_query`, `sigmap_weights`); Codex CLI and OpenCode surface these in their tool picker. `claude.write()` injects a `## Bash allowlist` section into CLAUDE.md with `permissions.allow` patterns for all sigmap commands; adding these to `.claude/settings.json` bypasses the Claude Code confirmation prompt. Both sections are idempotent and preserve human content.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
13
21
|
## [6.2.0] — 2026-04-22
|
|
14
22
|
|
|
15
23
|
### Added
|
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.
|
|
5390
|
+
version: '6.3.0',
|
|
5391
5391
|
description: 'SigMap MCP server — code signatures on demand',
|
|
5392
5392
|
};
|
|
5393
5393
|
|
|
@@ -6789,6 +6789,36 @@ __factories["./packages/adapters/claude"] = function(module, exports) {
|
|
|
6789
6789
|
const fs = require('fs');
|
|
6790
6790
|
const name = 'claude';
|
|
6791
6791
|
const CLAUDE_MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
|
|
6792
|
+
const CLAUDE_ALLOWLIST_MARKER = '<!-- sigmap-bash-allowlist -->';
|
|
6793
|
+
const CLAUDE_ALLOWLIST_BLOCK = [
|
|
6794
|
+
'## Bash allowlist',
|
|
6795
|
+
'',
|
|
6796
|
+
CLAUDE_ALLOWLIST_MARKER,
|
|
6797
|
+
'',
|
|
6798
|
+
'The following sigmap commands are pre-approved — Claude Code will not prompt for confirmation:',
|
|
6799
|
+
'',
|
|
6800
|
+
'```json',
|
|
6801
|
+
JSON.stringify({
|
|
6802
|
+
permissions: {
|
|
6803
|
+
allow: [
|
|
6804
|
+
'Bash(sigmap ask*)',
|
|
6805
|
+
'Bash(sigmap validate*)',
|
|
6806
|
+
'Bash(sigmap judge*)',
|
|
6807
|
+
'Bash(sigmap weights*)',
|
|
6808
|
+
'Bash(sigmap history*)',
|
|
6809
|
+
'Bash(sigmap --query*)',
|
|
6810
|
+
'Bash(sigmap --diff*)',
|
|
6811
|
+
'Bash(sigmap --health*)',
|
|
6812
|
+
'Bash(sigmap --coverage*)',
|
|
6813
|
+
'Bash(node gen-context.js*)',
|
|
6814
|
+
],
|
|
6815
|
+
},
|
|
6816
|
+
}, null, 2),
|
|
6817
|
+
'```',
|
|
6818
|
+
'',
|
|
6819
|
+
'Add the `permissions.allow` array above to `.claude/settings.json` to activate.',
|
|
6820
|
+
'',
|
|
6821
|
+
].join('\n');
|
|
6792
6822
|
function format(context, opts = {}) {
|
|
6793
6823
|
if (!context || typeof context !== 'string') return '';
|
|
6794
6824
|
const version = (opts && opts.version) || 'unknown';
|
|
@@ -6812,9 +6842,17 @@ __factories["./packages/adapters/claude"] = function(module, exports) {
|
|
|
6812
6842
|
if (fs.existsSync(filePath)) existing = fs.readFileSync(filePath, 'utf8');
|
|
6813
6843
|
const formatted = format(context, opts);
|
|
6814
6844
|
const markerIdx = existing.indexOf('## Auto-generated signatures');
|
|
6815
|
-
|
|
6845
|
+
let newContent = markerIdx !== -1
|
|
6816
6846
|
? existing.slice(0, markerIdx) + CLAUDE_MARKER.trimStart() + formatted
|
|
6817
6847
|
: existing + CLAUDE_MARKER + formatted;
|
|
6848
|
+
if (!newContent.includes(CLAUDE_ALLOWLIST_MARKER)) {
|
|
6849
|
+
const sigPos = newContent.indexOf('## Auto-generated signatures');
|
|
6850
|
+
if (sigPos !== -1) {
|
|
6851
|
+
newContent = newContent.slice(0, sigPos) + CLAUDE_ALLOWLIST_BLOCK + '\n' + newContent.slice(sigPos);
|
|
6852
|
+
} else {
|
|
6853
|
+
newContent = CLAUDE_ALLOWLIST_BLOCK + '\n' + newContent;
|
|
6854
|
+
}
|
|
6855
|
+
}
|
|
6818
6856
|
fs.writeFileSync(filePath, newContent, 'utf8');
|
|
6819
6857
|
}
|
|
6820
6858
|
module.exports = { name, format, outputPath, write };
|
|
@@ -6941,6 +6979,23 @@ __factories["./packages/adapters/codex"] = function(module, exports) {
|
|
|
6941
6979
|
const fs = require('fs');
|
|
6942
6980
|
const name = 'codex';
|
|
6943
6981
|
const CODEX_MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
|
|
6982
|
+
const CODEX_TOOLS_MARKER = '<!-- sigmap-tools -->';
|
|
6983
|
+
const CODEX_TOOLS_BLOCK = [
|
|
6984
|
+
'## Tools',
|
|
6985
|
+
'',
|
|
6986
|
+
CODEX_TOOLS_MARKER,
|
|
6987
|
+
'',
|
|
6988
|
+
'```json',
|
|
6989
|
+
JSON.stringify([
|
|
6990
|
+
{ name: 'sigmap_ask', description: 'Rank source files by relevance to a natural-language query. Run before exploring the codebase.', command: 'sigmap ask "$QUERY"' },
|
|
6991
|
+
{ name: 'sigmap_validate', description: 'Validate SigMap config and measure context coverage. Run after changing config or source dirs.', command: 'sigmap validate' },
|
|
6992
|
+
{ name: 'sigmap_judge', description: 'Score an LLM response for groundedness against source context. Use to verify answer quality.', command: 'sigmap judge --response "$RESPONSE" --context "$CONTEXT"' },
|
|
6993
|
+
{ name: 'sigmap_query', description: 'Rank all files by relevance using TF-IDF and write a focused mini-context.', command: 'sigmap --query "$QUERY" --context' },
|
|
6994
|
+
{ name: 'sigmap_weights', description: 'Show learned file-ranking multipliers accumulated from past sessions.', command: 'sigmap weights' },
|
|
6995
|
+
], null, 2),
|
|
6996
|
+
'```',
|
|
6997
|
+
'',
|
|
6998
|
+
].join('\n');
|
|
6944
6999
|
function format(context, opts = {}) {
|
|
6945
7000
|
if (!context || typeof context !== 'string' || !context.trim()) return '';
|
|
6946
7001
|
const toolBlock = [
|
|
@@ -6965,9 +7020,17 @@ __factories["./packages/adapters/codex"] = function(module, exports) {
|
|
|
6965
7020
|
const formatted = format(context, opts);
|
|
6966
7021
|
const markerIdx = existing.indexOf('## Auto-generated signatures');
|
|
6967
7022
|
const isLegacyGenerated = existing.includes('<!-- Generated by SigMap gen-context.js') || existing.includes('## Code Signatures') || existing.includes('# Code signatures');
|
|
6968
|
-
|
|
7023
|
+
let newContent = markerIdx !== -1
|
|
6969
7024
|
? existing.slice(0, markerIdx) + CODEX_MARKER.trimStart() + formatted
|
|
6970
7025
|
: (isLegacyGenerated ? CODEX_MARKER.trimStart() + formatted : existing + CODEX_MARKER + formatted);
|
|
7026
|
+
if (!newContent.includes(CODEX_TOOLS_MARKER)) {
|
|
7027
|
+
const sigPos = newContent.indexOf('## Auto-generated signatures');
|
|
7028
|
+
if (sigPos !== -1) {
|
|
7029
|
+
newContent = newContent.slice(0, sigPos) + CODEX_TOOLS_BLOCK + '\n' + newContent.slice(sigPos);
|
|
7030
|
+
} else {
|
|
7031
|
+
newContent = CODEX_TOOLS_BLOCK + '\n' + newContent;
|
|
7032
|
+
}
|
|
7033
|
+
}
|
|
6971
7034
|
fs.writeFileSync(filePath, newContent, 'utf8');
|
|
6972
7035
|
}
|
|
6973
7036
|
module.exports = { name, format, outputPath, write };
|
|
@@ -7159,7 +7222,7 @@ const path = require('path');
|
|
|
7159
7222
|
const os = require('os');
|
|
7160
7223
|
const { execSync } = require('child_process');
|
|
7161
7224
|
|
|
7162
|
-
const VERSION = '6.
|
|
7225
|
+
const VERSION = '6.3.0';
|
|
7163
7226
|
const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
|
|
7164
7227
|
|
|
7165
7228
|
function requireSourceOrBundled(key) {
|
package/package.json
CHANGED
|
@@ -16,6 +16,37 @@ const fs = require('fs');
|
|
|
16
16
|
const name = 'claude';
|
|
17
17
|
|
|
18
18
|
const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
|
|
19
|
+
const ALLOWLIST_MARKER = '<!-- sigmap-bash-allowlist -->';
|
|
20
|
+
|
|
21
|
+
const ALLOWLIST_BLOCK = [
|
|
22
|
+
'## Bash allowlist',
|
|
23
|
+
'',
|
|
24
|
+
ALLOWLIST_MARKER,
|
|
25
|
+
'',
|
|
26
|
+
'The following sigmap commands are pre-approved — Claude Code will not prompt for confirmation:',
|
|
27
|
+
'',
|
|
28
|
+
'```json',
|
|
29
|
+
JSON.stringify({
|
|
30
|
+
permissions: {
|
|
31
|
+
allow: [
|
|
32
|
+
'Bash(sigmap ask*)',
|
|
33
|
+
'Bash(sigmap validate*)',
|
|
34
|
+
'Bash(sigmap judge*)',
|
|
35
|
+
'Bash(sigmap weights*)',
|
|
36
|
+
'Bash(sigmap history*)',
|
|
37
|
+
'Bash(sigmap --query*)',
|
|
38
|
+
'Bash(sigmap --diff*)',
|
|
39
|
+
'Bash(sigmap --health*)',
|
|
40
|
+
'Bash(sigmap --coverage*)',
|
|
41
|
+
'Bash(node gen-context.js*)',
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
}, null, 2),
|
|
45
|
+
'```',
|
|
46
|
+
'',
|
|
47
|
+
'Add the `permissions.allow` array above to `.claude/settings.json` to activate.',
|
|
48
|
+
'',
|
|
49
|
+
].join('\n');
|
|
19
50
|
|
|
20
51
|
/**
|
|
21
52
|
* Format context suited for CLAUDE.md.
|
|
@@ -82,6 +113,17 @@ function write(context, cwd, opts = {}) {
|
|
|
82
113
|
} else {
|
|
83
114
|
newContent = existing + MARKER + formatted;
|
|
84
115
|
}
|
|
116
|
+
|
|
117
|
+
// Inject ## Bash allowlist above the sig marker if not already present
|
|
118
|
+
if (!newContent.includes(ALLOWLIST_MARKER)) {
|
|
119
|
+
const sigMarkerPos = newContent.indexOf('## Auto-generated signatures');
|
|
120
|
+
if (sigMarkerPos !== -1) {
|
|
121
|
+
newContent = newContent.slice(0, sigMarkerPos) + ALLOWLIST_BLOCK + '\n' + newContent.slice(sigMarkerPos);
|
|
122
|
+
} else {
|
|
123
|
+
newContent = ALLOWLIST_BLOCK + '\n' + newContent;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
85
127
|
fs.writeFileSync(filePath, newContent, 'utf8');
|
|
86
128
|
}
|
|
87
129
|
|
|
@@ -17,6 +17,44 @@ const fs = require('fs');
|
|
|
17
17
|
|
|
18
18
|
const name = 'codex';
|
|
19
19
|
const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
|
|
20
|
+
const TOOLS_MARKER = '<!-- sigmap-tools -->';
|
|
21
|
+
|
|
22
|
+
const TOOLS_BLOCK = [
|
|
23
|
+
'## Tools',
|
|
24
|
+
'',
|
|
25
|
+
TOOLS_MARKER,
|
|
26
|
+
'',
|
|
27
|
+
'```json',
|
|
28
|
+
JSON.stringify([
|
|
29
|
+
{
|
|
30
|
+
name: 'sigmap_ask',
|
|
31
|
+
description: 'Rank source files by relevance to a natural-language query. Run before exploring the codebase.',
|
|
32
|
+
command: 'sigmap ask "$QUERY"',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'sigmap_validate',
|
|
36
|
+
description: 'Validate SigMap config and measure context coverage. Run after changing config or source dirs.',
|
|
37
|
+
command: 'sigmap validate',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'sigmap_judge',
|
|
41
|
+
description: 'Score an LLM response for groundedness against source context. Use to verify answer quality.',
|
|
42
|
+
command: 'sigmap judge --response "$RESPONSE" --context "$CONTEXT"',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'sigmap_query',
|
|
46
|
+
description: 'Rank all files by relevance using TF-IDF and write a focused mini-context.',
|
|
47
|
+
command: 'sigmap --query "$QUERY" --context',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'sigmap_weights',
|
|
51
|
+
description: 'Show learned file-ranking multipliers accumulated from past sessions.',
|
|
52
|
+
command: 'sigmap weights',
|
|
53
|
+
},
|
|
54
|
+
], null, 2),
|
|
55
|
+
'```',
|
|
56
|
+
'',
|
|
57
|
+
].join('\n');
|
|
20
58
|
|
|
21
59
|
/**
|
|
22
60
|
* Format context for AGENTS.md — clean markdown, no LLM preamble.
|
|
@@ -80,6 +118,16 @@ function write(context, cwd, opts = {}) {
|
|
|
80
118
|
: existing + MARKER + formatted;
|
|
81
119
|
}
|
|
82
120
|
|
|
121
|
+
// Inject ## Tools block above the sig marker if not already present
|
|
122
|
+
if (!newContent.includes(TOOLS_MARKER)) {
|
|
123
|
+
const sigMarkerPos = newContent.indexOf('## Auto-generated signatures');
|
|
124
|
+
if (sigMarkerPos !== -1) {
|
|
125
|
+
newContent = newContent.slice(0, sigMarkerPos) + TOOLS_BLOCK + '\n' + newContent.slice(sigMarkerPos);
|
|
126
|
+
} else {
|
|
127
|
+
newContent = TOOLS_BLOCK + '\n' + newContent;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
83
131
|
fs.writeFileSync(filePath, newContent, 'utf8');
|
|
84
132
|
}
|
|
85
133
|
|
package/src/mcp/server.js
CHANGED