pub const BASE_AGENT: &str = include_str!("assets/agents/BASE-AGENT.md");
pub const BASE_ENGINEER: &str = include_str!("assets/agents/BASE-ENGINEER.md");
pub const BASE_OPS: &str = include_str!("assets/agents/BASE-OPS.md");
pub const BASE_QA: &str = include_str!("assets/agents/BASE-QA.md");
pub const BASE_RESEARCH: &str = include_str!("assets/agents/BASE-RESEARCH.md");
pub const API_QA: &str = include_str!("assets/agents/api-qa.md");
pub const CODE_ANALYZER: &str = include_str!("assets/agents/code-analyzer.md");
pub const CODE_CRITIC: &str = include_str!("assets/agents/code-critic.md");
pub const DART_ENGINEER: &str = include_str!("assets/agents/dart-engineer.md");
pub const DATA_ENGINEER: &str = include_str!("assets/agents/data-engineer.md");
pub const DOCUMENTATION: &str = include_str!("assets/agents/documentation.md");
pub const DOTNET_ENGINEER: &str = include_str!("assets/agents/dotnet-engineer.md");
pub const ELIXIR_ENGINEER: &str = include_str!("assets/agents/elixir-engineer.md");
pub const ENGINEER: &str = include_str!("assets/agents/engineer.md");
pub const GCP_OPS: &str = include_str!("assets/agents/gcp-ops.md");
pub const GOLANG_ENGINEER: &str = include_str!("assets/agents/golang-engineer.md");
pub const JAVA_ENGINEER: &str = include_str!("assets/agents/java-engineer.md");
pub const JAVASCRIPT_ENGINEER: &str = include_str!("assets/agents/javascript-engineer.md");
pub const LOCAL_OPS: &str = include_str!("assets/agents/local-ops.md");
pub const MEMORY_MANAGER: &str = include_str!("assets/agents/memory-manager.md");
pub const MPM_AGENT_MANAGER: &str = include_str!("assets/agents/mpm-agent-manager.md");
pub const MPM_SKILLS_MANAGER: &str = include_str!("assets/agents/mpm-skills-manager.md");
pub const NEXTJS_ENGINEER: &str = include_str!("assets/agents/nextjs-engineer.md");
pub const PHOENIX_ENGINEER: &str = include_str!("assets/agents/phoenix-engineer.md");
pub const PHP_ENGINEER: &str = include_str!("assets/agents/php-engineer.md");
pub const PROMPT_ENGINEER: &str = include_str!("assets/agents/prompt-engineer.md");
pub const PYTHON_ENGINEER: &str = include_str!("assets/agents/python-engineer.md");
pub const QA: &str = include_str!("assets/agents/qa.md");
pub const REACT_ENGINEER: &str = include_str!("assets/agents/react-engineer.md");
pub const REFACTORING_ENGINEER: &str = include_str!("assets/agents/refactoring-engineer.md");
pub const RESEARCH: &str = include_str!("assets/agents/research.md");
pub const RUBY_ENGINEER: &str = include_str!("assets/agents/ruby-engineer.md");
pub const RUST_ENGINEER: &str = include_str!("assets/agents/rust-engineer.md");
pub const SECURITY: &str = include_str!("assets/agents/security.md");
pub const SVELTE_ENGINEER: &str = include_str!("assets/agents/svelte-engineer.md");
pub const TAURI_ENGINEER: &str = include_str!("assets/agents/tauri-engineer.md");
pub const TICKETING: &str = include_str!("assets/agents/ticketing.md");
pub const TYPESCRIPT_ENGINEER: &str = include_str!("assets/agents/typescript-engineer.md");
pub const VERCEL_OPS: &str = include_str!("assets/agents/vercel-ops.md");
pub const VERSION_CONTROL: &str = include_str!("assets/agents/version-control.md");
pub const WEB_QA: &str = include_str!("assets/agents/web-qa.md");
pub const WEB_UI_ENGINEER: &str = include_str!("assets/agents/web-ui-engineer.md");
pub const AGENT_ASSETS: &[(&str, &str)] = &[
("BASE-AGENT.md", BASE_AGENT),
("BASE-ENGINEER.md", BASE_ENGINEER),
("BASE-OPS.md", BASE_OPS),
("BASE-QA.md", BASE_QA),
("BASE-RESEARCH.md", BASE_RESEARCH),
("api-qa.md", API_QA),
("code-analyzer.md", CODE_ANALYZER),
("code-critic.md", CODE_CRITIC),
("dart-engineer.md", DART_ENGINEER),
("data-engineer.md", DATA_ENGINEER),
("documentation.md", DOCUMENTATION),
("dotnet-engineer.md", DOTNET_ENGINEER),
("elixir-engineer.md", ELIXIR_ENGINEER),
("engineer.md", ENGINEER),
("gcp-ops.md", GCP_OPS),
("golang-engineer.md", GOLANG_ENGINEER),
("java-engineer.md", JAVA_ENGINEER),
("javascript-engineer.md", JAVASCRIPT_ENGINEER),
("local-ops.md", LOCAL_OPS),
("memory-manager.md", MEMORY_MANAGER),
("mpm-agent-manager.md", MPM_AGENT_MANAGER),
("mpm-skills-manager.md", MPM_SKILLS_MANAGER),
("nextjs-engineer.md", NEXTJS_ENGINEER),
("phoenix-engineer.md", PHOENIX_ENGINEER),
("php-engineer.md", PHP_ENGINEER),
("prompt-engineer.md", PROMPT_ENGINEER),
("python-engineer.md", PYTHON_ENGINEER),
("qa.md", QA),
("react-engineer.md", REACT_ENGINEER),
("refactoring-engineer.md", REFACTORING_ENGINEER),
("research.md", RESEARCH),
("ruby-engineer.md", RUBY_ENGINEER),
("rust-engineer.md", RUST_ENGINEER),
("security.md", SECURITY),
("svelte-engineer.md", SVELTE_ENGINEER),
("tauri-engineer.md", TAURI_ENGINEER),
("ticketing.md", TICKETING),
("typescript-engineer.md", TYPESCRIPT_ENGINEER),
("vercel-ops.md", VERCEL_OPS),
("version-control.md", VERSION_CONTROL),
("web-qa.md", WEB_QA),
("web-ui-engineer.md", WEB_UI_ENGINEER),
];
pub const AGENT_ASSETS_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/src/assets/agents");
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn every_asset_is_non_empty() {
for (name, body) in AGENT_ASSETS {
assert!(
!body.trim().is_empty(),
"agent asset `{name}` embedded empty"
);
}
}
#[test]
fn table_filenames_are_unique() {
let mut seen: Vec<&str> = AGENT_ASSETS.iter().map(|(n, _)| *n).collect();
let total = seen.len();
seen.sort_unstable();
seen.dedup();
assert_eq!(total, seen.len(), "duplicate filename in AGENT_ASSETS");
assert_eq!(total, 42, "AGENT_ASSETS must carry all 42 agent assets");
}
#[test]
fn every_entry_embeds_the_file_it_names() {
for (name, body) in AGENT_ASSETS {
let path = std::path::Path::new(AGENT_ASSETS_DIR).join(name);
let on_disk = std::fs::read_to_string(&path)
.unwrap_or_else(|e| panic!("read {}: {e}", path.display()));
assert_eq!(
on_disk, *body,
"`{name}`'s table entry does not embed {name} — check the \
const wired to that filename"
);
}
}
#[test]
fn no_two_entries_share_content() {
for (i, (name_a, body_a)) in AGENT_ASSETS.iter().enumerate() {
for (name_b, body_b) in AGENT_ASSETS.iter().skip(i + 1) {
assert!(
!std::ptr::eq(*body_a, *body_b),
"`{name_a}` and `{name_b}` embed the same string"
);
}
}
}
#[test]
fn table_matches_the_directory() {
let mut on_disk: Vec<String> = std::fs::read_dir(AGENT_ASSETS_DIR)
.expect("the embedded agent roster directory must exist")
.flatten()
.map(|e| e.file_name().to_string_lossy().into_owned())
.filter(|n| n.ends_with(".md"))
.collect();
on_disk.sort();
let mut in_table: Vec<String> =
AGENT_ASSETS.iter().map(|(n, _)| (*n).to_string()).collect();
in_table.sort();
assert_eq!(
on_disk, in_table,
"AGENT_ASSETS and {AGENT_ASSETS_DIR} disagree — a roster file was \
added or removed without updating the table, so it would ship \
embedded by nobody (or be embedded while missing from disk)"
);
}
#[test]
fn credential_switching_is_forbidden_in_the_shipped_assets() {
for (name, body) in [
("BASE-AGENT.md", BASE_AGENT),
("version-control.md", VERSION_CONTROL),
] {
let flat = body.replace('\n', " ");
assert!(
flat.contains("Never switch") && flat.contains("credential"),
"`{name}` must forbid switching to another `gh` \
account/token/credential to obtain a missing permission (#5680)"
);
}
assert!(
VERSION_CONTROL.contains("When the PM relays operator authorization to merge directly"),
"the credential-switching ban must leave the PM-relayed \
admin-merge authorization intact (#2842)"
);
}
#[test]
fn base_templates_travel_with_the_roster() {
for base in [
"BASE-AGENT.md",
"BASE-ENGINEER.md",
"BASE-OPS.md",
"BASE-QA.md",
"BASE-RESEARCH.md",
] {
assert!(
AGENT_ASSETS.iter().any(|(n, _)| *n == base),
"`{base}` must ship alongside the agents that extend it"
);
}
}
}