Claude Code side calls: use --safe-mode so the judge and proposer don't load the user's customizations

Aperta
#162 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@dhruv1220 ci sta già lavorando.

Dal 7/11/2026.

  • #163 di @dhruv1220 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Read sidecall.claude_call and the existing claude_flags() detection for --no-session-persistence. Add the conditional --safe-mode flag to side-call invocations, keeping the measure and refresh-catalog probes unchanged. Check the side-call tests and verify behavior with and without the flag in claude --help; done when only supported Claude Code versions receive the flag and both probes still load customizations.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Context

Since #89, sidecall.claude_call runs claude -p --output-format json --max-turns 1 --tools "" --model haiku
with --strict-mcp-config and an empty MCP config, which removed the MCP cost. The call still loads everything
else from the user's setup: CLAUDE.md files, installed plugins and their SessionStart / UserPromptSubmit
hooks, skills, output styles.

On a setup with a shared team config (rtk, caveman, ponytail, a few plugins, a UserPromptSubmit classifier
hook), te toolprune measure reports a lean prompt of ~26k tokens for an empty Claude Code session (Claude Code
2.1.319, Linux). Each judge or proposer call pays that context, and the user's hooks run inside it: a
SessionStart hook that starts background updates, or plugins that inject style instructions into the reply,
can change both the cost and the shape of the JSON answer the plugin parses.

Proposal

Add --safe-mode to the Claude Code side-call flags when claude --help lists it, the same way
claude_flags() already detects --no-session-persistence. claude --help describes it as "Start with all
customizations (CLAUDE.md, skills, installed plugins, hooks, MCP servers, custom commands and agents, output
styles, workflows, …) disabled". TE_SIDECALL=1 would still be useful for older Claude Code versions without the
flag.

The measure and refresh-catalog probes should keep loading the user's setup: they measure the real session.

Environment

TokenEconomizer 0aa2aca, Claude Code 2.1.319, Linux, Python 3.14.

Lingua principale
Python
Stelle
5.6k
Fork
344
Merge medio
14h 41m
PR unite (30g)
54

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/TokenEconomizer

Tutte le issue di microsoft/TokenEconomizer

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.