Skip to content

feat: session memory bridge — inject and persist context across sessions #783

@OneStepAt4time

Description

@OneStepAt4time

Summary

Sessions are stateless — each new session starts from zero. A memory bridge would allow sessions to read/write shared context, enabling continuity across related tasks without manual copy-paste of context.

Problem

  • Hep works on 3 parallel worktrees. Session A fixes a bug in webhook.ts, Session B needs to know about that fix to avoid conflicts.
  • No way to persist learnings from one session to the next (e.g., "this module uses Zod v3.23").
  • Currently relies on human (Athena/Ema) manually providing context via prompt — error-prone and slow.

Proposed API

  • POST /v1/memory — write key/value entry with optional TTL and session scope
  • GET /v1/memory/:key — read entry (latest value or merged history)
  • GET /v1/memory?prefix=webhook.* — list entries by key prefix
  • DELETE /v1/memory/:key — remove entry
  • Auto-inject: session creation accepts memoryKeys: string[] → bridge injects values into system prompt

Storage

  • Default: in-memory Map with optional JSON file persistence
  • Key structure: namespace/key (e.g., session/abc123/context, global/project-structure)
  • TTL support for auto-expiry

Acceptance Criteria

  • Memory bridge module (src/memory-bridge.ts)
  • REST API endpoints for CRUD
  • Auto-injection into session system prompt via memoryKeys
  • TTL support with auto-expiry
  • JSON file persistence option
  • Tests for read/write/expiry/injection
  • Backward compatible (disabled by default, opt-in via config)

Priority

P1 — foundational for multi-session workflows and v2.5.0 roadmap

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions