reset-demo-state
Skill3 starsChanged 7 days agoApache-2.0View on GitHub
Run the scripted Ledgerly demo reset first, then complete only the manual cleanup it reports.
- Reads credentials
- Deletes or force-pushes
- Commits and pushes
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- ledgerly/AGENTS.mdAGENTS.md
- ledgerly/.cursor/rules/disposable-demo-prs.mdcCursor rule
- ledgerly/.cursor/rules/ledgerly.mdcCursor rule
- ledgerly/.cursor/rules/multitask-no-wrapper.mdcCursor rule
- add-dashboard-widgetSkill
- choose-cursor-workflowSkill
- dispatch-subagentsSkill
- draft-collection-emailSkill
- hand-to-cloud-agentSkill
- present-runbooksSkill
- stage-linearSkill
- start-ledgerlySkill
- write-prisma-querySkill
- standard-bug-fixSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Run the script first. It is the source of truth for every step that can be scripted.
- Very specific: line 33
Read remaining for MCP cleanup and summary.cloudAgents plus manual for everything else.
- Very specific: line 36
Cursor user rule: use cursor_dialog only for a recorded rule ID with no filesystem path.
- Distinctive: line 44
If the event file is missing or a beat predates this script, use the old discovery flow cautiously: list candidates, do not guess a team, …
- Distinctive: line 48
Start each demo session and record artifacts as they are created:
- Very specific: line 65
Never edit tests/suggested-credit-api.test.ts, either suggested-credit API route, or the seed to make the shipped red test green.
- Distinctive: line 66
Never delete a path outside the script's allowlist.
- Distinctive: line 67
Never delete main, master, or a branch that is not a demo branch.
- Very specific: line 68
Never git push origin --delete a branch outside cursor/* and demo/*.
- Distinctive: line 69
Never cancel Linear issues on a team the operator did not confirm, and never delete the team.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Reset the demo state
Run the script first. It is the source of truth for every step that can be scripted.
npm run demo:reset
npm run demo:reset -- --dry-run--dry-run lists the branches, worktrees, remotes, and files it would remove, then prints the summary without changing anything. The script is scripts/demo-reset.ts (npm run demo:reset). It is idempotent.
What the script does
- Restores tracked files with
git reset --hard HEADand switches tomain(git checkout mainequivalent). It restoresapp/invoices/page.tsxandapp/disputes/page.tsxalong with every other tracked change. - Removes recorded demo rules, skills, and Canvas files, plus the known paths
.cursor/rules/suggested-credit-api-v2.mdc,.cursor/skills/create-api, and.cursor/agents/accessibility-manual-reviewer.md. It does not rungit clean. Untracked files outside that allowlist stay. - Deletes local demo branches with
git branch -D. A demo branch is a branch recorded in the session file, or any local branch namedcursor/*ordemo/*. It never deletesmainormaster, and it never deletes any other non-demo branch. - Deletes a remote with
git push origin --deleteonly when the session recorded that branch with--remoteand the name matchescursor/*ordemo/*. - Removes linked worktrees whose branch is a demo branch, then runs
git worktree prune. Removal unlocks a locked worktree and runsgit worktree remove --force, so uncommitted changes and untracked files in that directory are discarded. A lock does not keep the directory. Unpushed commits can remain in the primary reflog until it expires. Worktrees on non-demo branches stay. - Reseeds SQLite and restarts port 43173.
- Confirms 1 failed / 33 passed. It leaves the suggested-credit client on v1 and filter pills writing
state=.
The script exits with an error before it changes anything when the current branch is not main and not a demo branch, when the checkout is detached, when it is run from a linked worktree, or when a branch name is main or otherwise unsafe. --keep-branch stays on the current branch and skips git reset --hard for an isolated check.
It prints one JSON report. The summary object is the resulting state: branch, head, worktrees, local branches, untouched non-demo branches, the planted client version, the suite line, cloud agent notes, and manual leftovers.
What stays manual
Read remaining for MCP cleanup and summary.cloudAgents plus manual for everything else. Do only these:
- Figma: for each recorded Slides
fileKey, loadfigma-useandfigma-use-slides, then remove every slide withslide.remove(). - Cursor user rule: use
cursor_dialogonly for a recorded rule ID with no filesystem path. Do not remove unrelated user rules. - 301 Reviewer automation: this optional automation is not in the report. Remove it by hand in the Automations tab.
- Linear: offer teardown whenever the Linear MCP is connected, but act only when the report lists a recorded
ce-field-demosboard. Confirm the exact team before any write: present its name, key, privacy, andhttps://linear.app/<workspace>/settings/teams/<KEY>. Public and private teams are both valid. Public and private projects are both valid — do not skip teardown because the project is public. Never assume or guess a team. Cancel each recorded issue withsave_issue(state:Canceled) and then the project withsave_project(state:Canceled). The catalog isFIELD_DEMO_ISSUESplusCOLLECTIONS_COMMAND_CENTER_ISSUESplusWCAG_KEYBOARD_WALKTHROUGHplusWCAG_CONTRAST_TEST; the recorded board is those fourteen identifiers with contrast last. Cancel the filter issue and the contrast issue with the other recorded issues. Reset still only cancels what was recorded. Do not delete the team, and do not treat the walkthrough or contrast issue as a reason to skip teardown. Leave the issue linked, leave the team-scopedCollections Command Centerlabel in place, and retain the team. The nextstage-linearreopens the project and reopens recorded issues toTodowith the original catalog bodies fromrunbooks/linear-field-demos.ts, and creates a title only when it is missing or a canceled issue will not leaveCanceled. The script uses the Linear API only with bothLINEAR_API_KEYand explicit--confirm-linear. - Cloud agent runs: this script cannot stop a Cloud Agent. Stop the run in Cursor. Unrecorded
origin/cursor/*andorigin/demo/*branches are listed in the summary and left in place, because they may belong to a live cloud agent or to another checkout. - Recorded remotes outside
cursor/*anddemo/*: listed undermanualand not deleted. Remove that remote by hand only when you know it is a rehearsal branch. - Non-demo branches, and worktrees checked out on them: left in place.
- Unrecorded personal skills, user rules, and Canvas files: left in place. Record them before the next reset if they should be removed.
If the event file is missing or a beat predates this script, use the old discovery flow cautiously: list candidates, do not guess a team, and never cancel issues outside the recorded board.
Session events
Start each demo session and record artifacts as they are created:
npm run demo:session -- start
npm run demo:session -- record skill "$HOME/.cursor/skills/<created-skill>"
npm run demo:session -- record project-path .cursor/agents/accessibility-manual-reviewer.md
npm run demo:session -- record branch <linear-gitBranchName> --remoteThe ignored .cursor/demo-session-events.json stores recorded paths, branches, Figma file keys, and Linear identifiers. Use npm run demo:session -- status to inspect it. One reset clears everything it knows about. There is no per-track reset. Without the file the command still resets tracked files, known demo paths, local cursor/* and demo/* branches, and demo worktrees. Unrecorded personal rules, skills, and Canvas files need manual cleanup. When a demo beat creates a new leftover, update scripts/demo-reset.ts and its event record in the same change.
Demo-beat git branches
The script switches to main (git checkout main equivalent), then uses git branch -D and, for recorded remotes that match cursor/* or demo/*, git push origin --delete. It removes linked demo worktrees with git worktree remove --force (a dirty or locked tree is wiped) and runs git worktree prune. It restores app/invoices/page.tsx and app/disputes/page.tsx along with every other tracked change. Do not repeat those commands after the script succeeds.
Never
- Never edit
tests/suggested-credit-api.test.ts, either suggested-credit API route, or the seed to make the shipped red test green. - Never delete a path outside the script's allowlist.
- Never delete
main,master, or a branch that is not a demo branch. - Never
git push origin --deletea branch outsidecursor/*anddemo/*. - Never cancel Linear issues on a team the operator did not confirm, and never delete the team.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

