Skip to content

Configuration

G6Solver uses pydantic-settings for configuration, loading values from environment variables and .env files.

Environment variables

Variable Purpose Required
OPENROUTER_API_KEY LLM routing via OpenRouter Yes (unless using Ollama)
ALLOW_PAID_API Global opt-in for components that can call paid third-party APIs, including ctx_vision No (prefer per-call consent for local use)
VISION_DB_PATH SQLite persistence location for ctx_vision MCP analyses No (default: ~/.vision_mcp/vision.db)
VISION_MODEL Override default OpenRouter vision model for ctx_vision No
ANTHROPIC_API_KEY Direct Claude API access for agent_claude Optional
PANDAS_DB_PATH Pandas MCP SQLite location No (default: ~/.pandas_mcp/pandas.db)
DJANGO_SETTINGS_MODULE Django config module No (auto-detected)
POSTGRES_PASSWORD Database credential for Docker deployment Yes (Docker only)
BIAS_EVOLUTION_ENABLED Enables experimental bias evolution No (default: false)
BIAS_EVOLUTION_CONFIRM_TOKEN Human confirmation secret for mutating bias operations Required only when bias evolution is enabled
BIAS_EVOLUTION_TIER Local tier override for bias evolution (trialing or premium) No
BIAS_DB_PATH SQLite fallback path for bias evolution history No (default: ~/.bias_mcp/bias.db)
G6_JOB_LIVE_SEARCH Allows job-agent handlers and recipes to call live web search instead of deterministic local fallback No (default: false)
G6_JOB_LIVE_LLM Allows job-agent debate/enrichment paths to call live LLM backends instead of deterministic/mock fallback No (default: false)
G6_JOB_ENABLE_GROUNDING Allows selected job agents, including job_political, to load optional grounding/context enrichment No (default: false)
G6_JOB_ENABLE_EXPERTA Allows selected job agents, including job_political, to load optional Experta rule-engine enrichment No (default: false)
G6_JOB_ENABLE_BAYESIAN Allows selected job agents, including job_political, to load optional Bayesian enrichment No (default: false)
LEAN_PROVER_DB_PATH SQLite persistence path for Lean prover sessions, theorem records, and strategy history No (default: ~/.g6/lean_prover.sqlite3)
LEAN_PROVER_PROJECT_PATH Lake/Lean project path used for Lean project management and Mathlib-backed workflows No (default: current directory)
LEAN_BINARY_PATH Explicit path to the Lean executable when it is not discoverable on PATH No
LEAN_PROVER_TEMP_DIR Directory for bounded temporary Lean files during verification No (default: project .g6/lean_tmp or OS temp)

Security notice

Never commit .env files to version control. Use environment variables or a secret manager in production. The .gitignore already excludes .env.

Setting up .env

If you want to pay for your own inference, add an OpenRouter key to your account on the hosted service:

  1. Sign in at g6solver.com.
  2. Open your account's LLM key page.
  3. Paste your sk-or-... key and save it.

The key is sealed at rest, is never displayed again, and can be cleared from the same page. OpenRouter is currently the only provider you can bring a key for.

g6 --gui is not available

This section used to tell you to launch a desktop app and use its Settings panel. There is no desktop application to install; the hosted account page above is the supported path.

Create ~/.g6/.env with your keys:

# ~/.g6/.env
OPENROUTER_API_KEY=your_openrouter_key_here

Paid API consent

Some components require explicit opt-in before they call paid external APIs. For ctx_vision, image-processing calls require both OPENROUTER_API_KEY and either a per-call allow_paid_api=True flag or ALLOW_PAID_API=1 in the MCP server environment.

Prefer per-call allow_paid_api=True during local experimentation so consent is visible at the call site. Use ALLOW_PAID_API=1 only for a runtime where paid API usage is expected and budgeted.

Job-agent live integrations

Job agents default to local/deterministic behavior. Live web search, live LLM-backed debate, grounding, Experta, and Bayesian enrichment are disabled unless explicitly enabled. Enable these only when network access, API credentials, latency, dependency loading, and cost are acceptable for that runtime.

Political workflows

job_political outputs are decision support only. Do not treat them as legal, electoral, campaign-finance, compliance, lobbying, or publication approval advice. Built-in defaults are illustrative, jurisdiction matters, and constituent/campaign workflows may involve sensitive personal or political data.

Lean prover production gates

Before using Lean-backed verification as a production-critical gate, run lean_prover_lean_status and require readiness.ga_ready=true with no readiness.actions. Outputs with verified=false or verification_status="generated" are unverified source only, not proofs. verification_status="proved" is not enough on its own for policy approval; require verified=true or a stored verified theorem record. Use lean_prover_replay_artifact and lean_prover_enforce_policy for medium, high, regulated, or safety-critical workflows.

In production, set LEAN_PROVER_DB_PATH to a managed writable SQLite path. Configure LEAN_PROVER_PROJECT_PATH for workflows that import Mathlib or project-local Lean modules. Pantograph and research grounding are optional; if missing, status output reports warnings and batch Lean proof checking can still work.

Lean proving is an advanced reliability gate. It should be exposed to non-technical launch users through guided recipes or templates, not as a first-run requirement to install and debug Lean/Lake/Mathlib directly.

Full .env for all features:

OPENROUTER_API_KEY=your_openrouter_key_here
ANTHROPIC_API_KEY=your_anthropic_key_here
PANDAS_DB_PATH=~/.pandas_mcp/pandas.db

Bias evolution configuration

Bias evolution is experimental and can mutate component bias configuration. It is off by default and should not be part of the first-run onboarding path for a new non-technical user.

For a controlled local pilot:

BIAS_EVOLUTION_ENABLED=true
BIAS_EVOLUTION_CONFIRM_TOKEN=<random-human-reviewed-secret>
BIAS_EVOLUTION_TIER=trialing
BIAS_DB_PATH=~/.bias_mcp/bias.db

For paid production access, use BIAS_EVOLUTION_TIER=premium or rely on the normal license/subscription tier supplied by the gateway. Do not set G6_DEV_MODE=true in production; it bypasses tier checks.

Mutating operations (evolve, apply, rollback) require callers to pass a matching confirm_token. Snapshot, observe, evaluate, and grounding checks can run without it.

Claude-Mem configuration

ctx_claude_mem uses an upstream claude-mem worker for persistent Claude session memory. G6 can use an already running worker or the pinned source snapshot under vendor/claude-mem for controlled local testing.

Variable Purpose
CLAUDE_MEM_BASE_URL Explicit worker URL. Overrides port discovery.
CLAUDE_MEM_PORT Legacy/G6-managed worker port, defaulting to 37777.
CLAUDE_MEM_WORKER_PORT Current upstream worker port variable. Used when CLAUDE_MEM_PORT is unset.
CLAUDE_MEM_DATA_DIR Upstream data directory. G6 reads .worker.port from here when present.
CLAUDE_MEM_WORKER_PATH Optional path used by the MCP worker_start operation.

Bundling caveat

The vendored claude-mem source is present for source availability, regression testing, and packaging evaluation. The root package is AGPL-3.0, and upstream's ragtime/ subtree carries PolyForm Noncommercial 1.0.0. Do not treat the vendored directory as automatically cleared for paid end-user distribution.

For local validation, use python scripts\claude_mem_vendor.py check, worker start, contract-test, and worker stop. Avoid silently running the upstream global installer from G6; it can rewrite user IDE hooks.

CSF configuration

The Computational Safety Framework (CSF) has dedicated configuration fields that control resource limits and safety bounds. These are set via the Settings class and can be overridden with environment variables.

Setting Default Description
allowed_llm_base_urls ["https://openrouter.ai/api/v1"] Permitted LLM API base URLs
default_llm_timeout_sec 60 Default timeout for LLM calls (seconds)
default_llm_max_retries 3 Maximum retry attempts for failed LLM calls
max_llm_tokens_cap 128,000 Maximum token limit per LLM request
max_horizon_cap 10,000 Maximum planning horizon for goal decomposition
default_state_limit 50,000 Default state space limit

Environment variable mapping

All settings follow the pattern SETTING_NAME in uppercase. For example, max_llm_tokens_cap maps to the environment variable MAX_LLM_TOKENS_CAP.

These settings are read from the environment (and ~/.g6/.env) when G6 starts. The defaults above apply unless you override them — for example, add MAX_LLM_TOKENS_CAP=64000 to your ~/.g6/.env, or set it in the GUI Settings tab where exposed. You don't need to set any of these to get started; they are caps and timeouts for advanced tuning.

Per-goal resource bounds

For per-run resource control, declare resource_bounds directly in your goal's JSON — the engine enforces them, and they travel with the goal across every surface:

{
  "goal": "Summarize the attached report",
  "resource_bounds": {
    "max_execution_seconds": 30,
    "max_tokens_per_hour": 200000
  }
}

See Safety-Guarded Goals for bounds alongside guardrails, checkpoints, and breakpoints, and Security Architecture for the CSF safety framework.

Next steps