DeepSeek Harness (dsh) manages the session lifecycle of agents. For developers, tracking the detailed activities of these sessions (such as code modifications, tool calls, and token consumption) is crucial for evaluating development efficiency. The existing codetime-cli provides such capabilities, but it primarily relies on adapters to connect to different Agents. As a native plugin, dsh-codetime ports this mechanism directly to the dsh platform, allowing DSH activities to be reported uniformly to codetime.dev, enabling users to view the usage of all AI tools on a single dashboard.
Plugin Introduction¶
dsh-codetime is a plugin maintained by codetime-dev, designed to provide automated coding time tracking for DeepSeek Harness. It leverages the built-in session-telemetry seam of dsh to convert dsh sessions and events into CodeTime’s standard event format and push them to the /v3/agent/ingest endpoint.
Core Features¶
- Unified Reporting: Reports session, turn, tool, file, and model activities to a single Agent ingest endpoint.
- Native Backend: Acts as a native
sessionTelemetrybackend for dsh, directly integrated into dsh’s telemetry pipeline. - Event Mapping: Maps dsh
sessionandeventtypes to CodeTime Canonical Events. - Data Flushing: Flushes aggregated data via
POST /v3/agent/ingestusing areplace: truestrategy for upsert operations.
Installation and Activation¶
This plugin is a host-plane plugin distributed as a dsh bundle. Installation requires dsh version 0.2.x.
1. Install Plugin¶
Install using the official command:
dsh plugin --profile web add dsh-codetime
2. Environment Preparation¶
sessionTelemetry operates as a singleton in dsh (one backend per process). The base bundle always mounts session-telemetry-otel. Therefore, before installing this plugin, ensure the default OTEL backend is disabled.
3. Local Development Installation (Optional)¶
If you need to test before releasing a new version, you can install via a local path:
dsh plugin --profile web add /path/to/dsh-codetime
Configuration¶
The plugin’s behavior is controlled via configuration files or environment variables. The following configuration keys are available:
| Configuration Key | Default Value | Description |
|---|---|---|
mode |
FULL (set by patch) |
Capture mode: FULL (real-time capture of all sessions), FEEDBACK_ONLY (upload only after user feedback is recorded), or DISABLED. |
apiUrl |
https://codetime.dev |
API Base URL. |
flushIntervalMs |
60000 |
Interval for flushing aggregated data (in milliseconds). |
shutdownTimeoutMs |
5000 |
Timeout for draining the buffer on shutdown (in milliseconds). |
token |
— | Bearer Token, takes precedence over environment variables and configuration files. |
Token Acquisition¶
The resolution order for the Token is: Configuration file token -> Environment variable CODETIME_TOKEN -> ~/.codetime/config.json. If you have already logged in via the CLI or another editor plugin, you can usually read this file directly.
How It Works and Event Mapping¶
The plugin drives event collection via the SessionTelemetryCoordinator and converts dsh events into CodeTime events. The following are the primary event type mappings:
dsh session/event Type |
codetime canonical event |
|---|---|
turn/start / turn/end |
turn.started / turn.completed | turn.failed |
user/message |
prompt.submitted |
assistant/message (with usage) |
model.usage |
tool/call |
tool.started |
tool/result |
tool.completed | tool.failed |
tool/result (bash/pwsh) |
command.completed | command.failed |
compaction/end |
context.compacted |
session created / disposed |
session.started / session.ended |
File Activity Mapping¶
File activities are derived from tool names and arguments:
| Tool Type | Derived Activity |
|---|---|
read, read_image |
read |
write |
write |
edit |
edit, calculating linesAdded/linesRemoved |
str_replace_editor |
view -> read, create -> write, others -> edit |
grep, glob |
search |
If a tool’s result is marked as an error, it will be classified as tool.failed and will not contribute to file activities.
Limitations and Considerations¶
- In-Memory Buffering: Event buffers are kept in memory per session and resent on every flush. Long sessions may increase memory usage.
- No Historical Backfill: This plugin only reports real-time activities observed by the current process. It cannot automatically backfill historical session data. For historical data, the
codetime-clibackfill adapter must be used. - No Deduplication Rules: The plugin does not automatically handle data deduplication; records are sent as-is (after the
session-telemetry/recordwaterfall). - Singleton Constraint: Ensure only one
sessionTelemetrybackend is mounted per process, otherwise data conflicts may occur.
Summary¶
dsh-codetime fills the gap in coding time tracking for DeepSeek Harness, enabling seamless integration with the codetime-cli ecosystem. Through standardized API endpoints and event mapping, it provides developers with a unified view to monitor the development activities of AI Agents.
- Plugin Directory: https://www.skillhub.cn/plugins/codetime-dev/dsh-codetime
- GitHub Repository: https://github.com/codetime-dev/dsh-codetime