Skip to the content.

Task 102 — Context distillation

Phase: 8 Status: done Owner: — Slug: context-distillation Studio Stage: 6

Goal

Иерархическая дистилляция контекста (recent=raw, older=summary, ancient=key facts) для экономии токенов. Расширить существующий /api/context/* endpoints.

Acceptance criteria

Sub-tasks

Implementation notes

Round 1 (this tick) — completed

Config (src/agent/Context/ContextBuilderConfig.cs):

Persistence (src/agent/Context/Distillation/SqliteDistillationStore.cs):

Service (src/agent/Context/Distillation/ContextDistillationService.cs):

Предостережение по LLM: в оригинальной AC упоминается “LLM summarization”. В этой итерации используется детерминированная (frequency + sentence scoring) реализация. Причины:

ContextBuilder (src/agent/Context/ContextBuilder.cs):

WebApi (src/agent/Hercules.WebApi/Controllers/ContextController.cs):

Storage (src/agent/Storage/SqliteSessionStore.cs):

DI wiring (оба Program.cs):

Round 1 — validation

Notes

Notes / Constraints

Dependencies

Scope / Likely files

src/agent/Context/ContextDistillationService.cs (new), src/agent/Context/ContextService.cs (extend), src/agent/Hercules.WebApi/Controllers/ContextController.cs (extend)