From claudalytics
Connect this project to the Claudalytics Docker stack. Configures OTel telemetry and writes the project name. Hook scripts ship with the plugin — no per-project script install.
npx claudepluginhub jimkeecn/claudalytics --plugin claudalyticsThis skill uses the workspace's default tool permissions.
**Prerequisites:**
Initializes Claude Code projects by auto-detecting Node.js frameworks from package.json and lockfiles, replaces CLAUDE.md placeholders, installs rules, hooks, and scripts.
Bootstraps .claude/ dotclaude config from template if missing, then customizes all files to match project's tech stack, conventions, and patterns. Interactive via user confirmations.
Installs and configures Manifest observability plugin for Claude agents, including telemetry setup, API key verification, gateway management, and connection troubleshooting.
Share bugs, ideas, or general feedback.
Prerequisites:
docker compose up -d from docker-stack/).Create these tasks:
Health check — Checking Docker stackDetect project name — Detecting project nameClean up legacy install — Removing old per-project hook filesCheck OTel settings — Checking OTel settingsWrite configuration — Writing configurationWrite analytics.json — Writing analytics.jsonReport — Generating reportCheck OTel Collector:
curl -sf -o /dev/null -w "%{http_code}" http://localhost:13133/
If it fails → STOP: tell the user to run docker compose up -d from docker-stack/.
Check Hooks Server:
curl -sf http://localhost:4319/health
From the response, store HOOKS_SERVER_REACHABLE, HOOKS_SERVER_VERSION, HOOKS_SCHEMA_VERSION, HOOKS_BOOTSTRAP.
If it fails → WARN (don't stop); hook events won't be captured until the server is up, but OTel metrics/traces will still flow.
Check .claude/analytics.json for project_name. If not found, check .claude/settings.local.json for OTEL_RESOURCE_ATTRIBUTES containing project.name=.
If found → ask the user: keep or detect a new name.
If not found → auto-detect:
node -e "try{console.log(require('./package.json').name)}catch(e){process.exit(1)}" 2>/dev/null \
|| git remote get-url origin 2>/dev/null | sed 's|.*/||;s|\.git$||' \
|| basename "$(pwd)"
Convert underscores to hyphens. Validate: letters, digits, hyphens only.
Always ask the user to confirm using AskUserQuestion:
Store the confirmed name as PROJECT_NAME.
Earlier versions of Claudalytics installed hook scripts into every project and wrote 26 hook entries into .claude/settings.local.json. Those are now obsolete because hooks ship with the plugin.
Remove the old script files (safe if they don't exist):
rm -f .claude/hooks/forward-hook.sh
rm -f .claude/hooks/session-start-health-check.sh
rm -f .claude/hooks/session-start-forward.sh
Read .claude/settings.local.json. In the hooks object, remove any hook entry whose command references one of the paths above, OR whose url points at http://localhost:4319/hook (legacy HTTP hooks). If removing a hook entry empties its event array, remove the event key entirely. Do not touch hook entries unrelated to Claudalytics.
Read .claude/settings.local.json.
CLAUDE_CODE_ENABLE_TELEMETRY=1, OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317, OTEL_TRACES_EXPORTER=otlp) → OTEL_MODE = skip_otel.OTEL_MODE.OTEL_MODE = replace.Read-modify-write .claude/settings.local.json. Preserve existing keys.
Skip this step entirely if OTEL_MODE = skip_otel.
If OTEL_MODE = replace, set:
CLAUDE_CODE_ENABLE_TELEMETRY = 1
OTEL_METRICS_EXPORTER = otlp
OTEL_LOGS_EXPORTER = otlp
OTEL_EXPORTER_OTLP_PROTOCOL = grpc
OTEL_EXPORTER_OTLP_ENDPOINT = http://localhost:4317
OTEL_LOG_TOOL_DETAILS = 1
OTEL_LOG_USER_PROMPTS = 1
CLAUDE_CODE_ENHANCED_TELEMETRY_BETA = 1
OTEL_TRACES_EXPORTER = otlp
OTEL_LOG_TOOL_CONTENT = 1
OTEL_METRIC_EXPORT_INTERVAL = 10000
OTEL_LOGS_EXPORT_INTERVAL = 5000
OTEL_RESOURCE_ATTRIBUTES = project.name=<PROJECT_NAME>
Write .claude/settings.local.json and read it back. Confirm:
OTEL_RESOURCE_ATTRIBUTES contains project.name=<PROJECT_NAME>.hooks references .claude/hooks/forward-hook.sh, .claude/hooks/session-start-health-check.sh, or http://localhost:4319/hook (all cleanup from Step 3 took effect).{
"project_name": "<PROJECT_NAME>",
"configured_at": "<ISO_TIMESTAMP>"
}
Add .claude/analytics.json to the project's .gitignore if not already present.
The plugin-hosted forward-hook.sh reads project_name from this file at runtime. If the file is missing, it falls back to basename "$CLAUDE_PROJECT_DIR" — meaning hook events still flow, but under the directory name.
Set ACTION for the Step 7 report: initialized if .claude/analytics.json did not exist before this run, reconfigured if it did.
Check services:
curl -sf -o /dev/null -w "%{http_code}" http://localhost:8123/ 2>/dev/null
curl -sf -o /dev/null -w "%{http_code}" http://localhost:13133/
curl -sf -o /dev/null -w "%{http_code}" http://localhost:13000/api/health
Present:
Claudalytics — Project Connected
=====================================
Project: <PROJECT_NAME>
Action: <initialized | reconfigured>
Services
ClickHouse http://localhost:8123 [STATUS]
OTel Collector http://localhost:4317 [STATUS]
Grafana http://localhost:13000 [STATUS]
Hooks Server http://localhost:4319 [STATUS]
OTel: [configured / skipped]
Hooks: declared by the Claudalytics plugin (active whenever the plugin is enabled)
Dashboard: http://localhost:13000/d/claude-otel-overview
Grafana: admin / admin
ACTION REQUIRED: Restart the Claude Code session for OTel env vars to take effect.
Mark all tasks as completed.