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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
- 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>
- 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>
- 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>
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>
- 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>
- 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>
- 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>
- 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>
- 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>
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>
- 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>
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>