Skip to content
Kward Search API index

Module: Kward::ConfigFiles

Extended by:
Core, Extensions, Settings, Prompts
Defined in:
lib/kward/config_files.rb,
lib/kward/config/core.rb,
lib/kward/config/prompts.rb,
lib/kward/config/settings.rb,
lib/kward/config/extensions.rb

Overview

Resolves Kward configuration, cache, memory, prompt, skill, and plugin paths, and reads/writes the JSON config file used by the CLI and RPC server.

This module is the configuration boundary, not a runtime settings cache. Most methods read the filesystem each time so CLI commands and RPC reloads can observe edits made outside the process. Callers that need caching should own invalidation explicitly, as Client#reload_config does for provider state.

Keep path decisions here. Higher-level code should ask ConfigFiles for config, prompt, skill, plugin, cache, memory, and session locations instead of reconstructing ~/.kward paths independently.

Defined Under Namespace

Modules: Core, Extensions, Prompts, Settings Classes: ConfigError, PromptTemplate, Skill

Constant Summary collapse

MAX_SKILL_FILE_BYTES =
100_000
MAX_PROMPT_FILE_BYTES =
32 * 1024
DEFAULT_OVERLAY_SETTINGS =
{ "alignment" => "center", "width" => "maximum" }.freeze
PROJECT_BROWSER_ICON_THEMES =
%w[off nerd-font].freeze
DEFAULT_PERSONAS =
{
  "characters" => [
    {
      "key" => "kward",
      "label" => "Kward",
      "instruction" => "Your name is Kward, the grim Andruid - robotic keeper of the Forest of Code, protecting the nature of good engineering principles. Speak like an old druid, be suspicious of everyone, but with good intent."
    }
  ],
  "default" => "kward"
}.freeze
OVERLAY_ALIGNMENTS =
%w[left center right].freeze
OVERLAY_WIDTHS =
%w[capped maximum].freeze

Method Summary

Methods included from Core

cache_dir, code_search_cache_dir, config_dir, config_path, config_value, default_config, delete_config_key, ensure_default_config!, kwshrc_path, kwshrc_paths, lifecycle_hooks_config, memory_core_path, memory_dir, memory_events_path, memory_soft_path, merge_hook_maps, merge_hooks_config, model_catalog_cache_path, openrouter_models_cache_path, project_browser_state_path, prompt_history_path, read_config, read_kwsh_config, read_kwshrc_config, read_trusted_workspace_hooks, read_trusted_workspace_hooks_config, skip_config=, skip_config?, trust_workspace_hooks!, trusted_workspace_hooks_path, untrust_workspace_hooks!, update_check_cache_path, update_config, update_nested_config, warning_sink, warning_sink=, workspace_hooks_digest, workspace_hooks_path, workspace_hooks_trusted?, write_config

Methods included from Settings

composer_busy_help?, composer_tab_keybindings, diff_view, editor_agent_model, editor_agent_provider, editor_agent_reasoning_effort, editor_agent_setting, editor_auto_close_pairs?, editor_auto_indent?, editor_bar_cursor?, editor_line_numbers, editor_mode, editor_runners, editor_soft_wrap?, enforce_workspace_agents_file?, mcp_servers, overlay_settings, permission_policy, project_browser_icon_theme, project_skills_trusted?, sandbox_policy, session_auto_resume_enabled?, shell_agent_model, shell_agent_provider, shell_agent_reasoning_effort, shell_agent_setting, transport_config, update_overlay_settings, web_search_config, workspace_guardrails_enabled?

Methods included from Prompts

base_prompt, config_agents_prompt, config_agents_prompt_label, config_agents_prompt_source, persona_prompt, prompt_parts, prompt_section, prompt_sections, replacement_prompt_sections, skills_prompt, system_message, workspace_agents_context, workspace_agents_context_label, workspace_agents_hint, workspace_agents_prompt

Methods included from Extensions

emit_warning, inside_directory?, plugin_dir, plugin_paths, presence, project_skill_candidates, prompt_template_registry, prompt_templates, read_skill_file, skills, skills_registry