Fix the trim-status-table hook path for sessions that start below the repository root #1755

Open
opened 2026-11-13 20:10:43 +00:00 by jared · 0 comments
Owner

Problem

The status-table trim hook of this repository cannot find its script in a session that starts below the repository root. Each Edit or Write in that session writes a hook_non_blocking_error record, and the History table trim does not run.

Observed

Counts from the transcripts under ~/.claude/projects on 2026-11-13: 553 hook_non_blocking_error records dated 2026-11-11 to 2026-11-13.

20 of them have the hooks PostToolUse:Write (13) and PostToolUse:Edit (7):

ruby: No such file or directory -- /home/jared/dev/cc-os/plugins/os-sdlc/bin/trim-status-table.rb (LoadError)

This hook is not an os-sdlc hook. plugins/os-sdlc/hooks/hooks.json has no Edit matcher and does not name the script. The hook is in the project file .claude/settings.json, matcher Edit|Write, command ruby "$CLAUDE_PROJECT_DIR/bin/trim-status-table.rb". The script exists only at the repository root, bin/trim-status-table.rb. In a session that starts in plugins/os-sdlc, $CLAUDE_PROJECT_DIR is plugins/os-sdlc, and the path does not exist. Before 2026-11-11 the same shape occurs with worktree paths, for example .claude/worktrees/ticket-1393/bin/trim-status-table.rb (201 records in all transcripts).

Reproduce

Start a session in plugins/os-sdlc and edit a file. The transcript gets the error above.

Approach

The trim hook command finds the script from each session directory of this repository, or does nothing when the edited file is not a status leaf of this repository.

Required work: none beyond the acceptance criteria.

Acceptance criteria

  1. Given a session that starts in plugins/os-sdlc, when the session edits a file, then the trim hook writes no error.
  2. Given a session that starts at the repository root, when the session edits a status leaf, then the trim runs as it does today.

Non-goals

The os-sdlc PostToolUse:Agent hook error. A separate ticket of 2026-11-13 covers it.

Origin

  • Trigger: the os-me check of 2026-11-13 in session 2bb44e9c. Jared asked how the os-me outcome function works and said "We definitely need to get this back on track. /os-me:predict desired outcome, how to get there, then do it!" The applied Prediction (docs/decisions/rulings.tsv row 161) sends this work to a ticket.
  • Improvised this session: none
  • Chain: trim hook fails ← .claude/settings.json builds the script path from $CLAUDE_PROJECT_DIR ← the session starts below the repository root, or in a worktree with no bin/trim-status-table.rb ← DESIGN (.claude/settings.json)
  • Root candidate: none found; searched "No database associated with Sequel::Model", post_tool_use, hook.rb, after_launch, NextInstruction, trim-status-table, CLAUDE_PROJECT_DIR, hook_non_blocking_error, PostToolUse:Agent, 1646
  • Where: .claude/settings.json (PostToolUse hook, matcher Edit|Write); bin/trim-status-table.rb
  • Session: 2bb44e9c-522c-4c97-8449-bd46bed898e0
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/2bb44e9c-522c-4c97-8449-bd46bed898e0.jsonl

VERDICT: CREATE (ticket-skeptic, 2026-11-13): observed recurring failure, 20 records; the skeptic split the draft into two tickets by mechanism.

## Problem The status-table trim hook of this repository cannot find its script in a session that starts below the repository root. Each Edit or Write in that session writes a `hook_non_blocking_error` record, and the History table trim does not run. ## Observed Counts from the transcripts under `~/.claude/projects` on 2026-11-13: 553 `hook_non_blocking_error` records dated 2026-11-11 to 2026-11-13. 20 of them have the hooks `PostToolUse:Write` (13) and `PostToolUse:Edit` (7): ``` ruby: No such file or directory -- /home/jared/dev/cc-os/plugins/os-sdlc/bin/trim-status-table.rb (LoadError) ``` This hook is not an os-sdlc hook. `plugins/os-sdlc/hooks/hooks.json` has no `Edit` matcher and does not name the script. The hook is in the project file `.claude/settings.json`, matcher `Edit|Write`, command `ruby "$CLAUDE_PROJECT_DIR/bin/trim-status-table.rb"`. The script exists only at the repository root, `bin/trim-status-table.rb`. In a session that starts in `plugins/os-sdlc`, `$CLAUDE_PROJECT_DIR` is `plugins/os-sdlc`, and the path does not exist. Before 2026-11-11 the same shape occurs with worktree paths, for example `.claude/worktrees/ticket-1393/bin/trim-status-table.rb` (201 records in all transcripts). ## Reproduce Start a session in `plugins/os-sdlc` and edit a file. The transcript gets the error above. ## Approach The trim hook command finds the script from each session directory of this repository, or does nothing when the edited file is not a status leaf of this repository. Required work: none beyond the acceptance criteria. ## Acceptance criteria 1. Given a session that starts in `plugins/os-sdlc`, when the session edits a file, then the trim hook writes no error. 2. Given a session that starts at the repository root, when the session edits a status leaf, then the trim runs as it does today. ## Non-goals The os-sdlc `PostToolUse:Agent` hook error. A separate ticket of 2026-11-13 covers it. ## Origin - Trigger: the os-me check of 2026-11-13 in session 2bb44e9c. Jared asked how the os-me outcome function works and said "We definitely need to get this back on track. /os-me:predict desired outcome, how to get there, then do it!" The applied Prediction (docs/decisions/rulings.tsv row 161) sends this work to a ticket. - Improvised this session: none - Chain: trim hook fails ← .claude/settings.json builds the script path from $CLAUDE_PROJECT_DIR ← the session starts below the repository root, or in a worktree with no bin/trim-status-table.rb ← DESIGN (.claude/settings.json) - Root candidate: none found; searched "No database associated with Sequel::Model", post_tool_use, hook.rb, after_launch, NextInstruction, trim-status-table, CLAUDE_PROJECT_DIR, hook_non_blocking_error, PostToolUse:Agent, 1646 - Where: .claude/settings.json (PostToolUse hook, matcher Edit|Write); bin/trim-status-table.rb - Session: 2bb44e9c-522c-4c97-8449-bd46bed898e0 - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/2bb44e9c-522c-4c97-8449-bd46bed898e0.jsonl VERDICT: CREATE (ticket-skeptic, 2026-11-13): observed recurring failure, 20 records; the skeptic split the draft into two tickets by mechanism.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#1755
No description provided.