feat(heartbeat): skip API calls when HEARTBEAT.md is effectively empty #1535
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Skip heartbeat API calls when HEARTBEAT.md exists but contains no actionable content. Saves API costs when users keep an empty/template HEARTBEAT.md.
Closes #1534
Changes
Core logic
src/auto-reply/heartbeat.ts- NewisHeartbeatContentEffectivelyEmpty()function that detects files with only:#,##, etc.) - note: requires space after#per ATX specfalsefor missing files (LLM decides) or actual contentIntegration
src/infra/heartbeat-runner.ts- Check HEARTBEAT.md content before API call; emitskipped/empty-heartbeat-fileevent when skippingTests
src/auto-reply/heartbeat.test.ts- 11 new unit tests forisHeartbeatContentEffectivelyEmpty()src/infra/heartbeat-runner.returns-default-unset.test.ts- Integration tests verifying skip behaviorTemplate
docs/reference/templates/HEARTBEAT.md- Updated to be effectively empty by default (header only)Behavior Matrix
false# HEARTBEAT.mdtrue# Header\n## Sectiontrue- Check emailfalse#TODO fix(no space)falseTesting
Real-world validation done on live Clawdbot instance.
AI Contribution Disclosure