Commit Graph
300 Commits
Author SHA1 Message Date
arkonandClaude Opus 4.5 aa46d35970 chore: add todo.md to .gitignore
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 01:39:59 +01:00
arkonandClaude Opus 4.5 46c9e0f951 fix: clean up orphaned test screen sessions in afterAll
Integration tests create screen sessions via the web server, but
server.stop() intentionally preserves them (for reattachment in
production). This left 30+ detached screens after each test run.

Fix by recording pre-existing screens in beforeAll, then killing any
new detached claudeman-* screens in afterAll that weren't there at
test start. Never kills attached sessions (user's active work).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 01:34:57 +01:00
arkonandClaude Opus 4.5 0fc52902cc feat: add multi-layer browser notification system
Implement a 4-layer notification system for alerting users when Claude
Code sessions need attention:

1. Notification Drawer - persistent in-page log with bell icon + badge
2. Tab Title Updates - flashing title with unread count when unfocused
3. Web Notifications - browser push notifications when tab hidden
4. Audio Alerts - Web Audio API beep for critical events

Notification triggers:
- Critical: session errors, crashes (non-zero exit), agent failures/timeouts
- Warning: Ralph loop completions, budget warnings, stuck sessions (idle >10min)
- Info: auto-accepts, auto-clears, agent completions

Features:
- NotificationManager class with debouncing/grouping (5s window)
- Settings tab in App Settings with per-layer/per-urgency toggles
- Configurable idle threshold for stuck session detection
- Click notification to switch to relevant session
- Notification permission request flow
- Rate-limited browser notifications (max 1/3s)
- Idle timer cleanup on session delete

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 01:22:53 +01:00
arkonandClaude Opus 4.5 e40849da79 fix: scroll terminal to bottom on tab switch
After loading the terminal buffer on tab switch, xterm.js wasn't
guaranteed to be scrolled to the bottom, requiring users to manually
scroll down. Fix by:
1. Adding scrollToBottom() after chunkedTerminalWrite completes
2. Adding scrollToBottom() after terminal.focus()
3. Delaying chunkedTerminalWrite resolution by one extra rAF to ensure
   xterm.js has finished rendering the final chunk

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 00:53:47 +01:00
arkonandClaude Opus 4.5 99919d6dfb feat: replace SpawnDetector with MCP server for spawn1337 protocol
Instead of parsing terminal output for <spawn1337> tags, spawn capabilities
are now exposed as native MCP tools that Claude Code can call directly.
The MCP server (stdio transport) proxies requests to the existing REST API.

- Add src/mcp-server.ts with 6 tools: spawn_agent, list_agents,
  get_agent_status, get_agent_result, send_agent_message, cancel_agent
- Remove src/spawn-detector.ts and all references in session.ts/server.ts
- Add CLAUDEMAN_API_URL env var propagation to sessions and screens
- Write .mcp.json to case directories during creation
- Remove spawn1337 tag documentation from case-template.md
- Add claudeman-mcp bin entry to package.json

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 23:16:21 +01:00
arkonandClaude Opus 4.5 7c72802886 feat: add Spawn1337 protocol docs to case template
New sessions had no awareness of the spawn1337 agent protocol because
the case-template.md (copied as CLAUDE.md into every new case) was
missing the documentation. Added full spawn protocol reference including
tag syntax, task spec format, monitoring commands, and resource limits.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 22:32:42 +01:00
arkonandClaude Opus 4.5 9c322f7506 fix: make session numbering per-case instead of global
The w1/w2/s1/s2 session counter was scanning all sessions regardless
of case name, causing cross-case number inflation. Now only counts
sessions belonging to the same case when determining the next number.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 22:22:27 +01:00
arkonandClaude Opus 4.5 a41240049e feat: disable Ralph/Todo tracker auto-enable by default
Ralph tracker no longer auto-enables on pattern detection. It must be
explicitly enabled per-session (via API) or globally via the new
`ralphEnabled` AppConfig setting. Adds GET/PUT /api/config endpoints
for runtime configuration. Spawn agent ralph enable is unchanged.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 22:14:00 +01:00
arkonandClaude Opus 4.5 a39ae1d151 chore: add commands scratch file to .gitignore
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 21:56:44 +01:00
arkonandClaude Opus 4.5 8ff480f9e9 fix: preserve execute permission on dist/index.js during build
Add chmod +x after tsc compilation to prevent "Permission denied" errors
when running claudeman via npm link symlink.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 19:41:43 +01:00
arkonandClaude Opus 4.5 1c9272b6be docs: update all docs for spawn1337 protocol
- README: add spawn1337 section, update architecture diagram with
  orchestrator/detector, add spawn API endpoints, update test badge
  (1426 total)
- ralph-wiggum-guide: add spawn-related files to references
- All docs: update Last Updated dates to 2026-01-23

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 17:33:54 +01:00
arkonandClaude Opus 4.5 1705b7a67d feat: implement spawn1337 autonomous agent protocol
Add full lifecycle management for spawning autonomous Claude sessions as
screen-based agents. Agents communicate via filesystem message bus, signal
completion via RalphTracker <promise> mechanism, and enforce resource budgets
(tokens, cost, timeout, depth limits).

New files:
- spawn-types.ts: Types, YAML parser, factory functions, serialization
- spawn-detector.ts: Terminal pattern detection for spawn1337 tags
- spawn-orchestrator.ts: Agent lifecycle (spawn, monitor, queue, cleanup)
- spawn-claude-md.ts: CLAUDE.md generator for agent sessions

Modified:
- session.ts: SpawnDetector integration, parent/child tracking
- server.ts: Orchestrator wiring, 11 API endpoints, SSE events
- types.ts: Re-exports, SessionState additions

Tests: 80 new tests across 3 test files (all passing)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 10:20:37 +01:00
arkonandClaude Opus 4.5 33a8febf30 docs: document auto-accept prompts feature in CLAUDE.md
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 01:25:45 +01:00
arkonandClaude Opus 4.5 0e8c8b8c60 feat: auto-accept plan mode and question prompts in respawn controller
When Claude enters plan mode or asks a question (AskUserQuestion), output
stops without a completion message. The new autoAcceptPrompts feature
detects this state and sends Enter after a configurable delay (default 8s)
to accept the plan or select the default option, keeping Claude working
autonomously.

Enabled by default. Adds UI checkbox in the respawn config panel.
Safety: only fires once per silence period, requires prior output,
and won't fire during active respawn cycles.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 01:25:09 +01:00
arkonandClaude Opus 4.5 619f2a3403 fix: clean up test case directories after each test instead of at end
Moves case directory cleanup from afterAll to afterEach in all test
files that create cases. Previously, if the test suite was interrupted
or afterAll timed out, all case directories were left behind. Now each
test cleans up immediately after itself.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 22:54:26 +01:00
arkonandClaude Opus 4.5 afaa1d3adb refactor: move default CLAUDE.md template to bundled case-template.md
Replaces the ~400-line inline template string in claude-md.ts with a
file read from src/templates/case-template.md. Removes the hardcoded
/home/arkon/default/CLAUDE.md path from server.ts. The build script
now copies the template to dist/templates/ for production use.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 22:43:09 +01:00
arkonandClaude Opus 4.5 0ff0dcac82 docs: document Format 4 and Format 5 todo detection patterns
Add native checkbox (☐/◐/☒) and Claude Code checkmark-based
(✔ Task #N) formats to CLAUDE.md and ralph-wiggum-guide.md,
matching the recently added detection code.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 22:25:51 +01:00
arkonandClaude Opus 4.5 bf44925ea4 feat: detect Claude Code checkmark-based TodoWrite output format
The RalphTracker now recognizes Format 5 - the checkmark-based output
that Claude Code's TodoWrite tool produces:
- "✔ Task #N created: <content>" → creates todo
- "✔ #N <content>" → registers task summary
- "✔ Task #N updated: status → in progress/completed" → updates status

Previously only detected markdown checkboxes, icon indicators, and
native ☐/☒/◐ format, missing the primary output format used by
Claude Code CLI sessions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 22:02:49 +01:00
arkonandClaude Opus 4.5 d291dc0d05 docs: sync all documentation with recent state persistence and respawn changes
- CLAUDE.md: Add step confirmation behavior, respawnEnabled field, recovery
  strategy with dual redundancy, updated state lifecycle
- README.md: Multi-layer idle detection, step confirmation, state persistence
  in performance table, updated architecture diagram with State Store
- docs/: Updated last-modified dates to 2026-01-22

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 21:36:43 +01:00
arkonandClaude Opus 4.5 024425e979 fix: add screens.json fallback for respawn recovery
state.json is now the primary source for session recovery, but
screens.json is used as a fallback for respawn config since it was
the proven working path before. This provides double-redundancy:
both files would need to be lost for respawn state to disappear.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 21:23:59 +01:00
arkonandClaude Opus 4.5 a006621cd0 fix: don't wipe session state from state.json on server shutdown
cleanupSession() always called store.removeSession() which deleted the
session from state.json. On server stop, cleanupSession(id, false) was
called for all sessions - preserving screens but deleting their saved
state. On next restart, state.json was empty so nothing was restored.

Now only removes from state.json when killScreen=true (user explicitly
deleting a session), preserving state for recovery on restart.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 21:22:07 +01:00
arkonandClaude Opus 4.5 35c2f4fb61 fix: use state.json as single source of truth for session recovery
All session settings (auto-compact, auto-clear, ralph, respawn) are now
restored from state.json on server restart. Previously settings were
split across state.json, screens.json, and state-inner.json which was
fragile. state-inner.json is kept as a fallback for ralph state only.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 21:17:55 +01:00
arkonandClaude Opus 4.5 1c430e0cbd fix: persist session state after all restorations complete on restart
persistSessionState was called before the respawn controller was restored,
so respawnEnabled was always saved as false during recovery. Moved the
persist call to after all restorations (auto-compact, auto-clear, ralph,
respawn) are applied.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 21:13:23 +01:00
arkonandClaude Opus 4.5 8501dcbec5 fix: restore auto-compact/auto-clear settings on server restart
Session recovery from screens created fresh Session objects with default
values, losing the auto-compact and auto-clear settings that were saved
to state.json. Now reads them back during recovery.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 20:59:18 +01:00
arkonandClaude Opus 4.5 60f73fc5fe fix: correct property paths for auto-compact/clear in session options modal
The modal was reading from non-existent nested paths (session.autoClear?.autoCompact?)
instead of the flat properties from toState() (session.autoCompactEnabled, etc.).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 20:56:40 +01:00
arkonandClaude Opus 4.5 23c75578c0 fix: persist respawnEnabled state to state.json
The respawn controller's enabled/disabled state was not being saved,
so CLI status couldn't show whether respawn was active.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 20:52:41 +01:00
arkonandClaude Opus 4.5 e5aff372e8 feat: auto-save session options and restore on modal open
- Add GET /api/sessions/:id/respawn/config endpoint for reading saved config
- PUT /api/sessions/:id/respawn/config now works without running controller
  (saves pre-config to screens.json for when respawn starts)
- Respawn start/enable merges pre-saved config from screens.json
- Frontend auto-saves respawn config, auto-compact, auto-clear on field change
- Frontend loads saved config when opening session options modal
- Updated CLAUDE.md with state persistence docs, new API endpoint,
  SessionState fields table, state lifecycle, and session setting guide

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 20:49:09 +01:00
arkonandClaude Opus 4.5 43eaafe084 feat: persist full session state to state.json for CLI visibility
The web server now persists all per-session settings (name, mode,
auto-compact, auto-clear, respawn config, ralph state, tokens, cost)
to state.json so the CLI status/session commands can display them.
Also removes unused pendingStepConfirm property from respawn controller.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 20:36:06 +01:00
arkonandClaude Opus 4.5 5a97403066 fix: add step confirmation to respawn controller
- Add step confirmation timer for waiting_update, waiting_init, waiting_kickstart states
- After detecting completion in waiting states, wait for completionConfirmMs silence
- Prevents sending next command before Claude finishes processing current one
- Cancel step confirmation when working patterns detected
- Update CLAUDE.md with step confirmation documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:31:24 +01:00
arkonandClaude Opus 4.5 ec92e5b1cf fix: respawn controller multi-layer detection and cleanup
- Update idle detection from legacy '↵ send' to completion message pattern
  ("for Xm Xs" time patterns like "Worked for 2m 46s")
- Add confirming_idle state for false positive prevention
- Add completionConfirmMs (5s) and noOutputTimeoutMs (30s) config options
- Add multi-layer detection with confidence scoring (0-100%)
- Fix null pointer error in extractTokenCount with guard clause
- Fix respawn controller not stopping on session cleanup (broadcast respawn:stopped)
- Update tests to use new completion message patterns
- Add detection status UI display (confidence level, waiting state)
- Update CLAUDE.md with new detection documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 19:24:36 +01:00
arkonandClaude Opus 4.5 34fb33fbc6 test: add global test setup with screen limits and reach 1337 tests
- Add test/setup.ts with max 10 concurrent screen sessions limiter
- Add orphaned Claude/screen process cleanup before/after tests
- Add semaphore-based screen slot acquisition for concurrency control
- Update vitest.config.ts with setupFiles and fileParallelism: false
- Add 16 new test files for comprehensive coverage
- Update README badge to show 1337 total tests
- Update CLAUDE.md with test setup documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 11:30:10 +01:00
arkon 675e5f2616 docs: rename Respawn agents to Respawn Controller 2026-01-22 09:17:35 +01:00
arkon 5d8a5f2e57 docs: update Ralph tracking description 2026-01-22 09:15:00 +01:00
arkonandClaude Opus 4.5 bd09e8acd9 docs: update README naming consistency and buffer sizes
- Rename "Ralph Wiggum Loop Tracking" to "Ralph / Todo Tracking"
- Shorten "Ralph Wiggum loops" to "Ralph loops"
- Fix memory buffer sizes (2MB terminal, 1MB text) to match code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 09:14:32 +01:00
arkonandClaude Opus 4.5 add8f8c84b fix: memory leak prevention and resource cleanup improvements
SSE Client Management:
- Add periodic health check (30s) to detect dead SSE connections
- Clean up clients with destroyed/non-writable sockets
- Clear all SSE clients on server stop

Session Lifecycle:
- Add _isStopped flag to prevent new timers after session stops
- Check flag in auto-compact/clear callbacks to avoid timer races
- Check flag in line buffer flush timer creation

Server Shutdown:
- Add _isStopping flag to prevent timer creation during shutdown
- Skip batch timer creation in terminal/output/task/state handlers
- Clear SSE health check timer on stop

Ralph Tracker:
- Call clearDebounceTimers() in clear() method (was missing)
- Add MAX_COMPLETION_PHRASE_ENTRIES (50) to trim phrase map
- Add MAX_LINE_BUFFER_SIZE (64KB) to prevent unbounded growth
- Trim line buffer when exceeding max size

Task Tracker:
- Add timestamp to pending tool uses for age-based cleanup
- Add PENDING_TOOL_USE_MAX_AGE_MS (1 hour) expiry
- Add MAX_PENDING_TOOL_USES (100) limit
- Clean up old entries on new tool use

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 00:08:32 +01:00
arkonandClaude Opus 4.5 5bd1e9e536 perf: optimize terminal buffer rendering for smoother tab switches
- Reduce buffer limits (terminal: 5MB→2MB, text: 2MB→1MB) to decrease
  render payload
- Add chunkedTerminalWrite() that writes in 64KB chunks via
  requestAnimationFrame to avoid UI jank
- Add tail mode to /api/sessions/:id/terminal endpoint (?tail=256KB)
  for faster initial load on tab switch
- Show truncation indicator when earlier output is cut
- Update CLAUDE.md with new buffer limits and performance notes

Fixes jittery behavior when switching tabs with large (2MB+) buffers.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 23:55:16 +01:00
arkonandClaude Opus 4.5 50150befef docs: update API and class references to ralph-* naming
- README.md: Update API endpoints to /ralph-state and /ralph-config
- ralph-wiggum-guide.md: Update class names (RalphTracker, RalphLoopState),
  file paths (ralph-tracker.ts), SSE events (session:ralphLoopUpdate), and
  API endpoints throughout

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 23:07:05 +01:00
arkonandClaude Opus 4.5 0d1ca37b6e refactor: rename inner-loop-tracker to ralph-tracker with API improvements
- Rename inner-loop-tracker.ts → ralph-tracker.ts throughout codebase
- Add ralph-config.ts for parsing .claude/ralph-loop.local.md config
- Standardize API error responses using createErrorResponse()
- Add input validation for auto-compact/auto-clear thresholds
- Update UI labels to "Ralph / Todo Tracker" consistently
- Add 46 integration tests for Ralph tracking functionality
- Update test badge to 438 total tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 22:36:45 +01:00
arkonandClaude Opus 4.5 5be0babf01 docs: add animated demo GIF to README
Shows dashboard in action with 8 frames at 1 second intervals,
last frame held for 3 seconds.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:56:44 +01:00
arkonandClaude Opus 4.5 403c7e77fb feat: auto-detect completion phrase from CLAUDE.md
- Extract <promise>PHRASE</promise> from CLAUDE.md on session start
- Configure inner loop tracker before first broadcast so UI shows phrase immediately
- More lenient bare phrase detection (triggers when loop is active)
- Auto-detect on session restoration from screens
- Add logging for auto-detection debugging

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:49:44 +01:00
arkonandClaude Opus 4.5 e469b30ddb feat: persist respawn config and inner loop state across server restarts
- Add PersistedRespawnConfig type and respawnConfig field to ScreenSession
- Add innerLoopEnabled field to ScreenSession for Ralph Wiggum tracking
- Add updateRespawnConfig, clearRespawnConfig, updateInnerLoopEnabled methods to ScreenManager
- Save respawn config when enabled/updated via API endpoints
- Save inner loop enabled state when changed via API
- Restore respawn controllers and inner loop state on server startup

This ensures respawn continues working after claudeman restarts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:30:06 +01:00
arkonandClaude Opus 4.5 6bfc7f9027 fix: add 10s fallback timeout for /clear step in respawn controller
After sending /clear, if no prompt indicator is detected within 10 seconds,
proceed to send /init anyway. This fixes respawn getting stuck when Claude
doesn't show the expected prompt characters after /clear completes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 18:19:22 +01:00
arkonandClaude Opus 4.5 ae7c003089 fix: add input validation for /input and /resize API endpoints
- Add validation for input parameter in /input endpoint
- Add validation for cols/rows as positive integers in /resize endpoint
- Use standardized error responses with ApiErrorCode

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 16:20:56 +01:00
arkonandClaude Opus 4.5 3007abdbb2 docs: remove TUI from Quick Start options
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:54:20 +01:00
arkonandClaude Opus 4.5 469e8fedf4 docs: add more run options to Quick Start
Include custom port, TUI mode, and dev mode examples.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:53:58 +01:00
arkonandClaude Opus 4.5 51ac311920 docs: update closing tagline
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:52:01 +01:00
Ark0N 7a11280ab3 Fix formatting in README.md features list 2026-01-21 15:49:44 +01:00
Ark0N ba81cb8285 Update README.md 2026-01-21 15:48:04 +01:00
arkonandClaude Opus 4.5 90241b2ff1 docs: simplify README tagline
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:47:23 +01:00
arkonandClaude Opus 4.5 dc34eadaa7 chore: remove .claude/ from version control
Internal Claude Code development files are not needed in the public repo.
Files remain locally but are now gitignored.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 15:45:52 +01:00