archgraph-argo 0.26.2 → 0.27.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/README.md CHANGED
@@ -8,10 +8,14 @@ ArchGraph builds a **unified language** that puts harness design and target prod
8
8
  **one model** — so you get a single view to work and observe, and real control over your agents.
9
9
 
10
10
  It doubles as a **long-term memory for coding agents**: an ArchiMate 3.2 intent graph exposed through
11
- a single read/write MCP interface. Writes are deduplicated, so the graph stays clean and semantic
12
- recall stays precise. See the [home page](https://archgraph.org/) for the full capability set.
11
+ a single read/write MCP interface. Memory is tiered — a compact working memory restored at session
12
+ start, a long-term memory recalled on demand — and writes are deduplicated, so the graph stays clean
13
+ and semantic recall stays precise. Reusable subgraphs can also be shared across projects through a
14
+ federated registry, and any read tool can take an optional <code>projectId</code> to query
15
+ **another project's graph** through the federation center — authorized, read-only, and by
16
+ reference (denied by default). See the [home page](https://archgraph.org/) for the full capability set.
13
17
 
14
- ![alt text](docs/diagrams/image.png)
18
+ ![ArchGraph core model — harness design and product design in one graph](docs/diagrams/core-model.svg)
15
19
 
16
20
  ## Architecture
17
21
 
@@ -21,7 +25,7 @@ engineering:
21
25
 
22
26
  ![Global architecture — Layered Viewpoint](docs/diagrams/global-architecture.svg)
23
27
 
24
- Editable source: [`docs/diagrams/global-architecture.excalidraw`](docs/diagrams/global-architecture.excalidraw)
28
+ Editable source: [`scripts/gen-diagrams.js`](scripts/gen-diagrams.js)
25
29
 
26
30
  ## Supported Harnesses
27
31
 
@@ -93,6 +97,11 @@ subgraphs** across projects, and follow the governance & contribution guides:
93
97
  - **graph-wiki repository** — https://github.com/derekhu0002/graph-wiki (graph-asset home: contribute
94
98
  a subgraph from your project, or pull one back to reuse)
95
99
 
100
+ Sharing is **federated**: each project keeps its own graph sovereign and publishes subgraphs to a
101
+ registry, where other members register, discover, and read opened content **by reference** —
102
+ register, discover, authorize, read. Access is **denied by default**, and nothing is copied or merged.
103
+ Browse the [federation members](https://argo.derekworkspacev5.com/archgraph/federation).
104
+
96
105
  ## License
97
106
 
98
107
  [Apache License 2.0](LICENSE)
package/argo/.env.example CHANGED
@@ -1,163 +1,170 @@
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
- # Provider profile: "approved" (default) = the human-approved cloud profile
23
- # below; "openai-compatible" = a self-hosted OpenAI-compatible endpoint
24
- # (intranet/offline) whose URL/model/label/dimension are read verbatim.
25
- ARGO_EMBEDDING_PROFILE=
26
- # OpenAI-compatible embedding endpoint base URL (no trailing slash).
27
- ARGO_EMBEDDING_BASE_URL=
28
- # Embedding model id (e.g. qwen3.7-text-embedding).
29
- ARGO_EMBEDDING_MODEL=
30
- # Provider label recorded in evidence; also the rerank fallback provider.
31
- ARGO_EMBEDDING_PROVIDER=
32
- # Model version / qualification label (recorded evidence only).
33
- ARGO_EMBEDDING_MODEL_VERSION=
34
- # Embedding vector dimension; must match the model and the vector index
35
- # (current profiles: 1536).
36
- ARGO_EMBEDDING_DIMENSIONS=
37
- # Query-side instruction prefix for instruction-tuned embedding models (e.g.
38
- # gte-Qwen2: "Instruct: <task>\nQuery: "). Empty = no prefix. Documents are
39
- # never prefixed; only the query side is.
40
- ARGO_EMBEDDING_QUERY_INSTRUCTION=
41
- # Optional embedding API key. SECRET: overrides QWEN_KEY as the Bearer token for
42
- # the embeddings call when set (useful for a self-hosted endpoint). Leave empty
43
- # to use QWEN_KEY.
44
- ARGO_EMBEDDING_API_KEY=
45
-
46
- # --- Neo4j (required) — structural projection + vector/full-text store ------
47
- # Neo4j connection URI (e.g. neo4j://127.0.0.1:7687).
48
- ARGO_NEO4J_DATABASE_URL=
49
- # Neo4j username.
50
- ARGO_NEO4J_DATABASE_USERNAME=
51
- # Neo4j password. SECRET: value must come from the untracked, ACL-restricted
52
- # .env (or direct process injection) only — never commit it.
53
- ARGO_NEO4J_DATABASE_PASSWORD=
54
- # Optional: override the Neo4j database name. Default = sanitized repository
55
- # folder name (e.g. repo "archgraph" -> database "archgraph").
56
- ARGO_NEO4J_DATABASE=
57
-
58
- # --- Secrets (required) ------------------------------------------------------
59
- # API key for the embedding endpoint above. SECRET; also the fallback key for
60
- # the reranker when ARGO_RERANK_API_KEY is not set. Never commit it.
61
- QWEN_KEY=
62
-
63
- # --- Semantic retrieval tuning (optional; safe defaults shown) --------------
64
- # Similarity threshold, memory purposes (recall-oriented). Default 0.55.
65
- ARGO_SEMANTIC_MEMORY_THRESHOLD=
66
- # Memory threshold override for the Element channel. Default 0.55.
67
- ARGO_SEMANTIC_MEMORY_THRESHOLD_ELEMENT=
68
- # Memory threshold override for the ArchitectureRelationship channel. Default 0.55.
69
- ARGO_SEMANTIC_MEMORY_THRESHOLD_RELATIONSHIP=
70
- # Memory threshold override for the View channel. Default 0.55.
71
- ARGO_SEMANTIC_MEMORY_THRESHOLD_VIEW=
72
- # Similarity threshold, audit purpose (precision-oriented). Default 0.8.
73
- ARGO_SEMANTIC_AUDIT_THRESHOLD=
74
- # Audit threshold override for the Element channel. Default 0.8.
75
- ARGO_SEMANTIC_AUDIT_THRESHOLD_ELEMENT=
76
- # Audit threshold override for the ArchitectureRelationship channel. Default 0.8.
77
- ARGO_SEMANTIC_AUDIT_THRESHOLD_RELATIONSHIP=
78
- # Audit threshold override for the View channel. Default 0.8.
79
- ARGO_SEMANTIC_AUDIT_THRESHOLD_VIEW=
80
- # Bound on returned candidates per retrieval. Default 8.
81
- ARGO_SEMANTIC_TOP_K=
82
-
83
- # --- Hybrid retrieval (vector + lexical BM25 via RRF; optional) -------------
84
- # Master switch. "1" enables hybrid fusion; unset/"0" = vector-only (default off).
85
- ARGO_SEMANTIC_HYBRID=
86
- # Weight of the vector channel in the RRF fusion. Default 3.
87
- ARGO_SEMANTIC_HYBRID_VECTOR_WEIGHT=
88
- # Weight of the lexical (full-text) channel in the RRF fusion. Default 1.
89
- ARGO_SEMANTIC_HYBRID_LEXICAL_WEIGHT=
90
- # RRF smoothing constant k. Default 60.
91
- ARGO_SEMANTIC_HYBRID_RRF_K=
92
- # Candidate pool size pulled per channel before fusion. Default 16.
93
- ARGO_SEMANTIC_HYBRID_TOP_K=
94
-
95
- # --- LLM rerank (second-stage reordering; optional) -------------------------
96
- # Master switch. "1" enables rerank; unset/"0" = off (default off). Fail-open:
97
- # any error/timeout keeps the original order.
98
- ARGO_SEMANTIC_RERANK=
99
- # Rerank model when using the embedding provider fallback. Default qwen-turbo.
100
- ARGO_SEMANTIC_RERANK_MODEL=
101
- # Candidate pool size offered to the reranker. Default 20.
102
- ARGO_SEMANTIC_RERANK_POOL=
103
- # Max ids the reranker may return. Default 8.
104
- ARGO_SEMANTIC_RERANK_RETURN=
105
- # Per-request rerank timeout in ms (AbortController). Default 3500.
106
- ARGO_SEMANTIC_RERANK_TIMEOUT_MS=
107
- # Dedicated rerank provider (optional). When unset, rerank falls back to the
108
- # embedding provider above. Use these to point rerank at another provider/model
109
- # (e.g. DeepSeek: base https://api.deepseek.com, model deepseek-flash).
110
- ARGO_RERANK_BASE_URL=
111
- # Dedicated rerank API key. SECRET. Falls back to QWEN_KEY when unset.
112
- ARGO_RERANK_API_KEY=
113
- # Dedicated rerank provider label (informational; defaults to the embedding provider label).
114
- ARGO_RERANK_PROVIDER=
115
- # Dedicated rerank model id (overrides ARGO_SEMANTIC_RERANK_MODEL).
116
- ARGO_RERANK_MODEL=
117
- # Disable the rerank model's hidden "thinking"/reasoning (reasoning models spend
118
- # 6-12s per call for a listwise ranking with no accuracy gain). Default 1 =
119
- # disabled; set 0 to send nothing. Applies to every provider so a model swap
120
- # keeps the fast path. If a provider rejects the fragment it is retried without.
121
- ARGO_RERANK_DISABLE_THINKING=
122
- # Exact JSON body fragment merged into the rerank request to disable thinking
123
- # (default {"thinking":{"type":"disabled"}}). Override for another model/provider
124
- # that uses a different field, e.g. {"reasoning_effort":"none"} or
125
- # {"enable_thinking":false}.
126
- ARGO_RERANK_THINKING_PARAM=
127
-
128
- # --- Live end-to-end opt-ins (optional; normally unset) ---------------------
129
- # "1" allows the live embedding-provider E2E to hit the real network.
130
- ARGO_LIVE_PROVIDER_E2E=
131
- # "1" allows the live W3.1 mutation-vector E2E to hit the real network.
132
- ARGO_W31_LIVE_MUTATION_VECTOR_E2E=
133
-
134
-
135
- # -----------------------------------------------------------------------------
136
- # PART 2 — host / process-level only (do NOT put these in .env)
137
- # Set in the host or MCP launch configuration (mcp.json / opencode.json env,
138
- # dsh plugin, or the shell), never in the .env file.
139
- # -----------------------------------------------------------------------------
140
- # Point at a non-default env file path.
141
- # ARGO_ENV_FILE=
142
- # Pin the workspace/repository root the MCP server serves.
143
- # ARGO_REPO_ROOT=
144
- # Path to the Enterprise Architect model file (.qea) to project to/from.
145
- # ARGO_EA_QEA=
146
- # Semicolon-separated roots for multi-workspace hosts (DSH plugin).
147
- # ARGO_WORKSPACE_ROOTS=
148
- # Explicit path to the argo MCP server entry script (DSH plugin).
149
- # ARGO_SERVER_PATH=
150
- # URL of the graph-mcp HTTP bridge.
151
- # GRAPH_MCP_URL=
152
- # "1" enables verbose EA <-> .qea sync debug logging.
153
- # EA_QEA_DEBUG=
154
- # Architecture test runner timeout in ms.
155
- # ARGO_TEST_TIMEOUT_MS=
156
- # "1" prints the full mutation response for debugging.
157
- # ARGO_MCP_MUTATION_RESPONSE_DEBUG=
158
- # "0" disables the pre-write semantic dedup advisory (default: enabled).
159
- # ARGO_MCP_SEMANTIC_DEDUP=
160
- # Similarity threshold for the semantic dedup advisory. Default 0.85.
161
- # ARGO_MCP_SEMANTIC_DEDUP_THRESHOLD=
162
- # Alias of ARGO_MCP_SEMANTIC_DEDUP_THRESHOLD (takes precedence when set).
163
- # ARGO_SEMANTIC_DEDUP_THRESHOLD=
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 (never commit it);
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
+ # Provider profile: "approved" (default) = the human-approved cloud profile
23
+ # below; "openai-compatible" = a self-hosted OpenAI-compatible endpoint
24
+ # (intranet/offline) whose URL/model/label/dimension are read verbatim.
25
+ ARGO_EMBEDDING_PROFILE=
26
+ # OpenAI-compatible embedding endpoint base URL (no trailing slash).
27
+ ARGO_EMBEDDING_BASE_URL=
28
+ # Embedding model id (e.g. qwen3.7-text-embedding).
29
+ ARGO_EMBEDDING_MODEL=
30
+ # Provider label recorded in evidence; also the rerank fallback provider.
31
+ ARGO_EMBEDDING_PROVIDER=
32
+ # Model version / qualification label (recorded evidence only).
33
+ ARGO_EMBEDDING_MODEL_VERSION=
34
+ # Embedding vector dimension; must match the model and the vector index
35
+ # (current profiles: 1536).
36
+ ARGO_EMBEDDING_DIMENSIONS=
37
+ # Query-side instruction prefix for instruction-tuned embedding models (e.g.
38
+ # gte-Qwen2: "Instruct: <task>\nQuery: "). Empty = no prefix. Documents are
39
+ # never prefixed; only the query side is.
40
+ ARGO_EMBEDDING_QUERY_INSTRUCTION=
41
+ # Optional embedding API key. SECRET: overrides QWEN_KEY as the Bearer token for
42
+ # the embeddings call when set (useful for a self-hosted endpoint). Leave empty
43
+ # to use QWEN_KEY.
44
+ ARGO_EMBEDDING_API_KEY=
45
+
46
+ # --- Neo4j (required) — structural projection + vector/full-text store ------
47
+ # Neo4j connection URI (e.g. neo4j://127.0.0.1:7687).
48
+ ARGO_NEO4J_DATABASE_URL=
49
+ # Neo4j username.
50
+ ARGO_NEO4J_DATABASE_USERNAME=
51
+ # Neo4j password. SECRET: value must come from the untracked
52
+ # .env (or direct process injection) only — never commit it.
53
+ ARGO_NEO4J_DATABASE_PASSWORD=
54
+ # Optional: override the Neo4j database name. Default = sanitized repository
55
+ # folder name (e.g. repo "archgraph" -> database "archgraph").
56
+ ARGO_NEO4J_DATABASE=
57
+
58
+ # --- Secrets (required) ------------------------------------------------------
59
+ # API key for the embedding endpoint above. SECRET; also the fallback key for
60
+ # the reranker when ARGO_RERANK_API_KEY is not set. Never commit it.
61
+ QWEN_KEY=
62
+
63
+ # --- Semantic retrieval tuning (optional; safe defaults shown) --------------
64
+ # Similarity threshold, memory purposes (recall-oriented). Default 0.55.
65
+ ARGO_SEMANTIC_MEMORY_THRESHOLD=
66
+ # Memory threshold override for the Element channel. Default 0.55.
67
+ ARGO_SEMANTIC_MEMORY_THRESHOLD_ELEMENT=
68
+ # Memory threshold override for the ArchitectureRelationship channel. Default 0.55.
69
+ ARGO_SEMANTIC_MEMORY_THRESHOLD_RELATIONSHIP=
70
+ # Memory threshold override for the View channel. Default 0.55.
71
+ ARGO_SEMANTIC_MEMORY_THRESHOLD_VIEW=
72
+ # Similarity threshold, audit purpose (precision-oriented). Default 0.8.
73
+ ARGO_SEMANTIC_AUDIT_THRESHOLD=
74
+ # Audit threshold override for the Element channel. Default 0.8.
75
+ ARGO_SEMANTIC_AUDIT_THRESHOLD_ELEMENT=
76
+ # Audit threshold override for the ArchitectureRelationship channel. Default 0.8.
77
+ ARGO_SEMANTIC_AUDIT_THRESHOLD_RELATIONSHIP=
78
+ # Audit threshold override for the View channel. Default 0.8.
79
+ ARGO_SEMANTIC_AUDIT_THRESHOLD_VIEW=
80
+ # Bound on returned candidates per retrieval. Default 8.
81
+ ARGO_SEMANTIC_TOP_K=
82
+
83
+ # --- Hybrid retrieval (vector + lexical BM25 via RRF; optional) -------------
84
+ # Master switch. "1" enables hybrid fusion; unset/"0" = vector-only (default off).
85
+ ARGO_SEMANTIC_HYBRID=
86
+ # Weight of the vector channel in the RRF fusion. Default 3.
87
+ ARGO_SEMANTIC_HYBRID_VECTOR_WEIGHT=
88
+ # Weight of the lexical (full-text) channel in the RRF fusion. Default 1.
89
+ ARGO_SEMANTIC_HYBRID_LEXICAL_WEIGHT=
90
+ # RRF smoothing constant k. Default 60.
91
+ ARGO_SEMANTIC_HYBRID_RRF_K=
92
+ # Candidate pool size pulled per channel before fusion. Default 16.
93
+ ARGO_SEMANTIC_HYBRID_TOP_K=
94
+
95
+ # --- LLM rerank (second-stage reordering; optional) -------------------------
96
+ # Master switch. "1" enables rerank; unset/"0" = off (default off). Fail-open:
97
+ # any error/timeout keeps the original order.
98
+ ARGO_SEMANTIC_RERANK=
99
+ # Rerank model when using the embedding provider fallback. Default qwen-turbo.
100
+ ARGO_SEMANTIC_RERANK_MODEL=
101
+ # Candidate pool size offered to the reranker. Default 20.
102
+ ARGO_SEMANTIC_RERANK_POOL=
103
+ # Max ids the reranker may return. Default 8.
104
+ ARGO_SEMANTIC_RERANK_RETURN=
105
+ # Per-request rerank timeout in ms (AbortController). Default 3500.
106
+ ARGO_SEMANTIC_RERANK_TIMEOUT_MS=
107
+ # Dedicated rerank provider (optional). When unset, rerank falls back to the
108
+ # embedding provider above. Use these to point rerank at another provider/model
109
+ # (e.g. DeepSeek: base https://api.deepseek.com, model deepseek-flash).
110
+ ARGO_RERANK_BASE_URL=
111
+ # Dedicated rerank API key. SECRET. Falls back to QWEN_KEY when unset.
112
+ ARGO_RERANK_API_KEY=
113
+ # Dedicated rerank provider label (informational; defaults to the embedding provider label).
114
+ ARGO_RERANK_PROVIDER=
115
+ # Dedicated rerank model id (overrides ARGO_SEMANTIC_RERANK_MODEL).
116
+ ARGO_RERANK_MODEL=
117
+ # Disable the rerank model's hidden "thinking"/reasoning (reasoning models spend
118
+ # 6-12s per call for a listwise ranking with no accuracy gain). Default 1 =
119
+ # disabled; set 0 to send nothing. Applies to every provider so a model swap
120
+ # keeps the fast path. If a provider rejects the fragment it is retried without.
121
+ ARGO_RERANK_DISABLE_THINKING=
122
+ # Exact JSON body fragment merged into the rerank request to disable thinking
123
+ # (default {"thinking":{"type":"disabled"}}). Override for another model/provider
124
+ # that uses a different field, e.g. {"reasoning_effort":"none"} or
125
+ # {"enable_thinking":false}.
126
+ ARGO_RERANK_THINKING_PARAM=
127
+
128
+ # --- Live end-to-end opt-ins (optional; normally unset) ---------------------
129
+ # "1" allows the live embedding-provider E2E to hit the real network.
130
+ ARGO_LIVE_PROVIDER_E2E=
131
+ # "1" allows the live W3.1 mutation-vector E2E to hit the real network.
132
+ ARGO_W31_LIVE_MUTATION_VECTOR_E2E=
133
+
134
+
135
+ # -----------------------------------------------------------------------------
136
+ # PART 2 — host / process-level only (do NOT put these in .env)
137
+ # Set in the host or MCP launch configuration (mcp.json / opencode.json env,
138
+ # dsh plugin, or the shell), never in the .env file.
139
+ # -----------------------------------------------------------------------------
140
+ # Point at a non-default env file path.
141
+ # ARGO_ENV_FILE=
142
+ # Pin the workspace/repository root the MCP server serves.
143
+ # ARGO_REPO_ROOT=
144
+ # Explicit schema-bundle directory (highest precedence): overrides both the
145
+ # repository's own <workspace>/.argo/schema bundle and the default ArgoBument
146
+ # bundle. Must contain SystemArchitecture.schema.json.
147
+ # ARGO_SCHEMA_DIR=
148
+ # Actor element type the wakeup gate looks up when a workspace schema renames
149
+ # it. Default: Business Actor.
150
+ # ARGO_ACTOR_ELEMENT_TYPE=
151
+ # Path to the Enterprise Architect model file (.qea) to project to/from.
152
+ # ARGO_EA_QEA=
153
+ # Semicolon-separated roots for multi-workspace hosts (DSH plugin).
154
+ # ARGO_WORKSPACE_ROOTS=
155
+ # Explicit path to the argo MCP server entry script (DSH plugin).
156
+ # ARGO_SERVER_PATH=
157
+ # URL of the graph-mcp HTTP bridge.
158
+ # GRAPH_MCP_URL=
159
+ # "1" enables verbose EA <-> .qea sync debug logging.
160
+ # EA_QEA_DEBUG=
161
+ # Architecture test runner timeout in ms.
162
+ # ARGO_TEST_TIMEOUT_MS=
163
+ # "1" prints the full mutation response for debugging.
164
+ # ARGO_MCP_MUTATION_RESPONSE_DEBUG=
165
+ # "0" disables the pre-write semantic dedup advisory (default: enabled).
166
+ # ARGO_MCP_SEMANTIC_DEDUP=
167
+ # Similarity threshold for the semantic dedup advisory. Default 0.85.
168
+ # ARGO_MCP_SEMANTIC_DEDUP_THRESHOLD=
169
+ # Alias of ARGO_MCP_SEMANTIC_DEDUP_THRESHOLD (takes precedence when set).
170
+ # ARGO_SEMANTIC_DEDUP_THRESHOLD=
@@ -1,27 +1,29 @@
1
- // Argo wakeup gate plugin for opencode.
2
- //
3
- // Injects an unconditional "wakeup gate" as the FIRST system instruction of
4
- // every session, so the agent identifies its Business Actor and restores its
5
- // long-term memory before responding to anything (including greetings and
6
- // casual questions). The rule also lives in argo/rules/archgraph.instructions.md,
7
- // but that file is long and can be skimmed; this hook guarantees a short,
8
- // high-salience gate sits at the top of the system prompt on session start.
9
-
10
- const WAKEUP_GATE = [
11
- "WAKEUP GATE (unconditional; applies to the very first message of every session, including greetings, casual chat, and questions; never skip or defer).",
12
- "1. Your very FIRST tool call must be an ARGO MCP query listing all Business Actors (getSystemArchitecture, purpose \"audit\", subject \"Business Actor\") to identify which Business Actor you are.",
13
- "2. Restore that Actor's long-term memory (the SUBVIEW hierarchy mounted under it) before responding.",
14
- "3. If the ARGO MCP is unavailable or errors, say so explicitly first. Only after this gate may you respond or act.",
15
- ].join("\n");
16
-
17
- export default async function argoWakeupPlugin() {
18
- return {
19
- "experimental.chat.system.transform": async (_input, output) => {
20
- const system = Array.isArray(output.system) ? output.system : [];
21
- if (system.some((entry) => entry.includes("WAKEUP GATE"))) {
22
- return;
23
- }
24
- output.system = [WAKEUP_GATE, ...system];
25
- },
26
- };
27
- }
1
+ // Argo wakeup gate plugin for opencode.
2
+ //
3
+ // Injects an unconditional "wakeup gate" as the FIRST system instruction of
4
+ // every session, so the agent identifies its Business Actor and restores its
5
+ // long-term memory before responding to anything (including greetings and
6
+ // casual questions). The rule also lives in argo/rules/archgraph.instructions.md,
7
+ // but that file is long and can be skimmed; this hook guarantees a short,
8
+ // high-salience gate sits at the top of the system prompt on session start.
9
+
10
+ const ACTOR_ELEMENT_TYPE = process.env.ARGO_ACTOR_ELEMENT_TYPE || 'Business Actor';
11
+
12
+ const WAKEUP_GATE = [
13
+ "WAKEUP GATE (unconditional; applies to the very first message of every session, including greetings, casual chat, and questions; never skip or defer).",
14
+ `1. Your very FIRST tool call must be an ARGO MCP query listing all Actor elements (getSystemArchitecture, purpose "audit", subject "${ACTOR_ELEMENT_TYPE}"). Resolve the workspace's own schema first: queryNeo4jGraph with {schema:true} reports actorElementType (a .argo/schema bundle may rename it; null means no Actor concept, then skip), bundleValidation, and the type enums.`,
15
+ "2. Restore that Actor's long-term memory (the SUBVIEW hierarchy mounted under it) before responding.",
16
+ "3. If the ARGO MCP is unavailable or errors, say so explicitly first. Only after this gate may you respond or act.",
17
+ ].join("\n");
18
+
19
+ export default async function argoWakeupPlugin() {
20
+ return {
21
+ "experimental.chat.system.transform": async (_input, output) => {
22
+ const system = Array.isArray(output.system) ? output.system : [];
23
+ if (system.some((entry) => entry.includes("WAKEUP GATE"))) {
24
+ return;
25
+ }
26
+ output.system = [WAKEUP_GATE, ...system];
27
+ },
28
+ };
29
+ }