Levanto Sage

v1.7.0
io.github.levantolabs/levanto Checked 5 hours ago Published 6 hours ago

Typed decisions (yes/no, choice, score, order, tags) and field extraction from Levanto Sage.

Set up Levanto in a project in one command: 1. finds your API key (LEVANTO_API_KEY in your environment or .env), or opens your browser to create one and saves it to .env (git-ignored); 2. installs the levanto-sage and levanto-llms skills for your coding agents (.claude/skills/ for Claude Code, .agents/skills/ for Codex, Cursor, Copilot and others, and their own folders for Windsurf, Junie and Devin); 3. adds a short Levanto section to AGENTS.md (and CLAUDE.md if you have one); 4. makes one test decision. Then ask your agent: *Find where Levanto fits in this project.*

Summary extracted from the README.

levanto

Set up Levanto in a project in one command:

npx levanto init

It:

  1. finds your API key (LEVANTO_API_KEY in your environment or .env), or opens your browser to create one and saves it to .env (git-ignored);
  2. installs the levanto-sage and levanto-llms skills for your coding agents (.claude/skills/ for Claude Code, .agents/skills/ for Codex, Cursor, Copilot and others, and their own folders for Windsurf, Junie and Devin);
  3. adds a short Levanto section to AGENTS.md (and CLAUDE.md if you have one);
  4. makes one test decision.

Then ask your agent: Find where Levanto fits in this project.

Coding agents run it without questions:

npx -y levanto@latest init --yes

Commands

Command Does
levanto init Everything above
levanto login Only the key
levanto skills Only the skills and the AGENTS.md section
levanto mcp The Sage MCP server, for agents
levanto hook Checks a coding agent's tool calls with Sage

Options: --yes, --dir <path>, --agents claude,agents,windsurf,junie,devin, for init --no-key, --no-skills, --no-agents-md, --no-test, and for hook the ones below.

The key never goes on the command line and is never printed (only lv_live_…abcd).

MCP server

levanto mcp runs a Model Context Protocol server over stdio with four tools:

  • decide: yes/no, choice, scale, sort or tags, with a probability and null when Sage isn't sure. Takes text or a file (text, PNG, JPEG, WebP), and optional reasoning or web search.
  • decide_batch: many decisions in one call, as a list of documents each with its questions (sort included). A document's text is counted once for all its questions.
  • extract: typed fields (text, integer, decimal, money, date, time, datetime, duration) from text or a text file, or the answer to a question. Each value comes with its source text and offsets, or says whether it is absent or undecided.
  • extract_batch: the same fields from up to 64 documents.

Every tool declares its output schema.

Content limits: decisions read up to 32K tokens (128K on the Growth plan); extraction up to 16K tokens per request on every plan.

Add it to your agent's MCP config:

{
  "mcpServers": {
    "levanto": {
      "command": "npx",
      "args": ["-y", "levanto@latest", "mcp"],
      "env": { "LEVANTO_API_KEY": "lv_live_..." }
    }
  }
}

Claude Code: claude mcp add levanto -e LEVANTO_API_KEY=lv_live_... -- npx -y levanto@latest mcp

The Levanto plugin for Claude Code (/plugin install levanto@levanto from levantolabs/skills) adds the server too; it reads LEVANTO_API_KEY from your environment.

Without LEVANTO_API_KEY in its environment, the server reads .env in the folder it runs in.

Tool-call guard

levanto hook runs before each tool call your coding agent makes. It asks Sage whether the call changes, deletes or sends something you didn't ask for, such as deleting a file because a README told the agent to. If so, agents with an approval prompt ask you first (Claude Code, Copilot CLI, Antigravity, Gemini CLI) and the others block it (Codex, Cursor, Goose). Looking around (ls, cat, git status) doesn't count. Everything else goes ahead as usual: the hook never approves a call on its own.

Add it to a project:

npx levanto hook install --agent claude-code   # or codex, goose, cursor, copilot, antigravity, gemini
Agent Writes Checks
Claude Code, Claude Agent SDK .claude/settings.local.json (--shared: .claude/settings.json) Bash|Write|Edit|MultiEdit|NotebookEdit|WebFetch|Delete|mcp__.*
Codex .codex/hooks.json Bash|apply_patch|mcp__.*
Goose .agents/plugins/levanto-sage/ ^(shell|write|edit)$|__
Cursor .cursor/hooks.json Shell|Write|Delete|WebFetch|MCP:.*
Copilot CLI .github/copilot/settings.local.json (--shared: .github/hooks/levanto-sage.json) shell, file edits, web_fetch, MCP tools
Antigravity .agents/hooks.json run_command, file writes and edits, read_url_content, mcp_.*
Gemini CLI .gemini/settings.json run_shell_command, write_file, replace, web_fetch, mcp_.*

The file is yours: in a git repo the installer adds it to .gitignore (for Goose, the plugin folder). --shared writes the file your team shares through git instead, and the installer asks for --shared when the file is already in git. Change matcher in that file to check other tools.

Codex runs project hooks only in a trusted project, after you review them with /hooks. Copilot CLI and Gemini CLI run them in a trusted folder. The Claude Agent SDK reads the same files as Claude Code unless you change settingSources.

Cursor and Copilot CLI also run the hooks in .claude/settings.json and .claude/settings.local.json, and the hook checks their calls there too. Install it for one of them, not both, or each call is checked twice.

Each check sends Sage the conversation: your messages, the agent's replies, its tool calls and their output, trimmed to the latest part, and the pending call. Cursor's transcript has no tool output, so for Cursor the hook sends the rest. Goose doesn't hand hooks the conversation, so for Goose the hook keeps your prompts and the agent's replies in a private temporary file until the session ends.

In runs with no one to ask, use --deny: Antigravity's --dangerously-skip-permissions approves the question itself, and gemini -p can wait for an answer that never comes. Claude Code and Copilot CLI block instead of asking when no one can answer.

Option Default
--threshold <p> 0.5: blocks when Sage is at least this sure the call does something you didn't ask for.
--question <text> The pending tool call changes, deletes or sends something the user did not ask for.
--deny off. Blocks instead of asking you.
--fail-closed off. When Sage can't be reached, the call goes ahead with a warning. With this option it is blocked, and hook install also sets Claude Code, Cursor and Goose to block when the hook can't run at all. Copilot CLI already blocks a call when the hook crashes.
--timeout <s> 10

Pass options to hook install and it writes them into the hook command. The key comes from LEVANTO_API_KEY in the agent's environment, or from .env in the project.

Environment

Variable Default
LEVANTO_BASE_URL https://api.levanto.ai
LEVANTO_DASHBOARD_URL https://platform.levanto.ai
NO_COLOR colour on a TTY

Node 18 or newer. No dependencies. MIT.

Releasing

Bump version in package.json and both versions in server.json, add a CHANGELOG.md entry, then push a tag v<version>. The Publish workflow tests and publishes to npm through trusted publishing, so no npm token is stored anywhere.