npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tokencap

v0.8.0

Published

AI Project Intelligence Platform — agent skill packs, architecture analysis, risk maps, review rules, tech stack detection, context retrieval, interactive code graphs, change intelligence, debug handoff, and token-budgeted context packs from the CLI or VS

Readme

TokenCap

Turn your repository into agent-ready intelligence.

TokenCap is an AI Project Intelligence Platform. It analyzes your repository and automatically generates an Agent Skill Pack — teaching an AI agent your architecture, coding conventions, review rules, risk areas, and critical files before it touches a single line of code.

It also retrieves smart context from natural language questions, generates compressed context packs, builds interactive code graphs, and delivers change intelligence — all from the CLI, all offline, all static.

No server. No database. No build step. Just files.


What's New in v0.8

Agent Intelligence Engine — TokenCap evolves from context generator to AI Project Intelligence Platform.

  • tokencap agent — the flagship command. Analyzes the repository and generates a complete Agent Skill Pack that teaches an AI agent your project's architecture, coding rules, risk areas, review groups, and tech stack — automatically, with no manual setup.
  • 8-phase intelligence pipeline — Tech Stack → Architecture → Project Rules → Risk Map → Review Groups → Agent Skills → Agent Pack → Machine-readable JSON.
  • agent-pack.md — a single paste-ready file for ChatGPT, Claude, Gemini, Cursor, Windsurf, Cline, Roo Code, and OpenHands.
  • agent.json — structured machine-readable output with agentInjectHooks for future --inject integrations (v0.9+).
  • Mode flags--full, --architecture, --rules, --skills for focused generation.
  • Zero new dependencies — built entirely on top of the existing Graph, Diff, Memory, and Pack engines.
  • 9-command CLI — added agent to the existing 8 commands.

What's New in v0.7

Smart Retrieval Engine — TokenCap moves from "generate context" to "retrieve the right context automatically."

  • tokencap ask "question" — Ask a natural language question about your codebase and TokenCap finds only the relevant files, builds a focused context package, and generates a suggested AI prompt.
  • tokencap context <topic> — manual context generation by topic keyword (auth, payments, dashboard, etc.).
  • Multi-source retrieval — searches across Graph (clusters, dependencies), Memory (tasks, issues), Diff (recent changes), and Impact (risk, connectivity) to rank files by relevance.
  • Auto-mode detection — questions like "debug login redirect" auto-detect debug mode; "review payment flow" auto-detects review mode; "explain dashboard architecture" auto-detects architecture mode.
  • Graph BFS traversal — finds not just directly matching files, but their dependencies and dependents up to 2 hops away.
  • Token-budgeted output — reuses the pack engine's budget system to include full content, outlines, or summaries based on a configurable token budget.
  • Prompt generation — automatically generates a suggested AI prompt alongside the context.
  • 8-command CLI — added ask and context to the existing 6 commands.

What's New in v0.6

Graph Intelligence Upgrade — TokenCap Graph is no longer a dependency visualizer. It's a code intelligence graph.

  • Obsidian-style interactive viewertokencap graph --open opens a dark-mode, three-panel graph with hover highlights, local graph mode, cluster filtering, and a right-side node inspector.
  • 13 node types — route, api, component, controller, service, database, middleware, config, utility, hook, package, test, unknown — each with their own color.
  • 4-tier risk scoring — CRITICAL / HIGH / MEDIUM / LOW — applied to every node based on connectivity, type, and change status.
  • Graph presets--full, --minimal, --quiet replace the need to combine multiple flags.
  • Cluster detection — files auto-grouped into Authentication, Payments, Dashboard, Database, API, Frontend, Config, Testing, Utilities.
  • TOKENCAP.md graph summary — a ## Project Graph Summary section is injected into your main snapshot after every graph run.
  • 6-command CLI — simplified from 14 commands to 6: make, graph, diff, debug, pack, watch. Debug sub-commands unified into tokencap debug --start / --end / --log.

What's New in v0.5

  • AI Context Packing (tokencap pack) — token-budgeted context compressor using AST analysis and git history. Modes: review, debug, architecture, minimal.
  • Interactive Graph Viewertokencap graph --open with Cytoscape.js.
  • AI Architecture Summarytokencap graph --ai generates a narrative of your subsystems.
  • Graph Structural Diffingtokencap graph --diff compares current vs previous graph.
  • JSON Exporttokencap graph --json for custom integrations.

What's New in v0.4

  • AI Change Intelligence Engine — semantic risk analysis, breaking change detection, endpoint capture.
  • tokencap diff with --staged, --last, --pr, --prompt, --json flags.

What's New in v0.3

  • AI Debug Handoff Mode — captures error logs, stack traces, investigation order, and timeline.
  • Auto-capture from failing commands, auto-populated suspected files.

What's New in v0.2

  • Project Knowledge Graph (TOKENCAP_GRAPH.md) — import/export relationships.
  • Context Memory Layer (TOKENCAP_MEMORY.md) from editable .tokencap-notes.md.

Getting Started

npm install -g tokencap

Then run from any JS/TS project root:

Teach an AI agent your entire project (v0.8)

tokencap agent --full

Generates .tokencap/agent/agent-pack.md — paste it into any AI system. The agent immediately knows your architecture, conventions, risk areas, and critical files.

Ask a question about your codebase (v0.7)

tokencap ask "How does authentication work?"

TokenCap scans your project, finds the relevant auth files, and generates a focused context package at .tokencap/context/auth-context.md — ready to paste into any AI tool.

Or generate a full snapshot

tokencap make

This generates TOKENCAP.md, TOKENCAP_GRAPH.md, and TOKENCAP_MEMORY.md in one shot.

To open the interactive graph viewer:

tokencap graph --open

The 9 Commands

| Command | What it does | |---|---| | tokencap agent | Generate Agent Intelligence Pack (v0.8 — flagship) | | tokencap ask | Smart context retrieval from a question (v0.7) | | tokencap context | Build focused context for a topic (v0.7) | | tokencap make | Full snapshot: TOKENCAP.md + graph + memory | | tokencap graph | Code knowledge graph (see modes below) | | tokencap diff | Change intelligence & risk analysis | | tokencap debug | Debug session management | | tokencap pack | AI-optimized context pack (token budget) | | tokencap watch | Auto-regenerate on file save |


Agent Intelligence

Generate project-specific intelligence for AI agents.

Instead of manually explaining your architecture, conventions, and review rules every time:

tokencap agent

TokenCap automatically creates an Agent Skill Pack — a complete intelligence document your AI agent can read before starting work.

Before v0.8                          After v0.8
─────────────────────────────────    ─────────────────────────────────
Developer                            Repository
  → Explains project to AI             → TokenCap analysis
  → AI starts work                      → Agent Skill Pack
                                        → AI agent starts work
                                             with full project knowledge

Modes

tokencap agent                   # Generate all 8 intelligence files
tokencap agent --full            # All files + console summary
tokencap agent --architecture    # Architecture + tech stack only
tokencap agent --rules           # Rules + review rules only
tokencap agent --skills          # Skills + agent-pack only

What gets generated

.tokencap/agent/
  agent-pack.md      ← Paste this into any AI system
  agent.json         ← Machine-readable (future --inject integrations)
  skills.md          ← Primary AI skill document
  architecture.md    ← Architecture layers + critical chains
  rules.md           ← Folder conventions + tech-specific rules
  review-rules.md    ← Which files to review together and why
  risk-map.md        ← CRITICAL / HIGH risk areas with explanations
  tech-stack.md      ← Detected languages, frameworks, databases, etc.

What the agent learns

Running tokencap agent --full generates enough intelligence for an AI agent to understand:

| Intelligence | Source | |---|---| | Architecture style (Frontend → API → Service → Database) | Graph engine | | Tech stack (Next.js, Prisma, Stripe, Jest...) | Manifest files | | Folder conventions (services = business logic, etc.) | Graph + heuristics | | Critical files (highest import connectivity) | Graph enrichment | | Risk areas (CRITICAL / HIGH clusters) | Graph + Diff engines | | Review groups (which files must be reviewed together) | Graph edges | | Coding rules (ORM rules, auth patterns, test conventions) | Tech stack + structure |

Example output — skills.md

# Agent Skills — my-app

You are working on a **Next.js** project.

## Core Features
- Authentication
- Dashboard
- Payments
- Notifications

## Architecture

Frontend → API → Service → Database


## Project Conventions
- Business logic belongs in services
- Controllers should remain thin — delegate to services
- Database access must use Prisma — raw SQL is not allowed
- Authentication uses NextAuth.js — auth logic belongs in authOptions

## Important Files
- src/services/authService.ts
- src/middleware/auth.ts
- prisma/schema.prisma

## High-Risk Areas
- 🔴 Authentication — CRITICAL
- 🟠 Database — HIGH
- 🟠 Middleware — HIGH

Example output — review-rules.md

## Authentication Review Group

**Risk:** 🔴 CRITICAL

**Reason:** Shared dependency chain (6 files). Central file: authService.ts
with 8 importers. Changes here carry CRITICAL risk.

**Review Together:**
- src/pages/login.tsx
- src/api/auth/route.ts
- src/controllers/authController.ts
- src/services/authService.ts
- prisma/schema.prisma

Future — --inject (v0.9+)

The agent.json output includes an agentInjectHooks key reserved for:

tokencap agent --inject cursor      # Inject into Cursor rules
tokencap agent --inject claude      # Inject into Claude projects
tokencap agent --inject roocode     # Inject into Roo Code memory
tokencap agent --inject openhands   # Inject into OpenHands

Not yet implemented — planned for v0.9.


tokencap ask

The flagship command of v0.7. Ask a natural language question and get a focused context package.

tokencap ask "How does authentication work?"
tokencap ask "Explain invoice generation"
tokencap ask "debug login redirect"           # Auto-detects debug mode
tokencap ask "review payment flow"             # Auto-detects review mode

How it works

Your question
  → Extract keywords ("auth", "login", "jwt")
  → Match to clusters (Authentication)
  → Score all files using Graph + Memory + Diff + Impact
  → BFS: find dependencies & dependents (up to 2 hops)
  → Rank by composite relevance score
  → Allocate token budget (default: 12,000)
  → Generate context.md + prompt.md

Options

tokencap ask "question" --mode review       # Override auto-detected mode
tokencap ask "question" --budget 15000      # Custom token budget (default: 12000)
tokencap ask "question" --json              # Also export context.json
tokencap ask "question" --no-prompt         # Skip prompt.md generation

What modes mean

| Mode | Auto-detected by | Focus | |---|---|---| | architecture | "explain", "how", "overview", "structure" | System design, flows, dependencies | | review | "review", "check", "verify", "audit" | Code quality, risk areas, recent changes | | debug | "debug", "fix", "bug", "error", "broken" | Error context, suspected files, stack traces |

Generates:

  • .tokencap/context/<topic>-context.md — focused context with overview, main files, flow, risk areas, recent changes, and file content
  • .tokencap/context/<topic>-prompt.md — suggested AI prompt tailored to the topic
  • .tokencap/context/<topic>-context.json — machine-readable retrieval results (with --json)

tokencap context

Manual context generation by topic keyword. Same engine as ask, but takes a topic instead of a question.

tokencap context auth                        # Build auth-context.md
tokencap context payments                    # Build payment-context.md
tokencap context dashboard                   # Build dashboard-context.md
tokencap context graph                       # Build graph-context.md

Options

tokencap context auth --prompt               # Also generate prompt.md
tokencap context auth --json                 # Also export context.json
tokencap context auth --budget 8000          # Custom token budget
tokencap context auth --mode review          # Override mode

tokencap make

Generates the complete TokenCap snapshot in one command.

tokencap make                    # Full snapshot (balanced profile)
tokencap make --profile deep     # Deep capture (more files)
tokencap make --no-diff          # Skip git diff snippets
tokencap make --no-contents      # Structure only, no file contents

Generates:

  • TOKENCAP.md — main snapshot (files, Git status, diffs, TODOs, redacted secrets)
  • TOKENCAP_GRAPH.md — dependency graph markdown
  • TOKENCAP_MEMORY.md — developer context memory

tokencap graph

The graph command has four preset modes:

Standard (default)

tokencap graph

Generates: graph-data.json, nodes.json, edges.json, graph-map.md, ai-graph-summary.md

Updates: TOKENCAP.md with a ## Project Graph Summary section.

No browser opens.


Open Mode

tokencap graph --open

Same as standard, then opens .tokencap/graph/graph.html in your default browser.


Full Mode

tokencap graph --full

Runs everything: JSON export + AI summary + graph diff + HTML viewer + opens browser.

Equivalent to combining --json --ai --diff --open.


Minimal Mode

tokencap graph --minimal

Generates only graph-data.json, nodes.json, edges.json. No HTML, no AI summary, no diff. Fastest.


Quiet Mode

tokencap graph --quiet

Any mode, suppressed logs. Only shows:

Graph generated successfully

Nodes:             284
Edges:             812
Clusters:          14
High Impact Files: 9

Additional flags

tokencap graph --diff     # Generate graph-diff.md + graph-diff.json vs last run
tokencap graph --ai       # Generate AI narrative summary only
tokencap graph --json     # Export JSON files only

The Graph Viewer

Running tokencap graph --open or tokencap graph --full opens graph.html — a self-contained, offline-capable Obsidian-style graph viewer.

Three-Panel Layout

┌─────────────┬──────────────────────────┬─────────────┐
│ Filters     │      Graph Canvas         │ Node Info   │
│ Clusters    │   zoom / pan / drag       │ Type        │
│ Graph Mode  │   hover highlights        │ Cluster     │
│ Stats       │   click to inspect        │ Importance  │
│             │                           │ Risk        │
│             │                           │ Depends On  │
│             │                           │ Used By     │
└─────────────┴──────────────────────────┴─────────────┘

Interactions

| Action | Behavior | |---|---| | Hover node | Highlight node + neighbors + edges. Fade everything else. | | Click node | Center node. Populate right panel. | | Global Graph | Show entire codebase graph. | | Local Graph | Show only selected node + its direct deps + dependents. | | Search | Filter by file name, path, type, or cluster. | | Type filter | Show only routes, services, database files, etc. | | Cluster filter | Show only Authentication, Payments, Database, etc. |

Node Colors (13 types)

| Type | Color | |---|---| | route | 🟢 Green | | api | 🟢 Green | | component | 🔵 Blue | | controller | 🩵 Teal | | service | 🟣 Purple | | database | 🟠 Orange | | middleware | 🔴 Red | | config | ⬜ Gray | | utility | 🩵 Cyan | | hook | 🩷 Pink | | package | 🟡 Yellow | | test | 🟩 Lime | | unknown | — Slate |

Risk Tiers

| Risk | When | |---|---| | CRITICAL | Auth middleware, database schema with high connectivity | | HIGH | Imported by 5+ files, API routes, changed high-impact files | | MEDIUM | Imported by 2+ files, recently changed, moderate importance | | LOW | Low connectivity, isolated utilities |

Node Inspector (Right Panel)

Click any node to see:

  • Name, path, type badge, cluster
  • Importance score (1–10 bar)
  • Risk badge (CRITICAL / HIGH / MEDIUM / LOW)
  • Changed status
  • Depends On list (clickable — navigates to that node)
  • Used By list (clickable)
  • Impact — which clusters are affected by changes to this file
  • Actions: Local Graph, Copy Path

tokencap diff

Semantic change analysis — goes beyond line diffs to answer: what changed, what's at risk, what could break.

tokencap diff                    # Analyze working tree
tokencap diff --staged           # Analyze staged changes only
tokencap diff --last             # Analyze last commit
tokencap diff --json             # Export analyzed-diff.json
tokencap diff --pr               # Generate PR summary
tokencap diff --prompt           # Generate AI review prompt

Generates:

  • .tokencap/diff/report.md — full change intelligence report
  • Risk level (LOW → CRITICAL) across the change set
  • Breaking change detection (removed exports, schema changes, signature changes)
  • API endpoint capture (added/modified routes)
  • Suggested test cases
  • PR summary and AI review prompt (with flags)

tokencap debug

Unified debug session management. All sub-commands are now flags on a single command.

tokencap debug --start             # Start a new debug session
tokencap debug --start -- npm test # Start + auto-capture failing command output
tokencap debug                     # Regenerate debug handoff report
tokencap debug --log "message"     # Add timestamped event to timeline
tokencap debug --end               # End session and archive

What gets auto-captured (--start -- <command>)

| Section | Source | Auto? | |---|---|---| | Error Logs | Command stderr | ✅ | | Stack Trace | Extracted from output | ✅ | | Failed Tests | Jest / Mocha / pytest / Go test | ✅ | | Suspected Files | From git changed files | ✅ | | Related Files | Graph-connected neighbors | ✅ | | Investigation Order | Ranked by traces → suspected → changed → neighbors | ✅ | | Problem | Your one-sentence description | ✍️ Manual | | Attempted Fixes | What you've tried | ✍️ Manual |

Typical debug workflow

tokencap debug --start -- npm test
# Edit .tokencap-debug.md — describe the problem in one sentence
tokencap debug --log "Tried reverting auth middleware — no change"
tokencap debug --end

Generates: .tokencap/debug/active.md — ready to paste into any AI tool to pick up exactly where you left off.


tokencap pack

Compresses your codebase into a token-budgeted context pack for LLMs.

tokencap pack                              # Review mode, 20k tokens (default)
tokencap pack --mode debug                 # Debug investigation context
tokencap pack --mode architecture          # High-level structural overview
tokencap pack --mode minimal               # Fastest, lightest summary
tokencap pack --budget 10000               # Custom token budget
tokencap pack --mode architecture --budget 50000

How compression works

Each file is scored by import centrality, git history, and debug relevance, then assigned a representation tier:

| Tier | When | Output | |---|---|---| | 🟢 Full Content | Critical files | Complete source | | 🟡 Structural Outline | Mid-importance | Function/class signatures only | | 🟠 AST Summary | Low importance | ~80-token structural description | | 🔴 Reference Only | Distant/utility | File path + export count |


tokencap watch

Watches for file saves and auto-regenerates all snapshots.

tokencap watch                     # 30 second debounce (default)
tokencap watch --debounce 5000     # Custom debounce in milliseconds

Output Files

| File | Description | |---|---| | .tokencap/agent/agent-pack.md | All-in-one Agent Intelligence Pack (v0.8) | | .tokencap/agent/agent.json | Machine-readable agent intelligence (v0.8) | | .tokencap/agent/skills.md | Agent skill document (v0.8) | | .tokencap/agent/architecture.md | Architecture analysis (v0.8) | | .tokencap/agent/rules.md | Project coding rules (v0.8) | | .tokencap/agent/review-rules.md | Review groupings (v0.8) | | .tokencap/agent/risk-map.md | Risk area analysis (v0.8) | | .tokencap/agent/tech-stack.md | Tech stack detection (v0.8) | | .tokencap/context/<topic>-context.md | Smart context package (v0.7) | | .tokencap/context/<topic>-prompt.md | Suggested AI prompt (v0.7) | | .tokencap/context/<topic>-context.json | Machine-readable context (v0.7) | | TOKENCAP.md | Main snapshot — files, Git status, diffs, TODOs | | TOKENCAP_GRAPH.md | Dependency graph markdown | | TOKENCAP_MEMORY.md | Developer context memory | | .tokencap/graph/graph.html | Interactive Obsidian-style graph viewer | | .tokencap/graph/graph-data.json | Full enriched graph JSON | | .tokencap/graph/nodes.json | Node list | | .tokencap/graph/edges.json | Edge list | | .tokencap/graph/graph-map.md | Cluster map markdown | | .tokencap/graph/ai-graph-summary.md | Architecture narrative | | .tokencap/graph/graph-diff.md | Graph change diff | | .tokencap/graph/graph-diff.json | Graph diff JSON | | .tokencap/graph/previous-graph.json | Previous snapshot for diffing | | .tokencap/packs/review.md | Review context pack | | .tokencap/packs/debug.md | Debug context pack | | .tokencap/packs/architecture.md | Architecture context pack | | .tokencap/packs/minimal.md | Minimal context pack | | .tokencap/diff/report.md | Change intelligence report | | .tokencap/diff/analyzed-diff.json | Machine-readable diff analysis | | .tokencap/prompts/pr-summary.md | Pull request summary | | .tokencap/prompts/ai-review-prompt.md | AI code review prompt | | .tokencap/debug/active.md | Active debug handoff report | | .tokencap/debug/debug.json | Machine-readable debug data | | .tokencap-notes.md | Your editable notes file | | .tokencap-debug.md | Debug notes file (auto-created) |

Graph note: The graph scans only JS/TS import syntax (.js, .jsx, .ts, .tsx, .mjs, .cjs). Files in other languages appear as nodes but will have no edges. TOKENCAP.md, TOKENCAP_MEMORY.md, and the debug system work for all languages.


Configuration

Create .tokencap.json in your project root to customize:

{
  "profile": "balanced",
  "outputPath": "TOKENCAP.md",
  "maxFiles": 90,
  "maxSourceBytes": 220000,
  "maxFileBytes": 14000,
  "includeGitDiff": true,
  "includeFileContents": true,
  "excludePatterns": ["node_modules/**", "dist/**", "build/**", "coverage/**"],
  "redactSecrets": true
}

Context Profiles

| Profile | Max Files | Budget | Use case | |---|---|---|---| | compact | 45 | 90KB | Tight context windows | | balanced | 90 | 220KB | Default | | deep | 140 | 420KB | Complex codebases | | gpt-4o | — | — | Tuned for GPT-4o limits | | claude-3-5-sonnet | — | — | Tuned for Claude limits | | gemini-1.5-pro | — | — | Tuned for Gemini limits |


Options Reference

--root <path>              Workspace root (default: current directory)
--out <path>               Output path (default: TOKENCAP.md)
--profile <name>           compact | balanced | deep | gpt-4o | claude-3-5-sonnet | gemini-1.5-pro
--max-files <n>            Max files in snapshot
--max-bytes <n>            Source byte budget
--max-file-bytes <n>       Per-file content limit
--max-diff-bytes <n>       Git diff budget
--debounce <ms>            Watch debounce (default: 30000)
--no-diff                  Skip git diff snippets
--no-contents              Skip file contents (structure only)

# agent (v0.8)
--full                     Generate all files + console summary
--architecture             Architecture + tech stack only
--rules                    Rules + review rules only
--skills                   Skills + agent-pack only

# ask / context (v0.7)
--mode <name>              review | debug | architecture (override auto-detect)
--budget <n>               Token budget (default: 12000)
--json                     Export context.json
--prompt                   Generate prompt.md (default for ask)
--no-prompt                Skip prompt.md generation

# diff
--staged                   Analyze staged changes
--last                     Analyze last commit
--json                     Export JSON
--pr                       Generate PR summary
--prompt                   Generate AI review prompt

# graph
--open                     Open viewer in browser
--full                     JSON + AI + diff + HTML + open browser
--minimal                  JSON files only
--quiet                    Suppress verbose output
--diff                     Graph diff vs last run
--ai                       AI narrative summary
--json                     JSON export only

# pack
--mode <name>              review | debug | architecture | minimal
--budget <n>               Token budget (default: 20000)

# debug
--start                    Start debug session
--end                      End and archive session
--log "message"            Add timeline event

Example Workflows

Before starting any AI coding session (v0.8)

tokencap agent --full
# Paste .tokencap/agent/agent-pack.md into your AI
# The agent now knows your architecture, rules, and risk areas

Before a specific feature review (v0.8)

tokencap agent --rules
# Paste .tokencap/agent/review-rules.md into your AI code reviewer

Ask about any part of your codebase (v0.7)

tokencap ask "How does authentication work?"
# Paste .tokencap/context/auth-context.md into your AI tool

Quick topic context (v0.7)

tokencap context payments
# Paste .tokencap/context/payment-context.md into your AI tool

Before an AI handoff

tokencap make
# Paste TOKENCAP.md into your AI tool

Visual architecture review

tokencap graph --full
# Browser opens with interactive graph

Before a PR

tokencap diff --staged --pr
# Paste .tokencap/prompts/pr-summary.md into your PR description

Debugging a failing test

tokencap debug --start -- npm test
# Edit .tokencap-debug.md to describe the problem
tokencap debug --log "Tried reverting auth middleware — no change"
tokencap debug --end
# Paste .tokencap/debug/active.md into your AI tool

Context-compressed AI prompt

tokencap pack --mode review --budget 15000
# Paste .tokencap/packs/review.md into your AI tool

Architecture

TokenCap is a pure CLI + static file tool:

CLI Tool            →  bin/tokencap.js
Agent Engine        →  src/agent/  (v0.8 — flagship)
Smart Retrieval     →  src/context/ (v0.7)
Static HTML         →  .tokencap/graph/graph.html (Cytoscape.js, self-contained)
Local Analysis      →  src/graph/, src/diff/, src/debug/, src/pack/, src/memory/

The Agent Engine pipeline:

Repository
  → buildGraph()           (dependency graph)
  → enrichGraph()          (risk, clusters, connectivity)
  → detectTechStack()      (manifest file analysis)
  → analyzeArchitecture()  (layer detection, critical chains)
  → extractProjectRules()  (folder + tech conventions)
  → buildRiskMap()         (cluster risk grouping)
  → buildReviewGroups()    (edge-aware review groups)
  → buildAgentSkills()     (primary AI skill doc)
  → buildAgentPack()       (all-in-one paste file)
  → buildAgentJson()       (machine-readable output)

Everything is:

  • Offline — no API calls, no telemetry
  • Local — all output written to your project directory
  • Zero configuration — works out of the box
  • Portable — single npm install -g tokencap
  • Fast — 50 files in <1s, 300 files in <3s, 1000 files in <10s

Product Vision

TokenCap is evolving from an AI Context Generator into an AI Project Intelligence Platform.

Before                     After
──────────────────────     ──────────────────────────────────
Repository                 Repository
  → Context                  → Project Intelligence
                               → Agent Intelligence
                                 → AI Agent

Teach AI how your project works.