← 返回 Skills 市场
furukama

Context Visualization

作者 Benedikt Koehler · GitHub ↗ · v1.0.0
cross-platform ✓ 安全检测通过
649
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install context-viz
功能描述
Visualize the current context window usage — token estimates per component (system prompt, tools, workspace files, messages, free space). Use when the user a...
使用说明 (SKILL.md)

Context Visualization

Estimate and display a breakdown of the current context window usage.

How It Works

Run the bundled script to estimate token counts for workspace files:

python3 scripts/estimate_tokens.py /path/to/workspace

The script counts characters in known workspace files and estimates tokens (~4 chars/token).

Then call session_status to get the actual context usage from OpenClaw.

Generating the Visualization

  1. Run session_status to get: model, context used/total, compactions
  2. Run scripts/estimate_tokens.py \x3Cworkspace_path> to estimate file token sizes
  3. Estimate message tokens: context_used - system_overhead - file_tokens
  4. Present the breakdown using the format below

Output Format

Use a monospace block with bar chart. Adapt the bar lengths proportionally.

📊 Context Usage
\x3Cmodel> • \x3Cused>k/\x3Ctotal>k tokens (\x3Cpct>%)

Component                    Tokens    %     
─────────────────────────────────────────────
⚙️  System prompt + tools    ~Xk      X%    ░░
📋  AGENTS.md                ~Xk      X%    ░
👻  SOUL.md                  ~Xk      X%    
👤  USER.md                  ~Xk      X%    
🔧  TOOLS.md                 ~Xk      X%    ░
💓  HEARTBEAT.md             ~Xk      X%    
🧠  MEMORY.md                ~Xk      X%    ░
🪪  IDENTITY.md              ~Xk      X%    
💬  Messages                 ~Xk      X%    ░░░░░░░░░░░░
📭  Free space               ~Xk      X%    ░░░░░
─────────────────────────────────────────────

Use ░ blocks: 1 block per ~2% of total context. Round to nearest block.

Memory Inventory (not in context)

Below the context chart, add a Memory on Disk section showing what's stored in memory/ — grouped by category. These files are NOT loaded into context but represent the agent's total knowledge base.

💾 Memory on Disk (not in context)
Category                     Files  Tokens   Size
──────────────────────────────────────────────────
📰  chinese-ai-digests        12    ~23k     92KB
📁  other                     11    ~12k     46KB
📅  daily-notes                9    ~5k      17KB
🗃️  zettelkasten               8    ~4k      15KB
💼  linkedin                   2    ~1k       5KB
──────────────────────────────────────────────────
     Total:                   42    ~44k    177KB

The script auto-categorizes files by directory or filename pattern.

Notes

  • Token estimates use ~4 chars/token (rough average for English/mixed content)
  • System prompt + tools overhead is estimated at ~8-10k tokens for a typical OpenClaw setup
  • Message tokens are the remainder after subtracting files + system overhead
  • Memory files are informational only — they show what the agent has accumulated
  • For Discord/WhatsApp: skip markdown tables, use the block format above
安全使用建议
This skill appears to do what it says: it will read the workspace files you point it at and the memory/ directory to estimate token usage and produce a local breakdown. Before running, make sure you pass a workspace path that does not contain sensitive secrets or unrelated system files (avoid pointing it at / or your home directory). The script outputs filenames, sizes, and token estimates locally — it does not contact external endpoints — but you should still review its output before sharing it. If you want extra safety, run the script on a copy of the workspace or a limited test directory first. Additionally, note that token counts are estimates (uses ~4 chars/token and a fixed system overhead value).
功能分析
Type: OpenClaw Skill Name: context-viz Version: 1.0.0 The skill 'context-viz' and its associated script `scripts/estimate_tokens.py` are designed to visualize the OpenClaw agent's context window usage and memory inventory. The `SKILL.md` provides clear, non-malicious instructions for the agent to run the local Python script and process its output. The Python script reads files from the specified workspace path and its 'memory' subdirectory to estimate token counts and file sizes, outputting this data as JSON to stdout. There is no evidence of data exfiltration, unauthorized network communication, persistence mechanisms, or execution of arbitrary commands. The file access is directly aligned with the stated purpose of analyzing workspace and memory files for token estimation, and there are no prompt injection attempts against the agent in `SKILL.md`.
能力评估
Purpose & Capability
Name and description match the actual behavior: the included script estimates token counts for named workspace files and the SKILL.md instructs calling session_status to get model/context usage. No unrelated binaries, env vars, or external services are requested.
Instruction Scope
Instructions are narrowly focused on running the bundled estimator and calling session_status. The estimator reads workspace files and the memory/ directory to produce counts and an inventory — this is necessary for the stated task but means the skill will read and report filenames, sizes, and token estimates for any files under the provided workspace path. That could expose sensitive filenames or content if you point it at a directory containing secrets; the SKILL.md does not instruct any external transmission of the data.
Install Mechanism
No install spec or external downloads. The skill is delivered with a small local Python script (no network activity or third-party packages). Risk from installation is minimal.
Credentials
No environment variables, credentials, or config paths are requested. The only required capability is read access to the workspace path you provide (and to memory/ beneath it), which is proportionate to estimating context usage.
Persistence & Privilege
The skill is not always-enabled and does not request persistent/system-level privileges or modify other skills. It runs on-demand and only reads local files when invoked.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install context-viz
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /context-viz 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release – visualize and break down current context window usage. - Estimates token usage per component: system prompt, tools, workspace files, messages, and free space. - Provides a visual, proportional bar chart in monospace format. - Includes script to estimate tokens for workspace files. - Details a "Memory on Disk" inventory, showing files not loaded into context. - Designed for user questions about context size, usage breakdown, or context fullness.
元数据
Slug context-viz
版本 1.0.0
许可证
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Context Visualization 是什么?

Visualize the current context window usage — token estimates per component (system prompt, tools, workspace files, messages, free space). Use when the user a... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 649 次。

如何安装 Context Visualization?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install context-viz」即可一键安装,无需额外配置。

Context Visualization 是免费的吗?

是的,Context Visualization 完全免费(开源免费),可自由下载、安装和使用。

Context Visualization 支持哪些平台?

Context Visualization 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Context Visualization?

由 Benedikt Koehler(@furukama)开发并维护,当前版本 v1.0.0。

💬 留言讨论