Skip to main content

Cyberstrike is now open source! AI-powered penetration testing for security professionals. Star on GitHub

Creating Plugins

A Cyberstrike plugin is a module that exports a function returning a set of hooks. This guide covers writing, registering, and publishing one.

πŸ“Έ SCREENSHOT: plugin-development.png

Plugin development workflow

Write a Plugin

A plugin is (input: PluginInput) => Promise<Hooks>. Import the types from @cyberstrike-io/plugin:

.cyberstrike/plugin/guard.ts
import type { Plugin } from "@cyberstrike-io/plugin"
export const GuardPlugin: Plugin = async ({ project, directory, $ }) => {
return {
"tool.execute.before": async (input, output) => {
if (input.tool === "bash" && /rm\s+-rf/.test(output.args.command)) {
throw new Error("blocked: rm -rf")
}
},
"permission.ask": async (input, output) => {
if (input.type === "read") output.status = "allow"
},
}
}

The function’s input gives you context β€” client, project, directory, worktree, serverUrl, and $ (a Bun shell). Return an object whose keys are hook names; see the hook reference for every hook and its signature.

Register a Plugin

There are two ways to load a plugin.

1. Local file (no publishing)

Drop a .ts/.js file into a plugin/ (or plugins/) directory inside any .cyberstrike/ folder β€” project or ~/.cyberstrike/:

.cyberstrike/
└── plugin/
└── guard.ts

Cyberstrike discovers it automatically and installs @cyberstrike-io/plugin for you so local plugins can import the types.

2. The plugin config array

Reference an npm package or a path in the plugin array (values are union-merged across config sources):

cyberstrike.json
{
"plugin": [
"@myorg/cyberstrike-guard",
"./local/guard.ts"
]
}

Test & Debug

Run Cyberstrike with debug logging to see plugins load and hooks fire:

Terminal window
cyberstrike --log-level DEBUG --print-logs

(Or set "logLevel": "DEBUG" in your config.)

Since hooks mutate output (or throw), you can unit-test them by calling the hook with a fake input/output and asserting on the mutated output.

Publish

Package your plugin like any npm module and publish it, then have users add it to their plugin array:

package.json
{
"name": "@myorg/cyberstrike-guard",
"type": "module",
"main": "./index.ts",
"peerDependencies": { "@cyberstrike-io/plugin": "*" }
}
Terminal window
npm publish --access public

Caution

Plugins run with full access to your machine and Cyberstrike internals. Only install plugins you trust, and keep hooks fast β€” they run inline with tool calls and LLM requests.