Autonomy entry points

Single operator page for running dark-factory lmeta flows and optional Fleet dispatch through CLI, HTTP (forge-cdp-manager), or MCP (forge-lcdl sidecar). All surfaces are default-deny: flows, dispatch, and Fleet hooks…

Updated

Related: PDCA campaigns, lmeta mode, Fleet dispatch, forge-lcdl MCP sidecar, CDP flows API.

Security callout

  • Flows (MCP): lcdl.run_flow is unavailable until FORGE_LCDL_MCP_FLOW_ALLOWLIST lists colon-separated directories; resolved paths must stay under those roots.
  • Fleet (MCP): lcdl.dispatch_fleet_job registers only with allowlist and FORGE_LCDL_MCP_ALLOW_DISPATCH=1.
  • Fleet (HTTP): FORGE_CDP_FLEET_DISPATCH=1 plus a resolvable fleet-servers.json injects the dispatch consumer hook at CDP manager startup; default off.
  • Campaign host: FORGE_DARK_FACTORY_DISPATCH=fleet is separate from MCP/CDP flags; assay and freeze gates always run on the host.

Never commit bearer tokens or API keys. Use env vars and local config files excluded from git.


CLI (PDCA + lmeta)

From the forge-dark-factory repo root:

export FORGE_DARK_FACTORY_VIA_LMETA=1
# optional parallel Fleet fan-out on the campaign host:
export FORGE_DARK_FACTORY_DISPATCH=fleet
export FORGE_FLEET_SERVERS_FILE=config/fleet-servers.json

python -m forge_dark_factory.pdca run --campaign examples/poc-sandbox-offline.yaml
Variable Purpose
FORGE_DARK_FACTORY_VIA_LMETA Run driver via flows/df-driver-loop.lmeta instead of legacy driver.py
FORGE_DARK_FACTORY_DISPATCH fleet → fan-out items to Forge Fleet (docker_argv jobs)
FORGE_FLEET_SERVERS_FILE Host Fleet node list (see config sample below)

See PDCA-CAMPAIGNS.md for campaign YAML and worker ladder details.


HTTP (forge-cdp-manager :18770)

Start the CDP manager (default 127.0.0.1:18770), then run a flow:

export FORGE_CDP_FLEET_DISPATCH=1          # only if the flow uses dispatch consumer hook
export FORGE_FLEET_SERVERS_FILE=config/fleet-servers.json

curl -sS -X POST "http://127.0.0.1:18770/v1/flows/run" \
  -H "Content-Type: application/json" \
  -d @- <<'JSON'
{
  "flow": {
    "id": "df-driver-loop",
    "automationFlowVersion": 3,
    "start": "Classify",
    "states": []
  },
  "inputs": {
    "goal": "example",
    "target": "poc-sandbox-offline"
  }
}
JSON

Replace the inline "states": [] stub with the full document from flows/df-driver-loop.lmeta for real runs.

Poll run status:

curl -sS "http://127.0.0.1:18770/v1/flows/runs/<run_id>"

The dispatch hook is registered at daemon startup, not per request. When FORGE_CDP_FLEET_DISPATCH is unset, flows that call "hook": "dispatch" receive {"ok": false, "error": "FORGE_CDP_FLEET_DISPATCH is not enabled"}.


MCP (Cursor / Hermes)

Add to Cursor mcp.json (adjust cwd to your forge-lcdl clone):

{
  "mcpServers": {
    "lcdl-local": {
      "command": "python3",
      "args": ["-m", "forge_lcdl.integrations.mcp.server"],
      "cwd": "/path/to/forge-lcdl",
      "env": {
        "PYTHONPATH": "src",
        "FORGE_LCDL_MCP_FLOW_ALLOWLIST": "/path/to/forge-dark-factory/flows",
        "FORGE_LCDL_MCP_ALLOW_DISPATCH": "0",
        "FORGE_LCDL_MCP_RUN_DIR": "/tmp/lcdl-mcp-runs"
      }
    }
  }
}

Set FORGE_LCDL_MCP_ALLOW_DISPATCH to 1 only when Fleet submit via MCP is intended.

Example tool call (lcdl.run_flow):

{
  "flow_path": "df-driver-loop.lmeta",
  "inputs": {
    "goal": "smoke",
    "target": "poc-sandbox-offline"
  }
}

Follow with lcdl.flow_status and {"run_id": "<id from run_flow>"}.


Config samples

config/llm-priority.json (forge-lcdl / campaign cwd)

Minimal valid registry (place under repo config/ or set FORGE_LCDL_LLM_PRIORITY_FILE):

{
  "profiles": [
    {
      "id": "local-primary",
      "priority": 0,
      "base_url": "http://127.0.0.1:11434/v1",
      "api_key": "",
      "model": "ctx-unlim-qwen3-8b:latest",
      "timeout_sec": 120,
      "json_mode": true
    }
  ]
}

See forge-lcdl llm-priority reference.

config/fleet-servers.json

Copy config/fleet-servers.json.example in this repo:

{
  "nodes": [
    {
      "id": "localhost-fleet",
      "base_url": "http://127.0.0.1:18766",
      "bearer_token": "REPLACE_WITH_FLEET_BEARER",
      "enabled": true,
      "priority": 100,
      "max_cpu_percent": null,
      "max_memory_percent": null
    }
  ]
}

Used by dark-factory dispatch, CDP FORGE_CDP_FLEET_DISPATCH, and MCP lcdl.dispatch_fleet_job (via FORGE_FLEET_SERVERS_FILE or servers_path argument).


Surface comparison

Surface Best for Flow guard Fleet guard
CLI pdca Full campaigns, host-side gates FORGE_DARK_FACTORY_VIA_LMETA FORGE_DARK_FACTORY_DISPATCH=fleet
HTTP /v1/flows/run Automation, Cockpit-adjacent runs Inline flow JSON FORGE_CDP_FLEET_DISPATCH=1
MCP sidecar Cursor / agent tool calls FORGE_LCDL_MCP_FLOW_ALLOWLIST FORGE_LCDL_MCP_ALLOW_DISPATCH=1