A plugin adds a runner, an agent tool, a wait kind, a workflow step kind, a CLI command, an HTTP
route or Hono route bundle, a server lifecycle hook, a /api/v1/health capability, a launch part,
a run removal slot, a run-lifecycle listener or a git forge to Squawk. Squawk loads plugins from one folder on the
host: <config>/plugins/ (see the platform roots; with
HSQ_HOME set, $HSQ_HOME/config/plugins/). Nothing needs to be configured: a folder that is
not there loads nothing.
ADR 0070 records the loader and
runner kit design; ADR 0071 records the
self-contained runner folder rules; ADR 0072
records the launch slot and bundled feature plugins; ADR 0073
records the server slots (registerHttpRoute bundles, registerServerHook, registerCapability),
typed client composition, and automations as a bundled feature;
ADR 0074 records the forge registry
(registerForge) and GitHub as a bundled forge.
Warning. A plugin runs inside the Squawk process, with all of Squawk's permissions and logins. It can read every file Squawk can read, start any process, and use every agent account and token Squawk holds. Put only code you trust in
<config>/plugins/, as you would when you install Squawk itself.
- Squawk loads no plugin from a project or a repository, only from the host folder.
- The cockpit has no page and the API has no route to install, remove, enable or disable a
plugin. This holds on a local cockpit and on a hosted one (
HSQ_REMOTE=1). To add or remove a plugin, change the folder on the host and restarthsq.
The plugin API and the runner kit (@hearsay-tools/squawk/plugin and its subpaths) can change in
any release. They become a stable promise when Squawk installs plugin packages from npm or git
(ADR 0065, rule 3). Check your plugins after each
upgrade.
A plugin is one folder in <config>/plugins/. The folder name is the plugin name. Its entry is
plain JavaScript: index.mjs, or index.js (Squawk tries them in that order). The entry
default-exports a setup function that receives the API object:
// <config>/plugins/hello/index.mjs
export default function setup(api) {
api.registerCliCommand({
name: 'hello',
usage: ['hsq hello'],
parseMode: 'subcommand',
homeMode: 'none',
runtimeMode: 'none',
// Returns the command: it receives the arguments after the name and returns the exit code.
load: async () => async (argv) => {
console.log('hello', ...argv);
return 0;
},
});
}The fields of each registration are in the types that @hearsay-tools/squawk/plugin exports
(packages/cezar/src/plugin/index.ts). The API object has registerRunner,
registerAgentTool, registerWaitKind, registerStepKind, registerCliCommand,
registerHttpRoute, registerServerHook, registerCapability, registerRemovalSlots,
registerLaunchPart, registerForge and onRunLifecycle. The setup function may be async.
A plugin imports Squawk code only from @hearsay-tools/squawk/plugin and these subpaths:
/runtime, /model-settings, /managed-cli, /pi-rpc and /acp. Squawk maps them to its own running
copy, so a plugin needs no installed copy of Squawk. Any other @hearsay-tools/squawk import
fails. packages/cezar/src/plugin/__fixtures__/external-runner/ is a complete runner plugin in
plain JavaScript.
A runner plugin folder is self-contained and needs no npm install or node_modules folder:
- Allowed imports. Runner code may import only
node:*built-ins, files inside its own plugin folder, and@hearsay-tools/squawk/plugin(plus its subpaths).@hearsay-tools/squawk/pluginre-exportszfromzodso runners validate schemas without installingzod. - Runner-owned scripts. Any script that the agent CLI itself loads (such as an extension or
plugin) lives inside the runner's own folder and resolves through
new URL('./…', import.meta.url). For bundled runners,packages/cezar/scripts/copy-runner-assets.mjscopies every non-test.mjsasset fromsrc/runners/<id>/todist/runners/<id>/duringpostbuild, andcheck:packverifies they ship in the tarball. - Tool client in agent processes (
HSQ_TOOL_CLIENT). Squawk's in-process import hook does not run inside a spawned agent CLI process. When a session asks for Squawk tools,CiToolController.provision()setsHSQ_TOOL_CLIENT(withCEZ_TOOL_CLIENTfallback) in the session environment to thefile:URL of the running Squawk copy's tool client (dist/ci-wait/client.js, orsrc/ci-wait/client.tsunder source). Out-of-process extensions import the client from that URL instead of a relative path into Squawk. - Dry-run mocks (
nativeMockPath).@hearsay-tools/squawk/plugin/runtimeexportsnativeMockPath(mock). It resolvesRunnerMock.scriptagainst the running Squawk installation'sscripts/folder and throws an error naming the script when the installation does not ship it. - Bundled parity. All six bundled runners (
claude,codex,opencode,pi,ompandantigravity) follow these rules and load unchanged when their builtdist/runners/<id>/folders are copied into<config>/plugins/with nonode_modulesancestor (packages/cezar/test/e2e/runner-copy-out.test.ts).
A forge plugin lets Squawk open and follow pull requests on a host that the bundled GitHub forge
does not serve, such as a self-hosted Forgejo or Gitea. registerForge takes one definition
object for every project on that forge; the types are ForgeDefinition and its members in
@hearsay-tools/squawk/plugin.
- Matching. A project's forge is the first definition whose
matchRemote({ host, owner, repo })returnstruefor the project'soriginremote. The bundled GitHub forge (github.comonly) asks first, then host plugins by folder name.matchRemoteis synchronous; a throw counts as no match. - Required members.
id,label,matchRemote,parsePullRequestUrl,pullRequestUrl,readPullRequest,mergedPullRequestsandopen({ repoRoot, remote }).openreturns the project client:detect,webUrl,createPullRequestandpullRequestComments. With these Squawk opens a draft PR (it pushes the branch itself, then callscreatePullRequest), shows PR links, state and comments, archives a task family on merge, and servescezar_waitwithuntil: "merge". - Optional members. Every other member adds one ability, such as
readChecksforuntil: "checks",mergeProgressforuntil: "merge_or_blocked", ormergePRfor auto-merge. Without it, a read route answers{ available: false, reason }, the merge route answers HTTP 409 with{ error }, auto-merge blocks with "forge<id>cannot merge pull requests", and the wait is refused withunsupported_host. - PR URLs. Squawk accepts
https://<host>/<owner>/<repo>/pull/Nand/pulls/N. - Errors. Throw
ForgeRateLimitedErrorfor a rate limit (pollers pause) andPrWaitErrorto choose a PR wait error code. Any other error from a PR wait read is a retriedcommand_failed.
packages/cezar/src/plugin/__fixtures__/external-forge/ is a complete forge plugin in plain
JavaScript with only the required members.
- The bundled runners load first, then bundled features in ASCII folder-name order, then
host plugins in
<config>/plugins/in ASCII folder-name order. Missing bundled features are valid; a present bundled feature that fails to import or register stops boot. - Squawk applies a plugin's registrations only when its setup finishes with no error and no registration conflicts with an earlier one. Otherwise it applies none of them and skips the plugin. The cockpit still starts.
- For each skipped plugin,
hsqwrites one line to stderr:[hsq] plugin "<name>" skipped: <error>. - A runner's stored settings (default runner, models, accounts, disabled providers) stay on disk while its plugin does not load, and act again once it loads.
hsq pluginslists each loaded plugin with what it registered, and each skipped plugin with its full error.hsq plugins --jsonprints the same report as JSON.GET /api/v1/healthsendsplugins: { loaded, failed }. A skipped plugin'serrorthere is a short fixed text for the kind of failure; runhsq pluginson the host for the full error. A hosted cockpit sends no plugin paths.hsq --helploads runtime and lists core, bundled feature and host plugin commands. It skips host discovery quietly if home cannot be resolved, without preparing home. A plugin's command runs ashsq <name>like a built-in.