symposium hook
Entry point invoked by the agent’s hook system on session events.
Flow
The payload is parsed first, and the agent’s parser can declare it not an occurrence of the symposium event (AgentHookInput::should_dispatch; false for an Antigravity PreInvocation after the first of a turn). Such a payload is answered with the agent’s neutral output and skips every step below.
All remote package-manager operations in execute_hook share a two-second
absolute deadline, including initialization and work across multiple PMs. An
expired request terminates that PM’s process tree and fails through the normal
PM error path. Later PM requests fail immediately, while local plugin dispatch
continues so its decisions can reach agents with ten-second hook deadlines.
This bounds remote PM waiting; it is not a timeout on local plugin execution.
-
Auto-sync (if enabled): when
auto-sync = truein the user config, runssymposium syncto ensure skills are current. The workspace is the project the package managers find from the payload’scwdfield, or from the process’s current working directory when the payload has none. Runs quietly and non-fatally: failures are logged but don’t block hook dispatch.That directory is also where the event’s predicates run (
shell(...), a relativepath_exists(...)), here and at dispatch, and where plugin hook processes run. When it is not an existing directory, they use the process’s working directory instead. On Antigravity the process starts in the directory holdinghooks.json, so this is what keeps hooks in the project.Auto-sync is also where a crate reached through a
[[plugins]]chained reference or a[plugins]enablement entry is downloaded when cargo has not cached it yet. Dispatch only reads the cargo cache, so such a crate is absent from it until a sync has downloaded it.SessionStartis the refresh point. Because it fires once per agent session, it does the expensive work that other events skip: it bypasses the freshness gate (so skills re-sync even when no package manager’s inputs changed) and passesUpdateLevel::Checkso git registries andsource.gitskill groups are re-fetched if their upstream moved. Every other event keeps the cheap path, gated on the package managers’ recorded inputs, withUpdateLevel::None(debounced) to avoid per-event network and package-manager cost. The registry refresh onSessionStart(ensure_registrieswithCheck, decided in the binary entry point from the event) still honors each registry’sauto-updatetoggle.SessionStartalso runsprewarm_hook_sources, which refreshes already-installed hook binaries/scripts (thecargo/githubsources backing plugin hooks) — refresh-only, so it never eagerly installs a tool a hook may never use; first install still happens lazily at dispatch. -
Built-in dispatch: symposium’s own handling, before plugin hooks.
PreToolUseproduces nothing. OnSessionStartthree fragments are computed independently and, when present, joined into oneadditionalContext:- Discovery hint: when the active workspace exposes plugin-vended subcommands (the same workspace-filtered set listed by
symposium --help), a line suggesting the agent runsymposium --helpto find them. Computed independently of the update-check throttle, so it fires whenever there is something to discover. - Consent hint: the dependency plugins awaiting consent, each named with its audit answer in the consent prompt’s words (
crate-a (not audited),crate-b (audited by the `symposium-audits` list)), with no audit answer when no list was read (AuditIndex::is_read), telling the agent that they stay off until the user consents (“audited or not” only when some name carries an answer), and to point the user atsymposium syncorsymposium use. The answers come from the same cache-only discovery pass, so the hint adds no network call and no package-manager run. - Update nudge: when
auto-update = "warn", the 24-hour check throttle has elapsed, and the registry reports a newer version: a line suggestingsymposium self-update.
On
PostToolUseandUserPromptSubmit, when auto-sync just re-synced because a package manager’s input changed, the consent hint fromSessionStartnames the dependency plugins awaiting consent and points atsymposium sync. With nothing awaiting consent it adds nothing, so a new dependency that ships no plugin, or oneauto-enableorusecovers (which the sync just installed), gets no notice. It names each pending package and version once: the per-directory state records every candidate already named, atSessionStarttoo, so a later change names only the new ones, or nothing, while a new version of a named one counts as new. A candidate is recorded only when the response the agent receives, read back through its handler, still carries the notice and does not block the event, since an agent discards the context of an event it blocks. So when a plugin hook blocks the event (exit 2, or a decision such as Claude’s and Codex’s"decision": "block") or the agent’s output has no room for context (Antigravity after a tool call), the next change names it again.SessionStartitself still names every pending candidate, once per session. That is right after a tool call that changed the dependencies, or the user’s next prompt when they changed them.run_auto_syncreturns that as a bool, so an event with unchanged inputs does no extra work. A directory with no recorded sync (a sibling crate the agent moved to, a cleared cache), or whose last sync recorded no inputs, still syncs but gets no dependency notice, since nothing says its dependencies changed. The reload noticeSessionStartgives is added too: the plugins a sync installed or updated for the hook’s agent, and how this agent loads them now. Codex and Copilot get the same notice for the skills that sync copied into or updated in their skills directory, since neither may offer a skill added during a session (see Codex CLI and Copilot CLI); Copilot gets it onSessionStarttoo, Codex does not, since it lists what that sync copies from the next turn. What the reload notice names is not taken from that event’s sync alone: every sync records in the per-directory state (pending-reloads) what it installed or updated for each agent that takes the notice, each event names what is pending for its agent, and a name leaves the record only when the response the agent receives carries the notice and does not block, the check the consent notice uses. So a change first seen onPreToolUseorStop, which sync but carry no notice, on a blocked event, on an event whose context the agent ignores (Antigravity after a tool call), or by another agent’s hook (Copilot also runs Claude Code’s), is named on that agent’s next event that can carry it.SessionStartfirst drops what was pending for its agent, since a new session loads it.Agents without hook registration (OpenCode, Goose) never receive this; for them the only discovery surface is
symposium --helpitself. - Discovery hint: when the active workspace exposes plugin-vended subcommands (the same workspace-filtered set listed by
-
Dispatch to plugin hooks: for each enabled plugin that defines a hook handler for the incoming event:
- Select format: for each plugin, pick the best format and deliver to every matching hook of it (see Hooks for priority rules). A hook whose
agentnames another agent, or whosepredicatesdo not hold, is not a candidate. If the plugin has hooks matching the current agent’s format, deliver the input unmodified. Otherwise deliver in symposium canonical format to its symposium-format hooks. A hook in another agent’s format never fires: Symposium does not convert between agent formats. - Acquire and run:
- Ensure any
requirementsfor the hook are acquired (on-demand, best-effort). - Resolve the hook’s
command(a named installation reference or inline declaration) into a runnable form:- If the installation declares a
source, acquire it (install / cache / clone) and resolve theexecutable/scriptagainst the cached location. Dispatch acquires withUpdateLevel::None— it serves the cache (git checks debounced) rather than hitting the network on every event. Freshness comes from theSessionStartprewarm (step 1), which re-acquires every applicable hook’s source withCheckonce per session. - If no source, the
executable/scriptis taken as a path on disk, resolved when the plugin loads (plugins::resolve_plugin_paths) against the directory of its manifest, so a refreshed plugin-source repo updates these for free. A relativescriptalways names a file in the plugin, even a barehook.shbeside the manifest; a relativeexecutabledoes too when it has more than one component (./tool,bin/tool), while a bareexecutablename such asrustcstays a$PATHlookup. Absolute paths stay as written. - Run the installation’s
install_commands(post-source) before invoking the runnable. - Spawn
path args…directly forExec, orsh path args…forScript.
- If the installation declares a
- Pass the event JSON (in the selected format) on stdin to the plugin’s hook. A separate thread writes it while dispatch waits for the hook, so a hook that never reads its input cannot hold dispatch.
- Collect output from each handler. Stdout and stderr go to temporary files rather than pipes, so a hook can write any amount, and a background job it leaves running is not waited for: the hook is done when its process exits. Stdout is parsed for every exit code except 2 and a missing one, and a code other than 0 is logged as a warning.
- Time limits: each plugin hook may run for 5 seconds (
PLUGIN_HOOK_TIMEOUT), and all plugin hooks of one invocation for 8 seconds together (PLUGIN_HOOKS_BUDGET), counted from the first hook. The total stays below the shortest timeout symposium registers with an agent (10 seconds, Codex and Copilot), so symposium answers before the agent gives up on it and drops every plugin’s output. Acquiring a hook’s command, its source andinstall_commandsincluded, counts toward the total: acquisition stops at the deadline and the hook is skipped. A hook’s own limit starts when it is spawned. A hook that reaches its limit is killed together with every process it started, and fails open: it contributes nothing, is not a block, and the next hook still runs. Once the total is used up, the remaining hooks are skipped. - Convert output back to the agent’s wire format.
- Merge results (e.g., allow/block decisions, output text) across all handlers.
mergelets a later value replace an earlier one, so onSessionStart,UserPromptSubmitandPostToolUseaJoinedContextkeeps every source’s context (the builtin fragments first, then each hook) and writes the joined text back after each merge.PreToolUseandStopare left out: there some agents keep context in the field that holds the decision. An agent’s handler can merge a field itself (merge_output): Antigravity keeps theinjectStepsthat are not context (userMessage,toolCall) and appends each hook’s. - Return the merged result to the agent.
- Ensure any
- A hook that exits 2 blocks: dispatch stops, and
blocked_responseturns its stderr into the reason. OnPreToolUsethat is a canonical deny, translated like any other so each agent receives it in the form it honors (Antigravity ignores exit codes, Copilot drops the reason of a failing hook). On other events the agent’s handler answers (blocked): the process exits 2 with the reason on stderr, except on Antigravity’sStop, where exit 2 would end the turn unnoticed, so the reason is sent asdecision: "continue"and the turn continues as it does on Claude Code and Codex.
- Select format: for each plugin, pick the best format and deliver to every matching hook of it (see Hooks for priority rules). A hook whose
-
Respond: the agent’s handler renders the final output as a
HookResponse(stdout, stderr, exit code). Most agents read everything from stdout; Kiro, whose stdout is plain context, is told to deny a tool through exit 2. Claude Code’sSessionStartresponse always carriesreloadSkills: true: Claude Code lists skills beforeSessionStarthooks finish, so without the rescan the skills this sync installs stay hidden until the next session. It is sent even when nothing changed, since knowing that would needsyncto report what it installed, and a rescan is cheap.
Plugin hooks can respond to agent-specific events (e.g., pre-tool-use, post-tool-use, user-prompt-submit for Claude Code). The available events depend on which agent is in use.