rules-to-hook

Installation
SKILL.md

Hook Context Rules

Author and maintain .claude/context-rules.json for the context-inject.mjs hook. The engine supports both Claude Code and VS Code Copilot hook payload formats.

VS Code Copilot support

The engine auto-detects payloads from VS Code Copilot (camelCase fields, toolArgs as JSON string). Key differences from Claude Code:

  • Event name: VS Code doesn't include the event in the payload. Pass it as a CLI argument: node .claude/hooks/context-inject.mjs preToolUse. The engine normalizes camelCase (preToolUse) to PascalCase (PreToolUse) used in rules.
  • Tool input: VS Code sends toolArgs (JSON string), not tool_input (object). The engine parses it automatically.
  • Output: VS Code only supports permissionDecision on preToolUse — flat JSON, no hookSpecificOutput wrapper. Context injection (text, hint, learnings) has no effect on VS Code.
  • Supported inject types on VS Code: only block and allow (PreToolUse).
Installs
10
Repository
andurilcode/ctx
First Seen
Mar 3, 2026