cognitive

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package cognitive defines persona cognitive settings and trusted operational observations. Persona phases remain descriptive unless the host opts into the bounded reflection controller with explicit supported strategies.

Index

Constants

View Source
const CalibrationMeasured = "measured_cohort"

CalibrationMeasured identifies a measurement authenticated by the host's evaluation adapter. You must never decode this authority from model output.

View Source
const ExtractiveHistoryRevision = "extractive-history-v1"

ExtractiveHistoryRevision pins deterministic literal extraction and rendering.

Variables

View Source
var (
	// ErrInvalidReflection rejects incomplete or unbounded controller inputs.
	ErrInvalidReflection = errors.New("cortex: invalid reflection")
	// ErrReflectionConflict rejects stale decisions and changed immutable policy.
	ErrReflectionConflict = errors.New("cortex: reflection conflict")
	// ErrUnsupportedReflection rejects actions without a controlled runtime route.
	ErrUnsupportedReflection = errors.New("cortex: unsupported reflection strategy or action")
)
View Source
var ErrContextBudgetExceeded = errors.New("cortex: required context exceeds budget")

ErrContextBudgetExceeded requires retrieval, a larger context or escalation. No partial selection is returned when required context cannot fit.

View Source
var ErrInvalidCalibration = errors.New("cortex: invalid calibration observation")

ErrInvalidCalibration rejects malformed measurements or compatibility pins.

View Source
var ErrInvalidContext = errors.New("cortex: invalid context selection")

ErrInvalidContext rejects incomplete, malformed or unbounded selection inputs.

View Source
var ErrInvalidSnapshot = errors.New("cortex: invalid cognitive snapshot")

ErrInvalidSnapshot rejects malformed or unbounded runtime observations.

Functions

func ContextHistoryDigest

func ContextHistoryDigest(messages []llm.Message) (string, error)

ContextHistoryDigest binds up to 4096 text messages in a one-MiB projection. Empty and absent histories have the same canonical identity.

func HistoryGroups

func HistoryGroups(messages []llm.Message) ([][]llm.Message, error)

HistoryGroups returns detached turns, starting a new group at each user message. Conversation data cannot inject system, developer or tool roles. The engine's saved history is a text projection; tool traces live separately.

Types

type Assumption

type Assumption struct {
	Key      string           `json:"key"`
	Summary  string           `json:"summary"`
	Origin   AssumptionOrigin `json:"origin"`
	State    AssumptionState  `json:"state"`
	Evidence []evidence.Ref   `json:"evidence,omitempty"`
}

Assumption retains a short claim and references, not private reasoning. Only authenticated host observations may support or dispute a claim. The caller must verify that the referenced bytes actually support the stated transition.

type AssumptionOrigin

type AssumptionOrigin string

AssumptionOrigin distinguishes hypotheses from authenticated observations.

const (
	AssumptionModel AssumptionOrigin = "model"
	AssumptionHost  AssumptionOrigin = "host"
)

type AssumptionState

type AssumptionState string

AssumptionState never establishes task acceptance or execution authority.

const (
	AssumptionUnresolved AssumptionState = "unresolved"
	AssumptionSupported  AssumptionState = "supported"
	AssumptionDisputed   AssumptionState = "disputed"
)

type CalibrationBinding

type CalibrationBinding struct {
	Scope               cortex.Scope      `json:"scope"`
	TaskClass           string            `json:"task_class"`
	ProviderRevision    string            `json:"provider_revision"`
	ModelRevision       string            `json:"model_revision"`
	PromptRevision      string            `json:"prompt_revision"`
	ControllerRevision  string            `json:"controller_revision"`
	PolicyRevision      string            `json:"policy_revision"`
	EnvironmentRevision string            `json:"environment_revision"`
	AcceptanceDigest    string            `json:"acceptance_digest"`
	Tools               []CalibrationTool `json:"tools"`
}

CalibrationBinding identifies the configuration and task covered by a cohort. Revisions must identify immutable configurations, including provider settings. AcceptanceDigest pins the frozen success criteria used for evaluation.

func (CalibrationBinding) Validate

func (b CalibrationBinding) Validate() error

Validate rejects absent pins and duplicate tool names. An empty tool set is a complete configuration for tasks that use no tools; blank tool pins are invalid.

type CalibrationInterval

type CalibrationInterval struct {
	Kind           string  `json:"kind"`
	Lower          float64 `json:"lower"`
	Upper          float64 `json:"upper"`
	Level          float64 `json:"level"`
	MethodRevision string  `json:"method_revision"`
}

CalibrationInterval preserves uncertainty computed by the evaluation service. Kind identifies confidence or credible intervals; Level is their coverage. Cortex validates bounds and retains the method revision without recalculating it.

type CalibrationObservation

type CalibrationObservation struct {
	Origin     string
	ObservedAt time.Time
	Profile    CalibrationProfile
	Revoked    bool
	Leaked     bool
}

CalibrationObservation comes from a trusted, scoped evaluation adapter. That adapter authenticates the producer, checks artifact availability and current revocation, and attests that the profile matches its immutable evidence bytes. A digest alone cannot establish those facts. Neither models nor recalled lessons may supply this observation. Leaked includes known contamination even when discovery and holdout content hashes differ.

type CalibrationPolicy

type CalibrationPolicy struct {
	MinimumTrials int
	MaxAge        time.Duration
}

CalibrationPolicy applies host-defined eligibility bounds to measurements. MinimumTrials counts resolved trials with successful or failed task verdicts. Missing results and evaluator failures stay in the profile's total denominator.

type CalibrationProfile

type CalibrationProfile struct {
	SchemaVersion     int                 `json:"schema_version"`
	Revision          string              `json:"revision"`
	EvaluatorRevision string              `json:"evaluator_revision"`
	Evidence          evidence.Ref        `json:"evidence"`
	Binding           CalibrationBinding  `json:"binding"`
	DatasetDigest     string              `json:"dataset_digest"`
	DiscoveryItems    []string            `json:"discovery_items"`
	HoldoutItems      []string            `json:"holdout_items"`
	WindowStart       time.Time           `json:"window_start"`
	WindowEnd         time.Time           `json:"window_end"`
	ExpiresAt         time.Time           `json:"expires_at"`
	Trials            int                 `json:"trials"`
	Successes         int                 `json:"successes"`
	Failures          int                 `json:"failures"`
	Missing           int                 `json:"missing"`
	GraderErrors      int                 `json:"grader_errors"`
	Cancelled         int                 `json:"cancelled"`
	Estimate          float64             `json:"estimate"`
	Uncertainty       CalibrationInterval `json:"uncertainty"`
}

CalibrationProfile references a versioned evaluation cohort. Counts partition all planned trials, including missing results, grader errors and cancellations. Estimate is the evaluator's measured task success, never a model self-score. DiscoveryItems and HoldoutItems identify exact dataset items by content digest.

func (CalibrationProfile) Validate

func (p CalibrationProfile) Validate() error

Validate checks structure and count conservation. You still need an authenticated adapter to establish measurement provenance and split integrity.

type CalibrationTool

type CalibrationTool struct {
	Name     string `json:"name"`
	Revision string `json:"revision"`
}

CalibrationTool pins a tool implementation in a measured configuration.

type Capability

type Capability struct {
	Name     string          `json:"name"`
	Revision string          `json:"revision,omitempty"`
	Kind     ToolKind        `json:"kind"`
	State    CapabilityState `json:"state"`
	Health   Health          `json:"health"`
}

Capability is one observed tool. It confers no permission to execute a call.

type CapabilityState

type CapabilityState string

CapabilityState distinguishes request eligibility from missing resources or grants.

const (
	CapabilityRequestable        CapabilityState = "requestable"
	CapabilityUnavailable        CapabilityState = "unavailable"
	CapabilityDenied             CapabilityState = "permission_denied"
	CapabilityServiceUnavailable CapabilityState = "service_unavailable"
	CapabilityBudgetExhausted    CapabilityState = "budget_exhausted"
)

Requestable still requires argument-level authorization, budget and approval checks.

type ContextInput

type ContextInput struct {
	FixedTokens int           `json:"fixed_tokens"`
	Items       []ContextItem `json:"items"`
}

ContextInput lists atomic items oldest first. FixedTokens accounts for system instructions, tools and request framing that are never eligible for omission.

type ContextItem

type ContextItem struct {
	Key         string          `json:"key"`
	Kind        ContextKind     `json:"kind"`
	Origin      ContextOrigin   `json:"origin"`
	Source      ContextSource   `json:"source"`
	Sources     []ContextSource `json:"sources,omitempty"`
	Uncertainty string          `json:"uncertainty,omitempty"`
	Tokens      int             `json:"tokens"`
	Optional    bool            `json:"optional,omitempty"`
}

ContextItem describes one indivisible unit, such as a complete conversation turn. The host must group dependent messages together and supply measured costs. Sources and Uncertainty preserve a summary's references and qualifications; this selector neither produces summaries nor verifies their semantic fidelity.

type ContextKind

type ContextKind string

ContextKind describes an item's purpose. Classification comes from the host.

const (
	ContextObjective   ContextKind = "objective"
	ContextConstraint  ContextKind = "constraint"
	ContextAcceptance  ContextKind = "acceptance"
	ContextPlan        ContextKind = "plan"
	ContextBlocker     ContextKind = "blocker"
	ContextHistory     ContextKind = "history"
	ContextObservation ContextKind = "observation"
	ContextSummary     ContextKind = "summary"
)

Task requirements are always pinned. Other items are pinned unless the host explicitly makes them optional; Cortex does not infer importance from text.

type ContextOrigin

type ContextOrigin string

ContextOrigin records who supplied material. It is not a model message role.

const (
	ContextHost         ContextOrigin = "host"
	ContextConversation ContextOrigin = "conversation"
	ContextRetrieved    ContextOrigin = "retrieved"
	ContextGenerated    ContextOrigin = "generated"
)

Host classifications must come from trusted application code. Never decode host authority or optional flags directly from model or retrieved content.

type ContextPolicy

type ContextPolicy struct {
	Summary         HistorySummaryPolicy `json:"summary,omitzero"`
	Revision        string               `json:"revision"`
	CounterRevision string               `json:"counter_revision"`
	MaxTokens       int                  `json:"max_tokens"`
	ReservedTokens  int                  `json:"reserved_tokens"`
}

ContextPolicy reserves room for output and selects within a finite window. Revisions identify the trusted classification and token-counting implementations. Costs are supplied by the host. Before provider dispatch, the caller must count the complete assembled request to check framing and nonadditive tokenization.

func (ContextPolicy) Select

Select retains every required item, then considers optional items newest first. Selection never rewrites content, merges conflicting observations, elevates an origin or removes source references. The caller owns scoped source retrieval, publication screening, persistence and model-message construction.

type ContextRecord

type ContextRecord struct {
	Summary        *HistorySummary  `json:"summary,omitempty"`
	SchemaVersion  int              `json:"schema_version"`
	Policy         ContextPolicy    `json:"policy"`
	Input          ContextInput     `json:"input"`
	Selection      ContextSelection `json:"selection"`
	OriginalDigest string           `json:"original_digest"`
	SelectedDigest string           `json:"selected_digest"`
	FixedDigest    string           `json:"fixed_digest"`
}

ContextRecord preserves the initial selection without storing conversation text in run metadata. Original history belongs in private verification evidence.

func (ContextRecord) Validate

func (r ContextRecord) Validate() error

Validate checks the bounded deterministic selection and its content identities. It does not establish token-counter accuracy or source availability.

func (ContextRecord) ValidateHistory

func (r ContextRecord) ValidateHistory(original, selected []llm.Message) error

ValidateHistory proves that selected history consists exactly of the retained original groups, with their recorded digests and order.

type ContextSelection

type ContextSelection struct {
	PolicyRevision  string        `json:"policy_revision"`
	CounterRevision string        `json:"counter_revision"`
	Retained        []ContextItem `json:"retained"`
	Omitted         []ContextItem `json:"omitted"`
	InputTokens     int           `json:"input_tokens"`
	RemainingTokens int           `json:"remaining_tokens"`
}

ContextSelection preserves order and source metadata in detached slices. RemainingTokens excludes reserved output tokens. Omitted items are an audit record for the host; do not append them to the model request without recounting.

type ContextSource

type ContextSource struct {
	Reference string `json:"reference"`
	Digest    string `json:"digest"`
}

ContextSource identifies immutable source bytes without exposing their content. A digest proves identity, not truth, authorization, freshness or availability.

type Health

type Health string

Health is an observed service condition. Registration alone leaves it unknown.

const (
	HealthUnknown     Health = "unknown"
	HealthHealthy     Health = "healthy"
	HealthUnavailable Health = "unavailable"
)

Health values do not guarantee that a future call will succeed.

type HistoryExcerpt

type HistoryExcerpt struct {
	Group         int           `json:"group"`
	Message       int           `json:"message"`
	Role          string        `json:"role"`
	GroupDigest   string        `json:"group_digest"`
	ContentDigest string        `json:"content_digest"`
	ContentBytes  int           `json:"content_bytes"`
	Spans         []HistorySpan `json:"spans"`
}

HistoryExcerpt identifies source content without retaining text in run metadata.

type HistorySpan

type HistorySpan struct {
	Start  int    `json:"start"`
	End    int    `json:"end"`
	Digest string `json:"digest"`
}

HistorySpan binds one exact UTF-8 byte range inside a source message.

type HistorySummary

type HistorySummary struct {
	Policy          HistorySummaryPolicy `json:"policy"`
	Excerpts        []HistoryExcerpt     `json:"excerpts"`
	Truncated       bool                 `json:"truncated"`
	OmittedBytes    int                  `json:"omitted_bytes"`
	OmittedMessages int                  `json:"omitted_messages"`
	RenderedDigest  string               `json:"rendered_digest"`
	RenderedBytes   int                  `json:"rendered_bytes"`
}

HistorySummary records the bounded derivation. Original bytes and rendered excerpts belong in private execution inputs, not public provenance metadata.

func SummarizeHistory

func SummarizeHistory(policy HistorySummaryPolicy, original []llm.Message, omitted []int) (*HistorySummary, string, error)

SummarizeHistory quotes omitted optional groups in chronological order. It never combines claims, promotes instructions, or modifies required history. Nil means no excerpt fits the declared byte limit.

func (HistorySummary) Validate

func (s HistorySummary) Validate() error

Validate checks bounded metadata. ValidateHistory must still reconstruct the exact selection from retained original bytes before this can be used as proof.

type HistorySummaryPolicy

type HistorySummaryPolicy struct {
	Revision     string `json:"revision"`
	MaxBytes     int    `json:"max_bytes"`
	ExcerptBytes int    `json:"excerpt_bytes"`
	MaxMessages  int    `json:"max_messages"`
}

HistorySummaryPolicy bounds optional history excerpts. A zero policy disables summaries. Excerpts preserve bytes, not semantic completeness or truth.

func (HistorySummaryPolicy) Enabled

func (p HistorySummaryPolicy) Enabled() bool

Enabled distinguishes explicit summary policy from legacy context selection.

func (HistorySummaryPolicy) Validate

func (p HistorySummaryPolicy) Validate() error

Validate rejects unknown algorithms and unbounded extraction configurations.

type Phase

type Phase struct {
	Strategy   Strategy            `json:"strategy"`
	MaxSteps   int                 `json:"max_steps,omitempty"`
	Transition TransitionCondition `json:"transition,omitempty"`
}

Phase represents one stage in a cognitive strategy chain.

type ReflectionAction

type ReflectionAction string

ReflectionAction is a deterministic next action, never an authority grant.

const (
	ActionContinue ReflectionAction = "continue"
	ActionRetrieve ReflectionAction = "retrieve"
	ActionVerify   ReflectionAction = "verify"
	ActionReplan   ReflectionAction = "replan"
	ActionDelegate ReflectionAction = "delegate"
	ActionAsk      ReflectionAction = "ask"
	ActionStop     ReflectionAction = "stop"
)

type ReflectionBinding

type ReflectionBinding struct {
	Scope                cortex.Scope     `json:"scope"`
	RunID                id.AgentRunID    `json:"run_id"`
	AgentID              id.AgentID       `json:"agent_id"`
	PreparedDigest       string           `json:"prepared_digest"`
	Budget               execution.Budget `json:"budget"`
	VerificationRequired bool             `json:"verification_required"`
	SharedPlanID         id.ID            `json:"shared_plan_id,omitzero"`
}

ReflectionBinding pins immutable execution limits and required verification. SharedPlanID is optional and must be authenticated against current ownership.

func (ReflectionBinding) Validate

func (b ReflectionBinding) Validate() error

Validate checks identity and requires finite step and token ceilings.

type ReflectionDecision

type ReflectionDecision struct {
	Action         ReflectionAction `json:"action"`
	Reason         ReflectionReason `json:"reason"`
	Reflect        bool             `json:"reflect"`
	Phase          int              `json:"phase"`
	PhaseChanged   bool             `json:"phase_changed"`
	EvidenceDigest string           `json:"evidence_digest"`
}

ReflectionDecision contains no replacement budget, grant or success criterion.

func Decide

Decide selects a bounded action from observable progress and retained state.

type ReflectionHistoryStore

type ReflectionHistoryStore interface {
	ListReflections(context.Context, id.AgentRunID, int64, int) (ReflectionPage, error)
}

ReflectionHistoryStore is optional exact-scope persistence for operator review. Host authorization must wrap reads. Limits range from one to one hundred.

type ReflectionPage

type ReflectionPage struct {
	Items []ReflectionReceipt `json:"items"`
	After int64               `json:"after,omitempty"`
}

ReflectionPage orders retained decisions by increasing version. After is zero at the end. Reading a decision never grants permission to repeat its action.

type ReflectionPolicy

type ReflectionPolicy struct {
	SchemaVersion    int              `json:"schema_version"`
	Revision         string           `json:"revision"`
	MaxReflections   int              `json:"max_reflections"`
	StuckSteps       int              `json:"stuck_steps"`
	FailureThreshold int              `json:"failure_threshold"`
	OnStuck          ReflectionAction `json:"on_stuck"`
	Phases           []Phase          `json:"phases"`
}

ReflectionPolicy is opt-in. Legacy persona phases do not enable it. These strategies map to bounded decisions, not separate model reasoning algorithms.

func (ReflectionPolicy) Normalize

func (p ReflectionPolicy) Normalize() (ReflectionPolicy, error)

Normalize applies finite defaults and rejects unsupported runtime promises.

type ReflectionReason

type ReflectionReason string

ReflectionReason contains only bounded operational explanations.

const (
	ReflectionHealthy          ReflectionReason = "healthy"
	ReflectionStuck            ReflectionReason = "no_progress"
	ReflectionFailure          ReflectionReason = "repeated_failure"
	ReflectionConflict         ReflectionReason = "contradictory_evidence"
	ReflectionNoNewEvidence    ReflectionReason = "no_new_evidence"
	ReflectionLimit            ReflectionReason = "reflection_limit"
	ReflectionBudget           ReflectionReason = "budget_exhausted"
	ReflectionPending          ReflectionReason = "prior_action_unresolved"
	ReflectionEffects          ReflectionReason = "unresolved_effects"
	ReflectionMissingInput     ReflectionReason = "missing_input"
	ReflectionMissingAuthority ReflectionReason = "missing_authority"
	ReflectionUnresolvedRisk   ReflectionReason = "unresolved_risk"
	ReflectionSuperseded       ReflectionReason = "user_intervention"
	ReflectionInvalid          ReflectionReason = "invalid_observation"
)
const ReflectionInsufficientEvidence ReflectionReason = "insufficient_evidence"

ReflectionInsufficientEvidence stops analytical phases until evidence is supplied.

type ReflectionReceipt

type ReflectionReceipt struct {
	Request       ReflectionRequest  `json:"request"`
	RequestDigest string             `json:"request_digest"`
	Before        ReflectionState    `json:"before"`
	State         ReflectionState    `json:"state"`
	Decision      ReflectionDecision `json:"decision"`
	At            time.Time          `json:"at"`
	Fresh         bool               `json:"-"`
}

ReflectionReceipt retains the checked decision before any action is dispatched. Fresh is process-local acknowledgement only and is never recovered as true.

func AdvanceReflection

func AdvanceReflection(req ReflectionRequest, before ReflectionState, at time.Time) (ReflectionReceipt, error)

AdvanceReflection derives the complete immutable transition.

func (ReflectionReceipt) Validate

func (r ReflectionReceipt) Validate() error

Validate recomputes the transition, excluding its transient fresh flag.

type ReflectionRequest

type ReflectionRequest struct {
	SchemaVersion           int                `json:"schema_version"`
	ExpectedVersion         int64              `json:"expected_version"`
	ExpectedControlRevision int64              `json:"expected_control_revision"`
	ExpectedRunRevision     int64              `json:"expected_run_revision"`
	Snapshot                ReflectionSnapshot `json:"snapshot"`
	Policy                  ReflectionPolicy   `json:"policy"`
	Intervention            *ContextSource     `json:"intervention,omitempty"`
}

ReflectionRequest pins optimistic state, current run revision and policy. Intervention is an authenticated user correction reference, never model text.

func (ReflectionRequest) Freeze

Freeze validates and detaches authority inputs before crossing host callbacks.

type ReflectionSnapshot

type ReflectionSnapshot struct {
	Binding             ReflectionBinding    `json:"binding"`
	ObservedAt          time.Time            `json:"observed_at"`
	Step                int                  `json:"step"`
	Usage               execution.Usage      `json:"usage"`
	ProgressDigest      string               `json:"progress_digest"`
	Evidence            []evidence.Ref       `json:"evidence,omitempty"`
	Assumptions         []Assumption         `json:"assumptions,omitempty"`
	Services            []ServiceObservation `json:"services,omitempty"`
	NoProgressSteps     int                  `json:"no_progress_steps"`
	ConsecutiveFailures int                  `json:"consecutive_failures"`
	PlanComplete        bool                 `json:"plan_complete"`
	HadError            bool                 `json:"had_error"`
	UnresolvedEffects   bool                 `json:"unresolved_effects"`
	RequiredInput       ReflectionReason     `json:"required_input,omitempty"`
}

ReflectionSnapshot contains trusted observable progress, never model scores. The host authenticates progress, plan completion, missing inputs and evidence semantics. Storage additionally requires each evidence object to be retained.

func (ReflectionSnapshot) References

func (s ReflectionSnapshot) References() []evidence.Ref

References returns detached reference values used by the observation.

func (ReflectionSnapshot) Validate

func (s ReflectionSnapshot) Validate() error

Validate bounds observations without certifying their producer or meaning.

type ReflectionState

type ReflectionState struct {
	Version            int64  `json:"version"`
	ControlRevision    int64  `json:"control_revision"`
	Phase              int    `json:"phase"`
	PhaseStartStep     int    `json:"phase_start_step"`
	Reflections        int    `json:"reflections"`
	LastEvidenceDigest string `json:"last_evidence_digest,omitempty"`
	LastStep           int    `json:"last_step"`
	Pending            bool   `json:"pending"`
}

ReflectionState is recovered from the last immutable transition. Interventions advance ControlRevision; they never reset consumed attempts or raise limits.

type ReflectionStore

type ReflectionStore interface {
	GetReflection(context.Context, id.AgentRunID) (*ReflectionReceipt, error)
	AdmitReflection(context.Context, ReflectionRequest) (ReflectionReceipt, error)
}

ReflectionStore is trusted persistence. Public callers need current host guards.

type ReliabilityMeasurement

type ReliabilityMeasurement struct {
	Status string              `json:"status"`
	Reason string              `json:"reason,omitempty"`
	Cohort *CalibrationProfile `json:"cohort,omitempty"`
}

ReliabilityMeasurement is a detached observation, never permission or a check verdict. Unknown results carry no cohort or numeric confidence.

func ReliabilityFor

func ReliabilityFor(binding CalibrationBinding, observation *CalibrationObservation, policy CalibrationPolicy, now time.Time) (ReliabilityMeasurement, error)

ReliabilityFor selects one compatible externally measured cohort. The host supplies current binding pins and time; it must authorize any later disclosure. Required checks, authorization and execution budgets are unaffected.

type Remaining

type Remaining struct {
	Steps     *int `json:"steps"`
	Tokens    *int `json:"tokens"`
	ToolCalls *int `json:"tool_calls"`
}

Remaining records unused configured allowances. Nil means no configured limit.

type ServiceObservation

type ServiceObservation struct {
	Service    string       `json:"service"`
	Health     Health       `json:"health"`
	ObservedAt time.Time    `json:"observed_at"`
	ExpiresAt  time.Time    `json:"expires_at"`
	Evidence   evidence.Ref `json:"evidence"`
}

ServiceObservation records a bounded health observation with its evidence. Missing or expired observations remain unknown; registration is not health.

func (ServiceObservation) CurrentHealth

func (s ServiceObservation) CurrentHealth(now time.Time) Health

CurrentHealth never extends an observation beyond its explicit lifetime.

type Snapshot

type Snapshot struct {
	SchemaVersion int              `json:"schema_version"`
	ObservedAt    time.Time        `json:"observed_at"`
	Tools         []Capability     `json:"tools"`
	Budget        execution.Budget `json:"budget"`
	Usage         execution.Usage  `json:"usage"`
	Remaining     Remaining        `json:"remaining"`
	Reliability   string           `json:"reliability"`
}

Snapshot is a detached operational view. Reliability remains unknown until a compatible measured cohort is integrated; no model-authored score is accepted.

func BuildSnapshot

func BuildSnapshot(in SnapshotInput) (Snapshot, error)

BuildSnapshot validates trusted observations and derives request eligibility. Callers must authorize disclosure before exposing the result to a model or user.

type SnapshotInput

type SnapshotInput struct {
	ObservedAt time.Time
	Tools      []ToolObservation
	Budget     execution.Budget
	Usage      execution.Usage
}

SnapshotInput contains observations for one instant, never authority to act.

type Strategy

type Strategy string

Strategy names an intended thinking approach, not a separate runtime algorithm.

const (
	StrategyAnalytical    Strategy = "analytical"
	StrategyCreative      Strategy = "creative"
	StrategyMethodical    Strategy = "methodical"
	StrategyReactive      Strategy = "reactive"
	StrategyReflective    Strategy = "reflective"
	StrategyCollaborative Strategy = "collaborative"
)

type Style

type Style struct {
	Phases              []Phase `json:"phases,omitempty"`
	DepthPreference     float64 `json:"depth_preference,omitempty"`
	FocusPreference     float64 `json:"focus_preference,omitempty"`
	ReflectionFrequency float64 `json:"reflection_frequency,omitempty"`
}

Style defines how an agent thinks through problems.

type ToolKind

type ToolKind string

ToolKind identifies the executor, not the effect or permissions of a tool.

const (
	ToolBuiltin  ToolKind = "builtin"
	ToolLocal    ToolKind = "local"
	ToolExternal ToolKind = "external"
)

Tool executors can be built into Cortex, registered locally or supplied externally.

type ToolObservation

type ToolObservation struct {
	Name      string
	Revision  string
	Kind      ToolKind
	Installed bool
	Visible   bool
	Health    Health
}

ToolObservation comes from trusted registry, visibility and health observations. Persona, model and recalled-memory claims must never populate this input.

type TransitionCondition

type TransitionCondition string

TransitionCondition defines when the cognitive engine switches phases.

const (
	TransitionAfterSteps     TransitionCondition = "after_steps"
	TransitionOnStuck        TransitionCondition = "on_stuck"
	TransitionOnPlanComplete TransitionCondition = "on_plan_complete"
	TransitionOnError        TransitionCondition = "on_error"
)

Jump to

Keyboard shortcuts

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