ticket-id-gate
Pre-commit gate refusing a tracker id in staged library prose. Use when composing a role that authors the shipped library (the `ai-hats-dev` trait), or when diagnosing why the ticket-ids hook blocked a commit.
- License 许可
- MIT
- 所属仓库
- muratovv/ai-hats
- 最近更新
- 2026-11-05
- Stars
- ★ 3
- Forks
- 1
01 前言 Front Matter
- name
- ticket-id-gate
- ai_hats
- { "type": "skill", "schema_version": 1 }
- license
- MIT
- description
- Pre-commit gate refusing a tracker id in staged library prose. Use when composing a role that authors the shipped library (the `ai-hats-dev` trait), or when diagnosing why the ticket-ids hook blocked a commit.
02 资源文件 1
03 SKILL.md 正文
Ticket ID Gate
Pure-infrastructure hook-carrier skill. It contributes one git pre-commit hook and carries no agent-side decision logic — the value is delivered entirely through composition.
What it gates
A tracker id in prose the library ships. The library installs into other
people's projects, where PROJ-1430 is a link into a tracker the reader does
not have, and it costs context on every load. git log -S '<phrase>' finds the
commit that introduced a line for anyone holding the repository; a tracker id
travels nowhere.
Scope is staged files only, so the gate never retro-blocks a backlog it did not create.
The prefix is learned, never written down here
This script is itself shipped library content. Hardcoding one project's prefix
in it would reproduce the exact leak it refuses. So it reads the prefix from the
project's own card ids (shortest <prefix>-<digit> run, so MY-PROJ-42 yields
MY-PROJ, matching how rack routes). AI_HATS_TICKET_PREFIX overrides it. No
tracker and no override is a loud no-op: a project with no ids has none to leak.
What it does not judge
| not judged | why |
|---|---|
<PREFIX>-NNN placeholders |
digits are required, so a CLI template teaching the shape is not a match |
hooks/, git_hooks/, code |
a bare id there is often the whole comment — removing it is a rewrite |
| anything unstaged | changed-files scope; the gate fires only on what this commit touches |
| another project's prefix | only the ids this project mints are judged |
When an id belongs
When prose names a string a machine prints, so the reader can recognise what appears on screen. Prefer quoting the message itself — a reader can grep that, and cannot grep a number. When the id really is the identifier, say so on the same line:
a wall of PROJ-1242 tripwire errors <!-- ticket-ids: allow the guard prints it -->
The reason is not decoration: the hook prints it back, and a marker without one
is reported as (no reason given).
Relationship to the ticket-ids CI stage
Same invariant, two ranges. The hook is per-commit and staged-scope, so it
catches an id at the keystroke. scripts/check_no_ticket_ids.py sweeps a wider
corpus than the hook — the library, the docs a reader opens, and the project's
own code — and runs inside merge-gate and push-gate, which is the one
nothing lands on the base branch without. The hook shortens the loop; the stage
is the boundary.
Override
After confirming the id belongs and the marker is wrong for the case, ask the
supervisor for AI_HATS_TICKET_IDS_ACK=1, exported in the shell that runs the
commit. Writing it onto your own command line is refused — see safety-guard.
The bypass is journalled, not merely printed to stderr.
04 同仓库更多 Skills
tool-evaluation-protocol
Time-bounded protocol for evaluating new tools, libraries, or methodologies before adoption. Use when evaluating a candidate dependency for the project, researching a methodology (e.g. ML/LLM frameworks, testing approaches), or following up on a hype-driven recommendation.
systematic-debugging
4-phase bug-fix protocol (evidence, pattern, hypothesis, verify). Use when investigating any error, failure, or unexpected behavior, handling bug reports from users or monitoring, or diagnosing test failures with non-obvious causes.
skill-template
Canonical template and validation guide for ai-hats skills. Use when creating a new skill, reviewing an existing one for structural compliance, or deciding which pattern fits a new behavior.
skill-optimization
Audit and refactor library components to eliminate redundancy and staleness. Use during periodic library maintenance, after adding multiple new skills or rules, when a role's token budget is too high, or after retrospectives identify component issues.
silent-fallback-gate
PreToolUse hook — refuses an Edit or Write that adds an inert broad except. Use when a Python edit was blocked for a silent fallback.
retro-to-framework
Convert an observation about agent behavior — from a retrospective or from a single incident — into a framework-level change (hook, rule, skill, skill update). Use after a retrospective identifies problems that are not project-specific, after an incident where an agent misapplied a component it had read, when CLAUDE.md band-aids accumulate (more than 3 per-project rules that could be generic), or when the same problem recurs across multiple projects.