Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 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
7fdae1d
Add Telegram document upload and message type emojis (#9)
JanusMarko Mar 29, 2026
ce8a016
Add mistletoe as explicit dependency
claude Mar 29, 2026
e834f65
Pin telegramify-markdown <1.0 to fix ImportError
claude Mar 29, 2026
63dfec2
Add ccweb: React web gateway to Claude Code (Phase 1 backend)
claude Apr 10, 2026
1aad315
Fix bugs found by adversarial code review
claude Apr 11, 2026
ea14201
Fix packaging: restructure for correct wheel build
claude Apr 11, 2026
611921e
Fix silent message drops, grid reconnection, and send ACK
claude Apr 11, 2026
f191773
Fix protocol completeness and silent error handling
claude Apr 11, 2026
eb8ee62
Add React frontend (Phase 2-3): message stream, sessions, interactive UI
claude Apr 11, 2026
bdb2fd9
Fix frontend bugs found by adversarial code review (Round 1)
claude Apr 11, 2026
9774329
Fix bugs from adversarial reviews (Round 1 backend + Round 2 frontend)
claude Apr 11, 2026
9be6c65
Fix DecisionGrid stale rows crash on new grid (Round 3)
claude Apr 11, 2026
ff085b4
Add command palette and skill discovery (Phase 7)
claude Apr 11, 2026
c2c1353
Fill gaps from plan audit: file upload, directory picker, images, sho…
claude Apr 11, 2026
27204e4
Fix CommandPalette crash and Enter key interception
claude Apr 11, 2026
8756cd2
Fix missing dependency, skill fetch race, and scroll targeting
claude Apr 11, 2026
8fbe220
Fix grid file race, switch validation, and double parse (R2 backend)
claude Apr 11, 2026
2347cfa
Fix submit_decisions rename race (R3 backend review)
claude Apr 11, 2026
524c655
Add documentation wiki system (Phase 9)
claude Apr 11, 2026
c796cbb
Fix path traversal guard and file read race in docs endpoint
claude Apr 11, 2026
49f8da7
Add httpx dev dependency to pyproject.toml
claude Apr 11, 2026
8632cb1
Add responsive design for tablet (Phase 10)
claude Apr 11, 2026
07c692d
Hide hamburger button when modal overlays are open
claude Apr 11, 2026
f91e9a6
Fill all plan gaps before Phase 11
claude Apr 11, 2026
4f9974f
Fix localStorage crash and StrictMode palette toggle
claude Apr 11, 2026
dc294f6
Fix session restore, reconnect, and stale DecisionGrid
claude Apr 11, 2026
bb9ba30
Fix path traversal in file upload endpoint
claude Apr 11, 2026
2cef310
Fix browse containment, session_map wipe, and double switch_session
claude Apr 11, 2026
b1ab481
Clear active session when killed externally
claude Apr 11, 2026
00d0ebf
Add Phase 11 QoL features: notifications, rename, export, context
claude Apr 11, 2026
41ea52a
Add README.md, deferred items grid, and session history docs
claude Apr 11, 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.
54 changes: 54 additions & 0 deletions ccweb/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# CLAUDE.md

ccweb — React web gateway to Claude Code sessions via tmux. Replaces the Telegram interface with a browser-based UI.

Tech stack: Python (FastAPI + WebSocket), React (TypeScript + Vite + Tailwind), tmux (libtmux).

## Common Commands

```bash
# Backend
cd ccweb && uv run ruff check ccweb/backend/ # Lint
cd ccweb && uv run ruff format ccweb/backend/ # Format
cd ccweb && pip install -e . # Install backend

# Frontend
cd ccweb/frontend && npx tsc -b --noEmit # Type check
cd ccweb/frontend && npx vite build # Production build
cd ccweb/frontend && npm run dev # Dev server (:5173)

# Run
ccweb # Start server (default :8765)
ccweb install # Install hook + global commands
ccweb hook # SessionStart hook handler
```

## Documentation Wiki — IMPORTANT

The `docs/` directory contains all user-facing documentation, rendered both as repo-readable markdown AND in the in-app wiki at `/wiki`.

**When you change any feature, endpoint, component, protocol message, configuration option, or user-facing behavior, you MUST update the corresponding doc file in `docs/`.** This is not optional — the wiki is the primary user documentation.

Doc files use YAML frontmatter (`title`, `description`, `order`) for wiki sidebar sorting. Internal links use relative paths (`../features/sessions.md`).

Key doc locations:
- `docs/getting-started/` — installation, setup, quickstart
- `docs/configuration/` — env vars, preferences
- `docs/features/` — one file per feature
- `docs/architecture/` — system design, protocol reference
- `docs/troubleshooting/` — common issues, debugging

## Architecture

- Backend: `ccweb/backend/` — FastAPI server, WebSocket handler, session management
- Core modules: `ccweb/backend/core/` — forked from ccbot (tmux_manager, session_monitor, terminal_parser, etc.)
- Frontend: `frontend/src/` — React components, hooks, protocol types
- State: `~/.ccweb/` — state.json, session_map.json, monitor_state.json, preferences.json
- Docs: `docs/` — markdown wiki files

## Key Design Constraints

- **Single user** — no multi-user auth
- **File-based decision grids** — skills write JSON to `.ccweb/pending/`, backend polls, AskUserQuestion blocks Claude
- **WebSocket protocol** — all real-time comms via typed JSON messages (see `ws_protocol.py` / `protocol.ts`)
- **Forked modules** — core/ modules are forks from ccbot with import paths adapted; `~/.ccweb/` state is fully separate from `~/.ccbot/`
Loading
Loading