memory

package
v1.1.60 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package memory implements persistent memory storage for Hermes mode. Memory is stored as a human-readable Markdown file (memory.md).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryTool

type MemoryTool struct {
	// contains filtered or unexported fields
}

MemoryTool provides persistent memory read/write via memory.md.

func NewMemoryTool

func NewMemoryTool(store *Store) *MemoryTool

NewMemoryTool creates a new memory tool.

func (*MemoryTool) Description

func (t *MemoryTool) Description() string

func (*MemoryTool) Execute

func (t *MemoryTool) Execute(ctx context.Context, params map[string]any) (tools.ToolResult, error)

func (*MemoryTool) Name

func (t *MemoryTool) Name() string

func (*MemoryTool) Parameters

func (t *MemoryTool) Parameters() json.RawMessage

func (*MemoryTool) PromptGuidelines

func (t *MemoryTool) PromptGuidelines() []string

func (*MemoryTool) PromptSnippet

func (t *MemoryTool) PromptSnippet() string

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store manages reading and writing of memory.md files.

func NewStore

func NewStore(explicitPath, workDir string) *Store

NewStore creates a memory store. If explicitPath is non-empty, it overrides the default discovery logic. workDir is used as fallback directory for creating new memory files.

func (*Store) Add

func (s *Store) Add(section, entry string) error

Add appends a line to a specific section.

func (*Store) Delete

func (s *Store) Delete(section, entry string) error

Delete removes a line from a section.

func (*Store) Read

func (s *Store) Read() (content string, path string, source string, err error)

Read returns the full content of memory.md.

func (*Store) ReadSection

func (s *Store) ReadSection(section string) (string, error)

ReadSection returns the content of a specific ## section.

func (*Store) Resolve

func (s *Store) Resolve() (path string, source string, err error)

Resolve finds the memory.md file to use. Priority: explicit path → .mothx/memory.md → <GLOBAL_DIR>/memory.md Returns (path, source, error). source is "explicit", "project", "global", or "".

func (*Store) Update

func (s *Store) Update(section, oldText, newText string) error

Update replaces old text with new text in a section.

func (*Store) WriteAll

func (s *Store) WriteAll(content string) error

WriteAll overwrites the entire memory.md content.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL