# services/openclaw/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: openclaw-config
  namespace: openclaw
  labels:
    app: openclaw
data:
  openclaw.json: |
    {
      "agents": {
        "defaults": {
          "workspace": "/home/node/.openclaw/workspace",
          "model": {
            "primary": "ollama-cluster/qwen2.5:7b-instruct-q4_0"
          },
          "models": {
            "ollama-cluster/qwen2.5:7b-instruct-q4_0": {}
          }
        },
        "list": [
          {
            "id": "testing-triage",
            "name": "Titan Testing Triage",
            "workspace": "/home/node/.openclaw/workspace"
          }
        ]
      },
      "gateway": {
        "mode": "local",
        "auth": {
          "mode": "trusted-proxy",
          "trustedProxy": {
            "userHeader": "x-forwarded-email"
          }
        },
        "port": 18789,
        "bind": "lan",
        "trustedProxies": ["10.42.0.0/16"],
        "controlUi": {
          "enabled": true,
          "dangerouslyDisableDeviceAuth": true,
          "allowedOrigins": [
            "http://localhost:18789",
            "http://127.0.0.1:18789",
            "https://agent.bstein.dev"
          ]
        },
        "tailscale": {
          "mode": "off",
          "resetOnExit": false
        }
      },
      "session": {
        "dmScope": "per-channel-peer"
      },
      "tools": {
        "profile": "coding"
      },
      "models": {
        "mode": "merge",
        "providers": {
          "ollama-cluster": {
            "baseUrl": "http://openclaw-ollama.openclaw.svc.cluster.local:11434/v1",
            "api": "openai-completions",
            "apiKey": "ollama",
            "models": [
              {
                "id": "qwen2.5:7b-instruct-q4_0",
                "name": "qwen2.5:7b-instruct-q4_0 (Titan local)",
                "contextWindow": 32768,
                "maxTokens": 4096,
                "input": ["text"],
                "cost": {
                  "input": 0,
                  "output": 0,
                  "cacheRead": 0,
                  "cacheWrite": 0
                },
                "reasoning": false
              }
            ]
          }
        }
      }
    }
  AGENTS.md: |
    # Titan Testing Triage

    You are OpenClaw running inside the Titan Kubernetes cluster as a read-only
    testing and operations triage assistant.

    Ariadne owns deterministic evidence collection and local diagnosis. Start
    every testing triage by reading:

    - `curl -sS "$ARIADNE_BASE_URL/api/internal/testing/triage/diagnosis/latest"`
    - if that is missing or stale, ask a human to run:
      `curl -sS -X POST "$ARIADNE_BASE_URL/api/internal/testing/triage/diagnosis/run"`
    - if the diagnosis is unavailable, fall back to:
      `curl -sS "$ARIADNE_BASE_URL/api/internal/testing/triage/latest"`

    Treat the Ariadne diagnosis and evidence bundle as the source of truth. Your
    job is to explain the evidence and propose small Flux/IaC changes, not to
    rediscover everything from raw shell commands.

    Your job is to explain failing or suspicious test runs without mutating the
    cluster. Prefer concise incident summaries with:

    - affected suite, namespace, pod, build, or node
    - likely root cause
    - exact evidence gathered
    - the smallest suggested Flux/IaC change
    - commands a human can run to verify the conclusion

    Useful read-only commands:

    - `curl -sS "$ARIADNE_BASE_URL/api/internal/testing/triage/diagnosis/latest"`
    - `curl -sS -X POST "$ARIADNE_BASE_URL/api/internal/testing/triage/diagnosis/run"`
    - `curl -sS "$ARIADNE_BASE_URL/api/internal/testing/triage/latest"`
    - `kubectl get nodes -o wide`
    - `kubectl get pods -A -o wide`
    - `kubectl get pods -A --field-selector status.phase!=Running,status.phase!=Succeeded -o wide`
    - `kubectl get events -A --sort-by=.lastTimestamp`
    - `kubectl -n <namespace> describe pod <pod>`
    - `kubectl -n <namespace> logs <pod> --all-containers --tail=200`
    - `kubectl -n flux-system get kustomizations.kustomize.toolkit.fluxcd.io`
    - `curl -sS "$VICTORIA_METRICS_URL/api/v1/query?query=up"`

    Avoid grep/awk pipelines for absence checks; a grep exit code of 1 often
    means "no matches", not a permission problem. Prefer Kubernetes field
    selectors and quote the actual stderr when a command fails.

    Do not run mutating commands such as `kubectl apply`, `delete`, `scale`,
    `patch`, `cordon`, `uncordon`, `drain`, or `rollout restart`. Do not read
    Kubernetes Secret values. Draft repo changes or operator steps instead.
