@rigour-labs/mcp 6.4.2 → 6.4.4

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.
@@ -11,7 +11,7 @@
11
11
  import fs from 'fs-extra';
12
12
  import path from 'path';
13
13
  import { createHash } from 'crypto';
14
- import { getTaskContextStats, getTaskCostStats, getCacheStats, explainContext, getSemanticQueryCache, setSemanticQueryCache, findRelatedSemanticQueryCache, filterExistingEditScope, estimateTokenCount, ensureAutomaticIndex, getApplicableLessons, searchTeamKnowledge, } from '@rigour-labs/core';
14
+ import { getTaskContextStats, getTaskCostStats, getCacheStats, explainContext, getSemanticQueryCache, setSemanticQueryCache, findRelatedSemanticQueryCache, filterExistingEditScope, estimateTokenCount, ensureAutomaticIndex, getApplicableLessons, searchTeamKnowledge, recordScopeOffer, } from '@rigour-labs/core';
15
15
  import { loadPatternIndex, getDefaultIndexPath, generateEmbedding, semanticSearch, } from '@rigour-labs/core/pattern-index';
16
16
  import { buildTelemetryMeta, getWorkspaceCommitSha } from '../utils/context-telemetry.js';
17
17
  import { appendContextFooter } from '../utils/context-footer.js';
@@ -263,14 +263,17 @@ export async function handleContextScope(cwd, query, limit = 10, taskId, agentId
263
263
  searchTeamKnowledge(query, Math.min(limit, 8)),
264
264
  ]);
265
265
  let fullFileTokens = 0;
266
+ const offered = [];
266
267
  for (const file of editScope) {
268
+ let tokens = 500;
267
269
  try {
268
- const content = await fs.readFile(path.join(cwd, file), 'utf-8');
269
- fullFileTokens += estimateTokenCount(content);
270
+ tokens = estimateTokenCount(await fs.readFile(path.join(cwd, file), 'utf-8'));
270
271
  }
271
272
  catch {
272
- fullFileTokens += 500;
273
+ // Unreadable: keep the estimate.
273
274
  }
275
+ fullFileTokens += tokens;
276
+ offered.push({ path: file, tokens });
274
277
  }
275
278
  const guidance = {
276
279
  kind: 'context-scope',
@@ -317,6 +320,8 @@ export async function handleContextScope(cwd, query, limit = 10, taskId, agentId
317
320
  let resultText = JSON.stringify(scopePayload, null, 2);
318
321
  scopePayload.estimatedTokensSaved = Math.max(0, fullFileTokens - estimateTokenCount(resultText));
319
322
  resultText = JSON.stringify(scopePayload, null, 2);
323
+ // What the agent was told it need not read, so observed savings can check whether it read them anyway.
324
+ recordScopeOffer(cwd, offered, estimateTokenCount(resultText));
320
325
  await setSemanticQueryCache(query, commitSha, {
321
326
  query,
322
327
  resolvedOwner: editScope[0] ? path.dirname(editScope[0]) : 'unknown',
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@rigour-labs/mcp",
3
- "version": "6.4.2",
3
+ "version": "6.4.4",
4
4
  "description": "MCP server + live dashboard for AI code governance — OWASP LLM Top 10 (10/10), real-time MCP App UI, 25+ security patterns, Bayesian learning Brain, hallucinated import detection, multi-agent governance. Works with Claude, Cursor, VS Code, ChatGPT, Goose, Windsurf. Industry presets for HIPAA, SOC2, FedRAMP.",
5
+ "engines": {
6
+ "node": ">=22"
7
+ },
5
8
  "license": "MIT",
6
9
  "homepage": "https://rigour.run",
7
10
  "icon": "https://raw.githubusercontent.com/rigour-labs/rigour/main/docs/assets/icon.svg",
@@ -62,7 +65,7 @@
62
65
  "execa": "^8.0.1",
63
66
  "fs-extra": "^11.4.0",
64
67
  "yaml": "^2.8.2",
65
- "@rigour-labs/core": "6.4.2"
68
+ "@rigour-labs/core": "6.4.4"
66
69
  },
67
70
  "devDependencies": {
68
71
  "@types/node": "^25.0.3",