v2.0.0 Documentation fixpointforge.dev

Configuration

Every ForgeConfig field, its default value, environment variable, and YAML key.


Configuration Loading Order

FORGE loads configuration through ForgeConfig, which resolves values in this priority order (highest to lowest):

  1. Explicit constructor arguments — passed directly to ForgeConfig(...)
  2. Environment variables — prefixed with FORGE_
  3. YAML config file — forge_config.yaml in the working directory
  4. Built-in defaults — sensible defaults for every field
Python — explicit config
from forge import normalize_content
from forge.config import ForgeConfig

config = ForgeConfig(
    hmac_secret="my-production-secret",
    max_iterations=15,
    telemetry_enabled=True
)

result = normalize_content(content, "TEXT", config=config)
â„šī¸

If you don't pass a config argument, FORGE automatically creates a ForgeConfig from environment variables and forge_config.yaml.


Core Settings

YAML Key Env Var Type Default Description
forge.hmac_secret FORGE_HMAC_SECRET str "forge-dev-key" Secret key for HMAC-SHA256 ForgeStamp signatures. Must be set in production.
forge.max_iterations FORGE_MAX_ITERATIONS int 10 Maximum fixpoint loop iterations before failing closed.
forge.convergence_threshold FORGE_CONVERGENCE_THRESHOLD float 0.0 Maximum allowed diff between consecutive iterations to declare convergence. 0.0 = exact match required.
forge.fail_closed FORGE_FAIL_CLOSED bool true If true, content that doesn't converge is REJECTED. If false, it's QUARANTINED.
forge.log_level FORGE_LOG_LEVEL str "WARNING" Python logging level: DEBUG, INFO, WARNING, ERROR, CRITICAL.
forge.strict_mode FORGE_STRICT_MODE bool false If true, any lane warning is promoted to an error and content is REJECTED.
forge.timeout_ms FORGE_TIMEOUT_MS int 30000 Maximum total time (in milliseconds) for a single normalization call.
forge.config_path FORGE_CONFIG_PATH str "forge_config.yaml" Path to the YAML configuration file. Relative to working directory.

Actor Settings

Actor information is embedded in every ForgeStamp for provenance tracking.

YAML Key Env Var Type Default Description
forge.actor.service FORGE_ACTOR_SERVICE str "unknown" Name of the calling service (e.g., "my-api").
forge.actor.version FORGE_ACTOR_VERSION str "0.0.0" Version of the calling service.
forge.actor.environment FORGE_ACTOR_ENVIRONMENT str "development" Deployment environment: development, staging, production.
forge.actor.instance_id FORGE_ACTOR_INSTANCE_ID str auto-generated Unique ID for this FORGE instance. Auto-generated UUID if not set.

Telemetry Settings

YAML Key Env Var Type Default Description
forge.telemetry.enabled FORGE_TELEMETRY_ENABLED bool true Whether to collect failure telemetry locally.
forge.telemetry.upload FORGE_TELEMETRY_UPLOAD bool false Whether to upload telemetry to the FORGE cloud endpoint.
forge.telemetry.endpoint FORGE_TELEMETRY_ENDPOINT str "https://telemetry.fixpointforge.report" URL for telemetry upload. Only used when upload is true.
forge.telemetry.batch_size FORGE_TELEMETRY_BATCH_SIZE int 100 Number of failure records to batch before uploading.
forge.telemetry.flush_interval_s FORGE_TELEMETRY_FLUSH_INTERVAL int 60 Seconds between automatic telemetry flushes.
forge.telemetry.include_lane_timing FORGE_TELEMETRY_LANE_TIMING bool true Include per-lane execution time in telemetry records.
forge.telemetry.anonymize FORGE_TELEMETRY_ANONYMIZE bool true Strip all content from telemetry. Only structural metadata is sent.
âš ī¸

Telemetry never includes raw content by default. The anonymize flag adds an extra layer by stripping even structural fragments. See Telemetry for details.


Lane Configuration

Each lane can be individually configured under the forge.lanes YAML key or via environment variables with the pattern FORGE_LANE_{ID}_{SETTING}.

YAML Key Env Var Pattern Type Default Description
forge.lanes.{ID}.enabled FORGE_LANE_{ID}_ENABLED bool true Enable/disable this specific lane.
forge.lanes.{ID}.strict FORGE_LANE_{ID}_STRICT bool false Promote warnings to errors for this lane.
forge.lanes.{ID}.timeout_ms FORGE_LANE_{ID}_TIMEOUT int 5000 Per-lane timeout in milliseconds.
forge.lanes.{ID}.max_repairs FORGE_LANE_{ID}_MAX_REPAIRS int 50 Maximum number of repairs a lane can make per pass.
forge.lanes.{ID}.config — dict {} Lane-specific settings (varies by lane). Only available in YAML.
YAML — per-lane configuration
forge:
  lanes:
    L0:
      enabled: true
      strict: true
      timeout_ms: 3000
    T2:
      enabled: true
      strict: true
      config:
        block_injection: true
        max_prompt_length: 10000
    T3:
      enabled: true
      config:
        policy_file: "policies/compliance_v2.yaml"
        jurisdictions:
          - US
          - EU
    L4:
      config:
        stamp_algorithm: "hmac-sha256"
        include_content_hash: true

Content Type Configuration

Override lane chains or settings on a per-content-type basis.

YAML Key Env Var Pattern Type Default Description
forge.types.{TYPE}.enabled FORGE_TYPE_{TYPE}_ENABLED bool true Enable/disable this content type entirely.
forge.types.{TYPE}.max_iterations FORGE_TYPE_{TYPE}_MAX_ITER int inherits core Override max iterations for this content type.
forge.types.{TYPE}.fail_closed FORGE_TYPE_{TYPE}_FAIL_CLOSED bool inherits core Override fail-closed behavior for this content type.
forge.types.{TYPE}.skip_lanes — list[str] [] Lane IDs to skip for this content type. YAML only.
YAML — per-type overrides
forge:
  types:
    DIFF:
      max_iterations: 20
      fail_closed: true
    JSON:
      max_iterations: 5
      skip_lanes: ["T2"]
    PROMPT:
      fail_closed: true
    COMPLIANCE:
      max_iterations: 15
    SPEECH:
      enabled: true
    VIDEO_META:
      enabled: true
      max_iterations: 8

Service Provider (SP) Settings

SP lanes are outbound-only — they apply additional normalization when FORGE emits content to external services.

YAML Key Env Var Type Default Description
forge.sp.enabled FORGE_SP_ENABLED bool false Enable outbound SP normalization.
forge.sp.providers — list[dict] [] List of provider configurations (YAML only).
forge.sp.default_policy FORGE_SP_DEFAULT_POLICY str "strict" Default policy for outbound: "strict", "permissive", or "passthrough".

Complete YAML Example

forge_config.yaml
forge:
  # Core
  hmac_secret: "${FORGE_HMAC_SECRET}"  # Can reference env vars
  max_iterations: 10
  convergence_threshold: 0.0
  fail_closed: true
  strict_mode: false
  timeout_ms: 30000
  log_level: INFO

  # Actor
  actor:
    service: "my-production-api"
    version: "3.1.0"
    environment: production

  # Telemetry
  telemetry:
    enabled: true
    upload: true
    endpoint: "https://telemetry.fixpointforge.report"
    batch_size: 100
    flush_interval_s: 60
    anonymize: true
    include_lane_timing: true

  # Lane overrides
  lanes:
    L0:
      enabled: true
      strict: true
    T2:
      strict: true
      config:
        block_injection: true
    T3:
      config:
        policy_file: "policies/compliance_v2.yaml"
    L4:
      config:
        include_content_hash: true

  # Content type overrides
  types:
    DIFF:
      max_iterations: 20
    COMPLIANCE:
      max_iterations: 15
      fail_closed: true
    SPEECH:
      enabled: true
    VIDEO_META:
      enabled: true

  # Service Provider (outbound)
  sp:
    enabled: false
    default_policy: strict

Programmatic Access

Access resolved config values programmatically:

Python
from forge.config import ForgeConfig

# Load from env + YAML
config = ForgeConfig()

# Inspect resolved values
print(config.hmac_secret)           # "my-production-secret"
print(config.max_iterations)        # 10
print(config.telemetry_enabled)     # True
print(config.telemetry_endpoint)    # "https://telemetry.fixpointforge.report"

# Check lane config
print(config.lane_enabled("T2"))    # True
print(config.lane_config("T2"))     # {"block_injection": True, ...}

# Check content type config
print(config.type_enabled("DIFF"))  # True
print(config.type_max_iterations("DIFF"))  # 20

# Override at runtime
config.set("max_iterations", 25)
config.set_lane("T2", "strict", True)

# Validate configuration
errors = config.validate()
if errors:
    for e in errors:
        print(f"Config error: {e}")
💡

Use config.validate() during startup to catch configuration errors early. It checks for missing required fields, invalid types, and unknown lane IDs.