展示HN:Claudedash – Claude Code代理的实时本地仪表板
嗨,HN,
我一直在大量使用Claude Code进行自主代理工作流程,但遇到了一个持续的痛点:对正在运行的任务、卡住的任务以及每个会话的上下文溢出程度完全没有可见性。
因此,我构建了claudedash。只需一个命令:
```
npx -y claudedash@latest start
```
这将在4317端口打开一个本地仪表板。它被动监视~/.claude/tasks/(Claude Code本地写入的文件),并呈现:
- 实时看板:待处理 → 进行中 → 已完成 → 被阻塞
- 每个会话的上下文健康百分比(最后消息的token数 / 模型最大token数)
- 工作树可观察性(每个分支的代理状态)
- 计划模式:读取queue.md,渲染依赖图,同步execution.log
- MCP服务器:使Claude能够查询自己的仪表板
- 成本跟踪器、事件日志、会话历史
对于好奇的技术细节:
- 使用Fastify和chokidar构建服务器
- SSE(通过模块级单例共享一个连接)
- 基于mtime的服务器端缓存(避免不必要的文件读取)
- 静态Next.js导出,不进行服务器渲染
- 零遥测,完全本地化
上下文健康功能比预期更复杂——简单地将所有input_tokens相加会得出非常错误的数字。正确的方法是仅使用最后一条消息的token计数。
共180次提交,MIT许可证。
GitHub: [https://github.com/yunusemrgrl/claudedash](https://github.com/yunusemrgrl/claudedash)
欢迎就实现或设计决策方面的问题进行咨询。
查看原文
Hi HN,<p>I've been using Claude Code heavily for autonomous agent workflows and hit
a consistent pain point: zero visibility into what's running, what's stuck,
and how close to context overflow each session is.<p>So I built claudedash. One command:<p><pre><code> npx -y claudedash@latest start
</code></pre>
Opens a local dashboard on port 4317. It passively watches ~/.claude/tasks/
(the files Claude Code writes natively) and renders:<p>- Live Kanban: pending → in_progress → completed → blocked
- Context health % per session (last-message tokens / model max)
- Worktree observability (per-branch agent status)
- Plan Mode: reads queue.md, renders dependency graph, syncs execution.log
- MCP server: so Claude can query its own dashboard
- Cost tracker, hook event log, session history<p>Technical notes for the curious:
- Fastify + chokidar for the server
- SSE (one shared connection via module-level singleton)
- Server-side mtime-based caching (no unnecessary file reads)
- Static Next.js export, no server rendering
- Zero telemetry, fully local<p>The context health feature was trickier than expected — the naive approach
of summing all input_tokens gives wildly wrong numbers. The correct approach
is using only the last message's token counts.<p>180 commits, MIT license.<p>GitHub: <a href="https://github.com/yunusemrgrl/claudedash" rel="nofollow">https://github.com/yunusemrgrl/claudedash</a><p>Happy to answer questions about the implementation or design decisions.