Problem
The internal/agent/memory package implements an AgentMemory type with recent-query recall (GetSimilarQueries), service-health tracking (UpdateServiceHealth), learned-pattern accumulation (LearnPattern), and an intent-similarity scorer (calculateSimilarity). None of it is ever instantiated or referenced anywhere in the codebase. A grep for agent/memory, AgentMemory, memory.New, GetSimilarQueries, AddQueryContext, LearnPattern, and UpdateServiceHealth outside the package itself returns zero hits. Agent.InvestigateQuery builds a brand-new semantic.NewAnalyzer() on every call (agent.go:66) and carries no state across queries.
Where
internal/agent/memory/memory.go:12-107
internal/agent/agent.go:62-108
internal/agent/agent.go:66
Root cause
The memory layer was written as part of an 'agent memory' design but was never connected to the agent lifecycle. Agent (agent.go:40-45) has no *memory.AgentMemory field, so each query is fully stateless — the product is not actually 'remembering' anything despite advertising incident/query memory.
How to fix
Add a mem *memory.AgentMemory field to Agent, initialize it in NewAgent with a configurable MaxQueries, and in InvestigateQuery: (1) before fan-out, call mem.GetSimilarQueries(queryIntent, 3) and inject prior similar contexts into agentCtx.GatheredData["prior_context"] and BuildFinalContext; (2) after completion, call mem.AddQueryContext(...) and mem.LearnPattern(...). Persist AgentMemory to the resource SQLite cache (modernc.org/sqlite already a dep) so memory survives process restarts. Alternatively delete the package if memory is intentionally out of scope, so it stops implying a capability that does not exist.
Acceptance criteria
A second related query within a session demonstrably reuses prior gathered context (verifiable via a debug log / chain-of-thought entry referencing a similar past query), and AgentMemory has at least one production caller covered by a test.
Severity: medium · from holistic hardening review.
Problem
The
internal/agent/memorypackage implements anAgentMemorytype with recent-query recall (GetSimilarQueries), service-health tracking (UpdateServiceHealth), learned-pattern accumulation (LearnPattern), and an intent-similarity scorer (calculateSimilarity). None of it is ever instantiated or referenced anywhere in the codebase. A grep foragent/memory,AgentMemory,memory.New,GetSimilarQueries,AddQueryContext,LearnPattern, andUpdateServiceHealthoutside the package itself returns zero hits.Agent.InvestigateQuerybuilds a brand-newsemantic.NewAnalyzer()on every call (agent.go:66) and carries no state across queries.Where
internal/agent/memory/memory.go:12-107internal/agent/agent.go:62-108internal/agent/agent.go:66Root cause
The memory layer was written as part of an 'agent memory' design but was never connected to the agent lifecycle.
Agent(agent.go:40-45) has no*memory.AgentMemoryfield, so each query is fully stateless — the product is not actually 'remembering' anything despite advertising incident/query memory.How to fix
Add a
mem *memory.AgentMemoryfield toAgent, initialize it inNewAgentwith a configurableMaxQueries, and inInvestigateQuery: (1) before fan-out, callmem.GetSimilarQueries(queryIntent, 3)and inject prior similar contexts intoagentCtx.GatheredData["prior_context"]andBuildFinalContext; (2) after completion, callmem.AddQueryContext(...)andmem.LearnPattern(...). PersistAgentMemoryto the resource SQLite cache (modernc.org/sqlite already a dep) so memory survives process restarts. Alternatively delete the package if memory is intentionally out of scope, so it stops implying a capability that does not exist.Acceptance criteria
A second related query within a session demonstrably reuses prior gathered context (verifiable via a debug log / chain-of-thought entry referencing a similar past query), and
AgentMemoryhas at least one production caller covered by a test.Severity: medium · from holistic hardening review.