Skip to content

feat(memory): Tests, docs, and examples for inject_memories #3018

@hamza-jeddad

Description

@hamza-jeddad

Background

Sub-issue of #3011. Final polish — make sure inject_memories is well-tested, documented, and discoverable via examples once the other sub-issues land.

Scope

Tests

  • Unit tests in pkg/hooks/builtins/inject_memories_test.go:
    • Disabled builtin → no-op
    • No memory toolset → no-op
    • Empty memory store → no injection block
    • Local strategy + multi-keyword prompt → correct SearchMemories call
    • max_inject_memories cap respected
    • XML output is well-formed
  • Integration test (e.g. under e2e/):
    • Agent with inject_memories: true + a few seeded memories
    • User prompt referencing one memory → that memory appears in the injected block
    • Unrelated user prompt → only fallback / no relevant memories
    • Memory written via tool call → next turn reflects it
  • Race detector clean: go test -race ./pkg/hooks/builtins/... ./pkg/runtime/...
  • ≥80% line coverage on new code

Docs

  • docs/ — new section on proactive memory injection: what it does, how to enable it, when to choose local vs llm strategy
  • AGENTS.md — short note explaining inject_memories for agents browsing the repo
  • agent-schema.json — confirm descriptions render usefully in IDEs / YAML language servers

Examples

  • examples/ — sample agent YAML demonstrating inject_memories: true with a memory toolset
  • Optional: a CHANGELOG entry under the next release header

Acceptance Criteria

  • All new tests pass on Linux, macOS, and Windows CI
  • Coverage report shows ≥80% on new files
  • Docs build cleanly (no broken links, lints pass)
  • Example agent runs end-to-end via docker-agent run and demonstrably injects memories
  • CHANGELOG entry merged with the feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/agentFor work that has to do with the general agent loop/agentic features of the apparea/configFor configuration parsing, YAML, environment variablesarea/ragFor work/issues that have to do with the RAG featuresarea/testingTest infrastructure, CI/CD, test runners, evaluation

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions