commit.trunk-gates

commit.trunk-gates is a cursor rule for Claude Code, Cursor from YuDefine/nuxt-supabase-starter. It costs 0 tokens per session (2,987 once invoked), scanned A, original, MIT.

A set of safeguards for commits on the main branch and for Git operations in shared working directories. A shared working directory is one used by multiple concurrent sessions.

In plain words
What is it for?
It guides path-limited staging, stashing, publishing, and special checks for changes under openspec/changes/.
Why use it?
It prevents one session from accidentally including another session's staged or untracked work in a commit or deployment.

Cursor rule for Claude CodeCursor

Written for Claude Code and Cursor: $ARGUMENTS substitution, but also installed under .cursor/. Also seen: mentions Codex.

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.

agentmods
npx agentmods add rules/yudefine/nuxt-supabase-starter/commit.trunk-gates
Clone the repo
git clone --depth 1 https://github.com/YuDefine/nuxt-supabase-starter

Made for: Claude Code, 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 commit.trunk-gates

README.md
[![agentmods](https://agentmods.dev/badge/rules/yudefine/nuxt-supabase-starter/commit.trunk-gates.svg)](https://agentmods.dev/rules/yudefine/nuxt-supabase-starter/commit.trunk-gates)
Your own site
<a href="https://agentmods.dev/rules/yudefine/nuxt-supabase-starter/commit.trunk-gates"><img src="https://agentmods.dev/badge/rules/yudefine/nuxt-supabase-starter/commit.trunk-gates.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,987 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00000 $0.02987
Opus 5 $0.00000 $0.01494
Sonnet 5 $0.00000 $0.00597
Haiku 4.5 $0.00000 $0.00299

Measured 2d ago against content hash 49e3fc3f914d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

commit.trunk-gates 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 2d 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.

template/.cursor/rules/commit.trunk-gates.mdc · 102 lines

How it starts

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

Commit — Trunk Gates([[commit]] detail)

本檔是 [[commit]] 的 path-scoped 延伸:兩條 main / master 限定 hard gate + multi-session git hazard 交叉索引。核心紀律(git commit --only -- <paths>、§ 禁止事項、Commit 預設位置)留在 [[commit]] 本體 always-load,因為那些由「跑 commit 這個動作」觸發、不必然伴隨檔案存取;本檔兩條 gate 的觸發條件本身就是 openspec/changes/**,故可 path-scoped。

Multi-session shared working-tree 的 git hazard 地圖

多 session 並行是常態,「全 working tree scope」的 git 操作會 silently 吃進別 session 的 staged WIP / untracked 新檔 / stash 內容 → mixed commit、WIP 永久遺失、deploy commit 內容跟 message 不符。

交叉索引

危害點 既有規約 Pitfall
Ad-hoc git add + git commit 吃別 session staged WIP [[commit]] § Ad-hoc commit 必走 git commit --only -- <paths> [[pitfall-consumer-ad-hoc-commit-eats-other-session-staged]]
git stash push 不帶 pathspec → scope leak [[worktree-default]] §1(Stash strategy 隱性風險 / Anti-pattern 手動 selective baseline sync) [[pitfall-git-stash-pathspec-scope-leak]]
publish.ts auto-stash 把 tracked file 捲進 deploy commit [[worktree-default]] §1 + [[clade-publish]] § Step 3(分組 commit,禁 --stash-untracked 對 tracked dirty) [[pitfall-publish-auto-stash-bundles-tracked-into-deploy-commit]]
publish.ts flow 清掉別 session 的 parallel untracked file [[worktree-default]] §1(Pre-fork baseline guard) [[pitfall-publish-flow-cleans-parallel-untracked]]
Merge-back auto-stash 整批捲走別 session WIP [[worktree-default]] §5.5(Merge-back ceremony / Stash reconcile) [[pitfall-merge-back-autostash-bulk-captures-other-session-wip]]

已撞 mixed commit → [[commit]] § Recovery from mixed commit (multi-session safety);cross-session staged 偵測層 → commit SKILL Step 0-Coord

Partial Archive Gate(main / master 限定,hard rule

當前 branch 為 main / master,且某個 change <X>排除 openspec/changes/archive/)命中下列任一觸發路徑時,MUST 對該 change 同時驗證:

  • A(staged-delete) — 本次 /commit 含任一 openspec/changes/<X>/** staged-delete
  • B(working tree 殘留)openspec/changes/<X>/ 仍存在但缺 tasks.mdproposal.md即使本次 commit 完全沒有 staged-delete

Read the full file on GitHub · 102 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. 2d ago First seen · 102 lines · 0 tokens per session scan A 49e3fc3f914d

Subscribe to this mod's changes

commit.trunk-gates is a cursor rule published in the GitHub repository YuDefine/nuxt-supabase-starter (45 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,987 tokens. 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-09-03.