SakuraDocs

Sakura Configuration Reference

Overview

Sakura uses a layered configuration system: a TOML file for CLI profiles, JSON files for MCP server connections and team orchestration, and environment variables for secrets and runtime overrides.


1. CLI Configuration — config.toml

The primary CLI configuration file lives at .sakura/config.toml in your project directory. It is created automatically by sakura init.

Sources: src/config.ts

Schema

version = 1
defaultProfile = "default"
maxPlanAgeHours = 4

[profiles.default]
provider = "openai"
model = "gpt-5.2"
temperature = 0.2

[profiles.coding-claude]
provider = "anthropic"
model = "claude-sonnet-4-20250514"
temperature = 0.2

[phase]
language = "typescript"
buildCommand = "pnpm build"
lintCommand = "pnpm lint"
referenceFiles = ["src/types.ts", "src/config.ts"]
projectContext = "A deterministic AI CLI tool"

Top-Level Fields

FieldTypeDefaultDescription
version1 (literal)Schema version. Must be 1.
defaultProfilestring"default"Which profile to use when none is specified via --profile.
maxPlanAgeHoursnumber4Plans older than this are considered stale.

Profile Fields ([profiles.<name>])

FieldTypeDefaultDescription
provider"openai" | "anthropic""openai"LLM provider to use for this profile.
modelstring(provider default)Model identifier. If omitted, the provider uses its own default.
temperaturenumber (0–2)0.2Sampling temperature. Lower = more deterministic.
awsProfilestringAWS CLI profile name to use for AWS commands.
awsRegionstringAWS region override for this profile.

Sources: src/config.tsProfileSchema

Phase Fields ([phase])

Used by the /phase scaffold command to drive code generation.

FieldTypeDefaultDescription
language"typescript" | "python" | "go" | "rust""typescript"Target language for generated code.
buildCommandstring"pnpm build"Command to verify the build after code generation.
lintCommandstringOptional lint command run after build.
referenceFilesstring[][]Files injected as context into the code generation prompt.
projectContextstring""Free-text description of the project, injected into prompts.

Sources: src/config.tsPhaseSchema, src/scaffold/phase.ts

Config Resolution Flow

Sources: src/config.tsensureInitialized, loadConfig, resolveProvider


2. MCP Server Configuration — mcp.json

Configures external Model Context Protocol servers that Sakura connects to at REPL startup. Tools and resources from these servers are registered into the tool registry and made available to the LLM.

Sources: src/mcp/config.ts, src/mcp/lifecycle.ts, src/mcp/bridge.ts

File Locations (searched in order)

PriorityPath
1 (local).sakura/mcp.json (project directory)
2 (global)~/.sakura/mcp.json (home directory)

The first file found is used. If neither exists, MCP is disabled silently.

Schema

{
  "mcpServers": {
    "my-server": {
      "command": "npx",
      "args": ["-y", "@my-org/mcp-server"],
      "env": {
        "API_KEY": "${MY_API_KEY}"
      },
      "trustLevel": "trust_read_only"
    },
    "remote-server": {
      "url": "https://mcp.example.com/sse",
      "transport": "sse",
      "trustLevel": "not_trusted"
    }
  }
}

Server Config Fields

FieldTypeRequiredDescription
commandstringFor stdioExecutable to launch the MCP server process.
argsstring[]NoArguments passed to command.
envRecord<string, string>NoEnvironment variables for the server process. Supports ${VAR} expansion from the host environment.
urlstringFor sse/httpURL of the remote MCP server. Supports ${VAR} expansion.
transport"stdio" | "sse" | "http"NoTransport type. Auto-detected: stdio if command is set, sse if url is set.
trustLevelTrustLevelNoDefault: "not_trusted". Controls whether tool calls require user confirmation.

Transport Types

TransportWhen to UseRequired Fields
stdioLocal process (npx, python, binary)command
sseRemote server via Server-Sent Eventsurl
httpRemote server via Streamable HTTPurl

Sources: src/mcp/client.tscreateTransport

Trust Levels

MCP tools inherit the trustLevel from their server config. Resources are always registered as trust_read_only.

LevelBehavior
trustedExecutes without any confirmation prompt.
trust_read_onlyAuto-approved for read operations; prompts for writes.
trust_working_dirAuto-approved for paths inside cwd; prompts for paths outside.
not_trustedAlways prompts the user before execution.

Sources: src/tools/registry.ts, src/tools/executor.ts

MCP Startup Flow


3. Model Tiers and Provider Defaults

Sakura supports two providers. Each has a default model used when model is omitted from the profile.

Sources: src/providers/openai.ts, src/providers/anthropic.ts

Provider Defaults

ProviderDefault ModelMax TokensNotes
openaigpt-5.2(API default)Uses OpenAI Responses API.
anthropicclaude-sonnet-4-202505144096 (standard), 16000 (thinking)Supports extended thinking via thinking: true.
Use CaseProviderModelTemperature
General / AWS tasksopenaigpt-5.20.2
Code generationanthropicclaude-sonnet-4-202505140.2
Complex reasoninganthropicclaude-sonnet-4-202505141.0 (thinking mode)
Deterministic outputEitherAny0

Anthropic-Specific Features

FeatureHow to EnableEffect
Extended thinkingreq.thinking = trueRaises max_tokens to 16,000, sets temperature = 1
Prompt cachingAutomaticApplied to the last tool in the tools array via cache_control: ephemeral
System prompt cachingAutomaticApplied to system prompt when present

Sources: src/providers/anthropic.ts


4. API Provider — Managed Key Mode

When a user is logged in via sakura login, the ApiProvider is used instead of direct provider SDKs. API keys are managed server-side.

Sources: src/providers/api.ts, src/auth/keys.ts, src/auth/session.ts

Key Resolution Order

Sources: src/repl/index.tsresolveLlmProvider

Auth Storage

ItemPathPermissions
Auth token~/.sakura-cli/auth.json0o600 (owner read/write only)
Bundled keysdist/keys.jsonEmbedded at build time

Sources: src/auth/session.ts


5. Environment Variables

CLI Environment Variables

VariablePurposeDefaultRequired
OPENAI_API_KEYOpenAI API key for direct provider useIf using OpenAI without login
ANTHROPIC_API_KEYAnthropic API key for direct provider useIf using Anthropic without login
SAKURA_API_URLBase URL for the Sakura API proxyhttps://api.sakura-ai.devNo
AWS_PAGERDisables AWS CLI pager (set to "" automatically)""No
AWS_PROFILEAWS CLI profile (can also be set in config.toml)No
AWS_REGIONAWS region overrideNo

Sources: src/providers/api.ts, src/aws/runner.ts, src/auth/keys.ts

API Server Environment Variables

VariablePurposeDefaultRequired
JWT_SECRETSecret for signing JWT tokensYes
STRIPE_SECRET_KEYStripe API key for billingYes (billing features)
STRIPE_WEBHOOK_SECRETStripe webhook signature verificationYes (billing features)
OPENAI_API_KEYOpenAI key used server-side for completionsYes
ANTHROPIC_API_KEYAnthropic key used server-side for completionsYes
AWS_REGIONDynamoDB regionus-east-1No
GITHUB_CLIENT_IDGitHub OAuth app client IDYes (GitHub login)
GITHUB_CLIENT_SECRETGitHub OAuth app client secretYes (GitHub login)

Sources: api/src/services/secrets.ts, api/src/routes/auth.ts, api/.env

SSM Parameter Store (Production)

The API reads secrets from AWS SSM Parameter Store in production. The CLI also checks SSM for API keys before falling back to the API proxy.

SSM ParameterUsed ByDescription
/sakura/api/openai-keyCLI (REPL), APIOpenAI API key
/sakura/api/anthropic-keyCLI (REPL), APIAnthropic API key
/sakura/jwt-secretAPIJWT signing secret
/sakura/stripe-secretAPIStripe secret key

Sources: src/repl/index.tsgetKeyFromSsm, api/src/services/secrets.ts


6. Local State Files

Sakura writes runtime state to .sakura/ in the project directory.

PathContentsCreated By
.sakura/config.tomlCLI configurationsakura init
.sakura/mcp.jsonMCP server config (local)User
.sakura/plans/Saved plan JSON filesPlanning system
.sakura/plans/latest.jsonMost recent planPlanning system
.sakura/sessions/Conversation session filesREPL
.sakura/mcp/latest.jsonMCP knowledge pack/init command
.sakura/project.mdProject context for prompts/init command
.sakura/build-state.json/build command progressScaffold system
.sakura/settings.jsonLocal settings overrides/set command
~/.sakura-cli/auth.jsonLogin token and emailsakura login
~/.sakura-cli/settings.jsonGlobal settings/set --global
~/.sakura/mcp.jsonGlobal MCP server configUser

Sources: src/planning/store.ts, src/sessions/store.ts, src/mcp/config.ts, src/util/settings.ts, src/auth/session.ts


7. Settings

Runtime settings can be changed