macroclaw 0.0.0-dev

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 macrosak
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.
package/README.md ADDED
@@ -0,0 +1,114 @@
1
+ # Macroclaw
2
+
3
+ Telegram-to-Claude-Code bridge. Bun + Grammy.
4
+
5
+ Uses the Claude Code CLI (`claude -p`) rather than the Agent SDK to avoid any possible
6
+ ToS issues with using a Claude subscription programmatically.
7
+
8
+ ## Vision
9
+
10
+ Macroclaw is a minimal bridge between Telegram and Claude Code. It handles the parts
11
+ that a Claude session can't: receiving messages, managing processes, scheduling tasks,
12
+ and delivering responses.
13
+
14
+ Everything else — personality, memory, skills, behavior, conventions — lives in the
15
+ workspace. The platform stays small so the workspace can be infinitely customizable
16
+ without touching platform code.
17
+
18
+ ## Architecture
19
+
20
+ Macroclaw follows a **thin platform, rich workspace** design:
21
+
22
+ **Platform** (this repo) — the runtime bridge:
23
+ - Telegram bot connection and message routing
24
+ - Claude Code process orchestration and session management
25
+ - Background agent spawning and lifecycle
26
+ - Cron scheduler (reads job definitions from workspace)
27
+ - Message queue (FIFO, serial processing)
28
+ - Timeout management and auto-retry
29
+
30
+ **Workspace** — the intelligence layer, initialized from [`workspace-template/`](workspace-template/):
31
+ - [`CLAUDE.md`](workspace-template/CLAUDE.md) — agent behavior, conventions, response style
32
+ - [`.claude/skills/`](workspace-template/.claude/skills/) — teachable capabilities
33
+ - [`.macroclaw/cron.json`](workspace-template/.macroclaw/cron.json) — scheduled job definitions
34
+ - [`MEMORY.md`](workspace-template/MEMORY.md) — persistent memory
35
+
36
+ ### Where does a new feature belong?
37
+
38
+ **Platform** when it:
39
+ - Requires external API access (Telegram, future integrations)
40
+ - Manages processes (spawning Claude, background agents, timeouts)
41
+ - Operates outside Claude sessions (cron scheduling, message queuing)
42
+ - Is a security boundary (chat authorization, workspace isolation)
43
+ - Is bootstrap logic (workspace initialization)
44
+
45
+ **Workspace** when it:
46
+ - Defines agent behavior or personality
47
+ - Is a convention Claude can follow via instructions
48
+ - Can be implemented as a skill
49
+ - Is data that Claude reads/writes (memory, tasks, cron definitions)
50
+ - Is a formatting or response style rule
51
+
52
+ > **Litmus test:** Could this feature work if you just wrote instructions in CLAUDE.md and/or created a skill? If yes → workspace. If no → platform.
53
+
54
+ ## Security Model
55
+
56
+ Macroclaw runs with `dangerouslySkipPermissions` enabled. This is intentional — the bot
57
+ is designed to run in an isolated environment (container or VM) where the workspace is
58
+ the entire world. The single authorized chat ID ensures only one user can interact with
59
+ the bot.
60
+
61
+ ## Requirements
62
+
63
+ - [Bun](https://bun.sh/) runtime
64
+ - [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) installed and logged in
65
+
66
+ ## Install
67
+
68
+ ```bash
69
+ # Run directly (no install needed)
70
+ TELEGRAM_BOT_TOKEN=xxx AUTHORIZED_CHAT_ID=123 bunx macroclaw
71
+
72
+ # Or install globally
73
+ bun install -g macroclaw
74
+ export TELEGRAM_BOT_TOKEN=xxx
75
+ export AUTHORIZED_CHAT_ID=123
76
+ macroclaw
77
+ ```
78
+
79
+ On first run, a workspace is created at `~/.macroclaw-workspace` with default config.
80
+ Set `WORKSPACE` to use a different path. Set `MODEL` to override the Claude model.
81
+
82
+ ## Usage
83
+
84
+ Run inside a tmux session so it survives SSH disconnects:
85
+
86
+ ```bash
87
+ tmux new -s macroclaw # start session
88
+ macroclaw # run the bot
89
+
90
+ # Ctrl+B, D — detach (bot keeps running)
91
+ # tmux attach -t macroclaw — reattach later
92
+ # tmux kill-session -t macroclaw — stop everything
93
+ ```
94
+
95
+ ## Development
96
+
97
+ ```bash
98
+ git clone git@github.com:macrosak/macroclaw.git
99
+ cd macroclaw
100
+ cp .env.example .env # fill in real values
101
+ bun install --frozen-lockfile
102
+ ```
103
+
104
+ ## Development
105
+
106
+ ```bash
107
+ bun run dev # start with watch mode
108
+ bun test # run tests (100% coverage enforced)
109
+ bun run claude # open Claude Code CLI in current main session
110
+ ```
111
+
112
+ ## License
113
+
114
+ MIT
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ await import("../src/index.ts");
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "macroclaw",
3
+ "version": "0.0.0-dev",
4
+ "description": "Telegram-to-Claude-Code bridge",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "macroclaw": "./bin/macroclaw.js"
9
+ },
10
+ "files": [
11
+ "bin/",
12
+ "src/",
13
+ "workspace-template/"
14
+ ],
15
+ "scripts": {
16
+ "start": "bun run src/index.ts",
17
+ "dev": "bun run --watch src/index.ts",
18
+ "check": "tsc --noEmit && biome check && bun test",
19
+ "typecheck": "tsc --noEmit",
20
+ "lint": "biome check",
21
+ "lint:fix": "biome check --fix --unsafe",
22
+ "test": "bun test",
23
+ "test:integration": "bun test src/*.integration-test.ts --timeout 120000",
24
+ "claude": "set -a && . ./.env && set +a && cd ${WORKSPACE:-~/.macroclaw-workspace} && claude --resume $(node -p \"require('$HOME/.macroclaw/settings.json').sessionId\") --model ${MODEL:-sonnet}"
25
+ },
26
+ "dependencies": {
27
+ "cron-parser": "^5.5.0",
28
+ "grammy": "^1.39.3",
29
+ "openai": "^6.27.0",
30
+ "pino": "^10.3.1",
31
+ "pino-pretty": "^13.1.3",
32
+ "pinorama-client": "^0.3.0",
33
+ "pinorama-transport": "^0.1.4",
34
+ "zod": "^4.3.6"
35
+ },
36
+ "devDependencies": {
37
+ "@biomejs/biome": "^2.4.6",
38
+ "bun-types": "^1.3.10",
39
+ "typescript": "^5.9.3"
40
+ }
41
+ }