profile

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package profile stores per-identity Agent.md profiles on disk.

Index

Constants

View Source
const (
	// ProfileBlockStart marks the beginning of the protected Agent.md context block.
	ProfileBlockStart = "<profile:Agent.md>"
	// ProfileBlockEnd marks the end of the protected Agent.md context block.
	ProfileBlockEnd = "</profile:Agent.md>"
)
View Source
const MaxAgentMDBytes = 32768

MaxAgentMDBytes caps the rendered Agent.md profile size.

Variables

View Source
var (
	// ErrInvalidIdentity is returned when a profile identity is empty, malformed, or escapes the profile root.
	ErrInvalidIdentity = errors.New("invalid profile identity")
	// ErrProfileNotFound is returned when one or more required profile files are missing.
	ErrProfileNotFound = errors.New("profile not found")
)

Functions

func AddFact

func AddFact(agentMD, fact string) (string, bool, error)

AddFact inserts a bullet into the Identity section without duplicating it.

func DefaultRoot

func DefaultRoot() string

DefaultRoot returns the default per-user Aura profile directory.

func FormatSectionTree

func FormatSectionTree(agentMD string) string

FormatSectionTree renders a compact ASCII tree for CLI display.

func RenderAgentMD

func RenderAgentMD(c AgentContent) string

RenderAgentMD renders Agent.md with a stable section order.

func RenderContextBlock

func RenderContextBlock(agentMD string) string

RenderContextBlock wraps Agent.md for the protected messages[1] user-role block.

Types

type AgentContent

type AgentContent struct {
	Identity           []string
	ExpertiseTools     []string
	ProjectsGoals      []string
	Interests          []string
	People             []string
	Style              []string
	Vetoes             []string
	CustomInstructions []string
}

AgentContent is the structured form rendered into Agent.md.

type LoadedProfile

type LoadedProfile struct {
	AgentMD     string
	Preferences Preferences
	Metadata    Metadata
	Changelog   string
}

LoadedProfile is the full profile state reconstructed from disk.

type Metadata

type Metadata struct {
	Version             int    `json:"version"`
	SchemaVersion       int    `json:"schema_version,omitempty"`
	OnboardingCompleted bool   `json:"onboarding_completed"`
	OnboardingSkipped   bool   `json:"onboarding_skipped,omitempty"`
	GeneratedAt         string `json:"generated_at,omitempty"`
	LastUpdatedAt       string `json:"last_updated_at,omitempty"`
}

Metadata tracks profile versioning and onboarding state.

type Preferences

type Preferences struct {
	Lang                string `json:"lang,omitempty"`
	Timezone            string `json:"timezone,omitempty"`
	Location            string `json:"location,omitempty"`
	VoiceMode           bool   `json:"voice_mode,omitempty"`
	CanProactiveMessage bool   `json:"can_proactive_message,omitempty"`
	TonePreference      string `json:"tone_preference,omitempty"`
	ResponseLength      string `json:"response_length,omitempty"`
}

Preferences is the structured companion file beside Agent.md.

type Profile

type Profile struct {
	AgentMD     string
	Preferences Preferences
	Metadata    Metadata
	Change      string
}

Profile is the write input for one identity profile.

type Section

type Section struct {
	Title string
	Items []string
	Body  []string
}

Section is a parsed Agent.md H2 section for display.

func ParseSections

func ParseSections(agentMD string) []Section

ParseSections returns Agent.md H2 sections in file order.

type Store

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

Store reads and writes profile files under Root/<identity>/.

func NewStore

func NewStore(root string) *Store

NewStore builds a Store. An empty root falls back to DefaultRoot.

func (*Store) AddFact

func (s *Store) AddFact(identity, fact string) (bool, error)

AddFact inserts fact under Agent.md's Identity section and appends the changelog.

func (*Store) ReadProfile

func (s *Store) ReadProfile(identity string) (LoadedProfile, error)

ReadProfile reads Agent.md, preferences, metadata, and changelog for identity.

func (*Store) Root

func (s *Store) Root() string

Root returns the absolute-ish root configured for this store.

func (*Store) WriteProfile

func (s *Store) WriteProfile(identity string, p Profile) error

WriteProfile atomically writes every file in a profile directory.

Jump to

Keyboard shortcuts

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