feat(memory): add task-aware agentic memory#1802
Conversation
📝 WalkthroughWalkthroughIntroduces a five-value ChangesAgent Memory Category Feature
Sequence Diagram(s)sequenceDiagram
participant Agent
participant AgentRuntimePresenter
participant ExtractionPipeline
participant MemoryPresenter
participant AgentMemoryTable
Agent->>AgentRuntimePresenter: session turn with tool use / content
AgentRuntimePresenter->>AgentRuntimePresenter: buildMemorySpanFromTape()<br/>(hadToolUse, visibleTextChars)
AgentRuntimePresenter->>AgentRuntimePresenter: admission gate<br/>(tool use OR large delta OR sufficient chars)
AgentRuntimePresenter->>ExtractionPipeline: extractAndStore(spanText)
ExtractionPipeline->>ExtractionPipeline: buildExtractionPrompt(AGENT_MEMORY_CATEGORIES)
ExtractionPipeline->>ExtractionPipeline: parseMemoryCandidates()<br/>(validate category, cap task_outcome)
ExtractionPipeline->>MemoryPresenter: writeMemoriesSync(candidates)
MemoryPresenter->>MemoryPresenter: normalizeMemoryCandidate()<br/>(derive kind, clamp importance floor)
MemoryPresenter->>MemoryPresenter: coordinateWrite()<br/>(ADD / UPDATE / SUPERSEDE / CHALLENGE)
MemoryPresenter->>MemoryPresenter: applyContentUpdate(category)<br/>(propagate if canCarryCategory && row.category === null)
MemoryPresenter->>AgentMemoryTable: insert / updateContent(category)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/presenter/memoryPresenter/extraction.ts`:
- Around line 92-99: The issue is that invalid categories are being pushed to
the candidates array even when they fail the isAgentMemoryCategory validation.
Currently, the isAgentMemoryCategory check is only used to guard against
duplicate task_outcome entries, but the category variable is still pushed to
candidates regardless of whether it's a valid category or not. Fix this by
normalizing the category to undefined whenever isAgentMemoryCategory returns
false, so that only valid categories conforming to the five-category contract
are included in the candidates array when candidates.push is called.
In `@src/main/presenter/memoryPresenter/index.ts`:
- Around line 1551-1553: The audit logging at lines 1575-1579 is recording the
raw candidate field values before any normalization occurs, but the write path
normalizes these values (such as category-driven kind coercion or dropping
invalid categories to null). This causes audit records to disagree with what was
actually persisted. Refactor the audit logging to record the final normalized
values that are actually written to storage instead of the raw candidate fields,
ensuring the audit trail accurately reflects what was persisted.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 76818d1d-5adf-4306-8686-06519dbe2895
📒 Files selected for processing (50)
docs/architecture/agent-memory-system/spec.mdresources/skills/memory-management/SKILL.mdsrc/main/presenter/agentRuntimePresenter/index.tssrc/main/presenter/index.tssrc/main/presenter/memoryPresenter/decision.tssrc/main/presenter/memoryPresenter/extraction.tssrc/main/presenter/memoryPresenter/index.tssrc/main/presenter/memoryPresenter/types.tssrc/main/presenter/sqlitePresenter/schemaCatalog.tssrc/main/presenter/sqlitePresenter/tables/agentMemory.tssrc/main/presenter/toolPresenter/agentTools/agentMemoryTools.tssrc/main/presenter/toolPresenter/runtimePorts.tssrc/main/routes/index.tssrc/renderer/settings/components/MemoryManagerPanel.vuesrc/renderer/src/i18n/da-DK/settings.jsonsrc/renderer/src/i18n/de-DE/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/es-ES/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/he-IL/settings.jsonsrc/renderer/src/i18n/id-ID/settings.jsonsrc/renderer/src/i18n/it-IT/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/ms-MY/settings.jsonsrc/renderer/src/i18n/pl-PL/settings.jsonsrc/renderer/src/i18n/pt-BR/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/tr-TR/settings.jsonsrc/renderer/src/i18n/vi-VN/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/shared/contracts/routes/memory.routes.tssrc/shared/types/agent-memory.tssrc/shared/types/index.d.tstest/main/presenter/agentMemoryTable.test.tstest/main/presenter/agentRuntimePresenter/agentRuntimePresenter.test.tstest/main/presenter/fakes/memoryFakes.tstest/main/presenter/memoryAdd.test.tstest/main/presenter/memoryDecision.test.tstest/main/presenter/memoryExtraction.test.tstest/main/presenter/memoryPresenter.test.tstest/main/presenter/memoryRetrieval.eval.test.tstest/main/presenter/skillPresenter/discoveryWorker.test.tstest/main/presenter/sqlitePresenter.test.tstest/main/presenter/toolPresenter/agentTools/agentMemoryTools.test.tstest/main/routes/memoryDto.test.tstest/renderer/components/MemoryManagerDialog.test.ts
Adds task-aware agentic memory writing across runtime, kernel, UI, and skill guidance.
user_preference,project_fact,task_outcome,heuristic,anti_pattern.memory-managementskill and triage guardrail coverage.Summary by CodeRabbit
New Features
memory_remembertool now accepts optionalcategoryparameter to organize memories.Behavior Changes
Documentation