文档

tokenguard 命令参考

完整命令参考,由 tokenguard 仓库的 README 自动生成。

版本 v0.3.5 更新于 2026-11-08 ← 返回概览

快速见效

5 分钟省下架构 Token:scan → mcp lazy
拆分离题的对话:chats drift → chats compact
设定支出上限:budget set → CI 门禁

快速开始

terminal
git clone <repo> tokenguard && cd tokenguard
npm install
node bin/tokenguard.js scan
node bin/tokenguard.js mcp audit --probe
node bin/tokenguard.js chats list
node bin/tokenguard.js docs index --write

命令参考

CLI 参考保留英文,便于与 --help 和源码逐项核对。命令名称与参数在各语言下完全一致。
tokenguard scan Overview: harnesses, chats, MCP overhead, dead projects, docs problems
tokenguard chats list List chats with sizes and token counts
tokenguard chats digest <id> Auto digest of a chat (no LLM): requests, files, commands
tokenguard chats rename <id> "Название" Rename a chat by meaning using the native session/title event
tokenguard chats archive <id> Archive or delete a chat with a tar backup
tokenguard chats clean --older-than 30 Find and remove chats older than N days
tokenguard chats drift [--all] Topic drift detector: where the conversation moved on and a new chat would pay off
tokenguard chats compact <id> Compress the early part of a chat into a digest for a fresh one
tokenguard chats tools <id> Repeated identical tool calls: how many times and how many tokens wasted
tokenguard report [--days 7] Token profiler by day, session and tool, with cost estimates
tokenguard budget set/status/check Daily and weekly token budget plus overrun checks
tokenguard guard install/status/check Context-economy rule in AGENTS.md and topic drift checks
tokenguard artifacts list Everything tokenguard created: backups, digests, lazy proxies, archives
tokenguard artifacts clean --all Safely delete tokenguard artefacts (dry-run by default)
tokenguard mcp audit [--probe] Discover MCP configs, count tools and schema tokens, show real usage
tokenguard mcp lazy <server> Generate a lazy proxy: 2 tools instead of all of them, started on demand
tokenguard mcp lazy --all [--apply] [--apply-dsh] Convert every stdio server to lazy mode; --apply-dsh patches the DSH profile
tokenguard projects scan Dead and unfinished repositories judged by git metrics
tokenguard projects archive <path> git bundle + tar + manifest, optionally moved to the archive
tokenguard docs index Build INDEX.md: headings, summaries, duplicates, orphans, stale files
tokenguard docs check Broken links, conflicting values (ports/versions), duplicated text, stale "as of" dates

安全原则

  • Dry-run по умолчанию. Изменения только с --apply.
  • Бэкап перед изменением. Всё сохраняется в ~/.tokenguard/backups.
  • Живые сессии не трогаются. Если файл сессии изменён <2 минут назад — нужен --force.
  • Никакой сети без флагов. Конспекты строятся локально, без LLM.
  • Честные эвристики. docs check — не «истина в последней инстанции», а подсказки;

懒加载 MCP 实践

terminal
node bin/tokenguard.js mcp lazy safari --probe
← 返回概览

GitHub · 更新日志 更新日志 →