You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Forbid discard operations unless explicitly requested
- Remove guidance that implies user edits can be discarded by default
- Add warnings to git references and self-review command
Copy file name to clipboardExpand all lines: commands/self-review.md
+13-10Lines changed: 13 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,20 +4,23 @@ description: Comprehensive local code review comparing current branch to main -
4
4
5
5
# SELF CODE REVIEW MODE ACTIVATED
6
6
7
-
You are now in **SELF REVIEW** phase - performing a comprehensive local code review comparing the current branch to `main`, following the structured review approach from `100-core.mdc` and `050-workflow.mdc`.
7
+
You are now in **SELF REVIEW** phase - performing a comprehensive local code review comparing the current branch to `main`, following the structured review approach from `100-core.mdc` and `010-workflow.mdc`.
8
8
9
9
> [!IMPORTANT]
10
-
> This is a **read-only analysis**. No commits or pushes will be made without explicit user authorization (see `060-agent-audit.mdc`).
10
+
> This is a **read-only analysis**. No commits or pushes will be made without explicit user authorization (see `020-agent-audit.mdc`).
- Record baseline: `HEAD` SHA, branch name, timestamp
17
17
- Document all commands with exit codes in audit report
18
18
19
19
> [!NOTE]
20
-
> **Checkpoints:** Only create checkpoints (`git stash`, rollback branch) if Phase 5 (Automated Fixes) will be applied. For read-only analysis, baseline recording is sufficient since formatting changes are easily reversible with `git restore` or `git checkout`.
20
+
> **Checkpoints:** Only create checkpoints (`git stash`, rollback branch) if Phase 5 (Automated Fixes) will be applied.
21
+
> For read-only analysis, baseline recording is sufficient.
22
+
>
23
+
> Do not discard user working-tree edits with `git restore` / `git checkout --` unless the user explicitly asks (see `020-agent-audit.mdc`).
21
24
22
25
1.**Branch Information:**
23
26
- Current branch name (`git branch --show-current`)
@@ -130,7 +133,7 @@ Generate a structured review report:
130
133
## Phase 5: Automated Fixes (Optional)
131
134
132
135
> [!IMPORTANT]
133
-
> **Before applying fixes:** Create checkpoints per `060-agent-audit.mdc`:
136
+
> **Before applying fixes:** Create checkpoints per `020-agent-audit.mdc`:
> Formatting changes are easily reversible with `git restore <file>` or `git checkout -- <file>`, but checkpoints provide additional safety for complex changes.
155
+
> If the user wants to revert formatting changes, propose the exact revert commands (for example `git restore <file>`), but do not run them unless the user explicitly asks. Checkpoints provide additional safety for complex changes.
153
156
154
157
## Phase 6: Verification & Audit Report
155
158
@@ -158,7 +161,7 @@ Generate a structured review report:
158
161
3.**Diff summary:** Show final `git diff main...HEAD --stat`
159
162
4.**Ready for PR:** Confirm all Critical issues resolved
- Ensure `GIT_REPO_ROOT` is set, then write/append the report to `<GIT_REPO_ROOT>/extras/agent_reports/$(date +%F)-agent-report-<repo>-<branch>.md` (if `<GIT_REPO_ROOT>/extras/` exists and is gitignored) or `/tmp/$(date +%F)-agent-report-<repo>-<branch>.md`
164
167
- Include:
@@ -179,7 +182,7 @@ Generate a structured review report:
179
182
- Refactor code not part of current changes
180
183
- Add features not in the current scope
181
184
- Change APIs or break existing functionality
182
-
-**Commit or push** without explicit user authorization (see `060-agent-audit.mdc`)
185
+
-**Commit or push** without explicit user authorization (see `020-agent-audit.mdc`)
183
186
- Perform any remote writes (git push, PR creation, etc.)
184
187
185
188
✅ **DO:**
@@ -230,7 +233,7 @@ If CodeRabbit is available and configured for the repository:
Copy file name to clipboardExpand all lines: rules/130-git.mdc
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -592,6 +592,10 @@ Git 2.23+ split the multi-purpose `checkout` into focused commands for clarity a
592
592
| `git checkout -- file` | `git restore file` | Restore file from index |
593
593
| `git checkout HEAD -- file` | `git restore -s HEAD file` | Restore file from commit |
594
594
595
+
> [!IMPORTANT]
596
+
> `git restore`, `git checkout -- <path>`, `git reset --hard`, and `git clean -fd` can discard local changes.
597
+
> AI agents MUST NOT run discard operations unless the user explicitly requests it.
598
+
595
599
**Why prefer `switch`?**
596
600
597
601
`checkout` is a multi-purpose tool that does many different things: switch branches, create branches, restore files, detach HEAD. When you see `git checkout somename`, you cannot immediately tell if it is switching to a branch, restoring a file, or going to a specific commit.
Copy file name to clipboardExpand all lines: skills/core-engineering/references/git-reflog.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# The Reflog: Git's Safety Net
2
2
3
+
> [!IMPORTANT]
4
+
> `git reset --hard` and similar commands can discard local changes.
5
+
> If you are operating as an AI agent, do not run discard operations unless the user explicitly requests it.
6
+
3
7
## What is the Reflog?
4
8
5
9
The **reflog** (reference log) is Git's time machine. While `git log` shows only commits reachable from branches/tags, the reflog records **every movement of HEAD** — every checkout, reset, commit, rebase, branch switch, and even "lost" commits.
0 commit comments