frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

TokenShrink v2.0 – Reddit proved our token math was wrong, so we fixed it

https://tokenshrink.com
1•wattsonme•2h ago

Comments

wattsonme•2h ago
Hey HN – I built TokenShrink, an npm package that compresses AI prompts to save tokens. Zero dependencies, runs locally in <1ms.

  After posting v1.0, r/LocalLLaMA tore it apart. They were right.

  The problem: v1.0 estimated tokens as `words × 1.3`. But BPE tokenizers don't work that way. "database" is 1 token.
  "db" is also 1 token. That replacement saves exactly nothing. Worse — "should" → "shd" goes from 1 token to 2. We were
   making prompts MORE expensive.

  What v2.0 does differently:

  - Precomputed every dictionary entry against cl100k_base (GPT-4's tokenizer)
  - Removed 130 entries that saved zero tokens
  - Removed 45 entries that actually increased token count
  - Replaced the word heuristic with a real token cost lookup table
  - Added pluggable tokenizer support: `compress(text, { tokenizer })`

  What it still does well — phrase compression. "In order to" → "to" saves 2 tokens. "Due to the fact that" → "because"
  saves 4. "It is important to" → removed entirely. These multi-word filler phrases are where the real savings are.

  Benchmarks (verified with gpt-tokenizer):

    Verbose dev prompt:    408 → 349 tokens (14.5%)
    Code review prompt:    210 → 183 tokens (12.9%)
    Medical notes:         151 → 134 tokens (11.3%)
    Business requirements: 143 → 121 tokens (15.4%)
    Minimal filler:         77 →  77 tokens (0.0%)

  No prompt had its token count increase. Zero false savings.

  npm: npm install tokenshrink
  Web: https://tokenshrink.com
  GitHub: https://github.com/chatde/tokenshrink

Show HN: Winslop – De-Slop Windows

https://github.com/builtbybel/Winslop
1•guilamu•1m ago•0 comments

Ask HN: How do you test your MyBatis dynamic SQL queries?

1•allegorist•5m ago•0 comments

Show HN: AI Agent for SEO

https://usefox.ai/
1•Creator-io•5m ago•0 comments

Toggle: A simple and keyboard friendly graphics drawing tool

https://github.com/Protyasha-Roy/toggle
1•zynovex•6m ago•1 comments

Tracing Chinese Immigration Through Food (2023)

https://sundaylongread.com/2023/11/17/chasing-chop-suey-tracing-chinese-immigration-through-food/
4•NaOH•15m ago•0 comments

Inputlag.science – Repository of knowledge about input lag in gaming

https://inputlag.science
3•akyuu•16m ago•0 comments

I quit my job to run EpsteinExposed.com full time

https://old.reddit.com/r/Epstein/comments/1ra6yw0/i_quit_my_job_to_run_epsteinexposedcom_full_time/
2•Betelbuddy•16m ago•1 comments

Parse, Don't Validate and Type-Driven Design in Rust

https://www.harudagondi.space/blog/parse-dont-validate-and-type-driven-design-in-rust/
3•todsacerdoti•17m ago•0 comments

Identity Theft 2.0

https://rekt.news/identity-theft-2
1•eustoria•21m ago•0 comments

New Technical Briefing: Digital Fingerprinting

https://blog.citp.princeton.edu/2026/02/20/new-technical-briefing-digital-fingerprinting/
2•eustoria•22m ago•0 comments

Ask HN: Do You Love My "Assess Idea" (AI) Robo-Reply Side Project Idea?

1•burnerToBetOut•23m ago•0 comments

Epstein files reveal how the rich fuel climate denialism

https://www.fastcompany.com/91490280/epstein-files-how-ultra-wealthy-peddle-climate-denialism
5•cdrnsf•24m ago•0 comments

Kubernetes Deployment Strategies for Zero Downtime

https://dixken.de/blog/kubernetes-deployment-strategies
1•mooreds•24m ago•0 comments

Measuring Claude Code ROI and Adoption in Honeycomb

https://www.honeycomb.io/blog/measuring-claude-code-roi-adoption-honeycomb
1•mooreds•25m ago•0 comments

Experimental pill dramatically reduces 'bad' cholesterol

https://medicalxpress.com/news/2026-02-experimental-pill-bad-cholesterol.html
1•PaulHoule•27m ago•1 comments

The Power of Constraints

https://collabfund.com/blog/the-power-of-constraints/
2•mooreds•28m ago•0 comments

BJJBench – tracking AI video model progress on Brazilian Jiu Jitsu techniques

https://bricee98.github.io/bjjbench/
1•bricee98•29m ago•1 comments

The Broken Record

https://2ndbreakfast.audreywatters.com/the-broken-record/
1•MindGods•30m ago•0 comments

JPMorgan Admits It Shut Trump's Accounts After Jan. 6 Capitol Attack

https://www.nytimes.com/2026/02/21/business/jpmorgan-trump-debanking.html
2•koolba•32m ago•1 comments

Bitcoin's Security Budget Transition: From Subsidy to Sustainability

https://cantonius.substack.com/p/bitcoin-asymmetry-rise-and-the-2040
1•antoniuschan99•35m ago•1 comments

Show HN: No Trace Chat – secret code, no signup, messages disappear after read

https://play.google.com/store/apps/details?id=com.teamzlab.no_trace_code_chat&hl=en_US
1•teamzlab•36m ago•0 comments

Show HN: Codex Linux Self-Installer

https://github.com/welidev/codex-installer
2•weli•38m ago•1 comments

Joint Statement on the U.S.-India AI Opportunity Partnership

https://www.state.gov/releases/under-secretary-for-economic-affairs/2026/02/joint-statement-on-th...
1•artninja1988•39m ago•1 comments

Carlos Alcaraz wins his first Qatar Open title with a 50-minute victory

https://twitter.com/beINSPORTS_EN/status/2025288459091357953
1•amrrs•40m ago•0 comments

Brat, a parallel TAP testing harness for the POSIX shell

https://codeberg.org/sstephenson/brat
2•birdculture•41m ago•0 comments

Ask HN: What are the most interesting AI Agent Skills you've seen or used?

1•taariqlewis•42m ago•0 comments

Show HN: Simple Teleprompter App for the Browser

https://gojko.net/tools/teleprompter/
1•adzicg•43m ago•1 comments

Dreamer – why we built it: David Singleton's new startup

https://blog.singleton.io/posts/2026-02-17-introducing-dreamer/
1•sherlock_h•45m ago•0 comments

She Graduated with Honors but She Can't Read

https://garryslist.org/posts/she-graduated-with-honors-but-she-can-t-read-d2def6ed
12•tomaskafka•48m ago•1 comments

I want Artificial Competence, not more Artificial Intelligence

https://jdauriemma.com/programming/i-want-artificial-competence-not-more-ai
2•jdauriemma•49m ago•0 comments