Skip to content

feat(memory): Scaffold inject_memories turn_start builtin #3015

@hamza-jeddad

Description

@hamza-jeddad

Background

Sub-issue of #3011. Create the inject_memories builtin file and register it as a turn_start hook, following the precedent set by add_date, add_environment_info, and add_prompt_files in pkg/hooks/builtins/.

This issue is scoped to the builtin scaffolding only — the retrieval logic itself is defined in #3013, and runtime wiring is handled in a separate sub-issue.

Scope

  • Create pkg/hooks/builtins/inject_memories.go with the turn_start builtin signature
  • Register a constant (e.g. InjectMemories = "inject_memories") and the handler in pkg/hooks/builtins/builtins.go
  • Add the corresponding fields to AgentDefaults:
    • InjectMemories bool
    • MaxInjectMemories int
    • InjectMemoriesStrategy string
  • The builtin must be a no-op for now if either the master toggle is off OR no memory toolset is present
  • The actual keyword extraction + SearchMemories call is implemented in feat(memory): Design and implement inject_memories retrieval strategy #3013 (this issue lays the foundation)

Implementation Checklist

  • pkg/hooks/builtins/inject_memories.go — file + handler skeleton
  • pkg/hooks/builtins/builtins.go — register constant, handler, AgentDefaults fields
  • Stub returns empty AdditionalContext until feat(memory): Design and implement inject_memories retrieval strategy #3013 lands
  • Unit tests: builtin returns no-op when disabled; builtin returns no-op when no memory toolset attached
  • godoc comments on exported symbols

Acceptance Criteria

  • Builtin compiles and is discoverable through the builtins registry
  • Disabled by default (AgentDefaults.InjectMemories == false)
  • Calling the builtin with InjectMemories: false returns no AdditionalContext
  • Calling the builtin without a memory toolset wired returns no AdditionalContext
  • No behavioural change to any other builtin or to the default turn_start execution order

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/toolsFor features/issues/fixes related to the usage of built-in and MCP tools
    No fields configured for Enhancement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions