readysite / website / models / note.go
1.8 KB
note.go
package models

import (
	"github.com/readysite/readysite/pkg/database"
)

// Note types
const (
	NoteTypePreference  = "preference"  // User-specified preferences
	NoteTypeConvention  = "convention"  // Coding/style conventions
	NoteTypeLearned     = "learned"     // AI-learned patterns
)

// Note categories
const (
	NoteCategoryStyle     = "style"     // Styling preferences
	NoteCategoryContent   = "content"   // Content preferences
	NoteCategoryStructure = "structure" // Structure preferences
	NoteCategoryBehavior  = "behavior"  // Behavior preferences
)

// Note sources
const (
	NoteSourceUser = "user" // Created by user
	NoteSourceAI   = "ai"   // Created by AI
)

// Note represents a persistent project-level note for AI context.
// Notes help the AI remember user preferences, conventions, and learned patterns
// across conversations.
type Note struct {
	database.Model
	Type     string // "preference" | "convention" | "learned"
	Category string // "style" | "content" | "structure" | "behavior"
	Title    string // Short descriptive title
	Content  string // Full note content
	Source   string // "user" | "ai"
	Active   bool   // Whether this note is enabled
}

// IsPreference returns true if this is a preference note.
func (n *Note) IsPreference() bool {
	return n.Type == NoteTypePreference
}

// IsConvention returns true if this is a convention note.
func (n *Note) IsConvention() bool {
	return n.Type == NoteTypeConvention
}

// IsLearned returns true if this is a learned note.
func (n *Note) IsLearned() bool {
	return n.Type == NoteTypeLearned
}

// IsFromUser returns true if this note was created by the user.
func (n *Note) IsFromUser() bool {
	return n.Source == NoteSourceUser
}

// IsFromAI returns true if this note was created by the AI.
func (n *Note) IsFromAI() bool {
	return n.Source == NoteSourceAI
}
← Back