larik v0.25.0

Guide

Execution

The permission mode decides what Larik may do without asking. The execution setting decides how the model does it, and the two combine freely (plan mode with scripts is a good pair for exploring).

Setting What the model gets
tools The tools, one call per step.
hybrid The tools plus run_code, and it picks per step: scripts for loops, chained lookups and filtering large output, direct calls otherwise.
code run_code for ordinary tools, plus the conversation-level tools directly: subagents, the task list, skills, memory and plan approval. The default.

run_code runs JavaScript in an embedded interpreter, in a separate process started from the Larik binary, with no file, network or process access of its own. When the sandbox is on, that process is also confined more strictly than bash commands: no writes, no network (not even localhost), no API keys in its environment, and no reading home or temp directories. A script can only call tools (tools.read({path}), tools.call(name, args)), and gets their text back. Only what the script prints returns to the model, so reading forty files to count something costs the context one summary instead of forty results.

Some things work differently in a script:

  • bash returns more. It returns {output, exit_code, truncated} with up to 1 MB of output, and a non-zero exit code doesn't throw.
  • read, grep and glob return objects. read gives {path, content, start_line, end_line, more, next_offset?}, with the lines as they are (no line numbers) and up to 1 MB of them; grep gives {matches: [{path, line, text}], truncated} and glob {paths, truncated}, each with up to 5,000 results.
  • The core tools are described in full. In code mode, run_code's description gives read, write, edit, multi_edit, bash, grep, glob and raw_output their whole descriptions and argument notes, and the system prompt advises how to work in scripts; other tools get one line each.
  • Calls can run at once. tools.parallel([{name, args}, …]) runs several calls together, read-only ones side by side, and returns each result or error in order.
  • MCP tool names are valid JavaScript. Characters that can't appear in an identifier become _, so mcp__my-server__search is tools.mcp__my_server__search.
  • Long output is kept. When a script prints more than fits in a tool result, the model sees the start and end, and raw_output reads the rest.
  • Tools can be found by keyword. tools.search(query) ranks the tools a script can call, which helps when many MCP tools are connected and the list in run_code's description shows only their names.
  • Small values can survive between scripts. store(key, value) keeps a JSON value for later run_code calls and load(key) reads it (undefined when absent); store(key, undefined) deletes it. Changes commit together only when the script succeeds and survive compaction and resume; /clear deletes them. They're kept in a state file beside the session, so rewriting values doesn't grow the transcript. A branch starts with the session's current values, wherever it's cut. A key is limited to 256 bytes, one encoded value to 256 KB, and all values together to 1 MB.

Every call a script makes goes through the same checks as a direct one: permission rules and mode, hooks, auto mode, checkpoints for /undo. A script in plan mode can read but not write; in default mode you are asked about an edit in the middle of a script. Each script is limited to 200 tool calls, 256 MB of memory, a call depth of 10,000, and a timeout (120 seconds by default, up to 600). Time spent awaiting an auto-mode approval verdict or your answer to a permission prompt doesn't count toward it; actual script and tool execution still does. A script that runs out of memory is stopped and the model is told why; Larik itself keeps running. Subagents use their own model's setting. Claude Code CLI subagents default to tools instead of inheriting the global code default, unless an explicit model_execution entry chooses otherwise. This does not change the main agent or other providers.

In code mode, the model calls the conversation-level tools directly: task, task_wait and task_stop, todo_write, skill, memory, exit_plan_mode and ask_user. Scripts cannot call them, and subagents still cannot start further subagents. Changing execution in an existing conversation saves the choice for the next /clear or new session, so the tool list stays stable while that conversation is in context. A new conversation applies the choice immediately.

The right setting depends on the model: a strong model writes reliable scripts, a small one may not. So it is set per model, with a default for the rest:

json
{
  "execution": "code",
  "model_execution": { "ollama/qwen3-coder": "tools", "claude-opus-5": "hybrid" }
}

Keys are provider/model or a bare model id, and provider/model wins. /execution code saves a setting for the model you're using, /execution default removes it, and /execution alone opens a picker for the model you're using, with its saved setting marked. The default is "Default execution" in /config. Switching models (/model) switches to that model's setting, and subagents use their own model's. Measure before choosing: larik bench --models <model> --execution tools,hybrid,code --runs 3. Bench runs with Larik's base system prompt and the fixture's project instructions, but not your personal instructions, skills or memory, so results are reproducible and prompt changes are actually measured.

Background commands

bash with run_in_background starts a command, such as a dev server, a watcher or a long build, and returns a task id at once so the model can keep working. The output goes to the command's log, which the model reads with raw_output while it runs. When the command exits, the end of its output and its exit code reach the model in its next turn; if Larik is idle, a turn starts by itself. task_wait blocks until it exits, task_stop kills it, and quitting the session stops it. It shares the limit of eight background tasks with background subagents. A background command runs without a time limit unless the call sets timeout (up to 24 hours). Its file changes aren't recorded for /undo. Subagents can't start one. In larik -p the run ends when the model is done, even if background commands are still running; they are stopped then.

Generated from README.md · section “Execution”. Edit that file to change this page.