Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

tokensafe

Latest version: v4.7.14

Overview

Last scanned
28 Nov 2026
Published
28 Nov 2026
npm package Publisher: nekosin4eg
48 Stars
3 Forks
129 Versions
28.2K Downloads
Python Repo language

Scan summary

tokensafe was last scanned on 28 Nov 2026 at version 4.7.14. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 129 versions; the latest 5 were published on 28 Nov 2026.
  • Findings: No rules fired in version 4.7.14.
  • Downloads: 28,192 downloads.

Versions

129 versions published
Versions and the rules that fired in each
VersionPublishedStatus
4.7.15 28 Nov 2026 Not shown
4.7.14 28 Nov 2026 No rules fired
4.7.13 28 Nov 2026 No rules fired
4.7.11 28 Nov 2026 Not shown
4.7.12 28 Nov 2026 Not shown

No rules fired in 4.7.14

Findings

Findings for v4.7.14. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 4.7.14; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.


What's New in v4.0

TokenSafe 4.0 is a major architecture release designed for Zero Mid-Day Lockouts, 3-Second Turn Latency, Exact Code Context (Zero Loss), and Developer Flow:

  • ⚡ SQLite FTS5 BM25 Code Indexer & Search (scoped_search, tokensafe search): Native SQLite full-text search with trigram tokenization and BM25 relevance ranking (\<1ms) across the repository. Replaces raw terminal grep entirely with zero-token-waste search.
  • 🔗 SQLite Graph Cache & Cross-Boundary Route Linking: Persistent SQLite caching (.tokensafe/cache/graph.db) with bidirectional semantic linking between frontend client endpoints (fetch, axios, apiClient) and backend HTTP routes (FastAPI, Express, Flask, Next.js).
  • 🖼️ Vision Image Downscaler (optimize_image, tokensafe optimize-image): Automatically scales down oversized screenshots, architecture diagrams, and mockups (>1024px) via Pillow or macOS sips, saving 50–75% vision tokens while keeping original files intact.
  • 🧠 Anti-Stuck Dead-Ends Ledger (get_mistakes, tokensafe mistakes): Persistent project memory tracking failed hypotheses, loop guard trips, and git reverts to prevent agents from cycling through already-failed solutions.
  • 🧹 Transcript Superseded Output Pruning (prune_superseded, tokensafe prune-superseded): Prunes obsolete intermediate tool reads that were superseded by subsequent edits or re-reads in long agent transcripts (-30-40% context).
  • 🧼 ANSI Escape Sequence Stripper: Cleans all ANSI/VT100 escape codes from tool outputs, test runners, and proxy streams before they enter model context.
  • 👻 Ghost Tokens Auditor (tokensafe doctor): Detects and cleans redundant multi-IDE configuration files (.cursorrules, CLAUDE.md, .windsurfrules, .clinerules) and oversized rule files, saving 2,000–5,000 wasted ghost tokens on every turn.
  • 🛡️ Exact Code Context & Reversible Stash (expand_ref): 100% byte-exact target symbol preservation with reversible 8-char hash anchors (#a1b2c3d4) to instantly recover any folded block.
  • 🌲 C# Tree-sitter Support: Native AST slicing and God Nodes detection for C# (tree-sitter-c-sharp) alongside TypeScript, JavaScript, Python, Go, Rust, Java, Kotlin, and PHP.

Install & Agents

Connect TokenSafe to the AI coding agents on your workstation in one command:

# Option 1: Zero-Install via npx (recommended)
npx tokensafe

# Option 2: Python / PyPI
pip install tokensafe && tokensafe

# Option 3: Direct shell script (macOS / Linux)
curl -fsSL https://tokensafe.dev/install.sh | bash

The installer detects which agents live on your machine, registers the TokenSafe MCP server, injects project rules, and wires lifecycle hooks where the agent supports them.

Runtime requirements
  • CPython 3.10+ (3.11+ recommended). If no suitable interpreter is found, the npm launcher provisions a pinned, SHA-256-verified CPython 3.12 build into ~/.tokensafe/runtime and installs the dependencies there, so TokenSafe works on a machine without Python. One-time download: 25 MB on macOS, 47 MB on Windows, 53-68 MB on Linux. Opt out with TOKENSAFE_NO_DOWNLOAD=1, force a specific interpreter with TOKENSAFE_PYTHON=/path/to/python3, relocate the whole tree with TOKENSAFE_HOME.
  • cryptography>=42.0 is the only required Python dependency (Ed25519 license checks, under 1 ms per validation).
  • Optional accelerators, installed by default but not required: tree-sitter plus grammar wheels for AST-accurate slicing across 10 languages (without them the slicer falls back to stdlib heuristics; disable with TOKENSAFE_TREESITTER=off), and Pillow for cross-platform image downscaling (macOS falls back to sips).
  • The managed runtime is pinned in bin/python-runtime.json: CPython 3.12.16 from astral-sh/python-build-standalone, five platform builds, every archive verified against a hardcoded SHA-256 before extraction.
Agent Integration
Google Antigravity Plugin symlink + hooks + skills + MCP (loaded automatically on startup)
Claude Code CLI MCP + SessionStart / UserPromptSubmit / PreToolUse hooks
Cursor MCP + beforeShellExecution / beforeReadFile hooks
Claude Desktop MCP registration (claude_desktop_config.json)
Windsurf MCP registration + global rules
OpenAI Codex MCP in ~/.codex/config.toml (stdio + cloud HTTP natively)
Cline / Roo Code MCP registration (VS Code)
GitHub Copilot MCP registration
Z.ai Code MCP registration
Kimi Code Native Plugin (kimi.plugin.json) + MCP + PreToolUse / SessionStart hooks
ChatGPT Cloud connector, nothing to install

Claude Desktop / Cursor MCP config:

{
  "mcpServers": {
    "tokensafe": { "command": "npx", "args": ["-y", "tokensafe", "mcp"] }
  }
}

Cloud features (team metrics, managed distillation, shared team cache, billing) run on the remote endpoint https://api.tokensafe.dev/mcp with Authorization: Bearer <TS2. license key>. Four public tools work without a key, so ChatGPT connects with authentication set to None.

Full per-agent configuration, hook details, and the Codex/ChatGPT setup live in docs/AGENT_SETUP.md.

CLI Quickstart

# View live savings dashboard in your terminal
tokensafe stats
⚡ TOKENSAFE CONTEXT OPTIMIZER DASHBOARD
Total Tokens Saved:   4,524,156 tokens
Efficiency Gain:      [████████████████████████░░] 92.5%
Context Traffic:      4,889,255 raw → 370,574 optimized (2,132 events)

• Command Sanitizer (CLI)        :   727,300 tokens saved (263 events)
• Architecture Graph             :   758,256 tokens saved (13 events)
• Multi-turn History Fold        : 2,897,897 tokens saved (471 events)
• Prompt Compactor (local+cache) :    43,502 tokens saved (1,255 events)
# Audit your environment: MCP tool overhead, skills tax, risky settings
tokensafe doctor

# Recursive security & hygiene audit of a repository
tokensafe guard audit

# Preview prompt compaction on custom input
tokensafe test "fix the validate_token method in src/auth.py to check jwt expiration"

# Map architectural hotspots before multi-file changes
tokensafe graph

# Disable a heavy MCP server without editing JSON
tokensafe mcp disable <server>

# Compile and preview the Friday team ROI digest
tokensafe digest

# Scaffold a new token-optimized project for AI agents
tokensafe create my-app --template fullstack  # tokensafe-ui + tokensafe-python
tokensafe create my-service --template go     # tokensafe-backend (Go)

# Retrofit existing apps for AI agents (out-of-the-box stack detection)
tokensafe integrate          # Generates .tokensafe/oumv.json with safe defaults
tokensafe adapters           # Catalog of frontend & backend OUMV adapters
tokensafe oumv doctor        # Verify live dev-server & static AST capabilities

# Activate a Team or Solo license key
tokensafe activate TS2.eyJlbWFpbCI6...

The full command reference (24 commands) is in Reference.

Why TokenSafe

Giving coding agents raw access to entire repositories creates three daily costs:

  1. Senior hours burned on AI PRs: reading 2,000-line modules for a 10-line fix makes models forget imports, invent methods, and regress adjacent code.
  2. Secret leaks and unsafe shortcuts: static prompt rules in .cursorrules wear off mid-session. Agents hardcode fallback credentials, disable TLS checks, or stage .env files with git add ..
  3. Mid-sprint quota stops and blind spend: bloated diffs, lockfiles, and verbose MCP schemas burn 5-hour limits while engineering leads lack per-seat ROI visibility.
Outcome What changes for your team How it is enforced
Clean code on the first pass Agents read only target functions, design tokens, and 1-hop dependencies instead of 2,000 lines of noise. Sub-30ms local AST skeletonizer, architecture graph, predictive signature prefetch, lockfile-stripping diff slicer, loop guard.
Zero leaked secrets in git Hardcoded password fallbacks, TLS bypasses, raw SQL interpolation, and .env commits are stopped before reaching disk or staging. Deterministic TokenSafe Guard on every tool call, output guard on large writes, local PII/key redaction.
Predictable sprint velocity & ROI Teammates get warm cache hits, and CTOs receive a Friday ROI digest separating measured and estimated savings. Shared team cache, live context budget HUD, per-seat dashboard.

A $29 seat pays for itself by saving one hour of senior code review or preventing one leaked key. Typical payback: 1 to 3 days of team usage.

Before and After

One contrast: an agent asked to change one helper in a 1,420-line file receives 94 lines of target logic and type contracts instead of the whole module. The same principle applies to terminal output, diffs, and session history.

What breaks coding agents How TokenSafe fixes it The outcome
"Lost in the Middle" context fade: an agent reads a 2,000-line file to change one 10-line helper, forgets imports, and invents methods. AST skeletonizer folds inert bodies into typed signatures while keeping the target symbol and 1-hop callees intact. Focused signal: the model keeps full type contracts without drowning in unrelated logic.
Terminal log flooding: npm test or pytest fails and dumps 4,000 lines of stack traces and lockfile diffs into context. Command sanitizer strips lockfile noise and trims output to the failing assertion and stack frame. Root-cause fixes instead of unrelated rewrites.
Infinite wait on background tests: yarn test hangs in watch mode, or jest finishes but unclosed handles keep the process alive. Test-runner guard forces run-once mode (CI=true, --watch=false, --forceExit) and peeks at <cwd>/package.json to identify the runner behind opaque scripts. The test run terminates with an exit code and the agent moves on.
5-attempt retry loops: an agent repeats the same broken edit until the context budget runs dry. Loop guard detects repeated identical tool calls and halts the cycle. Stuck loops stop before damaging working modules.
Unsafe edits & secret leaks: fallback keys, verify=False, SQL string interpolation, or git add . with .env present. TokenSafe Guard audits writes and shell commands locally before execution. Credentials, SQLi patterns, and destructive commands are blocked locally.

When an operation is blocked, the agent sees an explicit, constructive message:

🛡️ TokenSafe Guard: Blocked a hardcoded secret fallback in config.py.
   Leave the default empty or read from os.environ at runtime.

10 Core Engine Capabilities

Why TokenSafe agents ship working code on the first pass without burning quotas or leaking keys:

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm tokensafe

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Cry2Wolf: How to Tell a Real Bug from a Nothingburger
AI & VibeSec

Cry2Wolf: Not Every Branded Bug Deserves a Fire Drill

Critical Apache HTTP Server Flaw Exposes Web Servers to RCE (1)
CVE

CVE-2026-119618: Critical Apache HTTP Server Flaw Exposes Web Servers to Remote Code Execution

Microsoft's Official agent framework Hijacked
AI & VibeSec

BREAKING: Hijacked Releases of Microsoft’s Official agent-framework Steals Azure and CI Credentials

Frame 2085668439 (1)
Group 1261154229