Location: ~/.config/gokin/config.yaml

Gokin uses YAML configuration with 22+ sections. All parameters have sensible defaults.


Configuration Sections#

api — Providers & Keys#

api:
  active_provider: gemini          # Current provider
  gemini_key: ""                   # Gemini API key
  anthropic_key: ""                # Anthropic API key
  deepseek_key: ""                 # DeepSeek API key
  glm_key: ""                      # GLM API key
  minimax_key: ""                  # MiniMax API key
  kimi_key: ""                     # Kimi API key
  ollama_key: ""                   # Ollama API key (optional)
  ollama_base_url: "http://localhost:11434"  # Ollama server
  gemini_oauth:                    # OAuth tokens (automatic)
    access_token: ""
    refresh_token: ""
    expiry: ""
  retry:
    max_retries: 3
    retry_delay: 1s
    http_timeout: 120s
    stream_idle_timeout: 0         # 0 = provider default

model — Model & Parameters#

model:
  name: gemini-3-flash-preview     # Model name
  provider: ""                     # Explicit provider (or auto-detect)
  preset: ""                       # coding, fast, balanced, creative
  temperature: 1.0                 # Generation temperature
  max_output_tokens: 8192          # Max output tokens
  enable_thinking: false           # Extended thinking (Anthropic)
  thinking_budget: 0               # Thinking budget (tokens)
  custom_base_url: ""              # Custom API endpoint
  fallback_providers: []           # Failover: ["deepseek", "gemini"]
  max_pool_size: 5                 # Connection pool size

tools — Tools#

tools:
  timeout: 2m                      # Tool timeout
  bash_sandbox: true               # Bash sandbox
  blocked_commands:                # Blocked commands
    - "rm -rf /"
    - "mkfs"
  allowed_directories: []          # Allowed directories (empty = all)
  formatters:                      # Auto-format after writes
    .py: "black"
    .go: "gofmt"

ui — User Interface#

ui:
  theme: dark                      # dark, macos, light
  stream_output: true              # Stream responses
  markdown_rendering: true         # Render Markdown
  show_tool_calls: true            # Show tool calls
  show_token_usage: true           # Show token usage
  mouse_mode: enabled              # enabled / disabled
  show_welcome: true               # Welcome message
  hints_enabled: true              # Contextual hints
  compact_mode: false              # Compact mode
  bell: true                       # Terminal bell on prompts
  native_notifications: false      # macOS Notification Center

context — Context Management#

context:
  warning_threshold: 0.8           # Warning at 80% context
  summarization_ratio: 0.5         # Summarize to 50%
  tool_result_max_chars: 10000     # Max chars per tool result
  enable_auto_summary: true        # Auto-summarization
  auto_compact_threshold: 0.75     # Auto-compact at 75%

permission — Permissions#

permission:
  default_policy: ask              # ask, allow, deny
  rules:
    read: allow                    # Auto-allow
    glob: allow
    grep: allow
    write: ask                     # Ask
    edit: ask
    bash: ask
    ssh: ask
    delete: ask

plan — Planning#

plan:
  enabled: true
  require_approval: true           # Approval before execution
  auto_detect: true                # Auto-detect complex tasks
  clear_context: true              # Clear context before planning
  delegate_steps: true             # Delegate steps to agents
  abort_on_step_failure: false     # Don't abort on failure
  planning_timeout: 60s
  algorithm: beam                  # beam, mcts, astar

hooks — Hooks#

hooks:
  - name: "pre_git_commit"
    type: pre_tool                 # pre_tool, post_tool, on_error, on_start, on_exit
    tool_name: git_commit
    command: "git diff --stat"
    enabled: true
    condition: always              # always, if_previous_success, if_previous_failure
    fail_on_error: true
    depends_on: ""                 # Hook chaining
web:
  provider: ""                     # serpapi, google
  serpapi_key: ""
  google_key: ""
  google_cx: ""

session — Sessions#

session:
  enabled: true
  save_interval: 2m                # Auto-save every 2 minutes
  auto_load: true                  # Load last session on start

memory — Memory#

memory:
  enabled: true
  max_entries: 1000                # Max memory entries
  auto_inject: true                # Inject relevant memories

logging — Logging#

logging:
  level: warn                      # debug, info, warn, error

Log file: ~/.config/gokin/gokin.log (structured JSON via slog).

audit — Audit#

audit:
  enabled: true
  max_entries: 10000               # Max entries per session
  max_result_len: 1000             # Max result length
  retention_days: 30               # Retention: 30 days

Audit files: ~/.config/gokin/audit/{sessionID}.json (permissions 0600).

rate_limit — Rate Limiting#

rate_limit:
  enabled: true
  requests_per_minute: 60
  tokens_per_minute: 1000000       # 1M
  burst_size: 10

cache — Caching#

cache:
  enabled: true
  capacity: 100                    # Max cache entries
  ttl: 5m                          # Entry time-to-live

watcher — File Watcher#

watcher:
  enabled: false                   # Disabled by default
  debounce_ms: 500                 # Debounce delay (ms)
  max_watches: 1000                # Max watched paths

diff_preview — Diff Preview#

diff_preview:
  enabled: true
  max_lines: 50000
semantic:
  enabled: false                   # Disabled by default
  model: text-embedding-004        # Embedding model
  index_on_start: false            # Index on startup
  max_file_size: 102400            # 100KB
  cache_ttl: 24h
  top_k: 10                        # Top-K results
  chunk_size: 0                    # Chunk size (auto)
  chunk_overlap: 0                 # Chunk overlap
  auto_cleanup: false
  index_patterns: []               # Indexing patterns
  exclude_patterns: []             # Exclusions

contract — Contract Validation#

contract:
  enabled: false

mcp — Model Context Protocol#

mcp:
  servers:
    - name: "example-server"
      transport: stdio              # stdio or http
      command: "/path/to/server"
      args: ["--arg1", "value"]
      env:
        CUSTOM_VAR: "${HOME}/config"
      auto_connect: true
      timeout: 15s

update — Updates#

update:
  enabled: true
  check_interval: 24h
  auto_update: false
  owner: ""                        # GitHub owner
  repo: ""                         # GitHub repo
  asset_pattern: ""                # Binary pattern
  max_backups: 3

Key Constants (defaults.go)#

Content Limits#

ConstantValueDescription
DefaultMaxTokens8192Max output tokens
DefaultMaxChars10000Max characters
DefaultToolResultMaxChars30000Max tool result
DefaultMaxFetchContent50000Max web content
DefaultDiffTruncation50000Max diff

Timeouts#

ConstantValueDescription
DefaultToolTimeout30sTool timeout
DefaultBashTimeout30sBash timeout
DefaultPermissionTimeout5mPermission wait
DefaultAgentTimeout30mAgent timeout
DefaultPlanApprovalTimeout10mPlan approval wait
DefaultHTTPTimeout120sHTTP timeout

Limits#

ConstantValueDescription
DefaultMaxConcurrentAgents5Max parallel agents
DefaultMaxGlobResults1000Max glob results
DefaultMaxWatches1000Max watched files
DefaultMaxRetries3Max retries
DefaultRetryDelay1sRetry delay
DefaultMaxSessionHistory200Max session messages
DefaultMaxMemoryEntries100Max memory entries
DefaultAuditMaxEntries10000Max audit entries

Examples#

Minimal Configuration#

api:
  active_provider: gemini
  gemini_key: "your-key-here"
api:
  active_provider: gemini
  gemini_key: "your-gemini-key"
  anthropic_key: "your-anthropic-key"
model:
  name: gemini-3-flash-preview
  fallback_providers:
    - anthropic
    - ollama
ui:
  theme: dark
plan:
  enabled: true
  require_approval: true
memory:
  enabled: true
  auto_inject: true

Offline Configuration (Ollama)#

api:
  active_provider: ollama
  ollama_base_url: "http://localhost:11434"
model:
  name: qwen2.5-coder
ui:
  theme: dark
GitHub MIT License © Gokin Contributors