Agent Skills › nanocoai/nanoclaw › add-dashboard

add-dashboard

GitHub

为NanoClaw添加本地监控仪表盘,集成npm包与推送器,实现数据收集、日志实时展示及系统重启配置。

.claude/skills/add-dashboard/SKILL.md nanocoai/nanoclaw

Trigger Scenarios

需要为项目添加监控仪表板功能 配置实时日志和Agent活动监控

Install

npx skills add nanocoai/nanoclaw --skill add-dashboard -g -y
More Options

Non-standard path

npx skills add https://github.com/nanocoai/nanoclaw/tree/main/.claude/skills/add-dashboard -g -y

Use without installing

npx skills use nanocoai/nanoclaw@add-dashboard

指定 Agent (Claude Code)

npx skills add nanocoai/nanoclaw --skill add-dashboard -a claude-code -g -y

安装 repo 全部 skill

npx skills add nanocoai/nanoclaw --all -g -y

预览 repo 内 skill

npx skills add nanocoai/nanoclaw --list

SKILL.md

Frontmatter
{
    "name": "add-dashboard",
    "description": "Add a monitoring dashboard to NanoClaw. Installs @nanoco\/nanoclaw-dashboard and a pusher that sends periodic JSON snapshots."
}

/add-dashboard — NanoClaw Dashboard

Adds a local monitoring dashboard showing agent groups, sessions, channels, users, token usage, context windows, message activity, and real-time logs.

Architecture

NanoClaw (pusher)              Dashboard (npm package)
┌──────────┐    POST JSON      ┌──────────────┐
│ collects │ ────────────────→ │ /api/ingest  │
│ DB data  │   every 60s       │ in-memory    │
│ tails    │ ────────────────→ │ /api/logs/   │
│ log file │   every 2s        │   push       │
└──────────┘                   │ serves UI    │
                               └──────────────┘

Steps

1. Install the npm package

pnpm install @nanoco/nanoclaw-dashboard

2. Copy the pusher module and its tests

Copy all three resource files into src/. The tests ship with the skill and run against the composed project — they're how you confirm the skill works and is wired in correctly.

.claude/skills/add-dashboard/resources/dashboard-pusher.ts       → src/dashboard-pusher.ts
.claude/skills/add-dashboard/resources/dashboard-pusher.test.ts  → src/dashboard-pusher.test.ts
.claude/skills/add-dashboard/resources/dashboard-wiring.test.ts  → src/dashboard-wiring.test.ts
  • dashboard-pusher.test.ts — behavior: starts the pusher, posts a real snapshot to a fake dashboard.
  • dashboard-wiring.test.ts — the code edit in step 3: asserts (via the TS AST) that index.ts dynamically imports ./dashboard-pusher.js and awaits startDashboard() as colocated statements of main(), after DB init and before the boot-complete log. Delete or misplace the edit and this goes red.

3. Wire into src/index.ts

This is the skill's one integration point, and it's deliberately minimal and self-contained: all the startup logic lives in dashboard-pusher.ts, and the import is colocated with the call so the whole edit is a single block in one place — there's no separate top-of-file import to add (or to remember to remove).

Add this block inside main(), just before the log.info('NanoClaw running') line:

  // Dashboard (optional; no-ops without DASHBOARD_SECRET)
  const { startDashboard } = await import('./dashboard-pusher.js');
  await startDashboard();

startDashboard() reads DASHBOARD_SECRET/DASHBOARD_PORT itself and no-ops if the secret is unset, so nothing else in core needs to change.

4. Add environment variables to .env

DASHBOARD_SECRET=<generate-a-random-secret>
DASHBOARD_PORT=3100

Generate the secret: node -e "console.log('nc-' + require('crypto').randomBytes(16).toString('hex'))"

5. Build, test, and restart

Run from your NanoClaw project root:

pnpm run build
pnpm exec vitest run src/dashboard-pusher.test.ts src/dashboard-wiring.test.ts   # behavior + wiring
source setup/lib/install-slug.sh
systemctl --user restart $(systemd_unit)              # Linux
# or: launchctl kickstart -k gui/$(id -u)/$(launchd_label)  # macOS

Run build before the tests: it's what guards the @nanoco/nanoclaw-dashboard dependency. dashboard-pusher.ts reaches the package through await import('@nanoco/nanoclaw-dashboard'), so if step 4 was skipped, pnpm run build fails with TS2307: Cannot find module. The behavior test deliberately mocks that package — its startDashboard binds a real dashboard port, a side effect we don't want in a test — so the test alone would pass with the dependency missing. Build is therefore the leg that verifies the dependency is installed; keep it ahead of the tests in the validate step.

6. Verify (runtime smoke check)

Once the service is restarted, confirm the dashboard is live:

curl -s http://localhost:3100/api/status
curl -s -H "Authorization: Bearer <secret>" http://localhost:3100/api/overview

Open http://localhost:3100/dashboard in a browser.

Dashboard Pages

Page Shows
Overview Stats, token usage + cache hit rate, context windows, activity chart
Agent Groups Sessions, wirings, destinations, members, admins
Sessions Status, container state, context window usage bars
Channels Live/offline status, messaging groups, sender policies
Messages Per-session inbound/outbound messages
Users Privilege hierarchy: owner > admin > member
Logs Real-time log streaming with level filter

Troubleshooting

  • "No data yet": Wait 60s for first push, or check logs for push errors
  • 401 errors: Verify DASHBOARD_SECRET matches in .env
  • Port conflict: Change DASHBOARD_PORT in .env
  • No logs: Check logs/nanoclaw.log exists

Removal

Reverse the apply steps. Safe to re-run even if some pieces are already gone.

rm -f src/dashboard-pusher.ts src/dashboard-pusher.test.ts src/dashboard-wiring.test.ts
pnpm uninstall @nanoco/nanoclaw-dashboard 2>/dev/null || true

Then, by hand, remove the single dashboard block the skill added to main() in src/index.ts (the // Dashboard (optional…) comment, the await import('./dashboard-pusher.js') line, and the await startDashboard(); call), and remove DASHBOARD_SECRET and DASHBOARD_PORT from .env.

pnpm run build

Version History

  • 882305e Current 2026-08-20 09:40

Same Skill Collection

.claude/skills/add-anydoc/container-skills/convert-documents-to-markdown/SKILL.md
.claude/skills/add-anydoc/SKILL.md
.claude/skills/add-atomic-chat-tool/SKILL.md
.claude/skills/add-clidash/SKILL.md
.claude/skills/add-codex/SKILL.md
.claude/skills/add-deltachat/SKILL.md
.claude/skills/add-dial-number/SKILL.md
.claude/skills/add-dial/SKILL.md
.claude/skills/add-emacs/SKILL.md
.claude/skills/add-imessage/SKILL.md
.claude/skills/add-iron-proxy/SKILL.md
.claude/skills/add-karpathy-llm-wiki/SKILL.md
.claude/skills/add-linear/SKILL.md
.claude/skills/add-macos-statusbar/SKILL.md
.claude/skills/add-mattermost/SKILL.md
.claude/skills/add-mnemon/SKILL.md
.claude/skills/add-ollama-provider/SKILL.md
.claude/skills/add-ollama-tool/SKILL.md
.claude/skills/add-onecli/SKILL.md
.claude/skills/add-opencode/SKILL.md
.claude/skills/add-resend/SKILL.md
.claude/skills/add-rtk/SKILL.md
.claude/skills/add-signal/SKILL.md
.claude/skills/add-tavily-tool/SKILL.md
.claude/skills/add-teams/SKILL.md
.claude/skills/add-vercel/container-skills/vercel-cli/SKILL.md
.claude/skills/add-vercel/SKILL.md
.claude/skills/add-wechat/SKILL.md
.claude/skills/add-whatsapp-cloud/SKILL.md
.claude/skills/add-whatsapp/SKILL.md
.claude/skills/customize/SKILL.md
.claude/skills/debug/SKILL.md
.claude/skills/init-first-agent/SKILL.md
.claude/skills/init-onecli/SKILL.md
.claude/skills/manage-channels/SKILL.md
.claude/skills/manage-mounts/SKILL.md
.claude/skills/migrate-from-openclaw/SKILL.md
.claude/skills/migrate-from-v1/SKILL.md
.claude/skills/migrate-memory/SKILL.md
.claude/skills/migrate-nanoclaw/SKILL.md
.claude/skills/migrate-slack-agents/SKILL.md
.claude/skills/setup/SKILL.md
.claude/skills/slack-a2a-rooms/SKILL.md
.claude/skills/slack-agent-flow/SKILL.md
.claude/skills/update-nanoclaw/SKILL.md
.claude/skills/update-skills/SKILL.md
container/skills/agent-browser/SKILL.md
container/skills/frontend-engineer/SKILL.md
container/skills/onecli-gateway/SKILL.md

Metadata

Files
0
Version
5e4f4b7
Hash
f44df22f
Indexed
2026-08-20 09:40

ホーム - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-29 02:01
浙ICP备14020137号-1