TCR
Intent
- Goal: Apply
TCR = Test && Commit || Revertone deliberately small change at a time. - Limits: Direct only, after explicit
Delivery: tcr; never SDD, never silently replaced withcommit-per-unitorworking-tree. The primary coordinator owns every inventory, rollback, stage, and commit; workers never use this skill or mutate Git. Never skip hooks, push, amend,git reset, rebase, squash, rewrite history, or use broadgit checkout/git restore,git clean, globs, repository-wide deletion, or rollback by directory. - Fails if: a commit includes a path outside the microstep or inside
.ai/; unrelated tracked, staged, unstaged, or untracked state changes; a red step is committed; or rollback touches anything not provably created by the step.
Context
- Reads: Git state, the baseline check set (plan
Done meansor full-scope check), exact commit message if supplied. - Never reads:
.ai/as target scope. - Persona: Exact, attributable microstep deliverer.
- Scope: Frontmatter triggers.
Expectations
- Scenarios:
- WHEN a focused check is green THEN commit only the step's exact paths on the recorded parent.
- WHEN this microstep turns a focused check red THEN roll back only that microstep exactly.
- WHEN the failure is flaky, environmental, or ambiguous, the rollback set is unprovable, or a hook fails THEN delete or restore nothing; inspect
HEAD, index, and working tree and stop.
- Done means: every green microstep is its own verified commit, and after the last one the complete baseline set is rerun green (a focused check does not replace it).
- Quality needs: Post-commit corrections are new microsteps and commits. Messages are the user's exact text or one outcome-oriented Conventional Commit message.
Method
Preflight
- Require a Git repository, a valid
HEAD, and an attached branch. - Resolve an exact target scope excluding
.ai/; any dirty target path blocks TCR. - Inventory tracked, staged, unstaged, and untracked paths.
- Run the complete baseline check set; it must be green or TCR does not start.
- Record the full
HEADas the expected parent for the first microstep.
One microstep
Declare one small intent; record the full HEAD, tracked paths it may modify, delete, or rename, each proposed new path and whether it exists, scoped Git state, and the focused check. Apply only that intent and run the check.
Green: commit
- Require
HEADto equal the recorded pre-step SHA. - Derive the exact changed paths; all must belong to the microstep and exclude
.ai/. - Stage only those paths with
git add -- <paths>; never a broad add. - Require no unstaged diff in them; inspect the staged set and diff, then run
git diff --cached --check -- <paths>. - Commit with hooks enabled and an explicit pathspec.
- Verify the commit parent, exact path set,
.ai/exclusion, and clean microstep paths before the next step.
Red: exact rollback
First confirm this microstep caused the failure. Then:
- Restore only tracked paths changed by the step from its recorded pre-step
HEAD. - Remove only untracked paths absent from the pre-step inventory and demonstrably created by this step, each named explicitly; remove a new directory only once empty.
- Require the target scope to match the pre-step inventory exactly.