Use Cara as a guarded local project assistant

Outcome

Run Cara against one explicit workspace root so it can inspect and search local project files without getting unrestricted disk access.

Prerequisites

Export these shell variables first:

export CARAPACE_GATEWAY_TOKEN="$(openssl rand -hex 32)"
export OLLAMA_BASE_URL="http://127.0.0.1:11434"
export WORKSPACE_ROOT="$PWD"

Windows (PowerShell) alternative:

$bytes = [byte[]]::new(32)
[System.Security.Cryptography.RandomNumberGenerator]::Fill($bytes)
$env:CARAPACE_GATEWAY_TOKEN = [System.BitConverter]::ToString($bytes).Replace('-', '').ToLower()
$env:OLLAMA_BASE_URL = "http://127.0.0.1:11434"
$env:WORKSPACE_ROOT = (Get-Location).Path

1) Create config

Create carapace.json5:

{
  "gateway": {
    "bind": "loopback",
    "port": 18789,
    "auth": {
      "mode": "token",
      "token": "${CARAPACE_GATEWAY_TOKEN}"
    }
  },
  "providers": {
    "ollama": {
      "baseUrl": "${OLLAMA_BASE_URL}"
    }
  },
  "agents": {
    "defaults": {
      "model": "ollama:llama3"
    }
  },
  "filesystem": {
    "enabled": true,
    "roots": ["${WORKSPACE_ROOT}"],
    "excludePatterns": [".git", "node_modules", "target", "*.env"]
  }
}

This recipe keeps filesystem access read-only. Cara can read, list, stat, and search inside WORKSPACE_ROOT, but it cannot write or move files until you opt into filesystem.writeAccess.

2) Run commands

Start Cara:

CARAPACE_CONFIG_PATH=./carapace.json5 cara

In another terminal, point the CLI at the same config file. If you opened a fresh shell, re-export the same gateway token value from the first step before running cara verify or cara chat.

export CARAPACE_CONFIG_PATH="$PWD/carapace.json5"
# If this is a fresh shell, reuse the same gateway token value from the
# prerequisites export step above.
# export CARAPACE_GATEWAY_TOKEN="same-token-from-prerequisites"

cara verify --outcome local-chat --port 18789
cara chat --port 18789

Then try prompts that exercise the guarded workspace tools:

3) Verify

Next step

Common failures and fixes

Need a recipe for your use case?

Tell us what outcome you want and we can prioritize a walkthrough.

Request a cookbook recipe