Skip to content

fix: avoid CLAUDE_SKILL_DIR in hook frontmatter#1872

Closed
maxpetrusenkoagent wants to merge 1 commit into
garrytan:mainfrom
maxpetrusenkoagent:hermes/oss-pr-2026-06-05-openclaw-1871-2
Closed

fix: avoid CLAUDE_SKILL_DIR in hook frontmatter#1872
maxpetrusenkoagent wants to merge 1 commit into
garrytan:mainfrom
maxpetrusenkoagent:hermes/oss-pr-2026-06-05-openclaw-1871-2

Conversation

@maxpetrusenkoagent
Copy link
Copy Markdown

@maxpetrusenkoagent maxpetrusenkoagent commented Jun 5, 2026

Summary

Fixes #1871 by removing CLAUDE_SKILL_DIR from Claude skill-frontmatter PreToolUse hook commands. Claude Code 2.1.162 does not populate that variable for frontmatter hooks, so the generated hook command can expand to an invalid /../... path before the safety check runs.

The affected hook skills now use the installed Claude gstack skill root path directly:

  • careful
  • freeze
  • guard
  • investigate

Template and generated SKILL.md files are updated together.

Tests

  • ulimit -n 4096; bun test test/gen-skill-docs.test.ts
  • Result: 391 pass, 0 fail

Notes

This was produced through the Hermes OSS PR lane after the first OpenClaw automation run failed to emit a PR URL. The lane now uses a persistent manager-owned worktree so useful diffs survive agent compaction/session exits.

Fixes #1871

@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented Jun 5, 2026

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@maxpetrusenkoagent maxpetrusenkoagent marked this pull request as ready for review June 5, 2026 02:44
@maxpetrusenkoagent
Copy link
Copy Markdown
Author

Closing this Hermes OSS-lane PR as duplicate/overlap. Open PR #1141 already addresses the same root issue by replacing ${CLAUDE_SKILL_DIR} in the skill-frontmatter PreToolUse hook commands for the affected safety skills. Overlapping PR: #1141

@maxpetrusenkoagent
Copy link
Copy Markdown
Author

Addressed Codex reviewer blocker.

Fix:

  • Hook commands no longer depend on CLAUDE_SKILL_DIR.
  • They resolve repo-local .claude/skills/gstack/... first for setup --local.
  • They fall back to $HOME/.claude/skills/gstack/... for global installs.
  • Added regression assertions for git rev-parse --show-toplevel, $R/.claude/skills/gstack/, and $HOME/.claude/skills/gstack/.

Verification:

  • ulimit -n 4096; bun test test/gen-skill-docs.test.ts
  • 391 pass, 0 fail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skill-frontmatter PreToolUse hooks broken on Claude Code 2.1.162 (${CLAUDE_SKILL_DIR} not populated)

1 participant