Class: Insika::Context::Providers::Briefing
- Inherits:
-
Insika::ContextProvider
- Object
- Insika::ContextProvider
- Insika::Context::Providers::Briefing
- Defined in:
- lib/insika/context/providers/briefing.rb
Overview
Read path for the session briefing: the per-session working-state the agent keeps and asks for. Thin adapter over the SessionStore, same pattern as Memory, deterministic. The MISSING list is rendered, never implied — that list is what stops the model re-asking for a field already given.
TWO fragments, and the split is the whole point:
· `<briefing>` (:system) — the DURABLE facts, what is already known.
Head of the prompt, where reference material belongs.
· `<recitation>` (:tail) — what is still missing and what the next step
is, rendered AFTER the whole history, as the last thing before the
current user message.
Attention is strongest at the END of the context: a goal stated only in the head is the first thing a 30-call turn forgets. The recitation lives in exactly one place — it was MOVED out of the head, never duplicated, so a turn pays for it once.
Instance Method Summary collapse
-
#call(request) ⇒ Object
required? == false (default): a store failure degrades via the Builder's warning path, never aborts the turn.
-
#enabled_for?(profile) ⇒ Boolean
Pack-declared: no briefing_fields -> no provider (the Builder still applies the
context_providersallowlist on top — two gates, like Memory). -
#id ⇒ Object
Stable id -> the context-trace category "briefing".
-
#initialize(session_store:) ⇒ Briefing
constructor
A new instance of Briefing.
Methods inherited from Insika::ContextProvider
Constructor Details
#initialize(session_store:) ⇒ Briefing
Returns a new instance of Briefing.
23 24 25 |
# File 'lib/insika/context/providers/briefing.rb', line 23 def initialize(session_store:) @session_store = session_store end |
Instance Method Details
#call(request) ⇒ Object
required? == false (default): a store failure degrades via the Builder's warning path, never aborts the turn.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/insika/context/providers/briefing.rb', line 39 def call(request) session = request.respond_to?(:session) ? request.session : nil return [] if session.nil? # one-shot turns have no briefing briefing = briefing_for(session) fields = briefing["fields"] || {} declared = Array(request.profile.briefing_fields) return [] if declared.empty? # defensive; enabled_for? already gates missing = declared.reject { |name| Coercion.present?(fields[name]) } next_step = briefing["next_step"] [head_fragment(declared, fields), tail_fragment(missing, next_step)].compact end |
#enabled_for?(profile) ⇒ Boolean
Pack-declared: no briefing_fields -> no provider (the Builder still
applies the context_providers allowlist on top — two gates, like Memory).
32 33 34 35 |
# File 'lib/insika/context/providers/briefing.rb', line 32 def enabled_for?(profile) fields = profile.respond_to?(:briefing_fields) ? profile.briefing_fields : nil !Array(fields).empty? end |
#id ⇒ Object
Stable id -> the context-trace category "briefing".
28 |
# File 'lib/insika/context/providers/briefing.rb', line 28 def id = "briefing" |