terraphim-hooks

Transform commands and messages using knowledge-graph-based Aho-Corasick automata.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/terraphim/terraphim-skills --skill terraphim-hooks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: terraphim-hooks
Source: https://github.com/terraphim/terraphim-skills/tree/main/skills/terraphim-hooks
Command: npx skills add https://github.com/terraphim/terraphim-skills --skill terraphim-hooks

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Terraphim hooks solve manual text editing by applying knowledge-graph-based transformations to commands and messages.

Core Features & Use Cases

  • Terraphim hooks intercept text at key points (CLI commands, commit messages) and apply transformations using Aho-Corasick automata built from knowledge graph definitions.
  • Key Components: PreToolUse hooks, Git hooks.
  • Use Case: Example transformation of npm install to bun install in a PreToolUse scenario to streamline tooling across environments.

Quick Start

Follow these steps to set up terraphim-hooks and run basic replacements:

  1. Create a knowledge-graph directory at ~/.config/terraphim/docs/src/kg
  2. Create replacement rules such as bun install.md with content describing the replacement and its synonyms
  3. Configure Claude Code hooks to invoke the terraphim-agent on PreToolUse events
  4. Run terraphim-agent replace against sample inputs to verify changes

Frequently Asked Questions about terraphim-hooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate text replacement in Git hooks and CLI commands?

Automate text replacement by configuring hooks to intercept inputs and apply transformations using Aho-Corasick automata built from local knowledge graph definitions. This enforces consistency across development workflows by rewriting commands and commit messages automatically.

What is a PreToolUse hook for command transformation?

A PreToolUse hook intercepts CLI commands before execution and applies knowledge-graph-based transformations to rewrite inputs. For example, it can automatically transform npm install to bun install to streamline tooling across environments.

Do I need a local knowledge graph to use Terraphim hooks?

Yes, a local knowledge graph is required to operate Terraphim hooks. You must create a knowledge-graph directory at ~/.config/terraphim/docs/src/kg and populate it with replacement rule files defining transformations and their synonyms.

How do I set up replacement rules for automated text rewriting?

To set up replacement rules, create files like bun install.md in your knowledge-graph directory and define the replacement text along with its synonyms. Configure your hooks to invoke the agent on target events and run replacement commands against sample inputs to verify.

Can I intercept and rewrite commit messages using Git hooks?

Yes, Git hooks can intercept and rewrite commit messages by applying knowledge-graph-based transformations. This rewrites intercepted inputs to enforce consistency and automation across your development workflow without manual text editing.