rtk-ai/rtk

Feature: Track invoking agent (Claude, Copilot, Codex, etc) in command analytics

Open

#1,314 opened on 2026年4月14日

GitHub で見る
 (1 comment) (3 reactions) (0 assignees)Rust (2,914 forks)batch import
area:clieffort-mediumenhancementhelp wantedpriority:medium

Repository metrics

Stars
 (48,085 stars)
PR merge metrics
 (平均マージ 11d 1h) (30d で 45 merged PRs)

説明

Problem

Currently, RTK tracks command runs and token savings, but does not record which assistant agent (e.g., Claude Code, GitHub Copilot, Codex CLI, Cursor, etc.) triggered each command. This makes it impossible to analyze token savings per console or model, or to understand usage patterns by agent.

Suggested Solution

  • Add an agent or agent_type field to the commands table in the tracking database.
  • Detect at runtime which agent or tool is executing the command:
    • Option 1: Use environment variables (e.g., ANTHROPIC_CLAUDE_CODE, VSCode/Cursor session IDs, etc.)
    • Option 2: Pass agent identifier from CLI or hook (preferred for reliability)
  • Update the tracking code to store this value per command record.
  • Extend rtk gain and JSON/CSV exports to provide breakdowns by agent.
  • Optionally, add a migration for existing installations.

Motivation

  • Helps users understand their RTK savings and usage per console/model/agent.
  • Enables fine-grained product analytics, troubleshooting, and filter tuning.
  • Useful for users in multi-assistant environments and organizations sharing the same tracking DB.

Prior art

Many analytics platforms distinguish the source of actions. RTK could surface similar insights for tokens and efficiency by agent.

Example output (rtk gain)

By Agent
---------------------------------
Agent         Commands   Savings
claude-code   88         34,992
codex-cli     41         15,123
opencode      22         5,554
...

Related

  • src/core/tracking.rs (schema + record fn)
  • All CLI and hook integrations

This feature would be especially useful for teams and contributors using RTK with multiple LLM coding assistants.

コントリビューターガイド