Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
512bd19
Add CCBOT_BROWSE_ROOT config for directory browser start path
claude Feb 28, 2026
b9d0925
Merge pull request #1 from JanusMarko/claude/add-browse-root-config-5…
JanusMarko Feb 28, 2026
8eb53bf
Fix inconsistent Path.cwd() fallbacks in directory browser callbacks
claude Feb 28, 2026
f2f765e
Merge pull request #2 from JanusMarko/claude/add-browse-root-config-5…
JanusMarko Feb 28, 2026
2f1729e
Fix misc bugs: asyncio deprecation, double stat, missing /kill handler
claude Feb 28, 2026
bdcde13
Merge pull request #3 from JanusMarko/claude/add-browse-root-config-5…
JanusMarko Feb 28, 2026
22b75be
Fix duplicate Telegram messages for interactive UI prompts
claude Mar 1, 2026
1baaad8
Fix iter_thread_bindings RuntimeError: rename to all_thread_bindings …
claude Mar 1, 2026
fcb9207
Replace blocking queue.join() with enqueue_callable for interactive UI
claude Mar 1, 2026
e631f73
Replace destructive unpin_all topic probe with send_chat_action
claude Mar 1, 2026
9f7cd6e
Add RetryAfter retry loop with callable factory fix
claude Mar 1, 2026
a845d39
Remove mtime cache, use size-only fast path for file change detection
claude Mar 1, 2026
1a2bf77
Move save_if_dirty after message delivery for at-least-once semantics
claude Mar 1, 2026
ea895e2
Clean up _pending_tools when sessions are removed
claude Mar 1, 2026
0f701c0
Fix pending message loss when send_to_window fails
claude Mar 1, 2026
922cb45
Pass message_thread_id to send_chat_action for forum topics
claude Mar 1, 2026
7cf1210
Fix overly broad exception handling in handle_interactive_ui
claude Mar 2, 2026
8583d28
Add generation counter to prevent stale interactive UI callables
claude Mar 2, 2026
5c2033f
Add clarifying comment for fresh snapshot in status_poll_loop
claude Mar 2, 2026
5fa7ae4
Document intentionally ignored wait_for_session_map_entry return value
claude Mar 2, 2026
3d4e0fa
Merge pull request #4 from JanusMarko/claude/fix-duplicate-interactiv…
JanusMarko Mar 2, 2026
ff0ddf3
Fix screenshot refresh showing broken preview by switching to photo m…
claude Mar 2, 2026
4419464
Merge pull request #5 from JanusMarko/claude/fix-duplicate-interactiv…
JanusMarko Mar 3, 2026
f424a79
Prevent sending user input to shell when Claude Code has exited
claude Mar 4, 2026
cb455b2
Auto-resume Claude Code when pane drops to shell
claude Mar 4, 2026
f49960a
Optimize tmux performance with list_windows cache and unified capture…
claude Mar 4, 2026
8a4a0b1
Merge pull request #6 from JanusMarko/claude/fix-duplicate-interactiv…
JanusMarko Mar 4, 2026
31cc95d
Create ccbot-workshop-setup.md
JanusMarko Mar 4, 2026
2f1e6ab
Fix duplicate interactive UI messages for numbered answers
claude Mar 5, 2026
b9d74c3
Merge pull request #7 from JanusMarko/claude/fix-numbered-answer-dupl…
JanusMarko Mar 5, 2026
291381d
Add OOM detection and memory monitoring for tmux sessions
claude Mar 8, 2026
2d431bb
Add session death context to crash notifications
claude Mar 8, 2026
621cd44
Merge pull request #8 from JanusMarko/claude/fix-numbered-answer-dupl…
JanusMarko Mar 8, 2026
1014a2b
Trying to deal with OOM issues still
JanusMarko Mar 8, 2026
9199c2d
Add document upload handler for text/markdown files
claude Mar 27, 2026
76ecce2
Support PDF and Word document uploads in document handler
claude Mar 27, 2026
43829f0
Put file notification before user caption in document handler
claude Mar 27, 2026
25f5810
Add speech balloon emoji prefix to assistant text messages
claude Mar 27, 2026
e83baf8
Use colorful square emojis for all message type prefixes
claude Mar 27, 2026
6a20d39
Use colorful emojis for message type prefixes
claude Mar 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/rules/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
│ SessionMonitor │ │ TmuxManager (tmux_manager.py) │
│ (session_monitor.py) │ │ - list/find/create/kill windows│
│ - Poll JSONL every 2s │ │ - send_keys to pane │
│ - Detect mtime changes │ │ - capture_pane for screenshot │
│ - Detect size changes │ │ - capture_pane for screenshot │
│ - Parse new lines │ └──────────────┬─────────────────┘
│ - Track pending tools │ │
│ across poll cycles │ │
Expand Down
2 changes: 1 addition & 1 deletion .claude/rules/message-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Per-user message queues + worker pattern for all send tasks:

## Performance Optimizations

**mtime cache**: The monitoring loop maintains an in-memory file mtime cache, skipping reads for unchanged files.
**File size fast path**: The monitoring loop compares file size against the last byte offset, skipping reads for unchanged files.

**Byte offset incremental reads**: Each tracked session records `last_byte_offset`, reading only new content. File truncation (offset > file_size) is detected and offset is auto-reset.

Expand Down
13 changes: 13 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"permissions": {
"allow": [
"Bash(cmd.exe:*)",
"Bash(pip show:*)",
"Bash(python3:*)",
"Bash(\"/c/Users/krisd/AppData/Local/Programs/Python/Python314/python.exe\":*)",
"Bash(uv run:*)",
"Bash(~/.local/bin/uv run:*)",
"Bash(ls:*)"
]
}
}
310 changes: 310 additions & 0 deletions ccbot-workshop-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,310 @@
# CCBot Workshop Setup Guide

Complete setup from a fresh Windows machine to running CCBot with Claude Code sessions accessible via Telegram.

---

## Prerequisites

Before you begin, you'll need:

- Windows 10 (version 2004+) or Windows 11
- A Telegram account
- A Claude Code subscription (Claude Pro/Team/Enterprise)
- Your project repositories cloned into `C:\GitHub\`

---

## Part 1: Install WSL and Ubuntu

Open **PowerShell as Administrator** and run:

```powershell
wsl --install
```

This installs WSL 2 with Ubuntu. Restart your computer when prompted.

After restart, Ubuntu will open automatically and ask you to create a username and password. Remember these — you'll need the password for `sudo` commands.

Once you're at the Ubuntu prompt, update everything:

```bash
sudo apt update && sudo apt upgrade -y
```

---

## Part 2: Install Core Tools

### Node.js (required for Claude Code)

```bash
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs
```

Verify:

```bash
node --version
npm --version
```

### Claude Code

```bash
npm install -g @anthropic-ai/claude-code
```

Add npm global bin to your PATH if not already there:

```bash
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
```

Verify Claude Code works:

```bash
claude --version
```

### tmux

```bash
sudo apt install -y tmux
```

### uv (Python package manager)

```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```

Then:

```bash
source ~/.bashrc
```

---

## Part 3: Create a Telegram Bot

1. Open Telegram and search for **@BotFather**
2. Send `/newbot`
3. Follow the prompts to name your bot
4. BotFather gives you a **bot token** — save it (looks like `1234567890:ABCdefGHIjklMNOpqrsTUVwxyz`)

### Get your Telegram user ID

1. Search for **@userinfobot** in Telegram
2. Start a chat with it
3. It replies with your numeric user ID — save it

### Create a Telegram group

1. Create a new group in Telegram
2. Name it something like "Workshop Sessions"
3. Add your bot to the group
4. Go to group settings → **Topics** → Enable topics (use list format)
5. Make the bot an **admin** of the group

---

## Part 4: Install CCBot Workshop

```bash
uv tool install git+https://github.com/JanusMarko/ccbot-workshop.git
```

Verify it installed:

```bash
which ccbot
```

If it's not found, add the path:

```bash
export PATH="$HOME/.local/bin:$PATH"
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
```

### Configure CCBot

Create the config directory and environment file:

```bash
mkdir -p ~/.ccbot
nano ~/.ccbot/.env
```

Paste the following, replacing the placeholder values with your actual token and user ID:

```
TELEGRAM_BOT_TOKEN=your_bot_token_here
ALLOWED_USERS=your_telegram_user_id_here
TMUX_SESSION_NAME=ccbot
CLAUDE_COMMAND=claude --dangerously-skip-permissions
CCBOT_BROWSE_ROOT=/mnt/c/GitHub
```

Save with `Ctrl+O`, exit with `Ctrl+X`.

The `CCBOT_BROWSE_ROOT` setting ensures the directory browser always starts from your `C:\GitHub\` folder when creating new sessions.

### Install the Claude Code hook

This lets CCBot track which Claude session runs in which tmux window:

```bash
ccbot hook --install
```

Or manually add to `~/.claude/settings.json`:

```json
{
"hooks": {
"SessionStart": [
{
"hooks": [{ "type": "command", "command": "ccbot hook", "timeout": 5 }]
}
]
}
}
```

---

## Part 5: Starting CCBot

### First time startup

```bash
tmux new -s ccbot
```

Inside the tmux session:

```bash
ccbot
```

You should see log output confirming the bot started, including your allowed users and Claude projects path.

### Detach from tmux

Press `Ctrl+b`, release, then press `d`. CCBot keeps running in the background. You can close the terminal — it stays alive.

### Start a session from Telegram

1. Open your Telegram group
2. Create a new topic (name it after your project, e.g. "PAIOS")
3. Send a message in the topic
4. CCBot shows a directory browser starting from `C:\GitHub\` — tap your project folder
5. Tap **Select** to confirm
6. A new tmux window is created with Claude Code running in that directory
7. Your message is forwarded to Claude Code

### View sessions in the terminal

```bash
tmux attach -t ccbot
```

Switch between windows using `Ctrl+b` then the window number (shown in the bottom bar). For example:

- `Ctrl+b` then `1` → ccbot process (don't close this)
- `Ctrl+b` then `2` → first Claude Code session
- `Ctrl+b` then `3` → second Claude Code session

Detach again with `Ctrl+b` then `d`.

---

## Part 6: Daily Usage

### Starting CCBot after a reboot

```bash
tmux new -s ccbot || tmux attach -t ccbot
ccbot
```

Then `Ctrl+b` then `d` to detach.

### Useful Telegram commands

Send these in a topic:

- `/screenshot` — see what the terminal looks like right now
- `/history` — browse conversation history
- `/esc` — send Escape key (toggles plan mode, same as Shift+Tab)
- `/cost` — check token usage
- `/kill` — kill the session and delete the topic

### Ending a session

Close or delete the topic in Telegram. The tmux window is automatically killed.

### Multiple projects

Create a new topic for each project. CCBot's design is **1 topic = 1 window = 1 session**. Each topic can run a separate Claude Code session in a different project directory.

### Switching between phone and desktop

From your phone, just use Telegram — all interaction goes through topics.

To switch to your desktop terminal:

```bash
tmux attach -t ccbot
```

Navigate to the right window with `Ctrl+b` then the window number. You're in the same session with full scrollback.

---

## Part 7: Uninstall and Reinstall

Use this after pushing updates to your fork.

### Stop CCBot

```bash
tmux attach -t ccbot
```

Press `Ctrl+C` to stop ccbot. Stay in the tmux session.

### Uninstall the current version

```bash
uv tool uninstall ccbot
```

### Install the updated version

```bash
uv tool install git+https://github.com/JanusMarko/ccbot-workshop.git
```

If you're getting a cached version and not seeing your changes, force a fresh install:

```bash
uv tool install --force git+https://github.com/JanusMarko/ccbot-workshop.git
```

### Verify and restart

```bash
which ccbot
ccbot
```

Then `Ctrl+b` then `d` to detach.

Your `~/.ccbot/.env` configuration and `~/.ccbot/state.json` session state are preserved across reinstalls — you don't need to reconfigure anything.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies = [
"Pillow>=10.0.0",
"aiofiles>=24.0.0",
"telegramify-markdown>=0.5.0",
"python-docx>=1.0.0",
]

[project.scripts]
Expand Down
Loading
Loading