
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
A CLI tool that sends Claude Code session messages to Slack threads. Designed to be used as a hook in Claude Code for real-time session monitoring and collaboration.
npm install -g ccth
# or
pnpm add -g ccth
# or
yarn global add ccth
# Clone the repository
git clone https://github.com/mkusaka/ccth.git
cd ccth
# Install dependencies
pnpm install
# Build the project
pnpm run build
# Link globally
pnpm link --global
export SLACK_BOT_TOKEN="xoxb-your-slack-bot-token"
export SLACK_CHANNEL="C1234567890" # Your Slack channel ID
~/.claude/settings.json
or project-specific .claude/settings.json
):{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "ccth"
}
]
}
],
"PostToolUse": [
{
"hooks": [
{
"type": "command",
"command": "ccth"
}
]
}
]
}
}
This configuration will:
UserPromptSubmit
)PostToolUse
)Note: UserPromptSubmit
doesn't require a matcher since it's not tool-specific.
ccth [options]
Options:
-c, --channel <channel> Slack channel ID or name (env: SLACK_CHANNEL)
-t, --token <token> Slack bot token (env: SLACK_BOT_TOKEN)
-d, --debug Enable debug logging and event storage
--dry-run Process messages without sending to Slack
--thread-timeout <seconds> Thread inactivity timeout in seconds (default: 3600)
-V, --version output the version number
-h, --help display help for command
When running with the -d, --debug
flag, ccth will save raw hook events to disk for debugging purposes:
~/.ccth/
โโโ {session_id}/
โโโ thread.json # Session metadata
โโโ events.jsonl # Raw hook events in chronological order
This is useful for debugging and analyzing Claude Code session activity.
The tool expects Claude Code hook event JSON via stdin:
# UserPromptSubmit event
echo '{
"session_id": "abc123",
"transcript_path": "/path/to/transcript.jsonl",
"cwd": "/home/user/project",
"hook_event_name": "UserPromptSubmit",
"prompt": "Help me write a function"
}' | ccth
# PostToolUse event
echo '{
"session_id": "abc123",
"transcript_path": "/path/to/transcript.jsonl",
"cwd": "/home/user/project",
"hook_event_name": "PostToolUse",
"tool_name": "Write",
"tool_input": {"file_path": "/test.txt", "content": "Hello"},
"tool_response": {"success": true}
}' | ccth
# Dry run mode for testing
echo '{...}' | ccth --dry-run --debug
CCTH Bot
(or your preferred name)chat:write
- Required for sending messageschat:write.public
- Required if posting to public channelschannels:read
- Optional: To list channelsgroups:read
- Optional: To access private channelsxoxb-
SLACK_BOT_TOKEN
environment variableC
(e.g., C1234567890
)https://app.slack.com/client/T[TEAM_ID]/C[CHANNEL_ID]
/invite @CCTH Bot
(or your bot's name)# Add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
export SLACK_BOT_TOKEN="xoxb-your-bot-token-here"
export SLACK_CHANNEL="C1234567890" # Your channel ID
# Or create a .env file in your project
echo 'SLACK_BOT_TOKEN="xoxb-your-bot-token-here"' >> ~/.env
echo 'SLACK_CHANNEL="C1234567890"' >> ~/.env
xoxb-
chat:write.public
scope is added# Run in development mode
pnpm run dev
# Run tests
pnpm test
# Run tests with coverage
pnpm run test:coverage
# Type checking
pnpm run typecheck
# Linting
pnpm run lint
# Format code
pnpm run format
npm install -g ccth
# or
pnpm add -g ccth
# or
yarn global add ccth
Follow the Slack Bot Setup section above to:
chat:write
, chat:write.public
)xoxb-
)# Option 1: Export in your shell profile (~/.bashrc, ~/.zshrc, etc.)
export SLACK_BOT_TOKEN="xoxb-your-bot-token-here"
export SLACK_CHANNEL="C1234567890"
# Option 2: Create a .env file in your home directory
cat > ~/.env << EOF
SLACK_BOT_TOKEN="xoxb-your-bot-token-here"
SLACK_CHANNEL="C1234567890"
EOF
# Load the environment variables
source ~/.env
Create or edit ~/.claude/settings.json
:
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "ccth"
}
]
}
],
"PostToolUse": [
{
"hooks": [
{
"type": "command",
"command": "ccth"
}
]
}
]
}
}
# Test with a dry run
echo '{"session_id": "test", "hook_event_name": "UserPromptSubmit", "prompt": "Test message"}' | ccth --dry-run --debug
# If successful, test actual Slack posting
echo '{"session_id": "test", "hook_event_name": "UserPromptSubmit", "prompt": "Hello from CCTH!"}' | ccth
You should see a message appear in your Slack channel!
For comprehensive session monitoring, add all supported events:
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "ccth"
}
]
}
],
"PostToolUse": [
{
"hooks": [
{
"type": "command",
"command": "ccth"
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "ccth"
}
]
}
],
"Notification": [
{
"hooks": [
{
"type": "command",
"command": "ccth"
}
]
}
]
}
}
Create .claude/settings.json
in your project directory for project-specific hooks:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit|MultiEdit",
"hooks": [
{
"type": "command",
"command": "ccth --channel C0987654321"
}
]
}
]
}
}
Use different channels for different projects:
# Personal projects
alias ccth-personal='ccth --channel C1111111111'
# Work projects
alias ccth-work='ccth --channel C2222222222'
Then update your Claude Code settings to use the aliases.
See examples/ directory for more configuration examples.
UserPromptSubmit: Captures user prompts when submitted
PostToolUse: Captures tool execution results
Stop: Triggered when Claude completes its response
stop_hook_active
flag if stop hook is preventing completionNotification: System notifications from Claude Code
Each event is formatted with:
SLACK_BOT_TOKEN
: Your Slack bot token (required)SLACK_CHANNEL
: Default Slack channel ID (required){
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit|MultiEdit",
"hooks": [
{
"type": "command",
"command": "ccth --debug"
}
]
}
]
}
}
Note: For PostToolUse
, if you omit the matcher
field entirely, it will match all tools.
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "ccth"
}
]
}
],
"PostToolUse": [
{
"hooks": [
{
"type": "command",
"command": "ccth"
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "ccth"
}
]
}
],
"Notification": [
{
"hooks": [
{
"type": "command",
"command": "ccth"
}
]
}
]
}
}
This configuration provides:
UserPromptSubmit
PostToolUse
Stop
Notification
MIT
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature
)git commit -m 'Add some amazing feature'
)git push origin feature/amazing-feature
)FAQs
Claude Code session messages to Slack thread notifier
The npm package ccth receives a total of 6 weekly downloads. As such, ccth popularity was classified as not popular.
We found that ccth 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
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.