Skip to content

Add reflect pass to heartbeat — synthesize insights from memories #26

Description

@tyejcoleman

Summary

The heartbeat currently scans memories for triggers (stale work, missed follow-ups, etc.) but doesn't learn from what it knows. Add a reflect pass that analyzes existing memories and synthesizes higher-level insights.

Inspired by Hindsight's reflect operation — but integrated into Keyoku's existing heartbeat loop rather than as a separate call.

What this looks like

During each heartbeat cycle:

  1. Trigger scan (existing) — check for actionable items
  2. Reflect pass (new) — pull recent memories, find patterns, synthesize insights
  3. Store insight — save as a new memory with a distinct type (e.g. insight or reflection) and higher weight so it surfaces more easily on recall

Examples

  • 10 memories about a user preferring short responses → synthesize: "this user values brevity as a core communication principle"
  • Multiple memories about missed deadlines on project X → synthesize: "project X is at risk"
  • Contradicting memories about a preference → resolve into a coherent understanding

Why heartbeat

  • Already runs periodically with access to all memories
  • Reflect output feeds back into better trigger detection (insights make the heartbeat smarter over time)
  • Turns the heartbeat from a monitoring loop into a learning loop

Implementation notes

  • The consolidation processor already does decay and cleanup — reflection/synthesis would be a natural addition there
  • New memory type or tag to distinguish raw memories from synthesized insights
  • Configurable: how often to reflect, how many memories to consider, minimum cluster size before synthesizing
  • Should deduplicate — don't re-synthesize insights that already exist

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions