Plugin System
Extend CodeSpar with enterprise plugins for policy, observability, secrets, and integrations.
Plugin System
CodeSpar's plugin system allows enterprise packages to hook into the core agent lifecycle without coupling the core to enterprise code.
Architecture
The core calls plugin hooks at specific points. Enterprise packages register themselves at startup. When no plugins are registered, all hooks are no-ops (zero overhead).
Available Hooks
PolicyHook
Called before an agent executes an action.
Returns { allowed: true } or { allowed: false, reason: "budget exceeded" }.
ObservabilityHook
Called after an agent executes an action.
Records latency, cost, token usage, and errors for every tool call.
SecretsHook
Called when an agent needs credentials.
IntegrationHook
Handles webhooks from external services (Sentry, Linear, Jira, etc.).
Registering Plugins
At application startup:
Plugin Status
Check which plugins are active:
Open Source vs Enterprise
| Hook | Open Source | Enterprise |
|---|---|---|
| Policy | No-op (all allowed) | Budget limits, rate limits, time windows, approval requirements |
| Observability | No-op | Cost tracking, hallucination detection, anomaly detection |
| Secrets | No-op (uses env vars) | AES-256-GCM encrypted vault with rotation |
| Integrations | GitHub webhooks only | Sentry, Linear, Jira, Datadog, PagerDuty |