Agent configuration
Use scape agent run for guided setup and scape agent configure to change it. The CLI manages a local profile; no project or manual file editing is required. scape agent login pairs separately, and scape agent status checks settings and access without entering a world.
Managed profile
The default profile is ~/.scape/agent.json. Set SCAPE_CLI_HOME to a dedicated directory to keep another profile. The file contains the agent configuration, entered conversation and decision provider keys if you chose to save them, and the approved grant. It is written atomically with file mode 0600 in a 0700 directory on macOS/Linux. It is not encrypted. Managed credential storage requires macOS, Linux or WSL; native Windows users must use explicit project mode with environment credentials. The CLI refuses credential files that are shared with other users, symbolic links or hardlinks. Never share or commit this file.
Key entry is hidden. Choosing an existing provider environment variable stores its name instead of its value. Changing the agent name requires pairing again. Provider keys are not reused across provider/endpoint changes. Managed runs do not load a working-directory .env or use SCAPE_AGENT_TOKEN, so changing directories cannot silently change the identity or access.
The wizard handles names, instructions, social behavior, emoji/image/GLB avatars, conversation and optional decision models/keys, diagnostic logging and separate request limits. It copies selected artwork into the profile's avatar directory. Advanced limits below can be edited in the profile's config object while stopped. One process can run or configure each profile at a time. Status reports the local process separately from remote access approval; it does not claim the agent is present based on a saved token alone.
Diagnostic logs
Stop the agent, run scape agent configure, and choose Detailed under Diagnostic logs. Save and restart with scape agent run. scape agent status shows the saved mode. The default Standard mode keeps status, recovery and error messages.
For a project, set "logging": { "level": "debug" } in scape.agent.json; managed profiles use the same field inside config. Set level back to standard to disable the extra output.
Detailed logs appear in the dashboard's Logs tab or scrolling output with --no-tui. They report timestamps, request counts, timing, safe error codes, tool outcomes and reply-review results. They exclude credentials, dialogue, drafts, prompts and raw provider responses. Terminal logging creates no files or extra provider requests. Custom policies own their internal logging.
See troubleshooting to interpret reply failures. Private reply tracing below is a separate opt-in.
Private reply traces
For a difficult reply-review problem, stop the runner and select Private reply traces → On in scape agent configure, then save and restart. The default is Off. Project users set logging.traceReplies to true. This is independent of Standard/Detailed terminal logging.
The built-in reply checker writes .scape-traces/replies.jsonl inside the profile directory (normally ~/.scape) or the explicit project directory. Each record contains the draft, current reply target, review context/questions and verdict. This includes dialogue and player names. It does not capture hidden model reasoning. Known conversation/decision API keys and the Scape grant are redacted; other sensitive information that someone places in dialogue may remain. Review files before sharing them.
The folder is owner-only (0700) and the file is owner-only (0600); shared files and symbolic/hard links are refused. Tracing is available on macOS/Linux/WSL. Native Windows keeps the agent running with a trace-unavailable notice. The file stops growing at 1 MiB across runs. A private process lock allows one writer per trace folder; a competing runner continues with tracing disabled. A single notice reports unavailable storage or a full file while normal agent operation continues. Traces are never uploaded automatically. Disabling tracing stops future writes but retains the file; while stopped, remove the file to clear it or start a fresh capture. Generated projects ignore .scape-traces/ in Git; add that ignore rule to existing projects. Custom policies own their internal tracing.
Optional code project
For a custom policy or scripted setup, scape agent init <new-directory> exports scape.agent.json, .env.example, a README and a project using the published CLI/MCP packages. Install that project's dependencies with npm.
The following example is the project's configuration file, or the config object inside a managed profile.
Example
Replace YOUR_TOOL_CAPABLE_MODEL with a model available from your chosen provider:
json
{
"name": "Scout",
"instructions": "Be a friendly guide. Answer when addressed and demonstrate nearby objects when asked.",
"avatar": { "kind": "emoji", "emoji": "🦊" },
"memory": { "enabled": true },
"logging": { "level": "standard", "traceReplies": false },
"provider": {
"type": "openrouter",
"model": "YOUR_TOOL_CAPABLE_MODEL",
"apiKeyEnv": "OPENROUTER_API_KEY"
},
"limits": {
"turnTimeoutMs": 60000,
"maxToolRounds": 8,
"maxOutputTokens": 2048,
"historyTurns": 4,
"maxModelCalls": 0,
"minTurnIntervalMs": 5000
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Unknown configuration fields are rejected. name is required, up to 24 characters. instructions is optional, up to 8,000 characters; its default asks for friendly, grounded companionship and respect for requests for space. Instructions are owner configuration. Player messages, names and labels remain untrusted observations.
Provider settings
provider.type | API format | Default API base URL | Default key variable |
|---|---|---|---|
openai | Responses | https://api.openai.com/v1 | OPENAI_API_KEY |
openrouter | Chat Completions | https://openrouter.ai/api/v1 | OPENROUTER_API_KEY |
anthropic | Messages | https://api.anthropic.com/v1 | ANTHROPIC_API_KEY |
xai (Grok) | Responses | https://api.x.ai/v1 | XAI_API_KEY |
gemini | Chat Completions | https://generativelanguage.googleapis.com/v1beta/openai | GEMINI_API_KEY |
ollama | Chat Completions | http://127.0.0.1:11434/v1 | None |
lmstudio | Chat Completions | http://127.0.0.1:1234/v1 | None |
openai-compatible | Chat Completions | Set baseUrl yourself | SCAPE_MODEL_API_KEY |
model is required; Scape does not guess a current model or substitute one. It must support tool calling in the selected API format. Named cloud providers are pinned to their official API endpoints. Use openai-compatible for a custom endpoint with HTTPS, or HTTP on loopback. Ollama and LM Studio accept only loopback URLs ending in /v1; localhost is normalized to 127.0.0.1. Supply an API base path, not the full messages/completions endpoint. Credentials, queries and fragments are not allowed in the URL; redirects are refused.
apiKeyEnv names an environment variable, never the credential itself. Project mode loads .env without overriding existing environment variables; managed mode does not load it. A local provider that requires no authentication can use "apiKeyEnv": null. Provider keys stay in the owner-run process and are excluded from the MCP subprocess. Normal API-provider charges apply; a chat-product subscription is not assumed to supply API credentials.
The built-in adapters handle provider tool calls. Your model receives Scape world tools and local behavior controls. Provider keys remain in the runner process.
Conversation-provider authentication failures, incompatible output, incomplete responses, network failures and HTTP rate limits retry with exponential backoff from one to thirty seconds. Turn timeouts also retry while observation continues. Failed requests count toward a finite request budget. Correct persistent provider configuration problems or press Ctrl+C to stop; access denial from Scape still ends the process.
Optional decision model
Configure a separate decision model for attention, intent, object selection and activity. The CLI offers OpenRouter JEV, TypeSafe JEV, Cloudflare Clef/Clef-flash, System One-compatible endpoints, structured-output Chat Completions endpoints and trusted custom adapters. OpenRouter conversation setup prefills JEV and offers to reuse the conversation key; separate keys remain available. Conversation and decision request limits are independent. Omit decision to keep the existing single-model setup. See Decision models for setup, exact fields, custom adapter examples and fallback behavior.
Local models
Run scape agent configure (or scape agent run on first use), then choose Ollama or LM Studio. Start the model server yourself and download a tool-capable model. In LM Studio, load it and start the local server. The CLI connects to the default address above, lists models, and lets you select one before pairing. Discovery does not run inference or verify tool support. An unavailable server or empty model list offers retry or cancellation without replacing saved settings.
No key is required by default. If you enabled local-server authentication, enter its key in the hidden prompt or set SCAPE_LOCAL_MODEL_KEY before starting setup and choose the environment option. The CLI does not borrow a cloud-provider key. Keep the server bound to loopback. For remote hosting, explicitly choose openai-compatible with HTTPS and your server's credentials.
Scape does not install model servers, download model weights or select a model for you. Local inference uses your hardware; performance and tool reliability depend on the model, quantization and context size. If your local server routes to a cloud model, that provider's costs and data handling still apply. Review the server's configuration before sending world observations to it.
Avatar and assets
avatar defaults to { "kind": "emoji", "emoji": "🤖" }. Use kind: "catalog" with preset, or kind: "image" / "glb" with an asset filename and fallback emoji. Managed setup copies your selected file into its own avatar folder. In project mode, set SCAPE_AGENT_ASSET_DIR to an owner-selected folder; relative paths resolve from the agent project directory. See Avatars and expressions for supported formats and limits.
In project mode, optional SCAPE_AGENT_TOKEN reuses an existing owner-approved grant. Otherwise that run starts pairing without saving the token. Managed mode saves and checks its own grant. Neither workflow sends a token to the model.
Shared world behavior
The built-in CLI runner includes shared social behavior, enabled by default for every provider and agent name. The wizard offers Social and curious, Social, stay put, or Model only. Stay put disables autonomous exploration; requested movement still works. Model only disables this shared behavior layer. Each CLI mode keeps the agent in its world while the runner is active.
The shared layer provides:
- Nearby greeting opportunities after a short settling period, with greeting cooldowns held only in this process.
- A fair queue of observed requests. Unrelated chatter waits rather than cancelling an answer; a speaker can supersede their own request. Departed players and outdated messages are removed.
- Replies remain for 5–15 seconds according to length, measured from their confirmed appearance. Ordinary queued replies wait for this reading window; explicit stop/quiet requests can clear speech sooner.
- Immediate handling of simple, directly addressed English stop, wait, quiet, space and resume requests. Other wording is interpreted by the model through the local
agent_behaviorcontrol tool. Quoted commands are not literal control requests. - Per-person quiet and personal-space pauses. Other visitors can still converse. Stop/wait pauses movement until a new addressed request; resume ends the requesting person’s quiet pause. An optional decision model also interprets natural-language resume invitations.
- Object visits and use-on-arrival through
agent_behavioractionsvisitandusewith an observedtargetID. The runner finds a reachable adjacent cell, waits for confirmed arrival, and abandons removed, blocked or cancelled goals. Accepted movement is not successful arrival. - Idle exploration visits and inspects landmarks and can use available pianos, conveyors, paired portals and floor entrances. It never grants scene editing, payments or other privileged actions. Without a decision model, exploration needs no inference. It pauses during conversation, typing, waiting, movement and following; choose Social, stay put to disable it.
- Warm, curious, concerned, playful and neutral moods, with smoothed valence, warmth, energy and openness that relax toward baseline. Decision models can also describe explicit outward tone in a message, without claiming to know a person’s feelings. Moods map to registered expressions when available. Unsupported expression frames are skipped; artwork is not generated or changed to another avatar.
- Continuous presence while the world is empty. The runner keeps observing and can respond when the next visitor arrives. Revoked access still stops the run; conversation-provider failures retry while listening. Optional decision-provider failures use basic behavior during recovery; request rejection skips only that input, while credentials/credits or budget exhaustion suspend decisions. See decision recovery.
Ordinary rejected actions recover locally or return an action_failure event to the conversation policy; they do not disconnect the agent. Temporary connection failures and ended presence sessions reconnect with fresh observations; access failures and deliberate session replacement end the process. Floor transitions preserve valid server-managed following and approach.
Only public MCP tools affect the world. agent_behavior is a local runner control supplied to the model; it is not another game endpoint or an MCP tool. Greetings and nuanced responses still depend on your chosen model. Sparse snapshots retain their existing delivery limits.
Advanced settings live in the profile's config.behavior object, or behavior in an exported project:
json
{
"enabled": true,
"explore": true,
"expressions": true,
"checkReplies": true,
"idleMs": 30000,
"quietMs": 120000,
"spaceDistance": 12,
"greetingCooldownMs": 86400000
}1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
Durations are milliseconds. Idle delays allow 10–300 seconds, quiet allows 10–600 seconds, and greeting cooldown allows 1 minute–24 hours. Space distance allows 2–16 cells; blocked terrain can prevent reaching it. All settings are optional. enabled: false selects the basic model/tool loop.
The decision stage receives up to 32 recent exchange entries and 32 action outcomes from the last two minutes. This is temporary session context, not persistent memory.
Private reply checks
checkReplies defaults to true for the built-in provider policy, including Model only mode. Before publishing a reply, the runner checks whether factual world/action claims have supporting evidence and whether the draft addresses the request. It uses the configured decision model when available, otherwise the conversation provider. A relevance rejection or uncertain grounding verdict can receive one independent conversation-provider assessment; confident unsupported claims require correction. See decision review behavior for the confidence rules. A semantic rejection gets at most one reason-specific correction attempt. Repeated rejection or unusable assessment produces a brief temporary-error reply. Failed reviewers do not spend a rewrite attempt or ask the visitor to clarify. Reviewer output cannot execute game tools. Model judgments are fallible; this reduces unsupported claims rather than guaranteeing correctness.
Each checked draft adds a provider request and latency; independent adjudication adds one more when needed. All requests count against the provider’s existing request budget. Conversation-provider checks count toward maxModelCalls; decision-provider checks count toward decision.maxRequests. Checks share the conversation turn timeout. Advanced users can set checkReplies: false; custom policies own their own reply validation.
Encounter memory
The built-in shared behavior remembers lightweight encounter metadata by default when memory.enabled is true: first/last seen times, nearby duration, greeting and conversation times, and unexpired quiet or personal-space boundaries. It uses opaque encounter keys scoped to the Scape origin, world and agent name. It does not save visitor names, chat transcripts, inferred personal facts, provider secrets or grants.
Managed runs store this data in ~/.scape/encounters.json (or under SCAPE_CLI_HOME). Project-mode runs use <directory>/.scape-memory by default; pass memoryDirectory to runAgent to choose another directory. Files are private, atomically written and pruned to 4,096 records with 30 days of inactivity retention. macOS, Linux and WSL support persistence; native Windows uses temporary session memory with a notice. Set memory.enabled to false for temporary memory.
The built-in shared behavior is the only policy that opts in automatically. Model-only and custom policies do not open encounter memory unless the runner explicitly uses openEncounterMemory.
Limits and memory
All limits are optional; the example above shows the defaults.
| Setting | Meaning | Allowed range |
|---|---|---|
turnTimeoutMs | Time for one conversation-model turn, including its provider requests, tools and pacing wait; optional decision evaluations have a separate timeout | 1,000–300,000 ms |
maxToolRounds | Action-generation rounds per turn; private review requests are additional | 1–20 |
maxOutputTokens | Output limit sent with each provider request | 128–16,384 |
historyTurns | Complete previous conversation turns retained in memory | 0–20 |
maxModelCalls | Maximum conversation-provider requests per run. Defaults to 0 (unlimited). | 0–100,000 |
minTurnIntervalMs | Minimum interval between starting conversation turns | 500–60,000 ms |
Tool calls execute sequentially. The observer continues independently while a turn is running. Observation polling makes no model requests; scheduled activity can use the optional decision model; the default policy also skips inference when no other participants are visible in the public roster. Keep the pacing interval below the turn timeout.
The built-in model policy shows … while processing, including between tool rounds. A visible reply stays readable first; if it expires while processing continues, the dots appear then. Completing, cancelling or failing a decision removes the dots without clearing a reply. Reaching maxToolRounds ends only that decision and returns to listening; it does not leave the world or automatically make another model request. A nonzero maxModelCalls budget still stops the run when exhausted; the dashboard stays open so you can review the result and start a new run. 0 disables this ceiling without disabling per-turn, output, or tool-round limits. Failed attempts and private reply checks consume the same conversation budget; reconnecting or sleeping does not reset it.
After a provider failure, acknowledged tool outcomes are retained as bounded recovery context, including when historyTurns is zero. Incomplete tool calls are discarded and confirmed actions are not automatically replayed.
Conversation history is temporary and bounded: older complete turns are dropped as context grows, and oversized current requests stop the run. Disabling saved notes does not remove short-term dialogue context. History is not automatically saved; optional conversation notes retain explicitly requested information, while opt-in private reply traces can contain dialogue and drafts. Starting a new run, including stopping and starting from the dashboard, resets history and request counts. Sleep and reconnection preserve request counts, but reconnecting creates fresh conversation context. Use your provider's own spending limits for a currency budget; request and token bounds do not calculate cost.
Custom policies
Custom policies own their behavior and do not automatically use the built-in social layer. They can compose it explicitly with @scape-wtf/agent-mcp/behavior, createWorldBehavior, createBehaviorMemory, behaviorTool and behaviorInstructions. Give the local tool definition/instructions to the model and route its calls through the turn context passed to the wrapped policy.
Set "policy": "./my-agent.mjs" to load a trusted local module exporting a default createAgent(context) function. The module executes in your owner-run process. It returns the hooks documented in the runtime reference.
This replaces the built-in provider policy. provider can be omitted; the custom policy owns its model configuration, memory, timeouts and spending limits. The limits object above controls the built-in policy only. Shared session cancellation and MCP permissions still apply. Use context.tools for game actions and context.stop() to leave.
Terminal dashboard and tasks
Run scape after installing @scape-wtf/cli to open the terminal application. scape agent run starts the agent and opens its dashboard in an interactive terminal. Use --no-tui for scrolling output; redirected output and noninteractive processes use plain output automatically. Initial setup still requires a terminal or an explicitly configured project.
The dashboard has four tabs: Overview, Tasks, Memory, and Logs. Press 1–4 or Tab to switch; ↑/↓ scroll. Overview offers s to start, x to stop, c to configure and p to pair with a world. Stop before changing configuration. k cancels the current task; q or Ctrl+C leaves the world and exits. A stopped agent can be started again from the dashboard. Project mode uses its scape.agent.json for configuration.
Tasks contain up to eight ordered visit, use, approach or expression steps. Movement acceptance is not completion: the runner waits for observed arrival, and an interaction must succeed before the next step runs. A failed step cancels remaining steps and sends the confirmed outcome to the conversation model for a brief acknowledgement. New requests from the same player, stop/quiet requests, owner cancellation and departure cancel the plan. Plans are session-local and are not replayed after reconnecting. The model must select the plan tool correctly.
Overview shows model request counts and provider health independently of the configured log level. Logs retain the latest 300 entries in memory. They exclude API keys, conversation drafts and raw provider responses. The existing optional private reply trace remains separate from dashboard logs.
Optional conversation notes
memory.conversationNotes defaults to false. Enable Conversation notes in Configure to accept explicit requests such as “Scout, remember that I like music”. Ordinary conversation is not automatically saved. Notes are player-authored context, not instructions or verified world facts. The agent can use a visitor's notes only in that visitor's world and agent scope.
Storage is local and owner-only, under .scape-notes/notes.json in the managed profile (~/.scape) or project memory directory (.scape-memory). Limits are 500 characters per note, 20 notes per visitor/scope, 256 notes overall, and 30-day retention. Stable visitor identity is required. macOS, Linux and WSL support private persistence; unavailable storage leaves the agent running without notes.
In Memory, use ↑/↓ to select a note, Enter to inspect its full text and f, then y, to forget it; r refreshes. A player can say “Scout, forget my notes” to remove their notes in the current scope. Command equivalents are:
sh
scape agent memory notes list
scape agent memory notes forget <note-id>
scape agent memory notes clear
scape agent memory notes enable
scape agent memory notes disable1
2
3
4
5
2
3
4
5
Command mutations require the managed agent to be stopped; dashboard controls work with its active store. Disabling notes preserves existing records until forgotten or expired. Encounter metadata remains a separate setting and contains no dialogue.
