{
  "schemaVersion": "1.0",
  "item": {
    "slug": "local-first-llm",
    "name": "Local-First LLM",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/joelnishanth/local-first-llm",
    "canonicalUrl": "https://clawhub.ai/joelnishanth/local-first-llm",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/local-first-llm",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=local-first-llm",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "references/local-providers.md",
      "references/routing-logic.md",
      "references/token-estimation.md",
      "scripts/check_local.py",
      "scripts/dashboard.py"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/local-first-llm"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/local-first-llm",
    "agentPageUrl": "https://openagent3.xyz/skills/local-first-llm/agent",
    "manifestUrl": "https://openagent3.xyz/skills/local-first-llm/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/local-first-llm/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Local-First LLM",
        "body": "Route requests to a local LLM first; fall back to cloud only when necessary. Track every decision to show real token and cost savings."
      },
      {
        "title": "1. Check if a local LLM is running",
        "body": "python3 skills/local-first-llm/scripts/check_local.py\n\nReturns JSON: { \"any_available\": true, \"best\": { \"provider\": \"ollama\", \"models\": [...] } }"
      },
      {
        "title": "2. Route a request",
        "body": "python3 skills/local-first-llm/scripts/route_request.py \\\n  --prompt \"Summarize this meeting transcript\" \\\n  --tokens 800 \\\n  --local-available \\\n  --local-provider ollama\n\nReturns: { \"decision\": \"local\", \"reason\": \"...\", \"complexity_score\": -1 }"
      },
      {
        "title": "3. Log the outcome",
        "body": "After executing the request, record it:\n\npython3 skills/local-first-llm/scripts/track_savings.py log \\\n  --tokens 800 \\\n  --model gpt-4o \\\n  --routed-to local"
      },
      {
        "title": "4. Show the dashboard",
        "body": "python3 skills/local-first-llm/scripts/dashboard.py"
      },
      {
        "title": "Full Routing Workflow",
        "body": "┌─────────────────────────────────────────────────────┐\n│  1. check_local.py  →  is a local provider running? │\n│                                                      │\n│  2. route_request.py  →  local or cloud?             │\n│     - sensitivity check  (private data → local)      │\n│     - complexity score   (high score → cloud)        │\n│     - availability gate  (no local → cloud)          │\n│                                                      │\n│  3. Execute with the chosen provider                 │\n│                                                      │\n│  4. track_savings.py log  →  record the outcome      │\n│                                                      │\n│  5. dashboard.py  →  show cumulative savings         │\n└─────────────────────────────────────────────────────┘"
      },
      {
        "title": "Routing Rules (Summary)",
        "body": "ConditionRouteNo local provider available☁️ CloudPrompt contains sensitive data (password, secret, api key, ssn, etc.)🏠 LocalComplexity score ≥ 3☁️ CloudComplexity score < 3🏠 Local\n\nFor full scoring details, see references/routing-logic.md."
      },
      {
        "title": "Executing with a Local Provider",
        "body": "Once route_request.py returns \"decision\": \"local\", send the request:"
      },
      {
        "title": "Ollama",
        "body": "curl http://localhost:11434/api/generate \\\n  -d '{\"model\": \"llama3.2\", \"prompt\": \"YOUR_PROMPT\", \"stream\": false}'"
      },
      {
        "title": "LM Studio / llamafile (OpenAI-compatible)",
        "body": "curl http://localhost:1234/v1/chat/completions \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"model\": \"local-model\", \"messages\": [{\"role\": \"user\", \"content\": \"YOUR_PROMPT\"}]}'"
      },
      {
        "title": "Dashboard",
        "body": "The dashboard reads from ~/.openclaw/local-first-llm/savings.json (auto-created).\n\n┌─────────────────────────────────────────┐\n│    🧠  Local-First LLM — Dashboard      │\n├─────────────────────────────────────────┤\n│  Local LLM:  ✅  ollama (llama3.2...)   │\n├─────────────────────────────────────────┤\n│  Total requests:         42             │\n│  Routed locally:         31  (73.8%)    │\n│  Routed to cloud:        11             │\n├─────────────────────────────────────────┤\n│  Tokens saved:       84,200             │\n│  Cost saved:           $0.4210          │\n└─────────────────────────────────────────┘\n\nReset savings data:\n\npython3 skills/local-first-llm/scripts/track_savings.py reset"
      },
      {
        "title": "Additional References",
        "body": "Routing scoring details: references/routing-logic.md\nLocal provider setup (Ollama, LM Studio, llamafile): references/local-providers.md\nToken estimation & cloud cost table: references/token-estimation.md"
      }
    ],
    "body": "Local-First LLM\n\nRoute requests to a local LLM first; fall back to cloud only when necessary. Track every decision to show real token and cost savings.\n\nQuick Start\n1. Check if a local LLM is running\npython3 skills/local-first-llm/scripts/check_local.py\n\n\nReturns JSON: { \"any_available\": true, \"best\": { \"provider\": \"ollama\", \"models\": [...] } }\n\n2. Route a request\npython3 skills/local-first-llm/scripts/route_request.py \\\n  --prompt \"Summarize this meeting transcript\" \\\n  --tokens 800 \\\n  --local-available \\\n  --local-provider ollama\n\n\nReturns: { \"decision\": \"local\", \"reason\": \"...\", \"complexity_score\": -1 }\n\n3. Log the outcome\n\nAfter executing the request, record it:\n\npython3 skills/local-first-llm/scripts/track_savings.py log \\\n  --tokens 800 \\\n  --model gpt-4o \\\n  --routed-to local\n\n4. Show the dashboard\npython3 skills/local-first-llm/scripts/dashboard.py\n\nFull Routing Workflow\n┌─────────────────────────────────────────────────────┐\n│  1. check_local.py  →  is a local provider running? │\n│                                                      │\n│  2. route_request.py  →  local or cloud?             │\n│     - sensitivity check  (private data → local)      │\n│     - complexity score   (high score → cloud)        │\n│     - availability gate  (no local → cloud)          │\n│                                                      │\n│  3. Execute with the chosen provider                 │\n│                                                      │\n│  4. track_savings.py log  →  record the outcome      │\n│                                                      │\n│  5. dashboard.py  →  show cumulative savings         │\n└─────────────────────────────────────────────────────┘\n\nRouting Rules (Summary)\nCondition\tRoute\nNo local provider available\t☁️ Cloud\nPrompt contains sensitive data (password, secret, api key, ssn, etc.)\t🏠 Local\nComplexity score ≥ 3\t☁️ Cloud\nComplexity score < 3\t🏠 Local\n\nFor full scoring details, see references/routing-logic.md.\n\nExecuting with a Local Provider\n\nOnce route_request.py returns \"decision\": \"local\", send the request:\n\nOllama\ncurl http://localhost:11434/api/generate \\\n  -d '{\"model\": \"llama3.2\", \"prompt\": \"YOUR_PROMPT\", \"stream\": false}'\n\nLM Studio / llamafile (OpenAI-compatible)\ncurl http://localhost:1234/v1/chat/completions \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"model\": \"local-model\", \"messages\": [{\"role\": \"user\", \"content\": \"YOUR_PROMPT\"}]}'\n\nDashboard\n\nThe dashboard reads from ~/.openclaw/local-first-llm/savings.json (auto-created).\n\n┌─────────────────────────────────────────┐\n│    🧠  Local-First LLM — Dashboard      │\n├─────────────────────────────────────────┤\n│  Local LLM:  ✅  ollama (llama3.2...)   │\n├─────────────────────────────────────────┤\n│  Total requests:         42             │\n│  Routed locally:         31  (73.8%)    │\n│  Routed to cloud:        11             │\n├─────────────────────────────────────────┤\n│  Tokens saved:       84,200             │\n│  Cost saved:           $0.4210          │\n└─────────────────────────────────────────┘\n\n\nReset savings data:\n\npython3 skills/local-first-llm/scripts/track_savings.py reset\n\nAdditional References\nRouting scoring details: references/routing-logic.md\nLocal provider setup (Ollama, LM Studio, llamafile): references/local-providers.md\nToken estimation & cloud cost table: references/token-estimation.md"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/joelnishanth/local-first-llm",
    "publisherUrl": "https://clawhub.ai/joelnishanth/local-first-llm",
    "owner": "joelnishanth",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/local-first-llm",
    "downloadUrl": "https://openagent3.xyz/downloads/local-first-llm",
    "agentUrl": "https://openagent3.xyz/skills/local-first-llm/agent",
    "manifestUrl": "https://openagent3.xyz/skills/local-first-llm/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/local-first-llm/agent.md"
  }
}