Skip to content
Back to skills

Agent Hooks

ASecurity

Checklists every agent runs at session start and session end, plus the Team Lead's pre- and post-delegation checks. Use when starting, resuming or wrapping up a session.

  • 80 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added May 28, 2026
ai-agentsgit

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned October 5, 2026

npx -y skills add monkilabs/opencastle --skill agent-hooks --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Agent Hooks?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Agent Hooks
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/monkilabs-agent-hooks/badge)](https://www.skillsdirectory.com/skills/monkilabs-agent-hooks)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: agent-hooks
description: "Checklists every agent runs at session start and session end, plus the Team Lead's pre- and post-delegation checks. Use when starting, resuming or wrapping up a session."
---

# Agent Lifecycle Hooks

Conventions (not auto-triggers) agents execute at specific lifecycle points. Team Lead includes hook reminders in delegation prompts; specialists follow them in their own workflow.

```
on-session-start → [work loop] → on-session-end
                        ↓   ↑
               on-pre-delegate → on-post-delegate
```

The tracker is the project's own: its skill (Linear, Jira, Trello) or `gh issue` for GitHub Issues.

---


## on-session-start

| # | Action |
|---|--------|
| 1 | Read `.opencastle/LESSONS-LEARNED.md`, then `rg -n "keyword" .opencastle/lessons/` |
| 2 | `cat .opencastle/SESSION-CHECKPOINT.md` (resume if exists) |
| 3 | `rg -n "ERROR\|FAIL" .opencastle/AGENT-FAILURES.md \|\| true` |
| 4 | `cat .opencastle/agents/skill-matrix.json \| jq '.bindings'` — load domain skills |

See [HOOKS-REFERENCE.md](HOOKS-REFERENCE.md) for extended startup checks (approval polling, skill-matrix verification).

---

## on-session-end

> **HARD GATE** — every session gets a record in `.opencastle/logs/events.ndjson`,
> written before you yield, one per task, never batched retrospectively. Load
> **observability-logging** for the Pre-Response Quality Gate.

| # | Action |
|---|--------|
| 1 | `opencastle doctor` |
| 2 | `opencastle log --type session ...` |
| 3 | Write `.opencastle/SESSION-CHECKPOINT.md` if work is incomplete |
| 4 | More than 50 lessons in `.opencastle/lessons/` → flag a **memory-merger** pass |

---

## on-pre-delegate — Team Lead only

| # | Check |
|---|-------|
| 1 | Tracker issue exists for the task |
| 2 | File partition clean (`comm -12 <(sort agent1-files) <(sort agent2-files)` = empty) |
| 3 | Upstream issues are Done in the tracker |
| 4 | Prompt has exact file paths + acceptance criteria |
| 5 | Prompt includes "Read LESSONS-LEARNED.md first" |
| 6 | 5+ files → load **context-map** skill |

All 6 must pass before the sub-agent is dispatched. See [HOOKS-REFERENCE.md](HOOKS-REFERENCE.md) for example commands per check.

## on-post-delegate — Team Lead only

| # | Action |
|---|--------|
| 1 | **⛔** `opencastle log --type delegation …` (the record in **observability-logging**) |
| 2 | Run **fast-review** skill |
| 3 | Lint, typecheck, and test (commands via the **codebase-tool** slot) |
| 4 | Verify each acceptance criterion on the tracker issue is met |
| 5 | If agent retried → verify lesson added via **self-improvement** |
| 6 | Move the issue to Done in the tracker, or follow **fast-review**'s Handle Verdict table |

See [HOOKS-REFERENCE.md](HOOKS-REFERENCE.md) for detailed verification commands.

---

## Anti-Patterns

- Batch-logging retrospectively — loses per-task provenance.
- Running only part of on-post-delegate — build passes while ACs fail.

Files in this skill

  • HOOKS-REFERENCE.md2.3 KB
  • SKILL.md3.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…