Skip to the content.

Task 84 — ProposalStore caching, async I/O, and hot-path allocations

Phase: 5 Initiative: 46 Status: done Owner: — Slug: proposal-store-hotpath-alloc

Goal

Две perf-проблемы:

  1. ProposalStore.ListAll (Reflection/ProposalStore.cs:75-97): читает все JSON files синхронно под global lock, потом сортирует в памяти. GetBySkill, GetRecent, CountToday — каждый re-read’ает все файлы. O(files) sync I/O под lock на каждый call.
  2. Hot-path allocations: нет ArrayPool/MemoryPool/ObjectPool usage; new StringBuilder() per request в context-build hot path (LayeredMemoryManager.cs:41, ContextBuilder.cs:92, TraceSummarizer.cs:19, AgentCore.cs:1023, MemoryManager.cs:33,164, ResponseAggregator.cs:208).

Acceptance criteria

Sub-tasks

Implementation notes

Validation

Scope / Likely files

src/agent/Reflection/ProposalStore.cs, src/agent/Memory/Layers/LayeredMemoryManager.cs, src/agent/Context/ContextBuilder.cs, src/agent/Context/Summarizer/TraceSummarizer.cs, src/agent/Agent/AgentCore.cs, src/agent/Agent/MemoryManager.cs, src/agent/Mesh/Aggregation/ResponseAggregator.cs, src/agent/Hercules.csproj

Dependencies

Risks / Rollback

FileSystemWatcher может пропустить events на некоторых FS (NFS); periodic refresh fallback (every 60s). StringBuilder pool: Clear() перед Return обязателен иначе leak. Rollback: вернуть new StringBuilder().