Table of Contents

Getting Started

DotnetTokenKiller (DTK) is a .NET CLI proxy that reduces LLM token usage by filtering the verbose output of dotnet commands.

Prerequisites

  • .NET 10 SDK or later (full SDK, not just the runtime)
  • OS: Windows, macOS, or Linux — any platform supported by the .NET SDK
  • Shell: Works with bash, zsh, fish, PowerShell, and cmd

Installation

Install DTK as a global .NET tool:

dotnet tool install -g DotnetTokenKiller

On Linux (x64 and arm64, glibc 2.27 or later, or musl as on Alpine) and macOS on Apple silicon, this installs a natively compiled dtk that starts in milliseconds and needs no .NET runtime to run; on Linux it needs ICU (libicu, or icu-libs on Alpine), as .NET does. On Windows x64 it installs the same natively compiled dtk.exe as the command (Windows 10 1903 or later, whose own SQLite and ICU it uses), packaged as the tool's shim because the SDK writes a dtk.cmd batch file for a native tool, which Git Bash cannot run and cmd re-parses; dotnet tool run dtk, tool manifests and dnx run the package's managed build on the .NET 10 runtime instead. Windows arm64 and every other platform get the framework-dependent build, which runs on the .NET 10 runtime. The same command, dotnet tool update, tool manifests and dnx all pick the right package for the machine.

The framework-dependent build records runs on any glibc, but dtk gain cannot report them on glibc older than 2.34, because its SQLite library needs GLIBC_2.34 (ericsink/SQLitePCL.raw#674); filtering and recording still work, and the records are reported once the tool runs on a newer glibc. Only Linux architectures without a native package (32-bit ARM, for example) get that build.

To update an existing installation:

dotnet tool update -g DotnetTokenKiller

To uninstall:

dotnet tool uninstall -g DotnetTokenKiller

First Use

Prefix any supported dotnet command with dtk:

dtk dotnet build
dtk dotnet test

DTK runs the underlying dotnet command, filters the output, and prints a compact summary. For example, a successful build that normally prints restore progress, project paths, and timing becomes:

✓ dotnet build (1 project, 1.86s)

A test run with one failure strips adapter banners, license warnings, and framework internals down to:

FAILURES (1):
  SampleApp.Tests.IntentionallyFailingTests.AlwaysFails [5 ms]
    Intentional failure
    at samples/SampleApp.Tests/IntentionallyFailingTests.cs:line 8
dotnet test: 1 failed, 3 passed (1 project, 0.07s)

Supported Commands

Command Description
dtk dotnet build Build with filtered output
dtk dotnet test Test with filtered output
dtk dotnet restore Restore with filtered output
dtk dotnet clean Clean with filtered output
dtk dotnet format Format with filtered output
dtk dotnet list package List package references with filtered output
dtk dotnet publish Publish with filtered output
dtk dotnet pack Pack with filtered output
dtk pipe <subcommand> Filter output dtk did not produce (CI logs, missed invocations)
dtk log Retrieve a previous run's full output without re-running it
dtk gain Show token savings analytics
dtk reset Clear all tracking data
dtk config show Display current configuration
dtk config set Update a configuration value
dtk doctor Run self-diagnostic checks
dtk completion Print a shell completion script
dtk init Install AI agent integration artifacts (alias: dtk integrate)

Any other dotnet subcommand (e.g., dtk dotnet run) is passed through to dotnet unchanged.

Troubleshooting

dtk: command not found

The .NET global tools directory is not on your PATH. Add it:

# Linux / macOS (bash/zsh)
export PATH="$PATH:$HOME/.dotnet/tools"

# Windows (PowerShell)
$env:PATH += ";$env:USERPROFILE\.dotnet\tools"

Add the line to your shell profile (~/.bashrc, ~/.zshrc, or $PROFILE) to make it permanent.

dtk is installed but outdated

dotnet tool update -g DotnetTokenKiller

Proxy or corporate firewall errors during install

If dotnet tool install fails behind a proxy, configure NuGet to use your proxy:

# Linux / macOS
export HTTP_PROXY=http://proxy:port
export HTTPS_PROXY=http://proxy:port

# Windows (PowerShell)
$env:HTTP_PROXY = "http://proxy:port"
$env:HTTPS_PROXY = "http://proxy:port"

Then retry the install command.

The agent's hook does not rewrite dotnet commands

The hooks run dtk hook <provider>, so the agent must find dtk on its PATH. Check with:

dtk doctor

A failed hook probe names the cause: dtk missing from PATH (add ~/.dotnet/tools), or a dtk too old to know hook (dotnet tool update -g DotnetTokenKiller). A legacy Python hook means the project was set up by an older dtk; run dtk init <provider> to migrate it.

Next Steps

  • Usage Guide — all flags and command details
  • Configuration — customize behavior via CLI or JSON config
  • AI Agent Setup — integrate with Claude Code, Copilot, Gemini, Codex CLI, OpenCode, Antigravity CLI, pi, oh-my-pi, Cursor, Windsurf, Aider, or JetBrains AI