CodeVetter · Repo Unpack · Behavior traces
msitarzewski/agency-agents
Three flows dominate: installing into a host, regenerating integration files, and turning the roster into a Hermes plugin that can search and delegate. A fourth, docs-only flow is NEXUS activation by pasting a prompt. The traces below name the functions in call order as they appear in the scripts.
- Install startup: main parses flags, do_list exits early for --list, build_selection computes _ALLOWED_SLUGS, check_integrations requires integrations/ to exist, then either interactive_wizard or the detect loop fills SELECTED_TOOLS. Dry-run prints the plan via selected_agent_count and exits before any write.
- Non-interactive detection calls is_detected per ALL_TOOLS entry, which dispatches detect_claude_code (directory ~/.claude or CLAUDE_CONFIG_DIR), detect_copilot (code binary or ~/.github or ~/.copilot), detect_hermes (hermes binary or HERMES_HOME), and the other detect_* helpers. Zero detections exits 0 with a tip, not an error.
- Wizard order is tui_begin, then screen_tools -> screen_teams -> screen_review. Each screen calls selector, which loops read_key and draw_frame. On install, the wizard commits SELECTED_TOOLS and, if not every team is selected, FILTER_DIVISIONS, then build_selection. No TTY makes interactive_wizard return 1 and main falls through to auto-detect.
- A real install calls install_tool, which calls ensure_converted then the matching install_<tool>. Sequential mode prints progress_bar around each tool. --parallel re-execs install.sh with AGENCY_INSTALL_WORKER=1 via xargs -P, passing worker_flags (--link, --no-convert, --path, --division, --agent, --agents-file).
- Claude Code file loop: for each AGENT_DIRS entry, find *.md, is_agent_file, agent_slug, slug_allowed, install_file (cp, or ln -sf if --link) into the resolved dest. Copilot repeats that write into two directories and counts once.
- Convert startup: main validates --tool against valid_tools, then run_conversions. For a normal tool it clean_tool_output, find-sorts markdown, skips non-frontmatter, and calls the converter. --parallel on tool=all runs every tool except aider and windsurf through xargs, because those two share temp accumulators, then runs them serially.
- OpenClaw convert of one file: get_field name/description, slugify, get_body, then a line loop that uses fence_open_p/fence_closes_p so fenced ## lines are not section breaks, classifies headers into soul vs agents, and writes SOUL.md, AGENTS.md, and IDENTITY.md.
- Hermes install order: ensure_converted may call convert.sh --tool hermes; install_hermes checks plugin.yaml, __init__.py, and data/agents.json exist; if HERMES_PLUGIN_DIR's basename is not agency-agents-router it appends that segment; rm -rf only that directory; cp -R or ln -s; ensure_hermes_plugin_enabled; then a python one-liner prints len(agents.json).
- ensure_hermes_plugin_enabled copies config.yaml to config.yaml.bak.agency-agents-plugin.$$, then an inline Python script finds the plugins: block, repairs lines where '- ' was glued into a scalar, and inserts '- agency-agents-router' at the existing list-item indent. It exits 0 if the plugin is already present and exits 1 without writing when it cannot find an insertion point.
- Hermes delegate order inside the generated plugin: _identifier, _agent_lookup, require task, _specialist_prompt as fallback, import SubagentLaunchRequest, lifecycle.launch, lifecycle.wait(330), on timeout lifecycle.cancel then wait(30), lifecycle.result, and on any exception return either pending or the fallback prompt.
- Lint of one agent: lint_file rejects CRLF, requires an opening ---, requires name/description/color, checks color against names awk-extracted from resolve_opencode_color, warns if Identity, Core Mission, or Critical Rules are absent, warns under 50 words, and warns if no ## header classifies as soul or as agents.
- NEXUS-Sprint startup, as documented rather than executed, is a pasted prompt: activate Agents Orchestrator, skip Phase 0, staff PM/design/engineering/QA/support roles, begin at Phase 1, and require Reality Checker approval before launch. The matching runbook startup-mvp lists agents-orchestrator plus engineering-frontend-developer and testing-reality-checker as always-on.