Integration · Claude Code

rightmodeler + Claude Code

rightmodeler runs inside the tool that wrote the traces. Claude Code already keeps every session on disk, so the audit starts with no export step, no SDK, and no re-instrumentation.

Trace source · dedicated adapter

TL;DR

rightmodeler is itself a Claude Code skill, and Claude Code already writes every session to ~/.claude/projects as JSONL, so there is no export step at all. A dedicated adapter folds each assistant turn into a per-step schema, replays the successful ones through cheaper models on OpenRouter, and judges every candidate against the output you already accepted.

How it works with Claude Code

01 · Locate

Your traces are already on disk

Claude Code writes every session to ~/.claude/projects/<encoded-path>/*.jsonl as it runs, one folder per project, one JSONL file per session. There is nothing to export and no SDK to add; the audit starts from files you already have.

02 · Ingest

Each assistant turn becomes a step

The ingester recognizes Claude Code JSONL by its parentUuid and type/message keys, then folds each assistant turn into one step: plain turns become LLM steps, turns with tool_use blocks become agent steps, and every tool_result from a later user turn is joined back to the call that produced it.

03 · Replay + judge

Cheaper candidates, judged against what you accepted

Single-shot steps replay through cheaper OpenRouter models on the exact inputs from the log, and a judge from a different model family scores each candidate against the output you already accepted, with a quality floor of 0.90 by default. Steps that call tools are confirmed by re-running the work end-to-end in a throwaway git worktree with the candidate injected.

04 · Approve

A per-step report you approve

The report lists each proposed swap with its evidence and confidence, and the TUI walks you through approve, reject, or hold, per step, never all-or-nothing. Weak evidence means abstain, and sessions that touch deploys, secrets, or migrations are flagged and left alone.

Setup

Install once and the skill runs inside the tool that wrote the traces. Sessions live at ~/.claude/projects; point the skill at the whole directory, one project folder, or a single session file.

# install the rightmodeler skill

# your sessions are already on disk, one folder per project

# inside Claude Code, run the audit on your own session logs

What rightmodeler reads from Claude Code

Every run is folded into one per-step schema, the same one the replay and the judge run on.

normalized schema ← Claude Code
step kindtype + content block type
modelmessage.model
input messagesmessage.content[]
tool callstool_use blocks
tool resultstool_result / toolUseResult
step lineageuuid / parentUuid
token usageusage.*_tokens
success signalis_error
cost baselinemodel + tokens via OpenRouter pricing

autodetected by: type · message.content[].tool_use · parentUuid

Use cases

Find out which turns earn the frontier model

Every assistant turn carries its model and token usage. The audit replays the single-shot ones through cheaper candidates and reports, per step family, where the big model is earning its price and where a smaller one held at the quality floor.

Put a per-step price on a session

The session log carries token counts (including cache reads and writes) and rightmodeler turns them into per-step dollars using the recorded model and OpenRouter pricing, so the report shows where spend concentrates before it proposes anything.

Audit an agent built on Claude Code

If your team ships automation on headless Claude Code (CI jobs, hooks, subagent fan-outs) the session logs are already complete traces. The audit reads them as-is, so a coding agent gets right-sized without standing up an observability stack first.

The honest part

  • It reads the JSONL session logs already on disk; it does not watch live sessions, and it never changes which model Claude Code uses; applying a swap stays your decision.
  • Coding turns are dense with tool calls, and tool-calling steps are never judged from the trace alone. They are confirmed by re-running the work end-to-end in a throwaway git worktree, and where that is not possible, the audit abstains.
  • Steps that touch high-risk territory (auth, payments, migrations, deploys, secrets) are flagged and left on the current model, whatever the replay says.
  • It is a report, not a gateway. Claude Code keeps calling its provider directly; rightmodeler never sits in the request path.

Frequently asked questions

Where does Claude Code keep its session logs?

In ~/.claude/projects, with one folder per project (the project path is encoded into the folder name) and one JSONL file per session. Point the skill at a single file, one folder, or the whole directory; the format is autodetected.

Do I need to export my traces first?

No, this is the one integration with no export step. rightmodeler is itself a Claude Code skill, so it runs inside the tool that wrote the logs and reads them straight off disk.

Does my code leave my machine?

Replays send step inputs (which for a coding session include your prompts and code) to candidate models through OpenRouter with your own API key, the same shape of call Claude Code already makes to its provider. There is no rightmodeler server and no account; nothing else holds your traces.

Will it always find savings?

No, and that's deliberate. Coding turns lean hard on tool calls, so plenty of steps resist single-shot replay; when the evidence is weak or a step is high-risk, the audit abstains and the current model stays. A tool that always finds a swap is not measuring anything.

Can it switch the model my sessions use?

No. It is a report: per-step verdicts with evidence attached. If a cheaper model holds at the quality floor for a step family, changing the model setting is your move, nothing changes without your approval.

Does it work on headless (claude -p) runs?

Yes. Headless runs write the same JSONL session format to the same directory, so the adapter reads them identically, and CI-driven Claude Code pipelines are the best-fit case, because they can be re-run end-to-end to confirm tool-calling steps.

Run the audit on your own traces

The skill is free on GitHub. One command installs it; your Claude Code traces do the rest.

View on GitHub