Commit Graph
6 Commits
Author SHA1 Message Date
lior 5f775b1ab1 fix(hooks): guard subagent stops and rewake from the parent transcript
Two defects in the background-task hook scripts.

SubagentStop had no handler at all. When a subagent launched background work and
one watcher ended while others were still running, Claude could publish the
worker's last progress sentence as its final result, abandoning the live tasks.
A new guard pairs launched task IDs against completed ones and confirms liveness
by scanning /proc/<pid>/fd for an open tasks/<id>.output handle, blocking the
stop only while genuinely-live work remains. It fails open — allowing the stop —
when /proc is unavailable, nothing was launched, or everything finished.

The rewake helper watched only input.transcript_path. A subagent has its own
transcript, but Claude writes the completion queue-operation to the PARENT
transcript, so the record it waited for never appeared and the wake never fired.
It now watches both paths, but only when the relationship is provable: the
transcript's parent directory is subagents/ and its grandparent basename equals
input.session_id. It also now requires operation === 'enqueue'.

The rewake marker moves V2 -> V3; refreshStaleCodemanHooks treats absence of the
current marker as stale, so existing cases self-heal on next launch (the same
mechanism as the V1 -> V2 bump). Ownership matches on marker PREFIXES, so a
future bump still recognises older Codeman handlers and never adopts a user's.

12 tests fail on unmodified master, e.g.
  expected '[{"matcher":"Bash",…' to contain 'CODEMAN_BACKGROUND_REWAKE_V3'
  expected 'Background command bg-report-1 comple…' to contain '<codeman-background-result>'
2026-08-08 22:31:38 +03:00
lior 3c903b36ca fix(hooks): reawaken jobs without replacing user hooks 2026-07-28 23:16:37 +03:00
arkonandClaude Opus 4.5 e55eca9824 docs: update all docs for security hardening, respawn fix, and test fixes
- CLAUDE.md: idle detection cancellation on substantial output, API input
  limits table, configure() method on RalphTracker, tighter completion
  pattern description
- ralph-wiggum-guide: add configure() to tracker methods table
- Both docs: update Last Updated date to 2026-01-24

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 16:26:31 +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 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 47877f00d0 docs: add comprehensive Ralph Wiggum and hooks documentation
- Create docs/ralph-wiggum-guide.md with official plugin reference,
  best practices, prompt templates, and troubleshooting
- Create docs/claude-code-hooks-reference.md with all hook events,
  configuration options, and examples from official docs
- Update CLAUDE.md with documentation section and quick reference
- Add missing key files (task-tracker.ts, state-store.ts) to architecture table
- Add unit test note to test port allocation section

Sources: Official Anthropic plugin, code.claude.com, community resources

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 08:56:15 +01:00