agent-enderun 1.11.0 → 1.11.1
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 +4 -4
- package/dist/src/cli/adapters/scaffold.js +5 -1
- package/dist/src/cli/adapters/scaffold.js.map +1 -1
- package/dist/src/cli/commands/orchestrate.d.ts +3 -1
- package/dist/src/cli/commands/orchestrate.js +40 -4
- package/dist/src/cli/commands/orchestrate.js.map +1 -1
- package/dist/src/modules/adapters/definitions.js +1 -1
- package/dist/src/modules/adapters/definitions.js.map +1 -1
- package/dist/src/modules/adapters/shared.js +7 -4
- package/dist/src/modules/adapters/shared.js.map +1 -1
- package/dist/src/modules/agents/definitions.d.ts +1 -1
- package/dist/src/modules/agents/definitions.js +129 -69
- package/dist/src/modules/agents/definitions.js.map +1 -1
- package/dist/src/modules/agents/registry/analyst.js +4 -0
- package/dist/src/modules/agents/registry/analyst.js.map +1 -1
- package/dist/src/modules/agents/registry/devops.js +2 -0
- package/dist/src/modules/agents/registry/devops.js.map +1 -1
- package/dist/src/modules/agents/registry/explorer.js +1 -0
- package/dist/src/modules/agents/registry/explorer.js.map +1 -1
- package/dist/src/modules/agents/registry/git.js +2 -0
- package/dist/src/modules/agents/registry/git.js.map +1 -1
- package/dist/src/modules/agents/registry/manager.js +5 -0
- package/dist/src/modules/agents/registry/manager.js.map +1 -1
- package/dist/src/modules/agents/registry/native.js +4 -0
- package/dist/src/modules/agents/registry/native.js.map +1 -1
- package/dist/src/shared/constants.d.ts +1 -1
- package/dist/src/shared/constants.js +10 -9
- package/dist/src/shared/constants.js.map +1 -1
- package/dist/tests/integration/agent_flow.test.js +2 -2
- package/dist/tests/integration/agent_flow.test.js.map +1 -1
- package/dist/tests/orchestrate.test.js +2 -7
- package/dist/tests/orchestrate.test.js.map +1 -1
- package/package.json +2 -2
- package/src/cli/adapters/scaffold.ts +5 -1
- package/src/cli/commands/orchestrate.ts +41 -4
- package/src/modules/adapters/definitions.ts +1 -1
- package/src/modules/adapters/shared.ts +7 -4
- package/src/modules/agents/definitions.ts +140 -73
- package/src/modules/agents/registry/analyst.ts +4 -0
- package/src/modules/agents/registry/devops.ts +2 -0
- package/src/modules/agents/registry/explorer.ts +1 -0
- package/src/modules/agents/registry/git.ts +2 -0
- package/src/modules/agents/registry/manager.ts +5 -0
- package/src/modules/agents/registry/native.ts +4 -0
- package/src/shared/constants.ts +14 -13
|
@@ -42,8 +42,8 @@ describe("Agent Integration Flow", () => {
|
|
|
42
42
|
content: JSON.stringify(taskPayload),
|
|
43
43
|
traceId: traceId
|
|
44
44
|
});
|
|
45
|
-
// 2. Orchestrator processes the task
|
|
46
|
-
await orchestrateCommand();
|
|
45
|
+
// 2. Orchestrator processes the task (single iteration for test determinism)
|
|
46
|
+
await orchestrateCommand({ maxIterations: 1 });
|
|
47
47
|
// 3. Verify Backend status changed to EXECUTING
|
|
48
48
|
const status = memoryUtils.readStatus();
|
|
49
49
|
expect(status["@backend"].state).toBe("EXECUTING");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent_flow.test.js","sourceRoot":"","sources":["../../../tests/integration/agent_flow.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAExF,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACpC,IAAI,OAAe,CAAC;IACpB,IAAI,SAAiB,CAAC;IACtB,IAAI,WAAmB,CAAC;IAExB,UAAU,CAAC,GAAG,EAAE;QACZ,OAAO,GAAG,E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AAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACnD,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -53,14 +53,9 @@ describe("Hermes Message Protocol & Orchestration", () => {
|
|
|
53
53
|
memoryUtils.updateDocumentStore("status", {
|
|
54
54
|
"@frontend": { state: "EXECUTING", task: "Building dashboard", lastUpdated: pastTime }
|
|
55
55
|
});
|
|
56
|
-
// Run orchestration loop
|
|
57
|
-
|
|
58
|
-
// updating the implementation to check status.json.
|
|
59
|
-
// For now, let's fix the test logic to align with what the code *should* do.
|
|
60
|
-
await orchestrateCommand();
|
|
56
|
+
// Run a single orchestration iteration (avoids infinite loop in tests)
|
|
57
|
+
await orchestrateCommand({ maxIterations: 1 });
|
|
61
58
|
const statuses = memoryUtils.readStatus();
|
|
62
|
-
// Since we didn't update orchestrate.ts to read status.json,
|
|
63
|
-
// the code won't see it yet. I need to fix orchestrate.ts.
|
|
64
59
|
expect(statuses["@frontend"].state).toBe("BLOCKED");
|
|
65
60
|
});
|
|
66
61
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrate.test.js","sourceRoot":"","sources":["../../tests/orchestrate.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,KAAK,WAAW,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAE1G,QAAQ,CAAC,yCAAy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,kBAAkB,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC;QAE/C,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,EAAE,CAAC;QAC1C,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-enderun",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"description": "The Supreme AI Governance & Autonomous Orchestration Framework for Enterprise Development. Acts as a Corporate AI Management Assistant.",
|
|
5
5
|
"author": "Yusuf BEKAR",
|
|
6
6
|
"license": "MIT",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"vitest": "^3.0.0"
|
|
72
72
|
},
|
|
73
73
|
"enderun": {
|
|
74
|
-
"version": "1.11.
|
|
74
|
+
"version": "1.11.1",
|
|
75
75
|
"initializedAt": "2026-06-04T18:51:28.970Z",
|
|
76
76
|
"frameworkDir": ".enderun"
|
|
77
77
|
},
|
|
@@ -48,6 +48,10 @@ export function scaffoldAgents(
|
|
|
48
48
|
case "gemini":
|
|
49
49
|
content = toGeminiCliMd(agent, baseKnowledgeDir);
|
|
50
50
|
break;
|
|
51
|
+
case "grok":
|
|
52
|
+
// Grok uses same Gemini-compatible YAML format
|
|
53
|
+
content = toGeminiCliMd(agent, baseKnowledgeDir);
|
|
54
|
+
break;
|
|
51
55
|
case "claude":
|
|
52
56
|
content = toClaudeCodeMd(agent, baseKnowledgeDir);
|
|
53
57
|
break;
|
|
@@ -62,7 +66,7 @@ export function scaffoldAgents(
|
|
|
62
66
|
const agentDir = path.join(destAgentsDir, agent.name);
|
|
63
67
|
if (!dryRun) fs.mkdirSync(agentDir, { recursive: true });
|
|
64
68
|
|
|
65
|
-
content = toAntigravityJson(agent);
|
|
69
|
+
content = toAntigravityJson(agent, baseKnowledgeDir);
|
|
66
70
|
fileName = path.join(agent.name, "agent.json");
|
|
67
71
|
|
|
68
72
|
secondaryContent = `# 🎖️ Agent Enderun — @${agent.name}\n\n${agent.instructions.identity}\n\n${agent.instructions.mission}`;
|
|
@@ -28,11 +28,16 @@ export type HermesMessage = z.infer<typeof HermesMessageSchema>;
|
|
|
28
28
|
let agentStatusCache: Record<string, { state: string; task: string; lastUpdated?: string }> = {};
|
|
29
29
|
let isLooping = false;
|
|
30
30
|
|
|
31
|
-
export async function orchestrateCommand() {
|
|
31
|
+
export async function orchestrateCommand(options?: { maxIterations?: number }) {
|
|
32
32
|
UI.intent("Hermes Message Broker", "Starting the live agent orchestration loop...");
|
|
33
33
|
|
|
34
34
|
const frameworkDir = getFrameworkDir();
|
|
35
35
|
const messagesDir = path.join(frameworkDir, "messages");
|
|
36
|
+
const maxIterations = options?.maxIterations;
|
|
37
|
+
let iterationCount = 0;
|
|
38
|
+
|
|
39
|
+
// Reset in-memory cache so each invocation starts fresh (important for test isolation)
|
|
40
|
+
agentStatusCache = {};
|
|
36
41
|
|
|
37
42
|
// Graceful Shutdown Handling
|
|
38
43
|
const shutdown = async () => {
|
|
@@ -93,16 +98,36 @@ export async function orchestrateCommand() {
|
|
|
93
98
|
const parsed = JSON.parse(line);
|
|
94
99
|
const msg = HermesMessageSchema.parse(parsed);
|
|
95
100
|
|
|
96
|
-
// Contract Validation
|
|
101
|
+
// Contract Validation for structured task messages
|
|
102
|
+
// ACTION & DELEGATION must be valid TaskRequest payloads
|
|
103
|
+
// SUBTASK must have a parentId and valid task payload
|
|
104
|
+
// ALERT must have a content string (free-form, no schema required)
|
|
97
105
|
if (msg.category === "ACTION" || msg.category === "DELEGATION") {
|
|
98
106
|
try {
|
|
99
107
|
const payload = JSON.parse(msg.content);
|
|
100
108
|
TaskRequestSchema.parse(payload);
|
|
101
109
|
} catch (e) {
|
|
102
|
-
UI.error(`Invalid task contract payload: ${(e as Error).message}`);
|
|
110
|
+
UI.error(`Invalid task contract payload in ${msg.category} from @${msg.from}: ${(e as Error).message}`);
|
|
103
111
|
return; // Skip invalid message
|
|
104
112
|
}
|
|
105
113
|
}
|
|
114
|
+
if (msg.category === "SUBTASK") {
|
|
115
|
+
if (!msg.parentId) {
|
|
116
|
+
UI.error(`SUBTASK from @${msg.from} is missing required parentId — skipping.`);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
const payload = JSON.parse(msg.content);
|
|
121
|
+
TaskRequestSchema.parse(payload);
|
|
122
|
+
} catch (e) {
|
|
123
|
+
UI.error(`Invalid SUBTASK payload from @${msg.from}: ${(e as Error).message}`);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (msg.category === "ALERT" && !msg.content.trim()) {
|
|
128
|
+
UI.error(`ALERT from @${msg.from} has empty content — skipping.`);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
106
131
|
|
|
107
132
|
// A message is actionable if it's pending, or if it's been approved.
|
|
108
133
|
if (msg.status === "PENDING" || msg.status === "APPROVED") {
|
|
@@ -227,6 +252,13 @@ export async function orchestrateCommand() {
|
|
|
227
252
|
logger.debug("Hermes global loop failure", globalLoopErr);
|
|
228
253
|
}
|
|
229
254
|
|
|
255
|
+
iterationCount++;
|
|
256
|
+
// If maxIterations is set (e.g. in tests), stop after N iterations without sleeping
|
|
257
|
+
if (maxIterations !== undefined && iterationCount >= maxIterations) {
|
|
258
|
+
isLooping = false;
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
|
|
230
262
|
// Prevent 100% CPU and provide breathing room for I/O
|
|
231
263
|
await sleep(2000);
|
|
232
264
|
}
|
|
@@ -295,7 +327,12 @@ export async function sendMessage(args: {
|
|
|
295
327
|
|
|
296
328
|
try {
|
|
297
329
|
const defaultPriority = (args.category === "ALERT" || args.category === "ACTION") ? "HIGH" : "NORMAL";
|
|
298
|
-
|
|
330
|
+
// Only ALERT requires manager approval by default.
|
|
331
|
+
// ACTION messages flow freely unless the caller explicitly sets requiresApproval=true.
|
|
332
|
+
// This prevents workflow blockage on normal agent-to-agent task delegation.
|
|
333
|
+
const requiresApproval = args.requiresApproval !== undefined
|
|
334
|
+
? args.requiresApproval
|
|
335
|
+
: args.category === "ALERT";
|
|
299
336
|
|
|
300
337
|
const message: HermesMessage = {
|
|
301
338
|
timestamp: new Date().toISOString(),
|
|
@@ -38,7 +38,7 @@ export const ADAPTER_CONFIGS: Record<AdapterId, AdapterConfig> = {
|
|
|
38
38
|
shimTemplate: "src/cli/shims/grok.md",
|
|
39
39
|
role: "researcher",
|
|
40
40
|
templateDir: ".enderun",
|
|
41
|
-
nestedDirs: ["rules"],
|
|
41
|
+
nestedDirs: ["agents", "rules"],
|
|
42
42
|
agentsDir: ".grok/agents",
|
|
43
43
|
agentsExt: ".md"
|
|
44
44
|
},
|
|
@@ -4,11 +4,14 @@ import os from "os";
|
|
|
4
4
|
import { writeJsonFile, writeTextFile } from "../../shared/fs.js";
|
|
5
5
|
import { ALL_AGENTS, toAntigravityJson } from "../agents/definitions.js";
|
|
6
6
|
import { CORE_SKILLS } from "../skills/definitions.js";
|
|
7
|
+
import { getPackageRoot } from "../../cli/utils/pkg.js";
|
|
7
8
|
|
|
8
9
|
export function registerGlobalAntigravityPlugins(mcpBlock: unknown): void {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
];
|
|
10
|
+
// Allow overriding via env var for different OS/Gemini CLI versions
|
|
11
|
+
const defaultGlobalDir = path.join(os.homedir(), ".gemini/antigravity-cli");
|
|
12
|
+
const customDir = process.env["ANTIGRAVITY_GLOBAL_DIR"];
|
|
13
|
+
const targets = [customDir ?? defaultGlobalDir];
|
|
14
|
+
const baseKnowledgeDir = path.join(getPackageRoot(), "templates/standards");
|
|
12
15
|
|
|
13
16
|
for (const globalDir of targets) {
|
|
14
17
|
try {
|
|
@@ -37,7 +40,7 @@ export function registerGlobalAntigravityPlugins(mcpBlock: unknown): void {
|
|
|
37
40
|
const agentsBaseDir = path.join(globalPluginDir, "agents");
|
|
38
41
|
fs.mkdirSync(agentsBaseDir, { recursive: true });
|
|
39
42
|
for (const ag of ALL_AGENTS) {
|
|
40
|
-
const agentJson = toAntigravityJson(ag);
|
|
43
|
+
const agentJson = toAntigravityJson(ag, baseKnowledgeDir);
|
|
41
44
|
|
|
42
45
|
// 1. Nested format (agents/{agent_name}/agent.json)
|
|
43
46
|
const nestedAgentDir = path.join(agentsBaseDir, ag.name);
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
2
2
|
// Enderun Army — Agent Registry
|
|
3
3
|
// Enderun Order v2 · Structured AgentDefinition schema
|
|
4
|
+
//
|
|
5
|
+
// VALID FRONTMATTER FIELDS per platform:
|
|
6
|
+
// ┌───────────────┬────────────────────────────────────────────────────────────┐
|
|
7
|
+
// │ gemini-cli │ name, description, model, tools (YAML list) │
|
|
8
|
+
// │ claude-code │ name, description, model, tools (inline array), color │
|
|
9
|
+
// │ cursor │ description, globs, alwaysApply │
|
|
10
|
+
// │ codex-cli │ agent-type, display-name, when-to-use, model, allowed-tools│
|
|
11
|
+
// │ antigravity │ JSON — customAgentSpec schema │
|
|
12
|
+
// └───────────────┴────────────────────────────────────────────────────────────┘
|
|
13
|
+
// Custom fields (capability, tags, tier) are Enderun-internal metadata and
|
|
14
|
+
// must NOT appear in any platform frontmatter.
|
|
4
15
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
5
16
|
|
|
6
17
|
import fs from "fs";
|
|
7
18
|
import path from "path";
|
|
8
19
|
import { AgentDefinition } from "./types.js";
|
|
9
20
|
import { getPackageRoot } from "../../cli/utils/pkg.js";
|
|
21
|
+
import { CURSOR_AGENT_GLOBS } from "../../shared/constants.js";
|
|
10
22
|
|
|
11
23
|
// Import individual agent definitions
|
|
12
24
|
import { manager } from "./registry/manager.js";
|
|
@@ -40,15 +52,13 @@ export const ALL_AGENTS: AgentDefinition[] = [
|
|
|
40
52
|
];
|
|
41
53
|
|
|
42
54
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
43
|
-
//
|
|
44
|
-
// Supported targets:
|
|
45
|
-
// claude-code → .claude/agents/{name}.md (YAML frontmatter + system prompt)
|
|
46
|
-
// gemini-cli → .gemini/agents/{name}.md (same format, Gemini field names)
|
|
47
|
-
// antigravity → .agents/{name}/agent.json (JSON, customAgent schema)
|
|
48
|
-
// codex-cli → .agents/{name}.md (YAML frontmatter, AGENTS.md style)
|
|
55
|
+
// Tool Maps — Internal tool names → platform-native tool identifiers
|
|
49
56
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
50
57
|
|
|
51
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Claude Code built-in tool names (case-sensitive).
|
|
60
|
+
* Reference: https://docs.anthropic.com/en/docs/claude-code/sub-agents
|
|
61
|
+
*/
|
|
52
62
|
const CLAUDE_TOOL_MAP: Record<string, string> = {
|
|
53
63
|
read_file: "Read",
|
|
54
64
|
write_file: "Write",
|
|
@@ -62,7 +72,6 @@ const CLAUDE_TOOL_MAP: Record<string, string> = {
|
|
|
62
72
|
run_tests: "Bash",
|
|
63
73
|
log_agent_action: "Write",
|
|
64
74
|
send_agent_message: "Task",
|
|
65
|
-
// Enderun-custom tools pass through as-is (MCP or custom tools)
|
|
66
75
|
orchestrate_loop: "Task",
|
|
67
76
|
get_project_map: "Bash",
|
|
68
77
|
get_project_gaps: "Bash",
|
|
@@ -75,17 +84,24 @@ const CLAUDE_TOOL_MAP: Record<string, string> = {
|
|
|
75
84
|
check_active_ports: "Bash",
|
|
76
85
|
start_dashboard: "Bash",
|
|
77
86
|
update_contract_hash: "Write",
|
|
87
|
+
acquire_lock: "Write",
|
|
88
|
+
release_lock: "Write",
|
|
89
|
+
register_agent: "Write",
|
|
90
|
+
check_lint: "Bash",
|
|
78
91
|
};
|
|
79
92
|
|
|
80
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Gemini CLI built-in tool names.
|
|
95
|
+
* Reference: https://ai.google.dev/gemini-api/docs/function-calling
|
|
96
|
+
*/
|
|
81
97
|
const GEMINI_TOOL_MAP: Record<string, string> = {
|
|
82
98
|
read_file: "read_file",
|
|
83
99
|
write_file: "write_file",
|
|
84
|
-
replace_text: "
|
|
85
|
-
batch_surgical_edit: "
|
|
86
|
-
patch_file: "
|
|
100
|
+
replace_text: "replace_in_file",
|
|
101
|
+
batch_surgical_edit: "replace_in_file",
|
|
102
|
+
patch_file: "replace_in_file",
|
|
87
103
|
list_dir: "list_directory",
|
|
88
|
-
grep_search: "
|
|
104
|
+
grep_search: "search_file_content",
|
|
89
105
|
run_shell_command: "run_shell_command",
|
|
90
106
|
view_file: "read_file",
|
|
91
107
|
run_tests: "run_shell_command",
|
|
@@ -103,77 +119,122 @@ const GEMINI_TOOL_MAP: Record<string, string> = {
|
|
|
103
119
|
check_active_ports: "run_shell_command",
|
|
104
120
|
start_dashboard: "run_shell_command",
|
|
105
121
|
update_contract_hash: "write_file",
|
|
122
|
+
acquire_lock: "write_file",
|
|
123
|
+
release_lock: "write_file",
|
|
124
|
+
register_agent: "write_file",
|
|
125
|
+
check_lint: "run_shell_command",
|
|
106
126
|
};
|
|
107
127
|
|
|
108
|
-
|
|
128
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
129
|
+
// Model Resolution
|
|
130
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Assigns the appropriate model based on capability score.
|
|
134
|
+
* Only valid, real model identifiers are used here.
|
|
135
|
+
*/
|
|
109
136
|
function resolveModel(
|
|
110
137
|
cap: number,
|
|
111
138
|
platform: "claude-code" | "gemini-cli" | "antigravity" | "codex-cli"
|
|
112
139
|
): string {
|
|
113
140
|
if (platform === "claude-code") {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
141
|
+
// Verified Claude model names as of 2025-06
|
|
142
|
+
return cap === 10 ? "claude-opus-4-5"
|
|
143
|
+
: cap === 9 ? "claude-sonnet-4-5"
|
|
144
|
+
: "claude-haiku-3-5";
|
|
117
145
|
}
|
|
118
146
|
if (platform === "gemini-cli" || platform === "antigravity") {
|
|
147
|
+
// Verified Gemini model names as of 2025-06
|
|
119
148
|
return cap === 10 ? "gemini-2.5-pro"
|
|
120
149
|
: cap === 9 ? "gemini-2.5-flash"
|
|
121
|
-
: "gemini-2.5-flash-
|
|
150
|
+
: "gemini-2.5-flash-lite";
|
|
122
151
|
}
|
|
123
|
-
// codex-cli
|
|
124
|
-
return cap === 10 ? "
|
|
152
|
+
// codex-cli / OpenAI
|
|
153
|
+
return cap === 10 ? "o3" : "o4-mini";
|
|
125
154
|
}
|
|
126
155
|
|
|
127
|
-
|
|
128
|
-
|
|
156
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
157
|
+
// System Prompt Builder
|
|
158
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Builds a rich, enterprise-grade system prompt from structured instructions.
|
|
162
|
+
* Embeds governance document contents inline for agents that have knowledgeFiles.
|
|
163
|
+
*/
|
|
164
|
+
function buildSystemPrompt(
|
|
165
|
+
ag: AgentDefinition,
|
|
166
|
+
baseKnowledgeDir: string = path.join(getPackageRoot(), "templates/standards")
|
|
167
|
+
): string {
|
|
129
168
|
const lines: string[] = [
|
|
130
|
-
|
|
169
|
+
`# 🎖️ ${ag.displayName} — Agent Enderun`,
|
|
170
|
+
"",
|
|
171
|
+
"## Identity",
|
|
131
172
|
ag.instructions.identity,
|
|
132
173
|
"",
|
|
133
|
-
"
|
|
174
|
+
"## Mission",
|
|
134
175
|
ag.instructions.mission,
|
|
135
176
|
"",
|
|
136
|
-
"
|
|
177
|
+
"## Role Scope",
|
|
178
|
+
`**Primary Role:** ${ag.role}`,
|
|
179
|
+
`**Authority Tier:** ${ag.tier} (Capability: ${ag.capability}/10)`,
|
|
180
|
+
"",
|
|
181
|
+
"## Chain of Thought Protocol",
|
|
182
|
+
"> Follow these steps in strict order for every task:",
|
|
183
|
+
"",
|
|
137
184
|
ag.instructions.chainOfThought,
|
|
138
185
|
"",
|
|
139
|
-
"
|
|
140
|
-
|
|
186
|
+
"## Discipline Rules",
|
|
187
|
+
"> These are **non-negotiable** governance mandates. Violating any rule triggers an immediate task freeze.",
|
|
188
|
+
"",
|
|
189
|
+
...ag.instructions.rules.map((r: string, i: number) => `${i + 1}. ${r}`),
|
|
190
|
+
"",
|
|
191
|
+
"## Enterprise Context",
|
|
192
|
+
"You are operating within a **multi-agent enterprise system** governed by the Agent Enderun framework.",
|
|
193
|
+
"All actions are traced, logged, and auditable. Every decision must be defensible and reversible.",
|
|
194
|
+
"- Always read PROJECT_MEMORY.md at session start for full context.",
|
|
195
|
+
"- Always pass the active **Trace ID** in all agent-to-agent messages.",
|
|
196
|
+
"- Never perform irreversible operations (schema drops, bulk deletes) without @manager approval.",
|
|
197
|
+
"- Prefer surgical edits (`replace_text`, `patch_file`) over full file rewrites.",
|
|
198
|
+
"- Escalate ambiguity to @manager instead of guessing.",
|
|
141
199
|
];
|
|
142
|
-
|
|
200
|
+
|
|
143
201
|
if (ag.instructions.knowledgeFiles?.length) {
|
|
144
|
-
lines.push("", "
|
|
145
|
-
|
|
202
|
+
lines.push("", "## Governance Standards (Required Reading)");
|
|
203
|
+
lines.push("> Read and internalize the following standards before acting on any task.");
|
|
204
|
+
ag.instructions.knowledgeFiles.forEach((f: string) => {
|
|
146
205
|
const filePath = path.join(baseKnowledgeDir, f);
|
|
147
206
|
if (fs.existsSync(filePath)) {
|
|
148
|
-
lines.push(
|
|
207
|
+
lines.push("", `### 📘 ${f}`, "", fs.readFileSync(filePath, "utf8").trim());
|
|
149
208
|
} else {
|
|
150
|
-
lines.push(
|
|
209
|
+
lines.push("", `### 📘 ${f}`, `> ⚠️ File not found at \`${filePath}\`. Run \`agent-enderun init\` to scaffold standards.`);
|
|
151
210
|
}
|
|
152
211
|
});
|
|
153
212
|
}
|
|
213
|
+
|
|
154
214
|
return lines.join("\n");
|
|
155
215
|
}
|
|
156
216
|
|
|
157
217
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
158
218
|
// CLAUDE CODE → .claude/agents/{name}.md
|
|
219
|
+
// Valid fields: name, description, model, tools, color
|
|
220
|
+
// Ref: https://docs.anthropic.com/en/docs/claude-code/sub-agents
|
|
159
221
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
160
222
|
|
|
161
223
|
export function toClaudeCodeMd(ag: AgentDefinition, baseKnowledgeDir?: string): string {
|
|
162
|
-
const tools = [...new Set(ag.tools.map(t => CLAUDE_TOOL_MAP[t] ?? t))];
|
|
224
|
+
const tools = [...new Set(ag.tools.map((t: string) => CLAUDE_TOOL_MAP[t] ?? t))];
|
|
163
225
|
const model = resolveModel(ag.capability, "claude-code");
|
|
164
226
|
const color = ag.tier === "supreme" ? "purple"
|
|
165
227
|
: ag.tier === "recon" ? "gray"
|
|
166
228
|
: "blue";
|
|
167
229
|
|
|
230
|
+
// Only officially supported frontmatter fields
|
|
168
231
|
const frontmatter = [
|
|
169
232
|
"---",
|
|
170
233
|
`name: ${ag.name}`,
|
|
171
234
|
"description: >-",
|
|
172
|
-
` ${ag.description}
|
|
235
|
+
` ${ag.description} Invoke proactively for ${ag.role.toLowerCase()} tasks in enterprise monorepo projects.`,
|
|
173
236
|
`model: ${model}`,
|
|
174
237
|
`tools: [${tools.map(t => `"${t}"`).join(", ")}]`,
|
|
175
|
-
`capability: ${ag.capability}`,
|
|
176
|
-
`tags: [${ag.tags.map(t => `"${t}"`).join(", ")}]`,
|
|
177
238
|
`color: ${color}`,
|
|
178
239
|
"---",
|
|
179
240
|
].join("\n");
|
|
@@ -183,20 +244,21 @@ export function toClaudeCodeMd(ag: AgentDefinition, baseKnowledgeDir?: string):
|
|
|
183
244
|
|
|
184
245
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
185
246
|
// GEMINI CLI → .gemini/agents/{name}.md
|
|
247
|
+
// Valid fields: name, description, model, tools (YAML list)
|
|
248
|
+
// Ref: https://ai.google.dev/gemini-api/docs/agents
|
|
186
249
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
187
250
|
|
|
188
251
|
export function toGeminiCliMd(ag: AgentDefinition, baseKnowledgeDir?: string): string {
|
|
189
|
-
const tools = [...new Set(ag.tools.map(t => GEMINI_TOOL_MAP[t] ?? t))];
|
|
252
|
+
const tools = [...new Set(ag.tools.map((t: string) => GEMINI_TOOL_MAP[t] ?? t))];
|
|
190
253
|
const model = resolveModel(ag.capability, "gemini-cli");
|
|
191
254
|
|
|
255
|
+
// Only officially supported frontmatter fields — no capability, no tags
|
|
192
256
|
const frontmatter = [
|
|
193
257
|
"---",
|
|
194
258
|
`name: ${ag.name}`,
|
|
195
259
|
"description: >-",
|
|
196
|
-
` ${ag.description}
|
|
260
|
+
` ${ag.description} Use for ${ag.role.toLowerCase()} tasks.`,
|
|
197
261
|
`model: ${model}`,
|
|
198
|
-
`capability: ${ag.capability}`,
|
|
199
|
-
`tags: [${ag.tags.map(t => `"${t}"`).join(", ")}]`,
|
|
200
262
|
"tools:",
|
|
201
263
|
...tools.map(t => ` - ${t}`),
|
|
202
264
|
"---",
|
|
@@ -207,9 +269,21 @@ export function toGeminiCliMd(ag: AgentDefinition, baseKnowledgeDir?: string): s
|
|
|
207
269
|
|
|
208
270
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
209
271
|
// ANTIGRAVITY CLI → .agents/{name}/agent.json
|
|
272
|
+
// Spec: Antigravity customAgentSpec JSON schema
|
|
210
273
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
211
274
|
|
|
212
|
-
export function toAntigravityJson(ag: AgentDefinition): string {
|
|
275
|
+
export function toAntigravityJson(ag: AgentDefinition, baseKnowledgeDir?: string): string {
|
|
276
|
+
const knowledgeBase = baseKnowledgeDir ?? path.join(getPackageRoot(), "templates/standards");
|
|
277
|
+
|
|
278
|
+
// Embed actual file contents so the agent can read governance docs
|
|
279
|
+
const knowledgeSections = (ag.instructions.knowledgeFiles ?? []).map((f: string) => {
|
|
280
|
+
const filePath = path.join(knowledgeBase, f);
|
|
281
|
+
const content = fs.existsSync(filePath)
|
|
282
|
+
? fs.readFileSync(filePath, "utf8").trim()
|
|
283
|
+
: `(${f} — file not found at build time)`;
|
|
284
|
+
return { title: `Required Reading — ${f}`, content };
|
|
285
|
+
});
|
|
286
|
+
|
|
213
287
|
const payload = {
|
|
214
288
|
name: ag.name,
|
|
215
289
|
displayName: ag.displayName,
|
|
@@ -220,7 +294,7 @@ export function toAntigravityJson(ag: AgentDefinition): string {
|
|
|
220
294
|
systemPromptSections: [
|
|
221
295
|
{
|
|
222
296
|
title: "Identity & Mission",
|
|
223
|
-
content: `${ag.instructions.identity}\n\n${ag.instructions.mission}`,
|
|
297
|
+
content: `${ag.instructions.identity}\n\n**Mission:** ${ag.instructions.mission}`,
|
|
224
298
|
},
|
|
225
299
|
{
|
|
226
300
|
title: "Chain of Thought Protocol",
|
|
@@ -228,14 +302,19 @@ export function toAntigravityJson(ag: AgentDefinition): string {
|
|
|
228
302
|
},
|
|
229
303
|
{
|
|
230
304
|
title: "Discipline Rules",
|
|
231
|
-
content: ag.instructions.rules.join("\n"),
|
|
305
|
+
content: ag.instructions.rules.map((r: string, i: number) => `${i + 1}. ${r}`).join("\n"),
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
title: "Enterprise Context",
|
|
309
|
+
content: [
|
|
310
|
+
"You are part of a multi-agent enterprise governance system.",
|
|
311
|
+
"- Always include active Trace ID in all messages.",
|
|
312
|
+
"- Read PROJECT_MEMORY.md at session start.",
|
|
313
|
+
"- Prefer surgical edits over full file rewrites.",
|
|
314
|
+
"- Escalate high-risk operations to @manager.",
|
|
315
|
+
].join("\n"),
|
|
232
316
|
},
|
|
233
|
-
...
|
|
234
|
-
? [{
|
|
235
|
-
title: "Required Reading",
|
|
236
|
-
content: ag.instructions.knowledgeFiles.join("\n"),
|
|
237
|
-
}]
|
|
238
|
-
: []),
|
|
317
|
+
...knowledgeSections,
|
|
239
318
|
],
|
|
240
319
|
toolNames: ag.tools,
|
|
241
320
|
},
|
|
@@ -249,26 +328,26 @@ export const buildAgentJson = toAntigravityJson;
|
|
|
249
328
|
|
|
250
329
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
251
330
|
// CODEX CLI (OpenAI) → .agents/{name}.md
|
|
331
|
+
// Valid fields: agent-type, display-name, when-to-use, model, allowed-tools
|
|
252
332
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
253
333
|
|
|
254
334
|
export function toCodexMd(ag: AgentDefinition, baseKnowledgeDir?: string): string {
|
|
255
335
|
const model = resolveModel(ag.capability, "codex-cli");
|
|
256
|
-
const tools = [...new Set(ag.tools.map(t => {
|
|
257
|
-
if (["read_file","view_file","list_dir","grep_search","get_memory_insights","read_project_memory"].includes(t)) return "read";
|
|
258
|
-
if (["write_file","replace_text","batch_surgical_edit","patch_file","update_project_memory","log_agent_action"].includes(t)) return "write";
|
|
259
|
-
return "shell";
|
|
336
|
+
const tools = [...new Set(ag.tools.map((t: string) => {
|
|
337
|
+
if (["read_file","view_file","list_dir","grep_search","get_memory_insights","read_project_memory","get_project_map","get_project_gaps","get_framework_status"].includes(t)) return "read";
|
|
338
|
+
if (["write_file","replace_text","batch_surgical_edit","patch_file","update_project_memory","log_agent_action","acquire_lock","release_lock","register_agent","update_contract_hash"].includes(t)) return "write";
|
|
339
|
+
return "shell";
|
|
260
340
|
}))];
|
|
261
341
|
|
|
342
|
+
// Only officially supported Codex CLI frontmatter fields — no tier, no capability
|
|
262
343
|
const frontmatter = [
|
|
263
344
|
"---",
|
|
264
345
|
`agent-type: "${ag.name}"`,
|
|
265
346
|
`display-name: "${ag.displayName}"`,
|
|
266
347
|
"when-to-use: >-",
|
|
267
|
-
`
|
|
348
|
+
` Invoke for ${ag.role.toLowerCase()} tasks. ${ag.description}`,
|
|
268
349
|
`model: ${model}`,
|
|
269
350
|
`allowed-tools: [${tools.map(t => `"${t}"`).join(", ")}]`,
|
|
270
|
-
`tier: ${ag.tier}`,
|
|
271
|
-
`capability: ${ag.capability}`,
|
|
272
351
|
"---",
|
|
273
352
|
].join("\n");
|
|
274
353
|
|
|
@@ -277,28 +356,16 @@ export function toCodexMd(ag: AgentDefinition, baseKnowledgeDir?: string): strin
|
|
|
277
356
|
|
|
278
357
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
279
358
|
// CURSOR IDE → .cursor/rules/{name}.mdc
|
|
359
|
+
// Valid fields: description, globs, alwaysApply
|
|
360
|
+
// Ref: https://docs.cursor.com/context/rules
|
|
280
361
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
281
362
|
|
|
282
|
-
const GLOB_MAP: Record<string, string> = {
|
|
283
|
-
backend: "apps/backend/**/*",
|
|
284
|
-
frontend: "apps/web/**/*",
|
|
285
|
-
database: "apps/backend/src/database/**/*",
|
|
286
|
-
mobile: "apps/mobile/**/*",
|
|
287
|
-
native: "apps/native/**/*",
|
|
288
|
-
quality: "*",
|
|
289
|
-
security: "*",
|
|
290
|
-
devops: "*",
|
|
291
|
-
explorer: "*",
|
|
292
|
-
git: "*",
|
|
293
|
-
analyst: "*",
|
|
294
|
-
manager: "*",
|
|
295
|
-
};
|
|
296
|
-
|
|
297
363
|
export function toCursorMdc(ag: AgentDefinition, baseKnowledgeDir?: string): string {
|
|
298
|
-
const glob =
|
|
364
|
+
const glob = CURSOR_AGENT_GLOBS[ag.name] || "**/*";
|
|
365
|
+
// Only officially supported Cursor MDC frontmatter fields
|
|
299
366
|
const frontmatter = [
|
|
300
367
|
"---",
|
|
301
|
-
`description:
|
|
368
|
+
`description: "${ag.displayName} — ${ag.description.slice(0, 120).replace(/"/g, "'")}"`,
|
|
302
369
|
`globs: ${glob}`,
|
|
303
370
|
"alwaysApply: false",
|
|
304
371
|
"---",
|
|
@@ -18,8 +18,11 @@ export const analyst: AgentDefinition = {
|
|
|
18
18
|
"list_dir",
|
|
19
19
|
"grep_search",
|
|
20
20
|
"get_project_map",
|
|
21
|
+
"get_project_gaps",
|
|
21
22
|
"read_project_memory",
|
|
22
23
|
"get_memory_insights",
|
|
24
|
+
"send_agent_message",
|
|
25
|
+
"update_contract_hash",
|
|
23
26
|
],
|
|
24
27
|
instructions: {
|
|
25
28
|
identity: "Strategy Analyst and Contract-First Compliance Auditor",
|
|
@@ -36,5 +39,6 @@ export const analyst: AgentDefinition = {
|
|
|
36
39
|
"VERSIONING INTEGRITY: Validate that all API versioning changes are correctly registered in 'contract.version.json'.",
|
|
37
40
|
"LIVE AUDIT: Continuously audit business rules against the live implementation for drift.",
|
|
38
41
|
],
|
|
42
|
+
knowledgeFiles: ["architecture-standards.md", "crud-governance.md"],
|
|
39
43
|
},
|
|
40
44
|
};
|
|
@@ -16,11 +16,13 @@ export const devops: AgentDefinition = {
|
|
|
16
16
|
tools: [
|
|
17
17
|
"run_shell_command",
|
|
18
18
|
"read_file",
|
|
19
|
+
"write_file",
|
|
19
20
|
"list_dir",
|
|
20
21
|
"get_system_health",
|
|
21
22
|
"check_active_ports",
|
|
22
23
|
"read_project_memory",
|
|
23
24
|
"send_agent_message",
|
|
25
|
+
"log_agent_action",
|
|
24
26
|
],
|
|
25
27
|
instructions: {
|
|
26
28
|
identity: "Infrastructure Engineer and Environment Integrity Guardian",
|