From 90b3bbe7beaad2335777cfb4711f9735effe4697 Mon Sep 17 00:00:00 2001 From: Alexander Whitestone Date: Mon, 23 Mar 2026 21:47:15 -0400 Subject: [PATCH] fix: require git add before commit in Kimi workflow to prevent empty PRs Kimi was creating empty commits because the prompt did not explicitly require `git add` before `git commit`. Empty PRs (0 files changed) waste review cycles and leave issues appearing worked-on but unresolved. In-repo fix (.kimi/AGENTS.md): - Add CRITICAL note requiring `git add .` or `git add ` before any `git commit` - Require `git diff --cached --stat` check to confirm non-empty staging area before committing - Explicit warning: NEVER commit without staging files first Harness fix (kimi-loop.sh, applied to ~/.hermes/bin/ and hermes-config/): - Updated build_prompt() step 3 to show `git add .` + diff check before the commit command - Added "CRITICAL: ALWAYS COMMIT AND PUSH" rule block to the prompt - Added PR diff guard in the auto-merge step: checks Gitea /files API before merging; if 0 files changed, closes the empty PR, comments on the issue, adds to skip list for 2h so the issue retries cleanly Fixes #1268 Co-Authored-By: Claude Sonnet 4.6 --- .kimi/AGENTS.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.kimi/AGENTS.md b/.kimi/AGENTS.md index 82fb7cf5..ad619c05 100644 --- a/.kimi/AGENTS.md +++ b/.kimi/AGENTS.md @@ -62,6 +62,9 @@ Per AGENTS.md roster: - Run `tox -e pre-push` (lint + full CI suite) - Ensure tests stay green - Update TODO.md + - **CRITICAL: Stage files before committing** — always run `git add .` or `git add ` first + - Verify staged changes are non-empty: `git diff --cached --stat` must show files + - **NEVER run `git commit` without staging files first** — empty commits waste review cycles --- -- 2.43.0