Skip to main content

Explain it like you'd tell grandma.

Project description

๐Ÿ‘ต grandma

๐Ÿ‘ต grandma

Explain it like you'd tell grandma.

PyPI - Version PyPI - Python Version License: MIT CI


You know her. She loves you, she read the whole thing, and she is not sitting through six paragraphs of agent confetti to find out whether the test passed.

Grandma does not dumb it down. She keeps every fact that matters. She just refuses to waste your afternoon.

grandma takes verbose LLM output and distils it to three lines: what happened, the bottom line, and what to do next.


๐Ÿ’ธ Token savings

Every time you read a raw LLM response, you pay in attention โ€” or in tokens if you pipe it into another model.

Words Reading tokens Cost to re-read
Raw LLM response ~400 ~530 100%
grandma card ~40 ~55 ~10%
Savings ~90% fewer tokens

Why this matters:

  • In agent loops, every intermediate response fed back into context costs tokens. Grandma compresses the signal.
  • In multi-step workflows (plan โ†’ code โ†’ review โ†’ deploy), each step can save 400โ€“500 tokens of context bloat.
  • Deep mode trades a bit more output for full structured data โ€” still 70โ€“80% smaller than the raw response.
  • Across a 20-turn session, grandma typically saves 8,000โ€“12,000 context tokens.

Before / After

Raw LLM output (~90 words, ~120 tokens):

I inspected the repository and found that the authentication flow now routes through
the new async session adapter. I updated three files, added one regression test, and
confirmed that the login path still returns the expected token shape. There is one
compatibility consideration: the adapter relies on Python 3.9+ typing behavior, so
Python 3.8 users will need to upgrade or pin the old release. Overall, this should
reduce request latency, but the deployment notes should mention the runtime floor.

After grandma (default mode โ€” ~30 words, ~40 tokens):

๐Ÿ‘ต grandma
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
๐Ÿ“– Second turn reviewing an auth refactor PR.

What happened: Auth moved to the async session adapter.
Bottom line:   Faster login path, but Python 3.8 is out.
Do next:       Document Python โ‰ฅ3.9 before shipping.
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

After grandma (deep mode โ€” full impact table):

๐Ÿ‘ต grandma
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ๐Ÿ“– story arc โ”‚ Second turn reviewing an auth refactor PR.   โ”‚
โ”‚ ๐Ÿ‘€ happened  โ”‚ Auth moved to async session adapter.         โ”‚
โ”‚ ๐Ÿงถ changed   โ”‚ 3 files, 1 regression test added.            โ”‚
โ”‚ โœ… positive  โ”‚ Login latency reduced; token shape unchanged. โ”‚
โ”‚ โš ๏ธ  negative  โ”‚ Breaks Python 3.8 (asyncio.TaskGroup).       โ”‚
โ”‚ โž– neutral   โ”‚ API surface unchanged.                        โ”‚
โ”‚ ๐Ÿ’ก net gain  โ”‚ Win โ€” ship it with a runtime floor note.     โ”‚
โ”‚ ๐Ÿ“‹ actions   โ”‚ - Add Python โ‰ฅ3.9 to pyproject.toml          โ”‚
โ”‚              โ”‚ - Update deployment docs                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Install

pip install grandma
# or
pipx install grandma
# or from source
pip install git+https://github.com/ypollak2/grandma.git

Usage

Pipe any text through grandma:

echo "long agent output..." | grandma
cat response.txt | grandma --mode deep
cat response.txt | grandma --json        # raw JSON verdict
cat response.txt | grandma --mode off    # passthrough

Demo (no API key needed):

grandma --demo
grandma --demo --mode deep

Environment variable for default mode:

export GRANDMA_MODE=deep

The Modes

Mode What you get Model used Best for
default 3-line card: happened / bottom line / do next Haiku Most agent output
deep Full impact table with positive/negative/neutral Sonnet PRs, arch decisions, refactors
off Passthrough โ€” original text unchanged โ€” When you need the whole casserole

Works without an API key

Grandma runs on your Claude Code subscription โ€” no ANTHROPIC_API_KEY needed:

grandma โ†’ claude -p - (stdin pipe) โ†’ your Claude Code OAuth session

Set ANTHROPIC_API_KEY only if you want to use your own API credits instead.


IDE & agent integrations

Grandma works anywhere LLMs produce text. One-liner install for all detected tools:

./install.sh
Tool Integration type What happens
Claude Code Stop hook (native) Auto-card after every long response
Codex CLI Stop hook (native) Auto-card after every long response
Gemini CLI AfterAgent hook (native) Auto-card after every agent turn
Cursor MCP + .cursor/rules Agent calls grandma_summarize after long replies
Cline MCP + rules Agent calls grandma_summarize after tasks
Continue MCP + /grandma slash command On demand or automatic
Windsurf MCP + .windsurfrules Agent calls grandma_summarize after long replies
Zed MCP (context_servers) Tool available in Zed AI panel
Goose MCP extension Tool available in Goose sessions
Aider grandma-aider wrapper Pipe aider output through grandma
OpenHands grandma-openhands wrapper Pipe headless output through grandma

MCP server (for any MCP-capable IDE):

grandma serve

Exposes two tools:

  • grandma_summarize(text, mode, story_context) โ†’ plain-text card
  • grandma_summarize_json(text, mode, story_context) โ†’ structured dict

Add to any .mcp.json:

{
  "mcpServers": {
    "grandma": { "command": "grandma", "args": ["serve"] }
  }
}

How the mascot rotates

Each grandma portrait in this repo (assets/grandmas/) was generated with Gemini Image.
A daily GitHub Action picks one at random and replaces assets/grandma.png.
The README always shows the current winner. No JS. No CDN. No infrastructure.

Want to add your own grandma? Drop a PNG into assets/grandmas/ and open a PR.


FAQ

Does grandma make it dumber?
No dear. She keeps the facts. She removes the fog machine.

Does default mode include everything?
It includes what you need first. Use --mode deep when you need the full table.

Why is there an off mode?
Because sometimes you want the original, and grandma knows when to leave a person alone.

What's the story_so_far line?
Grandma reads the last 3 turns of the conversation to understand where you are in the arc.
If you are on turn 8 of debugging the same auth bug, she will tell you. This is the dementia prevention feature.

Which models does it use?
Default mode: claude-haiku-4-5-20251001. Deep mode: claude-sonnet-4-6.
Both run on your Claude Code subscription โ€” no extra key needed.


Made with ๐Ÿ’œ by Yali Pollak ยท MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grandma-0.1.0.tar.gz (42.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grandma-0.1.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file grandma-0.1.0.tar.gz.

File metadata

  • Download URL: grandma-0.1.0.tar.gz
  • Upload date:
  • Size: 42.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for grandma-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3cb6e96987faf126f7be15e7f54fd16aa2d82e26ce66b8438ecaf15b61be06e4
MD5 1564ad7a2aa25a4a9ad4c2bea7bd7b23
BLAKE2b-256 07b39f9ab2ff32f58ba4af5f8ea60723b60885c2517b999dc518841ab5afa3f5

See more details on using hashes here.

File details

Details for the file grandma-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: grandma-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for grandma-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c9bcd1580cf83f3a0648b196df25a87065e0428fa0d6fdb7bacbec239a57415f
MD5 3e70e9d568c7d373cd8b7cca04ff5a0e
BLAKE2b-256 aa8831c8d42561d5a2f0b427c79ba65e59d9afe7199f30a9435d0bb218492dac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page