Installation
Plugins use the@cyberstrike-io/plugin package for types. CyberStrike installs this automatically when it detects a plugin directory, but you can add it manually:
File locations
Place plugin files in one of these locations and CyberStrike will load them automatically:.cyberstrike/plugin/my-plugin.ts— project-level plugin.cyberstrike/plugins/my-plugin.ts— alternative project-level path~/.cyberstrike/plugin/my-plugin.ts— user-level plugin (applies to all projects)
cyberstrike.json:
Plugin files in
.cyberstrike/plugin/ are auto-discovered and do not need to be listed in cyberstrike.json. Entries in the "plugin" array are for npm packages or paths outside the standard directories.The Plugin type
A plugin is a function that receives a PluginInput and returns a Promise<Hooks>:
PluginInput fields
client
client
A fully initialized CyberStrike SDK client (
ReturnType<typeof createCyberstrikeClient>). Use it to interact with sessions, messages, and projects programmatically.project
project
The current
Project object from the SDK. Contains metadata about the active project.directory
directory
The current working directory for the session (
string). Prefer this over process.cwd() when resolving paths.worktree
worktree
The project worktree root (
string). Use this to generate stable relative paths, e.g. path.relative(input.worktree, absPath).serverUrl
serverUrl
The URL of the running CyberStrike server (
URL). Useful for making API calls back to the server from your plugin.$
$
A
BunShell instance for running shell commands from your plugin. Supports template literal syntax: await input.$`ls -la`.Hooks
Return aHooks object from your plugin function. All hooks are optional.
event
Called for every event emitted by CyberStrike.
config
Called with the resolved Config object after all config files are merged. Use this to inspect or react to configuration at startup.
tool
Register custom tools that the agent can call. The value is a map of tool names to ToolDefinition objects (see custom tools below).
auth
Register a custom authentication provider for LLM access. See AuthHook below.
chat.message
Called when a new user message is received, before the agent processes it.
chat.params
Modify sampling parameters sent to the LLM. Mutate the output object to change values.
chat.headers
Add custom HTTP headers to LLM API requests.
permission.ask
Intercept permission requests before the user is prompted. Mutate output.status to pre-approve or deny.
command.execute.before
Called before a slash command executes. Mutate output.parts to replace the command’s rendered output.
tool.execute.before
Intercept a tool call before it runs. Mutate output.args to modify the arguments passed to the tool.
tool.execute.after
Intercept a tool result after it runs. Mutate output.output to change what the agent sees.
shell.env
Inject environment variables into shells spawned by CyberStrike tools (e.g. the bash tool).
tool.definition
Modify tool descriptions and parameter schemas sent to the LLM. Use this to clarify or restrict tool usage for specific workflows.
Experimental hooks
experimental.chat.messages.transform
experimental.chat.messages.transform
Transform the full message history before it is sent to the LLM. Mutate
output.messages to reorder, filter, or modify messages.experimental.chat.system.transform
experimental.chat.system.transform
Transform the system prompt. Mutate
output.system (an array of strings that are joined) to add or replace content.experimental.session.compacting
experimental.session.compacting
Called before a session compaction starts. Set
output.context to append strings to the default compaction prompt, or set output.prompt to replace it entirely.experimental.text.complete
experimental.text.complete
Intercept text completions. Mutate
output.text to change the result.Custom tools
Use thetool helper from @cyberstrike-io/plugin to define tools. It uses Zod for argument schemas via tool.schema.
execute function receives the parsed args and a ToolContext with:
| Field | Type | Description |
|---|---|---|
sessionID | string | ID of the current session |
messageID | string | ID of the current message |
agent | string | Name of the calling agent |
directory | string | Current project directory |
worktree | string | Project worktree root |
abort | AbortSignal | Signal fired when the tool call is cancelled |
metadata() | function | Set a display title or metadata for the tool call |
ask() | function | Request permission from the user |
The AuthHook type
Use auth to register a custom LLM authentication provider. This lets you add new OAuth or API key flows accessible from the CyberStrike auth UI.
loader field (optional) is called to load existing credentials for the provider. methods supports "oauth" (browser-based redirect flow) and "api" (key/credential entry) types.
Example: log every tool call
.cyberstrike/plugin/logger.ts and CyberStrike will load it automatically on the next startup.