CodeVetter · Repo Unpack · Data flow
msitarzewski/agency-agents
Source of truth is the division markdown files. lib.sh parses frontmatter and body. convert.sh transforms each agent into a host format under integrations/, except Claude Code and Copilot, which install the source file unchanged. install.sh filters by slug, then copies or symlinks into a host directory resolved from --path, an env override, or a hardcoded default. Hermes is the outlier: bodies are packed into data/agents.json and only the matched specialist is returned or delegated at runtime. Runbook deploys use a different identifier, the filename stem, than the installer slug.
- get_field reads the first YAML frontmatter scalar, strips one matching quote pair, and folds indented continuation lines into a single space-separated value so multi-line descriptions are not truncated. get_body returns everything after the second --- fence.
- agent_slug is get_field name piped through slugify, which lowercases and replaces non-alphanumeric runs with single hyphens. That slug is the install filter key and the filename stem for most converters (frontend-developer), while Antigravity and Osaurus prefix it with agency-.
- The convert loop walks AGENT_DIRS, skips files whose first line is not --- and files with an empty name, then dispatches convert_<tool> or accumulate_<tool>. clean_tool_output first deletes prior output except README.md so renamed agents do not leave orphans.
- OpenCode files are markdown with name, description, mode subagent, and a resolved #RRGGBB color. Cursor files are .mdc with description, empty globs, and alwaysApply false. Gemini CLI files keep name/description frontmatter plus the raw body. Codex writes a TOML file under integrations/codex/agents/<slug>.toml.
- yaml_quote wraps values in single quotes and doubles apostrophes. toml_escape_string shells out to perl -0pe to escape backslashes, quotes, newlines, and other control characters before they are embedded in TOML.
- Install destination order is --path, then a tool-specific env var, then the default. CLAUDE_CONFIG_DIR is treated as the config root and agents are placed in its agents/ subdirectory unless the value already ends in /agents. path_collision_group blocks --path when two tools would write the same filenames (raw-source-md, slug-md, or agency-skill).
- build_selection unions slugs from --division (every agent_slug in those dirs), --agent, and --agents-file. slug_allowed strips a leading agency- prefix. With no filter, SELECTION_ACTIVE stays false and every frontmatter file is installed. Hermes later warns that selection flags are ignored.
- ensure_converted auto-runs convert.sh --tool when integrations/<tool> has no file other than README.md. Claude Code and Copilot return immediately. AUTO_CONVERT defaults true and --no-convert disables it.
- Hermes data flow packs every agent into data/agents.json (slug, name, description, division, color, emoji, vibe, source_path, body). At runtime _load_agents reads that JSON once. Search tokenizes the query and scores name, description, division, vibe, and body[:8000]. Load and delegate call _specialist_prompt, which prepends a 'obey higher-priority system instructions' wrapper and the user task.
- Delegate context is truncated to _MAX_LIFECYCLE_CONTEXT_CHARS (32000) with an explicit truncation marker. The wait budget is _DELEGATION_WAIT_SECONDS 330 and cancellation wait 30. On failure the handler returns the composed prompt instead of the subagent result.
- Runbook slugs are filename stems, not name-slugs. check-runbooks.sh builds the real set with git ls-files '*.md', drops integrations/examples/strategy/scripts/.github, and requires every roster agents[] entry to match a basename without .md. startup-mvp's core team therefore lists engineering-frontend-developer, while install --agent frontend-developer is the name slug of that same file.
- scripts/convert-outputs.sha256 is the drift manifest for generated output. test-convert-outputs.sh records one hash per agent across every tool, one hash per tool's non-agent files, and contract hashes for divisions.json, tools.json, and runbooks.json. Hashes are normalized to forward slashes and LF.
- About 33 of 279 filename stems do not contain the slugify(name) value, so the two identifier spaces are not a simple prefix convention. (inferred)