cursor-team-kit: add worktree + one-shot script cleanup rules - #195
Open
fluiddynamicsLLC wants to merge 2 commits into
Open
cursor-team-kit: add worktree + one-shot script cleanup rules#195fluiddynamicsLLC wants to merge 2 commits into
fluiddynamicsLLC wants to merge 2 commits into
Conversation
A standing rule that pairs with the existing parallel-agent-write-discipline guidance: every agent that adds a git worktree is responsible for removing it when its branch merges (or the work is abandoned), so sibling <repo>-wt-* directories do not accumulate in agent-heavy workflows. Co-authored-by: Cursor <cursoragent@cursor.com>
Companion to the worktree-cleanup rule in the same PR: agent sessions routinely produce single-use helper scripts and temp payload files (_tmp-*.ps1, _tmp-<ticket>-wi.json, PR-body drafts written only for a CLI --body-file, etc.). Left behind they bury every future git status. This rule makes the session that creates them responsible for deleting them once the task ships, with explicit carve-outs for secrets and tracked scripts. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds two closely related "session hygiene" rules to
cursor-team-kit/rules/and lists them in the team-kit README:worktree-cleanup.mdc-- the session that adds agit worktreeis responsible for removing it when the branch merges (or the work is abandoned), so sibling<repo>-wt-*directories do not accumulate.one-shot-script-cleanup.mdc-- the session that writes a_tmp-*helper script or temp payload (JSON fed to a single API call, PR-body drafts written only for--body-file, extract/parse one-liners, etc.) is responsible for deleting it when the underlying task ships.Why
In agent-heavy workflows both classes of artifact pile up fast:
<repo>-wt-*siblings and it becomes hard to tell what work is actually live._tmp-*.ps1,_tmp-<ticket>-wi.json,_tmp-*-pr-body.md, and similar one-shot scaffolding. Every subsequentgit statusgets buried under untracked scratch.Both rules pair with (and cross-reference) the existing parallel-agent write-discipline guidance in this ecosystem instead of duplicating it. They only add the "clean up after yourself" half, which was implicit but not written down.
Guardrails
Both rules explicitly refuse to sweep silently:
main/master/staging/develop)..env*,*.key,*.pem, VAPID / JWT / token blobs) -- report to the user instead.git clean -fda shared workspace without explicit approval, and never touch tool-managed dirs (.git/,node_modules/,venv/,.next/)._tmp-*cruft you leave behind, with a reason, in your final summary.Notes
no-inline-imports.mdc/typescript-exhaustive-switch.mdc(frontmatter withdescriptionandalwaysApply: true, prose body).No functional / code changes; docs-and-rules only.
Note
Low Risk
Documentation and agent guidance only; no application code, data access, or production behavior changes.
Overview
Adds two always-on agent rules to
cursor-team-kitfor session hygiene after parallel agent work, plus README table rows for each.worktree-cleanupmakes the session that created a siblinggit worktreeremove it after merge or abandonment (worktree remove,prune, merged feature branch delete), with guardrails against touching the main checkout, long-lived branches, dirty trees, or another agent’s worktree.one-shot-script-cleanuprequires deleting untracked_tmp-*helpers and single-use payloads when the task ships, with a session-end sweep, explicit exclusions for tracked source and secrets, and a requirement to report any scratch left behind.Neither rule changes runtime code—only documented agent behavior, aligned with existing rule frontmatter (
alwaysApply: true).Reviewed by Cursor Bugbot for commit 8c96aca. Bugbot is set up for automated code reviews on this repo. Configure here.