Writing a TokenCap Plugin, and What the Sandbox Stops It From Doing

●1 ●12 ●49
calendar_today • schedule1 min read

TokenCap 3 plugins are local JS files listed under tokencapPlugins in your package.json.

Two hooks:

  • afterBuild gets the build's output path, file count and token estimate
  • beforeRedact can rewrite content before core redaction runs

Plus named tools: tokencap analyze plugins run <tool-name> --text "input".

The sandbox:

  • Own V8 realm; no require, no process, no network
  • File access only inside .tokencap/plugins/<name>/, with symlinks and junctions rejected
  • 1 s per call, 150 ms to load; overruns get disabled
  • A failing beforeRedact never blocks redaction

One honest caveat from the source: node:vm is not a security boundary. Plugins are trusted code.

Read more at tokencap.vansharora.app

Want more deep dives?

Join 6,179+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

Cisco's Amy Chang: A Model's "Passport" Doesn't Tell You Where It Actually Came From

Tom Smithverified - Aug 27

Make for Small Business: What It Is, What It Costs, and When to Use It

floxolab - Oct 23

What Security Teams Want From AI Agents Before They Let Them Act Alone

Tom Smithverified - Nov 18

AAIF Hits 10 Projects. Its CTO on What to Adopt Now and the Security Gaps Left Open

Tom Smithverified - Oct 23

Python for commerce students, from a former bio kid

rahuldk1105 - Oct 30
chevron_left
2k Points • 62 Badges
Jaipur, India • t.co/BRmkFprjYq
25Posts
10Comments
16Connections
tech freak

Related Jobs

Commenters (This Week)

5 comments
2 comments

Contribute meaningful comments to climb the leaderboard and earn badges!