Important flows
This section describes the logic of each cargo agents command.
Crate-sourced skill resolution
A plugin loads a crate as a plugin by naming that crate in a [[plugins]] chained reference (source.cargo = "..."); the user can also load one directly by enabling the dependency it lives in (see enablement below). When the owning plugin is active and the edge’s predicates hold, the crate is resolved into the active plugin set — the shared list every facet (skills, MCP servers, hooks, subcommands) resolves over, so a crate-sourced plugin’s extensions dispatch exactly like a registry plugin’s. A single path handles every crate — a crate is always a first-class plugin, whether it describes itself with a Symposium.toml, with [package.metadata.symposium], with both, or with neither:
skills::active_pluginsseeds a worklist from the trust-root plugins the registry loaded: each active plugin’splugin.chainededges whose predicates hold (evaluated against the owning plugin’s provenance) contribute asource.cargocrate id.- For each id the fixed-point calls
pms.load_plugin(id, update)on the package-manager setactive_pluginswas handed (built once per invocation bySymposium::workspace). The id’spmroutes it to the cargo transport, which:CargoPm::fetchresolves the source viaRustCrateFetch. A workspace dependency is served from the sourcecargo metadataalready extracted (path overrides for local path deps). Any other crate is read underUpdateLevel::Nonefrom cargo’s extracted crates.io sources ($CARGO_HOME/registry/src/index.crates.io-*, the registry the probe asks, so another registry’s same-named crate is never substituted), with no process and no network, and goes through the crates.io probe underCheckorFetch. The per-invocation paths (--help, subcommand dispatch, hook dispatch) passNone, so they never spawn cargo;syncpassesCheck, so it downloads a crate cargo has not cached yet. The fetched id carries the exact resolved version.CargoPm::plugin_from_fetchedreturns the crate as an unvalidated plugin, with a manifest the cargo PM’smanifest::mergebuilds by layering two sources (merge order:[package.metadata.symposium]fromCargo.toml→Symposium.tomlfile). Both use the ordinary plugin-manifest schema and are parsed leniently (a malformed layer is logged and dropped).- A crate with neither source but a
plugin.jsonat its root is an Agent Plugins package instead. The cargo PM only flags it (UnvalidatedPlugin::agent_plugin): the translator lives in Symposium, and its warnings belong in the user’s report, which a package manager running as its own process cannot reach. - The cargo instance validates it (
plugins::validate_pluginwithPluginKind::Package). A flagged package is first translated byplugins::agent_plugin_manifestinto one skill group per immediate child ofskills/and itsmcp.jsoninto MCP servers, with the defaultskills/group turned off. The translation is strict, so an invalidplugin.jsonmakes the crate yield no plugin at all (reported as a warning) rather than falling back to itsskills/folder. For any other package, aplugin.jsonbeside its manifest sources only fills thename,versionanddescriptionthey leave out; a malformed one is logged. - Validation then runs under
ManifestOrigin::Crate(name defaults to the crate,depends-onis waived,[defaults]accepted, defaultskills/group appended unless[defaults] skills = false). The result is aPluginwhosecanonicalid is the resolved crate. A crate with no manifest sources and noplugin.jsonstill yields one whose only content is that defaultskills/group.
record_activehonors the crate plugin’s own plugin-level predicates (applies, which stamps its provenance: never a workspace member), appends it to the active set, and enqueues its own[[plugins]]edges. This is how a[package.metadata.symposium]redirect (now a[[plugins]] source.cargochained reference to the target crate) is followed. Avisitedset keyed on the package identity (PmRegistry::identity), global across the wholeactive_pluginscall, collapses diamonds (a crate reached through two plugins loads once, so its hooks don’t double-fire and its subcommands don’t read as a false conflict) and breaks cycles; the finite crate universe bounds termination.- Facet extraction then walks the active set.
collect_skillsruns each plugin’s skill groups through the ordinaryload_skills_for_grouppipeline — honoring named groups, group predicates, andsource.path/source.git, with each discovered skill’s origin hashed from its on-diskSKILL.mdpath (this is where git skill sources are fetched, hence theupdatelevel). MCP-server filtering (sync), hook dispatch (hook::dispatch_plugin_hooks), and subcommand lookup (subcommand_dispatch) each iterate the same set. A crate plugin’s custom predicate definitions are the one facet still not wired in — they resolve only from configured registries, andwarn_undispatched_crate_featuresnotes when a crate declares one.
A skill’s install identity is the hash of its on-disk SKILL.md path, so a crate reached two ways dedupes to one install. The edge’s version requirement is recorded but not yet enforced — the crate resolves against the workspace (pin / path override).
The key code paths are in symposium-pm-cargo (CargoPm::load_plugin, plugin_from_fetched, manifest::merge), pm/mod.rs (PmInstance, PluginKind), plugins/agent_plugin.rs (agent_plugin_manifest, fill_from_agent_plugin), plugins.rs (validate_plugin, ManifestOrigin::Crate, Plugin::canonical), skills.rs (active_plugins, record_active, plugin_key, collect_skills, hash_origin_key), and, in symposium-pm-cargo, metadata.rs (symposium_metadata), workspace.rs (WorkspaceDeps, WorkspaceCrate), and sources.rs (RustCrateFetch).
Dependency enablement
A dependency’s own plugin content (a Symposium.toml, [package.metadata.symposium], an Agent Plugins plugin.json, or a skills/ directory) is reachable without any manifest pointing at it, but only with the user’s consent: dependencies are not a trust root.
discovery::discoverasks the untrusted cargo transport for itsactive_plugins(dep_ids): the plugins embedded in the workspace’s dependencies.CargoPm::active_pluginsinspects each dependency in the sourcecargo metadataalready extracted (WorkspaceCrate::source_dir), with no probe or network, so registry-dep embedded plugins are discoverable too. The trusted registries (including the recommendations repo) are skipped, because their plugins are trust roots and never need consent. Each candidate is classified against[plugins]on its crate name — enabled byuse, auto-enabled, declined, or an undecided candidate. Nothing is prompted or written.- At sync time,
plugins::active_pluginsasksdiscovery::enabled_dependencieswhich packages[plugins] auto-enableor an applicableuseentry covers (workspace deps, plus the packagesuseentries name that aren’t deps at all) and seeds each id on the same worklist a chained reference feeds, sopms.load_pluginhonors the crate’s manifest sources, skill groups, and its own[[plugins]]edges. Eachusename is resolved by the package managers (PmRegistry::identify) at the level crate loading uses: a name a configured registry provides is left to that registry plugin, so it isn’t double-loaded, and a name no package manager has is skipped.syncresolves atCheck, reading the cargo cache first and searching crates.io only for a crate that is not cached; the per-invocation paths resolve atNone, which reads only workspace dependencies and the cargo cache. This reads config rather than the offer list, socargo agents use <crate>loads a crate from crates.io whether or not the workspace depends on it, and even before its source has been fetched. - Independently, a registry plugin with no dependency gate anywhere loads dormant (
PluginManifest::requires_use) and activates only when auseentry names it. The gate rides thePredicateContext(with_used/is_used, holding the canonical idsdiscovery::used_pluginsfinds by matching each plugin’s name under its own package manager’s rule), so skill resolution, hook dispatch, subcommand lookup, help, and MCP filtering all agree.
Decisions are recorded by the consent prompt in an interactive cargo agents sync (discovery::prompt_for_consent, which writes auto-enable and disable) and by cargo agents use (use entries); cargo agents status reports what [plugins] currently decides. A hook never prompts: SessionStart names the pending candidates as context instead.
The key code paths are in discovery.rs, config.rs (PluginsConfig, UseEntry), symposium-pm-cargo (CargoPm::active_plugins, CargoPm::load_plugin), plugins.rs (PluginManifest::requires_use), predicate.rs (PredicateContext::is_used), and skills.rs (active_plugins, record_active).
Help rendering
cargo agents --help (and -h, the bare help keyword, or no subcommand) is rendered by help_render, not by clap’s default help.
- The binary and the test harness parse argv with
Cli::try_parse_from, then callhelp_render::help_text(parse, args, sym, cwd). Because the decision happens after parsing, argument order (--help --quiet) does not matter and there is no second argv parser to keep in sync. - For no subcommand,
--help/-h, or the barehelpkeyword,help_textreturns the top-level grouped help:renderslices clap’s own rendered help (header + options block) and hand-renders “Commands for humans” / “Commands for agents” between them, mixing built-ins (cli::builtin_audience) with workspace-filtered plugin subcommands (subcommand_dispatch::applicable_subcommands). - For
<built-in> --help,help_textre-renders clap’s per-command help by walking clap’s command tree to the named subcommand — so required-arg commands (crate-info), required-subcommand groups (plugin), and nested commands (plugin list) all work even though clap’s auto help flag is disabled. - A plugin-vended
<name> --helpis left alone:help_textreturnsNone, and dispatch forwards--helpto the child binary, which owns its own help.
clap’s auto help flag and help subcommand are disabled in cli::Cli; --help/-h is a manual global bool. The key code paths are in help_render.rs (help_text, render, subcommand_help), cli.rs (builtin_audience, the Cli flags), and bin/cargo-agents.rs plus symposium-testlib (the parse-then-help_text wiring).
Subcommand dispatch
When the user runs cargo agents <name> for a name not built into the binary, clap’s allow_external_subcommands routes it to Commands::External(argv).
- The binary (or library
cli::run) callssubcommand_dispatch::dispatch_external(sym, cwd, argv), which first resolves the active plugin set (skills::active_plugins— registry plugins plus crate-sourced ones) so a crate’s subcommands are dispatchable too. find_subcommandwalks that set. For each plugin it applies the plugin-leveldepends-onpredicate against the workspace, then looks upargv[0]inplugin.subcommands. If the entry has its owndepends-onpredicate, that must also match. Two or more matches → error.- The matched subcommand’s
commandfield names anInstallationon the same plugin.installation::resolve_runnableacquires the source if any, runsinstall_commands, and picks theRunnable(Execfor binaries,Scriptfor shell scripts). - The child is spawned with stdio inherited. Its exit code is collapsed to a
u8— the binary wraps it inExitCode::from; the library treats non-zero as an error so the test harness can assert on success/failure.
The key code paths are in subcommand_dispatch.rs, cli.rs (the External arm), and bin/cargo-agents.rs (binary-side wrapping that surfaces the numeric exit code to the OS).