Commit Graph

7 Commits

Author SHA1 Message Date
Mario Hernandez 262da50f98 fix(context-timeline): detect Opus 1M context window dynamically (#548)
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).
2026-04-27 20:10:27 -04:00
Fernando Basilis e11ff2e105 fix(context-timeline): cross-platform path encoding for transcript lookup (#550)
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)
2026-04-27 20:09:13 -04:00
Dani fc2155655c fix(context-timeline): reload sessions from disk on cache miss when daemon predates session 2026-04-25 23:24:30 -04:00
Dani 99f423049d feat(hook): add monitoring/context-timeline real-time session visualizer
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.
2026-04-25 23:08:28 -04:00
Diego 2c9e88b0a5 feat: add desktop notification hook on Stop event (#360) 2026-02-22 21:21:06 -08:00
Dani 5ef9804f6a chore: Update catalog and LangSmith hook configuration
- Remove background execution (&) from langsmith-tracing hook
- Update component catalog with latest stats (383,881 downloads)
- Total components: 355 skills, 174 agents, 221 commands, 63 MCPs, 62 settings, 41 hooks

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-10 19:03:16 -05:00
Dani e4c2275bf6 feat(hooks): Add LangSmith tracing integration
Add comprehensive LangSmith observability integration for Claude Code:

- Add langsmith-tracing hook in monitoring category
  - Runs in background with & to avoid blocking
  - Official LangSmith stop_hook.sh script (33KB)
  - Automatic trace upload to LangSmith API
  - Session grouping with thread_id for continuity

- Add langsmith-tracing setting in telemetry category
  - Environment variables with placeholders
  - Easy installation for users
  - Clear instructions for API key setup

- Add bash script support to CLI (index.js)
  - Auto-downloads .sh files with executable permissions
  - Mirrors existing Python file handling
  - Critical for hook functionality

- Update security (.gitignore)
  - Protect .claude/settings.local.json (may contain API keys)
  - Protect .claude/hooks/ directory
  - Remove settings.local.json from git tracking

- Update component catalog (62 settings, 41 hooks)

Installation:
  npx claude-code-templates@latest --hook monitoring/langsmith-tracing
  npx claude-code-templates@latest --setting telemetry/langsmith-tracing

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-09 18:45:10 -05:00