Documentation
¶
Overview ¶
Package learning implements cross-session AI learning memory for cloop. After each PM run the AI distills key outcomes, failure patterns, and project conventions into .cloop/memory.md. On subsequent runs this memory is injected into every task execution prompt so the AI improves over time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Distill ¶
Distill asks the AI to summarise what worked, what failed, and any recurring patterns from the just-completed PM plan. Returns a markdown document.
func FormatForPrompt ¶
FormatForPrompt wraps the memory content for injection into a task prompt. Returns empty string if memory is empty.
func LoadMemory ¶
LoadMemory reads the project memory from .cloop/memory.md. Returns empty string if no memory file exists yet, or if the file exceeds the in-prompt size cap (memoryFileMaxBytes) — in which case prompts run without injected memory until the next SaveMemory call rewrites the file at a healthy size, rather than risk blowing token budgets by injecting an arbitrarily large blob into every task prompt.
func SaveMemory ¶
SaveMemory writes the distilled summary to .cloop/memory.md. Each call appends a dated section so history accumulates over runs.
The whole read-modify-write is serialised by saveMu — concurrent callers would otherwise each load the same baseline and the second writer would silently drop the first writer's session. The final write is atomic (tmp → fsync → rename), so a crash mid-write can never leave a truncated memory.md that destroys all accumulated history.
Types ¶
This section is empty.