convez.ai
HookProdutividadeIntermediário
waitdeadai

Response Clock

waitdeadai/response-clock

Timestamp de parede para cada turno do Claude Code — saber quanto tempo realmente leva

Ver no GitHub
InicialPluginScore · de 0 a 100

Hook que registra timestamps de início, fim e tempo decorrido em cada resposta do Claude Code, mostrando quando o modelo terminou de pensar e quando a execução finalizou. Funciona via lifecycle hooks shell sem dependências externas, APIkeys ou runtime adicional.

Instalação

$npx convez-ai waitdeadai/response-clock

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
0
Acompanhando
0
Saúde
42%
Último commit
há 5 meses
Versão
—
Issues abertas
0
Contribuidores
1

Casos de uso

  • Monitorar duração real de turnos longos com execução autônoma
  • Correlacionar timestamp de resposta com logs do sistema
  • Debugar performance de ferramentas e modelo em execuções iterativas

Veredito

Hook minimalista e bem pensado para problema real: perder noção de tempo em turnos longos. Design fail-safe (nunca corrompe respostas) e composição limpa com outros hooks tornam viável para usuários que precisam dessa visibilidade. Sem overhead perceptível.

README

A tradução para o português deste README ainda está na fila.

response-clock

A tiny quality-of-life Claude Code plugin that frames every response with local timestamps.

response-clock stamps the wall clock at each phase of a turn:

17:07:53                         ← you submit (start)
[17:07:55] Here's the plan...    ← thinking finished, response begins
[17:09:20 · 1m 27s]              ← turn ends (end · elapsed)

No model cooperation, no API key, no runtime — just shell hooks and a per-session timestamp file. It works the same on your laptop and in Claude Code on the web.

Why

Long autonomous turns make you lose track of wall-clock time. The model can't reliably tell you when it finished thinking or finished the turn (it doesn't know its own stream instants), so response-clock measures them from the outside with lifecycle hooks. You get an honest, four-point turn timer for free.

How it works

Hook eventScriptFiresWhat it shows
UserPromptSubmitstamp-start.shyou submit a promptthe start time (and records epoch for elapsed)
MessageDisplaystamp-thinking.shfirst visible chunk of the replyprepends [HH:MM:SS] to the first line — the instant thinking ends
PreToolUsestamp-firsttool.shfirst tool call of the turntells the model “thinking finished at …” (reliable on tool-only turns)
Stopstamp-end.shthe turn endsthe end time · elapsed, then clears the session files

Notes on the design:

  • Start / end use the systemMessage channel → shown to you, never injected into the model's context.
  • Thinking uses MessageDisplay + displayContent, the only channel that can place a visible bracket at the response's first line. It is display-only (the saved transcript keeps the original text) and strictly fail-safe: it stamps once per turn and, if it can't read the chunk text, it emits nothing — your response text is never dropped or altered. MessageDisplay fires per streamed chunk, so the hook takes a near-instant fast path after the first stamp.
  • First-tool is the documented complement for tool-heavy turns; it only adds additionalContext and never changes the permission decision, so it composes with other PreToolUse hooks.
  • All four correlate via the session_id Claude Code passes on stdin, so concurrent sessions keep separate clocks.

Install

As a plugin (recommended)

# from a marketplace once published:
/plugin install response-clock@claude-community

# or test locally without installing:
claude --plugin-dir ./response-clock

Standalone (drop into any project)

Copy hooks/ into your repo and add this to .claude/settings.json:

{
  "hooks": {
    "UserPromptSubmit": [
      { "hooks": [{ "type": "command", "command": "hooks/stamp-start.sh", "timeout": 5 }] }
    ],
    "MessageDisplay": [
      { "hooks": [{ "type": "command", "command": "hooks/stamp-thinking.sh", "timeout": 3 }] }
    ],
    "PreToolUse": [
      { "hooks": [{ "type": "command", "command": "hooks/stamp-firsttool.sh", "timeout": 5 }] }
    ],
    "Stop": [
      { "hooks": [{ "type": "command", "command": "hooks/stamp-end.sh", "timeout": 5 }] }
    ]
  }
}

(chmod +x hooks/*.sh first.)

Configure

Everything is env-driven; defaults are sensible, so configuration is optional.

VariableDefaultMeaning
CMAX_CLOCK_ENABLE1master switch — 0 disables every hook
CMAX_CLOCK_SHOW_START1show the start time
CMAX_CLOCK_THINKING1prepend [time] to the first response line
CMAX_CLOCK_FIRSTTOOL1inject the “thinking finished” first-tool stamp
CMAX_CLOCK_SHOW_ELAPSED1append · <elapsed> to the end time
CMAX_CLOCK_FORMAT%H:%M:%Sstrftime for the displayed time (e.g. %H:%M)
CMAX_CLOCK_TZ(system)timezone override, e.g. America/Argentina/Buenos_Aires
CMAX_CLOCK_EMOJI0prefix the start line with 🕒
CMAX_CLOCK_START_PREFIX(empty)custom prefix for the start line
CMAX_CLOCK_END_LABEL(empty)text before the end time → [done 17:09:20 · 1m 27s]
CMAX_CLOCK_THINK_LABEL(empty)text inside the thinking bracket before the time
CMAX_CLOCK_THINK_ELAPSED0also show +<n>s since the prompt in the thinking stamp
CMAX_CLOCK_CONTEXT0also tell the model the precise start instant
CMAX_CLOCK_DEBUG0append raw MessageDisplay payloads to <data>/<sid>.msgdisplay.log

Requirements

  • bash and coreutils date (Linux or macOS).
  • jq for the thinking stamp (safe escaping of arbitrary response text); the start / end / first-tool stamps fall back to a POSIX grep/sed path when jq is absent.

License

MIT — see LICENSE.

Ver o original no GitHub

Bom para

Relacionados