Hook Creator logo

Hook Creator

Community
tkellogg
hook-creator

Create and manage runtime command hooks declared in skills/*/hooks.json. Use when the user asks to intercept tool calls, augment prompts, audit or mutate tool arguments/results, add startup/shutdown scripts, or debug hook behavior.

Overview

Publishertkellogg
Repositoryopen-strix
Skill namehook-creator
Stars
95
Forks
21
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by tkellogg on GitHub. Read the source before you install it.

Installation

Install the Hook Creator AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/tkellogg/open-strix/tree/main/open_strix/builtin_skills/hook-creator
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/tkellogg/open-strix.git /tmp/open-strix
mkdir -p .claude/skills
cp -r /tmp/open-strix/open_strix/builtin_skills/hook-creator .claude/skills/hook-creator
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Hook Creator in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Hook Creator on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Hook Creator is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Hooks

Hooks are short-lived commands that receive one runtime event as JSON on stdin and may write one JSON object to stdout to replace it. They live in skills as hooks.json files and are discovered at startup and when reload_hooks is called.

Use hooks for small runtime adapters:

  • pre/post tool-call policy
  • prompt augmentation before the model is invoked
  • send_message shaping or audit
  • metrics and local logging
  • startup/shutdown setup and teardown

Do not use hooks for long-running services. Use UI plugins, pollers, supervisor jobs, or OS services for that.

hooks.json

json
{
  "hooks": [
    {
      "name": "message-policy",
      "command": "uv run python hook.py",
      "events": ["pre_tool_call", "post_tool_call", "pre_prompt"],
      "env": {},
      "timeout_seconds": 10,
      "include_conversation": false
    }
  ]
}

Valid events:

  • pre_tool_call
  • post_tool_call
  • pre_prompt
  • pre_startup
  • post_startup
  • pre_shutdown
  • post_shutdown

There are no tool-name filters in hooks.json. Filter explicitly in the hook script:

python
import json
import sys

event = json.loads(sys.stdin.readline())
if event.get("tool") != "send_message":
    print(json.dumps(event))
    raise SystemExit

event["args"]["text"] = event["args"]["text"].strip()
print(json.dumps(event))

Contract

The hook process runs from the directory containing hooks.json.

Environment:

  • STATE_DIR: the skill directory
  • HOOK_NAME: the hook name
  • HOOK_EVENT: the event type

Input:

  • exactly one JSON object plus a newline on stdin

Output:

  • stdout empty means no-op
  • stdout containing a JSON object replaces the event for the next hook
  • stderr is logged as hook_stderr

For pre_tool_call, returning an event with an args object changes the tool args before execution. For post_tool_call, returning an event with result changes the result shown to the agent after a successful tool call. For pre_prompt, returning prompt replaces the prompt, and returning append_prompt appends text to the prompt.

Blocking a tool call with _block

A pre_tool_call hook may reject the call entirely by returning an event with an _block object:

python
import json
import sys

event = json.loads(sys.stdin.readline())
if event.get("tool") == "send_message" and looks_bad(event["args"]):
    event["_block"] = {
        "reason": "shell-leak-prefix",
        "result": "[hook blocked] send_message text starts with `$(...)` — that ships as a literal string, not a shell command. Read the file and inline the contents, or attach via attachment_paths.",
    }
print(json.dumps(event))

When _block is set with both reason (string) and result (string), the wrapped tool is not invoked. The agent receives result as if it were the tool's own return value — so the agent sees the diagnostic next turn and can self-correct. A hook_blocked_tool_call event is logged, and post_tool_call hooks see status="blocked" with the same synthetic result.

This is the right verb when a hook needs to prevent a bad call rather than mutate it. Args-mutation is fine when the call should still happen but with different inputs; _block is for "this call must not happen — tell the agent why."

Invalid _block specs (missing fields, wrong types) are logged via hook_invalid_block and the call proceeds normally. This guards against silent drops from malformed hook output.

Set include_conversation: true only for hooks that need transcript context. The hook event then includes:

  • conversation.all_messages
  • conversation.channel_messages
  • conversation.current_channel_id

When logs/chat-history.jsonl exists, this is loaded from the persisted chat transcript. This is intentionally opt-in because full transcripts can be large.

Reload

After creating or editing hooks.json, call:

text
reload_hooks()

Debugging

Check logs/events.jsonl for:

  • hook_invalid_json
  • hook_invalid_format
  • hook_missing_fields
  • hook_timeout
  • hook_exec_error
  • hook_stderr
  • hook_nonzero_exit
  • hook_blocked_tool_call
  • hook_invalid_block
  • hook_invalid_mutation
  • hook_invalid_output
  • hook_invalid_mutation

Keep hooks small and deterministic. Short scripts are easier to reason about than daemons hiding in the tool path.

Frequently asked questions

What does the Hook Creator AI skill do?

Create and manage runtime command hooks declared in skills/*/hooks.json. Use when the user asks to intercept tool calls, augment prompts, audit or mutate tool arguments/results, add startup/shutdown scripts, or debug hook behavior.

Why use Hook Creator on TypingMind?

Because you install it once and use it with any model. Hook Creator is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Hook Creator in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/tkellogg/open-strix/tree/main/open_strix/builtin_skills/hook-creator. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Hook Creator?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Hook Creator?

As many as you like. As long as a model supports skills, you can use Hook Creator with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Hook Creator AI skill free?

Yes. It is published on GitHub by tkellogg under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇