From 719656e83befe28d09de551322aff0896d706593 Mon Sep 17 00:00:00 2001 From: Dark aura Date: Thu, 7 May 2026 05:45:09 +0100 Subject: [PATCH] feat(vault): add ReadNote with frontmatter parsing for MEMORY.md --- pkg/vault/store.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/vault/store.go b/pkg/vault/store.go index 2d663f866..c605cb751 100644 --- a/pkg/vault/store.go +++ b/pkg/vault/store.go @@ -4,6 +4,8 @@ import ( "os" "path/filepath" "gopkg.in/yaml.v3" + + "github.com/sipeed/picoclaw/pkg/memory" ) type VaultStore struct { @@ -25,4 +27,14 @@ func (vs *VaultStore) CreateNote(name string, frontmatter map[string]interface{} note += "---\n\n" + content notePath := filepath.Join(vs.rootPath, name+".md") return os.WriteFile(notePath, []byte(note), 0644) +} + +// ReadNote reads a note file and parses frontmatter +func (vs *VaultStore) ReadNote(name string) (map[string]interface{}, string, error) { + notePath := filepath.Join(vs.rootPath, name+".md") + content, err := os.ReadFile(notePath) + if err != nil { + return nil, "", err + } + return memory.ParseFrontmatter(string(content)) } \ No newline at end of file