Skip to content

Implement Phase 1: LLM memory foundation for pulsar-agentic#311

Closed
Copilot wants to merge 7 commits into4.5.xfrom
copilot/design-llm-memory-feature
Closed

Implement Phase 1: LLM memory foundation for pulsar-agentic#311
Copilot wants to merge 7 commits into4.5.xfrom
copilot/design-llm-memory-feature

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

Implements the foundation layer for persistent agent memory, enabling agents to learn from past experiences and maintain context across sessions.

Architecture

Three-layer memory system:

  • Working Memory: Session-scoped state, extends current AgentHistory with structured context
  • Episodic Memory: Persistent task execution records with outcomes and learnings
  • Semantic Memory: Extracted knowledge indexed by category (FACT, PATTERN, STRATEGY, etc.)
// Create and use memory manager
val manager = DefaultMemoryManager.createDefault(
    MemoryConfig(backend = StorageBackend.FILE_BASED)
)

// Track execution
manager.addToWorkingMemory(sessionId, agentState)

// Consolidate when complete
val episode = manager.consolidateSession(sessionId, TaskOutcome.SUCCESS)

// Build context for next task
val context = manager.buildContext(currentTask, sessionId, maxTokens = 4000)

Implementation

Data Models (memory/MemoryModels.kt)

  • WorkingMemory, EpisodicMemory, SemanticMemory with proper lifecycle
  • MemoryQuery sealed interface: Recency, Similarity, Tag, Hybrid strategies
  • AgentContext for LLM prompt integration

Storage Layer (memory/storage/)

  • MemoryStorage interface: async CRUD operations
  • InMemoryStorage: ConcurrentHashMap-based, development/testing
  • FileBasedStorage: JSON files in data/memory/{episodic,semantic}/

Memory Manager (memory/)

  • MemoryManager interface: lifecycle, consolidation, retrieval, context building
  • DefaultMemoryManager: full implementation with automatic cleanup
  • MemoryConfig: environment variable and system property support

Tests

  • InMemoryStorageTest: 11 tests covering CRUD and all query strategies
  • DefaultMemoryManagerTest: 11 tests covering lifecycle and consolidation

Configuration

# Enable memory system
export MEMORY_ENABLED=true
export MEMORY_STORAGE_BACKEND=file_based
export MEMORY_STORAGE_BASE_DIR=data/memory

# Capacity limits
export MEMORY_EPISODIC_MAX_SIZE=10000
export MEMORY_SEMANTIC_MAX_SIZE=50000

Storage Structure

data/memory/
├── episodic/
│   └── {sessionId}/
│       └── {episodeId}.json
└── semantic/
    └── {category}/
        └── {memoryId}.json

Next Steps

Phase 2 will integrate with existing components:

  • Add memoryManager to PerceptiveAgent interface
  • Hook into agent lifecycle for automatic consolidation
  • Emit memory events via AgentEventBus

Related design: docs-dev/agentic/llm-memory-design.md

Original prompt

仅设计,不编程:为 pulsar-agentic 组件提供 LLM 记忆功能。


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 9, 2026 09:26
Co-authored-by: galaxyeye <1701451+galaxyeye@users.noreply.github.com>
Co-authored-by: galaxyeye <1701451+galaxyeye@users.noreply.github.com>
Co-authored-by: galaxyeye <1701451+galaxyeye@users.noreply.github.com>
Copilot AI changed the title [WIP] Design memory functionality for pulsar-agentic component Design: LLM memory system for pulsar-agentic component Feb 9, 2026
Copilot AI requested a review from galaxyeye February 9, 2026 09:29
Copilot stopped work on behalf of galaxyeye due to an error February 10, 2026 02:46
Copilot AI and others added 3 commits February 10, 2026 02:55
Co-authored-by: galaxyeye <1701451+galaxyeye@users.noreply.github.com>
Co-authored-by: galaxyeye <1701451+galaxyeye@users.noreply.github.com>
Co-authored-by: galaxyeye <1701451+galaxyeye@users.noreply.github.com>
Copilot AI changed the title Design: LLM memory system for pulsar-agentic component Implement Phase 1: LLM memory foundation for pulsar-agentic Feb 10, 2026
@galaxyeye galaxyeye closed this Mar 2, 2026
@galaxyeye galaxyeye deleted the copilot/design-llm-memory-feature branch March 2, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants