Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ The tracker needs **8 of Claude Code's 24 hook events** registered in `~/.claude
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -301,7 +301,7 @@ The tracker needs **8 of Claude Code's 24 hook events** registered in `~/.claude
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -312,7 +312,7 @@ The tracker needs **8 of Claude Code's 24 hook events** registered in `~/.claude
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -323,7 +323,7 @@ The tracker needs **8 of Claude Code's 24 hook events** registered in `~/.claude
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -334,7 +334,7 @@ The tracker needs **8 of Claude Code's 24 hook events** registered in `~/.claude
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -345,7 +345,7 @@ The tracker needs **8 of Claude Code's 24 hook events** registered in `~/.claude
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -356,7 +356,7 @@ The tracker needs **8 of Claude Code's 24 hook events** registered in `~/.claude
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -367,7 +367,7 @@ The tracker needs **8 of Claude Code's 24 hook events** registered in `~/.claude
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -376,7 +376,7 @@ The tracker needs **8 of Claude Code's 24 hook events** registered in `~/.claude
}
```

> **Important:** Timeout values are in **milliseconds** for command hooks (5000 = 5 seconds). If you already have a `"hooks"` key in settings.json, merge these entries into it rather than overwriting.
> **Important:** Timeout values are in **seconds** for command hooks (`5` = 5 seconds, not milliseconds — `5000` would be 83 minutes). If you already have a `"hooks"` key in settings.json, merge these entries into it rather than overwriting.

**Verify:**
```bash
Expand Down Expand Up @@ -592,7 +592,7 @@ ls -la ~/.claude/hooks/session_title_generator.py
{
"type": "command",
"command": "python3 ~/.claude/hooks/session_title_generator.py",
"timeout": 15000
"timeout": 15
}
]
}
Expand All @@ -611,7 +611,7 @@ If you have Tier 2 live tracker, your `SessionEnd` should now have TWO entries:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
},
Expand All @@ -620,7 +620,7 @@ If you have Tier 2 live tracker, your `SessionEnd` should now have TWO entries:
{
"type": "command",
"command": "python3 ~/.claude/hooks/session_title_generator.py",
"timeout": 15000
"timeout": 15
}
]
}
Expand Down Expand Up @@ -802,7 +802,7 @@ The full `~/.claude/settings.json` for Tier 2 + 3:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -813,7 +813,7 @@ The full `~/.claude/settings.json` for Tier 2 + 3:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -824,7 +824,7 @@ The full `~/.claude/settings.json` for Tier 2 + 3:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -835,7 +835,7 @@ The full `~/.claude/settings.json` for Tier 2 + 3:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -846,7 +846,7 @@ The full `~/.claude/settings.json` for Tier 2 + 3:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -857,7 +857,7 @@ The full `~/.claude/settings.json` for Tier 2 + 3:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -868,7 +868,7 @@ The full `~/.claude/settings.json` for Tier 2 + 3:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -879,7 +879,7 @@ The full `~/.claude/settings.json` for Tier 2 + 3:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
},
Expand All @@ -888,7 +888,7 @@ The full `~/.claude/settings.json` for Tier 2 + 3:
{
"type": "command",
"command": "python3 ~/.claude/hooks/session_title_generator.py",
"timeout": 15000
"timeout": 15
}
]
}
Expand All @@ -912,7 +912,7 @@ If you installed the branch detector hook in Tier 4, add it to `SessionStart` al
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
},
{
"type": "command",
Expand Down
16 changes: 8 additions & 8 deletions api/SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Add the following to `~/.claude/settings.json`:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -92,7 +92,7 @@ Add the following to `~/.claude/settings.json`:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -103,7 +103,7 @@ Add the following to `~/.claude/settings.json`:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -114,7 +114,7 @@ Add the following to `~/.claude/settings.json`:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -125,7 +125,7 @@ Add the following to `~/.claude/settings.json`:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -136,7 +136,7 @@ Add the following to `~/.claude/settings.json`:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -147,7 +147,7 @@ Add the following to `~/.claude/settings.json`:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand All @@ -158,7 +158,7 @@ Add the following to `~/.claude/settings.json`:
{
"type": "command",
"command": "python3 ~/.claude/hooks/live_session_tracker.py",
"timeout": 5000
"timeout": 5
}
]
}
Expand Down
8 changes: 4 additions & 4 deletions api/models/hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{
"matcher": "*",
"hooks": [
{"type": "command", "command": "python3 script.py", "timeout": 5000}
{"type": "command", "command": "python3 script.py", "timeout": 5}
]
}
]
Expand Down Expand Up @@ -110,7 +110,7 @@ class HookRegistration(BaseModel):
command: str
script_filename: Optional[str] = None
script_language: str = "unknown"
timeout_ms: Optional[int] = None
timeout_seconds: Optional[int] = None
can_block: bool = False


Expand Down Expand Up @@ -372,7 +372,7 @@ def _parse_hook_groups(
if not command:
continue

timeout_ms = hook_entry.get("timeout")
timeout_seconds = hook_entry.get("timeout")

# For plugins, expand ${CLAUDE_PLUGIN_ROOT} in the display command
display_command = command
Expand All @@ -390,7 +390,7 @@ def _parse_hook_groups(
command=display_command,
script_filename=_extract_script_filename(command),
script_language=_detect_script_language(command),
timeout_ms=timeout_ms,
timeout_seconds=timeout_seconds,
can_block=can_block,
description=description,
)
Expand Down
32 changes: 16 additions & 16 deletions api/scripts/SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,42 +44,42 @@ hooks:
SessionStart:
- command: |
cat | python3 ~/.local/bin/claude-code-karma-tracker
timeout: 2000
timeout: 2

UserPromptSubmit:
- command: |
cat | python3 ~/.local/bin/claude-code-karma-tracker
timeout: 2000
timeout: 2

PostToolUse:
- command: |
cat | python3 ~/.local/bin/claude-code-karma-tracker
timeout: 2000
timeout: 2

Notification:
- command: |
cat | python3 ~/.local/bin/claude-code-karma-tracker
timeout: 2000
timeout: 2

Stop:
- command: |
cat | python3 ~/.local/bin/claude-code-karma-tracker
timeout: 2000
timeout: 2

SubagentStart:
- command: |
cat | python3 ~/.local/bin/claude-code-karma-tracker
timeout: 2000
timeout: 2

SubagentStop:
- command: |
cat | python3 ~/.local/bin/claude-code-karma-tracker
timeout: 2000
timeout: 2

SessionEnd:
- command: |
cat | python3 ~/.local/bin/claude-code-karma-tracker
timeout: 2000
timeout: 2
```

#### Option B: Global hooks (all projects)
Expand All @@ -89,14 +89,14 @@ Add to `~/.claude/settings.json`:
```json
{
"hooks": {
"SessionStart": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2000 }],
"UserPromptSubmit": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2000 }],
"PostToolUse": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2000 }],
"Notification": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2000 }],
"Stop": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2000 }],
"SessionEnd": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2000 }],
"SubagentStart": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2000 }],
"SubagentStop": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2000 }]
"SessionStart": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2 }],
"UserPromptSubmit": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2 }],
"PostToolUse": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2 }],
"Notification": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2 }],
"Stop": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2 }],
"SessionEnd": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2 }],
"SubagentStart": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2 }],
"SubagentStop": [{ "command": "cat | python3 ~/.local/bin/claude-code-karma-tracker", "timeout": 2 }]
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion captain-hook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Hooks are defined in `.claude/hooks.yaml`:
hooks:
PreToolUse:
- command: "your-script.sh"
timeout: 5000
timeout: 5
match_tools: ["Write", "Edit"] # optional filter

- type: "prompt" # LLM-powered hook
Expand Down
2 changes: 1 addition & 1 deletion captain-hook/docs/hooks/CwdChanged-info-available.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ hooks:
OLD=$(echo "$INPUT" | jq -r '.old_cwd')
NEW=$(echo "$INPUT" | jq -r '.new_cwd')
echo "$(date): $OLD -> $NEW" >> /tmp/cwd_history.log
timeout: 2000
timeout: 2
```

## Use Cases
Expand Down
Loading
Loading