agent-enderun 1.11.0 → 1.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -6
- package/bin/validate-agent-army.js +146 -0
- package/dist/src/cli/adapters/paths.js +2 -1
- package/dist/src/cli/adapters/paths.js.map +1 -1
- package/dist/src/cli/adapters/scaffold.js +5 -1
- package/dist/src/cli/adapters/scaffold.js.map +1 -1
- package/dist/src/cli/adapters/utils.js +2 -3
- package/dist/src/cli/adapters/utils.js.map +1 -1
- package/dist/src/cli/commands/init/scaffold-core.js +8 -2
- package/dist/src/cli/commands/init/scaffold-core.js.map +1 -1
- package/dist/src/cli/commands/init/scaffold-standards.js +3 -0
- package/dist/src/cli/commands/init/scaffold-standards.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/cli/commands/plan.js +2 -1
- package/dist/src/cli/commands/plan.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 +29 -10
- 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 +153 -72
- 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/adapters/paths.test.js +3 -3
- package/dist/tests/adapters/paths.test.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/paths.ts +2 -1
- package/src/cli/adapters/scaffold.ts +5 -1
- package/src/cli/adapters/utils.ts +2 -2
- package/src/cli/commands/init/scaffold-core.ts +8 -2
- package/src/cli/commands/init/scaffold-standards.ts +3 -0
- package/src/cli/commands/orchestrate.ts +41 -4
- package/src/cli/commands/plan.ts +2 -1
- package/src/modules/adapters/definitions.ts +1 -1
- package/src/modules/adapters/shared.ts +33 -10
- package/src/modules/agents/definitions.ts +164 -75
- 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
- package/templates/standards/governance-standards.md +121 -0
|
@@ -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,28 @@ 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 (canonical names validated by Gemini CLI agent schema).
|
|
95
|
+
* Reference: https://github.com/google-gemini/gemini-cli
|
|
96
|
+
*
|
|
97
|
+
* Valid Gemini CLI tool names:
|
|
98
|
+
* read_file, write_file, replace, grep_search, glob,
|
|
99
|
+
* list_directory, run_shell_command
|
|
100
|
+
*/
|
|
81
101
|
const GEMINI_TOOL_MAP: Record<string, string> = {
|
|
82
102
|
read_file: "read_file",
|
|
83
103
|
write_file: "write_file",
|
|
84
|
-
replace_text: "replace",
|
|
85
|
-
batch_surgical_edit: "replace",
|
|
86
|
-
patch_file: "replace",
|
|
104
|
+
replace_text: "replace", // ✅ NOT replace_in_file
|
|
105
|
+
batch_surgical_edit: "replace", // ✅ NOT replace_in_file
|
|
106
|
+
patch_file: "replace", // ✅ NOT replace_in_file
|
|
87
107
|
list_dir: "list_directory",
|
|
88
|
-
grep_search: "grep_search",
|
|
108
|
+
grep_search: "grep_search", // ✅ NOT search_file_content
|
|
89
109
|
run_shell_command: "run_shell_command",
|
|
90
110
|
view_file: "read_file",
|
|
91
111
|
run_tests: "run_shell_command",
|
|
@@ -103,77 +123,135 @@ const GEMINI_TOOL_MAP: Record<string, string> = {
|
|
|
103
123
|
check_active_ports: "run_shell_command",
|
|
104
124
|
start_dashboard: "run_shell_command",
|
|
105
125
|
update_contract_hash: "write_file",
|
|
126
|
+
acquire_lock: "write_file",
|
|
127
|
+
release_lock: "write_file",
|
|
128
|
+
register_agent: "write_file",
|
|
129
|
+
check_lint: "run_shell_command",
|
|
106
130
|
};
|
|
107
131
|
|
|
108
|
-
|
|
132
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
133
|
+
// Model Resolution
|
|
134
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Assigns the appropriate model based on capability score.
|
|
138
|
+
* Only valid, real model identifiers are used here.
|
|
139
|
+
*/
|
|
109
140
|
function resolveModel(
|
|
110
141
|
cap: number,
|
|
111
142
|
platform: "claude-code" | "gemini-cli" | "antigravity" | "codex-cli"
|
|
112
143
|
): string {
|
|
113
144
|
if (platform === "claude-code") {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
145
|
+
// Verified Claude model names as of 2025-06
|
|
146
|
+
return cap === 10 ? "claude-opus-4-5"
|
|
147
|
+
: cap === 9 ? "claude-sonnet-4-5"
|
|
148
|
+
: "claude-haiku-3-5";
|
|
117
149
|
}
|
|
118
150
|
if (platform === "gemini-cli" || platform === "antigravity") {
|
|
151
|
+
// Verified Gemini model names as of 2025-06
|
|
119
152
|
return cap === 10 ? "gemini-2.5-pro"
|
|
120
153
|
: cap === 9 ? "gemini-2.5-flash"
|
|
121
|
-
: "gemini-2.5-flash-
|
|
154
|
+
: "gemini-2.5-flash-lite";
|
|
122
155
|
}
|
|
123
|
-
// codex-cli
|
|
124
|
-
return cap === 10 ? "
|
|
156
|
+
// codex-cli / OpenAI
|
|
157
|
+
return cap === 10 ? "o3" : "o4-mini";
|
|
125
158
|
}
|
|
126
159
|
|
|
127
|
-
|
|
128
|
-
|
|
160
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
161
|
+
// System Prompt Builder
|
|
162
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Builds a rich, enterprise-grade system prompt from structured instructions.
|
|
166
|
+
* Embeds governance document contents inline for agents that have knowledgeFiles.
|
|
167
|
+
*
|
|
168
|
+
* @param stripMetaComments - When true, skips the HTML meta-comment header block
|
|
169
|
+
* (name/capability/tags). Set to true for Gemini CLI and Grok, whose strict
|
|
170
|
+
* frontmatter validators may misinterpret HTML comments in the document body
|
|
171
|
+
* as unrecognized YAML keys and reject the agent file entirely.
|
|
172
|
+
*/
|
|
173
|
+
function buildSystemPrompt(
|
|
174
|
+
ag: AgentDefinition,
|
|
175
|
+
baseKnowledgeDir: string = path.join(getPackageRoot(), "templates/standards"),
|
|
176
|
+
stripMetaComments = false,
|
|
177
|
+
): string {
|
|
178
|
+
const metaHeader = stripMetaComments ? [] : [
|
|
179
|
+
`<!-- name: ${ag.name} -->`,
|
|
180
|
+
`<!-- capability: ${ag.capability} -->`,
|
|
181
|
+
`<!-- tags: ${JSON.stringify(ag.tags)} -->`,
|
|
182
|
+
"",
|
|
183
|
+
];
|
|
129
184
|
const lines: string[] = [
|
|
130
|
-
|
|
185
|
+
...metaHeader,
|
|
186
|
+
`# 🎖️ ${ag.displayName} — Agent Enderun`,
|
|
187
|
+
"",
|
|
188
|
+
"## Identity",
|
|
131
189
|
ag.instructions.identity,
|
|
132
190
|
"",
|
|
133
|
-
"
|
|
191
|
+
"## Mission",
|
|
134
192
|
ag.instructions.mission,
|
|
135
193
|
"",
|
|
136
|
-
"
|
|
194
|
+
"## Role Scope",
|
|
195
|
+
`**Primary Role:** ${ag.role}`,
|
|
196
|
+
`**Authority Tier:** ${ag.tier} (Capability: ${ag.capability}/10)`,
|
|
197
|
+
"",
|
|
198
|
+
"## Chain of Thought Protocol",
|
|
199
|
+
"> Follow these steps in strict order for every task:",
|
|
200
|
+
"",
|
|
137
201
|
ag.instructions.chainOfThought,
|
|
138
202
|
"",
|
|
139
|
-
"
|
|
140
|
-
|
|
203
|
+
"## Discipline Rules",
|
|
204
|
+
"> These are **non-negotiable** governance mandates. Violating any rule triggers an immediate task freeze.",
|
|
205
|
+
"",
|
|
206
|
+
...ag.instructions.rules.map((r: string, i: number) => `${i + 1}. ${r}`),
|
|
207
|
+
"",
|
|
208
|
+
"## Enterprise Context",
|
|
209
|
+
"You are operating within a **multi-agent enterprise system** governed by the Agent Enderun framework.",
|
|
210
|
+
"All actions are traced, logged, and auditable. Every decision must be defensible and reversible.",
|
|
211
|
+
"- Always read PROJECT_MEMORY.md at session start for full context.",
|
|
212
|
+
"- Always pass the active **Trace ID** in all agent-to-agent messages.",
|
|
213
|
+
"- Never perform irreversible operations (schema drops, bulk deletes) without @manager approval.",
|
|
214
|
+
"- Prefer surgical edits (`replace_text`, `patch_file`) over full file rewrites.",
|
|
215
|
+
"- Escalate ambiguity to @manager instead of guessing.",
|
|
141
216
|
];
|
|
142
|
-
|
|
217
|
+
|
|
143
218
|
if (ag.instructions.knowledgeFiles?.length) {
|
|
144
|
-
lines.push("", "
|
|
145
|
-
|
|
219
|
+
lines.push("", "## Governance Standards (Required Reading)");
|
|
220
|
+
lines.push("> Read and internalize the following standards before acting on any task.");
|
|
221
|
+
ag.instructions.knowledgeFiles.forEach((f: string) => {
|
|
146
222
|
const filePath = path.join(baseKnowledgeDir, f);
|
|
147
223
|
if (fs.existsSync(filePath)) {
|
|
148
|
-
lines.push(
|
|
224
|
+
lines.push("", `### 📘 ${f}`, "", fs.readFileSync(filePath, "utf8").trim());
|
|
149
225
|
} else {
|
|
150
|
-
lines.push(
|
|
226
|
+
lines.push("", `### 📘 ${f}`, `> ⚠️ File not found at \`${filePath}\`. Run \`agent-enderun init\` to scaffold standards.`);
|
|
151
227
|
}
|
|
152
228
|
});
|
|
153
229
|
}
|
|
230
|
+
|
|
154
231
|
return lines.join("\n");
|
|
155
232
|
}
|
|
156
233
|
|
|
157
234
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
158
235
|
// CLAUDE CODE → .claude/agents/{name}.md
|
|
236
|
+
// Valid fields: name, description, model, tools, color
|
|
237
|
+
// Ref: https://docs.anthropic.com/en/docs/claude-code/sub-agents
|
|
159
238
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
160
239
|
|
|
161
240
|
export function toClaudeCodeMd(ag: AgentDefinition, baseKnowledgeDir?: string): string {
|
|
162
|
-
const tools = [...new Set(ag.tools.map(t => CLAUDE_TOOL_MAP[t] ?? t))];
|
|
241
|
+
const tools = [...new Set(ag.tools.map((t: string) => CLAUDE_TOOL_MAP[t] ?? t))];
|
|
163
242
|
const model = resolveModel(ag.capability, "claude-code");
|
|
164
243
|
const color = ag.tier === "supreme" ? "purple"
|
|
165
244
|
: ag.tier === "recon" ? "gray"
|
|
166
245
|
: "blue";
|
|
167
246
|
|
|
247
|
+
// Only officially supported frontmatter fields
|
|
168
248
|
const frontmatter = [
|
|
169
249
|
"---",
|
|
170
250
|
`name: ${ag.name}`,
|
|
171
251
|
"description: >-",
|
|
172
|
-
` ${ag.description}
|
|
252
|
+
` ${ag.description} Invoke proactively for ${ag.role.toLowerCase()} tasks in enterprise monorepo projects.`,
|
|
173
253
|
`model: ${model}`,
|
|
174
254
|
`tools: [${tools.map(t => `"${t}"`).join(", ")}]`,
|
|
175
|
-
`capability: ${ag.capability}`,
|
|
176
|
-
`tags: [${ag.tags.map(t => `"${t}"`).join(", ")}]`,
|
|
177
255
|
`color: ${color}`,
|
|
178
256
|
"---",
|
|
179
257
|
].join("\n");
|
|
@@ -183,33 +261,49 @@ export function toClaudeCodeMd(ag: AgentDefinition, baseKnowledgeDir?: string):
|
|
|
183
261
|
|
|
184
262
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
185
263
|
// GEMINI CLI → .gemini/agents/{name}.md
|
|
264
|
+
// Valid fields: name, description, model, tools (YAML list)
|
|
265
|
+
// Ref: https://ai.google.dev/gemini-api/docs/agents
|
|
186
266
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
187
267
|
|
|
188
268
|
export function toGeminiCliMd(ag: AgentDefinition, baseKnowledgeDir?: string): string {
|
|
189
|
-
const tools = [...new Set(ag.tools.map(t => GEMINI_TOOL_MAP[t] ?? t))];
|
|
269
|
+
const tools = [...new Set(ag.tools.map((t: string) => GEMINI_TOOL_MAP[t] ?? t))];
|
|
190
270
|
const model = resolveModel(ag.capability, "gemini-cli");
|
|
191
271
|
|
|
272
|
+
// Only officially supported frontmatter fields — no capability, no tags, no color.
|
|
273
|
+
// Gemini CLI's strict Zod validator rejects any unrecognized keys.
|
|
192
274
|
const frontmatter = [
|
|
193
275
|
"---",
|
|
194
276
|
`name: ${ag.name}`,
|
|
195
277
|
"description: >-",
|
|
196
|
-
` ${ag.description}
|
|
278
|
+
` ${ag.description} Use for ${ag.role.toLowerCase()} tasks.`,
|
|
197
279
|
`model: ${model}`,
|
|
198
|
-
`capability: ${ag.capability}`,
|
|
199
|
-
`tags: [${ag.tags.map(t => `"${t}"`).join(", ")}]`,
|
|
200
280
|
"tools:",
|
|
201
281
|
...tools.map(t => ` - ${t}`),
|
|
202
282
|
"---",
|
|
203
283
|
].join("\n");
|
|
204
284
|
|
|
205
|
-
|
|
285
|
+
// stripMetaComments=true: Gemini CLI's validator misparses <!-- tags: ... --> HTML
|
|
286
|
+
// comments at the top of the body as unrecognized frontmatter keys.
|
|
287
|
+
return `${frontmatter}\n\n${buildSystemPrompt(ag, baseKnowledgeDir, true)}`;
|
|
206
288
|
}
|
|
207
289
|
|
|
208
290
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
209
291
|
// ANTIGRAVITY CLI → .agents/{name}/agent.json
|
|
292
|
+
// Spec: Antigravity customAgentSpec JSON schema
|
|
210
293
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
211
294
|
|
|
212
|
-
export function toAntigravityJson(ag: AgentDefinition): string {
|
|
295
|
+
export function toAntigravityJson(ag: AgentDefinition, baseKnowledgeDir?: string): string {
|
|
296
|
+
const knowledgeBase = baseKnowledgeDir ?? path.join(getPackageRoot(), "templates/standards");
|
|
297
|
+
|
|
298
|
+
// Embed actual file contents so the agent can read governance docs
|
|
299
|
+
const knowledgeSections = (ag.instructions.knowledgeFiles ?? []).map((f: string) => {
|
|
300
|
+
const filePath = path.join(knowledgeBase, f);
|
|
301
|
+
const content = fs.existsSync(filePath)
|
|
302
|
+
? fs.readFileSync(filePath, "utf8").trim()
|
|
303
|
+
: `(${f} — file not found at build time)`;
|
|
304
|
+
return { title: `Required Reading — ${f}`, content };
|
|
305
|
+
});
|
|
306
|
+
|
|
213
307
|
const payload = {
|
|
214
308
|
name: ag.name,
|
|
215
309
|
displayName: ag.displayName,
|
|
@@ -220,7 +314,7 @@ export function toAntigravityJson(ag: AgentDefinition): string {
|
|
|
220
314
|
systemPromptSections: [
|
|
221
315
|
{
|
|
222
316
|
title: "Identity & Mission",
|
|
223
|
-
content: `${ag.instructions.identity}\n\n${ag.instructions.mission}`,
|
|
317
|
+
content: `${ag.instructions.identity}\n\n**Mission:** ${ag.instructions.mission}`,
|
|
224
318
|
},
|
|
225
319
|
{
|
|
226
320
|
title: "Chain of Thought Protocol",
|
|
@@ -228,14 +322,19 @@ export function toAntigravityJson(ag: AgentDefinition): string {
|
|
|
228
322
|
},
|
|
229
323
|
{
|
|
230
324
|
title: "Discipline Rules",
|
|
231
|
-
content: ag.instructions.rules.join("\n"),
|
|
325
|
+
content: ag.instructions.rules.map((r: string, i: number) => `${i + 1}. ${r}`).join("\n"),
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
title: "Enterprise Context",
|
|
329
|
+
content: [
|
|
330
|
+
"You are part of a multi-agent enterprise governance system.",
|
|
331
|
+
"- Always include active Trace ID in all messages.",
|
|
332
|
+
"- Read PROJECT_MEMORY.md at session start.",
|
|
333
|
+
"- Prefer surgical edits over full file rewrites.",
|
|
334
|
+
"- Escalate high-risk operations to @manager.",
|
|
335
|
+
].join("\n"),
|
|
232
336
|
},
|
|
233
|
-
...
|
|
234
|
-
? [{
|
|
235
|
-
title: "Required Reading",
|
|
236
|
-
content: ag.instructions.knowledgeFiles.join("\n"),
|
|
237
|
-
}]
|
|
238
|
-
: []),
|
|
337
|
+
...knowledgeSections,
|
|
239
338
|
],
|
|
240
339
|
toolNames: ag.tools,
|
|
241
340
|
},
|
|
@@ -249,56 +348,46 @@ export const buildAgentJson = toAntigravityJson;
|
|
|
249
348
|
|
|
250
349
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
251
350
|
// CODEX CLI (OpenAI) → .agents/{name}.md
|
|
351
|
+
// Valid fields: agent-type, display-name, when-to-use, model, allowed-tools
|
|
252
352
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
253
353
|
|
|
254
354
|
export function toCodexMd(ag: AgentDefinition, baseKnowledgeDir?: string): string {
|
|
255
355
|
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";
|
|
356
|
+
const tools = [...new Set(ag.tools.map((t: string) => {
|
|
357
|
+
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";
|
|
358
|
+
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";
|
|
359
|
+
return "shell";
|
|
260
360
|
}))];
|
|
261
361
|
|
|
362
|
+
// Only officially supported Codex CLI frontmatter fields — no tier, no capability
|
|
262
363
|
const frontmatter = [
|
|
263
364
|
"---",
|
|
264
365
|
`agent-type: "${ag.name}"`,
|
|
265
366
|
`display-name: "${ag.displayName}"`,
|
|
266
367
|
"when-to-use: >-",
|
|
267
|
-
`
|
|
368
|
+
` Invoke for ${ag.role.toLowerCase()} tasks. ${ag.description}`,
|
|
268
369
|
`model: ${model}`,
|
|
269
370
|
`allowed-tools: [${tools.map(t => `"${t}"`).join(", ")}]`,
|
|
270
|
-
`tier: ${ag.tier}`,
|
|
271
|
-
`capability: ${ag.capability}`,
|
|
272
371
|
"---",
|
|
273
372
|
].join("\n");
|
|
274
373
|
|
|
275
|
-
|
|
374
|
+
// stripMetaComments=true: Codex CLI may also have strict frontmatter validation;
|
|
375
|
+
// HTML comment metadata is Enderun-internal and not needed by the platform.
|
|
376
|
+
return `${frontmatter}\n\n${buildSystemPrompt(ag, baseKnowledgeDir, true)}`;
|
|
276
377
|
}
|
|
277
378
|
|
|
278
379
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
279
380
|
// CURSOR IDE → .cursor/rules/{name}.mdc
|
|
381
|
+
// Valid fields: description, globs, alwaysApply
|
|
382
|
+
// Ref: https://docs.cursor.com/context/rules
|
|
280
383
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
281
384
|
|
|
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
385
|
export function toCursorMdc(ag: AgentDefinition, baseKnowledgeDir?: string): string {
|
|
298
|
-
const glob =
|
|
386
|
+
const glob = CURSOR_AGENT_GLOBS[ag.name] || "**/*";
|
|
387
|
+
// Only officially supported Cursor MDC frontmatter fields
|
|
299
388
|
const frontmatter = [
|
|
300
389
|
"---",
|
|
301
|
-
`description:
|
|
390
|
+
`description: "${ag.displayName} — ${ag.description.slice(0, 120).replace(/"/g, "'")}"`,
|
|
302
391
|
`globs: ${glob}`,
|
|
303
392
|
"alwaysApply: false",
|
|
304
393
|
"---",
|
|
@@ -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",
|
|
@@ -36,5 +36,6 @@ export const explorer: AgentDefinition = {
|
|
|
36
36
|
"DEPENDENCY MAP: Map all file dependencies and surface them to @manager in a structured report.",
|
|
37
37
|
"RECON FIRST: No specialist should act on an unexplored codebase — flag absence of ADP as a phase blocker.",
|
|
38
38
|
],
|
|
39
|
+
knowledgeFiles: ["architecture-standards.md"],
|
|
39
40
|
},
|
|
40
41
|
};
|
|
@@ -15,6 +15,7 @@ export const git: AgentDefinition = {
|
|
|
15
15
|
stateMachine: STATE_MACHINE,
|
|
16
16
|
tools: [
|
|
17
17
|
"run_shell_command",
|
|
18
|
+
"read_file",
|
|
18
19
|
"list_dir",
|
|
19
20
|
"grep_search",
|
|
20
21
|
"read_project_memory",
|
|
@@ -35,5 +36,6 @@ export const git: AgentDefinition = {
|
|
|
35
36
|
"NO FORCE PUSH: Force-pushing to any shared branch is unconditionally forbidden.",
|
|
36
37
|
"GIT FLOW: Strictly follow git-flow branching conventions — feature, hotfix, release naming enforced.",
|
|
37
38
|
],
|
|
39
|
+
knowledgeFiles: ["logging-and-secrets.md"],
|
|
38
40
|
},
|
|
39
41
|
};
|
|
@@ -19,6 +19,9 @@ export const manager: AgentDefinition = {
|
|
|
19
19
|
"read_project_memory",
|
|
20
20
|
"get_memory_insights",
|
|
21
21
|
"update_project_memory",
|
|
22
|
+
"acquire_lock",
|
|
23
|
+
"release_lock",
|
|
24
|
+
"log_agent_action",
|
|
22
25
|
"get_project_gaps",
|
|
23
26
|
"get_project_map",
|
|
24
27
|
"audit_dependencies",
|
|
@@ -49,6 +52,8 @@ export const manager: AgentDefinition = {
|
|
|
49
52
|
"GAP ANALYSIS: Run 'get_project_gaps' after each phase — unfinished logic is a breach of discipline.",
|
|
50
53
|
"SYSTEM OBSERVABILITY: Periodically invoke 'get_system_health' and 'check_active_ports' to verify environment stability.",
|
|
51
54
|
"MEMORY INTEGRITY: Synchronize 'PROJECT_MEMORY.md' after every single turn. Memory drift is treason.",
|
|
55
|
+
"LOCKING PROTOCOL: Always acquire a lock via 'acquire_lock' on 'memory' resource before writing to PROJECT_MEMORY.md. Release immediately after write.",
|
|
52
56
|
],
|
|
57
|
+
knowledgeFiles: ["governance-standards.md"],
|
|
53
58
|
},
|
|
54
59
|
};
|
|
@@ -21,6 +21,8 @@ export const native: AgentDefinition = {
|
|
|
21
21
|
"grep_search",
|
|
22
22
|
"read_project_memory",
|
|
23
23
|
"run_shell_command",
|
|
24
|
+
"send_agent_message",
|
|
25
|
+
"log_agent_action",
|
|
24
26
|
],
|
|
25
27
|
instructions: {
|
|
26
28
|
identity: "Native Integration Engineer and OS-Layer Security Enforcer",
|
|
@@ -35,6 +37,8 @@ export const native: AgentDefinition = {
|
|
|
35
37
|
"SECURITY PARAMOUNT: Handle all OS-layer operations with rigorous input validation.",
|
|
36
38
|
"PLATFORM ISOLATION: Strictly separate platform-specific code from shared business logic.",
|
|
37
39
|
"SYSTEM CALL AUDITING: Validate all native module inputs and log elevated-privilege operations.",
|
|
40
|
+
"ESCALATION PROTOCOL: Any destructive or elevated-privilege operation requires prior @manager approval via send_agent_message.",
|
|
38
41
|
],
|
|
42
|
+
knowledgeFiles: ["security-standards.md", "logging-and-secrets.md"],
|
|
39
43
|
},
|
|
40
44
|
};
|
package/src/shared/constants.ts
CHANGED
|
@@ -134,20 +134,21 @@ export const DEFAULT_MONOREPO_PATHS = {
|
|
|
134
134
|
tests: "tests",
|
|
135
135
|
} as const;
|
|
136
136
|
|
|
137
|
-
/** Cursor rule globs per agent role (monorepo layout). */
|
|
137
|
+
/** Cursor rule globs per agent role (enterprise monorepo layout). */
|
|
138
138
|
export const CURSOR_AGENT_GLOBS: Record<string, string> = {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
analyst:
|
|
150
|
-
|
|
139
|
+
manager: "**/*",
|
|
140
|
+
security: "**/*",
|
|
141
|
+
architect: "**/*",
|
|
142
|
+
backend: `${DEFAULT_MONOREPO_PATHS.backend}/**/*`,
|
|
143
|
+
frontend: `${DEFAULT_MONOREPO_PATHS.frontend}/**/*`,
|
|
144
|
+
mobile: `${DEFAULT_MONOREPO_PATHS.mobile}/**/*`,
|
|
145
|
+
native: "apps/native/**/*",
|
|
146
|
+
database: `${DEFAULT_MONOREPO_PATHS.backend}/src/database/**/*`,
|
|
147
|
+
devops: "{.github,docker,infra,scripts,*.yml,*.yaml,Dockerfile*}",
|
|
148
|
+
quality: "**/*",
|
|
149
|
+
analyst: "{docs,specs,contracts}/**/*",
|
|
150
|
+
explorer: "**/*",
|
|
151
|
+
git: "**/*",
|
|
151
152
|
};
|
|
152
153
|
|
|
153
154
|
// ─── MCP & environment ──────────────────────────────────────────────────────
|