I want to merge @heartbeat/ to @cron/ as heartbeat is one of cron job
- User
I want to merge @heartbeat/ to @cron/ as heartbeat is one of cron job
Assistant· claude-opus-4-6
Let me read both packages to understand the current code.
Assistant· claude-opus-4-6
Let me read all the files in both packages first.
Assistant· claude-opus-4-6
Now let me find all imports/references to the heartbeat package across the codebase.
Assistant· claude-opus-4-6
Let me also check how the heartbeat service is created in
commands.go.Assistant· claude-opus-4-6
Now I have a complete picture, V. Here's my plan:
Plan: Merge
heartbeat/intocron/The heartbeat is essentially a periodic task that's already scheduled via
cron.ScheduleEvery. The merge would:New/Modified Files
-
cron/heartbeat.go— Move all heartbeat logic (Poll, decide, execute, prompts, parseDecision) fromheartbeat/service.gointo the cron package. TheHeartbeatConfig,ChatFunc, andDecisiontypes move here. Instead of a standaloneheartbeat.Service, it becomes part of the cronServicewith methods likeSetHeartbeat()andStartHeartbeat().
-
- User
yes, go ahead
Assistant· claude-opus-4-6
Let me start by creating the new heartbeat file in cron, then updating the command files, and finally removing the old package.
Assistant· claude-opus-4-6
Now add the heartbeat fields to the cron Service struct.
Assistant· claude-opus-4-6
Now add the
channelimport tocron/service.go.Assistant· claude-opus-4-6
Now create the heartbeat test file in cron.
Assistant· claude-opus-4-6
Now update
cmd/anna/commands.goto remove the heartbeat import and use the cron service directly.Assistant· claude-opus-4-6
Now replace the heartbeat service creation with
cronSvc.SetHeartbeat(...).Assistant· claude-opus-4-6
Now update the return value to remove the heartbeat field.
Assistant· claude-opus-4-6
Now update
cmd/anna/gateway.goto remove the heartbeat import and simplify the scheduling.Assistant· claude-opus-4-6
Now replace the heartbeat scheduling block in
runGateway.Assistant· claude-opus-4-6
Now remove the
scheduleHeartbeatfunction at the bottom of gateway.go.Assistant· claude-opus-4-6
Now remove the old heartbeat package.
Assistant· claude-opus-4-6
Now let me check if the
runnerimport is still needed incommands.goafter the change.Assistant· claude-opus-4-6
Good,
runneris still used. Now let's run format and lint.Assistant· claude-opus-4-6
No lint issues. Let's run the tests.
Assistant· claude-opus-4-6
The only failure is
TestIntegrationPoolWithGoRunnerwhich is a pre-existing integration test failure (requires API key), not related to our changes. Let me confirm by running just the cron tests.Assistant· claude-opus-4-6
All 22 tests pass (17 existing cron + 5 heartbeat). Let me also verify no stale references remain to the old heartbeat package.
Assistant· claude-opus-4-6
Clean. Here's a summary of what was done, V:
Summary
Merged
heartbeat/intocron/New files
-
cron/heartbeat.go— All heartbeat logic (poll, decide, execute, prompts, parsing) now lives here. The cronServicegained three new fields (heartbeatCfg,heartbeatChat,heartbeatNotifier) and two new methods:SetHeartbeat(cfg, chat, notifier)— configures heartbeat on the serviceStartHeartbeat(ctx, every)— schedules the poll viaScheduleEvery
-
cron/heartbeat_test.go— All 5 heartbeat tests ported, usingStartEphemeralto avoid loading persisted jobs.
Modified files
cron/service.go— Added heartbeat fields toServicestruct +channelimportcmd/anna/commands.go— Removed import and field from ; now calls directly
-
- User
commit this and create a PR
Assistant· claude-opus-4-6
Done, V. PR created: https://github.com/vaayne/anna/pull/49
- User
update the docs to reflect the heartbeat merge
Assistant· claude-opus-4-6
Let me check which docs reference heartbeat.
Assistant· claude-opus-4-6
Now let me check the architecture doc and cron-system doc for heartbeat references.
Assistant· claude-opus-4-6
Now let me also check the builtin anna skill for heartbeat references.
Assistant· claude-opus-4-6
Good, no heartbeat references in the builtin skill. Now I'll update the docs. The changes needed:
- README.md — Update package layout to show
heartbeat.goinsidecron/ - docs/architecture.md — Add
heartbeat.goto the cron section in the package layout - docs/cron-system.md — Add heartbeat section, update file table, update testing section
- CHANGELOG.md — Add entry under
[Unreleased]
- README.md — Update package layout to show
Assistant· claude-opus-4-6
Now commit and push.
Assistant· claude-opus-4-6
Done, V. Docs commit pushed to the PR. Here's what was updated:
- README.md — Package layout now shows
cron/includes heartbeat polling - docs/architecture.md — Added
heartbeat.goto the cron file listing - docs/cron-system.md — Added Heartbeat section (how it works, config), updated file table (4→5 files), updated wiring steps, added heartbeat test cases to testing section
- CHANGELOG.md — Added refactoring entry under
[Unreleased]
- README.md — Package layout now shows