workspace

package
v1.66.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BootstrapFiles = []string{
	"AGENTS.md",
	"SOUL.md",
	"USER.md",
	"IDENTITY.md",
	"RULES.md",
}

BootstrapFiles are loaded in this order (all optional).

Functions

This section is empty.

Types

type BootstrapLoader

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

BootstrapLoader loads and caches workspace bootstrap files.

func NewBootstrapLoader

func NewBootstrapLoader(workspaceDir, globalDir string, logger *zap.Logger) *BootstrapLoader

NewBootstrapLoader creates a new loader.

func (*BootstrapLoader) InvalidateCache

func (bl *BootstrapLoader) InvalidateCache()

InvalidateCache forces reload on next call.

func (*BootstrapLoader) IsStale

func (bl *BootstrapLoader) IsStale() bool

IsStale checks if any cached file has been modified on disk.

func (*BootstrapLoader) LoadBootstrapContent

func (bl *BootstrapLoader) LoadBootstrapContent() string

LoadBootstrapContent loads all bootstrap files with mtime-based cache invalidation. Priority: workspace > global (workspace files override global).

func (*BootstrapLoader) LoadFile

func (bl *BootstrapLoader) LoadFile(filename string) (string, bool)

LoadFile loads a single bootstrap file (workspace first, then global).

type ContextBuilder

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

ContextBuilder assembles the full system prompt from workspace sources.

func NewContextBuilder

func NewContextBuilder(bootstrap *BootstrapLoader, memory *MemoryStore) *ContextBuilder

NewContextBuilder creates a new context builder.

func (*ContextBuilder) BuildDynamicContext

func (cb *ContextBuilder) BuildDynamicContext() string

BuildDynamicContext returns time-sensitive context.

func (*ContextBuilder) BuildSystemPromptPrefix

func (cb *ContextBuilder) BuildSystemPromptPrefix() string

BuildSystemPromptPrefix returns workspace context to prepend to the system prompt. Includes: bootstrap files + memory context. Does NOT include mode-specific instructions (coder/agent prompts).

func (*ContextBuilder) InvalidateCache

func (cb *ContextBuilder) InvalidateCache()

InvalidateCache forces rebuild on next call.

type DailyNote

type DailyNote struct {
	Date    time.Time
	Path    string
	Content string
}

DailyNote represents a single day's note.

type MemoryStore

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

MemoryStore manages persistent AI memory.

func NewMemoryStore

func NewMemoryStore(baseDir string, logger *zap.Logger) *MemoryStore

NewMemoryStore creates a new memory store.

func (*MemoryStore) AppendLongTerm

func (ms *MemoryStore) AppendLongTerm(entry string) error

AppendLongTerm appends to MEMORY.md.

func (*MemoryStore) EnsureDirectories

func (ms *MemoryStore) EnsureDirectories() error

EnsureDirectories creates the memory directory structure.

func (*MemoryStore) GetMemoryContext

func (ms *MemoryStore) GetMemoryContext() string

GetMemoryContext builds the memory section for the system prompt.

func (*MemoryStore) GetRecentDailyNotes

func (ms *MemoryStore) GetRecentDailyNotes(days int) []DailyNote

GetRecentDailyNotes returns the last N days of notes.

func (*MemoryStore) ReadLongTerm

func (ms *MemoryStore) ReadLongTerm() string

ReadLongTerm reads the main MEMORY.md file.

func (*MemoryStore) TodayNotePath

func (ms *MemoryStore) TodayNotePath() string

TodayNotePath returns the path for today's note.

func (*MemoryStore) WriteDailyNote

func (ms *MemoryStore) WriteDailyNote(entry string) error

WriteDailyNote appends to today's daily note.

func (*MemoryStore) WriteLongTerm

func (ms *MemoryStore) WriteLongTerm(content string) error

WriteLongTerm writes the entire MEMORY.md file.

Jump to

Keyboard shortcuts

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