feat(harness): enable tool-mirror hook + live activity in inspector drawer (issue #84) - #101
Merged
Merged
Conversation
…rawer (issue #84) Enable log-worker-tool.sh's PostToolUse mirror by default (issue #71 spike concluded: go) and extend the worker inspector (/api/worker/<role>/<task>) with an `activity` array read from the mirror log, filtered to the worker's worktree and capped to the most recent 20, newest first. The drawer gains a "Live activity" section, rendered via textContent only. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EXQ49ycXNDBzi8x15n2jsc
robercano
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #84.
Decision: ENABLE the tool-mirror hook by default
Evaluated the
log-worker-tool.shspike (PostToolUse hook mirroring worker Bash/Edit/Write calls to.claude/state/worker-tools.jsonl) and decided to enable it always-on. Full evaluation evidence is posted as a comment on issue #84. Summary: readable Bash summaries, correct oldest-first rotation at the 2000-line cap, ~1,200 lines/hour under a ~4-worker fan-out (well within budget), zero agent tokens (harness-side), never-block contract intact.Changes (all under
.claude/)settings.json— newPostToolUseBash|Edit|Writeentry wiringlog-worker-tool.sh(existing Edit|Write→lint hook, Stop, PreToolUse all preserved).scripts/log-worker-tool.sh— header status reframed from "SPIKE / disabled by default" to enabled-by-default (behavior unchanged; comment-only diff).scripts/log-worker-tool.test.sh— header note updated to match.scripts/cockpit-serve.sh—GET /api/worker/<role>/<task>gains anactivityfield: worker-tools records under the worker's worktree path, newest first, capped to 20;[]when the log file or worktree is absent (never throws).CLAUDE_WORKER_TOOLS_FILEenv override plumbed into the node reader for testability. Drawer gains a "Live activity (newest first)" section rendered viatextContentonly (same XSS contract as the rest of the drawer).scripts/cockpit.test.sh— new coverage for theactivityfield: presence + array + newest-first ordering + cross-worktree exclusion, and the no-log-file case (activity: [], endpoint still 200 with timeline/worktree intact).Gates & review
GATES_FILE=.claude/self/gates.json gate.sh build|lint|testall green (cockpit.test.sh 57 checks, log-worker-tool.test.sh 17 checks, smoke-fanout end-to-end pass).correctness(approve) andtests(approve) lenses, consensusall.🤖 Generated with Claude Code
https://claude.ai/code/session_01EXQ49ycXNDBzi8x15n2jsc