Skip to content

Add abilities to read long-term and short-term memory files #28

@bradvin

Description

@bradvin

Problem

Memory can be written via existing memory abilities, but explicit memory read abilities are missing. The model currently relies on prompt context assembly only, which is not always sufficient for targeted retrieval.

Current State

  • Memory persistence is centralized in includes/helpers/class-memory-helper.php.
  • Existing abilities include add/update/delete for short/long-term memory.
  • Memory files map to:
    • long-term: memory.md
    • daily: memory-ddmmyyyy.md

Implementation Plan

1) Add explicit read abilities

Create abilities in includes/abilities/:

  • memory_long_term_read
  • memory_short_term_read

2) Input schemas

  • memory_long_term_read: optional options (max_chars, default cap).
  • memory_short_term_read:
    • optional date (supports default=today)
    • optional max_chars.

3) Output schemas

Include:

  • filename
  • content
  • exists boolean
  • optional metadata (daily_timestamp, content_length).

4) Implementation constraints

  • Route all reads through Memory_Helper methods only.
  • Apply truncation limits to avoid overlarge tool payloads.
  • Mark abilities readonly + idempotent.

5) Register + map

  • Register in includes/class-abilities.php.
  • Add tool mappings in Abilities_Helper::TOOL_TO_ABILITY.

Acceptance Criteria

  • Agent can read long-term and short-term memory via tools.
  • Missing daily file returns deterministic exists=false (not hard failure).
  • Large memory values are safely bounded.
  • No direct CPT access bypassing Memory_Helper.

Test Plan

  • Unit tests for:
    • long-term read with content,
    • short-term read for existing and missing day,
    • truncation behavior,
    • invalid input handling.
  • Tool declaration tests for new abilities.

Out of Scope

  • Memory search/indexing.
  • Bulk reads (covered by separate issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions