repl

repl is a command for Claude Code from MadAppGang/magus. It costs 44 tokens per session (883 once invoked), scanned A, original, MIT.

An interactive terminal session for database shells and programming-language consoles, such as PostgreSQL, MongoDB, Redis, Python, and Node.js. It opens the session, runs queries or expressions, and closes it cleanly.

In plain words
What is it for?
Use it to query databases, evaluate code interactively, inspect results, and work with other command-line REPLs.
Why use it?
It handles prompts and session state that ordinary one-off commands cannot manage reliably. This lets an agent perform several related actions in the same console.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the terminal plugin — 5 skills, 7 commands, 1 agent shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/madappgang/magus/repl
Clone the repo
git clone --depth 1 https://github.com/MadAppGang/magus

Made for: Claude Code.

Or install terminal, the plugin that ships this one along with the rest of its 5 skills, 7 commands, 1 agent.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for repl

README.md
[![agentmods](https://agentmods.dev/badge/commands/madappgang/magus/repl.svg)](https://agentmods.dev/commands/madappgang/magus/repl)
Your own site
<a href="https://agentmods.dev/commands/madappgang/magus/repl"><img src="https://agentmods.dev/badge/commands/madappgang/magus/repl.svg" alt="Measured on agentmods" height="20"></a>
Per session 44 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 883 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00044 $0.00883
Opus 5 $0.00022 $0.00441
Sonnet 5 $0.00009 $0.00177
Haiku 4.5 $0.00004 $0.00088

Measured 2d ago against content hash 0f73ed388890, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

repl scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/terminal/commands/repl.md · 94 lines

How it starts

The opening of the file, as written. The whole thing — 94 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/terminal:repl

Open an interactive REPL or database shell, execute queries/expressions, and manage the session lifecycle.

Usage

/terminal:repl {application} [query]

Examples

Database shells:

/terminal:repl psql $DATABASE_URL
/terminal:repl "psql -d myapp" "SELECT count(*) FROM users"
/terminal:repl mongosh $MONGO_URI
/terminal:repl redis-cli
/terminal:repl "turso db shell mydb"

Language REPLs:

/terminal:repl python3
/terminal:repl node
/terminal:repl "bun repl"
/terminal:repl irb

What It Does

  1. Creates a headless session: create-headless({ name: "repl" }){ paneId }
  2. Opens the REPL application with start-and-watch, blocking until the prompt appears: start-and-watch({ paneId, command: app, pattern: <prompt_pattern>, timeout: 15 })
  3. Executes each query with run-in-repl: run-in-repl({ paneId, input: query, promptPattern: <pattern>, timeout: 10 }) → returns { output } directly (no snapshot needed)
  4. Exits the REPL with run-in-repl({ input: exit_command, promptPattern: "\\$" })
  5. Closes the session with kill-session

Prompt Patterns for run-in-repl

Application promptPattern
psql "=#"
mongosh ">"
redis-cli "127\\.0\\.0\\.1:\\d+>"
python3 ">>> "
node / bun "> "
irb "irb>"
turso shell ">"
bash/zsh shell "\\$\\s*$"

REPL Exit Commands

Application Exit Command
psql \q
mongosh .exit or Ctrl+D
redis-cli quit or Ctrl+D
python3 exit() or Ctrl+D
node / bun .exit or Ctrl+D
irb exit or Ctrl+D
turso shell .quit

Multi-Query Sessions

Each query is one run-in-repl call — output is returned directly, no screen scraping needed:

result1 = run-in-repl({ input: "SELECT count(*) FROM users;", promptPattern: "=#" })
result2 = run-in-repl({ input: "SELECT * FROM settings LIMIT 5;", promptPattern: "=#" })
// output fields contain the full query results

Read the full file on GitHub · 94 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 94 lines · 44 tokens per session scan A 0f73ed388890

Subscribe to this mod's changes

repl is a command published in the GitHub repository MadAppGang/magus (9 stars, last pushed 2d ago), licensed MIT. It adds 44 tokens to every session and 883 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.