memory

package
v1.3.63 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultProjectMemoryFilename = "GGCODE.md"

Variables

View Source
var ProjectMemoryFilenames = []string{
	"GGCODE.md",
	"AGENTS.md",
	"CLAUDE.md",
	"COPILOT.md",
}

ProjectMemoryFilenames lists the supported project bootstrap documents in priority order.

Functions

func GenerateProjectMemory

func GenerateProjectMemory(root string) (string, error)

GenerateProjectMemory builds a GGCODE.md document using the current repo state.

func LoadProjectMemory

func LoadProjectMemory(workingDir string) (content string, files []string, err error)

LoadProjectMemory reads supported project bootstrap documents from the global config dir and the current working directory's ancestor chain. Merge order: global -> walked parents/current directory.

func ProjectMemoryFilesForPath added in v1.1.30

func ProjectMemoryFilesForPath(targetPath string) ([]string, error)

ProjectMemoryFilesForPath returns the supported project memory files that apply to a specific path by walking that path's ancestor chain.

func ReadProjectMemoryFiles added in v1.1.30

func ReadProjectMemoryFiles(paths []string) (content string, files []string, err error)

ReadProjectMemoryFiles reads project memory files in order and returns their merged content plus the subset that had non-empty readable contents.

func ResolveProjectMemoryInitTarget

func ResolveProjectMemoryInitTarget(workingDir string) (targetPath string, existingFiles []string, err error)

ResolveProjectMemoryInitTarget returns the preferred directory and file path for creating a new project memory file from the current working directory.

Types

type AutoMemory

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

AutoMemory manages automatic memory persistence in ~/.ggcode/memory/.

func NewAutoMemory

func NewAutoMemory() *AutoMemory

NewAutoMemory creates an AutoMemory instance for global memory (~/.ggcode/memory/).

func NewProjectAutoMemory added in v1.1.99

func NewProjectAutoMemory(workingDir string) *AutoMemory

NewProjectAutoMemory creates an AutoMemory instance for project-scoped memory. It locates the project root (git root or directory with project memory files) and uses <project-root>/.ggcode/memory/ as the storage directory. Falls back to workingDir itself as project root (every directory is a valid project). Returns nil only if workingDir is the user's HOME directory.

func (*AutoMemory) Clear

func (am *AutoMemory) Clear() error

Clear removes all memory files.

func (*AutoMemory) Dir

func (am *AutoMemory) Dir() string

Dir returns the memory directory path.

func (*AutoMemory) List

func (am *AutoMemory) List() ([]string, error)

List returns all memory keys.

func (*AutoMemory) LoadAll

func (am *AutoMemory) LoadAll() (string, []string, error)

LoadAll loads all memory files and returns their combined content.

func (*AutoMemory) SaveMemory

func (am *AutoMemory) SaveMemory(key, content string) error

SaveMemory saves a memory entry to ~/.ggcode/memory/{key}.md.

Jump to

Keyboard shortcuts

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