
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
opencode-baseline-hooks
Advanced tools
Security validation, logging, context monitoring, and Kokoro TTS voice notifications for OpenCode
Security validation, logging, context monitoring, and Kokoro TTS voice notifications for OpenCode and Claude Code.
If the plugin crashes OpenCode on startup, you can fix it without launching OpenCode:
Option 1: Revert to previous version
npm install -g opencode-baseline-hooks@0.8.0
Option 2: Disable the plugin entirely
Edit your config file directly with any text editor:
# Global config
nano ~/.config/opencode/opencode.json
# Or project config
nano .opencode/opencode.json
Remove or comment out the plugin:
{
"plugin": [
// "opencode-baseline-hooks"
]
}
Then restart OpenCode - it will start without the plugin.
Option 3: Check logs
Plugin errors are logged to .opencode/logs/errors.json in your project directory.
NOTIFY_QUIET_HOURS=22:00-07:00)output.args is missingnpm install -g opencode-baseline-hooks
IMPORTANT: OpenCode and Claude Code use DIFFERENT configuration systems!
OpenCode uses a plugin system. Add to your ~/.config/opencode/opencode.json:
{
"plugin": [
"opencode-baseline-hooks"
]
}
Or for project-level config in .opencode/opencode.json:
{
"plugin": [
"opencode-baseline-hooks"
]
}
That's it! The plugin handles all hook events automatically.
Claude Code uses a hooks config with CLI commands. Add to ~/.claude/settings.json:
{
"hooks": {
"PreToolUse": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "opencode-pre-tool"
}]
}],
"PostToolUse": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "opencode-post-tool"
}]
}],
"SessionStart": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "opencode-session-start"
}]
}],
"PreCompact": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "opencode-pre-compact --backup --verbose"
}]
}],
"UserPromptSubmit": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "opencode-user-prompt --log-only --store-last-prompt"
}]
}],
"Notification": [{
"matcher": "",
"hooks": [{
"type": "command",
"command": "opencode-context-monitor"
}]
}]
}
}
| Feature | OpenCode | Claude Code |
|---|---|---|
| Config file | opencode.json | ~/.claude/settings.json |
| Hook system | "plugin": [...] | "hooks": { ... } |
| Hook format | TypeScript plugin | CLI commands |
These CLI commands are available after global installation (used by Claude Code):
| Command | Description |
|---|---|
opencode-pre-tool | Pre-tool validation (security checks) |
opencode-post-tool | Post-tool logging (errors, stats) |
opencode-session-start | Session initialization |
opencode-pre-compact | Pre-compaction backup |
opencode-user-prompt | User prompt logging |
opencode-context-monitor | Context/token monitoring |
| Variable | Default | Description |
|---|---|---|
KOKORO_URL | http://localhost:8880 | Kokoro TTS API endpoint |
KOKORO_VOICE | bf_emma | Voice to use |
OPENCODE_VOICE | (enabled) | Set to off to disable voice |
PROJECT_DIR | (current dir) | Project root directory |
NOTIFICATION_MODE | verbose | verbose, smart, or quiet |
NOTIFICATION_SPEAK | completion,error | Categories to speak in smart mode |
NOTIFY_MAX_QUEUE | 20 | Maximum notifications in queue |
NOTIFY_MIN_GAP_MS | 750 | Minimum ms between notifications |
NOTIFY_QUIET_HOURS | (none) | Quiet hours ranges (e.g., 22:00-07:00,12:00-13:00) |
NOTIFY_COALESCE_CATEGORIES | info,warning | Categories to coalesce duplicates |
NOTIFY_RETRY_CATEGORIES | critical,blocked | Categories to retry on failure |
NOTIFY_MAX_RETRIES | 2 | Max retry attempts per notification |
NOTIFY_PERSONA_OPS_VOICE | (default) | Voice for ops_sentry persona |
NOTIFY_PERSONA_CONCIERGE_VOICE | (default) | Voice for concierge persona |
Control notification behavior to reduce voice spam while staying informed.
| Mode | Behavior |
|---|---|
verbose | Speak every notification (original behavior) |
smart | Aggregate blocked commands, speak summary on completion |
quiet | Visual notifications only (macOS notification center) |
Set NOTIFICATION_SPEAK to customize which events trigger voice (comma-separated):
completion - Task completion summarieserror - Errors requiring attentionblocked - Blocked commands (aggregated in smart mode)build - Build success/failuretest - Test resultswarning - Warningsexport NOTIFICATION_MODE=smart
export NOTIFICATION_SPEAK=completion,error
Before (verbose mode):
"Blocked writing secrets to file"
"Blocked writing secrets to file"
"Access to sensitive file blocked"
"Build completed successfully"
"Task complete"
After (smart mode):
"MyProject: completed after 5 minutes. 3 commands blocked. Build success."
rm -rf /, recursive delete with dangerous pathssudo, su commandschmod 777, world-writable permissions.env (allows .env.example)credentials.json, secrets.json.ssh/ directory, SSH keys.aws/credentials, .kube/configThe context monitor tracks cumulative token usage and creates backups at thresholds:
Backups include:
Backups are stored in .opencode/backup/.
All logs are stored in .opencode/logs/:
| File | Contents |
|---|---|
pre_tool_use.json | Tool calls with arguments |
post_tool_use.json | Tool outputs |
blocked.json | Blocked dangerous commands |
errors.json | Detected errors |
sessions.json | Session lifecycle |
daily_stats.json | Daily usage statistics |
user_prompts.json | User prompt history |
context_state.json | Current context state |
messages.jsonl | Message log for token tracking |
Run Kokoro TTS locally with Docker:
docker run -d -p 8880:8880 ghcr.io/remsky/kokoro-fastapi-cpu:latest
The package exports a plugin for direct use:
import plugin from "opencode-baseline-hooks"
// OpenCode plugin system calls this automatically
const hooks = await plugin({ directory: "/path/to/project" })
// Returns event handlers:
// - hooks["tool.execute.before"] - Pre-tool security validation
// - hooks["tool.execute.after"] - Post-tool logging
// - hooks.event - Session events (created, idle, error)
MIT
FAQs
Security validation, logging, context monitoring, and Kokoro TTS voice notifications for OpenCode
We found that opencode-baseline-hooks demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.