Commit Graph
825 Commits
Author SHA1 Message Date
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 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
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 c33d6e0987 refactor: improve code quality with stricter TypeScript and memory leak prevention
- Add stricter TypeScript compiler flags (noUnusedLocals, noUnusedParameters,
  noImplicitReturns, noImplicitOverride, noFallthroughCasesInSwitch,
  allowUnreachableCode, allowUnusedLabels)
- Remove unused variables caught by stricter flags:
  - Remove unused `renameSession` destructuring in App.tsx
  - Remove unused `BG_GRAY` constant in DirectAttach.ts
  - Remove unused `INPUT_BATCH_INTERVAL` constant in useSessionManager.ts
- Add proper EventEmitter cleanup to RalphLoop:
  - Store bound event handlers for cleanup
  - Add cleanupEventHandlers() method
  - Add destroy() method for complete cleanup
  - Add destroyRalphLoop() singleton cleanup function
- Update ralph-loop tests to use destroy() instead of stop() to prevent
  MaxListenersExceededWarning

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 14:01:47 +01:00
arkonandClaude Opus 4.5 d5ae376e07 feat(tui): add web server auto-start, shell mode, and feature parity
TUI now checks if web server is running on startup and offers to start
it in the background. Added new CLI options: --with-web (auto-start),
--no-web (skip check), -p (port).

TUI feature parity with web interface:
- Shell mode: press 'h' in cases view to start bash instead of Claude
- Multi-start: press 'm' to start 1-20 sessions at once
- Respawn toggle: Ctrl+R to enable/disable respawn on Claude sessions
- Session rename: API support via useSessionManager hook

Security fixes from previous analysis:
- Command injection prevention in screen-manager.ts
- Path traversal protection in server.ts
- Input validation for shell-interpolated values

Also fixes memory leak in session.ts (timer tracking) and flaky test
timeout in session-cleanup.test.ts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 09:54:42 +01:00
arkonandClaude Opus 4.5 921abd42a3 test: add unit tests for CLAUDE.md template generation
Adds 16 tests covering:
- Default template generation with case name and description
- Date placeholder replacement
- Claudeman environment section inclusion
- Work principles and TodoWrite guidance
- Ralph Wiggum Loop section
- Custom template loading and fallback behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 08:36:25 +01:00
arkonandClaude Opus 4.5 2db50f5c61 test: add unit tests for types module utility functions
- Add 10 tests for types.ts helper functions
- Test createErrorResponse with all error codes
- Test createSuccessResponse with and without data
- Test createInitialInnerLoopState defaults
- Test createInitialInnerSessionState structure
- Test createInitialState with Ralph Loop and config

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 07:37:57 +01:00
arkonandClaude Opus 4.5 5f66e052e7 test: add unit tests for StateStore class
- Add 27 tests covering state persistence and retrieval
- Test debounced save behavior with fake timers
- Test session, task, and config CRUD operations
- Test Ralph Loop state management
- Test inner state operations for session tracking
- Test persistence across store instances
- Uses real file system in temp directory for integration tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 07:33:16 +01:00
arkonandClaude Opus 4.5 e079151ac3 test: add unit tests for SessionManager class
- Add 29 tests covering session lifecycle management
- Test session creation, stopping, and cleanup
- Test event forwarding (output, error, completion, exit)
- Test max concurrent sessions limit
- Test session state persistence and retrieval
- Mock Session class to isolate unit tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 07:28:11 +01:00
arkonandClaude Opus 4.5 f27cde1e36 test: add unit tests for RalphLoop class
- Add 24 tests covering Ralph Loop lifecycle
- Test start, stop, pause, resume state transitions
- Test elapsed time tracking and min duration
- Test automatic stopping when conditions met
- Test stats reporting
- Use vi.hoisted() for mock state sharing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 07:23:49 +01:00
arkonandClaude Opus 4.5 e16242d32f test: add unit tests for Task class
- Add 25 tests covering Task model functionality
- Test constructor options and ID generation
- Test lifecycle methods (assign, complete, fail, reset)
- Test completion detection with promise tags
- Test timeout handling with fake timers
- Test serialization (toDefinition, toState, fromState)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 07:19:49 +01:00
arkonandClaude Opus 4.5 35b0a631a6 test: add unit tests for TaskQueue class
- Add 29 tests covering all TaskQueue methods
- Test priority ordering, dependency satisfaction
- Test task lifecycle (add, update, remove)
- Test filtering methods (pending, running, completed, failed)
- Test clear operations (clearCompleted, clearFailed, clearAll)
- Mock state-store to isolate unit tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 07:18:12 +01:00
arkonandClaude Opus 4.5 08b76cdb60 perf: add event debouncing to InnerLoopTracker
- Add EVENT_DEBOUNCE_MS constant (50ms) for batching rapid updates
- Add debounce timers and pending flags for todo/loop updates
- Add emitTodoUpdateDebounced() and emitLoopUpdateDebounced() methods
- Add flushPendingEvents() for testing/immediate sync needs
- Update reset()/fullReset() to clear debounce timers
- Replace rapid-fire emit calls with debounced versions
- Reduces UI jitter from rapid consecutive updates
- Tests updated to use flushPendingEvents() for synchronous testing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 05:41:30 +01:00
arkonandClaude Opus 4.5 78ee062c4d fix: update assignTask to use BufferAccumulator API
- Fix TypeScript error: assignTask() was still using string assignment
- Add extended timeout to session.test.ts afterAll hook to prevent
  flaky test failures during cleanup

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 05:10:57 +01:00
arkonandClaude Opus 4.5 d741b82966 fix: improve terminal buffer cleaning and test reliability
- Add buffer cleaning to remove junk before Claude banner
- Fix test todo text to avoid pattern conflicts
- Add reset support to inner-config API endpoint

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 04:34:45 +01:00
arkonandClaude Opus 4.5 4f11e029e5 fix: resolve flaky tests and TypeScript errors
- Fix pty-interactive test: use shell mode for reliable output timing
- Fix session-cleanup test: account for restored sessions from parallel tests
- Fix quick-start test: increase afterAll timeout for server.stop()
- Fix scheduled-runs test: skip slow real-Claude test, increase timeout
- Fix TypeScript errors: add non-null assertions for screenSession

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 20:56:25 +01:00
arkonandClaude Opus 4.5 bc16459ecb refactor: optimize inner-loop-tracker performance and code quality
Performance improvements:
- Throttle cleanupExpiredTodos() to run every 30s instead of every chunk
- Add early exit in detectTodoItems() for lines without todo markers
- Remove redundant PROMISE_PATTERN check from LOOP_START_PATTERN

Code quality:
- Extract activateLoopIfNeeded() helper to eliminate duplicate loop start logic
- Improve hash function using djb2 algorithm for better distribution
- Add guards for empty/whitespace-only content in upsertTodo()
- Simplify startLoop() to use existing enable() method

Tests:
- Add 5 new tests for edge cases and optimizations
- Test empty content handling, early exit, ID uniqueness

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 15:16:22 +01:00
arkonandClaude Opus 4.5 af9290389c fix: detect Claude Code native TodoWrite checkbox format
- Add TODO_NATIVE_PATTERN to match ☐/☒/◐ icons from Claude Code's TodoWrite
- Add TODO_EXCLUDE_PATTERNS to filter out tool invocations (Bash, Search, etc.)
- Update iconToStatus() to recognize ☒ as completed
- Add tests for native checkbox detection

The tracker now correctly parses Claude Code's actual terminal output format
instead of only matching markdown checkboxes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 14:23:22 +01:00
arkonandClaude Opus 4.5 2c38f7924a feat(tracker): disable Ralph Wiggum tracker by default, auto-enable on detection
The InnerLoopTracker is now disabled by default and auto-enables when
Ralph-related patterns are detected:
- /ralph-loop command
- <promise>PHRASE</promise> completion phrases
- TodoWrite tool usage
- Iteration patterns (Iteration 5/50, [5/50])
- Todo checkboxes (- [ ]/- [x]) or indicator icons

This reduces noise for sessions that don't use Ralph loops while
maintaining full functionality when loops are detected.

Changes:
- Add `enabled` property to InnerLoopState type
- Add enable()/disable() methods to InnerLoopTracker
- Implement shouldAutoEnable() for pattern detection
- Update frontend to show "Tracking" status when enabled
- Add CSS for tracking state indicator
- Update CLAUDE.md documentation
- Add comprehensive tests for auto-enable behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 18:34:43 +01:00
arkonandClaude Opus 4.5 684ccc2b07 feat(ralph): enhance Ralph Wiggum loop visualization
Add polished, animated Ralph Wiggum Loop panel with:
- Circular progress ring showing task completion percentage
- Task cards with status indicators (pending/in-progress/completed)
- Animated status badge with pulsing indicator when active
- Completion celebration animation with animated checkmark
- Smart time formatting ("1h 23m" instead of "1.38 hours")

Enhanced detection patterns based on official Ralph plugin:
- /ralph-loop command detection
- Iteration patterns: "Iteration 5/50", "[5/50]"
- Max iterations from YAML: "max-iterations: 50"
- TodoWrite tool output detection

Adds maxIterations field to InnerLoopState for tracking loop limits.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 17:09:56 +01:00
arkonandClaude Opus 4.5 ee8f6bd0cb feat: track Ralph Wiggum loops and todo lists in Claude sessions
Add InnerLoopTracker to detect and expose internal Claude Code state
running inside claudeman sessions by parsing terminal output patterns.

Detection patterns:
- Completion phrases: <promise>PHRASE</promise>
- Todo items: checkbox format, indicator icons, status parentheses
- Loop status: cycle counts, elapsed time, start/completion

New features:
- Inner state panel UI (collapsible, below session tabs)
- SSE events: innerLoopUpdate, innerTodoUpdate, innerCompletionDetected
- API endpoint: GET /api/sessions/:id/inner-state
- State persistence to ~/.claudeman/state-inner.json

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 13:21:01 +01:00
arkonandClaude Opus 4.5 a5b8628e53 refactor: hybrid indicator+timeout detection in respawn controller
- Primary: Use '↵ send' indicator for immediate response when ready
- Fallback: Use timeout-based detection for prompt patterns
- Add working indicators: Synthesizing, Brewing, ✻, ✽
- Cleaner step completion handlers (checkUpdateComplete, etc.)

The hybrid approach responds immediately when Claude shows the
suggestion indicator, while still having timeout fallback for
reliability.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 12:32:36 +01:00
arkonandClaude Opus 4.5 c81d014ec1 test: add comprehensive test suite with 129 tests
- Add PTY interactive session tests
- Add SSE event streaming tests
- Add scheduled runs API tests
- Add edge case and error handling tests
- Add integration flow tests for user workflows
- Add respawn controller tests with edge cases
- Add session cleanup and resource management tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 21:35:34 +01:00