archgraph-argo 0.20.8 → 0.20.9

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.
@@ -262,7 +262,7 @@ async function executeWpP2Retrieval({
262
262
  const strict = AUDIT_PURPOSES.has(purpose);
263
263
  const topK = Number.isInteger(request.topK) && request.topK > 0 ? request.topK : resolveTopK();
264
264
  const scoped = Array.isArray(canonicalIdentities) && canonicalIdentities.length > 0;
265
- const hybrid = isHybridEnabled();
265
+ const hybrid = isHybridEnabled() && request.hybrid !== false;
266
266
  const lexicalTopK = hybridTopK();
267
267
  const fusionK = rrfK();
268
268
  const fusionWeights = hybridWeights();
@@ -2810,7 +2810,7 @@ async function buildSemanticDedupAdvisory(context, mutations, dependencies) {
2810
2810
  const intent = [element.type, element.name, element.description]
2811
2811
  .filter(part => typeof part === 'string' && part.trim() !== '')
2812
2812
  .join(' ');
2813
- const retrieved = await journey.query({ purpose: 'general', intent, topK: SEMANTIC_DEDUP_TOP_K, rerank: false });
2813
+ const retrieved = await journey.query({ purpose: 'general', intent, topK: SEMANTIC_DEDUP_TOP_K, rerank: false, hybrid: false, scoreMode: 'similarity' });
2814
2814
  const source = retrieved && (retrieved.result || retrieved.document) || retrieved;
2815
2815
  const subset = buildCanonicalSemanticDocumentSubset(source, context.document);
2816
2816
  const elements = subset && subset.status === 'passed' && subset.document
@@ -3001,7 +3001,11 @@ async function executeSemanticSystemArchitectureQuery(args, dependencies) {
3001
3001
  try {
3002
3002
  const retrieved = await semanticRetrievalBoundary.retrieve(queryForRetrieval);
3003
3003
  if (canonicalSubsetContract) {
3004
- const subset = buildCanonicalSemanticDocumentSubset(retrieved, context.document);
3004
+ // scoreMode:'similarity' (used by the write-path dedup gate) returns the
3005
+ // true vector similarity instead of the closure rank-derived score.
3006
+ const subset = buildCanonicalSemanticDocumentSubset(retrieved, context.document, {
3007
+ preferSeedSimilarity: !!(query && query.scoreMode === 'similarity'),
3008
+ });
3005
3009
  if (subset.status === 'failed') {
3006
3010
  return getSystemArchitectureResult(subset);
3007
3011
  }
@@ -3306,7 +3310,7 @@ function normalizeFailedSemanticResponse(payload, fallbackResponse) {
3306
3310
  });
3307
3311
  }
3308
3312
 
3309
- function buildCanonicalSemanticDocumentSubset(source, canonicalDocument = undefined) {
3313
+ function buildCanonicalSemanticDocumentSubset(source, canonicalDocument = undefined, options = {}) {
3310
3314
  const evidence = source && typeof source === 'object' ? source : {};
3311
3315
  const endpointClosureRelationships = arrayAt(evidence, ['endpointClosure', 'relationships']);
3312
3316
  const viewClosureViews = arrayAt(evidence, ['viewClosure', 'views']);
@@ -3464,10 +3468,12 @@ function buildCanonicalSemanticDocumentSubset(source, canonicalDocument = undefi
3464
3468
  }
3465
3469
  }
3466
3470
  }
3467
- // buildCanonicalSemanticDocumentSubset may run a second time over a prior
3468
- // subset document (which no longer carries seedsByType); carry scores forward
3469
- // from evidence elements that already expose semanticScore.
3470
- for (const item of evidenceElements) {
3471
+ // The closure's rank-derived score (0.99..0.8, by closure rank) must NOT
3472
+ // overwrite a seed's TRUE similarity: when preferSeedSimilarity is set the
3473
+ // caller needs the cosine, so this override is skipped (otherwise the dedup
3474
+ // gate would flag every same-type seed in the top window regardless of actual
3475
+ // similarity -- the false-positive defect).
3476
+ if (!options.preferSeedSimilarity) for (const item of evidenceElements) {
3471
3477
  if (!item) continue;
3472
3478
  const numericScore = Number(item.semanticScore);
3473
3479
  if (!Number.isFinite(numericScore)) continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archgraph-argo",
3
- "version": "0.20.8",
3
+ "version": "0.20.9",
4
4
  "description": "Deploy the ArchGraph ARGO toolchain, skills, and rules (schema, scripts, argo-init skill, global rule) with one command.",
5
5
  "license": "MIT",
6
6
  "bin": {