메뉴
HN
Hacker News 36일 전

CC-Canary: 클로드 코드 성능 저하 조기 감지 도구

IMP
8/10
핵심 요약

클로드 코드(Claude Code)의 세션 로그를 분석해 AI 모델의 성능 저하(Drift) 및 회귀(Regression)를 감지하는 오픈소스 에이전트 스킬입니다. 별도의 네트워크 연결이나 계정 없이 로컬에 저장된 로그만으로 마크다운 및 HTML 형태의 상세 포렌식 보고서를 생성합니다. 파일 수정 전 검토 비율, 추론 루프 횟수 등 핵심 메트릭을 추적하여 개발자가 AI 코딩 어시스턴트의 이상 징후를 조기에 파악할 수 있도록 돕습니다.

번역된 본문

cc-canary는 클로드 코드(Claude Code)를 위한 드리프트(Drift) 감지 도구로, 두 가지 설치 가능한 에이전트 스킬(Agent Skills) 형태로 제공됩니다.

이 도구는 클로드 코드가 이미 ~/.claude/projects/ 경로에 기록해 둔 JSONL 세션 로그를 읽어와서, 모델이 사용자의 작업에서 성능이 저하되고 있는지(드리프트)를 감지하고 공유 가능한 포렌식 보고서를 생성합니다. 네트워크 연결, 계정, 원격 분석(Telemetry), 백그라운드 데몬이 전혀 필요하지 않으며, 디스크에 이미 존재하는 데이터만을 사용하여 실행됩니다.

현재 상태: 0.x / pre-alpha — 출력 형식과 메트릭 세트가 변경될 수 있습니다.

제공되는 기능

  • cc-canary: /cc-canary [기간] 명령으로 실행되며, GitHub 이슈나 Gist에 바로 복사해서 붙여넣을 수 있는 포렌식 마크다운 보고서( ./cc-canary-<날짜>.md )를 생성합니다.
  • cc-canary-html: /cc-canary-html [기간] 명령으로 실행되며, 다크 테마가 적용된 HTML 대시보드( ./cc-canary-<날짜>.html ) 형태로 보고서를 생성하여 브라우저에서 자동으로 엽니다.

기간(Window)의 기본값은 60일(60d)이며, 7d / 14d / 30d / 60d / 90d / 180d 중 선택할 수 있습니다.

각 보고서에는 다음과 같은 내용이 포함됩니다:

  • 평가(Verdict) — 양호(HOLDING) / 성능 저하 의심(SUSPECTED REGRESSION) / 성능 저하 확인(CONFIRMED REGRESSION) / 결론 불가(INCONCLUSIVE)
  • 핵심 메트릭 테이블 — 이전(전)과 이후(후) 데이터 비교 (🟢/🟡/🔴 색상으로 평가 등급 표시)
  • 주간 트렌드 바 차트 — 비용(USD, ccusage와 센트 단위로 정확히 검증됨), 읽기:수정 비율, 추론 루프(reasoning loops), 턴당 토큰 수
  • 버전 간 비교 — 동일한 사용자, 다른 모델 버전 간의 비교 (작업 유형 통제)
  • 자동 감지된 변곡점 날짜(Inflection date) — 복합 건강 점수(health-score)가 급락한 시점
  • 분류된 결과(Findings) — 모델 측 / 사용자 측 / 모호한 사안으로 구분된 원인 분석
  • 부록 — 시간대별 추론 깊이, 단어 빈도 변화, 3기간에 걸친 추론 가시성 전환, 턴별 행동 비율 등

설치 방법

npx skills add delta-hq/cc-canary

개별 설치 시: npx skills add delta-hq/cc-canary --skill cc-canary npx skills add delta-hq/cc-canary --skill cc-canary-html

설치 후 클로드 코드 세션 내에서 다음과 같이 실행할 수 있습니다: /cc-canary 60d /cc-canary-html 30d

요구 사항: PATH에 python3 3.8 이상이 설치되어 있어야 합니다. cc-canary-html 자동 열기 기능은 macOS / Linux / WSL 환경에서 지원됩니다 (open / xdg-open / start 명령이 실패하면 파일 경로를 출력하는 방식으로 대체됨).

작동 방식

  1. 스캔. 내장된 Python 스크립트(표준 라이브러리만 사용하여 pip나 Node 필요 없음)가 ~/.claude/projects/**/*.jsonl 파일을 탐색하여, 지정된 기간으로 필터링하고 기본적으로 하위 에이전트 세션은 제외합니다.
  2. 중복 제거. 어시스턴트 메시지는 (message.id, requestId)를 기준으로 중복이 제거됩니다. 이는 ccusage에서 사용하는 방식과 동일하며, 세션이 재개되거나 분기될 때 클로드 코드가 동일한 메시지를 여러 JSONL 파일에 기록하기 때문입니다.
  3. 집계. 세션별 메트릭을 계산합니다: 도구 사용 비율(tool-mix), 읽기:수정 비율, 추론 루프 문구, 자체 인정한 오류, 조기 중단, 인터럽트, 토큰 사용량, 비용(현재 Claude 4.x 요금 적용), 시간대별 추론 깊이.
  4. 변곡점 감지. 일별 복합 건강 점수를 계산하고, 0.75σ(시그마) 임계값을 넘는 후보 날짜들 중 |이전 - 이후| 차이가 가장 큰 날짜를 찾습니다. 명확한 급락 시점이 없으면 중간 타임스탬프를 기준으로 분할합니다.
  5. 보고서 사전 렌더링. 스크립트가 모든 테이블과 막대 차트가 채워진 마크다운/HTML 뼈대(skeleton) 파일을 작성합니다. ( 로 표시된) 약 20개 정도의 짧은 서술란만 클로드가 채워야 하는 형태입니다. 여기에는 평가 내용, 요약, 발견 사항별 추론, 근본 원인, 부록 단락 등이 포함됩니다.
  6. 내용 채우기 및 저장. 클로드가 뼈대 파일을 읽고 서술 부분을 작성한 다음, 최종 파일을 저장합니다. 총 실행 시간은 스크립트 실행에 약 2.5초, 클로드가 내용을 작성하는 데 10~20초가 소요됩니다.

각 스킬이 추적하는 핵심 메트릭

헤드라인 테이블의 메트릭 (정상/전환/주의 필요 등급 구간이 공개되어 있음):

  • 읽기:수정 비율(Read:Edit ratio) — 파일 수정 당 읽기 횟수. 모델이 코드를 변경하기 전에 얼마나 철저히 조사하는지를 보여주는 지표입니다.
  • 수정 중 쓰기(Write) 비중 — Write / (Edit + Write). 이 비중이 높다는 것은 모델이 정밀하게 코드를 수정하는 대신 파일 전체를 다시 작성(rewrite)하고 있음을 의미합니다.
  • 1K(1,000) 툴 콜 당 추론 루프 — "let me try again(다시 해볼게)", "oh wait(잠깐만)", "actually,(사실,)"와 같은 문구의 등장 횟수입니다.
  • 좌절감(Frustration) 비율 — 사용자 프롬프트에 포함된 좌절감을 나타내는 단어의 비율입니다.
  • 사고(Thinking) 검열(Redaction) 비율 — 가려진(redacted) 사고 블록과 표시된(visible) 블록의 비율입니다.
  • 평균 사고 길이 — 추론 깊이의 간접 지표입니다. (암호화 서명 길이를 통해 측정하며, 내용이 보이는 경우 실제 콘텐츠 길이와의 상관관계가 r=0.97로 매우 높음)
  • 사용자 1회 메시지 당 API 호출 횟수 — 사용자의 메시지 1개당 모델이 응답하기 위해 몇 번의 API 호출을 수행하는지를 나타냅니다.
  • 사용자 1회 메시지 당 토큰 수 — 사용자 메시지 1개당 발생하는 총 토큰 볼륨(입력 + 출력 + 캐시)입니다.

또한 다음과 같은 추가 신호를 담은 부록이 제공됩니다: 조기 중단(premature stopping), 자체 인정한 오류(self-admitted errors), 지름길 사용(shortcuts) 등.

원문 보기
원문 보기 (영어)
cc-canary Drift detection for Claude Code , packaged as two installable Agent Skills . Reads the JSONL session logs Claude Code already writes to ~/.claude/projects/ , detects whether the model has been drifting on your own work, and produces a shareable forensic report. No network, no account, no telemetry, no background daemon. Runs on the data already on your disk. Status: 0.x / pre-alpha — output format and metric set may change. What you get Skill Invocation Output cc-canary /cc-canary [window] forensic markdown writeup ( ./cc-canary-<date>.md ) — paste-ready for GitHub issues or gists cc-canary-html /cc-canary-html [window] same report as a dark-theme HTML dashboard ( ./cc-canary-<date>.html ), auto-opens in your browser Window defaults to 60d . Accepts 7d / 14d / 30d / 60d / 90d / 180d . Each report includes: Verdict — HOLDING / SUSPECTED REGRESSION / CONFIRMED REGRESSION / INCONCLUSIVE Headline metrics table (pre vs post, with 🟢/🟡/🔴 band verdicts) Weekly trend bars — cost (USD, verified against ccusage to the cent), read:edit ratio, reasoning loops, tokens/turn Cross-version comparison — same user, different model versions, controlling for task mix Auto-detected inflection date — composite health-score break Findings with model-side / user-side / ambiguous classification Appendices — hour-of-day thinking depth, word-frequency shift, three-period thinking-visibility transition, per-turn behavior rates, and more Install npx skills add delta-hq/cc-canary Install just one: npx skills add delta-hq/cc-canary --skill cc-canary npx skills add delta-hq/cc-canary --skill cc-canary-html Then from any Claude Code session: /cc-canary 60d /cc-canary-html 30d Requirements : python3 ≥ 3.8 on your PATH. macOS / Linux / WSL for the cc-canary-html auto-open step (it falls back to printing the path if open / xdg-open / start fails). How it works Scan. A bundled Python script (stdlib only — no pip, no Node) walks ~/.claude/projects/**/*.jsonl , filters by window and excludes subagent sessions by default. Dedupe. Assistant messages are deduped on (message.id, requestId) — same scheme ccusage uses, because Claude Code writes the same message into multiple JSONLs when sessions are resumed or branched. Aggregate. Per-session metrics: tool-mix, read:edit ratio, reasoning-loop phrases, self-admitted errors, premature stops, interrupts, token usage, cost (current Claude 4.x rates), hour-of-day thinking depth. Detect inflection. Composite health score per day; argmax of |before − after| over candidate dates with a 0.75σ floor. Falls back to median-timestamp split if no break clears. Pre-render the report. Script writes a markdown / HTML skeleton with every table and bar chart filled in. Only ~20 short narrative slots (marked <!-- C: ... --> ) are left for Claude to fill — verdict line, summary, per-finding reasoning, root-cause, appendix paragraphs. Fill & save. Claude reads the skeleton, writes the narrative, saves the final file. Total runtime: ~2.5s for the script + 10–20s for Claude to fill narrative. What each skill tracks Metrics in the headline table (with published healthy/transition/concerning bands where applicable): Read:Edit ratio — file reads per edit. Proxy for how thoroughly the model investigates before mutating. Write share of mutations — Write / (Edit + Write) . High share = model rewriting files instead of surgical edits. Reasoning loops / 1K tool calls — phrases like "let me try again", "oh wait", "actually,". Frustration rate — rate of frustration words in your prompts. Thinking redaction rate — fraction of thinking blocks that are redacted vs visible. Mean thinking length — reasoning-depth proxy (via cryptographic signature length, r=0.97 with content length when visible). API turns per user turn — how many API calls the model makes per user message. Tokens per user turn — total token volume (input + output + cache) per user message. Plus appendices with additional signals: premature stopping, self-admitted errors, shortcut vocabulary, user interrupts, hour-of-day thinking depth, per-word frequency shift, three-period thinking-visibility transition, per-turn behavior rates. Skill filters & flags The script accepts flags you can pass via Bash(python3 scripts/compute_stats.py …) for custom runs: Flag Default Purpose --window {Nd} 60d Window size ( 7d / 14d / 30d / 60d / 90d / 180d ) --include-agents off Include subagent sessions (default: excluded — they have no natural user prompts) --min-user-words N 10 Drop sessions with fewer user-prompt words than this (filters trivial sessions) --render-md PATH — Write the markdown skeleton to PATH --render-html PATH — Write the HTML dashboard to PATH Privacy Fully local. Zero network calls. The script reads ~/.claude/projects/*.jsonl only. Nothing else. Narrative prose is written by Claude during the skill invocation (inside your Claude Code session); it has access only to the on-disk files you explicitly point it at. User-prompt content is truncated to ≤180 chars before being included in the skeleton, and redacted for /Users/… paths, emails, hex-like tokens. Output files ( ./cc-canary-<date>.{md,html} ) live in the directory where you invoked the skill. Nothing is uploaded anywhere. Contributing Issues, metric suggestions, and PRs welcome: github.com/delta-hq/cc-canary/issues . Output format and metric set may change during 0.x. About the name Canaries were used in coal mines to detect early signs of danger. cc-canary does the same for drift in your Claude Code sessions. License MIT