archgraph-argo 0.20.0 → 0.20.2

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.
@@ -0,0 +1,140 @@
1
+ # =============================================================================
2
+ # ArchGraph (archgraph-argo) environment configuration — EXAMPLE.
3
+ #
4
+ # Copy this file to the live env file and fill in real values:
5
+ # Windows %USERPROFILE%\.argo\.env
6
+ # Linux/macOS ~/.argo/.env
7
+ # The live file is git-ignored and MUST stay untracked with a restricted ACL;
8
+ # this example is committed and contains no secrets.
9
+ #
10
+ # PART 1 keys are the ONLY keys accepted inside the .env file (any unknown key
11
+ # makes the secret-file preflight reject the whole file). PART 2 keys are
12
+ # host/process-level only — set them in the host/MCP launch config or shell, NOT
13
+ # here. Empty values below are placeholders.
14
+ # =============================================================================
15
+
16
+
17
+ # -----------------------------------------------------------------------------
18
+ # PART 1 — .env file keys
19
+ # -----------------------------------------------------------------------------
20
+
21
+ # --- Embedding provider (required) — powers vector semantic retrieval -------
22
+ # OpenAI-compatible embedding endpoint base URL (no trailing slash).
23
+ ARGO_EMBEDDING_BASE_URL=
24
+ # Embedding model id (e.g. qwen3.7-text-embedding).
25
+ ARGO_EMBEDDING_MODEL=
26
+ # Provider label recorded in evidence; also the rerank fallback provider.
27
+ ARGO_EMBEDDING_PROVIDER=
28
+ # Model version / qualification label (recorded evidence only).
29
+ ARGO_EMBEDDING_MODEL_VERSION=
30
+ # Embedding vector dimension; must match the model (current profiles: 1536).
31
+ ARGO_EMBEDDING_DIMENSIONS=
32
+
33
+ # --- Neo4j (required) — structural projection + vector/full-text store ------
34
+ # Neo4j connection URI (e.g. neo4j://127.0.0.1:7687).
35
+ ARGO_NEO4J_DATABASE_URL=
36
+ # Neo4j username.
37
+ ARGO_NEO4J_DATABASE_USERNAME=
38
+ # Neo4j password. SECRET: value must come from the untracked, ACL-restricted
39
+ # .env (or direct process injection) only — never commit it.
40
+ ARGO_NEO4J_DATABASE_PASSWORD=
41
+ # Optional: override the Neo4j database name. Default = sanitized repository
42
+ # folder name (e.g. repo "archgraph" -> database "archgraph").
43
+ ARGO_NEO4J_DATABASE=
44
+
45
+ # --- Secrets (required) ------------------------------------------------------
46
+ # API key for the embedding endpoint above. SECRET; also the fallback key for
47
+ # the reranker when ARGO_RERANK_API_KEY is not set. Never commit it.
48
+ QWEN_KEY=
49
+
50
+ # --- Semantic retrieval tuning (optional; safe defaults shown) --------------
51
+ # Similarity threshold, memory purposes (recall-oriented). Default 0.55.
52
+ ARGO_SEMANTIC_MEMORY_THRESHOLD=
53
+ # Memory threshold override for the Element channel. Default 0.55.
54
+ ARGO_SEMANTIC_MEMORY_THRESHOLD_ELEMENT=
55
+ # Memory threshold override for the ArchitectureRelationship channel. Default 0.55.
56
+ ARGO_SEMANTIC_MEMORY_THRESHOLD_RELATIONSHIP=
57
+ # Memory threshold override for the View channel. Default 0.55.
58
+ ARGO_SEMANTIC_MEMORY_THRESHOLD_VIEW=
59
+ # Similarity threshold, audit purpose (precision-oriented). Default 0.8.
60
+ ARGO_SEMANTIC_AUDIT_THRESHOLD=
61
+ # Audit threshold override for the Element channel. Default 0.8.
62
+ ARGO_SEMANTIC_AUDIT_THRESHOLD_ELEMENT=
63
+ # Audit threshold override for the ArchitectureRelationship channel. Default 0.8.
64
+ ARGO_SEMANTIC_AUDIT_THRESHOLD_RELATIONSHIP=
65
+ # Audit threshold override for the View channel. Default 0.8.
66
+ ARGO_SEMANTIC_AUDIT_THRESHOLD_VIEW=
67
+ # Bound on returned candidates per retrieval. Default 8.
68
+ ARGO_SEMANTIC_TOP_K=
69
+
70
+ # --- Hybrid retrieval (vector + lexical BM25 via RRF; optional) -------------
71
+ # Master switch. "1" enables hybrid fusion; unset/"0" = vector-only (default off).
72
+ ARGO_SEMANTIC_HYBRID=
73
+ # Weight of the vector channel in the RRF fusion. Default 3.
74
+ ARGO_SEMANTIC_HYBRID_VECTOR_WEIGHT=
75
+ # Weight of the lexical (full-text) channel in the RRF fusion. Default 1.
76
+ ARGO_SEMANTIC_HYBRID_LEXICAL_WEIGHT=
77
+ # RRF smoothing constant k. Default 60.
78
+ ARGO_SEMANTIC_HYBRID_RRF_K=
79
+ # Candidate pool size pulled per channel before fusion. Default 16.
80
+ ARGO_SEMANTIC_HYBRID_TOP_K=
81
+
82
+ # --- LLM rerank (second-stage reordering; optional) -------------------------
83
+ # Master switch. "1" enables rerank; unset/"0" = off (default off). Fail-open:
84
+ # any error/timeout keeps the original order.
85
+ ARGO_SEMANTIC_RERANK=
86
+ # Rerank model when using the embedding provider fallback. Default qwen-turbo.
87
+ ARGO_SEMANTIC_RERANK_MODEL=
88
+ # Candidate pool size offered to the reranker. Default 20.
89
+ ARGO_SEMANTIC_RERANK_POOL=
90
+ # Max ids the reranker may return. Default 8.
91
+ ARGO_SEMANTIC_RERANK_RETURN=
92
+ # Per-request rerank timeout in ms (AbortController). Default 8000.
93
+ ARGO_SEMANTIC_RERANK_TIMEOUT_MS=
94
+ # Dedicated rerank provider (optional). When unset, rerank falls back to the
95
+ # embedding provider above. Use these to point rerank at another provider/model
96
+ # (e.g. DeepSeek: base https://api.deepseek.com, model deepseek-flash).
97
+ ARGO_RERANK_BASE_URL=
98
+ # Dedicated rerank API key. SECRET. Falls back to QWEN_KEY when unset.
99
+ ARGO_RERANK_API_KEY=
100
+ # Dedicated rerank provider label (informational; defaults to the embedding provider label).
101
+ ARGO_RERANK_PROVIDER=
102
+ # Dedicated rerank model id (overrides ARGO_SEMANTIC_RERANK_MODEL).
103
+ ARGO_RERANK_MODEL=
104
+
105
+ # --- Live end-to-end opt-ins (optional; normally unset) ---------------------
106
+ # "1" allows the live embedding-provider E2E to hit the real network.
107
+ ARGO_LIVE_PROVIDER_E2E=
108
+ # "1" allows the live W3.1 mutation-vector E2E to hit the real network.
109
+ ARGO_W31_LIVE_MUTATION_VECTOR_E2E=
110
+
111
+
112
+ # -----------------------------------------------------------------------------
113
+ # PART 2 — host / process-level only (do NOT put these in .env)
114
+ # Set in the host or MCP launch configuration (mcp.json / opencode.json env,
115
+ # dsh plugin, or the shell), never in the .env file.
116
+ # -----------------------------------------------------------------------------
117
+ # Point at a non-default env file path.
118
+ # ARGO_ENV_FILE=
119
+ # Pin the workspace/repository root the MCP server serves.
120
+ # ARGO_REPO_ROOT=
121
+ # Path to the Enterprise Architect model file (.qea) to project to/from.
122
+ # ARGO_EA_QEA=
123
+ # Semicolon-separated roots for multi-workspace hosts (DSH plugin).
124
+ # ARGO_WORKSPACE_ROOTS=
125
+ # Explicit path to the argo MCP server entry script (DSH plugin).
126
+ # ARGO_SERVER_PATH=
127
+ # URL of the graph-mcp HTTP bridge.
128
+ # GRAPH_MCP_URL=
129
+ # "1" enables verbose EA <-> .qea sync debug logging.
130
+ # EA_QEA_DEBUG=
131
+ # Architecture test runner timeout in ms.
132
+ # ARGO_TEST_TIMEOUT_MS=
133
+ # "1" prints the full mutation response for debugging.
134
+ # ARGO_MCP_MUTATION_RESPONSE_DEBUG=
135
+ # "0" disables the pre-write semantic dedup advisory (default: enabled).
136
+ # ARGO_MCP_SEMANTIC_DEDUP=
137
+ # Similarity threshold for the semantic dedup advisory. Default 0.85.
138
+ # ARGO_MCP_SEMANTIC_DEDUP_THRESHOLD=
139
+ # Alias of ARGO_MCP_SEMANTIC_DEDUP_THRESHOLD (takes precedence when set).
140
+ # ARGO_SEMANTIC_DEDUP_THRESHOLD=
@@ -835,15 +835,26 @@ function scopeCanonicalIdentitiesForChannel(identities, channel) {
835
835
  });
836
836
  }
837
837
 
838
+ // Semantic vector records store their canonicalIdentity channel-prefixed
839
+ // (e.g. "Element:widget-1") so the scoped Cypher `node.canonicalIdentity IN
840
+ // $canonicalIdentities` matches. Every consumer of a seed's `id` — purpose
841
+ // closure anchors, provenance keys, and the canonical-subset score lookup —
842
+ // however keys on the BARE canonical graph id. Expose the bare id as `id` and
843
+ // keep the prefixed value as `canonicalIdentity` so a seed resolves against the
844
+ // canonical graph instead of a phantom prefixed id.
845
+ function bareCanonicalId(id) {
846
+ return String(id).replace(/^[^:]*:/, '');
847
+ }
848
+
838
849
  function normalizeVectorRecord(raw, channel) {
839
850
  if (!raw || typeof raw !== 'object') return undefined;
840
- const id = raw.canonicalIdentity || raw.id || raw.objectId;
851
+ const canonicalIdentity = raw.canonicalIdentity || raw.id || raw.objectId;
841
852
  const score = numberValue(raw.score);
842
- if (!id || !Number.isFinite(score)) return undefined;
853
+ if (!canonicalIdentity || !Number.isFinite(score)) return undefined;
843
854
  return {
844
855
  ...raw,
845
- id,
846
- canonicalIdentity: id,
856
+ id: bareCanonicalId(canonicalIdentity),
857
+ canonicalIdentity,
847
858
  objectType: channel.objectType,
848
859
  channel: channel.channel,
849
860
  score,
@@ -1157,5 +1168,7 @@ module.exports = {
1157
1168
  auditThresholdFor,
1158
1169
  resolveTopK,
1159
1170
  scopeCanonicalIdentitiesForChannel,
1171
+ bareCanonicalId,
1172
+ normalizeVectorRecord,
1160
1173
  AUDIT_PURPOSES,
1161
1174
  };
@@ -34,6 +34,13 @@ const RETRIEVAL_TUNING_KEYS = Object.freeze([
34
34
  'ARGO_SEMANTIC_AUDIT_THRESHOLD_RELATIONSHIP',
35
35
  'ARGO_SEMANTIC_AUDIT_THRESHOLD_VIEW',
36
36
  'ARGO_SEMANTIC_TOP_K',
37
+ // Hybrid (vector + lexical RRF) retrieval (P2). Off unless
38
+ // ARGO_SEMANTIC_HYBRID=1; weights/k/top-K tune the fusion.
39
+ 'ARGO_SEMANTIC_HYBRID',
40
+ 'ARGO_SEMANTIC_HYBRID_VECTOR_WEIGHT',
41
+ 'ARGO_SEMANTIC_HYBRID_LEXICAL_WEIGHT',
42
+ 'ARGO_SEMANTIC_HYBRID_RRF_K',
43
+ 'ARGO_SEMANTIC_HYBRID_TOP_K',
37
44
  // Rerank (P3) tuning + optional dedicated rerank provider. When the provider
38
45
  // keys are unset the reranker falls back to the embedding provider (qwen).
39
46
  'ARGO_SEMANTIC_RERANK',
@@ -525,4 +532,10 @@ module.exports = {
525
532
  resolveApprovedLiveConfiguration,
526
533
  withApprovedLiveConfigurationTestComposition,
527
534
  posixModeIsSecretSafe,
535
+ // The authoritative set of keys an approved `.env` file may carry. The
536
+ // committed `.env.example` must document exactly this set (see
537
+ // tests/env-example.test.js); SECRET_KEYS marks the subset that must be
538
+ // preflighted as secrets.
539
+ ENV_FILE_KEYS: READABLE_KEYS,
540
+ ENV_FILE_SECRET_KEYS: Object.freeze(Array.from(SECRET_KEYS)),
528
541
  };
@@ -3462,7 +3462,11 @@ function buildCanonicalSemanticDocumentSubset(source, canonicalDocument = undefi
3462
3462
  if (!item) continue;
3463
3463
  const numericScore = Number(item.semanticScore);
3464
3464
  if (!Number.isFinite(numericScore)) continue;
3465
- const key = String(item.id !== undefined ? item.id : item.view_id);
3465
+ // Evidence ids may still carry the channel prefix (real Neo4j shape); the
3466
+ // seed-score map and canonical lookups are keyed on the bare canonical id,
3467
+ // so normalize before comparing (otherwise the rank-derived score lands on
3468
+ // a phantom prefixed key and the tiny fused RRF score wins for the element).
3469
+ const key = String(item.id !== undefined ? item.id : item.view_id).replace(/^[^:]*:/, '');
3466
3470
  if (key && (!semanticScoreById.has(key) || numericScore > semanticScoreById.get(key))) {
3467
3471
  semanticScoreById.set(key, numericScore);
3468
3472
  }
package/install-argo.ps1 CHANGED
@@ -1008,6 +1008,16 @@ if ($SkipEnv) {
1008
1008
  $lines += "$key=$value"
1009
1009
  }
1010
1010
 
1011
+ # Preserve any extra keys already present in .env but not part of the
1012
+ # interactive prompt list (e.g. semantic retrieval tuning: hybrid/rerank/
1013
+ # thresholds). Without this a re-deploy would silently drop them. They are
1014
+ # documented in argo/.env.example.
1015
+ foreach ($key in ($existing.Keys | Sort-Object)) {
1016
+ if ($envKeys -notcontains $key) {
1017
+ $lines += "$key=$($existing[$key])"
1018
+ }
1019
+ }
1020
+
1011
1021
  [System.IO.File]::WriteAllLines(
1012
1022
  $envPath,
1013
1023
  $lines,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archgraph-argo",
3
- "version": "0.20.0",
3
+ "version": "0.20.2",
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": {
@@ -17,6 +17,7 @@
17
17
  "argo/skills/ea-human-reconcile",
18
18
  "argo/rules",
19
19
  "argo/package.json",
20
+ "argo/.env.example",
20
21
  "vendor",
21
22
  "install-argo.ps1",
22
23
  "bin",