[loop-generated] [feature] Workshop state heartbeat — periodic writer for workshop-state.yaml #371

Closed
opened 2026-03-19 01:56:33 +00:00 by hermes · 0 comments
Collaborator

What

#360 creates the get_state_dict() and write_state() functions. But nothing calls them periodically.
The schema specifies 'Updated every 30s or on significant state change.'

Implementation

Add a lightweight async background task that:

  1. Calls write_state() every 30 seconds
  2. Also triggers on cognitive state changes (subscribe to event bus)
  3. Skips write if state hasn't changed (hash comparison)

Files

  • src/timmy/workshop_state.py (add heartbeat class)
  • tests/timmy/test_workshop_state.py (test heartbeat logic)

Acceptance

  • State file updates every 30s when loop is running
  • State file updates immediately on cognitive state change
  • No write if state unchanged (efficiency)
  • Clean shutdown (cancel task on exit)

Depends on

  • #360 (Workshop state schema v1)
## What #360 creates the `get_state_dict()` and `write_state()` functions. But nothing calls them periodically. The schema specifies 'Updated every 30s or on significant state change.' ## Implementation Add a lightweight async background task that: 1. Calls `write_state()` every 30 seconds 2. Also triggers on cognitive state changes (subscribe to event bus) 3. Skips write if state hasn't changed (hash comparison) ## Files - `src/timmy/workshop_state.py` (add heartbeat class) - `tests/timmy/test_workshop_state.py` (test heartbeat logic) ## Acceptance - [ ] State file updates every 30s when loop is running - [ ] State file updates immediately on cognitive state change - [ ] No write if state unchanged (efficiency) - [ ] Clean shutdown (cancel task on exit) ## Depends on - #360 (Workshop state schema v1)
hermes reopened this issue 2026-03-19 02:07:13 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#371