Module: Insika::Context::Priority

Defined in:
lib/insika/context/priority.rb

Overview

Precedence ladder for context fragments — SINGLE SOURCE of the order (trust boundary). Higher = more authority: appears earlier in the system prompt and survives budget cuts. Providers reference these constants instead of loose numbers, so the boundary is an auditable contract in a single place (trust_boundary_spec locks the order).

Contract: identity and guardrails go PINNED at the top; TURN injections (request_context — the consumer's tenant/vars) sit at the BOTTOM and are sacrificed FIRST under budget. Identity (pinned) is NEVER truncated. A prompt injection riding in via turn data is DATA, not authority — it does not override IDENTITY/SOUL, and security decisions (tool allow/deny, egress, approvals) live in the engine/profile, never in the injected block.

Constant Summary collapse

IDENTITY =

IDENTITY/SOUL (Prompt) — pinned

100
PROMPT_REF =

Prompt Catalog guardrails/refs (Prompt) — pinned

90
SKILL_BODY =

<active_skill> trigger-matched body (SkillTrigger)

85
SKILL =

<available_skills> level 1 (Skill)

80
MEMORY =

read path (Memory)

75
TOOL_SEARCH =

<available_tools> level 1 (ToolSearch)

70
HISTORY_MAX =

history ceiling by recency (Session)

79
HISTORY_BASE =

history base; +idx up to the ceiling (Session)

60
REQUEST =

<request_context> — turn injection, the most cuttable

40