Class: Insika::Context::Providers::Prompt

Inherits:
Insika::ContextProvider show all
Defined in:
lib/insika/context/providers/prompt.rb

Overview

Absorbs SystemPrompt + SOUL.md. Identity is PINNED, priority 100 — never cut. required?: an agent without identity is a WRONG agent, not a degraded one. prompt_refs: priority 90 pinned fragments, from the PromptCatalog (catalog defaults to nil).

PER-AGENT identity. profile.prompt_files (file names) wins over the wiring's files: — this fixes the limitation of a new agent inheriting Bia's prompt. The content comes from agent_files (AgentFileStore, lives in the Store), with a File.read fallback for on-disk paths (compat/seed). Without prompt_files -> uses the wiring's files: (deployment default; byte-for-byte parity).

Instance Method Summary collapse

Methods inherited from Insika::ContextProvider

#enabled_for?, #id

Constructor Details

#initialize(base: "", files: [], catalog: nil, agent_files: nil, system_files: nil) ⇒ Prompt

Returns a new instance of Prompt.



18
19
20
21
22
23
24
# File 'lib/insika/context/providers/prompt.rb', line 18

def initialize(base: "", files: [], catalog: nil, agent_files: nil, system_files: nil)
  @base = base
  @files = Array(files)
  @catalog = catalog
  @agent_files = agent_files
  @system_files = system_files
end

Instance Method Details

#call(request) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/insika/context/providers/prompt.rb', line 28

def call(request)
  fragments = []
  identity = build_identity(request.profile)
  unless identity.empty?
    fragments << ContextFragment.build(content: identity, placement: :system,
                                       priority: Context::Priority::IDENTITY, source: id, pinned: true)
  end
  fragments.concat(ref_fragments(request.profile))
  fragments
end

#required?Boolean

Returns:

  • (Boolean)


26
# File 'lib/insika/context/providers/prompt.rb', line 26

def required? = true