dsh-wakatime: Report DSH Activity to WakaTime

Introduction

Activities in DeepSeek Harness (DSH) do not automatically show up on WakaTime: WakaTime relies primarily on editor plugins to report heartbeats, while your work in DSH happens in the terminal and AI conversations. dsh-wakatime is a DSH plugin that listens to DSH events, converts them into WakaTime heartbeats, and sends them out so that DSH usage can also be tracked on the WakaTime dashboard.

What It Is

dsh-wakatime (maintained by dsh-plugin-collection) is a WakaTime heartbeat plugin for DSH. It converts internal DSH events—such as tool invocations, command executions, and AI replies—into WakaTime-compliant heartbeats and reports them to the WakaTime service. It does not modify the DSH core, does not bundle host components, and only handles event-to-heartbeat conversion and reporting.

Core Features

Event Type Mapping

  • write / edit → a heartbeat with line count and language
  • bash / pwsh → an app-category heartbeat, with the category determined by the command content
  • AI reply → an ai coding heartbeat with token usage
  • read / grep / glob → browsing category
  • web_search → researching category
  • mcp__codegraph__codegraph_explore → code reviewing category
  • mcp__langfuse__* → debugging category
  • subagent / subagent_fork / workflow / todo_write → coding category
  • ask_user_question / user message → communicating category
  • skill → learning category
  • Others → coding category

Project Name Inference

The project field of each heartbeat is automatically inferred from the following sources, in descending priority:

  • remote.origin.url in .git/config at the Git repository root
  • name in package.json in the current directory
  • Directory name

Language Inference

Language is inferred from the file extension, e.g., .py → Python, .js → JavaScript.

User-Agent & Dashboard Display

The heartbeat’s User-Agent is constructed by the plugin for identification on the WakaTime dashboard:

  • Editor/platform: dsh/<dsh-ver> (<os>-<kernel>-<arch>) <runtime> dsh-wakatime/<plugin-ver>
  • Model: placed at the beginning, e.g., deepseek/4.1-flash-eco, so the server can identify it as ai_model
  • dsh-wakatime/<ver> at the end, ensuring the server recognizes the editor as Dsh

Model names without a version number (e.g., dsh-opendesign-go, deepseek-chat) cannot have their family identified per official rules; sessions with such models will not appear on the Models dashboard.

AI Token Reporting

The three input components of TokenUsage passed in by the host are mutually exclusive: inputTokens (uncached), cacheReadTokens (cache hit), and cacheWriteTokens (cache write). The plugin reports uncached tokens to ai_input_tokens and cache-hit tokens to ai_cached_input_tokens; it does not sum them together, nor does it report cacheWriteTokens.

Bulk Reporting & Caching

  • Uses the heartbeats.bulk API for batch reporting
  • The outer response is 202; the actual results are in the per-item status codes within the responses array
  • Writes to the local cache only on send failure; drains the cache upon success
  • Concurrent flushes are serialized; only heartbeats that were not persisted are written
  • When the limit is exceeded, the oldest heartbeats are trimmed by timestamp, and a warning is issued

Compatibility

  • DSH: supported range see engines.dsh in package.json; currently covers generations 0.1.2 ~ 0.2.3 (including pre-releases)
  • Node.js: ≥ 22.19 (including 24+)
  • Platform: Windows / macOS / Linux
  • WakaTime: official wakatime.com or a compatible self-hosted service

Other Telemetry Plugins

Only one heartbeat backend should be active per profile. Do not enable dsh-wakatime simultaneously with similar plugins such as codetime.

Installation & Activation

Install:

dsh plugin --profile web add dsh-wakatime

Restart dsh web after installation for changes to take effect. Then go to Settings → WakaTime and enter your WakaTime API Key.

Other installation methods:

Install from GitHub:

dsh plugin --profile web add github:dsh-plugin-collection/dsh-wakatime

Local development install (from the plugin directory):

dsh plugin --profile web add /path/to/dsh-wakatime

Build from source and install:

cd dsh-wakatime && pnpm install && pnpm build

Configuration

All settings are under Settings → WakaTime. Changes take effect immediately upon saving—no restart required.

Item Description
API Key WakaTime API key (displayed in a password field). When left empty, falls back in order: environment variable WAKATIME_API_KEY → ~/.wakatime.cfg → cordis.patch.yml
API URL Service address; defaults to https://wakatime.com; enter your own address for self-hosted WakaTime
Proxy Address http://host:port. When empty, falls back to HTTPS_PROXY → proxy in ~/.wakatime.cfg; set to none to force direct connection
No-Proxy Addresses Comma-separated; when empty, inherits NO_PROXY. E.g., wakatime.com means direct connection to that domain
Heartbeat Interval 60000–300000 ms
Project Name / Language Leave empty for auto-detection; fill in to override
Terminal App Name Entity for command-type heartbeats; defaults to Terminal; can be set to DSH, etc.
Tracking Toggles ×3 Tool calls / User messages / AI messages
Cache Enable local cache + limit (10–1000 entries)
Debug Mode Prints more detailed logs

Verification

After installation, follow these four steps to confirm it’s working:

  1. Check the logs—after restart, you should see loaded with API key waka_****xxxx;
  2. Make DSH do something—read a file, run a command;
  3. Wait one heartbeat cycle (default 120 seconds), and the log should show a successful send;
  4. Open the WakaTime dashboard—today’s time, project, and language should all show corresponding records.

If step 3 shows no activity, check the local cache first:

wc -l ~/.dsh/wakatime/heartbeat-cache.jsonl
  • 0 lines or file not found = everything is normal (cache is only written on failure);
  • Continuously growing = send is failing; check the log for 上报失败… (report failure) messages.

Use Cases

Ideal for developers and teams who need DSH usage tracked on WakaTime, for example:

  • Wanting to see DSH project distribution, language distribution, and editor distribution on the WakaTime dashboard;
  • Needing to track token usage in AI conversations;
  • Needing to distinguish activity categories such as coding / browsing / researching / communicating.

Note: The plugin runs with the permissions of the current DSH process. It is recommended to review the source code and license before installing.

Summary

dsh-wakatime converts DSH terminal and AI conversation activity into WakaTime heartbeats, enabling DSH usage to be tracked on the WakaTime dashboard. It supports automatic project name and language detection, separate AI token reporting, bulk reporting with caching, and more—making it well-suited for scenarios that require unified DSH usage tracking.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye