---
title: "Cockpit"
url: "https://claudemods.dev/zh-tw/builds/cockpit-8583ce"
source: "https://github.com/drkokorev/cockpit-for-claude/tree/main/plugins/cockpit"
source_type: "github"
repo: "https://github.com/drkokorev/cockpit-for-claude/tree/main/plugins/cockpit"
author: "drkokorev"
author_handle: "drkokorev"
stars: 13
category: "儀表板與 HUD"
categories: ["hud"]
tags: ["context-monitoring", "cost-tracking", "dashboard", "guard", "hooks", "observability"]
permission_level: 2
scan_complete: true
install: "claude plugin marketplace add drkokorev/cockpit-for-claude\nclaude plugin install cockpit@cockpit-for-claude"
added: "2026-11-19T05:08:02.193Z"
updated: "2026-10-09T17:39:48Z"
locale: "zh-tw"
content_locale: "zh-tw"
---

# Cockpit

一個用於 Claude Code 的即時儀表板外掛，顯示上下文用量、速率限制、成本、子代理、工具呼叫、已變更檔案與測試執行，並附有防護機制，會在危險命令及編輯機密檔案前詢問。

## Description

Cockpit 是一個以單一無相依性的 hooks 模組實作的 Claude Code 外掛。它會呈現一個即時面板與狀態帶，涵蓋上下文用量、速率限制、成本、子代理活動、工具呼叫次數與耗時、來自 git 的已變更檔案，以及測試執行，且每個區段都可展開查看詳細資訊。它也會新增一個防護機制，攔截高風險的 Bash 命令以及對機密檔案的編輯，並在 Claude Code 自己的對話方塊中請求確認。此外掛不會發出網路請求；它只會執行本機 git 命令來產生已變更檔案與差異檢視，僅在點擊時讀取檔案內容，並在匯出時寫入單一 .cockpit/cockpit-report.md 檔案。斜線命令包括 /cockpit、/cockpit-report、/cockpit-export、/cockpit-budget、/cockpit-guard、/cockpit-cache 和 /cockpit-demo。它需要 Claude Code v2.1.287 或更新版本，並可在終端機與桌面應用程式的 Code 索引標籤中運作。

## Install

```
claude plugin marketplace add drkokorev/cockpit-for-claude
claude plugin install cockpit@cockpit-for-claude
```

## Original README

# Cockpit

A live instrument panel for Claude Code, built as a mod: context fill, rate limits, cost, subagents, tool calls, changed files and test runs, each section opening to its details, plus a guard that asks before risky commands and edits to secrets files.

Works in the Claude Code terminal and the Claude desktop app (Code tab). Requires Claude Code v2.1.287 or later.

- `/cockpit` opens the panel
- `/cockpit-demo` fills it with sample data (`/cockpit-demo off` restores yours)
- `/cockpit-report`, `/cockpit-export`, `/cockpit-budget`, `/cockpit-guard`, `/cockpit-cache`

## What it runs, reads, writes and sends

Cockpit is one hooks module, `hooks/register.tsx`, readable TypeScript with no dependencies.

**Sends: nothing.** Cockpit makes no network requests and does not send the conversation, files or any other data anywhere. Everything it reads is shown in your own Claude Code window and stays on your machine.

**Programs it starts, and why.** Only `git`, only in your project, only to show changed files:

- `git diff --numstat HEAD` (or `git diff --numstat`) and `git ls-files --others --exclude-standard`: the list of changed and new files with +/- line counts, refreshed after an edit and after each turn
- `git rev-parse --show-toplevel` and `git diff --unified=1 --no-color [HEAD] -- <file>`: the diff of one file, only when you click that file in the Files section. `<file>` is the path git itself listed

**What it reads.** Through the Claude Code mods API: the session's usage figures (context, rate limits, cost), the tool calls Claude makes and their results (to count calls, time them, size their output and spot loops), the subagent list, and the model's turns. From disk: the contents of a new file only when you click it in Files. It never reads secrets files (`.env*`, keys, credentials) and shows "contents not read" for them instead.

**What it writes.** One file, `.cockpit/cockpit-report.md` in the session's working directory, only when you run `/cockpit-export` or press Export; each export replaces it. It never writes build, settings, start-up or instruction files. All-time totals (session, turn and tool-call counts, spend) are kept in the plugin's own store on your machine; session data lives in memory and ends with the session.

**Slash commands it runs itself.** One: `/compact`, and only when you press the **Compact now** button (shown when the context is over 70% and Claude is idle).

**Commands it adds.** `/cockpit`, `/cockpit-report`, `/cockpit-export`, `/cockpit-budget`, `/cockpit-guard`, `/cockpit-cache`, `/cockpit-demo`.

**Events it hooks.** `tool.call`: counts and times each call; for a risky Bash command or an edit to a secrets file it asks you first in Claude Code's own question dialog and refuses the call only if you block it. It never changes a call's input or result. `session.compact`: reads the result of a compaction to count it and show tokens before and after; it never changes the compaction. It also listens to `session.start`, `session.measure`, `turn.start`, `turn.step` and `turn.complete` to read figures, and draws its panel and band with `ui.render`.

**About "download-and-run" patterns in the source.** The text `curl … | sh` appears in `register.tsx` only as one of the guard's detection rules: Cockpit stops such a command and asks you. Cockpit itself never downloads or runs anything.

Full documentation, screenshots and the changelog: https://github.com/drkokorev/cockpit-for-claude
