Skip to content

th-44bace: smooth-agent plugin ships shared repo guardrail hooks#185

Merged
brentrager merged 1 commit into
mainfrom
th-44bace-hooks-plugin
Jul 11, 2026
Merged

th-44bace: smooth-agent plugin ships shared repo guardrail hooks#185
brentrager merged 1 commit into
mainfrom
th-44bace-hooks-plugin

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

Problem

Each SmooAI repo hand-copies identical .claude/hooks/ guardrails, and they've drifted:

  • smooth has th-curl-hint.sh; smooai doesn't.
  • smooai's enforce-worktree.sh is the same logic with smooai paths substituted in.
  • smooblue has no .claude/settings.json and no guardrails at all.

Fix (Phase 1 — the plugin)

Move the shared guardrails into the smooth-agent marketplace plugin as one source of truth, genericized so the same scripts guard any SmooAI repo — the main worktree, its parent, and the repo name are derived from git worktree list --porcelain at runtime instead of being hardcoded:

Hook Event
enforce-worktree.sh PreToolUse Edit|Write|Bash
session-worktree-warning.sh SessionStart startup
th-curl-hint.sh PreToolUse Bash
enforce-pearls-labels.sh PostToolUse Bash

Wired in hooks/hooks.json; plugin bumped 0.1.0 → 0.2.0. The SessionStart pearls-workflow context stays global via th prime (already one source of truth — untouched).

Verification

Direct script tests, 8/8 across smooth + smooai contexts: edit-source-on-main asks, .claude/ bypass, feature-worktree allow, git commit on main asks, git -C <worktree> commit allows, non-git dir safe-defaults to allow, and the repo name is correctly substituted in messages (smooth vs smooai). th-curl-hint + enforce-pearls-labels smoke-tested; all plugin JSON valid.

Follow-up (Phase 2 — per-repo cutover, after this lands + marketplace refresh)

Each repo (smooth, smooai, smooblue) enables smooth-agent@smooth via enabledPlugins + extraKnownMarketplaces and deletes its local .claude/hooks/ copies. Done only after verifying the live plugin fires, so no repo is left unguarded.

🤖 Generated with Claude Code

https://claude.ai/code/session_015zP7baF7SHR89bPftsX1kp

Each SmooAI repo hand-copied identical .claude/hooks/ guardrails that
drifted: smooth had th-curl-hint but smooai didn't, smooai had a repo-
name-substituted enforce-worktree, and smooblue had no guardrails at all.

Move them into the smooth-agent marketplace plugin as one source of truth,
genericized so the same scripts guard any SmooAI repo — the main worktree,
its parent, and the repo name are derived from `git worktree list` at
runtime instead of being hardcoded per repo:

  - enforce-worktree.sh        PreToolUse Edit|Write|Bash
  - session-worktree-warning.sh SessionStart startup
  - th-curl-hint.sh            PreToolUse Bash
  - enforce-pearls-labels.sh   PostToolUse Bash

Wired in hooks/hooks.json; plugin bumped 0.1.0 -> 0.2.0. Repos enable via
enabledPlugins and drop their local copies in follow-up per-repo changes
(the SessionStart pearls-workflow context stays global via `th prime`).

Verified: 8/8 direct script tests across smooth + smooai contexts (edit-on-
main asks, .claude bypass, feature-worktree allow, git-commit ask, git -C
worktree allow, non-git safe default, repo name in messages), th-curl-hint
+ enforce-pearls-labels smoke tests, all plugin JSON valid.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zP7baF7SHR89bPftsX1kp
@changeset-bot

changeset-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 048ee16

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@smooai/smooth Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brentrager brentrager enabled auto-merge (squash) July 11, 2026 03:04
@brentrager brentrager merged commit d2ec797 into main Jul 11, 2026
2 checks passed
brentrager added a commit that referenced this pull request Jul 11, 2026
Enable smooth-agent@smooth via enabledPlugins + extraKnownMarketplaces and
delete the local .claude/hooks/ copies (enforce-worktree, th-curl-hint,
enforce-pearls-labels) — the plugin now provides them (PR #185), genericized
so one source of truth guards every SmooAI repo. The SessionStart worktree
warning moves to the plugin's session-worktree-warning.sh; the pearls-workflow
context stays global via th prime.


Claude-Session: https://claude.ai/code/session_015zP7baF7SHR89bPftsX1kp

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant