Hooks Automation

Automates pre/post-operation hooks for agent coordination, formatting, and session memory.

Updated Feb 17, 2026
One-click install
npx skills add https://github.com/derbalimajd04-dot/al-wasat --skill hooks-automation-derbalimajd04-dot
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: Hooks Automation
Source: https://github.com/derbalimajd04-dot/al-wasat/tree/main/.agents/skills/hooks-automation
Command: npx skills add https://github.com/derbalimajd04-dot/al-wasat --skill hooks-automation-derbalimajd04-dot

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Manually coordinating agents, formatting code, tracking sessions, and persisting context across development sessions is repetitive and error-prone. This Skill automates those tasks through configurable pre/post-operation hooks integrated with MCP tools and memory coordination. ## Core Features & Use Cases - Pre/Post Operation Hooks: Validate syntax, auto-assign agents, and back up files before edits; auto-format, lint, and train neural patterns after edits. - Session & Memory Management: Start, restore, and end sessions with state persistence, metrics export, and cross-agent memory synchronization. - Git & MCP Integration: Wire hooks into Git pre-commit/pre-push quality gates and coordinate with MCP swarm tools for agent spawning and neural training. - Use Case: A team running multi-agent refactoring configures post-edit hooks so every file change is auto-formatted, stored in coordination memory, and used to train patterns, while a test engineer agent reads that memory to generate matching tests. ## Quick Start Ask the AI to initialize the hooks system with npx Codex-flow init --hooks and configure a post-edit hook that auto-formats files and stores edit context in memory.

Frequently Asked Questions about Hooks Automation

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

FAQPage Schema
How do I set up pre-edit and post-edit hooks for automatic code formatting?▼

Add hook entries to .Codex/settings.json under PreToolUse and PostToolUse with matchers for Write, Edit, and MultiEdit. Point each to npx Codex-flow hook pre-edit or post-edit with the file path, and enable --auto-format for language-specific formatting.

How do I persist session state and restore it later?▼

Use npx Codex-flow hook session-end with --save-state and --export-metrics to persist context, then run session-restore with the same session ID and --restore-memory to reload memory state and agent configurations.

Does the hooks system integrate with Git pre-commit checks?▼

Yes. You can add a Git pre-commit script that runs pre-edit hooks with --validate-syntax on staged files and post-edit hooks with --auto-format, blocking the commit if validation fails. Pre-push hooks can enforce test suites and quality thresholds.

Why are my configured hooks not executing?▼

Check that .Codex/settings.json has valid syntax, the matcher patterns match the tool names, and the Codex-flow CLI is in your PATH. Enable debug mode with CLAUDE_FLOW_DEBUG=true and review the hook execution logs.

What are the limitations of running hooks on every edit?▼

Hooks add latency to each operation, so they should stay under roughly 100ms or run asynchronously for heavy work. Misconfigured timeouts or blocking MCP calls can slow the workflow, so use continueOnError and caching where appropriate.