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
RECITATION =
95
PROMPT_REF =

the goal restated at the TAIL of context (Briefing). Never cut: it is two lines, and the one turn it gets evicted is the long turn that needed it.

90
SKILL_BODY =

Prompt Catalog guardrails/refs (Prompt) — pinned

85
SKILL =

<active_skill> trigger-matched body (SkillTrigger)

80
KNOWLEDGE =

<available_skills> level 1 (Skill)

77
MEMORY =

top-K learned concepts (Knowledge) — below curated skills, above a single conversation's memory

75
TOOL_SEARCH =

read path (Memory)

70
BRIEFING =

<available_tools> level 1 (ToolSearch)

65
HISTORY_MAX =

session working state (Briefing) — D5:

below every identity/skill/memory block (never breaks the
pinned prefix), above the turn's own <request_context>.
79
HISTORY_BASE =

history ceiling by recency (Session)

60
COMPACTION =

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

59
REQUEST =

<conversation_summary> the compacted prefix (RFC-0044) — one step below the oldest verbatim message: under budget it is the "oldest unit" and drops first.

40