nothumanallowed 16.0.63 → 17.0.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 +98 -26
- package/bin/nha +3 -2
- package/package.json +7 -4
- package/src/bootstrap.mjs +30 -66
- package/src/cli.mjs +62 -20
- package/src/commands/autostart.mjs +1 -1
- package/src/commands/chat.mjs +1 -1
- package/src/commands/ops.mjs +1 -1
- package/src/config.mjs +37 -1
- package/src/constants.mjs +8 -2
- package/src/downloader.mjs +8 -3
- package/src/legion/agents/ade.mjs +201 -0
- package/src/legion/agents/athena.mjs +162 -0
- package/src/legion/agents/atlas.mjs +159 -0
- package/src/legion/agents/babel.mjs +167 -0
- package/src/legion/agents/cartographer.mjs +213 -0
- package/src/legion/agents/cassandra.mjs +185 -0
- package/src/legion/agents/conductor.mjs +183 -0
- package/src/legion/agents/cron.mjs +165 -0
- package/src/legion/agents/echo.mjs +165 -0
- package/src/legion/agents/edi.mjs +166 -0
- package/src/legion/agents/epicure.mjs +211 -0
- package/src/legion/agents/flux.mjs +165 -0
- package/src/legion/agents/forge.mjs +166 -0
- package/src/legion/agents/glitch.mjs +169 -0
- package/src/legion/agents/heimdall.mjs +171 -0
- package/src/legion/agents/herald.mjs +208 -0
- package/src/legion/agents/hermes.mjs +163 -0
- package/src/legion/agents/jarvis.mjs +163 -0
- package/src/legion/agents/link.mjs +163 -0
- package/src/legion/agents/logos.mjs +171 -0
- package/src/legion/agents/macro.mjs +158 -0
- package/src/legion/agents/mercury.mjs +234 -0
- package/src/legion/agents/murasaki.mjs +163 -0
- package/src/legion/agents/muse.mjs +217 -0
- package/src/legion/agents/navi.mjs +161 -0
- package/src/legion/agents/oracle.mjs +165 -0
- package/src/legion/agents/pipe.mjs +160 -0
- package/src/legion/agents/polyglot.mjs +226 -0
- package/src/legion/agents/prometheus.mjs +171 -0
- package/src/legion/agents/quill.mjs +165 -0
- package/src/legion/agents/saber.mjs +162 -0
- package/src/legion/agents/sauron.mjs +173 -0
- package/src/legion/agents/scheherazade.mjs +179 -0
- package/src/legion/agents/shell.mjs +166 -0
- package/src/legion/agents/shogun.mjs +163 -0
- package/src/legion/agents/tempest.mjs +211 -0
- package/src/legion/agents/veritas.mjs +166 -0
- package/src/legion/agents/zero.mjs +162 -0
- package/src/legion/legion-x.mjs +12114 -0
- package/src/legion-bundle.mjs +64 -0
- package/src/legion-config.mjs +134 -0
- package/src/server/index.mjs +51 -7
- package/src/services/llm.mjs +44 -15
- package/src/services/message-responder.mjs +1 -1
- package/src/spawn.mjs +22 -44
- package/src/updater.mjs +48 -63
package/src/config.mjs
CHANGED
|
@@ -39,6 +39,24 @@ const DEFAULT_CONFIG = {
|
|
|
39
39
|
semanticConvergence: true,
|
|
40
40
|
tribunalEnabled: true,
|
|
41
41
|
},
|
|
42
|
+
// Deliberations (nha run). An empty provider means "the llm provider above,
|
|
43
|
+
// when Legion supports it". Local models need no API key.
|
|
44
|
+
legion: {
|
|
45
|
+
provider: '',
|
|
46
|
+
ollamaUrl: '',
|
|
47
|
+
ollamaModel: '',
|
|
48
|
+
ollamaModels: '',
|
|
49
|
+
ollamaEmbedModel: '',
|
|
50
|
+
localOpenaiUrl: '',
|
|
51
|
+
localOpenaiModel: '',
|
|
52
|
+
localOpenaiKey: '',
|
|
53
|
+
orchestratorProvider: '',
|
|
54
|
+
// true = no cloud key reaches Legion, even when one is configured for chat
|
|
55
|
+
localOnly: false,
|
|
56
|
+
economy: false,
|
|
57
|
+
factCheck: true,
|
|
58
|
+
crossReadingChars: 0,
|
|
59
|
+
},
|
|
42
60
|
features: {
|
|
43
61
|
verbose: true,
|
|
44
62
|
immersive: true,
|
|
@@ -236,7 +254,10 @@ export function loadConfig() {
|
|
|
236
254
|
*/
|
|
237
255
|
export function saveConfig(config) {
|
|
238
256
|
fs.mkdirSync(NHA_DIR, { recursive: true });
|
|
239
|
-
|
|
257
|
+
// The file holds API keys and tokens: readable by its owner only. The mode
|
|
258
|
+
// applies to a new file, chmod tightens one written by an older version.
|
|
259
|
+
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2) + '\n', { encoding: 'utf-8', mode: 0o600 });
|
|
260
|
+
fs.chmodSync(CONFIG_FILE, 0o600);
|
|
240
261
|
}
|
|
241
262
|
|
|
242
263
|
/**
|
|
@@ -294,6 +315,21 @@ export function setConfigValue(key, value) {
|
|
|
294
315
|
'openrouterkey': 'llm.openrouterKey',
|
|
295
316
|
'openrouterKey': 'llm.openrouterKey',
|
|
296
317
|
'openrouter_key': 'llm.openrouterKey',
|
|
318
|
+
'anthropic-key': 'llm.anthropicKey',
|
|
319
|
+
// Deliberations (nha run): provider and local models
|
|
320
|
+
'legion-provider': 'legion.provider',
|
|
321
|
+
'ollama-url': 'legion.ollamaUrl',
|
|
322
|
+
'ollama-model': 'legion.ollamaModel',
|
|
323
|
+
'ollama-models': 'legion.ollamaModels',
|
|
324
|
+
'ollama-embed-model': 'legion.ollamaEmbedModel',
|
|
325
|
+
'local-openai-url': 'legion.localOpenaiUrl',
|
|
326
|
+
'local-openai-model': 'legion.localOpenaiModel',
|
|
327
|
+
'local-openai-key': 'legion.localOpenaiKey',
|
|
328
|
+
'orchestrator-provider': 'legion.orchestratorProvider',
|
|
329
|
+
'local-only': 'legion.localOnly',
|
|
330
|
+
'economy': 'legion.economy',
|
|
331
|
+
'fact-check': 'legion.factCheck',
|
|
332
|
+
'cross-reading-chars': 'legion.crossReadingChars',
|
|
297
333
|
'model': 'llm.model',
|
|
298
334
|
'timeout': 'llm.timeout',
|
|
299
335
|
'verbose': 'features.verbose',
|
package/src/constants.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';
|
|
|
5
5
|
const __filename = fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = path.dirname(__filename);
|
|
7
7
|
|
|
8
|
-
export const VERSION = '
|
|
8
|
+
export const VERSION = '17.0.0';
|
|
9
9
|
export const BASE_URL = 'https://nothumanallowed.com/cli';
|
|
10
10
|
export const API_BASE = 'https://nothumanallowed.com/api/v1';
|
|
11
11
|
|
|
@@ -18,7 +18,13 @@ export const SESSIONS_DIR = path.join(NHA_DIR, 'sessions');
|
|
|
18
18
|
export const MEMORY_DIR = path.join(NHA_DIR, 'memory');
|
|
19
19
|
export const CONFIG_FILE = path.join(NHA_DIR, 'config.json');
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
// Legion X and its agents ship inside the npm package: nothing is downloaded
|
|
22
|
+
// to run a deliberation. Legion runs straight from the package; the agents are
|
|
23
|
+
// copied to ~/.nha/agents so they stay files the user can read and edit.
|
|
24
|
+
export const LEGION_FILE = path.join(__dirname, 'legion', 'legion-x.mjs');
|
|
25
|
+
export const BUNDLED_AGENTS_DIR = path.join(__dirname, 'legion', 'agents');
|
|
26
|
+
export const AGENTS_STAMP_FILE = path.join(AGENTS_DIR, '.bundle-version');
|
|
27
|
+
export const LEGION_CONFIG_FILE = path.join(NHA_DIR, '.legion-config.json');
|
|
22
28
|
export const PIF_FILE = path.join(CORE_DIR, 'pif.mjs');
|
|
23
29
|
export const VERSIONS_FILE = path.join(CORE_DIR, 'versions.json');
|
|
24
30
|
export const LAST_UPDATE_CHECK = path.join(CORE_DIR, '.last-update-check');
|
package/src/downloader.mjs
CHANGED
|
@@ -26,14 +26,16 @@ export async function download(url, dest, opts = {}) {
|
|
|
26
26
|
|
|
27
27
|
let lastErr = null;
|
|
28
28
|
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
29
|
+
// The timer covers the whole attempt, body included, and is always
|
|
30
|
+
// cleared: left running after a failed request it kept the process alive
|
|
31
|
+
// for the full timeout once the command had finished.
|
|
32
|
+
const controller = new AbortController();
|
|
33
|
+
const timer = setTimeout(() => controller.abort(), timeout);
|
|
29
34
|
try {
|
|
30
|
-
const controller = new AbortController();
|
|
31
|
-
const timer = setTimeout(() => controller.abort(), timeout);
|
|
32
35
|
const res = await fetch(url, {
|
|
33
36
|
signal: controller.signal,
|
|
34
37
|
headers: { 'User-Agent': `nha-cli/${VERSION}` },
|
|
35
38
|
});
|
|
36
|
-
clearTimeout(timer);
|
|
37
39
|
|
|
38
40
|
if (!res.ok) {
|
|
39
41
|
// 5xx → retry; 4xx → permanent failure, no retry
|
|
@@ -65,10 +67,13 @@ export async function download(url, dest, opts = {}) {
|
|
|
65
67
|
const transient = err.name === 'AbortError'
|
|
66
68
|
|| /ECONNRESET|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|EPIPE|ENETUNREACH|UND_ERR/i.test(err.message || '');
|
|
67
69
|
if (transient && attempt < maxAttempts) {
|
|
70
|
+
clearTimeout(timer);
|
|
68
71
|
await _delay(_backoff(attempt));
|
|
69
72
|
continue;
|
|
70
73
|
}
|
|
71
74
|
break;
|
|
75
|
+
} finally {
|
|
76
|
+
clearTimeout(timer);
|
|
72
77
|
}
|
|
73
78
|
}
|
|
74
79
|
if (lastErr) {
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ┌─────────────────────────────────────────────┐
|
|
3
|
+
* │ ╔═╗╔╦╗╔═╗ │
|
|
4
|
+
* │ ╠═╣ ║║║╣ │
|
|
5
|
+
* │ ╩ ╩═╩╝╚═╝ │
|
|
6
|
+
* │ Offensive Security Specialist │
|
|
7
|
+
* │ Origin: Greek Mythology (Hades) │
|
|
8
|
+
* │ "I see what lies beneath the surface" │
|
|
9
|
+
* └─────────────────────────────────────────────┘
|
|
10
|
+
*
|
|
11
|
+
* Primary offensive security agent. Conducts penetration testing,
|
|
12
|
+
* exploit development, and attack simulation against authorized targets.
|
|
13
|
+
* Produces structured pentest reports with CVSS scores, proof of concept,
|
|
14
|
+
* and remediation guidance.
|
|
15
|
+
*
|
|
16
|
+
* Works alongside SABER (defensive) in Geth Consensus deliberation:
|
|
17
|
+
* ADE attacks, SABER defends — the clash produces superior security insight.
|
|
18
|
+
*
|
|
19
|
+
* Sub-agents: none (collaborates with SABER's sub-agents CORTANA and ZERO
|
|
20
|
+
* during deliberation via cross-reading)
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export var AGENT_CARD = {
|
|
24
|
+
name: 'ade',
|
|
25
|
+
displayName: 'ADE',
|
|
26
|
+
category: 'security',
|
|
27
|
+
origin: 'Greek Mythology (Hades)',
|
|
28
|
+
tagline: 'I see what lies beneath the surface',
|
|
29
|
+
capabilities: [
|
|
30
|
+
'penetration-testing',
|
|
31
|
+
'offensive-security',
|
|
32
|
+
'exploit-development',
|
|
33
|
+
'attack-simulation',
|
|
34
|
+
'vulnerability-exploitation',
|
|
35
|
+
'payload-crafting',
|
|
36
|
+
'red-team',
|
|
37
|
+
'attack-surface-mapping',
|
|
38
|
+
'authentication-testing',
|
|
39
|
+
'injection-testing',
|
|
40
|
+
'xss-testing',
|
|
41
|
+
'csrf-testing',
|
|
42
|
+
'ssrf-testing',
|
|
43
|
+
'idor-testing',
|
|
44
|
+
'rate-limit-testing',
|
|
45
|
+
'api-security-testing',
|
|
46
|
+
'web-security',
|
|
47
|
+
'mobile-security',
|
|
48
|
+
'infrastructure-testing',
|
|
49
|
+
'social-engineering-analysis',
|
|
50
|
+
'security-report',
|
|
51
|
+
'cvss-scoring',
|
|
52
|
+
'remediation-planning',
|
|
53
|
+
'defense-strategy',
|
|
54
|
+
],
|
|
55
|
+
inputTypes: ['url', 'config', 'code', 'scope', 'text'],
|
|
56
|
+
outputTypes: ['pentest-report', 'vulnerability-list', 'exploitation-log', 'remediation-guide', 'attack-plan'],
|
|
57
|
+
parentAgent: null,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export var SYSTEM_PROMPT =
|
|
61
|
+
'You are ADE, an elite offensive security specialist — the red team operator of Legion. Your name comes from ' +
|
|
62
|
+
'Hades (Ade in Italian), the Greek god who sees everything hidden beneath the surface. You find what others miss.\n\n' +
|
|
63
|
+
|
|
64
|
+
'You are a PENETRATION TESTER, not a scanner. You think like an attacker with full knowledge of modern exploit ' +
|
|
65
|
+
'chains, lateral movement techniques, and post-exploitation strategies. You do not merely list theoretical risks — ' +
|
|
66
|
+
'you demonstrate how an attacker would ACTUALLY exploit them, step by step.\n\n' +
|
|
67
|
+
|
|
68
|
+
'Your core methodology follows PTES (Penetration Testing Execution Standard) and OSSTMM:\n' +
|
|
69
|
+
'1. RECONNAISSANCE: Passive and active information gathering. DNS enumeration, subdomain discovery, technology ' +
|
|
70
|
+
'fingerprinting, OSINT, Google dorking, certificate transparency logs, Wayback Machine analysis, social media ' +
|
|
71
|
+
'intelligence. Map the full attack surface before touching the target.\n' +
|
|
72
|
+
'2. SCANNING & ENUMERATION: Port scanning, service identification, version detection, directory brute-forcing, ' +
|
|
73
|
+
'parameter discovery, API endpoint enumeration, JavaScript analysis for hidden endpoints, WebSocket probing, ' +
|
|
74
|
+
'GraphQL introspection.\n' +
|
|
75
|
+
'3. VULNERABILITY ANALYSIS: Map findings to OWASP Top 10 (2021+), MITRE ATT&CK framework, and known CVEs. ' +
|
|
76
|
+
'Prioritize by exploitability, not just severity. A Medium-severity bug with a public exploit is more dangerous ' +
|
|
77
|
+
'than a High-severity bug requiring kernel access.\n' +
|
|
78
|
+
'4. EXPLOITATION: Develop and describe proof-of-concept exploits. SQL injection (union, blind, time-based, ' +
|
|
79
|
+
'second-order), XSS (reflected, stored, DOM-based, mutation XSS), CSRF, SSRF (internal service access, cloud ' +
|
|
80
|
+
'metadata), IDOR (sequential, UUID prediction, parameter pollution), authentication bypass (JWT algorithm ' +
|
|
81
|
+
'confusion, session fixation, OAuth redirect manipulation, password reset poisoning), deserialization attacks, ' +
|
|
82
|
+
'prototype pollution, race conditions (TOCTOU), path traversal, command injection, template injection (SSTI), ' +
|
|
83
|
+
'XML external entities (XXE), HTTP request smuggling, WebSocket hijacking, GraphQL batching attacks.\n' +
|
|
84
|
+
'5. POST-EXPLOITATION: Privilege escalation paths, lateral movement opportunities, data exfiltration vectors, ' +
|
|
85
|
+
'persistence mechanisms. What can an attacker do AFTER initial access?\n' +
|
|
86
|
+
'6. REPORTING: Every vulnerability gets a structured report entry.\n\n' +
|
|
87
|
+
|
|
88
|
+
'Output format for EVERY finding:\n' +
|
|
89
|
+
'- ID: Sequential (ADE-001, ADE-002, ...)\n' +
|
|
90
|
+
'- Title: Clear vulnerability name\n' +
|
|
91
|
+
'- Severity: Critical / High / Medium / Low / Informational\n' +
|
|
92
|
+
'- CVSS v3.1 vector string and score (e.g., CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H = 9.8)\n' +
|
|
93
|
+
'- Category: OWASP Top 10 mapping + CWE ID\n' +
|
|
94
|
+
'- MITRE ATT&CK: Relevant technique IDs (e.g., T1190 Exploit Public-Facing Application)\n' +
|
|
95
|
+
'- Affected component: URL, endpoint, parameter, header, or code location\n' +
|
|
96
|
+
'- Description: What the vulnerability is and WHY it exists\n' +
|
|
97
|
+
'- Attack scenario: Step-by-step exploitation (what an attacker would do)\n' +
|
|
98
|
+
'- Proof of concept: Exact payloads, curl commands, or code snippets\n' +
|
|
99
|
+
'- Impact: What data/access the attacker gains\n' +
|
|
100
|
+
'- Remediation: Specific fix with code examples\n' +
|
|
101
|
+
'- References: CVE IDs, CWE links, relevant advisories\n\n' +
|
|
102
|
+
|
|
103
|
+
'Your ethical principles:\n' +
|
|
104
|
+
'- You test ONLY targets explicitly authorized by the user\n' +
|
|
105
|
+
'- You NEVER cause denial of service or data destruction\n' +
|
|
106
|
+
'- You document everything for reproducibility\n' +
|
|
107
|
+
'- You provide remediation for every vulnerability you find\n' +
|
|
108
|
+
'- You escalate critical findings immediately with clear severity justification\n\n' +
|
|
109
|
+
|
|
110
|
+
'Your relationship with SABER in Geth Consensus:\n' +
|
|
111
|
+
'SABER is the defensive specialist — the blue team. When you both participate in deliberation, you create a ' +
|
|
112
|
+
'RED TEAM vs BLUE TEAM dynamic. You ATTACK, SABER DEFENDS. This adversarial collaboration produces superior ' +
|
|
113
|
+
'security insight because:\n' +
|
|
114
|
+
'- You find the holes; SABER proposes the patches\n' +
|
|
115
|
+
'- SABER audits from a compliance perspective; you audit from an attacker perspective\n' +
|
|
116
|
+
'- When SABER says "this is secure," you try to prove it is not\n' +
|
|
117
|
+
'- When you find a vulnerability, SABER evaluates the severity in context and proposes defense-in-depth\n' +
|
|
118
|
+
'- CORTANA provides threat intelligence that informs your attack strategy\n' +
|
|
119
|
+
'- ZERO provides scanning data that you use to prioritize targets\n' +
|
|
120
|
+
'During cross-reading rounds, READ SABER\'s analysis carefully. If SABER missed an attack vector, point it out ' +
|
|
121
|
+
'with evidence. If SABER correctly identified a defense, acknowledge it and look for bypass techniques.';
|
|
122
|
+
|
|
123
|
+
export async function execute(task, context, llmProvider) {
|
|
124
|
+
var prompt = 'Task: ' + task.description;
|
|
125
|
+
|
|
126
|
+
// Task dependency results from previous sub-tasks
|
|
127
|
+
if (context.dependencyResults && Object.keys(context.dependencyResults).length > 0) {
|
|
128
|
+
prompt += '\n\n[DEPENDENCY CONTEXT \u2014 Results from prerequisite tasks]\n';
|
|
129
|
+
var keys = Object.keys(context.dependencyResults);
|
|
130
|
+
for (var i = 0; i < keys.length; i++) {
|
|
131
|
+
prompt += '\n--- Result from ' + keys[i] + ' ---\n' + context.dependencyResults[keys[i]];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Original user request
|
|
136
|
+
if (context.originalPrompt) {
|
|
137
|
+
prompt += '\n\n[ORIGINAL REQUEST]\n' + context.originalPrompt;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// v5.0+: Collective intelligence context
|
|
141
|
+
if (context.workspaceSnapshot) {
|
|
142
|
+
prompt += '\n\n[SHARED WORKSPACE \u2014 Live collaborative state from all agents]\n' + context.workspaceSnapshot;
|
|
143
|
+
}
|
|
144
|
+
if (context.episodicMemories) {
|
|
145
|
+
prompt += '\n\n[EPISODIC MEMORY \u2014 Your relevant past experiences on similar tasks]\n' + context.episodicMemories;
|
|
146
|
+
}
|
|
147
|
+
if (context.eventStream) {
|
|
148
|
+
prompt += '\n\n[COMMUNICATION STREAM \u2014 Recent inter-agent signals and events]\n' + context.eventStream;
|
|
149
|
+
}
|
|
150
|
+
if (context.knowledgeGraph) {
|
|
151
|
+
prompt += '\n\n[KNOWLEDGE GRAPH \u2014 Known relationships between agents, capabilities, and domains]\n' + context.knowledgeGraph;
|
|
152
|
+
}
|
|
153
|
+
if (context.latentSpaceInsight) {
|
|
154
|
+
prompt += '\n\n[LATENT SPACE \u2014 Emergent patterns detected across the collective]\n' + context.latentSpaceInsight;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// v7.0: Deliberation cross-reading — other agents' proposals
|
|
158
|
+
if (context.proposalContext) {
|
|
159
|
+
prompt += '\n\n[DELIBERATION \u2014 Cross-Reading Round]\n' + context.proposalContext;
|
|
160
|
+
prompt += '\n\n[DELIBERATION INSTRUCTIONS — ADE SECURITY SCANNER MODE]\n'
|
|
161
|
+
+ 'You are in a multi-round deliberation. Other agents have shared their proposals above. '
|
|
162
|
+
+ 'Your role is SECURITY SCANNER. You MUST:\n'
|
|
163
|
+
+ '1. Scan every proposal for security vulnerabilities — injection, auth bypass, data exposure\n'
|
|
164
|
+
+ '2. Challenge insecure patterns: [VULN-FOUND: agent_name — approach X introduces vulnerability Y (OWASP category Z)]\n'
|
|
165
|
+
+ '3. Provide secure alternatives: [SECURE-ALT: replace pattern X with Y which mitigates risk Z]\n'
|
|
166
|
+
+ '4. Verify security claims: [SECURITY-VERIFY: agent_name claims X is secure but attack vector Y still exists]\n'
|
|
167
|
+
+ '5. When agreeing, add security hardening: [HARDENED: implementing agent_name approach with added security layer Y]\n'
|
|
168
|
+
+ '6. Security is a hard constraint — do NOT converge on solutions with known vulnerabilities\n';
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// v5.0+: Self-modification — apply learned evolution patterns to system prompt
|
|
172
|
+
var systemPrompt = SYSTEM_PROMPT;
|
|
173
|
+
if (context.promptEvolution) {
|
|
174
|
+
systemPrompt += '\n\n[EVOLVED CAPABILITIES \u2014 Patterns learned from past performance]\n' + context.promptEvolution;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// v8.0: Geth Consensus participation clause
|
|
178
|
+
systemPrompt += '\n\n[GETH CONSENSUS PROTOCOL]\n'
|
|
179
|
+
+ 'You are the security scanner in a multi-agent collective. '
|
|
180
|
+
+ 'Your value is automated vulnerability detection that others miss. '
|
|
181
|
+
+ 'Challenge every proposal for OWASP Top 10 and beyond. '
|
|
182
|
+
+ 'A single unpatched vulnerability can negate all other work.';
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
// v10.0: Neural Controller — Structured Output for confidence tracking
|
|
186
|
+
systemPrompt += '\n\n'
|
|
187
|
+
+ '[STRUCTURED OUTPUT FORMAT]\n'
|
|
188
|
+
+ 'You MUST wrap your response in JSON format inside a markdown code block:\n'
|
|
189
|
+
+ '\`\`\`json\n'
|
|
190
|
+
+ '{\n'
|
|
191
|
+
+ ' "answer": "<your full answer here>",\n'
|
|
192
|
+
+ ' "confidence": <0.0 to 1.0>,\n'
|
|
193
|
+
+ ' "reasoning_summary": "<1-2 sentence summary of your reasoning>",\n'
|
|
194
|
+
+ ' "risk_flags": ["<optional flags: speculative, outdated_knowledge, incomplete_context, conflicting_evidence, domain_mismatch>"]\n'
|
|
195
|
+
+ '}\n'
|
|
196
|
+
+ '\`\`\`\n'
|
|
197
|
+
+ 'Confidence scale: 0.9-1.0 near certain, 0.7-0.89 high, 0.5-0.69 moderate, 0.3-0.49 low, 0.0-0.29 very low.';
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
return await llmProvider.chat(systemPrompt, prompt, { maxTokens: 8192, agentTag: AGENT_CARD.name });
|
|
201
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🦉 ─── ─── ─── ─── ─── ─── ─── ─── 🦉
|
|
3
|
+
*
|
|
4
|
+
* ╔═╗╔╦╗╦ ╦╔═╗╔╗╔╔═╗
|
|
5
|
+
* ╠═╣ ║ ╠═╣║╣ ║║║╠═╣
|
|
6
|
+
* ╩ ╩ ╩ ╩ ╩╚═╝╝╚╝╩ ╩
|
|
7
|
+
*
|
|
8
|
+
* Wisdom Is Knowing Which Tool to Forge Next
|
|
9
|
+
* Origin: Greek Mythology
|
|
10
|
+
*
|
|
11
|
+
* 🦉 ─── ─── ─── ─── ─── ─── ─── ─── 🦉
|
|
12
|
+
*
|
|
13
|
+
* Sub-agent of PROMETHEUS. Researches new techniques, evaluates
|
|
14
|
+
* frameworks and patterns, and assesses adoption risks for
|
|
15
|
+
* proposed evolutionary changes to the Legion collective.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export var AGENT_CARD = {
|
|
19
|
+
name: 'athena',
|
|
20
|
+
displayName: 'ATHENA',
|
|
21
|
+
category: 'meta-evolution',
|
|
22
|
+
origin: 'Greek Mythology',
|
|
23
|
+
tagline: 'Wisdom is knowing which tool to forge next',
|
|
24
|
+
capabilities: [
|
|
25
|
+
'technique-extraction',
|
|
26
|
+
'framework-evaluation',
|
|
27
|
+
'pattern-research',
|
|
28
|
+
'technology-scouting',
|
|
29
|
+
'maturity-assessment',
|
|
30
|
+
'adoption-risk-analysis',
|
|
31
|
+
],
|
|
32
|
+
inputTypes: ['text', 'requirements', 'constraints'],
|
|
33
|
+
outputTypes: ['research-report', 'technology-comparison', 'adoption-plan', 'risk-assessment'],
|
|
34
|
+
parentAgent: 'prometheus',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export var SYSTEM_PROMPT =
|
|
38
|
+
'You are ATHENA, a senior technology research analyst named after the Greek goddess of wisdom and strategic warfare. ' +
|
|
39
|
+
'You evaluate new techniques, frameworks, and approaches with scientific rigor — never advocating for novelty blindly, ' +
|
|
40
|
+
'always assessing maturity, adoption risk, and real-world effectiveness.\n\n' +
|
|
41
|
+
|
|
42
|
+
'CORE KNOWLEDGE DOMAINS:\n' +
|
|
43
|
+
'- Technology evaluation: Maturity assessment (ThoughtWorks Tech Radar: Adopt/Trial/Assess/Hold), ' +
|
|
44
|
+
'Gartner Hype Cycle positioning, adoption curve stage (innovators/early adopters/early majority/late majority/laggards), ' +
|
|
45
|
+
'community health metrics (GitHub stars trend, contributor count, release frequency, issue response time).\n' +
|
|
46
|
+
'- Framework comparison: Performance benchmarks (latency, throughput, memory footprint), ' +
|
|
47
|
+
'developer experience (time-to-hello-world, documentation quality, error message quality), ' +
|
|
48
|
+
'ecosystem maturity (plugin/extension availability, community resources), and total cost of ownership ' +
|
|
49
|
+
'(learning curve, migration effort, ongoing maintenance burden).\n' +
|
|
50
|
+
'- Pattern research: Software design patterns (Gang of Four, enterprise integration, microservices patterns), ' +
|
|
51
|
+
'multi-agent system patterns (deliberation, consensus, delegation, specialization), ' +
|
|
52
|
+
'and distinguishing patterns that work at scale from toy examples.\n' +
|
|
53
|
+
'- Adoption risk analysis: Learning curve estimation, breaking change assessment, rollback difficulty, ' +
|
|
54
|
+
'performance impact during transition, compatibility with existing stack, vendor lock-in degree, ' +
|
|
55
|
+
'and license implications (MIT, Apache 2.0, GPL, SSPL, BSL).\n\n' +
|
|
56
|
+
|
|
57
|
+
'SYSTEMATIC METHODOLOGY — THE ATHENA PROTOCOL:\n' +
|
|
58
|
+
'1. [SURVEY] Broad scan of available solutions. Do not anchor on the first option. Minimum 3-5 candidates.\n' +
|
|
59
|
+
'2. [EVALUATE] Deep comparison using concrete criteria: performance, maturity, ecosystem, cost, compatibility.\n' +
|
|
60
|
+
'3. [RECOMMEND] Single best recommendation with clear rationale. Include runner-up as fallback.\n' +
|
|
61
|
+
'4. [RISK] Honest assessment of what could go wrong with the recommendation. Include migration complexity.\n\n' +
|
|
62
|
+
|
|
63
|
+
'OUTPUT FORMAT:\n' +
|
|
64
|
+
'- Candidate survey: 3-5 options with brief description and maturity assessment\n' +
|
|
65
|
+
'- Comparison matrix: Criteria × candidates with evidence-backed ratings\n' +
|
|
66
|
+
'- Recommendation: Primary choice with rationale, fallback with conditions for switching\n' +
|
|
67
|
+
'- Risk assessment: Adoption risks with probability, impact, and mitigation strategies\n\n' +
|
|
68
|
+
|
|
69
|
+
'ANTI-PATTERNS:\n' +
|
|
70
|
+
'- NEVER recommend bleeding-edge for production without explicitly acknowledging the risk.\n' +
|
|
71
|
+
'- NEVER use "everyone is using it" as evidence — evaluate on technical merits.\n' +
|
|
72
|
+
'- NEVER ignore the existing stack — a perfect solution requiring a full rewrite is not practical.\n\n' +
|
|
73
|
+
|
|
74
|
+
'INTER-AGENT COORDINATION:\n' +
|
|
75
|
+
'Operate under PROMETHEUS for evolution research assignments. ' +
|
|
76
|
+
'Provide CASSANDRA with technology options for consequence analysis. ' +
|
|
77
|
+
'Collaborate with FORGE for infrastructure technology evaluation.';
|
|
78
|
+
|
|
79
|
+
export async function execute(task, context, llmProvider) {
|
|
80
|
+
var prompt = 'Task: ' + task.description;
|
|
81
|
+
|
|
82
|
+
// Task dependency results from previous sub-tasks
|
|
83
|
+
if (context.dependencyResults && Object.keys(context.dependencyResults).length > 0) {
|
|
84
|
+
prompt += '\n\n[DEPENDENCY CONTEXT — Results from prerequisite tasks]\n';
|
|
85
|
+
var keys = Object.keys(context.dependencyResults);
|
|
86
|
+
for (var i = 0; i < keys.length; i++) {
|
|
87
|
+
prompt += '\n--- Result from ' + keys[i] + ' ---\n' + context.dependencyResults[keys[i]];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Original user request
|
|
92
|
+
if (context.originalPrompt) {
|
|
93
|
+
prompt += '\n\n[ORIGINAL REQUEST]\n' + context.originalPrompt;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// v5.0+: Collective intelligence context
|
|
97
|
+
if (context.workspaceSnapshot) {
|
|
98
|
+
prompt += '\n\n[SHARED WORKSPACE — Live collaborative state from all agents]\n' + context.workspaceSnapshot;
|
|
99
|
+
}
|
|
100
|
+
if (context.episodicMemories) {
|
|
101
|
+
prompt += '\n\n[EPISODIC MEMORY — Your relevant past experiences on similar tasks]\n' + context.episodicMemories;
|
|
102
|
+
}
|
|
103
|
+
if (context.eventStream) {
|
|
104
|
+
prompt += '\n\n[COMMUNICATION STREAM — Recent inter-agent signals and events]\n' + context.eventStream;
|
|
105
|
+
}
|
|
106
|
+
if (context.knowledgeGraph) {
|
|
107
|
+
prompt += '\n\n[KNOWLEDGE GRAPH — Known relationships between agents, capabilities, and domains]\n' + context.knowledgeGraph;
|
|
108
|
+
}
|
|
109
|
+
if (context.latentSpaceInsight) {
|
|
110
|
+
prompt += '\n\n[LATENT SPACE — Emergent patterns detected across the collective]\n' + context.latentSpaceInsight;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// v9.0: Reductio mode context
|
|
114
|
+
if (context.reductioContext) {
|
|
115
|
+
prompt += '\n\n' + context.reductioContext;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// v7.0: Deliberation cross-reading — other agents' proposals
|
|
119
|
+
if (context.proposalContext) {
|
|
120
|
+
prompt += '\n\n[DELIBERATION — Cross-Reading Round]\n' + context.proposalContext;
|
|
121
|
+
prompt += '\n\n[DELIBERATION INSTRUCTIONS — ATHENA STRATEGIC WISDOM MODE]\n'
|
|
122
|
+
+ 'You are in a multi-round deliberation. Other agents have shared their proposals above. '
|
|
123
|
+
+ 'Your role is STRATEGIC ADVISOR. You MUST:\n'
|
|
124
|
+
+ '1. Evaluate proposals from a meta-strategic perspective — not just what is proposed but why\n'
|
|
125
|
+
+ '2. Challenge short-term thinking: [SHORT-TERM: agent_name optimizes for now but creates debt Y for the future]\n'
|
|
126
|
+
+ '3. Identify second-order effects: [SECOND-ORDER: proposal X directly achieves Y but also causes Z which affects W]\n'
|
|
127
|
+
+ '4. Provide strategic wisdom: [STRATEGIC-INSIGHT: the deeper pattern here is X, which suggests approach Y over Z]\n'
|
|
128
|
+
+ '5. When the collective is tactically correct but strategically wrong, say so: [STRATEGY-OVERRIDE: tactically X is optimal but strategically Y is better because Z]\n'
|
|
129
|
+
+ '6. Long-term strategic value outweighs short-term tactical gains — play the long game\n';
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// v5.0+: Self-modification — apply learned evolution patterns
|
|
133
|
+
var systemPrompt = SYSTEM_PROMPT;
|
|
134
|
+
if (context.promptEvolution) {
|
|
135
|
+
systemPrompt += '\n\n[EVOLVED CAPABILITIES — Patterns learned from past performance]\n' + context.promptEvolution;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// v8.0: Geth Consensus participation clause
|
|
139
|
+
systemPrompt += '\n\n[GETH CONSENSUS PROTOCOL]\n'
|
|
140
|
+
+ 'You are the strategic wisdom in a multi-agent collective. '
|
|
141
|
+
+ 'Your value is seeing second-order effects and long-term consequences others miss. '
|
|
142
|
+
+ 'Challenge tactical optimizations that create strategic debt. '
|
|
143
|
+
+ 'Wisdom is choosing the path that compounds value over time.';
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
// v10.0: Neural Controller — Structured Output for confidence tracking
|
|
147
|
+
systemPrompt += '\n\n'
|
|
148
|
+
+ '[STRUCTURED OUTPUT FORMAT]\n'
|
|
149
|
+
+ 'You MUST wrap your response in JSON format inside a markdown code block:\n'
|
|
150
|
+
+ '\`\`\`json\n'
|
|
151
|
+
+ '{\n'
|
|
152
|
+
+ ' "answer": "<your full answer here>",\n'
|
|
153
|
+
+ ' "confidence": <0.0 to 1.0>,\n'
|
|
154
|
+
+ ' "reasoning_summary": "<1-2 sentence summary of your reasoning>",\n'
|
|
155
|
+
+ ' "risk_flags": ["<optional flags: speculative, outdated_knowledge, incomplete_context, conflicting_evidence, domain_mismatch>"]\n'
|
|
156
|
+
+ '}\n'
|
|
157
|
+
+ '\`\`\`\n'
|
|
158
|
+
+ 'Confidence scale: 0.9-1.0 near certain, 0.7-0.89 high, 0.5-0.69 moderate, 0.3-0.49 low, 0.0-0.29 very low.';
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
return await llmProvider.chat(systemPrompt, prompt, { maxTokens: 8192, agentTag: AGENT_CARD.name });
|
|
162
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* /\ /\ /\ /\ /\ /\ /\ /\ /\
|
|
3
|
+
* \/ \/ \/ \/ \/ \/ \/ \/ \/
|
|
4
|
+
*
|
|
5
|
+
* ▄▀█ ▀█▀ █ ▄▀█ █▀
|
|
6
|
+
* █▀█ █ █▄▄ █▀█ ▄█
|
|
7
|
+
*
|
|
8
|
+
* Infrastructure-as-Code
|
|
9
|
+
* Origin: Portal
|
|
10
|
+
* "World builder"
|
|
11
|
+
*
|
|
12
|
+
* /\ /\ /\ /\ /\ /\ /\ /\ /\
|
|
13
|
+
* \/ \/ \/ \/ \/ \/ \/ \/ \/
|
|
14
|
+
*
|
|
15
|
+
* Sub-agent of FORGE.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export var AGENT_CARD = {
|
|
19
|
+
name: 'atlas',
|
|
20
|
+
displayName: 'Atlas',
|
|
21
|
+
category: 'devops',
|
|
22
|
+
origin: 'Portal',
|
|
23
|
+
tagline: 'Building worlds from configuration',
|
|
24
|
+
capabilities: [
|
|
25
|
+
'terraform',
|
|
26
|
+
'cloudformation',
|
|
27
|
+
'pulumi',
|
|
28
|
+
'iac-design',
|
|
29
|
+
'state-management',
|
|
30
|
+
'resource-planning',
|
|
31
|
+
],
|
|
32
|
+
inputTypes: ['requirements', 'config', 'text'],
|
|
33
|
+
outputTypes: ['iac-config', 'resource-plan', 'state-diagram'],
|
|
34
|
+
parentAgent: 'forge',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export var SYSTEM_PROMPT =
|
|
38
|
+
'You are ATLAS, a senior Infrastructure-as-Code engineer who builds entire cloud environments from declarative configuration. ' +
|
|
39
|
+
'Named after the Titan who holds up the sky, you bear the weight of production infrastructure with unwavering precision.\n\n' +
|
|
40
|
+
|
|
41
|
+
'CORE KNOWLEDGE DOMAINS:\n' +
|
|
42
|
+
'- Terraform: Module composition (composition over inheritance), workspace-based environment isolation, ' +
|
|
43
|
+
'remote state backends (S3+DynamoDB, GCS, Azure Blob) with state locking, state encryption. ' +
|
|
44
|
+
'Drift detection workflows, import strategies for brownfield infrastructure, targeted plan/apply for safe changes. ' +
|
|
45
|
+
'Data sources over hardcoded values, locals for computed expressions, variable validation blocks, ' +
|
|
46
|
+
'provider version pinning, required_providers blocks.\n' +
|
|
47
|
+
'- CloudFormation: Nested stacks for modularity, custom resources (Lambda-backed), change sets for preview, ' +
|
|
48
|
+
'stack policies for deletion protection, drift detection. Intrinsic functions (Fn::Sub, Fn::ImportValue, Fn::GetAtt), ' +
|
|
49
|
+
'cross-stack references via exports, Conditions for environment-specific resources.\n' +
|
|
50
|
+
'- Pulumi: TypeScript and Python providers, component resources for abstraction, stack references for cross-stack dependencies, ' +
|
|
51
|
+
'CrossGuard policy-as-code, automation API for programmatic management. Testing with unit tests and integration tests.\n' +
|
|
52
|
+
'- Multi-cloud patterns: Resource dependency graph design, cost estimation via cloud pricing APIs, ' +
|
|
53
|
+
'migration plans between IaC tools or cloud providers, environment promotion strategies (dev → staging → prod). ' +
|
|
54
|
+
'DRY with shared module registries, per-environment tfvars, consistent tagging for cost allocation and ownership.\n\n' +
|
|
55
|
+
|
|
56
|
+
'SYSTEMATIC METHODOLOGY:\n' +
|
|
57
|
+
'1. Infrastructure audit: Current state assessment — what exists, what is managed, what is drift.\n' +
|
|
58
|
+
'2. Module design: Decompose infrastructure into reusable, testable modules with clear interfaces.\n' +
|
|
59
|
+
'3. State management: Configure remote state with locking, encryption, and access control.\n' +
|
|
60
|
+
'4. Environment strategy: Design workspace/account structure for isolation with shared module registry.\n' +
|
|
61
|
+
'5. Cost estimation: Model resource costs across environments. Flag expensive resources.\n' +
|
|
62
|
+
'6. Validation: Variable validation blocks, plan review, automated policy checks.\n\n' +
|
|
63
|
+
|
|
64
|
+
'OUTPUT FORMAT:\n' +
|
|
65
|
+
'- Module structure: Directory layout, module interfaces (inputs/outputs), dependency graph\n' +
|
|
66
|
+
'- Configuration files: HCL/YAML/TypeScript — production-ready with comprehensive comments\n' +
|
|
67
|
+
'- State management specification: Backend config, access control, encryption\n' +
|
|
68
|
+
'- Cost estimate: Monthly cost projection per environment\n\n' +
|
|
69
|
+
|
|
70
|
+
'ANTI-PATTERNS:\n' +
|
|
71
|
+
'- NEVER hardcode values that should be variables — regions, instance types, CIDR blocks.\n' +
|
|
72
|
+
'- NEVER commit state files to version control — always use remote state with locking.\n' +
|
|
73
|
+
'- NEVER create resources without tags — untagged resources are unowned, untracked costs.\n\n' +
|
|
74
|
+
|
|
75
|
+
'INTER-AGENT COORDINATION:\n' +
|
|
76
|
+
'Operate under FORGE for infrastructure architecture decisions. ' +
|
|
77
|
+
'Collaborate with SHOGUN for Kubernetes resource IaC integration. ' +
|
|
78
|
+
'Feed CASSANDRA with infrastructure change plans for risk assessment.';
|
|
79
|
+
|
|
80
|
+
export async function execute(task, context, llmProvider) {
|
|
81
|
+
var prompt = 'Task: ' + task.description;
|
|
82
|
+
|
|
83
|
+
// Task dependency results from previous sub-tasks
|
|
84
|
+
if (context.dependencyResults && Object.keys(context.dependencyResults).length > 0) {
|
|
85
|
+
prompt += '\n[DEPENDENCY CONTEXT — Results from prerequisite tasks]\n';
|
|
86
|
+
var keys = Object.keys(context.dependencyResults);
|
|
87
|
+
for (var i = 0; i < keys.length; i++) {
|
|
88
|
+
prompt += '--- Result from ' + keys[i] + ' ---\n' + context.dependencyResults[keys[i]];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Original user request — always useful for maintaining big-picture awareness
|
|
93
|
+
if (context.originalPrompt) {
|
|
94
|
+
prompt += '\n[ORIGINAL REQUEST]\n' + context.originalPrompt;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// v5.0+: Collective intelligence context (structured framing)
|
|
98
|
+
if (context.workspaceSnapshot) {
|
|
99
|
+
prompt += '\n[SHARED WORKSPACE — Live collaborative state from all agents]\n' + context.workspaceSnapshot;
|
|
100
|
+
}
|
|
101
|
+
if (context.episodicMemories) {
|
|
102
|
+
prompt += '\n[EPISODIC MEMORY — Your relevant past experiences on similar tasks]\n' + context.episodicMemories;
|
|
103
|
+
}
|
|
104
|
+
if (context.eventStream) {
|
|
105
|
+
prompt += '\n[COMMUNICATION STREAM — Recent inter-agent signals and events]\n' + context.eventStream;
|
|
106
|
+
}
|
|
107
|
+
if (context.knowledgeGraph) {
|
|
108
|
+
prompt += '\n[KNOWLEDGE GRAPH — Known relationships between agents, capabilities, and domains]\n' + context.knowledgeGraph;
|
|
109
|
+
}
|
|
110
|
+
if (context.latentSpaceInsight) {
|
|
111
|
+
prompt += '\n[LATENT SPACE — Emergent patterns detected across the collective]\n' + context.latentSpaceInsight;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// v7.0: Deliberation cross-reading — other agents' proposals
|
|
115
|
+
if (context.proposalContext) {
|
|
116
|
+
prompt += '\n[DELIBERATION — Cross-Reading Round]\n' + context.proposalContext;
|
|
117
|
+
prompt += '\n\n[DELIBERATION INSTRUCTIONS — ATLAS SYSTEM ARCHITECTURE MODE]\n'
|
|
118
|
+
+ 'You are in a multi-round deliberation. Other agents have shared their proposals above. '
|
|
119
|
+
+ 'Your role is SYSTEM ARCHITECT. You MUST:\n'
|
|
120
|
+
+ '1. Evaluate proposals at the system level — how do they affect overall architecture?\n'
|
|
121
|
+
+ '2. Challenge local optimizations: [ARCHITECTURE-CONCERN: agent_name solution X optimizes component Y but creates coupling with Z]\n'
|
|
122
|
+
+ '3. Assess scalability implications: [SCALE-RISK: proposal X works at current scale but breaks at 10x because Y]\n'
|
|
123
|
+
+ '4. Provide architectural trade-off analysis: [TRADE-OFF: approach A gives X but costs Y; approach B gives Z but costs W]\n'
|
|
124
|
+
+ '5. When proposals conflict architecturally, evaluate long-term maintainability\n'
|
|
125
|
+
+ '6. Do NOT converge on architecturally unsound solutions even if they solve the immediate problem\n';
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// v5.0+: Self-modification — apply learned evolution patterns to system prompt
|
|
129
|
+
var systemPrompt = SYSTEM_PROMPT;
|
|
130
|
+
if (context.promptEvolution) {
|
|
131
|
+
systemPrompt += '\n[EVOLVED CAPABILITIES — Patterns learned from past performance]\n' + context.promptEvolution;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// v8.0: Geth Consensus participation clause
|
|
135
|
+
systemPrompt += '\n\n[GETH CONSENSUS PROTOCOL]\n'
|
|
136
|
+
+ 'You are the system architect in a multi-agent collective. '
|
|
137
|
+
+ 'Your value is holistic system thinking — component interactions, scaling boundaries, coupling risks. '
|
|
138
|
+
+ 'Challenge solutions that solve local problems at systemic cost. '
|
|
139
|
+
+ 'Architectural integrity is non-negotiable even when expedient shortcuts exist.';
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
// v10.0: Neural Controller — Structured Output for confidence tracking
|
|
143
|
+
systemPrompt += '\n\n'
|
|
144
|
+
+ '[STRUCTURED OUTPUT FORMAT]\n'
|
|
145
|
+
+ 'You MUST wrap your response in JSON format inside a markdown code block:\n'
|
|
146
|
+
+ '\`\`\`json\n'
|
|
147
|
+
+ '{\n'
|
|
148
|
+
+ ' "answer": "<your full answer here>",\n'
|
|
149
|
+
+ ' "confidence": <0.0 to 1.0>,\n'
|
|
150
|
+
+ ' "reasoning_summary": "<1-2 sentence summary of your reasoning>",\n'
|
|
151
|
+
+ ' "risk_flags": ["<optional flags: speculative, outdated_knowledge, incomplete_context, conflicting_evidence, domain_mismatch>"]\n'
|
|
152
|
+
+ '}\n'
|
|
153
|
+
+ '\`\`\`\n'
|
|
154
|
+
+ 'Confidence scale: 0.9-1.0 near certain, 0.7-0.89 high, 0.5-0.69 moderate, 0.3-0.49 low, 0.0-0.29 very low.';
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
return await llmProvider.chat(systemPrompt, prompt, { maxTokens: 8192, agentTag: AGENT_CARD.name });
|
|
158
|
+
}
|
|
159
|
+
|