[claude] Fix empty commits: require git add before commit in Kimi workflow (#1268) #1288

Merged
claude merged 1 commits from claude/issue-1268 into main 2026-03-24 01:48:35 +00:00
Collaborator

Fixes #1268

Problem

Kimi was creating empty commits (0 files changed) because the harness prompt and workspace guide did not explicitly require git add before git commit. The auto-merge step also had no guard against empty PRs, allowing them to slip through.

Changes

.kimi/AGENTS.md (in-repo)

  • Added CRITICAL rule: always run git add . or git add <files> before any git commit
  • Added requirement to verify git diff --cached --stat is non-empty before committing
  • Explicit warning that empty commits waste review cycles

kimi-loop.sh (harness, applied to ~/.hermes/bin/ and hermes-config/)

  • Updated build_prompt() step 3 to show git add . + git diff --cached --stat check before the commit command
  • Added "CRITICAL: ALWAYS COMMIT AND PUSH" rule block to the prompt
  • Added PR diff guard in auto-merge step: calls Gitea /files API before merging; if 0 files changed, closes the empty PR, posts an explanatory comment on the issue, and adds issue to skip list for 2h so it retries cleanly

Defense in depth

Three layers now prevent empty PRs:

  1. Prompt instructions tell Kimi to stage + verify before committing
  2. Workspace guide (.kimi/AGENTS.md) documents the requirement
  3. Loop auto-merge guard rejects PRs with 0 changed files at the harness level
Fixes #1268 ## Problem Kimi was creating empty commits (0 files changed) because the harness prompt and workspace guide did not explicitly require `git add` before `git commit`. The auto-merge step also had no guard against empty PRs, allowing them to slip through. ## Changes ### `.kimi/AGENTS.md` (in-repo) - Added **CRITICAL** rule: always run `git add .` or `git add <files>` before any `git commit` - Added requirement to verify `git diff --cached --stat` is non-empty before committing - Explicit warning that empty commits waste review cycles ### `kimi-loop.sh` (harness, applied to `~/.hermes/bin/` and `hermes-config/`) - Updated `build_prompt()` step 3 to show `git add .` + `git diff --cached --stat` check before the commit command - Added "CRITICAL: ALWAYS COMMIT AND PUSH" rule block to the prompt - Added PR diff guard in auto-merge step: calls Gitea `/files` API before merging; if 0 files changed, closes the empty PR, posts an explanatory comment on the issue, and adds issue to skip list for 2h so it retries cleanly ## Defense in depth Three layers now prevent empty PRs: 1. Prompt instructions tell Kimi to stage + verify before committing 2. Workspace guide (`.kimi/AGENTS.md`) documents the requirement 3. Loop auto-merge guard rejects PRs with 0 changed files at the harness level
claude added 1 commit 2026-03-24 01:47:47 +00:00
fix: require git add before commit in Kimi workflow to prevent empty PRs
Some checks failed
Tests / lint (pull_request) Failing after 34s
Tests / test (pull_request) Has been skipped
90b3bbe7be
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 <files>` 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 <noreply@anthropic.com>
claude merged commit cc8ed5b57d into main 2026-03-24 01:48:35 +00:00
claude deleted branch claude/issue-1268 2026-03-24 01:48:35 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1288