policy

package
v0.3.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TierGlobal    = memorypolicy.TierGlobal
	TierProject   = memorypolicy.TierProject
	TierTask      = memorypolicy.TierTask
	TierWorkspace = memorypolicy.TierWorkspace
	TierDecision  = memorypolicy.TierDecision
)

Variables

View Source
var ValidMemoryTiers = memorypolicy.ValidTiers

Functions

func AcceptProposal

func AcceptProposal(ctx context.Context, db *sql.DB, proposalID, reviewedBy string, committedMemoryID *string) error

AcceptProposal marks a proposal as accepted and optionally records the committed memory ID. The reviewedBy field identifies the parent agent that approved the proposal.

func AgentCanAccessMemory

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

func GrantReadACL

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

func RejectProposal

func RejectProposal(ctx context.Context, db *sql.DB, proposalID, reviewedBy string) error

RejectProposal marks a proposal as rejected. The reviewedBy field identifies the parent agent that rejected the proposal.

func RevokeACL

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

func ValidProposalKind

func ValidProposalKind(k string) bool

ValidProposalKind returns true if k is a recognized proposal kind.

func ValidTier

func ValidTier(t string) bool

func ValidateTierOrErr

func ValidateTierOrErr(raw string) error

Types

type ACLQuery

type ACLQuery = memorypolicy.ACLQuery

type MemoryProposal

type MemoryProposal struct {
	ID                int64           `json:"id"`
	ProposalID        string          `json:"proposal_id"`
	SubtaskID         string          `json:"subtask_id"`
	ChildAgentID      string          `json:"child_agent_id"`
	ParentAgentID     string          `json:"parent_agent_id"`
	ProposedTier      MemoryTier      `json:"proposed_tier"`
	Kind              ProposalKind    `json:"kind"`
	Content           string          `json:"content"`
	EvidenceJSON      json.RawMessage `json:"evidence_json"`
	Status            ProposalStatus  `json:"status"`
	ReviewedBy        *string         `json:"reviewed_by,omitempty"`
	ReviewedAt        *int64          `json:"reviewed_at,omitempty"`
	CommittedMemoryID *string         `json:"committed_memory_id,omitempty"`
	CreatedAt         int64           `json:"created_at"`
}

MemoryProposal represents a child agent's tentative write to durable memory. Children propose; parents review and commit.

func GetProposal

func GetProposal(ctx context.Context, db *sql.DB, proposalID string) (*MemoryProposal, error)

GetProposal fetches a single proposal by its ID.

func ListPendingProposals

func ListPendingProposals(ctx context.Context, db *sql.DB, parentAgentID string) ([]MemoryProposal, error)

ListPendingProposals returns all pending proposals for a given parent agent, ordered by creation time (newest first).

type MemoryTier

type MemoryTier = memorypolicy.Tier

func DefaultTierForSource

func DefaultTierForSource(sourceKind string) MemoryTier

func NormalizeTier

func NormalizeTier(raw string) MemoryTier

func TierHierarchy

func TierHierarchy() []MemoryTier

func TiersReadableBy

func TiersReadableBy(agentTier MemoryTier) []MemoryTier

func TiersWritableBy

func TiersWritableBy(isParent bool) []MemoryTier

type ProposalKind

type ProposalKind string

ProposalKind enumerates the types of memory a child agent can propose.

const (
	KindFact        ProposalKind = "fact"
	KindPreference  ProposalKind = "preference"
	KindDecision    ProposalKind = "decision"
	KindObservation ProposalKind = "observation"
	KindReport      ProposalKind = "report"
	KindArtifact    ProposalKind = "artifact"
)

type ProposalRef

type ProposalRef struct {
	ProposalID    string         `json:"proposal_id"`
	ChildAgentID  string         `json:"child_agent_id"`
	ParentAgentID string         `json:"parent_agent_id"`
	Status        ProposalStatus `json:"status"`
}

ProposalRef is a lightweight handle returned when submitting a proposal.

func SubmitProposal

func SubmitProposal(ctx context.Context, db *sql.DB, subtaskID, childAgentID, parentAgentID, content string, tier MemoryTier, kind ProposalKind, evidence any) (*ProposalRef, error)

SubmitProposal inserts a child agent's memory proposal into the database. The proposal enters "pending" status awaiting parent review. Returns a ProposalRef for the caller to track the submission.

type ProposalStatus

type ProposalStatus string

ProposalStatus tracks the lifecycle state of a memory proposal.

const (
	StatusPending  ProposalStatus = "pending"
	StatusAccepted ProposalStatus = "accepted"
	StatusRejected ProposalStatus = "rejected"
)

Jump to

Keyboard shortcuts

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