Class: Insika::Context::Providers::Prompt
- Inherits:
-
Insika::ContextProvider
- Object
- Insika::ContextProvider
- Insika::Context::Providers::Prompt
- 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 the previous persona'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).
Constant Summary collapse
- TOOL_PERSISTENCE =
Engine-owned execution discipline, appended AFTER the agent's identity. The one behavior every reference harness bakes into its base prompt (OpenClaw's "Execution Bias") and this engine was missing: a weak tool result read as final. A constant — byte-identical every turn, so prompt_caching pays ONE write on the deploy that introduces it, never per turn. Opt-out per profile (
tool_persistence false), the single default-ON profile flag: the proven-good behavior is the default, the exception is the thing an operator declares. "## Tool discipline\n" \ "- Weak or empty tool result: try again with a different approach — rephrase the " \ "query, use a synonym or broader term, drop a secondary filter — before telling " \ "the user you found nothing. Do not narrate the retries. Then conclude.\n" \ "- Tool error: read the error, fix the arguments or try another path; never " \ "repeat the exact same call."
Instance Method Summary collapse
- #call(request) ⇒ Object
-
#initialize(base: "", files: [], catalog: nil, agent_files: nil, system_files: nil) ⇒ Prompt
constructor
A new instance of Prompt.
-
#layer ⇒ Object
identity (config/agent-file derived — already pinned).
- #required? ⇒ Boolean
Methods inherited from Insika::ContextProvider
Constructor Details
#initialize(base: "", files: [], catalog: nil, agent_files: nil, system_files: nil) ⇒ Prompt
Returns a new instance of Prompt.
33 34 35 36 37 38 39 |
# File 'lib/insika/context/providers/prompt.rb', line 33 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
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/insika/context/providers/prompt.rb', line 45 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 |
#layer ⇒ Object
identity (config/agent-file derived — already pinned).
43 |
# File 'lib/insika/context/providers/prompt.rb', line 43 def layer = :identity |
#required? ⇒ Boolean
41 42 |
# File 'lib/insika/context/providers/prompt.rb', line 41 def required? = true # identity (config/agent-file derived — already pinned). |