[Core] Heartbeat Loop v2 — Gather/Reason/Act with WorldInterface Integration #872

Closed
opened 2026-03-21 23:40:05 +00:00 by perplexity · 0 comments
Collaborator

Why This Is High Leverage

Timmy already has think_once() firing every 5 minutes and a Gather → Reason → Act loop stub in src/loop/. But these are disconnected from any world. This ticket wires the heartbeat to the WorldInterface so Timmy's cognitive cycle drives real actions in whatever world he's embodied in — Morrowind, the Matrix, or a test mock.

Scope

Refactor the existing heartbeat/thinking loop to:

  1. Gather: Call world.observe() to get structured perception
  2. Reason: Feed perception + memory + goals to the LLM, get a decision
  3. Act: Call world.act(command) with the decision
  4. Reflect: Log the cycle to CommandLogger, update episodic memory
  5. Broadcast: Emit cognitive state to WebSocket clients (Matrix, dashboard)

Requirements

  • Integrate WorldInterface into the existing src/timmy/agentic_loop.py or src/loop/
  • Each heartbeat cycle produces: one observation, one reasoning trace, one action, one log entry
  • Configurable heartbeat interval (default 30s for game world, 5min for passive thinking)
  • Graceful degradation: if no world adapter is connected, fall back to current think_once() behavior
  • CommandLogger from PR #864 records every cycle automatically

Acceptance Criteria

  • With MockWorldAdapter: heartbeat runs, logs show observe→reason→act→reflect cycle
  • Without adapter: existing think_once() behavior unchanged
  • WebSocket broadcasts include current action and reasoning summary

Dependencies

  • WorldInterface (previous ticket)
  • PR #864 (CommandLogger)

Assignee: Kimi

## Why This Is High Leverage Timmy already has `think_once()` firing every 5 minutes and a Gather → Reason → Act loop stub in `src/loop/`. But these are disconnected from any world. This ticket wires the heartbeat to the WorldInterface so Timmy's cognitive cycle drives real actions in whatever world he's embodied in — Morrowind, the Matrix, or a test mock. ## Scope Refactor the existing heartbeat/thinking loop to: 1. **Gather:** Call `world.observe()` to get structured perception 2. **Reason:** Feed perception + memory + goals to the LLM, get a decision 3. **Act:** Call `world.act(command)` with the decision 4. **Reflect:** Log the cycle to CommandLogger, update episodic memory 5. **Broadcast:** Emit cognitive state to WebSocket clients (Matrix, dashboard) ## Requirements - [ ] Integrate WorldInterface into the existing `src/timmy/agentic_loop.py` or `src/loop/` - [ ] Each heartbeat cycle produces: one observation, one reasoning trace, one action, one log entry - [ ] Configurable heartbeat interval (default 30s for game world, 5min for passive thinking) - [ ] Graceful degradation: if no world adapter is connected, fall back to current think_once() behavior - [ ] CommandLogger from PR #864 records every cycle automatically ## Acceptance Criteria - With MockWorldAdapter: heartbeat runs, logs show observe→reason→act→reflect cycle - Without adapter: existing think_once() behavior unchanged - WebSocket broadcasts include current action and reasoning summary ## Dependencies - WorldInterface (previous ticket) - PR #864 (CommandLogger) ## Assignee: Kimi
claude was assigned by Rockachopa 2026-03-22 23:33:34 +00:00
claude added the harnessheartbeatp0-critical labels 2026-03-23 13:52:54 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#872