⌘

Context Lens

v1.0.8AST Scan: 0 CriticalSource PublicCLI v2.1.287+ Tested

Interactive token distribution breakdown by system instructions, MCP tools, and codebase buffers.

@prompt-metrics•★1,240 stars•↓5,600 active installs•MIT License
View Source ↗
⚡Installation Specifier
$/plugin install context-lens@marketplace
ℹUninstall anytime:claude plugin uninstall context-lens@marketplace

Problem Solved & Architectural Motivation

Renders an interactive terminal breakdown showing exact token percentages consumed by system prompts, MCP tool schemas, conversation history, and project files. Alerts when prompt caching expires.

Before Execution

Zero-Time AST Interception

Evaluates tool payloads prior to kernel fork.

Scoring Model

0-100 Impact Index

Weighted heuristic scoring: files touched, git dirty state, env scope.

Non-Intrusive

Native CLI Hook

Zero proxy daemon required; hooks straight into Claude tool calls.

Lifecycle Architecture & Hook Flow

POSIX Event Engine
Step 01
Claude Plan
Prompt Inference
→
Step 02
Tool Call
tool.call Payload
→
HOOK INTERCEPT
context-lens
<18ms Heuristic
→
Step 04
OS Execution
Kernel Fork

Manifest Schema (plugin.json)

{
  "name": "context-lens",
  "version": "1.0.8"
}

Hook Implementation (register.js)

TypeScript SDK
export default function setup(lens) {
  lens.on('turn.before', (metrics) => {
    lens.ui.printContextBar({
      system: metrics.systemTokens,
      tools: metrics.mcpTokens,
      user: metrics.conversationTokens
    });
  });
}
Static Security AuditTested commit e4b91f2
0 Critical
SubprocessesClean (No Exec)
Dynamic Code (eval)Clean (0 eval)
Credential ExposureClean (0 leaks)
Network EgressZero Socket Egress
Filesystem ScopeWorkspace Bound
Read 6-Point Audit Methodology ↗

Static heuristic checks only. Not a formal commercial certification or warranty. Review source before installing.

Technical Specifications

Min CLI Versionv2.1.287+
Categorycontext-usage
Runtime Overhead< 18ms AST
LicenseMIT
Mod Publisher