Class: Insika::Doctor
- Inherits:
-
Object
- Object
- Insika::Doctor
- Defined in:
- lib/insika/doctor.rb
Overview
insika doctor (— OpenClaw's "strict config + doctor --fix",
"the repo's best productization discipline"). A read-only diagnosis of a
deployment's configuration that turns the scattered, silent boot warnings into
ONE structured report — and, with --fix, applies the safe autofixes.
Every check is DATA (config over convention): an id, a title, and a lambda that
inspects the injected collaborators and returns Findings. A Finding may carry a
fix proc; fix! runs those and re-diagnoses. Collaborators are optional so the
CLI can build them straight off the durable backend (no full app boot / no
DEEPSEEK) and an env-only caller can skip the store checks entirely.
Defined Under Namespace
Classes: DomainEntry, DomainReport, Finding, Report
Instance Method Summary collapse
-
#domain ⇒ Object
— the domain inventory: what a deployment declares (personas with a metadata.domain tag, outcome funnels, tool evidence) plus the built-in pt-BR corpora still in effect.
-
#fix! ⇒ Object
Applies every fixable finding, then re-diagnoses.
-
#initialize(env: ENV, settings_store: nil, llm_provider_store: nil, tool_store: nil, agent_file_store: nil, skill_store: nil, skill_catalog: nil, profile_source: nil, backend: nil, extra_env_specs: [], shadow_pair_store: nil, soak_envelope_path: nil, context_providers: nil, memory_store: nil, agent_ids: nil, funnel_store: nil, outcome_store: nil, followup_store: nil, contact_store: nil, proposal_store: nil, harvest_store: nil, harvest_criterion: nil) ⇒ Doctor
constructor
A new instance of Doctor.
-
#run ⇒ Object
-> Report.
Constructor Details
#initialize(env: ENV, settings_store: nil, llm_provider_store: nil, tool_store: nil, agent_file_store: nil, skill_store: nil, skill_catalog: nil, profile_source: nil, backend: nil, extra_env_specs: [], shadow_pair_store: nil, soak_envelope_path: nil, context_providers: nil, memory_store: nil, agent_ids: nil, funnel_store: nil, outcome_store: nil, followup_store: nil, contact_store: nil, proposal_store: nil, harvest_store: nil, harvest_criterion: nil) ⇒ Doctor
Returns a new instance of Doctor.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/insika/doctor.rb', line 101 def initialize(env: ENV, settings_store: nil, llm_provider_store: nil, tool_store: nil, agent_file_store: nil, skill_store: nil, skill_catalog: nil, profile_source: nil, backend: nil, extra_env_specs: [], shadow_pair_store: nil, soak_envelope_path: nil, context_providers: nil, memory_store: nil, agent_ids: nil, funnel_store: nil, outcome_store: nil, followup_store: nil, contact_store: nil, proposal_store: nil, harvest_store: nil, harvest_criterion: nil) @env = env @settings_store = settings_store @llm_provider_store = llm_provider_store @tool_store = tool_store @agent_file_store = agent_file_store @skill_store = skill_store @skill_catalog = skill_catalog @profile_source = profile_source @backend = backend @extra_env_specs = extra_env_specs @shadow_pair_store = shadow_pair_store @soak_envelope_path = soak_envelope_path # [ContextProvider | Class] — classes accepted so the CLI # can pass the builtin set without deps; the check only reads .layer / # .name. nil = skip. @context_providers = context_providers # the memory-scopes check — Insika::MemoryStore | nil = skip; # agent_ids excuse bare cells named like an agent (the agent-memory tab's). @memory_store = memory_store @agent_ids = Array(agent_ids).map(&:to_s) # the outcome-funnel check — nil collaborators = the check # reports declarations only (env-only callers stay cheap). @funnel_store = funnel_store @outcome_store = outcome_store # the follow-up check — nil collaborators = the check # reports declarations only. @followup_store = followup_store @contact_store = contact_store # the distillation check — nil collaborator = the check # reports declarations only (counts skipped). @proposal_store = proposal_store # the harvest check — nil collaborators = the check # reports declarations only (counts skipped). @harvest_store = harvest_store @harvest_criterion = harvest_criterion end |
Instance Method Details
#domain ⇒ Object
— the domain inventory: what a deployment declares (personas with a metadata.domain tag, outcome funnels, tool evidence) plus the built-in pt-BR corpora still in effect. Read-only: informational, never a gate — a pilot reporting its own artifacts must exit 0.
161 162 163 164 165 166 |
# File 'lib/insika/doctor.rb', line 161 def domain entries = %i[personas corpora funnels evidence].flat_map { |section| safe_domain(section) }.compact DomainReport.new(generated_at: Time.now.utc.iso8601, gem_version: Insika::VERSION, entries: entries.freeze) end |
#fix! ⇒ Object
Applies every fixable finding, then re-diagnoses. -> [Report before, Report after].
151 152 153 154 155 |
# File 'lib/insika/doctor.rb', line 151 def fix! before = run before.fixable.map(&:fix).each(&:call) [before, run] end |