Commit graph

60 commits

Author SHA1 Message Date
aa5eacf9ce docs: update homelab documentation, CLAUDE.md, and TODOs
- Add updates helper script docs and version checking guidance to CLAUDE.md
- Update container IPs from DHCP to static, add new containers (lisotex, debate-builder)
- Add DragonflyDB stack, NPM proxy entries, DNS records
- Add incident log (Hetzner MAC warning, BSI portmapper)
- Add new TODOs (RustDesk, dns-services helper, mh.datalos.dk)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 22:10:23 +00:00
2d0d4da992 fix(02-02): typing indicator lifecycle, model identity, tool permissions
- Fix typing indicator not showing: clean up stale typing tasks between
  messages and use dynamic event lookup in callbacks instead of capturing
  a specific event at creation time
- Fix stream-json input format: use nested message object for stdin NDJSON
- Switch --system-prompt to --append-system-prompt so Claude Code's
  default system prompt (with model identity) is preserved
- Add --dangerously-skip-permissions for full tool access in subprocess
- Use full model ID (claude-sonnet-4-5-20250929) in default persona

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 22:10:02 +00:00
f246d18fa0 feat(02-02): integrate typing indicators, batching, and file handling
- Create MessageBatcher class for debounce-based message batching
- Update make_callbacks() to include on_tool_use with progress notifications
- Add typing indicator support with stop_event control
- Implement smart message splitting with MarkdownV2 escaping
- Update handle_message() to use typing and batching
- Update handle_photo() and handle_document() to save to session directories
- Add auto-analysis for photos and file upload notifications
- Update session switching and archiving to handle typing and batchers
2026-02-04 19:24:09 +00:00
76fb57877d docs(02-01): complete persistent subprocess + telegram utils plan
Tasks completed: 2/2
- Refactor ClaudeSubprocess to persistent process with stream-json I/O
- Create telegram_utils.py with message formatting and typing indicator

SUMMARY: .planning/phases/02-telegram-integration/02-01-SUMMARY.md
2026-02-04 19:19:07 +00:00
6b624d7f80 feat(02-01): create telegram_utils with message formatting
- Add split_message_smart: code-block-aware message splitting at 4000 chars
- Add escape_markdown_v2: escape 17 special chars outside code blocks
- Add typing_indicator_loop: re-send typing every 4s with asyncio.Event
- Smart splitting respects triple-backtick and single-backtick boundaries
- Never splits inside code blocks (preserves syntax)
- Regex pattern identifies code regions for selective escaping
2026-02-04 19:17:20 +00:00
6a115a4947 refactor(02-01): persistent subprocess with stream-json I/O
- Replace fresh-process-per-turn with persistent subprocess model
- Accept NDJSON messages on stdin via --input-format stream-json
- Emit stream-json events on stdout including tool_use events
- Add on_tool_use callback for progress notifications
- Persistent stdout/stderr readers run for process lifetime
- Result events mark not busy but don't exit reader loop
- stdin.write + drain pattern prevents pipe buffer deadlock
- Auto-start process if not running when send_message called
- Crash recovery restarts persistent process with --continue
2026-02-04 19:15:46 +00:00
92318e79ab fix(02): revise plans based on checker feedback
Address 3 blockers and 1 warning:
- Clarify on_tool_use responsibility split (subprocess passes raw data, bot.py formats)
- Make verify step 6 concrete with code inspection pattern
- Add explicit subprocess auto-start pseudo-code with double-start guard
- Reframe must_haves truth from implementation detail to capability

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 19:07:32 +00:00
36fabb41a6 docs(02): create phase plan
Phase 02: Telegram Integration
- 2 plan(s) in 2 wave(s)
- Wave 1: persistent subprocess + message utilities (02-01)
- Wave 2: bot integration + batching + file handling + systemd (02-02)
- Ready for execution

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 19:03:40 +00:00
b188c25bb5 docs(02): research phase domain
Phase 2: Telegram Integration
- Claude Code stream-json I/O for persistent processes
- Telegram bot UX (typing indicators, message editing, MarkdownV2)
- Message batching and splitting patterns
- File handling architecture

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 18:57:50 +00:00
fedceab560 docs(02): capture phase context
Phase 02: Telegram Integration
- Implementation decisions documented
- Phase boundary established
2026-02-04 18:51:53 +00:00
03aaf64cff docs(01): complete session-process-foundation phase
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 18:32:54 +00:00
d878931e79 feat(01-03): add timing profiler for response latency debugging
Instruments the full message pipeline with [TIMING] log entries:
- Message age (Telegram delivery delay)
- Subprocess state (cold-start vs reused)
- Process spawn, first stdout, first assistant text
- Telegram send latency, total wall time

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 18:30:05 +00:00
2302b75e14 fix(01-02): read model/max_turns from persona settings object
Persona JSON nests model and max_turns under "settings" but the
subprocess was looking for them at the top level, so --model and
--max-turns were never passed to claude CLI.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 18:18:38 +00:00
faab47afbd feat(01-01): restructure personas with pipeline workflow
- default: generic helpful assistant
- homelab: infrastructure management (was default)
- brainstorm: creative ideation → produces BRAINSTORM.md with
  vision, MVP, v1.0, v2.0 feature sets
- planner: takes BRAINSTORM.md → produces PRD, BRD, SoW
- research: unchanged

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 18:13:21 +00:00
3fec4ed848 fix(01-01): update persona models to claude-sonnet-4-5-20250929
Plans hardcoded an outdated model. Updated all 4 personas to Sonnet 4.5.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 18:06:08 +00:00
a27ac010ec feat(01-03): add /archive command to compress and remove sessions
Archives session directory with tar+pigz to sessions_archive/,
terminates any running subprocess first, clears active session if needed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 18:01:14 +00:00
3cc97adcd0 fix(01-03): don't treat SIGTERM as crash, fix async callbacks in crash handler
- Only auto-restart on positive exit codes (genuine crashes), not negative
  return codes (signals like SIGTERM from our own process management)
- Add iscoroutinefunction check for on_error in crash handler max-retry path

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 17:58:27 +00:00
d08f3527cd fix(01-03): fix import collision between local telegram/ and pip package
The telegram/ directory's __init__.py shadowed the python-telegram-bot pip
package. Remove __init__.py and use direct sibling imports instead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 17:57:22 +00:00
3a62e01f6f feat(01-03): wire session manager and Claude subprocess into Telegram bot
- Add /new and /session commands to create and switch sessions
- Route plain text messages to active session's Claude subprocess
- Auto-spawn subprocess when switching to session with no process
- Update help text with session commands
- Handle async callbacks in ClaudeSubprocess (inspect.iscoroutinefunction)
- Preserve all existing bot commands (/status, /pbs, etc.)
- Use block=False for non-blocking message handling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 17:40:43 +00:00
9824e913bb docs(01-01): complete SessionManager + Persona library plan
Tasks completed: 2/2
- Task 1: Create SessionManager module
- Task 2: Create persona library with default templates

SUMMARY: .planning/phases/01-session-process-foundation/01-01-SUMMARY.md
2026-02-04 17:35:45 +00:00
85b83b2b17 docs(01-02): complete ClaudeSubprocess plan
Tasks completed: 1/1
- Create ClaudeSubprocess module with spawn, I/O, and lifecycle management

SUMMARY: .planning/phases/01-session-process-foundation/01-02-SUMMARY.md
2026-02-04 17:34:55 +00:00
8fce10c5ba feat(01-02): create ClaudeSubprocess module for process management
- Spawns Claude Code CLI with stream-json output in session directories
- Reads stdout/stderr concurrently via asyncio.gather (no pipe deadlock)
- Handles process lifecycle with clean termination (no zombies)
- Queues messages during processing using asyncio.Queue
- Auto-restarts on crash with --continue flag (max 3 retries)
- Parses stream-json events (assistant, result, system) to callbacks
- Supports persona configuration (system_prompt, model, max_turns)
- Uses terminate() + wait_for() + kill() fallback pattern

Based on research: .planning/phases/01-session-process-foundation/01-RESEARCH.md
2026-02-04 17:33:49 +00:00
ba8acf00b3 feat(01-01): create persona library with default templates
- Four persona templates: default, brainstorm, planner, research
- JSON schema: name, description, system_prompt, settings
- Each persona has distinct system_prompt for different modes
- Settings include model and max_turns configuration
- Fix SessionManager paths to use homelab directory
2026-02-04 17:33:16 +00:00
447855ceec feat(01-01): create SessionManager module
- SessionManager class with session lifecycle management
- Session CRUD: create, list, switch, get, update
- Session validation: alphanumeric, hyphens, underscores only
- Persona inheritance from library on session creation
- Session status tracking: idle, active, suspended
- Metadata persistence with JSON on disk
- Active session tracking and switching logic
2026-02-04 17:32:16 +00:00
fd1c24d7c6 fix(01): revise plan 01-03 based on checker feedback
Clarify subprocess persistence on session switch, mandatory auto-spawn
on /session, and message queueing delegation to ClaudeSubprocess.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 14:35:53 +00:00
0baaeb26b5 docs(01): create phase plan
Phase 01: Session & Process Foundation
- 3 plan(s) in 2 wave(s)
- 2 parallel (wave 1), 1 sequential (wave 2)
- Ready for execution

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 14:32:10 +00:00
a522a108ca docs(01): research phase domain
Phase 1: Session & Process Foundation
- Standard stack identified (asyncio, python-telegram-bot 22.5, Claude Code CLI)
- Architecture patterns documented (concurrent stream reading, session isolation)
- Pitfalls catalogued (pipe deadlock, zombie processes, blocking event loop)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 14:25:26 +00:00
786468c98b docs(01): capture phase context
Phase 01: Session & Process Foundation
- Implementation decisions documented
- Phase boundary established
2026-02-04 14:07:47 +00:00
a639a53b0b docs: add codebase map and domain research
Codebase: 7 documents (stack, architecture, structure, conventions, testing, integrations, concerns)
Research: 5 documents (stack, features, architecture, pitfalls, summary)
2026-02-04 13:50:03 +00:00
6cf6bfb8d1 docs: create roadmap (4 phases)
Phases:
1. Session & Process Foundation: SESS-01, SESS-02, SESS-04, INFRA-02, INFRA-03
2. Telegram Integration: MSG-01, MSG-02, MSG-03, MSG-04, OUT-01, INFRA-01
3. Lifecycle Management: LIFE-01, LIFE-02, LIFE-03, LIFE-04, SESS-03
4. Output Modes: OUT-02, OUT-03

All 18 v1 requirements mapped to phases.
2026-02-04 13:49:57 +00:00
0edb076981 docs: define v1 requirements
18 requirements across 5 categories
6 requirements deferred to v2
2026-02-04 13:41:23 +00:00
1648a986bc docs: complete project research
Files:
- STACK.md
- FEATURES.md
- ARCHITECTURE.md
- PITFALLS.md
- SUMMARY.md

Key findings:
- Stack: Python 3.12+ with python-telegram-bot 22.6, asyncio subprocess management
- Architecture: Path-based session routing with state machine lifecycle management
- Critical pitfall: Asyncio PIPE deadlock requires concurrent stdout/stderr draining

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 13:37:24 +00:00
9c62dac155 chore: add project config
Mode: yolo
Depth: quick
Parallelization: enabled
Workflow agents: research=on, plan_check=on, verifier=off
2026-02-04 13:28:24 +00:00
ed0c18befc docs: initialize project
Telegram Claude Code Bridge — frictionless Claude Code conversation via Telegram with session management, idle timeout, and full tool access.
2026-02-04 13:26:34 +00:00
c50c348004 Add Telegram bot and shared storage documentation
- Telegram bot (@georgsen_homelab_bot) for two-way communication
  - Commands: /status, /pbs, /backups, /beszel, /kuma, /ping
  - Photos and files saved to inbox for Claude to read
  - Runs as systemd user service
- Shared storage via ZFS bind mounts
  - rpool/shared/mikkel on PVE host
  - Mounted to ~/stuff in mgmt, dev, general containers
  - SMB access via \\mgmt\stuff (Tailscale MagicDNS)
- Updated helper scripts list in CLAUDE.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 14:21:51 +00:00
c741bc2597 Add pbs backups command to documentation
New command shows last backup status per VM/CT organized by namespace.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 12:22:48 +00:00
3b00ffa93d Add PBS helper script for backup monitoring
~/bin/pbs provides:
- status: Overview with datastore, storage, dedup ratio, task summary
- tasks: Recent backup/prune tasks with timestamps
- errors: Filter for failures only
- gc: Garbage collection details
- snapshots: List recent backups per namespace
- storage: Detailed dedup statistics

Also installed bc for calculations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 12:10:51 +00:00
ace09a3158 Add OpenCloud, Hoodik Android app, and other items to TODO
- OpenCloud: Dropbox alternative with native apps
- Hoodik Android app: Build native app for E2E encrypted storage
- NetBox: IPAM/DCIM for network documentation
- Forgejo CI/CD: Actions runner setup

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 23:46:11 +00:00
9cf836d2fa Add Dockge to Beszel monitoring with Docker stats
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 23:29:05 +00:00
654e3ffbce Add Beszel server monitoring dashboard
- Deployed Beszel hub in Dockge (10.5.0.10:8090)
- Installed agents on PVE host and PBS (with Synology mount monitoring)
- Created NPM proxy at dashboard.georgsen.dk
- Created ~/bin/beszel helper script for API management
- Added credentials for Beszel and Dockge
- Updated all documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 23:27:01 +00:00
7982975922 Update TODO: mark Uptime Kuma monitors as completed
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 23:05:13 +00:00
172087b463 Add Uptime Kuma helper script and monitors
- Created ~/bin/kuma for managing monitors via Socket.IO API
- Uses uptime-kuma-api Python library
- Added monitors: PBS, Forgejo, Technitium DNS
- Updated credentials with username/password for Socket.IO auth

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 23:04:51 +00:00
980475e903 Move Kuma API doc screenshot to uptime-kuma folder
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:58:10 +00:00
64df9998f6 Fix mgmt container IP: .102 → .108
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:57:18 +00:00
ce8c00aa1e Add Uptime Kuma API credentials and documentation
- Added API key to uptime-kuma/credentials
- Created README.md with full API documentation
- Updated homelab-documentation.md and CLAUDE.md
- Added TODO to review monitors for missing services

REST API is limited (metrics, push monitors, badges).
Full monitor management requires Socket.IO/web UI.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:52:14 +00:00
314d13c4ed Fix Proxmox URL to use hostname
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:24:05 +00:00
9988f74a61 Add dependent updates to IP reorg task
NPM, DNS, iptables, and docs all need updating too.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:17:17 +00:00
eee9aa2a7c Refine IP addressing plan in TODO
DHCP below 100, static VMIDs at 100+ matching their VMID number.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 21:58:01 +00:00
c935edb0cc Add IP addressing review to TODO
Consider VMID-based IPs and smaller DHCP range.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 21:18:41 +00:00
18cc58adc0 Add container quick reference table to README
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 20:31:13 +00:00