# claude-remote Self-hosted remote control for Claude Code. Wrap CLI in PTY, stream output to server, approve prompts from phone. ## Project Pure Bun stack: no frameworks, minimal dependencies. Target ~1000-1500 lines total. Core tech: - bun-pty for PTY wrapper (FFI to Rust, pre-built binaries) - bun:sqlite for persistence - Bun.serve() for HTTP + WebSocket + SSE - plain text output (no xterm.js) for mobile-friendly display ## References Inspiration and patterns to steal from: | Source | Path | What to look at | | ---------- | ---------------- | ------------------------------------------------------------------ | | crabigator | `../crabigator/` | Architecture, WebSocket protocol, cloud client, session management | | bun-pty | `../bun-pty/` | PTY API, spawn patterns, event handling | Key files in crabigator: - `src/cloud/client.rs` - WebSocket connection, reconnection logic - `src/cloud/events.rs` - event types for streaming - `src/capture.rs` - output capture patterns - `workers/crabigator-api/src/session-do.ts` - session state management Key files in bun-pty: - `src/index.ts` - spawn API, IPty interface - `src/terminal.ts` - FFI bindings (for understanding internals) ## Contribution policy If bun-pty needs changes, fork and contribute upstream. Don't vendor or patch locally. ## Workflow After making changes: ```bash just check # lint + typecheck + test ``` Commit after each logical change. One change = one commit. Keep commits atomic. ### Code review Run code review after completing a phase or significant chunk of work: - Use `superpowers:code-reviewer` agent - Provide: what was implemented, git range (base SHA to head SHA), requirements - Fix critical/important issues before moving on - Minor issues can be noted and deferred Review loop: implement → just check → code review → fix issues → re-review if needed → pause for user. ## Bun defaults - Use `bun ` instead of `node ` or `ts-node ` - Use `bun test` instead of `jest` or `vitest` - Use `bun build ` instead of `webpack` or `esbuild` - Use `bun install` instead of `npm install` or `yarn install` or `pnpm install` - Use `bun run ``` With the following `frontend.tsx`: ```tsx#frontend.tsx import React from "react"; import { createRoot } from "react-dom/client"; // import .css files directly and it works import './index.css'; const root = createRoot(document.body); export default function Frontend() { return

Hello, world!

; } root.render(); ``` Then, run index.ts ```sh bun --hot ./index.ts ``` For more information, read the Bun API docs in `node_modules/bun-types/docs/**.mdx`.