Skip to content

Commit e86a386

Browse files
authored
feat: add PRE_TASK_EXECUTION hook (#16)
## Summary - Adds `PRE_TASK_EXECUTION.md` hook template (ships empty) for pre-flight validation before individual task dispatch - Wires the hook into `execute-blueprint.md` and `full-workflow.md` as a new step between agent selection and parallel execution - Documents the hook across six Jekyll docs pages and updates AGENTS.md Closes #15 ## Test plan - [x] `npm test` passes (189 tests) - [x] `npm start init --assistants claude` installs `PRE_TASK_EXECUTION.md` to `.ai/task-manager/config/hooks/` - [x] `execute-blueprint.md` references the hook between steps 2 and 4 - [x] Hook count updated from "eight" to "nine" in all docs
1 parent 2c45081 commit e86a386

18 files changed

Lines changed: 46 additions & 36 deletions

.devcontainer/Dockerfile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ ARG TZ=Europe/Madrid
55
ENV TZ="$TZ"
66

77
ARG CLAUDE_CODE_VERSION=latest
8-
ARG GEMINI_VERSION=latest
9-
ARG CODEX_VERSION=latest
108

119
# Install basic development tools and iptables/ipset
1210
RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -49,8 +47,7 @@ RUN mkdir -p /worktrees \
4947
&& chown -R $USERNAME /worktrees
5048

5149
# Pre-create directories that will be needed for bind mounts
52-
RUN mkdir -p /home/$USERNAME/.claude/debug /home/$USERNAME/.gemini /home/$USERNAME/.codex \
53-
&& chown -R $USERNAME:$USERNAME /home/$USERNAME/.claude /home/$USERNAME/.gemini /home/$USERNAME/.codex
50+
RUN mkdir -p /home/$USERNAME/.claude/debug && chown -R $USERNAME:$USERNAME /home/$USERNAME/.claude
5451

5552
# Set `DEVCONTAINER` environment variable to help with orientation
5653
ENV DEVCONTAINER=true
@@ -91,7 +88,5 @@ RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/
9188
-a "export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
9289
-x
9390

94-
# Install Claude & Gemini
91+
# Install Claude
9592
RUN npm install -g @anthropic-ai/claude-code@${CLAUDE_CODE_VERSION:-latest}
96-
RUN npm install -g @google/gemini-cli@${GEMINI_VERSION:-latest}
97-
RUN npm install -g @openai/codex@${CODEX_VERSION:-latest}

.devcontainer/devcontainer.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"BASE_IMAGE": "node:22",
77
"TZ": "${localEnv:TZ:Europe/Madrid}",
88
"CLAUDE_CODE_VERSION": "latest",
9-
"GEMINI_VERSION": "latest",
109
"GIT_DELTA_VERSION": "0.18.2",
1110
"ZSH_IN_DOCKER_VERSION": "1.2.0"
1211
}
@@ -56,14 +55,10 @@
5655
"source=claude-code-bashhistory-${devcontainerId},target=/commandhistory,type=volume",
5756
"source=${localWorkspaceFolder}/../worktrees,target=/worktrees,type=bind,consistency=cached",
5857
"source=${localEnv:HOME}/.claude/CLAUDE.md,target=/home/node/.claude/CLAUDE.md,type=bind,consistency=cached",
59-
"source=${localEnv:HOME}/.gemini/GEMINI.md,target=/home/node/.gemini/GEMINI.md,type=bind,consistency=cached",
60-
"source=${localEnv:HOME}/.codex/AGENTS.md,target=/home/node/.codex/AGENTS.md,type=bind,consistency=cached",
6158
"source=${localEnv:HOME}/.claude.json,target=/home/node/.claude.json,type=bind,consistency=cached",
6259
"source=${localEnv:HOME}/.claude/settings.json,target=/home/node/.claude/settings.json,type=bind,consistency=cached",
6360
"source=${localEnv:HOME}/.claude/skills,target=/home/node/.claude/skills,type=bind,consistency=cached",
6461
"source=${localEnv:HOME}/.claude/hooks,target=/home/node/.claude/hooks,type=bind,consistency=cached",
65-
"source=${localEnv:HOME}/.codex/config.toml,target=/home/node/.codex/config.toml,type=bind,consistency=cached",
66-
"source=${localEnv:HOME}/.codex/prompts,target=/home/node/.codex/prompts,type=bind,consistency=cached",
6762
"source=${localEnv:HOME}/.config/gh/hosts.yml,target=/home/node/.config/gh/hosts.yml,type=bind,consistency=cached",
6863
"source=${localEnv:HOME}/.gitconfig,target=/home/node/.gitconfig,type=bind,consistency=cached",
6964
"source=${localEnv:SSH_AUTH_SOCK},target=/ssh-agent,type=bind"
@@ -76,7 +71,7 @@
7671
},
7772
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=delegated",
7873
"workspaceFolder": "/workspace",
79-
"postCreateCommand": "sudo chown -R node:node /home/node/.claude /home/node/.gemini /home/node/.codex || true",
80-
"postStartCommand": "npm update -g @anthropic-ai/claude-code && npm update -g @google/gemini-cli && npm update -g @openai/codex",
74+
"postCreateCommand": "sudo chown -R node:node /home/node/.claude || true",
75+
"postStartCommand": "npm update -g @anthropic-ai/claude-code",
8176
"waitFor": "postStartCommand"
8277
}

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ project/
292292
│ ├── config/
293293
│ │ ├── TASK_MANAGER.md # Project context
294294
│ │ ├── scripts/ # ID generation (get-next-plan-id.cjs, etc)
295-
│ │ ├── hooks/ # Validation scripts (PRE_PLAN.md, POST_PLAN.md, etc)
295+
│ │ ├── hooks/ # Lifecycle hooks (PRE_PLAN, POST_PLAN, PRE_PHASE, POST_PHASE, PRE_TASK_ASSIGNMENT, PRE_TASK_EXECUTION, POST_TASK_GENERATION_ALL, POST_EXECUTION, POST_ERROR_DETECTION)
296296
│ │ └── templates/ # Customizable (PLAN_TEMPLATE.md, TASK_TEMPLATE.md)
297297
└── .<assistant>/... # See Assistant-Specific Differences table below
298298
```

docs/architecture.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,13 @@ AI Task Manager is built for customization through three extension points:
233233

234234
### 1. Hooks System
235235

236-
Eight lifecycle hooks inject custom logic:
236+
Nine lifecycle hooks inject custom logic:
237237

238238
```
239239
PRE_PLAN → Planning guidance
240240
PRE_PHASE → Phase preparation
241241
PRE_TASK_ASSIGNMENT → Agent selection
242+
PRE_TASK_EXECUTION → Task pre-flight validation
242243
POST_PLAN → Plan validation
243244
POST_TASK_GENERATION_ALL → Task refinement
244245
POST_PHASE → Quality gates

docs/comparison.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ All formats are automatically generated from a single source during initializati
317317
### Can I customize the workflow?
318318

319319
**Yes, extensively.** Customize:
320-
- **Hooks**: Eight lifecycle hooks for validation gates and custom logic
320+
- **Hooks**: Nine lifecycle hooks for validation gates and custom logic
321321
- **Templates**: Five templates for plans, tasks, blueprints, and summaries
322322
- **Configuration**: TASK_MANAGER.md and POST_PHASE.md for project context
323323

docs/customization-extension.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ In this section:
3030
## Customization Points
3131

3232
### Hooks System
33-
Eight lifecycle hooks inject custom logic at key points in the workflow. All hooks are Markdown files in `.ai/task-manager/config/hooks/`:
33+
Nine lifecycle hooks inject custom logic at key points in the workflow. All hooks are Markdown files in `.ai/task-manager/config/hooks/`:
3434

3535
- **PRE_PLAN**: Pre-planning guidance
3636
- **PRE_PHASE**: Phase preparation logic
3737
- **POST_PHASE**: Validation gates after each phase
3838
- **POST_PLAN**: Plan validation
3939
- **POST_TASK_GENERATION_ALL**: Task complexity analysis and blueprint generation
4040
- **PRE_TASK_ASSIGNMENT**: Agent selection based on skills
41+
- **PRE_TASK_EXECUTION**: Pre-flight validation before each task dispatch
4142
- **POST_ERROR_DETECTION**: Error handling procedures
4243
- **POST_EXECUTION**: Final validation before execution summary and archival
4344

docs/customization.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,17 @@ The hook system injects custom logic at seven key points in the workflow lifecyc
116116
- Map skills to specific agent configurations
117117
- Add fallback strategies for unmatched skills
118118

119-
#### 7. POST_ERROR_DETECTION Hook
119+
#### 7. PRE_TASK_EXECUTION Hook
120+
121+
**File**: `PRE_TASK_EXECUTION.md`
122+
**Purpose**: Pre-flight validation before each individual task is dispatched to an agent. Ships empty — add your own checks.
123+
124+
**Common Customizations**:
125+
- Add project-specific pre-flight checks (e.g., verify required services are running)
126+
- Configure which checks are hard failures vs warnings
127+
- Add environment validation (e.g., required env vars are set)
128+
129+
#### 8. POST_ERROR_DETECTION Hook
120130

121131
**File**: `POST_ERROR_DETECTION.md`
122132
**Purpose**: Error handling procedures for task execution failures

docs/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ AI Task Manager provides comprehensive tools for structured AI-assisted developm
2020
- **Template Customization**: Modify plan and task templates to include project-specific sections, acceptance criteria, and workflow steps
2121

2222
### Extensibility Framework
23-
- **Hook System**: Eight lifecycle hooks for injecting custom logic at key workflow points (PRE_PLAN, PRE_PHASE, POST_PHASE, POST_PLAN, POST_TASK_GENERATION_ALL, PRE_TASK_ASSIGNMENT, POST_ERROR_DETECTION, POST_EXECUTION)
23+
- **Hook System**: Nine lifecycle hooks for injecting custom logic at key workflow points (PRE_PLAN, PRE_PHASE, POST_PHASE, POST_PLAN, POST_TASK_GENERATION_ALL, PRE_TASK_ASSIGNMENT, PRE_TASK_EXECUTION, POST_ERROR_DETECTION, POST_EXECUTION)
2424
- **Custom Validation Gates**: Add project-specific quality checks, security scans, performance tests, or documentation requirements
2525
- **Integration Points**: Connect with existing CI/CD pipelines, testing frameworks, or development tools
2626
- **Workflow Patterns**: Create and share reusable workflow patterns for common project types

docs/installation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ project-root/
9191
│ │ │ ├── POST_PLAN.md
9292
│ │ │ ├── POST_TASK_GENERATION_ALL.md
9393
│ │ │ ├── PRE_TASK_ASSIGNMENT.md
94+
│ │ │ ├── PRE_TASK_EXECUTION.md
9495
│ │ │ ├── POST_ERROR_DETECTION.md
9596
│ │ │ └── POST_EXECUTION.md
9697
│ │ ├── templates/ # Customizable templates

templates/ai-task-manager/config/hooks/POST_ERROR_DETECTION.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# POST_ERROR_DETECTION Hook
22

3-
This hook provides error handling procedures for task execution failures and validation gate failures.
4-
53
## Task Execution Error Handling
64

75
If task execution fails:
@@ -45,4 +43,4 @@ If validation gates fail:
4543
3. Generate remediation plan
4644
4. Re-execute affected tasks after fixes
4745
5. Re-run validation gates
48-
6. If errors persist, escalate to the user
46+
6. If errors persist, escalate to the user

0 commit comments

Comments
 (0)