CONTEXT_LIMIT was hardcoded at 200_000 tokens. Users on Claude Opus 4.7
with the 1M context window (model: "opus[1m]") saw the dashboard report
80–90% usage when actual usage was 16–18%, producing constant false
alarms and making the meter unusable on long sessions.
Replace the constant with _detect_context_limit(cwd) which resolves the
limit in this order:
1. CONTEXT_TIMELINE_LIMIT env var (explicit override).
2. "[1m]" / "[1000k]" / "[200k]" suffix in the model field of
<cwd>/.claude/settings.json or ~/.claude/settings.json.
3. 200_000 fallback (current behaviour).
The limit is resolved once per _Builder instance, not per update tick,
so there is no per-event filesystem cost.
No new dependencies (still stdlib only). Default behaviour is unchanged
for users without [1m] in settings.
Verified live on a real Opus 1M session of ~178K tokens: meter went
from 89% (red, false alarm) to 17.9% (cyan, correct).
The `_encode_cwd` function only replaced `/` with `-`, which fails on
Windows where paths use `\` and include drive letters like `D:`.
Use regex to replace any non-alphanumeric character with `-`.
This handles all edge cases across platforms in a single expression.
Before: D:\Claude\mcx -> lookup failed
After: D:\Claude\mcx -> D--Claude-mcx (matches Claude Code encoding)
Persistent local HTTP daemon (port 7878, 1h watchdog) that reads Claude Code
JSONL transcripts and renders a git-graph timeline in the browser — one column
per agent (main + subagents), tool nodes color-coded by type, context-window
sidebar with cache/input/output breakdown. Pure stdlib Python, zero pip deps.
The PostToolUse hook with a wildcard matcher fires on every single tool
call, flooding the user with dozens of notifications per turn. Replace
with Stop (fires once when Claude finishes) and Notification (fires
when Claude needs user input), matching the pattern already used by
discord-notifications and slack-notifications hooks.
* feat: add enterprise quality hooks and agents from pm-workspace
Add 3 quality gate hooks and 2 specialized agents contributed from
pm-workspace (https://github.com/gonzalezpazmonica/pm-workspace):
Hooks (new category: quality-gates/):
- tdd-gate: Enforces TDD — blocks editing production code without tests
- plan-gate: Warns about implementing without an approved specification
- scope-guard: Detects files modified outside the declared spec scope
Agents:
- sdd-spec-writer: Creates executable specifications for AI agents
- commit-guardian: 10-check pre-commit verification protocol
All components are generic (no Azure DevOps dependency), MIT licensed,
and follow the project's component structure conventions.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address all 12 cubic review issues on enterprise hooks and agents
Fixes applied per cubic-dev-ai review:
Hooks (JSON configs):
- Add MultiEdit matcher to tdd-gate, plan-gate (was bypassing gate)
- Use $CLAUDE_PROJECT_DIR for all hook paths (avoid CWD-dependent failures)
tdd-gate.sh:
- Narrow test file globs: use suffix-based patterns (*Test.ext, *.test.ext)
instead of overly broad *test* substring match (P1 fix)
- Improve test discovery: search nearby dirs first (same module), fallback
to project-wide with -maxdepth 6 to limit latency on large repos
plan-gate.sh:
- Remove `set -euo pipefail` that caused unintentional blocking when find
fails on non-existent dirs
- Add `|| true` to find to prevent exit-on-error
scope-guard.sh:
- Fix spec selection: use -printf '%T@ %p' sorted by mtime (not path sort)
with macOS fallback using xargs ls -t
- Broaden declared-file regex: support longer extensions and @ in paths
- Fix word-splitting: use while-read loop instead of unquoted for-in
- Fix matching: use case-based suffix match instead of substring grep
commit-guardian.md:
- CHECK 3: Fix Python build command (per-file py_compile, not bare)
- CHECK 3: Add Go and Rust build detection, add SKIP when no build system
- CHECK 10: Change from WARN to BLOCK for malformed commit messages
sdd-spec-writer.md:
- Add explicit .spec.md naming convention requirement (quality gate hooks
depend on this filename pattern for spec detection)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address cubic review round 2 — null-delimit macOS fallback, existence-only spec check
- scope-guard.sh: use -print0/xargs -0 for macOS fallback to handle
paths with spaces safely (cubic P2)
- plan-gate.sh: replace full enumeration with find -print -quit for
existence-only check, avoiding unnecessary latency in large repos
(cubic P2)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Codebase explorer agent, deadline countdown statusline, change logger
hook, deadline prep skill, commit smart skill, and test detect skill.
Designed for rapid onboarding on unfamiliar codebases with time pressure.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Opens a 3-panel Ghostty layout (Claude | lazygit / yazi) when creating
worktrees in sibling directories. Handles both WorktreeCreate and
WorktreeRemove events with a single companion script.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The installer (`installIndividualHook` in index.js) places companion
Python scripts in `.claude/hooks/`, but the hook config referenced
`.claude/scripts/`. This meant the hook would always fail with a
"file not found" error at runtime, silently rendering it non-functional.
Also removed the `2>&1` stderr redirect which masked the error by
merging stderr into stdout, causing the hook runner to report the
unhelpful "No stderr output" message instead of the actual cause.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Hook that sends Telegram notification when a new PR is created via
`gh pr create`, including the PR URL and Vercel preview URL.
Files added:
- cli-tool/components/hooks/automation/telegram-pr-webhook.json (component)
- cli-tool/components/hooks/automation/telegram-pr-webhook.py (component script)
- .claude/settings.json (project hook config)
- .claude/hooks/telegram-pr-webhook.py (project hook script)
- .gitignore updated to track the hook script
Uses TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID environment variables.
https://claude.ai/code/session_013aBUK67VEy9Q2MaUGUVRJQ
Co-authored-by: Claude <noreply@anthropic.com>
- Update description to list 30+ supported providers
- Simplify hook command by removing git commit grep filter
- Parse Claude Code JSON input from stdin to detect git commit
- Handle git commit -a and chained git add && git commit scenarios
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add new security hook to prevent accidental execution of dangerous shell
commands like rm -rf, dd, mkfs, and other destructive operations.
Features:
- Blocks rm with dangerous flags (recursive, force) on critical paths
- Detects wildcards and system directory targets (/, ~, *)
- Prevents disk operations (dd, mkfs, format)
- Blocks fork bombs and direct disk device access
- Provides clear safety guidelines in error messages
- Allows safe operations (e.g., rm -rf /tmp/specific-folder)
Reviewed by component-reviewer agent.
Co-authored-by: Claude <noreply@anthropic.com>
* Create close-debug-window.sh
* Enhance debug window script with detailed comments
Refactor debug window script for clarity and functionality.
* Enhance debug window description and functionality
Updated the debug window description to include additional details about its functionality and platform support.
* Update cli-tool/components/hooks/development-tools/debug-window.json
Invalid JSON: missing comma after description makes configuration unparsable
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* Update close-debug-window.sh for Windows compatibility
Replace taskkill with ps and kill for better compatibility in Git Bash/Cygwin environments.
* refac: merge close-debug-window.sh to debug-window.sh
- Parses input to get hook_event_name
- Based on hook_event_name, either opens or closes the window
* Delete cli-tool/components/hooks/development-tools/close-debug-window.sh
* Change debug window command script
---------
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* feat: debug-window
Auto Debug Log Viewer. Automatically opens a new window with live debug log output when a Claude Code session starts.
* fix: replace BSD-incompatible grep -P with portable sed for session_id extraction
* fix(hook/debug-window): Debug window opens without --debug flag
Add check for --debug flag to control debug log opening.
* doc(hook/debug-window): Update description for clarity
* Update cli-tool/components/hooks/development-tools/debug-window.sh
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
---------
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* feat: debug-window
Auto Debug Log Viewer. Automatically opens a new window with live debug log output when a Claude Code session starts.
* fix: replace BSD-incompatible grep -P with portable sed for session_id extraction
- Add plugin marketplace system with 10 curated plugins
- Create plugin detail pages with installation instructions
- Add component installation modal with copy functionality
- Update Python script to extract plugin data with category/folder paths
- Add category filters that load correctly based on URL
- Update footer across all pages for consistency
- Fix install commands to use folder/name format
Features:
- Plugin cards with View Details button
- Individual component installation with proper paths
- Related plugins based on shared keywords
- Dynamic category loading for all filter types
- URL-based filter detection and category display
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Created conventional-commits.py for commit message validation
- Created prevent-direct-push.py for protected branch enforcement
- Updated all hook JSONs to use Python scripts with proper JSON output
- All hooks now use permissionDecision: "deny" for proper blocking
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Modified installIndividualHook to detect and download .py files for ANY hook
- Added automatic installation of Python scripts to .claude/hooks/
- Python files get executable permissions (0o755)
- Created validate-branch-name.py for proper Git Flow branch validation
- Hook validation now uses JSON output with permissionDecision
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Added detailed Settings documentation (300+ lines) covering all configuration hierarchy levels
- Added comprehensive Hooks documentation (400+ lines) with event-driven automation examples
- Created Telegram notification hooks with complete setup guide
- Updated overview page to include Settings and Hooks as new component types
- Updated sidebar navigation to include new documentation sections
- Documented installation location selection for both Settings and Hooks
- Added security guidelines, troubleshooting, and best practices
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
✅ Fixed ALL remaining hooks (20 total):
- Updated post-tool/ and pre-tool/ hooks to Claude Code array format
- Fixed git-add-changes, format-javascript-files, format-python-files, run-tests-after-changes
- Fixed backup-before-edit, notify-before-bash
🧠 Added AI Hook Specification System:
- CLAUDE_HOOK_SPECIFICATION.md - Complete hook format guide for AI
- AI_HOOK_TEMPLATE.json - Structured template with examples for AI parsing
- HOOK_PATTERNS_COMPRESSED.json - Compressed patterns for rapid AI reference
📊 Technical Improvements:
- All 20 hooks now use proper array/matcher structure
- Regenerated components.json with corrected hook metadata
- Added comprehensive validation rules and anti-patterns
- Included environment variables and cross-platform compatibility guides
🎯 AI Context Enhancement:
- Future Claude Code sessions can reference these files for correct hook generation
- Compressed format optimizes AI parsing while maintaining completeness
- Common patterns and validation rules prevent structure errors
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Update all 14 hooks to use proper Claude Code array/matcher format
- Fix CLI merge logic to handle new hook structure correctly
- Add support for both old and new hook formats during migration
- Remove conflict detection for hooks (Claude Code arrays support multiple entries)
- Ensure hooks follow proper structure:
{
"hooks": {
"EventName": [
{
"matcher": "ToolPattern",
"hooks": [
{"type": "command", "command": "bash-command"}
]
}
]
}
}
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add 9 Settings components (telemetry, permissions, model, cleanup)
- Add 6 Hooks components (formatting, git integration, backups, testing)
- Implement CLI installation with --setting and --hook flags
- Add conflict detection that prompts user before overwriting
- Merge settings into .claude/settings.json with intelligent deep merge
- Update data-loader.js to handle new component types
- Add filter buttons for Settings and Hooks in web interface
- Generate components.json with new Settings and Hooks sections
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>