ooda

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMaxContextTokens is the default budget for INT8 context atoms.
	DefaultMaxContextTokens = 24000
	// ShaveThreshold is the minimum weight to keep during context shaving.
	ShaveThreshold = 0.5
)

Variables

View Source
var (
	// ErrT0Violation is returned when a Tier 0 (kernel axiom) violation is detected.
	ErrT0Violation = fmt.Errorf("T0 violation: immediate halt")
	// ErrMaxRefinementIterations is returned when refinement exceeds max iterations.
	ErrMaxRefinementIterations = fmt.Errorf("max refinement iterations exceeded")
	// ErrChaosThreshold is returned when entropy exceeds chaos threshold (0.9).
	ErrChaosThreshold = fmt.Errorf("chaos threshold exceeded: entropy too high")
)

Functions

func AddContext

func AddContext(frame *CognitiveFrame, atom Atom)

AddContext adds a soft fact to the Context (INT8). Weight can be 0.1-0.9. Low-weight atoms are prunable.

func CalculateActivity

func CalculateActivity(atoms []Atom) map[string]int

CalculateActivity builds a usage map from atoms accessed during Orient.

func CalculateEntropy

func CalculateEntropy(conflictCount, totalRules int) float64

CalculateEntropy computes entropy from conflict count and total rules. Returns 0.0 (no conflicts) to 1.0 (all rules conflicted).

func DetectConflicts

func DetectConflicts(context []Atom, axioms []Atom) int

DetectConflicts counts atoms that contradict AttentionSink axioms. A conflict occurs when an atom with Weight < 0.5 contradicts an axiom with Weight = 1.0.

func EstimateTotalTokens

func EstimateTotalTokens(frame *CognitiveFrame) int

EstimateTotalTokens estimates total token count for the frame.

func IsSaliencyHigh

func IsSaliencyHigh(saliency []string) bool

IsSaliencyHigh returns true if the saliency signals indicate high priority.

func IsSaliencyKnown

func IsSaliencyKnown(saliency []string) bool

IsSaliencyKnown returns true if the saliency signals include a known pattern.

func MeasureSaliency

func MeasureSaliency(input string) []string

MeasureSaliency evaluates input importance based on keyword detection. Returns a list of saliency signals found in the input.

func PinAxiom

func PinAxiom(frame *CognitiveFrame, atom Atom)

PinAxiom adds an immutable axiom to the AttentionSink (FP32). Axioms are never pruned and are pinned at the top of LLM prompts.

func PruneColdAtoms

func PruneColdAtoms(frame *CognitiveFrame, activity map[string]int)

PruneColdAtoms removes atoms with access count <= 1 and weight < 0.5.

func ShaveContext

func ShaveContext(frame *CognitiveFrame, maxTokens int)

ShaveContext removes low-weight atoms when context exceeds the token budget. Atoms with Weight < ShaveThreshold are dropped first, then sorted by weight descending.

func ShouldTerminate

func ShouldTerminate(audit *AuditResult, retryCount, maxRetries int, entropy float64) string

ShouldTerminate checks if the refinement loop should terminate. Returns the termination reason if any, or empty string to continue.

func UpdateEntropy

func UpdateEntropy(oldEntropy float64, violations, totalRules int) float64

UpdateEntropy adjusts entropy based on validation results. New entropy = old entropy + (violations / total rules).

func VerifySchema

func VerifySchema(ctx context.Context, frame *CognitiveFrame) error

VerifySchema checks if the action result matches the expected output_schema. This is the OODA mode (tools) post-Act validation.

Types

type ActionEnvelope

type ActionEnvelope struct {
	Name      string                 `json:"name"`
	Arguments map[string]interface{} `json:"arguments"`
}

ActionEnvelope contains the action to be executed and its parameters.

func NewActionEnvelope

func NewActionEnvelope(name string, args map[string]interface{}) *ActionEnvelope

NewActionEnvelope creates a new ActionEnvelope.

func (*ActionEnvelope) String

func (e *ActionEnvelope) String() string

String returns a string representation of the action envelope.

type Actor

type Actor interface {
	Act(ctx context.Context, frame *CognitiveFrame) error
}

Actor defines the capability to generate the final artifacts or side-effects.

type Atom

type Atom struct {
	Predicate    string    `json:"predicate"`
	Subject      string    `json:"subject"`
	Object       string    `json:"object"`
	Weight       float64   `json:"weight"` // 1.0 (Fact) to 0.1 (Guess)
	OriginIntent IntentStr `json:"origin_intent,omitempty"`
}

Atom is the smallest unit of knowledge in Manglekit's streaming architecture

func GetAttentionSink

func GetAttentionSink(frame *CognitiveFrame) []Atom

GetAttentionSink returns all AttentionSink atoms (FP32, immutable).

func GetContext

func GetContext(frame *CognitiveFrame) []Atom

GetContext returns all Context atoms (INT8, pruneable).

type AuditResult

type AuditResult struct {
	Pass          bool      `json:"pass"`
	ViolationTier TrustTier `json:"violation_tier"` // Which tier was violated
	TierID        string    `json:"tier_id"`
	ConflictPath  string    `json:"conflict_path"` // "safety.dl:42"
	ProofTree     any       `json:"proof_tree"`    // "Why" it failed
	EntropyDelta  float64   `json:"entropy_delta"` // Feedback for EAST
}

AuditResult represents the verification trace produced by the ReasoningPort

func TieredVerify

func TieredVerify(ctx context.Context, frame *CognitiveFrame) (*AuditResult, error)

TieredVerify evaluates rules by trust tier (T0-T3). T0 violations → HALT, T1 → RETRY, T2 → WARNING, T3 → IGNORE.

func ValidateAgainstRules

func ValidateAgainstRules(ctx context.Context, frame *CognitiveFrame) (*AuditResult, error)

ValidateAgainstRules performs Datalog-backed validation of the action result. This is the OODA+EAST mode (generation) post-Act validation. Returns the AuditResult with violation tier and matched rules.

type Brain

type Brain interface {
	// Evaluate makes a decision based on the input and context.
	// Returns a Decision with AuditTrail explaining which rules were matched.
	Evaluate(ctx context.Context, frame *CognitiveFrame) (*core.Decision, error)

	// Verify validates an action result against policy requirements.
	Verify(ctx context.Context, frame *CognitiveFrame) (*core.AuditTrail, error)

	// LoadPolicy loads additional policy rules.
	LoadPolicy(ctx context.Context, rules string) error
}

Brain defines the interface for policy evaluation and decision making. It wraps the Manglekit PolicyEngine.

type Builder

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

Builder provides a fluent API for constructing a CognitiveFrame with components.

func NewBuilder

func NewBuilder() *Builder

NewBuilder creates a new Builder for constructing a CognitiveFrame.

func (*Builder) Build

func (b *Builder) Build() *CognitiveFrame

Build constructs the final CognitiveFrame.

func (*Builder) WithBrain

func (b *Builder) WithBrain(brain Brain) *Builder

WithBrain sets the Brain component for the frame.

func (*Builder) WithDispatcher

func (b *Builder) WithDispatcher(dispatcher *Dispatcher) *Builder

WithDispatcher sets the Dispatcher for action mapping.

func (*Builder) WithExecutor

func (b *Builder) WithExecutor(executor Executor) *Builder

WithExecutor sets the Executor component for the frame.

func (*Builder) WithGraphID

func (b *Builder) WithGraphID(graphID string) *Builder

WithGraphID sets the MEB graph scope for this epoch.

func (*Builder) WithInput

func (b *Builder) WithInput(input string) *Builder

WithInput sets the input for the frame.

func (*Builder) WithIntent

func (b *Builder) WithIntent(intent IntentStr) *Builder

WithIntent sets the intent for the frame.

func (*Builder) WithKBVersion

func (b *Builder) WithKBVersion(version string) *Builder

WithKBVersion sets the cache invalidation token for knowledge base versioning.

func (*Builder) WithMaxRetries

func (b *Builder) WithMaxRetries(maxRetries int) *Builder

WithMaxRetries sets the max retries for the frame.

func (*Builder) WithMemory

func (b *Builder) WithMemory(memory Memory) *Builder

WithMemory sets the Memory component for the frame.

func (*Builder) WithRegistry

func (b *Builder) WithRegistry(registry *Registry) *Builder

WithRegistry sets the Registry and creates a Dispatcher.

func (*Builder) WithSessionID

func (b *Builder) WithSessionID(sessionID string) *Builder

WithSessionID sets the session ID for workflow continuity.

func (*Builder) WithTaskType

func (b *Builder) WithTaskType(taskType TaskType) *Builder

WithTaskType sets the task type for the frame.

func (*Builder) WithTimeout

func (b *Builder) WithTimeout(timeout time.Duration) *Builder

WithTimeout sets the timeout for the frame.

func (*Builder) WithTraceID

func (b *Builder) WithTraceID(traceID string) *Builder

WithTraceID sets the trace ID for the frame.

func (*Builder) WithWorkflowID

func (b *Builder) WithWorkflowID(workflowID string) *Builder

WithWorkflowID sets the workflow ID for execution.

func (*Builder) WithWorkflowInstance

func (b *Builder) WithWorkflowInstance(instance *core.WorkflowInstance) *Builder

WithWorkflowInstance sets the workflow instance for stateful execution.

type CognitiveFrame

type CognitiveFrame struct {
	ID        uuid.UUID
	Timestamp time.Time
	Intent    IntentStr
	Phase     Phase

	// Task Metadata
	TaskType   TaskType
	OutputType OutputType

	// Input Stimulus
	Input string

	// Memory & Logic
	Context       []Atom         // Soft Logic (INT8) - Observed facts, pruneable
	AttentionSink []Atom         // Hard Logic (FP32) - Immutable Axioms (Tier 0), never pruned
	ActiveGenes   []DomainGene   // Logic Pinning - crystallized rules for this epoch
	RawContext    map[string]any // Legacy escape hatch for transitional state

	// Knowledge Scope
	GraphID   string // MEB graph scope for this epoch
	KBVersion string // Cache invalidation token

	// Reasoning
	Draft  any          // Neural proposal: *Plan for PLAN output, []byte for RULE output
	Proof  *AuditResult // Verification trace
	Status VerifyStatus

	// Telemetry
	TraceID        string
	SessionHistory []AuditResult
	EAST           EASTState

	// Staging
	IsProposal bool

	// === NEW: OODA Chassis Fields ===
	// Components (set via Builder)
	Memory     Memory      `json:"-"` // Memory interface for Recall/Commit
	Brain      Brain       `json:"-"` // Brain interface for Evaluate/Verify
	Executor   Executor    `json:"-"` // Legacy executor interface (deprecated, use Dispatcher)
	Dispatcher *Dispatcher `json:"-"` // Action dispatcher for mapping decisions to tools

	// Execution State
	Decision     *core.Decision   // Decision from Brain
	AuditTrail   *core.AuditTrail // Audit trail from evaluation
	ActionResult any              // Result from Executor or Dispatcher

	// Session State (for workflow integration)
	SessionID        string                 // Session identifier for workflow continuity
	WorkflowID       string                 // Current workflow being executed
	WorkflowInstance *core.WorkflowInstance // Current workflow instance state

	// === Dual Memory Architecture ===
	// Long-term Memory: MEB-backed knowledge store (persistent across sessions)
	KnowledgeStore ports.KnowledgeStore `json:"-"`
	// Transient Memory: Session store (transient, RAM-only) for coordination facts
	TransientStore ports.TransientStore `json:"-"`
	// Reasoning Port: For KB-backed EAST steering (14-east.dl)
	ReasoningPort ports.ReasoningPort `json:"-"`

	// Configuration
	MaxRetries int           `json:"max_retries"`
	Timeout    time.Duration `json:"timeout"`

	// Middleware configuration for LLM-based actions.
	// When set, these options are passed to the TextGenerator during Act phase.
	GenerateOptions []core.GenerateOption `json:"-"`

	// Metrics
	RetryCount     int                     `json:"retry_count"`
	PhaseDurations map[Phase]time.Duration `json:"phase_durations"`
}

CognitiveFrame is the complete state of a single reasoning epoch. It replaces the generic loosely typed `State` from earlier versions.

func NewCognitiveFrame

func NewCognitiveFrame(input string, intent IntentStr, taskType TaskType) *CognitiveFrame

NewCognitiveFrame initializes a fresh cognitive epoch. Use NewBuilder() for a fluent API to set Memory, Brain, and Executor.

func Run

func Run(ctx context.Context, frame *CognitiveFrame) (*CognitiveFrame, error)

Run executes the full OODA loop: 1. Observe - Capture raw input 2. Orient - Hydrate context from Memory 3. Decide - Evaluate with Brain (returns Decision + AuditTrail) 4. Act - Execute the action 5. Verify - Post-act validation

func RunOODA

func RunOODA(ctx context.Context, frame *CognitiveFrame) (*CognitiveFrame, error)

RunOODA executes the OODA loop for deterministic tool execution. No EAST steering. No entropy measurement. Simple and fast.

Flow: Observe → Orient → Decide → Act → Verify(schema) → Commit

Security gates at every phase boundary:

  • Observe: input validation (input_rule, injection_pattern)
  • Orient: tool lookup + authorization (tool_authorization, tool_pattern)
  • Decide: Datalog policy evaluation (Brain.Evaluate with AuditTrail)
  • Act: tool execution with simple retry
  • Verify: output schema check (output_schema)

func RunOODAEAST

func RunOODAEAST(ctx context.Context, frame *CognitiveFrame) (*CognitiveFrame, error)

RunOODAEAST executes the OODA loop with EAST steering for generation tasks. Includes entropy measurement, fast-path routing, Datalog validation, and Teacher-Student retry.

Flow: Observe → Orient → Plan → [EAST routes] → Decide(opt) → Act → Validate + EAST post-act

EAST post-act behaviors:

  • Validate: Datalog rule check (quality_gate, validation_rule, generic_pattern)
  • Route: E decides HALT/RETRY/ACCEPT
  • Retry: Teacher-Student loop with feedback injection (max 3)

func (*CognitiveFrame) GetAuditSummary

func (f *CognitiveFrame) GetAuditSummary() string

GetAuditSummary returns a human-readable summary of the audit trail

func (*CognitiveFrame) GetPhaseDurations

func (f *CognitiveFrame) GetPhaseDurations() map[Phase]time.Duration

GetPhaseDurations returns a map of phase to duration

func (*CognitiveFrame) TotalDuration

func (f *CognitiveFrame) TotalDuration() time.Duration

TotalDuration returns the total execution time

type Decider

type Decider interface {
	Decide(ctx context.Context, frame *CognitiveFrame) error
}

Decider defines the capability to formulate a plan or structure based on observation and orientation.

type Dispatcher

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

Dispatcher executes actions from the registry based on Decision.

func NewDispatcher

func NewDispatcher(registry *Registry) *Dispatcher

NewDispatcher creates a new dispatcher with the given registry.

func (*Dispatcher) Dispatch

func (d *Dispatcher) Dispatch(ctx context.Context, actionName string, args map[string]interface{}) (string, error)

Dispatch executes an action based on the action name and arguments. If the action is not found, it logs a "Sovereign/Capability Mismatch" and calls SafeStop.

func (*Dispatcher) WithFallback

func (d *Dispatcher) WithFallback(fn ToolFunc) *Dispatcher

WithFallback sets a fallback function to be called when an action is not found.

type DomainGene

type DomainGene struct {
	Name         string    `json:"name"`
	Tier         TrustTier `json:"tier"`
	TierID       string    `json:"tier_id"`
	Rules        []byte    `json:"rules"`     // Compiled Datalog content
	Signature    [32]byte  `json:"signature"` // SHA256 integrity hash
	MMapAddr     uintptr   `json:"-"`         // Zero-copy mmap pointer
	Capabilities []string  `json:"capabilities"`
	Intents      []string  `json:"intents"`
	FactPath     string    `json:"fact_path,omitempty"`
	SourcePath   string    `json:"source_path,omitempty"`
	IsUnverified bool      `json:"is_unverified"`
}

DomainGene is a crystallized unit of Datalog logic with trust tiering

type EASTState

type EASTState struct {
	LogicSuccess       float64        `json:"logic_success"`       // L (0.0 - 1.0)
	EntropyCoefficient float64        `json:"entropy_coefficient"` // N (Novelty)
	SteeringMagnitude  float64        `json:"steering_magnitude"`  // P = exp(1-L) / N
	Entropy            float64        `json:"entropy"`             // E: 0.0 (stable) to 1.0 (chaotic)
	Activity           map[string]int `json:"activity"`            // A: fact/rule usage counts
	Saliency           []string       `json:"saliency"`            // S: prioritized input signals
	TrustTier          TrustTier      `json:"trust_tier"`          // T: T0 to T3
}

EASTState tracks the cognitive pressure metrics for steering. E = Entropy (conflict), A = Activity (hot atoms), S = Saliency (input importance), T = Trust (source tier)

func (*EASTState) CalculateMagnitude

func (e *EASTState) CalculateMagnitude() float64

CalculateMagnitude computes the steering formula: P = exp(1-L) / N

func (*EASTState) ShouldInjectParadox

func (e *EASTState) ShouldInjectParadox() bool

ShouldInjectParadox returns true if steering magnitude exceeds paradox threshold (0.8).

func (*EASTState) Steer

func (e *EASTState) Steer(frame *CognitiveFrame) ExecutionPath

Steer determines the execution path based on EAST metrics.

func (*EASTState) SteerKB

func (e *EASTState) SteerKB(ctx context.Context, frame *CognitiveFrame, reasoner ports.ReasoningPort) ExecutionPath

SteerKB determines the execution path by querying Datalog rules directly (14-east.dl). Falls back to in-memory Steer() if ReasoningPort is nil or query fails.

func (*EASTState) Temperature

func (e *EASTState) Temperature() float64

Temperature returns the recommended LLM temperature based on steering magnitude.

type ExecutionObject

type ExecutionObject struct {
	AttentionSink []Atom       // FP32 — immutable Tier 0 axioms, never pruned
	Context       []Atom       // INT8 — observed facts from MEB, prunable
	ActiveRules   []DomainGene // Datalog rules active for this epoch
	EAST          EASTState    // Steering state computed during Orient
	GraphID       string       // MEB graph scope for this epoch
	KBVersion     string       // Cache invalidation token
}

ExecutionObject is the unified output of the ORIENT phase. It synthesizes all knowledge the OODA epoch needs into a single inspectable struct.

func NewExecutionObject

func NewExecutionObject(frame *CognitiveFrame) *ExecutionObject

NewExecutionObject builds an ExecutionObject from a CognitiveFrame after Orient completes.

type ExecutionPath

type ExecutionPath int

ExecutionPath represents the routing decision from EAST steering

const (
	PathFast     ExecutionPath = iota // Orient → Act (skip Decide)
	PathStandard                      // Orient → Decide → Act
	PathSlow                          // Orient → Decide → Act → Validate → Retry
)

type Executor

type Executor interface {
	// Execute performs the action selected by the Brain.
	// Returns the result of the execution.
	Execute(ctx context.Context, frame *CognitiveFrame, decision *core.Decision) (any, error)

	// Rollback reverses a previous execution if needed.
	Rollback(ctx context.Context, frame *CognitiveFrame, result any) error
}

Executor defines the interface for executing actions. It handles the actual work of the chosen action.

type IntentStr

type IntentStr string

IntentStr represents the goal or objective of the execution

type Loop

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

Loop manages the OODA loop execution sequence. It orchestrates Observer, Orienter, Decider, Verifier, and Actor capabilities.

func NewLoop

func NewLoop(observer Observer, orienter Orienter, decider Decider, verifier Verifier, actor Actor) *Loop

NewLoop creates a new Loop engine.

func (*Loop) Run

func (l *Loop) Run(ctx context.Context, input string, initialFrame *CognitiveFrame) (*CognitiveFrame, error)

Run executes the full OODA sequence with the provided CognitiveFrame. If the frame is nil, a new one is instantiated from the input.

type Memory

type Memory interface {
	// Recall retrieves relevant context from memory based on the input.
	// This is called during the Orient phase to hydrate the frame with facts.
	Recall(ctx context.Context, input string) ([]Atom, error)

	// Commit stores the results of an action back into memory.
	// This is called after the Act phase to persist the outcome.
	Commit(ctx context.Context, frame *CognitiveFrame) error

	// Store stores a single atom into memory.
	Store(ctx context.Context, atom Atom) error

	// Query retrieves atoms matching a predicate pattern.
	Query(ctx context.Context, predicate string) ([]Atom, error)
}

Memory defines the interface for storing and retrieving context. It represents the "Memory" component of the OODA loop.

type Observer

type Observer interface {
	Observe(ctx context.Context, frame *CognitiveFrame) error
}

Observer defines the capability to analyze, classify, and normalize raw inputs.

type Orienter

type Orienter interface {
	Orient(ctx context.Context, frame *CognitiveFrame) error
}

Orienter defines the capability to retrieve domain context, rules, or historical knowledge.

type OutputType

type OutputType string

OutputType represents what the generative port should produce

const (
	OutputTypePlan OutputType = "PLAN" // Structured JSON or Markdown
	OutputTypeRule OutputType = "RULE" // Datalog logic rules for crystallization
)

type Phase

type Phase string

Phase represents the phases in the OODA loop

const (
	PhaseObserve Phase = "observe"
	PhaseOrient  Phase = "orient"
	PhasePlan    Phase = "plan" // Planning phase (between Orient and Decide)
	PhaseDecide  Phase = "decide"
	PhaseVerify  Phase = "verify"
	PhaseAct     Phase = "act"
	PhasePostAct Phase = "post_act" // EAST post-act behaviors (validate + route)
)

type Planner

type Planner interface {
	Plan(ctx context.Context, frame *CognitiveFrame) error
}

Planner defines the capability to create an explicit plan before deciding. It executes structured planning steps and produces a PlanningResult.

type RefinementContext

type RefinementContext struct {
	FailedRules   []string
	ConflictPath  string
	PreviousDraft any
	AttemptNumber int
}

BuildFeedback creates a RefinementContext from audit failures.

func NewRefinementContext

func NewRefinementContext(audit *AuditResult, draft any, attempt int) *RefinementContext

NewRefinementContext builds feedback for the Teacher-Student loop.

type Registry

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

Registry maps action names to executable Go functions. This decouples Manglekit's logical decisions from their Go implementations.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new empty action registry.

func (*Registry) Execute

func (r *Registry) Execute(ctx context.Context, name string, args map[string]interface{}) (string, error)

Execute looks up and executes a tool by name. Returns an error if the tool is not found.

func (*Registry) Get

func (r *Registry) Get(name string) ToolFunc

Get retrieves a tool by name. Returns nil if not found.

func (*Registry) Has

func (r *Registry) Has(name string) bool

Has checks if a tool is registered.

func (*Registry) List

func (r *Registry) List() []string

List returns all registered tool names.

func (*Registry) MustRegister

func (r *Registry) MustRegister(name string, fn ToolFunc)

MustRegister registers a tool and panics on error. Useful for initialization code.

func (*Registry) Register

func (r *Registry) Register(name string, fn ToolFunc) error

Register adds a new tool to the registry. Returns an error if a tool with the same name is already registered.

func (*Registry) Unregister

func (r *Registry) Unregister(name string)

Unregister removes a tool from the registry.

type TaskType

type TaskType string

TaskType represents the operational mode for this epoch

const (
	TaskTypeInduction  TaskType = "INDUCTION"  // Learning from raw input
	TaskTypeGeneration TaskType = "GENERATION" // Creating structured output
	TaskTypeAudit      TaskType = "AUDIT"      // System verification
	TaskTypeRecovery   TaskType = "RECOVERY"   // Error remediation
)

type ToolFunc

type ToolFunc func(ctx context.Context, args map[string]interface{}) (string, error)

ToolFunc is the function signature for executable tools. Each tool receives a context and arguments, and returns a result or error.

var SafeStop ToolFunc = func(ctx context.Context, args map[string]interface{}) (string, error) {
	return "STOPPED: SafeStop invoked due to undefined action or high-risk state", nil
}

SafeStop is a mandatory safety fallback tool that is called when the system enters an undefined or high-risk state.

type TrustTier

type TrustTier string

TrustTier represents the 4-level system of logical axiom trust

const (
	Tier0Kernel TrustTier = "TIER_0" // Immutable Core Axioms (Hard Logic - FP32)
	Tier1Admin  TrustTier = "TIER_1" // Human Operator / Governance
	Tier2AI     TrustTier = "TIER_2" // Induced / Learned Logic (Soft Logic - INT8)
	Tier3User   TrustTier = "TIER_3" // Untrusted External Input
)

func ClassifyTrustTier

func ClassifyTrustTier(source string) TrustTier

ClassifyTrustTier determines the trust tier from the decision source.

type ValidationError

type ValidationError struct {
	RuleName     string
	Tier         TrustTier
	Message      string
	ConflictPath string
}

ValidationError represents a validation failure with tier information.

func (*ValidationError) Error

func (e *ValidationError) Error() string

type Verifier

type Verifier interface {
	Verify(ctx context.Context, frame *CognitiveFrame) error
}

Verifier defines the capability to validate the proposed plan before execution.

type VerifyStatus

type VerifyStatus string

VerifyStatus represents the result of the Datalog verification bridge

const (
	VerifyStatusPending VerifyStatus = "PENDING"
	VerifyStatusPassed  VerifyStatus = "FP32_PASSED"     // Hard logic passed
	VerifyStatusFailed  VerifyStatus = "LOGIC_VIOLATION" // Critical failure, halts
	VerifyStatusWarning VerifyStatus = "WARNING"         // Soft logic warning, continues
)

Jump to

Keyboard shortcuts

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