Documentation
¶
Overview ¶
Package east implements EAST (Entropy-Activity-Steering-Throttling), the OODA v4 generative/research path. It is an extension to the deterministic core OODA loop (sdk/ooda): callers that want creative/steered generation opt into this package explicitly.
It depends only on the public sdk/ooda surface (CognitiveFrame, EASTState, Atom, TrustTier) and is never imported by the core, sdk, or adapters.
Index ¶
- Variables
- func CalculateActivity(atoms []ooda.Atom) map[string]int
- func CalculateEAST(logicSuccess, entropyCoefficient float64) float64
- func CalculateEntropy(conflictCount, totalRules int) float64
- func CalculateMagnitude(state *ooda.EASTState) float64
- func ClassifyTrustTier(source string) ooda.TrustTier
- func DetectConflicts(context []ooda.Atom, axioms []ooda.Atom) int
- func GetSteeringPrompts(magnitude float64) (headerKey, bodyKey string)
- func IsSaliencyHigh(saliency []string) bool
- func IsSaliencyKnown(saliency []string) bool
- func MeasureSaliency(input string) []string
- func RunOODAEAST(ctx context.Context, frame *ooda.CognitiveFrame) (*ooda.CognitiveFrame, error)
- func ShouldInjectParadox(state *ooda.EASTState) bool
- func Steer(state *ooda.EASTState, frame *ooda.CognitiveFrame) ooda.ExecutionPath
- func SteerKB(ctx context.Context, state *ooda.EASTState, frame *ooda.CognitiveFrame, ...) ooda.ExecutionPath
- func Temperature(state *ooda.EASTState) float64
- func UpdateEntropy(oldEntropy float64, violations, totalRules int) float64
- type SteeringPolicy
Constants ¶
This section is empty.
Variables ¶
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") )
var SteeringRegistry = []SteeringPolicy{
{MinMagnitude: 0.8, HeaderKey: "prompt_header_paradox", BodyKey: "prompt_body_conservative"},
{MinMagnitude: 0.5, HeaderKey: "prompt_header_strict", BodyKey: "prompt_body_structured"},
{MinMagnitude: 0.0, HeaderKey: "prompt_header_default", BodyKey: "prompt_body_creative"},
}
SteeringRegistry holds the tiered policies for guiding LLM behavior under stress. Sorted by MinMagnitude descending; first match where magnitude > MinMagnitude wins.
Functions ¶
func CalculateActivity ¶
CalculateActivity builds a usage map from atoms accessed during Orient.
func CalculateEAST ¶
CalculateEAST computes the Entropic Activation Steering magnitude (P): P = exp(1 - LogicSuccess) / EntropyCoefficient.
func CalculateEntropy ¶
CalculateEntropy computes entropy from conflict count and total rules. Returns 0.0 (no conflicts) to 1.0 (all rules conflicted).
func CalculateMagnitude ¶
CalculateMagnitude computes the steering formula: P = exp(1-L) / N.
func ClassifyTrustTier ¶
ClassifyTrustTier determines the trust tier from the decision source.
func DetectConflicts ¶
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 GetSteeringPrompts ¶
GetSteeringPrompts selects the appropriate prompt templates based on the current EAST magnitude.
func IsSaliencyHigh ¶
IsSaliencyHigh returns true if the saliency signals indicate high priority.
func IsSaliencyKnown ¶
IsSaliencyKnown returns true if the saliency signals include a known pattern.
func MeasureSaliency ¶
MeasureSaliency evaluates input importance based on keyword detection. Returns a list of saliency signals found in the input.
func RunOODAEAST ¶
func RunOODAEAST(ctx context.Context, frame *ooda.CognitiveFrame) (*ooda.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 ShouldInjectParadox ¶
ShouldInjectParadox returns true if steering magnitude exceeds the configured paradox threshold. Falls back to the default (0.8) when unset. Callers should compute magnitude first (see CalculateMagnitude) — order in RunOODAEAST guarantees Magnitude is set before Decide.
func Steer ¶
func Steer(state *ooda.EASTState, frame *ooda.CognitiveFrame) ooda.ExecutionPath
Steer determines the execution path based on EAST metrics.
func SteerKB ¶
func SteerKB(ctx context.Context, state *ooda.EASTState, frame *ooda.CognitiveFrame, reasoner ports.ReasoningPort) ooda.ExecutionPath
SteerKB determines the execution path by querying Datalog rules directly (14-east.dl). Falls back to in-memory Steer if ReasoningPort is nil.
func Temperature ¶
Temperature returns the recommended LLM temperature based on steering magnitude.
func UpdateEntropy ¶
UpdateEntropy adjusts entropy based on validation results. New entropy = old entropy + (violations / total rules).
Types ¶
type SteeringPolicy ¶
SteeringPolicy defines template keys used for prompt assembly when the agent reaches a specific cognitive pressure threshold.