Skip to content

feat(profile): record hooks, and report one added, removed or changed - #986

Merged
sandstream merged 2 commits into
mainfrom
claude/web-kit-status-sync-p6fg9a-profile-hooks
Nov 23, 2026
Merged

sandstream merged 2 commits into
mainfrom
claude/web-kit-status-sync-p6fg9a-profile-hooks

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Owner decision 3 from kit-research agent-platform-2027-vs-kit: yes.

Why

kit profile check reported a skill or an MCP server that was added after kit profile freeze. Hooks were not in the profile, although the harness runs a hook on its own, outside every tool-call gate.

What

  • src/profile/hooks.ts: reads the hooks of the project's .claude/settings.json.
    • Name: <event>: <command>, with the matcher when there is one (PreToolUse[Bash]: …).
    • Version: 16 hex digits of a SHA-256 over the project script files the command names.
  • kit profile freeze writes them as [[hooks]], and counts them in its summary line.
  • kit profile check compares them like the other kinds:
  hooks
    ✓ in sync  PreToolUse[Bash]: "$HOME/.kit/bin/kit" gate-bash
    ⚠ ADDED    Stop: node ./tools/listen.js  present, not declared
Change after freeze Reported as
a hook added ADDED
a hook removed, or its command changed REMOVED (and ADDED for the new command)
the script a hook runs was edited version drift, declared and found hash

Existing profiles

A profile frozen before this has no hooks list. Its hooks are not judged, so no existing --gate run starts failing. The output says: "hooks: present, but this profile was frozen before kit recorded them; run kit profile freeze. Not judged." The JSON output gains drift.notRecorded. A signed profile keeps its signature until it is frozen again.

An older kit rejects a profile that holds hooks (the schema is strict), as it does for any key it does not know.

Not covered

.claude/settings.local.json and ~/.claude/settings.json are not in the profile: they belong to one machine and the profile travels. kit check and the gates cover those two.

Verification

  • src/profile/hooks.test.ts: seven tests, one through the real CLI (freeze, add a hook, check --gate fails).
  • contracts/kit.opencli.json regenerated for the changed help text.
  • node scripts/prepush.mjs: build, format, lint, tests of the changed files, self-audit pass. kit review and the new-source-file check fail locally for container reasons. Semgrep did not run (not installed here).
  • No protected path.

Generated by Claude Code

kit profile listed skills, MCP servers and plugins. A hook was in none
of the lists, although the harness runs it outside every gate.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
@github-actions

Copy link
Copy Markdown

Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published.

… complexity limit

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
@github-actions

Copy link
Copy Markdown

Docker image built, scanned, and smoke-tested in CI. The PR image is local to this run and is not published.

@sandstream-kit-reviewer sandstream-kit-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kit review gate at c46fd73e7a3e: gates passed. All 33 checks passed on this commit, no file is in a protected class, 10 files and 279 lines changed. This approval is deterministic; it does not judge what the change is for.

@sandstream
sandstream merged commit b88b460 into main Nov 23, 2026
33 checks passed
@sandstream
sandstream deleted the claude/web-kit-status-sync-p6fg9a-profile-hooks branch November 23, 2026 03:57
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.

2 participants