hook-regenerate
Rebuild AIWG hook files from currently installed framework manifests
Best use case
hook-regenerate is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
It is a strong fit for teams already working in Codex.
Rebuild AIWG hook files from currently installed framework manifests
Teams using hook-regenerate should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/hook-regenerate/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How hook-regenerate Compares
| Feature / Agent | hook-regenerate | Standard Approach |
|---|---|---|
| Platform Support | Codex | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Rebuild AIWG hook files from currently installed framework manifests
Which AI agents support this skill?
This skill is designed for Codex.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
AI Agents for Marketing
Discover AI agents for marketing workflows, from SEO and content production to campaign research, outreach, and analytics.
SKILL.md Source
# Hook Regenerate
You are an AIWG Hook Management Specialist responsible for rebuilding AIWG hook files from the manifests of currently installed frameworks.
## Your Task
Regenerate `AIWG.md` (and provider equivalents) by assembling content from the `contextContributions` fragments of each installed framework. This updates the hook file content without touching platform context files (CLAUDE.md, WARP.md, etc.) or running a full `aiwg use` deployment.
## Parameters
| Flag | Description |
|------|-------------|
| `--provider <name>` | Regenerate only for this provider: `claude`, `warp`, `copilot`, `cursor`, `factory`, `windsurf`, `opencode`, `codex` |
| `--all` | Regenerate for all installed providers (default) |
| `--dry-run` | Show what would be written without writing |
| `--verbose` | Show each fragment being included and its line count |
## Hook File Map
| Provider | Hook File |
|----------|-----------|
| Claude Code | `AIWG.md` |
| Warp Terminal | `AIWG-warp.md` |
| Windsurf | `AIWG-windsurf.md` |
| GitHub Copilot | `AIWG-copilot.md` |
| Cursor | `AIWG-cursor.md` |
| Factory AI | `AIWG-factory.md` |
| OpenCode | `AIWG-opencode.md` |
| Codex | `AIWG-codex.md` |
## Workflow
### Step 1: Load Installed Registry
Read `.aiwg/frameworks/registry.json` to determine which frameworks are installed:
```json
{
"installed": [
{ "id": "sdlc-complete", "version": "2.1.0" },
{ "id": "aiwg-utils", "version": "1.5.0" }
]
}
```
If registry does not exist, fall back to scanning for known framework directories.
### Step 2: Collect Context Fragments
For each installed framework, read its `contextContributions` from `manifest.json`:
```json
{
"contextContributions": {
"hookFragment": "templates/project/AIWG-sdlc-fragment.md",
"sectionsDir": "templates/aiwg-sections",
"sectionsManifest": "templates/aiwg-sections/manifest.json",
"priority": 10
}
}
```
**If `sectionsManifest` is present** (preferred — sections-based assembly):
1. Read `{AIWG_ROOT}/{framework_path}/{sectionsManifest}`
2. For each section entry in manifest order:
- Load `{AIWG_ROOT}/{framework_path}/{sectionsDir}/{section.file}`
- Append to fragment buffer, followed by a blank line
3. Write assembled buffer to `{hookFragment}` (keeps the pre-assembled copy current)
**If only `hookFragment` is present** (legacy — single-file fragment):
Load the fragment file directly at `{AIWG_ROOT}/{framework_path}/{hookFragment}`.
**The sections-based approach is preferred** — it allows individual sections to be updated without touching the assembled file, and prevents agents from accidentally editing the whole AIWG.md content as a monolith.
**Always include** (regardless of installed frameworks):
- AIWG CLI core reference (always)
- RULES-INDEX pointer (when any rules are deployed)
- Hook management commands reference
### Step 3: Assemble Hook File
Combine fragments in priority order (lower number = higher priority):
```
Priority 1: Header (generated comment + timestamp)
Priority 5: Core AIWG CLI reference (always)
Priority 10: sdlc-complete fragment (if installed)
Priority 20: media-marketing-kit fragment (if installed)
Priority 30: forensics-complete fragment (if installed)
Priority 40: research-complete fragment (if installed)
Priority 50: rlm addon fragment (if installed)
Priority 60: voice-framework fragment (if installed)
Priority 90: RULES-INDEX pointer (if rules deployed)
Priority 95: Hook management reference (always)
```
### Step 4: Write Hook File
Write the assembled content to the appropriate hook file for each target provider.
**Header prepended to all generated hook files**:
```markdown
# AIWG Framework Context
<!-- Generated by aiwg hook-regenerate — do not edit manually -->
<!-- Frameworks: {list of installed frameworks} -->
<!-- Generated: {ISO timestamp} -->
<!-- Regenerate: aiwg hook-regenerate -->
<!-- Disable: aiwg hook-disable -->
```
### Step 5: Report
**Standard output**:
```
Regenerating AIWG.md from installed manifests...
Installed: sdlc-complete v2.1.0, aiwg-utils v1.5.0
Including: orchestrator context, RULES-INDEX, 47 commands, 12 agents
Excluding: media-marketing-kit (not installed), rlm (not installed)
Wrote AIWG.md (312 lines)
Hook is enabled — changes take effect at next session start
```
**Verbose output**:
```
Regenerating AIWG.md...
Fragment: core-header (8 lines, priority 1)
Fragment: aiwg-cli-core (25 lines, priority 5)
Fragment: sdlc-complete/AIWG-sdlc-fragment.md (270 lines, priority 10)
Fragment: rules-index-pointer (4 lines, priority 90)
Fragment: hook-management (5 lines, priority 95)
Total: 312 lines
Wrote AIWG.md
```
**Dry run output**:
```
[dry-run] Would write AIWG.md (312 lines)
[dry-run] Content preview:
---
# AIWG Framework Context
<!-- Generated by aiwg hook-regenerate -->
...
---
No files written. Remove --dry-run to apply.
```
## Fallback: No Registry
If no registry and no framework directories found, generate a minimal hook file containing only the core AIWG CLI reference and hook management section. Warn the user:
```
Warning: No installed frameworks detected.
Generating minimal AIWG.md with core CLI reference only.
Run `aiwg use sdlc` to deploy the SDLC framework.
```
## When to Run
- After `aiwg use <framework>` installs a new framework
- After `aiwg remove <framework>` uninstalls a framework
- After upgrading AIWG to a new version
- When you want to refresh the hook file without full redeployment
- After modifying AIWG configuration
## Examples
```bash
# Regenerate all hook files
/hook-regenerate
# Regenerate only Claude Code hook file
/hook-regenerate --provider claude
# Preview without writing
/hook-regenerate --dry-run
# Verbose output showing each fragment
/hook-regenerate --verbose
# Regenerate for all providers
/hook-regenerate --all
```
## Related Commands
- `/hook-enable` — Enable the hook after regenerating
- `/hook-disable` — Disable the hook temporarily
- `/hook-status` — Check current hook state
## References
- @.aiwg/planning/hook-file-architecture.md — Architecture design
- #439 — AIWG.md hook file architecture
- #441 — This command's issue
- #445 — Manifest-driven optimization (contextContributions contract)Related Skills
regression-cicd-hooks
Integrate regression testing into CI/CD pipelines with baseline comparison and merge blocking on failure
migrate-hook
Migrate existing CLAUDE.md full-injection to the AIWG.md hook file architecture
hook-status
Show AIWG hook state across all installed providers
hook-enable
Enable the AIWG context hook in platform context files without re-deploying
hook-disable
Disable the AIWG context hook without uninstalling AIWG or deleting hook files
aiwg-regenerate
Regenerate platform context file with preserved team directives
aiwg-regenerate-windsurfrules
Regenerate .windsurfrules for Windsurf with preserved team directives
aiwg-regenerate-warp
Regenerate WARP.md for Warp Terminal with preserved team directives
aiwg-regenerate-opencode
Regenerate OpenCode context file (.opencode/context.md) with AIWG framework content
aiwg-regenerate-factory
Regenerate AGENTS.md for Factory AI with hook file architecture
aiwg-regenerate-cursorrules
Regenerate .cursorrules for Cursor with preserved team directives
aiwg-regenerate-copilot
Regenerate copilot-instructions.md for GitHub Copilot with vendor-specific content only