MCPcopy Create free account
hub / github.com/compozy/agh / renderMemoryExtractorPrompt

Function renderMemoryExtractorPrompt

internal/daemon/memory_runtime.go:685–704  ·  view source on GitHub ↗
(turn memcontract.TurnRecord)

Source from the content-addressed store, hash-verified

683}
684
685func renderMemoryExtractorPrompt(turn memcontract.TurnRecord) (string, error) {
686 tmpl, err := prompts.ParseTemplate(prompts.NameExtract, prompts.VersionV1)
687 if err != nil {
688 return "", err
689 }
690 policy, err := prompts.Load(prompts.NameWhatNotToSave, prompts.VersionV1)
691 if err != nil {
692 return "", err
693 }
694 var rendered bytes.Buffer
695 data := map[string]any{
696 "WhatNotToSave": policy.Content,
697 "Turn": turn,
698 "Transcript": renderMemoryTranscript(turn.Snapshot),
699 }
700 if err := tmpl.Execute(&rendered, data); err != nil {
701 return "", fmt.Errorf("daemon: render memory extractor prompt: %w", err)
702 }
703 return rendered.String(), nil
704}
705
706func renderMemoryTranscript(snapshot memcontract.TranscriptSnapshot) string {
707 var buf strings.Builder

Callers 1

ExtractMethod · 0.85

Calls 5

ParseTemplateFunction · 0.92
LoadFunction · 0.92
renderMemoryTranscriptFunction · 0.85
ExecuteMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected