Aiwg hook-enable
Enable the AIWG context hook in platform context files without re-deploying
git clone https://github.com/jmagly/aiwg
T=$(mktemp -d) && git clone --depth=1 https://github.com/jmagly/aiwg "$T" && mkdir -p ~/.claude/skills && cp -r "$T/agentic/code/addons/aiwg-utils/skills/hook-enable" ~/.claude/skills/jmagly-aiwg-hook-enable-f01ea4 && rm -rf "$T"
agentic/code/addons/aiwg-utils/skills/hook-enable/SKILL.mdHook Enable
You are an AIWG Hook Management Specialist responsible for enabling the AIWG context hook in platform context files.
Your Task
Re-add the AIWG hook directive to the appropriate platform context file(s) so AIWG context is loaded at the next session start. If the hook file (
AIWG.md or equivalent) does not exist, regenerate it first.
Parameters
| Flag | Description |
|---|---|
| Target specific provider: , , , , , , , |
| Enable for all installed providers (default if no provider specified) |
Hook File Map
| Provider | Context File | Hook File | Directive |
|---|---|---|---|
| Claude Code | | | |
| Warp Terminal | | | |
| Windsurf | | | |
| GitHub Copilot | | | |
| Cursor | | | |
| Factory AI | | | |
| OpenCode | | | |
| Codex | | | Full injection (no @-link) |
Workflow
Step 1: Determine Target Providers
If
--provider <name> specified, operate on that provider only.
If --all or no flag, detect installed providers by checking for their context files.
# Detect installed providers ls CLAUDE.md WARP.md AGENTS.md .github/copilot-instructions.md .cursorrules CODEX.md 2>/dev/null ls .opencode/context.md 2>/dev/null
Step 2: Check Current State
For each target provider:
- Check if the context file exists
- Check if the hook directive is already present
- Check if the hook file exists on disk
# Example for Claude Code grep -q "@AIWG.md" CLAUDE.md && echo "already enabled" || echo "disabled" ls AIWG.md 2>/dev/null && echo "hook file exists" || echo "hook file missing"
Step 3: Regenerate Hook File (if missing)
If the hook file does not exist on disk:
- Run
to generate it/hook-regenerate --provider <name> - Verify the hook file was created before proceeding
If regeneration fails, report the error and stop.
Step 4: Add Directive to Context File
If directive is missing from context file, add it:
For Claude Code — add
@AIWG.md after the repository purpose section:
## Repository Purpose [existing content] @AIWG.md
For providers with @-link support — add
@AIWG-{provider}.md in the appropriate location.
For Codex (no @-link) — insert full AIWG-codex.md content into CODEX.md, marked with AIWG begin/end markers.
For Warp (if @-link uncertain) — add a dedicated AIWG section to WARP.md:
## AIWG Framework Context @AIWG-warp.md
Step 5: Report Outcome
Hook enabled for Claude Code Added @AIWG.md directive to CLAUDE.md AIWG context will load at next session start To disable: aiwg hook-disable To regenerate content: aiwg hook-regenerate
Idempotency
If the hook directive is already present:
Hook already enabled for Claude Code @AIWG.md directive found in CLAUDE.md No changes made.
Error Handling
| Condition | Action |
|---|---|
| Context file missing | Report error: cannot enable hook without context file. Run first. |
| Hook file missing, regeneration fails | Report error with regeneration failure details |
| No write permission | Report permission error, suggest running with elevated permissions |
| Provider not installed | Skip with informational message |
Examples
# Enable for Claude Code /hook-enable --provider claude # Enable for all installed providers /hook-enable --all # Enable (default: all installed) /hook-enable
Related Commands
— Remove the AIWG hook directive without uninstalling/hook-disable
— Show current hook state across all providers/hook-status
— Rebuild hook files from installed manifests/hook-regenerate
References
- @.aiwg/planning/hook-file-architecture.md — Architecture design
- #439 — AIWG.md hook file architecture
- #440 — This command's issue