memorypolicy

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ValidTiers is the ordered set of accepted memory governance tiers.

Functions

func AgentCanAccessMemory

func AgentCanAccessMemory(ctx context.Context, db *sql.DB, memoryID, agentID, workspaceID string, readableTiers []Tier) (bool, error)

AgentCanAccessMemory checks explicit ACL grants, workspace tier visibility, and the agent's own workspace scratch memory allowance.

func GrantReadACL

func GrantReadACL(ctx context.Context, db *sql.DB, memoryID, agentID, grantedBy string) error

GrantReadACL grants one agent explicit read access to one memory item.

func RevokeACL

func RevokeACL(ctx context.Context, db *sql.DB, memoryID, agentID, permission string) error

RevokeACL removes one explicit ACL grant.

func ValidTier

func ValidTier(raw string) bool

ValidTier reports whether raw names one of Goncho's memory governance tiers.

func ValidateTierOrErr

func ValidateTierOrErr(raw string) error

ValidateTierOrErr rejects unknown tier names with a public error message.

Types

type ACLQuery

type ACLQuery struct {
	AgentID     string
	IsParent    bool
	ReadTiers   []Tier
	WriteTier   Tier
	WorkspaceID string
}

ACLQuery captures the caller's memory tier window and explicit ACL identity.

func (ACLQuery) CanRead

func (q ACLQuery) CanRead(tier Tier) bool

CanRead reports whether the query identity can read tier through its tier window.

func (ACLQuery) CanWrite

func (q ACLQuery) CanWrite(tier Tier) bool

CanWrite reports whether the query identity can write tier.

func (ACLQuery) ReadScopeSQL

func (q ACLQuery) ReadScopeSQL() (string, []any)

ReadScopeSQL returns the SQL clause and args for readable memory rows.

type Tier

type Tier string

Tier identifies the governance level that owns a memory item.

const (
	TierGlobal    Tier = "global"
	TierProject   Tier = "project"
	TierTask      Tier = "task"
	TierWorkspace Tier = "workspace"
	TierDecision  Tier = "decision"
)

func DefaultTierForSource

func DefaultTierForSource(sourceKind string) Tier

DefaultTierForSource assigns source kinds to conservative memory tiers.

func Hierarchy

func Hierarchy() []Tier

Hierarchy returns tiers from broadest/global to most governed/decision.

func NormalizeTier

func NormalizeTier(raw string) Tier

NormalizeTier returns a valid tier, defaulting unknown input to global.

func ReadableBy

func ReadableBy(agentTier Tier) []Tier

ReadableBy returns the tier window visible to an agent at agentTier.

func WritableBy

func WritableBy(isParent bool) []Tier

WritableBy returns the tiers an agent may write directly.

Jump to

Keyboard shortcuts

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