mrstack 1.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.
- mrstack-1.1.0/.gitignore +18 -0
- mrstack-1.1.0/LICENSE +21 -0
- mrstack-1.1.0/PKG-INFO +640 -0
- mrstack-1.1.0/README.en.md +612 -0
- mrstack-1.1.0/README.md +685 -0
- mrstack-1.1.0/config/com.mrstack.claude-telegram.plist +25 -0
- mrstack-1.1.0/config/mcp-config.example.json +23 -0
- mrstack-1.1.0/config/start-daemon.sh +53 -0
- mrstack-1.1.0/config/start.sh +29 -0
- mrstack-1.1.0/mrstack/__init__.py +4 -0
- mrstack-1.1.0/mrstack/cli.py +330 -0
- mrstack-1.1.0/mrstack/constants.py +77 -0
- mrstack-1.1.0/mrstack/daemon.py +325 -0
- mrstack-1.1.0/mrstack/patcher.py +169 -0
- mrstack-1.1.0/mrstack/wizard.py +271 -0
- mrstack-1.1.0/pyproject.toml +66 -0
- mrstack-1.1.0/schedulers/manage-jobs.sh +87 -0
- mrstack-1.1.0/schedulers/morning-briefing.sh +29 -0
- mrstack-1.1.0/schedulers/register-jobs.py +182 -0
- mrstack-1.1.0/schedulers/run-threads-briefing.sh +36 -0
- mrstack-1.1.0/schedulers/weekly-review.sh +26 -0
- mrstack-1.1.0/src/api/dashboard.py +223 -0
- mrstack-1.1.0/src/api/templates/dashboard.html +328 -0
- mrstack-1.1.0/src/bot/handlers/callback.py +1432 -0
- mrstack-1.1.0/src/bot/handlers/command.py +1541 -0
- mrstack-1.1.0/src/bot/utils/keyboards.py +125 -0
- mrstack-1.1.0/src/bot/utils/ui_components.py +166 -0
- mrstack-1.1.0/src/claude/session.py +341 -0
- mrstack-1.1.0/src/jarvis/__init__.py +77 -0
- mrstack-1.1.0/src/jarvis/coach.py +122 -0
- mrstack-1.1.0/src/jarvis/context_engine.py +463 -0
- mrstack-1.1.0/src/jarvis/pattern_learner.py +255 -0
- mrstack-1.1.0/src/jarvis/persona.py +84 -0
- mrstack-1.1.0/src/jarvis/platform.py +182 -0
- mrstack-1.1.0/src/knowledge/__init__.py +6 -0
- mrstack-1.1.0/src/knowledge/manager.py +464 -0
- mrstack-1.1.0/src/knowledge/memory_index.py +180 -0
- mrstack-1.1.0/templates/DESIGN-GUIDE.md +160 -0
- mrstack-1.1.0/templates/alert.md +56 -0
- mrstack-1.1.0/templates/evening-summary.md +73 -0
- mrstack-1.1.0/templates/jarvis-alert.md +64 -0
- mrstack-1.1.0/templates/morning-briefing.md +53 -0
- mrstack-1.1.0/templates/weekly-review.md +79 -0
mrstack-1.1.0/.gitignore
ADDED
mrstack-1.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 thestack_ai (whynowlab)
|
|
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.
|
mrstack-1.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mrstack
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Proactive AI Butler for Claude Code — Telegram Bot with Memory, Jarvis Mode, and Daily Coaching
|
|
5
|
+
Project-URL: Homepage, https://github.com/whynowlab/mrstack
|
|
6
|
+
Project-URL: Repository, https://github.com/whynowlab/mrstack
|
|
7
|
+
Project-URL: Issues, https://github.com/whynowlab/mrstack/issues
|
|
8
|
+
Author-email: DD <dd@whynowlab.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai,assistant,butler,claude,jarvis,telegram
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: MacOS
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Communications :: Chat
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: psutil>=5.9
|
|
25
|
+
Requires-Dist: rich>=13.0
|
|
26
|
+
Requires-Dist: typer>=0.9.0
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
<div align="center">
|
|
30
|
+
|
|
31
|
+
<img src="assets/logo.svg" alt="Mr.Stack" width="180" />
|
|
32
|
+
|
|
33
|
+
# Mr.Stack
|
|
34
|
+
|
|
35
|
+
**Claude that works while your MacBook sleeps. Morning briefings, nightly coaching.**
|
|
36
|
+
|
|
37
|
+
Claude Code + Telegram = Your 24/7 AI development partner
|
|
38
|
+
|
|
39
|
+
[](https://opensource.org/licenses/MIT)
|
|
40
|
+
[](https://pypi.org/project/mrstack/)
|
|
41
|
+
[](https://python.org)
|
|
42
|
+
[](https://apple.com/macos)
|
|
43
|
+
[](https://t.me/botfather)
|
|
44
|
+
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
**Observes your Mac | Remembers conversations | Learns your patterns | Speaks first** — an AI partner that doesn't wait to be asked.
|
|
48
|
+
|
|
49
|
+
### Quick Start
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Install (pick one)
|
|
53
|
+
uv tool install mrstack # recommended
|
|
54
|
+
pip install mrstack # alternative
|
|
55
|
+
# git clone https://github.com/whynowlab/mrstack.git && pip install -e .
|
|
56
|
+
|
|
57
|
+
# Setup & run
|
|
58
|
+
mrstack init # interactive setup wizard
|
|
59
|
+
mrstack start # start the bot
|
|
60
|
+
# or: mrstack daemon # register as background service
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
<details>
|
|
64
|
+
<summary><b>All CLI commands</b></summary>
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
mrstack init # Interactive setup wizard
|
|
68
|
+
mrstack start # Start bot (foreground)
|
|
69
|
+
mrstack start --bg # Start bot (background)
|
|
70
|
+
mrstack stop # Stop bot
|
|
71
|
+
mrstack daemon # Install system daemon (launchd/systemd)
|
|
72
|
+
mrstack daemon -u # Uninstall daemon
|
|
73
|
+
mrstack status # Show status
|
|
74
|
+
mrstack logs [-f] # View/follow logs
|
|
75
|
+
mrstack config # Edit .env configuration
|
|
76
|
+
mrstack jarvis on/off # Toggle Jarvis mode
|
|
77
|
+
mrstack patch # Re-install Mr.Stack modules
|
|
78
|
+
mrstack update # Update to latest version
|
|
79
|
+
mrstack version # Show version info
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
</details>
|
|
83
|
+
|
|
84
|
+
> Legacy install (`git clone && ./install.sh`) is still supported. See [Installation](#installation) for details.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## What is Mr.Stack?
|
|
89
|
+
|
|
90
|
+
An **always-on** Telegram AI partner built on [Claude Code](https://claude.ai).
|
|
91
|
+
|
|
92
|
+
It extends Claude Code beyond the terminal — through Telegram, it works 24/7, even when your MacBook lid is closed, you're away from your desk, or you're asleep.
|
|
93
|
+
|
|
94
|
+
> A typical AI assistant sits in an office waiting for your call.
|
|
95
|
+
> Mr.Stack is more like **a senior colleague sitting next to you, looking at the same screen**.
|
|
96
|
+
|
|
97
|
+
Three pillars:
|
|
98
|
+
- **Proactive alerts** — Scans your Mac every 5 minutes and reaches out via Telegram when something needs attention
|
|
99
|
+
- **Persistent memory** — Remembers conversations and carries context across sessions
|
|
100
|
+
- **Pattern learning** — Analyzes your work habits and sends data-driven coaching every night
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Key Features
|
|
105
|
+
|
|
106
|
+
### 1. Telegram AI Assistant
|
|
107
|
+
Give Claude instructions with a single Telegram message.
|
|
108
|
+
|
|
109
|
+
- Write / edit / debug / refactor code
|
|
110
|
+
- Process files, photos (image recognition), and voice messages
|
|
111
|
+
- Voice in, voice out (Whisper + TTS)
|
|
112
|
+
- Auto-analyze clipboard content (error → root cause, URL → summary, code → review)
|
|
113
|
+
|
|
114
|
+
### 2. Memory System — An AI That Doesn't Forget
|
|
115
|
+
|
|
116
|
+
Most AIs have **goldfish memory**. Close the window, everything resets.
|
|
117
|
+
Mr.Stack separates **working memory (volatile)** from **long-term memory (persistent)**, much like the human brain.
|
|
118
|
+
|
|
119
|
+
#### Working Memory (Volatile)
|
|
120
|
+
- **Context snapshots**: Last 1 hour of system state (in-memory only, 12-slot ring buffer)
|
|
121
|
+
- **Current session**: Lives within Claude's context window
|
|
122
|
+
- **Recent interactions**: Last 7 days from `interactions.jsonl` → used for pattern analysis
|
|
123
|
+
|
|
124
|
+
#### Long-Term Memory (Persistent)
|
|
125
|
+
Every 3 hours, recent conversations are analyzed and **only meaningful information is extracted** for permanent storage:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
~/claude-telegram/memory/
|
|
129
|
+
people/ → People mentioned in conversations (overwrite)
|
|
130
|
+
projects/ → Project progress and technical decisions (overwrite)
|
|
131
|
+
decisions/ → Decisions and their reasoning (append)
|
|
132
|
+
preferences/ → Your preferences — coding style, tools, language (overwrite)
|
|
133
|
+
daily/ → Daily summary archive (1 file per day)
|
|
134
|
+
knowledge/ → Newly acquired knowledge (overwrite)
|
|
135
|
+
patterns/ → Work pattern data (interactions.jsonl)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The key insight: **it updates, not accumulates.** Like Git's HEAD, `people/`, `projects/`, and `preferences/` always maintain **only the latest snapshot**. Files don't grow forever.
|
|
139
|
+
|
|
140
|
+
The only append-mode data is `daily/` (1 per day, ~1KB) and `interactions.jsonl` (~300B per conversation). After a full year of use, **total storage is 10–15MB**.
|
|
141
|
+
|
|
142
|
+
Say "continue what I was working on yesterday" and it picks up exactly where you left off.
|
|
143
|
+
|
|
144
|
+
### 3. Always-On System (Jarvis Mode)
|
|
145
|
+
|
|
146
|
+
Like a linter watching your code in real-time, Mr.Stack **scans your entire Mac every 5 minutes**:
|
|
147
|
+
|
|
148
|
+
- Active application (osascript)
|
|
149
|
+
- Battery level and charging state (pmset)
|
|
150
|
+
- CPU load (sysctl)
|
|
151
|
+
- Git branch and working tree status
|
|
152
|
+
- Chrome active tabs
|
|
153
|
+
- Recent terminal commands
|
|
154
|
+
|
|
155
|
+
From this data, your current context is classified into **7 states**:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
CODING · BROWSING · MEETING · COMMUNICATION · BREAK · DEEP_WORK · AWAY
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Based on state classification, **7 triggers fire proactively**:
|
|
162
|
+
|
|
163
|
+
| Situation | Mr.Stack's Response |
|
|
164
|
+
|-----------|-------------------|
|
|
165
|
+
| Battery below 20% | "Battery at 12% — save your work" |
|
|
166
|
+
| Returned from away | "Welcome back. You were on the feature/auth branch" |
|
|
167
|
+
| 3+ hours of continuous coding | "You've been coding for 3 hours — take a break" |
|
|
168
|
+
| 5+ app switches in 10 min | "Too many context switches. Try to focus" |
|
|
169
|
+
| Same file for 30 min, no commits | "Are you stuck? Need help?" |
|
|
170
|
+
| Terminal error detected | "Want me to analyze that error?" |
|
|
171
|
+
| Deep work mode (2+ hours focused) | Only critical alerts pass through |
|
|
172
|
+
|
|
173
|
+
Each trigger has a **debounce cooldown**. No alert spam.
|
|
174
|
+
During deep work: **interrupt masking** — everything blocked except battery warnings.
|
|
175
|
+
|
|
176
|
+
### 4. Pattern Learning — Logs Become Insights
|
|
177
|
+
|
|
178
|
+
Every conversation is logged as a structured event in `interactions.jsonl`:
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"ts": "2026-02-28T10:00:00",
|
|
183
|
+
"hour": 10,
|
|
184
|
+
"state": "CODING",
|
|
185
|
+
"request_type": "debug",
|
|
186
|
+
"duration_ms": 5200,
|
|
187
|
+
"tools_used": ["Read", "Edit", "Bash"]
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Like Prometheus collecting metrics, these logs are analyzed as time-series data:
|
|
192
|
+
- **Peak hours**: "Most productive between 10–12" (max throughput window)
|
|
193
|
+
- **Request type distribution**: "40% debugging, 30% features, 20% questions" (work profiling)
|
|
194
|
+
- **Pattern detection**: "Requests weekly planning every Monday at 10am" (recurring event detection)
|
|
195
|
+
- **Routine learning**: Confidence > 0.7 triggers preemptive preparation (predictive prefetching)
|
|
196
|
+
|
|
197
|
+
### 5. Daily Coaching Report
|
|
198
|
+
|
|
199
|
+
Every night, a report like this arrives via Telegram:
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
[Daily Coach] 2026-02-28
|
|
203
|
+
|
|
204
|
+
Productivity: 8/10 (+1 from yesterday)
|
|
205
|
+
|
|
206
|
+
What went well:
|
|
207
|
+
• 2-hour focus block in the morning → 4 commits
|
|
208
|
+
• Clear specs → 0 rework
|
|
209
|
+
|
|
210
|
+
Areas to improve:
|
|
211
|
+
• 7 context switches between 2–4pm — least efficient window
|
|
212
|
+
→ Tomorrow: try a single-task block during this time
|
|
213
|
+
• 40% debugging ratio — writing tests first could cut this in half
|
|
214
|
+
|
|
215
|
+
Weekly trend:
|
|
216
|
+
• Instruction clarity improving (2.1 → 2.6)
|
|
217
|
+
• Most productive hours: 10–12 (consistent)
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
What a scrum master should say during sprint retro — **delivered nightly, backed by data.**
|
|
221
|
+
No flattery, just numbers. Manual access via `/coach`.
|
|
222
|
+
|
|
223
|
+
### 6. Context-Aware Tone (Persona Layer)
|
|
224
|
+
|
|
225
|
+
The same information should be delivered differently depending on context. Terse while coding, summary-first when returning.
|
|
226
|
+
|
|
227
|
+
| State | Tone | Example |
|
|
228
|
+
|-------|------|---------|
|
|
229
|
+
| Coding | Technical, concise | `"auth.py:42 — missing null check"` |
|
|
230
|
+
| Deep work | Silent (urgent only) | — |
|
|
231
|
+
| Returning from break | Warm, summary | `"Welcome back. PR #23 awaiting review"` |
|
|
232
|
+
| After 10pm | Concerned | `"You've done enough today. Pick it up tomorrow"` |
|
|
233
|
+
|
|
234
|
+
### 7. Scheduled Jobs (9 cron-based automations)
|
|
235
|
+
|
|
236
|
+
Like a CI/CD pipeline — configure once, runs automatically on schedule.
|
|
237
|
+
|
|
238
|
+
| Job | Schedule | Model |
|
|
239
|
+
|-----|----------|-------|
|
|
240
|
+
| Morning briefing (calendar + tasks + news) | Weekdays 08:00 | Sonnet |
|
|
241
|
+
| Evening summary + coaching report | Daily 21:00 | Opus |
|
|
242
|
+
| Weekly review | Fridays 18:00 | Opus |
|
|
243
|
+
| Calendar reminder | Weekdays 09/12/15/18 | Haiku |
|
|
244
|
+
| Conversation → memory auto-update | Every 3 hours | Sonnet |
|
|
245
|
+
| GitHub notification check | Every 2 hours | Haiku |
|
|
246
|
+
| Notion work log sync | Daily 22:00 | Sonnet |
|
|
247
|
+
| AI news summary + Notion save | Daily 08:30, 20:30 | Sonnet |
|
|
248
|
+
| OAuth token expiry monitor | Daily 10:00 | Haiku |
|
|
249
|
+
|
|
250
|
+
> **Model routing**: Automatically selects the right model per job complexity. Simple lookups (Haiku) → analysis/summary (Sonnet) → deep reflection (Opus). Reduces overnight usage by 60–70%.
|
|
251
|
+
|
|
252
|
+
### 8. External Integrations (MCP)
|
|
253
|
+
|
|
254
|
+
Mr.Stack connects to external services via MCP (Model Context Protocol).
|
|
255
|
+
**Each service is optional** — core features work fine without them.
|
|
256
|
+
|
|
257
|
+
| Service | Capability | Setup |
|
|
258
|
+
|---------|-----------|-------|
|
|
259
|
+
| **Google Calendar** | View/create events, reminders | Google Cloud OAuth 2.0 |
|
|
260
|
+
| **Notion** | Automatic work log recording | Notion Integration API key |
|
|
261
|
+
| **GitHub** | PR, issue, notification monitoring | `gh auth login` (CLI auth) |
|
|
262
|
+
| **Playwright** | Web automation | `npx playwright install` |
|
|
263
|
+
| **AppleScript** | macOS control | Accessibility permission |
|
|
264
|
+
|
|
265
|
+
Jobs for unconnected services are automatically skipped (no errors).
|
|
266
|
+
|
|
267
|
+
### 9. Claude HUD — Real-Time Usage Monitor
|
|
268
|
+
|
|
269
|
+
A **real-time status bar (HUD)** is displayed at the top of your Claude Code terminal.
|
|
270
|
+
Usage data is fetched directly from the Anthropic API, so it's always accurate.
|
|
271
|
+
|
|
272
|
+
Displays:
|
|
273
|
+
- **Model name** — Currently active Claude model
|
|
274
|
+
- **Context usage** — Context window utilization
|
|
275
|
+
- **Plan usage** — Usage percentage on 5-hour / 7-day windows
|
|
276
|
+
- **Tool activity** — Currently running tool status
|
|
277
|
+
- **Agent status** — Active agent information
|
|
278
|
+
- **Todo progress** — Task list completion rate
|
|
279
|
+
|
|
280
|
+
`install.sh` automatically installs and configures the HUD. No extra setup needed.
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## How Is This Different?
|
|
285
|
+
|
|
286
|
+
| | Typical AI Bot | Mr.Stack |
|
|
287
|
+
|---|---------------|----------|
|
|
288
|
+
| **Interaction** | Request-response (must be asked) | **Event-driven (proactive alerts on conditions)** |
|
|
289
|
+
| **Security** | API keys sent to external servers | **Runs only on your Mac. Zero servers** |
|
|
290
|
+
| **Availability** | Tied to terminal session | **macOS daemon — 24h even with lid closed** |
|
|
291
|
+
| **Memory** | Stateless (session end = reset) | **Persistent memory (permanent storage, context carried)** |
|
|
292
|
+
| **Learning** | None | **Time-series pattern analysis + routine prediction** |
|
|
293
|
+
| **Coaching** | None | **Daily productivity metrics + data-driven suggestions** |
|
|
294
|
+
| **Data** | Cloud storage | **100% local (SQLite, JSONL, Markdown)** |
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Prerequisites
|
|
299
|
+
|
|
300
|
+
Before you begin:
|
|
301
|
+
|
|
302
|
+
| Requirement | Description | Where |
|
|
303
|
+
|-------------|-------------|-------|
|
|
304
|
+
| **macOS** | Apple Silicon or Intel | — |
|
|
305
|
+
| **Claude Code** | Anthropic's AI coding tool (Max plan recommended) | [claude.ai/download](https://claude.ai/download) |
|
|
306
|
+
| **Telegram account** | Messenger to communicate with the bot | [telegram.org](https://telegram.org) |
|
|
307
|
+
| **Telegram Bot Token** | Create a bot via BotFather | Send `/newbot` to [@BotFather](https://t.me/botfather) |
|
|
308
|
+
| **Telegram User ID** | Your ID for receiving notifications | Send any message to [@userinfobot](https://t.me/userinfobot) |
|
|
309
|
+
| **claude-code-telegram** | Base bot framework | [github.com/nicepkg/claude-code-telegram](https://github.com/nicepkg/claude-code-telegram) |
|
|
310
|
+
|
|
311
|
+
### Get Your Telegram Bot Token (2 min)
|
|
312
|
+
|
|
313
|
+
1. Search for [@BotFather](https://t.me/botfather) in Telegram
|
|
314
|
+
2. Send `/newbot`
|
|
315
|
+
3. Enter a bot name (e.g., `My Stack Bot`)
|
|
316
|
+
4. Enter a bot username (e.g., `my_stack_bot`)
|
|
317
|
+
5. Save the token (`1234567890:ABCdef...`)
|
|
318
|
+
|
|
319
|
+
### Find Your Telegram User ID (30 sec)
|
|
320
|
+
|
|
321
|
+
1. Search for [@userinfobot](https://t.me/userinfobot) in Telegram
|
|
322
|
+
2. Send any message
|
|
323
|
+
3. Save the numeric ID
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Installation
|
|
328
|
+
|
|
329
|
+
Choose one of two methods:
|
|
330
|
+
|
|
331
|
+
### Method A: Manual Install
|
|
332
|
+
|
|
333
|
+
#### Step 1: Install the base bot
|
|
334
|
+
|
|
335
|
+
Install [claude-code-telegram](https://github.com/nicepkg/claude-code-telegram) first.
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
uv tool install claude-code-telegram
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Configure your `.env` file and verify the bot runs correctly.
|
|
342
|
+
|
|
343
|
+
#### Step 2: Install Mr.Stack
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
git clone https://github.com/whynowlab/mrstack.git
|
|
347
|
+
cd mrstack
|
|
348
|
+
./install.sh
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
The install script automatically:
|
|
352
|
+
- Locates your claude-code-telegram install path (uv / pipx)
|
|
353
|
+
- Copies the Jarvis module
|
|
354
|
+
- Patches 3 config files
|
|
355
|
+
- Adds `ENABLE_JARVIS=true` to `.env`
|
|
356
|
+
- Prompts for your Telegram User ID
|
|
357
|
+
- Creates the memory directory
|
|
358
|
+
|
|
359
|
+
#### Step 3: Restart the bot
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
# If running as a launchd daemon:
|
|
363
|
+
launchctl stop <your-service-name>
|
|
364
|
+
launchctl start <your-service-name>
|
|
365
|
+
|
|
366
|
+
# If running manually:
|
|
367
|
+
# Stop the process and restart
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
#### Step 4: Verify
|
|
371
|
+
|
|
372
|
+
```bash
|
|
373
|
+
curl http://localhost:8080/health # If API server is enabled
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
Send any message to your bot on Telegram.
|
|
377
|
+
`/jarvis` — check status | `/coach` — coaching report
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
### Method B: Install with Claude Code
|
|
382
|
+
|
|
383
|
+
If you have Claude Code installed, open it in your terminal and say:
|
|
384
|
+
|
|
385
|
+
```
|
|
386
|
+
Look at github.com/whynowlab/mrstack and install Mr.Stack for me.
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
Claude Code will read the README and install.sh, then guide you through setup.
|
|
390
|
+
If you don't have the base bot (claude-code-telegram) yet, just ask Claude to install that too.
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
### (Optional) External Service Integrations
|
|
395
|
+
|
|
396
|
+
MCP integrations are **optional**. Mr.Stack's core features work without them.
|
|
397
|
+
Set up only the services you need.
|
|
398
|
+
|
|
399
|
+
<details>
|
|
400
|
+
<summary><b>Google Calendar</b></summary>
|
|
401
|
+
|
|
402
|
+
1. Create a project in [Google Cloud Console](https://console.cloud.google.com/)
|
|
403
|
+
2. Enable Calendar API
|
|
404
|
+
3. Create OAuth 2.0 Client ID (Desktop app)
|
|
405
|
+
4. Add `client_id` and `client_secret` to MCP config
|
|
406
|
+
5. Register the Google Calendar server in `mcp-config.json`:
|
|
407
|
+
```json
|
|
408
|
+
{
|
|
409
|
+
"mcpServers": {
|
|
410
|
+
"google-calendar": {
|
|
411
|
+
"command": "npx",
|
|
412
|
+
"args": ["-y", "@anthropic/mcp-google-calendar"],
|
|
413
|
+
"env": {
|
|
414
|
+
"GOOGLE_CLIENT_ID": "your-client-id",
|
|
415
|
+
"GOOGLE_CLIENT_SECRET": "your-client-secret"
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
```
|
|
421
|
+
6. Enable MCP in `.env`:
|
|
422
|
+
```bash
|
|
423
|
+
ENABLE_MCP=true
|
|
424
|
+
MCP_CONFIG_PATH=/path/to/mcp-config.json
|
|
425
|
+
```
|
|
426
|
+
</details>
|
|
427
|
+
|
|
428
|
+
<details>
|
|
429
|
+
<summary><b>Notion</b></summary>
|
|
430
|
+
|
|
431
|
+
1. Create a new integration at [Notion Integrations](https://www.notion.so/my-integrations)
|
|
432
|
+
2. Copy the Internal Integration Token
|
|
433
|
+
3. In your target Notion database, click "Connect" → add the integration
|
|
434
|
+
4. Add to `mcp-config.json`:
|
|
435
|
+
```json
|
|
436
|
+
{
|
|
437
|
+
"mcpServers": {
|
|
438
|
+
"notion": {
|
|
439
|
+
"command": "npx",
|
|
440
|
+
"args": ["-y", "@anthropic/mcp-notion"],
|
|
441
|
+
"env": {
|
|
442
|
+
"NOTION_API_KEY": "ntn_your_api_key"
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
```
|
|
448
|
+
</details>
|
|
449
|
+
|
|
450
|
+
<details>
|
|
451
|
+
<summary><b>GitHub</b></summary>
|
|
452
|
+
|
|
453
|
+
The easiest one. In your terminal:
|
|
454
|
+
```bash
|
|
455
|
+
gh auth login
|
|
456
|
+
```
|
|
457
|
+
That's it. Mr.Stack uses the `gh` CLI to check GitHub notifications, PRs, and issues.
|
|
458
|
+
</details>
|
|
459
|
+
|
|
460
|
+
<details>
|
|
461
|
+
<summary><b>Playwright (Web Automation)</b></summary>
|
|
462
|
+
|
|
463
|
+
```bash
|
|
464
|
+
npx playwright install chromium
|
|
465
|
+
```
|
|
466
|
+
</details>
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
470
|
+
## Commands
|
|
471
|
+
|
|
472
|
+
| Command | Description |
|
|
473
|
+
|---------|-------------|
|
|
474
|
+
| `/new` | Start new conversation |
|
|
475
|
+
| `/status` | Session & cost overview |
|
|
476
|
+
| `/repo` | Switch project |
|
|
477
|
+
| `/jobs` | List scheduled jobs |
|
|
478
|
+
| `/usage` | Usage report |
|
|
479
|
+
| `/help` | Command reference |
|
|
480
|
+
| `/verbose` | Output verbosity (0/1/2) |
|
|
481
|
+
| `/voice` | Toggle voice responses |
|
|
482
|
+
| `/clipboard` | Clipboard auto-analysis |
|
|
483
|
+
| `/jarvis` | Pause/resume Jarvis |
|
|
484
|
+
| `/coach` | Daily coaching report |
|
|
485
|
+
| `/propose` | Spec-based change proposal |
|
|
486
|
+
| `/apply` | Execute spec implementation |
|
|
487
|
+
| `/archive` | Archive completed work |
|
|
488
|
+
| `/explore` | Exploration mode |
|
|
489
|
+
|
|
490
|
+
---
|
|
491
|
+
|
|
492
|
+
## Data & Privacy
|
|
493
|
+
|
|
494
|
+
- All data stored **only on your Mac** (`~/claude-telegram/memory/`)
|
|
495
|
+
- No external server transmissions. No cloud. No telemetry. **Zero-trust architecture.**
|
|
496
|
+
- System snapshots are refreshed in-memory every 5 min, never persisted to disk
|
|
497
|
+
- Claude API calls only on trigger activation (max 10/hour, rate-limited)
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
## Tech Stack
|
|
502
|
+
|
|
503
|
+
| Layer | Technology |
|
|
504
|
+
|-------|-----------|
|
|
505
|
+
| **Runtime** | Python 3.11 + asyncio (async event loop) |
|
|
506
|
+
| **AI Engine** | Claude Code SDK (Opus / Sonnet / Haiku) |
|
|
507
|
+
| **Interface** | Telegram Bot API |
|
|
508
|
+
| **Process Management** | macOS LaunchAgent (daemon, auto-restart) |
|
|
509
|
+
| **API Server** | FastAPI (health check, webhooks) |
|
|
510
|
+
| **Storage** | SQLite (conversations) + JSONL (event logs) + Markdown (memory) |
|
|
511
|
+
| **Integrations** | MCP — Google Calendar, Notion, Playwright, AppleScript |
|
|
512
|
+
| **Voice** | Whisper (STT) + TTS (speech synthesis) |
|
|
513
|
+
|
|
514
|
+
---
|
|
515
|
+
|
|
516
|
+
## Compatibility
|
|
517
|
+
|
|
518
|
+
| Item | Version |
|
|
519
|
+
|------|---------|
|
|
520
|
+
| claude-code-telegram | v1.3.0+ |
|
|
521
|
+
| Python | 3.11+ |
|
|
522
|
+
| macOS | Ventura / Sonoma / Sequoia |
|
|
523
|
+
|
|
524
|
+
---
|
|
525
|
+
|
|
526
|
+
## FAQ
|
|
527
|
+
|
|
528
|
+
### Does it work with the free version of Claude Code?
|
|
529
|
+
|
|
530
|
+
It works, but Mr.Stack calls Claude for scheduled jobs, Jarvis triggers, and regular conversations, so **Max plan is strongly recommended**. Free plans hit rate limits quickly.
|
|
531
|
+
|
|
532
|
+
### Do I need an Anthropic API key?
|
|
533
|
+
|
|
534
|
+
No. It uses Claude Code's built-in authentication. No separate API key or billing required.
|
|
535
|
+
|
|
536
|
+
### How much does it cost?
|
|
537
|
+
|
|
538
|
+
Mr.Stack itself is free (open source). You need:
|
|
539
|
+
- **Claude Code subscription**: Pro ($20/mo) or Max ($100/mo recommended)
|
|
540
|
+
- **Telegram**: Free
|
|
541
|
+
- **Server costs**: None (runs on your Mac)
|
|
542
|
+
|
|
543
|
+
### Does it work on Windows or Linux?
|
|
544
|
+
|
|
545
|
+
Currently **macOS only**. System state scanning uses macOS-specific tools (osascript, pmset, etc.). Linux support is on the roadmap.
|
|
546
|
+
|
|
547
|
+
### Does it really work with the MacBook lid closed?
|
|
548
|
+
|
|
549
|
+
Yes. When registered as a macOS LaunchAgent (daemon):
|
|
550
|
+
- Auto-starts on boot
|
|
551
|
+
- Auto-restarts on crash
|
|
552
|
+
- Runs in background with lid closed (Power Nap / connected to power)
|
|
553
|
+
- Accessible via Telegram while you're out
|
|
554
|
+
|
|
555
|
+
### Is my data sent externally?
|
|
556
|
+
|
|
557
|
+
**Absolutely not.** All data is stored in local files on your Mac (SQLite, JSONL). No external servers, no cloud storage, no telemetry whatsoever. The only external communication is Claude API calls to Anthropic's servers — identical to how Claude Code itself operates.
|
|
558
|
+
|
|
559
|
+
### Will installing this break my existing claude-code-telegram setup?
|
|
560
|
+
|
|
561
|
+
No. `install.sh` only **adds** Jarvis-related code to existing files. All your settings, conversation history, and scheduled jobs are preserved. If Jarvis is already installed, it will ask before overwriting.
|
|
562
|
+
|
|
563
|
+
### install.sh throws an error
|
|
564
|
+
|
|
565
|
+
Most common causes:
|
|
566
|
+
1. **claude-code-telegram not installed** → Run `uv tool install claude-code-telegram` first
|
|
567
|
+
2. **Python below 3.11** → Check with `python3 --version`
|
|
568
|
+
3. **Can't find site-packages path** → The script will prompt for manual input
|
|
569
|
+
|
|
570
|
+
If unresolved, file an issue at [GitHub Issues](https://github.com/whynowlab/mrstack/issues).
|
|
571
|
+
|
|
572
|
+
### Bot responses are slow
|
|
573
|
+
|
|
574
|
+
Claude is invoked via the Claude Code SDK, so complex requests can take 30 seconds to 2 minutes. This is Claude's processing time — Mr.Stack's overhead is negligible.
|
|
575
|
+
|
|
576
|
+
### Jarvis alerts are too frequent
|
|
577
|
+
|
|
578
|
+
Use `/jarvis` to pause, or increase `_TRIGGER_COOLDOWNS` values in `context_engine.py`. During deep work mode, everything except battery warnings is automatically blocked.
|
|
579
|
+
|
|
580
|
+
### Does it use a lot of storage? Will data pile up over time?
|
|
581
|
+
|
|
582
|
+
Mr.Stack separates short-term and long-term memory.
|
|
583
|
+
|
|
584
|
+
**Short-term (auto-recycled, no disk usage):**
|
|
585
|
+
- Context snapshots: 12-slot ring buffer in memory → 0 disk
|
|
586
|
+
- Session conversation: lives within Claude's context window only
|
|
587
|
+
|
|
588
|
+
**Long-term (disk, but barely grows):**
|
|
589
|
+
- `people/`, `projects/`, `preferences/` → **Overwrite mode**. Files don't grow; always latest state only
|
|
590
|
+
- `daily/` → 1 file/day, ~1KB. 1 year = ~365KB
|
|
591
|
+
- `interactions.jsonl` → ~300B per conversation. 50/day for 1 year = ~5MB
|
|
592
|
+
- `routines.json` → Periodically refreshed, stays at a few KB
|
|
593
|
+
|
|
594
|
+
**Estimated storage after 1 year: 10–15MB** (smaller than a single photo)
|
|
595
|
+
|
|
596
|
+
### Does it consume a lot of tokens?
|
|
597
|
+
|
|
598
|
+
**Mr.Stack adds about 15–20 Claude API calls per day.** Negligible on a Max plan.
|
|
599
|
+
|
|
600
|
+
| Component | Token Usage | Details |
|
|
601
|
+
|-----------|-----------|---------|
|
|
602
|
+
| **5-min polling (system scan)** | **Zero** | Local subprocesses only (osascript, pmset, git) |
|
|
603
|
+
| **Pattern logging** | **Zero** | Local JSONL file append |
|
|
604
|
+
| **State classification** | **Zero** | Simple if-else branching (app name → state mapping) |
|
|
605
|
+
| **Jarvis triggers** | 3–5/day | Only on condition match. Hard cap: 10/hour |
|
|
606
|
+
| **Scheduled jobs** | 10–15/day | Model routing auto-selects Haiku/Sonnet |
|
|
607
|
+
|
|
608
|
+
The most expensive operation (5-min polling) uses zero tokens. Scheduled jobs use **model routing** to assign Haiku for simple tasks and Sonnet for analysis, minimizing cost. Opus is reserved for evening summaries and weekly reviews only.
|
|
609
|
+
|
|
610
|
+
**Pro plan users** should consider disabling `memory-sync` (every 3h) and `github-check` (every 2h), or extending their intervals:
|
|
611
|
+
|
|
612
|
+
```bash
|
|
613
|
+
# Manage scheduled jobs
|
|
614
|
+
~/claude-telegram/schedulers/manage-jobs.sh list # List all
|
|
615
|
+
~/claude-telegram/schedulers/manage-jobs.sh toggle memory-sync # Toggle off
|
|
616
|
+
~/claude-telegram/schedulers/manage-jobs.sh toggle github-check # Toggle off
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
### Can I use it on multiple Macs?
|
|
620
|
+
|
|
621
|
+
Install separately on each Mac. To sync memory data, share `~/claude-telegram/memory/` via iCloud or git.
|
|
622
|
+
|
|
623
|
+
---
|
|
624
|
+
|
|
625
|
+
## Roadmap
|
|
626
|
+
|
|
627
|
+
- [ ] Weekly trend visualization report
|
|
628
|
+
- [ ] `pip install mrstack` one-line install
|
|
629
|
+
|
|
630
|
+
---
|
|
631
|
+
|
|
632
|
+
## Author
|
|
633
|
+
|
|
634
|
+
**[@thestack_ai](https://www.threads.net/@thestack_ai)**
|
|
635
|
+
|
|
636
|
+
---
|
|
637
|
+
|
|
638
|
+
## License
|
|
639
|
+
|
|
640
|
+
MIT
|