hook-controller

hook-controller is a cursor rule for Cursor from kubev2v/forklift-console-plugin. It costs 15 tokens per session (2,140 once invoked), scanned A, original, Apache-2.0.

A set of project rules describing how a Kubernetes-style Hook resource is checked and then run during migration phases. It covers local container hooks and hooks submitted to Ansible Automation Platform.

In plain words
What is it for?
Use it when implementing or reviewing Hook validation, readiness conditions, container images, encoded playbooks, or Ansible Automation Platform job execution.
Why use it?
It makes hook validation and execution behavior explicit, including which settings are required or incompatible.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when implementing or reviewing Hook validation, readiness conditions, container images, encoded playbooks, or Ansible Automation Platform job execution.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/kubev2v/forklift-console-plugin/hook-controller
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/kubev2v/forklift-console-plugin

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for hook-controller

README.md
[![agentmods](https://agentmods.dev/badge/rules/kubev2v/forklift-console-plugin/hook-controller/github.svg)](https://agentmods.dev/rules/kubev2v/forklift-console-plugin/hook-controller)
Your own site
<a href="https://agentmods.dev/rules/kubev2v/forklift-console-plugin/hook-controller"><img src="https://agentmods.dev/badge/rules/kubev2v/forklift-console-plugin/hook-controller/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for hook-controller

Your own site · 80×15
<a href="https://agentmods.dev/rules/kubev2v/forklift-console-plugin/hook-controller"><img src="https://agentmods.dev/badge/rules/kubev2v/forklift-console-plugin/hook-controller.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,140 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00015 $0.02140
Opus 5.5 $0.00006 $0.00856
Sonnet 5.5 $0.00003 $0.00428
Haiku 4.5 $0.00002 $0.00214

Measured 29d ago against content hash be6b60b3e2e0, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

hook-controller scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 29d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/backend/infrastructure/hook-controller.mdc · 222 lines

How it starts

The opening of the file, as written. The whole thing — 222 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Hook Controller

Analyzed from commit: baf9c7bcc307ed9358ad59886a5536366a050012 on 2026-09-17 Source paths: pkg/controller/hook/, pkg/controller/plan/hook.go, pkg/apis/forklift/v1beta1/hook_exec.go

Package Purpose

The Hook lifecycle spans two controllers:

  1. Hook controller (pkg/controller/hook/) — validates the Hook CRD and sets Ready.
  2. Plan controller (pkg/controller/plan/hook.go) — executes hooks via HookRunner during migration phases PreHook and PostHook.

Hooks support two execution modes: local (Kubernetes Job with optional Ansible playbook) and AAP (remote Ansible Automation Platform job template).


Key Types and Structs

HookSpec (pkg/apis/forklift/v1beta1/hook.go)

type HookSpec struct {
    ServiceAccount string       // optional; local hooks only
    Image          string       // required for local hooks
    Playbook       string       // optional base64-encoded Ansible playbook
    Deadline       int64        // pod/job deadline in seconds
    AAP            *AAPConfig   // remote AAP execution (mutually exclusive with image/playbook)
}

type AAPConfig struct {
    JobTemplateID int                    // required > 0
    URL           string                 // optional per-hook AAP URL
    TokenSecret   *core.ObjectReference  // optional per-hook token Secret (key "token")
    Timeout       int64                  // optional poll timeout in seconds
}

HookRunner (pkg/controller/plan/hook.go)

type HookRunner struct {
    *plancontext.Context
    vm   *planapi.VMStatus
    hook *api.Hook
}

Validation helpers (pkg/apis/forklift/v1beta1/hook_exec.go)

  • HookExecutionConfigValid(hook) — local hook needs non-empty image (playbook optional); AAP hook needs jobTemplateId > 0 and no local fields.
  • HookAAPRunnable(hook, clusterURL, clusterTokenSecret) — AAP hook runnable when per-hook or cluster AAP connection is configured.

Interfaces and Implementations

Read the full file on GitHub · 222 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 29d ago Changed · +104 lines be6b60b3e2e0
  2. 1mo ago First seen · 118 lines · 15 tokens per session scan A 180b59d97342

Subscribe to this mod's changes

hook-controller is a cursor rule published in the GitHub repository kubev2v/forklift-console-plugin (11 stars, last pushed today), licensed Apache-2.0. It adds 15 tokens to every session and 2,140 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.