grandma 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- grandma-0.1.0/.github/workflows/ci.yml +30 -0
- grandma-0.1.0/.github/workflows/rotate-grandma.yml +39 -0
- grandma-0.1.0/.gitignore +20 -0
- grandma-0.1.0/LICENSE +21 -0
- grandma-0.1.0/PKG-INFO +278 -0
- grandma-0.1.0/README.md +228 -0
- grandma-0.1.0/assets/grandma.png +0 -0
- grandma-0.1.0/assets/grandmas/grandma-01.png +0 -0
- grandma-0.1.0/assets/grandmas/grandma-02.png +0 -0
- grandma-0.1.0/assets/grandmas/grandma-03.png +0 -0
- grandma-0.1.0/assets/grandmas/grandma-04.png +0 -0
- grandma-0.1.0/assets/grandmas/grandma-05.png +0 -0
- grandma-0.1.0/assets/grandmas/grandma-06.png +0 -0
- grandma-0.1.0/assets/grandmas/grandma-07.png +0 -0
- grandma-0.1.0/assets/grandmas/grandma-08.png +0 -0
- grandma-0.1.0/assets/grandmas/grandma-09.png +0 -0
- grandma-0.1.0/assets/grandmas/grandma-10.png +0 -0
- grandma-0.1.0/install.sh +124 -0
- grandma-0.1.0/integrations/aider/grandma-aider +22 -0
- grandma-0.1.0/integrations/claude-code/hook.py +74 -0
- grandma-0.1.0/integrations/claude-code/settings-snippet.json +18 -0
- grandma-0.1.0/integrations/cline/.mcp.json +10 -0
- grandma-0.1.0/integrations/cline/cline-rules.md +9 -0
- grandma-0.1.0/integrations/codex-cli/codex-snippet.json +10 -0
- grandma-0.1.0/integrations/codex-cli/hook.py +47 -0
- grandma-0.1.0/integrations/continue/config-snippet.json +25 -0
- grandma-0.1.0/integrations/cursor/.cursor/rules/grandma.mdc +17 -0
- grandma-0.1.0/integrations/cursor/.mcp.json +9 -0
- grandma-0.1.0/integrations/gemini-cli/hook.py +50 -0
- grandma-0.1.0/integrations/gemini-cli/settings-snippet.json +10 -0
- grandma-0.1.0/integrations/goose/.goose/config.yaml +11 -0
- grandma-0.1.0/integrations/openhands/grandma-openhands +19 -0
- grandma-0.1.0/integrations/windsurf/.mcp.json +8 -0
- grandma-0.1.0/integrations/windsurf/.windsurfrules +11 -0
- grandma-0.1.0/integrations/zed/settings-snippet.json +13 -0
- grandma-0.1.0/pyproject.toml +66 -0
- grandma-0.1.0/skill/grandma.md +28 -0
- grandma-0.1.0/src/grandma/__init__.py +1 -0
- grandma-0.1.0/src/grandma/card.py +65 -0
- grandma-0.1.0/src/grandma/cli.py +105 -0
- grandma-0.1.0/src/grandma/extractor.py +137 -0
- grandma-0.1.0/src/grandma/mcp_server.py +81 -0
- grandma-0.1.0/src/grandma/models.py +25 -0
- grandma-0.1.0/tests/__init__.py +0 -0
- grandma-0.1.0/tests/test_extractor.py +82 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
python-version: ["3.9", "3.11", "3.12"]
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
|
|
23
|
+
- name: Install hatch
|
|
24
|
+
run: pip install hatch
|
|
25
|
+
|
|
26
|
+
- name: Lint
|
|
27
|
+
run: hatch run lint
|
|
28
|
+
|
|
29
|
+
- name: Test
|
|
30
|
+
run: hatch run test
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Rotate grandma mascot
|
|
2
|
+
|
|
3
|
+
# Security: this workflow uses no external/untrusted input in run: blocks.
|
|
4
|
+
# CHOSEN is derived only from local repo file listing (RANDOM % COUNT).
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
schedule:
|
|
8
|
+
- cron: "0 6 * * *" # daily at 06:00 UTC
|
|
9
|
+
workflow_dispatch: # allow manual trigger
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
rotate:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Pick a random grandma image
|
|
21
|
+
run: |
|
|
22
|
+
IMAGES=(assets/grandmas/grandma-*.png)
|
|
23
|
+
COUNT=${#IMAGES[@]}
|
|
24
|
+
IDX=$(( RANDOM % COUNT ))
|
|
25
|
+
CHOSEN="${IMAGES[$IDX]}"
|
|
26
|
+
cp "$CHOSEN" assets/grandma.png
|
|
27
|
+
echo "Chose: $CHOSEN (index $IDX of $COUNT)"
|
|
28
|
+
|
|
29
|
+
- name: Commit if changed
|
|
30
|
+
run: |
|
|
31
|
+
git config user.name "github-actions[bot]"
|
|
32
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
33
|
+
git add assets/grandma.png
|
|
34
|
+
if git diff --cached --quiet; then
|
|
35
|
+
echo "Same image — nothing to commit"
|
|
36
|
+
else
|
|
37
|
+
git commit -m "chore: rotate grandma mascot [skip ci]"
|
|
38
|
+
git push
|
|
39
|
+
fi
|
grandma-0.1.0/.gitignore
ADDED
grandma-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yali Pollak
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
grandma-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: grandma
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Explain it like you'd tell grandma.
|
|
5
|
+
Project-URL: Homepage, https://github.com/ypollak2/grandma
|
|
6
|
+
Project-URL: Repository, https://github.com/ypollak2/grandma
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/ypollak2/grandma/issues
|
|
8
|
+
Author-email: Yali Pollak <yali.pollak@gmail.com>
|
|
9
|
+
License: MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2026 Yali Pollak
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Keywords: ai,bottom-line,cli,extraction,llm,summary
|
|
32
|
+
Classifier: Development Status :: 3 - Alpha
|
|
33
|
+
Classifier: Intended Audience :: Developers
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
41
|
+
Classifier: Topic :: Utilities
|
|
42
|
+
Requires-Python: >=3.9
|
|
43
|
+
Requires-Dist: anthropic>=0.20.0
|
|
44
|
+
Requires-Dist: httpx>=0.25.0
|
|
45
|
+
Requires-Dist: mcp>=1.0.0
|
|
46
|
+
Requires-Dist: pydantic>=2.0.0
|
|
47
|
+
Requires-Dist: rich>=13.0.0
|
|
48
|
+
Requires-Dist: typer[all]>=0.9.0
|
|
49
|
+
Description-Content-Type: text/markdown
|
|
50
|
+
|
|
51
|
+
<div align="center">
|
|
52
|
+
|
|
53
|
+
<!-- Grandma rotates daily via .github/workflows/rotate-grandma.yml -->
|
|
54
|
+
<img src="assets/grandma.png" alt="👵 grandma" width="320" />
|
|
55
|
+
|
|
56
|
+
# 👵 grandma
|
|
57
|
+
|
|
58
|
+
**Explain it like you'd tell grandma.**
|
|
59
|
+
|
|
60
|
+
[](https://pypi.org/project/grandma)
|
|
61
|
+
[](https://pypi.org/project/grandma)
|
|
62
|
+
[](https://github.com/ypollak2/grandma/blob/main/LICENSE)
|
|
63
|
+
[](https://github.com/ypollak2/grandma/actions/workflows/ci.yml)
|
|
64
|
+
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
Grandma does not dumb it down. She keeps every fact that matters. She just refuses to waste your afternoon.
|
|
72
|
+
|
|
73
|
+
`grandma` takes verbose LLM output and distils it to three lines: **what happened**, **the bottom line**, and **what to do next**.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 💸 Token savings
|
|
78
|
+
|
|
79
|
+
Every time you read a raw LLM response, you pay in attention — or in tokens if you pipe it into another model.
|
|
80
|
+
|
|
81
|
+
| | Words | Reading tokens | Cost to re-read |
|
|
82
|
+
|---|---|---|---|
|
|
83
|
+
| Raw LLM response | ~400 | ~530 | 100% |
|
|
84
|
+
| **grandma card** | **~40** | **~55** | **~10%** |
|
|
85
|
+
| **Savings** | | | **~90% fewer tokens** |
|
|
86
|
+
|
|
87
|
+
**Why this matters:**
|
|
88
|
+
|
|
89
|
+
- In agent loops, every intermediate response fed back into context costs tokens. Grandma compresses the signal.
|
|
90
|
+
- In multi-step workflows (plan → code → review → deploy), each step can save 400–500 tokens of context bloat.
|
|
91
|
+
- Deep mode trades a bit more output for full structured data — still 70–80% smaller than the raw response.
|
|
92
|
+
- Across a 20-turn session, grandma typically saves **8,000–12,000 context tokens**.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Before / After
|
|
97
|
+
|
|
98
|
+
**Raw LLM output (~90 words, ~120 tokens):**
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
I inspected the repository and found that the authentication flow now routes through
|
|
102
|
+
the new async session adapter. I updated three files, added one regression test, and
|
|
103
|
+
confirmed that the login path still returns the expected token shape. There is one
|
|
104
|
+
compatibility consideration: the adapter relies on Python 3.9+ typing behavior, so
|
|
105
|
+
Python 3.8 users will need to upgrade or pin the old release. Overall, this should
|
|
106
|
+
reduce request latency, but the deployment notes should mention the runtime floor.
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**After grandma (default mode — ~30 words, ~40 tokens):**
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
👵 grandma
|
|
113
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
114
|
+
📖 Second turn reviewing an auth refactor PR.
|
|
115
|
+
|
|
116
|
+
What happened: Auth moved to the async session adapter.
|
|
117
|
+
Bottom line: Faster login path, but Python 3.8 is out.
|
|
118
|
+
Do next: Document Python ≥3.9 before shipping.
|
|
119
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**After grandma (deep mode — full impact table):**
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
👵 grandma
|
|
126
|
+
┌──────────────┬──────────────────────────────────────────────┐
|
|
127
|
+
│ 📖 story arc │ Second turn reviewing an auth refactor PR. │
|
|
128
|
+
│ 👀 happened │ Auth moved to async session adapter. │
|
|
129
|
+
│ 🧶 changed │ 3 files, 1 regression test added. │
|
|
130
|
+
│ ✅ positive │ Login latency reduced; token shape unchanged. │
|
|
131
|
+
│ ⚠️ negative │ Breaks Python 3.8 (asyncio.TaskGroup). │
|
|
132
|
+
│ ➖ neutral │ API surface unchanged. │
|
|
133
|
+
│ 💡 net gain │ Win — ship it with a runtime floor note. │
|
|
134
|
+
│ 📋 actions │ - Add Python ≥3.9 to pyproject.toml │
|
|
135
|
+
│ │ - Update deployment docs │
|
|
136
|
+
└──────────────┴──────────────────────────────────────────────┘
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Install
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
pip install grandma
|
|
145
|
+
# or
|
|
146
|
+
pipx install grandma
|
|
147
|
+
# or from source
|
|
148
|
+
pip install git+https://github.com/ypollak2/grandma.git
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Usage
|
|
154
|
+
|
|
155
|
+
**Pipe any text through grandma:**
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
echo "long agent output..." | grandma
|
|
159
|
+
cat response.txt | grandma --mode deep
|
|
160
|
+
cat response.txt | grandma --json # raw JSON verdict
|
|
161
|
+
cat response.txt | grandma --mode off # passthrough
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Demo (no API key needed):**
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
grandma --demo
|
|
168
|
+
grandma --demo --mode deep
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**Environment variable for default mode:**
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
export GRANDMA_MODE=deep
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## The Modes
|
|
180
|
+
|
|
181
|
+
| Mode | What you get | Model used | Best for |
|
|
182
|
+
|---|---|---|---|
|
|
183
|
+
| `default` | 3-line card: happened / bottom line / do next | Haiku | Most agent output |
|
|
184
|
+
| `deep` | Full impact table with positive/negative/neutral | Sonnet | PRs, arch decisions, refactors |
|
|
185
|
+
| `off` | Passthrough — original text unchanged | — | When you need the whole casserole |
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Works without an API key
|
|
190
|
+
|
|
191
|
+
Grandma runs on your **Claude Code subscription** — no `ANTHROPIC_API_KEY` needed:
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
grandma → claude -p - (stdin pipe) → your Claude Code OAuth session
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Set `ANTHROPIC_API_KEY` only if you want to use your own API credits instead.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## IDE & agent integrations
|
|
202
|
+
|
|
203
|
+
Grandma works anywhere LLMs produce text. One-liner install for all detected tools:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
./install.sh
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
| Tool | Integration type | What happens |
|
|
210
|
+
|---|---|---|
|
|
211
|
+
| **Claude Code** | Stop hook (native) | Auto-card after every long response |
|
|
212
|
+
| **Codex CLI** | Stop hook (native) | Auto-card after every long response |
|
|
213
|
+
| **Gemini CLI** | AfterAgent hook (native) | Auto-card after every agent turn |
|
|
214
|
+
| **Cursor** | MCP + `.cursor/rules` | Agent calls `grandma_summarize` after long replies |
|
|
215
|
+
| **Cline** | MCP + rules | Agent calls `grandma_summarize` after tasks |
|
|
216
|
+
| **Continue** | MCP + `/grandma` slash command | On demand or automatic |
|
|
217
|
+
| **Windsurf** | MCP + `.windsurfrules` | Agent calls `grandma_summarize` after long replies |
|
|
218
|
+
| **Zed** | MCP (`context_servers`) | Tool available in Zed AI panel |
|
|
219
|
+
| **Goose** | MCP extension | Tool available in Goose sessions |
|
|
220
|
+
| **Aider** | `grandma-aider` wrapper | Pipe aider output through grandma |
|
|
221
|
+
| **OpenHands** | `grandma-openhands` wrapper | Pipe headless output through grandma |
|
|
222
|
+
|
|
223
|
+
**MCP server (for any MCP-capable IDE):**
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
grandma serve
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Exposes two tools:
|
|
230
|
+
- `grandma_summarize(text, mode, story_context)` → plain-text card
|
|
231
|
+
- `grandma_summarize_json(text, mode, story_context)` → structured dict
|
|
232
|
+
|
|
233
|
+
Add to any `.mcp.json`:
|
|
234
|
+
|
|
235
|
+
```json
|
|
236
|
+
{
|
|
237
|
+
"mcpServers": {
|
|
238
|
+
"grandma": { "command": "grandma", "args": ["serve"] }
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## How the mascot rotates
|
|
246
|
+
|
|
247
|
+
Each grandma portrait in this repo (`assets/grandmas/`) was generated with Gemini Image.
|
|
248
|
+
A [daily GitHub Action](.github/workflows/rotate-grandma.yml) picks one at random and replaces `assets/grandma.png`.
|
|
249
|
+
The README always shows the current winner. No JS. No CDN. No infrastructure.
|
|
250
|
+
|
|
251
|
+
Want to add your own grandma? Drop a PNG into `assets/grandmas/` and open a PR.
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## FAQ
|
|
256
|
+
|
|
257
|
+
**Does grandma make it dumber?**
|
|
258
|
+
No dear. She keeps the facts. She removes the fog machine.
|
|
259
|
+
|
|
260
|
+
**Does default mode include everything?**
|
|
261
|
+
It includes what you need first. Use `--mode deep` when you need the full table.
|
|
262
|
+
|
|
263
|
+
**Why is there an off mode?**
|
|
264
|
+
Because sometimes you want the original, and grandma knows when to leave a person alone.
|
|
265
|
+
|
|
266
|
+
**What's the `story_so_far` line?**
|
|
267
|
+
Grandma reads the last 3 turns of the conversation to understand where you are in the arc.
|
|
268
|
+
If you are on turn 8 of debugging the same auth bug, she will tell you. This is the dementia prevention feature.
|
|
269
|
+
|
|
270
|
+
**Which models does it use?**
|
|
271
|
+
Default mode: `claude-haiku-4-5-20251001`. Deep mode: `claude-sonnet-4-6`.
|
|
272
|
+
Both run on your Claude Code subscription — no extra key needed.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
<div align="center">
|
|
277
|
+
<sub>Made with 💜 by <a href="https://github.com/ypollak2">Yali Pollak</a> · MIT License</sub>
|
|
278
|
+
</div>
|
grandma-0.1.0/README.md
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<!-- Grandma rotates daily via .github/workflows/rotate-grandma.yml -->
|
|
4
|
+
<img src="assets/grandma.png" alt="👵 grandma" width="320" />
|
|
5
|
+
|
|
6
|
+
# 👵 grandma
|
|
7
|
+
|
|
8
|
+
**Explain it like you'd tell grandma.**
|
|
9
|
+
|
|
10
|
+
[](https://pypi.org/project/grandma)
|
|
11
|
+
[](https://pypi.org/project/grandma)
|
|
12
|
+
[](https://github.com/ypollak2/grandma/blob/main/LICENSE)
|
|
13
|
+
[](https://github.com/ypollak2/grandma/actions/workflows/ci.yml)
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
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.
|
|
20
|
+
|
|
21
|
+
Grandma does not dumb it down. She keeps every fact that matters. She just refuses to waste your afternoon.
|
|
22
|
+
|
|
23
|
+
`grandma` takes verbose LLM output and distils it to three lines: **what happened**, **the bottom line**, and **what to do next**.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 💸 Token savings
|
|
28
|
+
|
|
29
|
+
Every time you read a raw LLM response, you pay in attention — or in tokens if you pipe it into another model.
|
|
30
|
+
|
|
31
|
+
| | Words | Reading tokens | Cost to re-read |
|
|
32
|
+
|---|---|---|---|
|
|
33
|
+
| Raw LLM response | ~400 | ~530 | 100% |
|
|
34
|
+
| **grandma card** | **~40** | **~55** | **~10%** |
|
|
35
|
+
| **Savings** | | | **~90% fewer tokens** |
|
|
36
|
+
|
|
37
|
+
**Why this matters:**
|
|
38
|
+
|
|
39
|
+
- In agent loops, every intermediate response fed back into context costs tokens. Grandma compresses the signal.
|
|
40
|
+
- In multi-step workflows (plan → code → review → deploy), each step can save 400–500 tokens of context bloat.
|
|
41
|
+
- Deep mode trades a bit more output for full structured data — still 70–80% smaller than the raw response.
|
|
42
|
+
- Across a 20-turn session, grandma typically saves **8,000–12,000 context tokens**.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Before / After
|
|
47
|
+
|
|
48
|
+
**Raw LLM output (~90 words, ~120 tokens):**
|
|
49
|
+
|
|
50
|
+
```text
|
|
51
|
+
I inspected the repository and found that the authentication flow now routes through
|
|
52
|
+
the new async session adapter. I updated three files, added one regression test, and
|
|
53
|
+
confirmed that the login path still returns the expected token shape. There is one
|
|
54
|
+
compatibility consideration: the adapter relies on Python 3.9+ typing behavior, so
|
|
55
|
+
Python 3.8 users will need to upgrade or pin the old release. Overall, this should
|
|
56
|
+
reduce request latency, but the deployment notes should mention the runtime floor.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**After grandma (default mode — ~30 words, ~40 tokens):**
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
👵 grandma
|
|
63
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
64
|
+
📖 Second turn reviewing an auth refactor PR.
|
|
65
|
+
|
|
66
|
+
What happened: Auth moved to the async session adapter.
|
|
67
|
+
Bottom line: Faster login path, but Python 3.8 is out.
|
|
68
|
+
Do next: Document Python ≥3.9 before shipping.
|
|
69
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**After grandma (deep mode — full impact table):**
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
👵 grandma
|
|
76
|
+
┌──────────────┬──────────────────────────────────────────────┐
|
|
77
|
+
│ 📖 story arc │ Second turn reviewing an auth refactor PR. │
|
|
78
|
+
│ 👀 happened │ Auth moved to async session adapter. │
|
|
79
|
+
│ 🧶 changed │ 3 files, 1 regression test added. │
|
|
80
|
+
│ ✅ positive │ Login latency reduced; token shape unchanged. │
|
|
81
|
+
│ ⚠️ negative │ Breaks Python 3.8 (asyncio.TaskGroup). │
|
|
82
|
+
│ ➖ neutral │ API surface unchanged. │
|
|
83
|
+
│ 💡 net gain │ Win — ship it with a runtime floor note. │
|
|
84
|
+
│ 📋 actions │ - Add Python ≥3.9 to pyproject.toml │
|
|
85
|
+
│ │ - Update deployment docs │
|
|
86
|
+
└──────────────┴──────────────────────────────────────────────┘
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Install
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pip install grandma
|
|
95
|
+
# or
|
|
96
|
+
pipx install grandma
|
|
97
|
+
# or from source
|
|
98
|
+
pip install git+https://github.com/ypollak2/grandma.git
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Usage
|
|
104
|
+
|
|
105
|
+
**Pipe any text through grandma:**
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
echo "long agent output..." | grandma
|
|
109
|
+
cat response.txt | grandma --mode deep
|
|
110
|
+
cat response.txt | grandma --json # raw JSON verdict
|
|
111
|
+
cat response.txt | grandma --mode off # passthrough
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Demo (no API key needed):**
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
grandma --demo
|
|
118
|
+
grandma --demo --mode deep
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Environment variable for default mode:**
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
export GRANDMA_MODE=deep
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## The Modes
|
|
130
|
+
|
|
131
|
+
| Mode | What you get | Model used | Best for |
|
|
132
|
+
|---|---|---|---|
|
|
133
|
+
| `default` | 3-line card: happened / bottom line / do next | Haiku | Most agent output |
|
|
134
|
+
| `deep` | Full impact table with positive/negative/neutral | Sonnet | PRs, arch decisions, refactors |
|
|
135
|
+
| `off` | Passthrough — original text unchanged | — | When you need the whole casserole |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Works without an API key
|
|
140
|
+
|
|
141
|
+
Grandma runs on your **Claude Code subscription** — no `ANTHROPIC_API_KEY` needed:
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
grandma → claude -p - (stdin pipe) → your Claude Code OAuth session
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Set `ANTHROPIC_API_KEY` only if you want to use your own API credits instead.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## IDE & agent integrations
|
|
152
|
+
|
|
153
|
+
Grandma works anywhere LLMs produce text. One-liner install for all detected tools:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
./install.sh
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
| Tool | Integration type | What happens |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| **Claude Code** | Stop hook (native) | Auto-card after every long response |
|
|
162
|
+
| **Codex CLI** | Stop hook (native) | Auto-card after every long response |
|
|
163
|
+
| **Gemini CLI** | AfterAgent hook (native) | Auto-card after every agent turn |
|
|
164
|
+
| **Cursor** | MCP + `.cursor/rules` | Agent calls `grandma_summarize` after long replies |
|
|
165
|
+
| **Cline** | MCP + rules | Agent calls `grandma_summarize` after tasks |
|
|
166
|
+
| **Continue** | MCP + `/grandma` slash command | On demand or automatic |
|
|
167
|
+
| **Windsurf** | MCP + `.windsurfrules` | Agent calls `grandma_summarize` after long replies |
|
|
168
|
+
| **Zed** | MCP (`context_servers`) | Tool available in Zed AI panel |
|
|
169
|
+
| **Goose** | MCP extension | Tool available in Goose sessions |
|
|
170
|
+
| **Aider** | `grandma-aider` wrapper | Pipe aider output through grandma |
|
|
171
|
+
| **OpenHands** | `grandma-openhands` wrapper | Pipe headless output through grandma |
|
|
172
|
+
|
|
173
|
+
**MCP server (for any MCP-capable IDE):**
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
grandma serve
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Exposes two tools:
|
|
180
|
+
- `grandma_summarize(text, mode, story_context)` → plain-text card
|
|
181
|
+
- `grandma_summarize_json(text, mode, story_context)` → structured dict
|
|
182
|
+
|
|
183
|
+
Add to any `.mcp.json`:
|
|
184
|
+
|
|
185
|
+
```json
|
|
186
|
+
{
|
|
187
|
+
"mcpServers": {
|
|
188
|
+
"grandma": { "command": "grandma", "args": ["serve"] }
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## How the mascot rotates
|
|
196
|
+
|
|
197
|
+
Each grandma portrait in this repo (`assets/grandmas/`) was generated with Gemini Image.
|
|
198
|
+
A [daily GitHub Action](.github/workflows/rotate-grandma.yml) picks one at random and replaces `assets/grandma.png`.
|
|
199
|
+
The README always shows the current winner. No JS. No CDN. No infrastructure.
|
|
200
|
+
|
|
201
|
+
Want to add your own grandma? Drop a PNG into `assets/grandmas/` and open a PR.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## FAQ
|
|
206
|
+
|
|
207
|
+
**Does grandma make it dumber?**
|
|
208
|
+
No dear. She keeps the facts. She removes the fog machine.
|
|
209
|
+
|
|
210
|
+
**Does default mode include everything?**
|
|
211
|
+
It includes what you need first. Use `--mode deep` when you need the full table.
|
|
212
|
+
|
|
213
|
+
**Why is there an off mode?**
|
|
214
|
+
Because sometimes you want the original, and grandma knows when to leave a person alone.
|
|
215
|
+
|
|
216
|
+
**What's the `story_so_far` line?**
|
|
217
|
+
Grandma reads the last 3 turns of the conversation to understand where you are in the arc.
|
|
218
|
+
If you are on turn 8 of debugging the same auth bug, she will tell you. This is the dementia prevention feature.
|
|
219
|
+
|
|
220
|
+
**Which models does it use?**
|
|
221
|
+
Default mode: `claude-haiku-4-5-20251001`. Deep mode: `claude-sonnet-4-6`.
|
|
222
|
+
Both run on your Claude Code subscription — no extra key needed.
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
<div align="center">
|
|
227
|
+
<sub>Made with 💜 by <a href="https://github.com/ypollak2">Yali Pollak</a> · MIT License</sub>
|
|
228
|
+
</div>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|