SAGE
SAGE is a token-saving AI coding agent assistant that compresses terminal output, manages command history, and provides agentic error recovery — all accessible via MCP tools.
Command Execution & History
sage_call– Run any shell command with purpose metadata (read, search, test, build, deploy, audit) for quality trackingsage_agentic_run– Run a command with automatic retry/fix/verify loop on failure (configurable autonomy: suggest, ask, or auto)sage_get_history– Retrieve recent command history, optionally filtered to failed commands onlysage_show_raw– Recover the exact original (uncompressed) output of any previous run by ID
Error Analysis & Fixing
sage_explain_error– Get an AI-friendly explanation of a command errorsage_suggest_fix– Get suggested fixes for a failed commandsage_agentic_fix– Get an auto-fix suggestion with strategy and confidence scoresage_agentic_session– Inspect the current agentic session state (failure streak, recent errors, intent chain)
File Operations (Token-Efficient)
sage_read_file– Read files with SAGE compression; supports line ranges and symbol-only outlinessage_write_file– Create or update a file, returning a compact confirmation instead of echoing full contentsage_edit_file– Perform exact string replacement with a compact change preview and automatic pre-edit snapshot for undo
Search & Navigation
sage_grep– Search files with compressed, grouped results preserving exact paths and line numberssage_glob– Find files by glob pattern (newest first, junk directories ignored, capped output)sage_tree– Get a compact, depth-limited directory overview
Agents & Workflows
sage_spawn_agent– Spawn a specialized sub-agent for a task (types: code, test, debug, security, performance)sage_run_workflow– Execute a named workflow pipeline (e.g., test, ci, deploy) or a custom workflow YAML file
All operations prioritize token efficiency by compressing output and keeping raw logs local, while an agent firewall blocks destructive commands and detects secret exposure.
SAGE - Smart Agent Guidance Engine
SAGE is a local-first command wrapper for AI coding agents. It keeps full terminal output on your machine, sends agents a clean compressed summary, and tracks proof metrics without uploading your raw logs.
Use it with Claude Code, Codex, Cursor, Windsurf, OpenCode, Cline, custom agents, CI scripts, and normal terminal workflows.
Start Here: Install SAGE, Use once sage run -- python -m pytest, Then Use Any AI Agent
Package installation is passive for package-registry safety. After installing, run sage install once to connect this machine and activate SAGE for supported local AI agents.
PyPI / pip
pip install psycgod-sage
# or
python -m pip install --upgrade psycgod-sage
sage install
sage run -- python -m pytestnpm / npx
npm install -g psycgod-sage
npx -y psycgod-sage install
npx -y psycgod-sage run -- npm testAfter install, restart any open AI-agent sessions. New sessions should read the SAGE instructions automatically and route terminal commands through SAGE.
Example prompt after restarting your AI agent:
Please help me with my general book in this folder.Natural shortcuts also work:
sage pytest
sage npm test
sage git statusThese are treated as:
sage run -- pytest
sage run -- npm test
sage run -- git statusRelated MCP server: knitbrain
What SAGE Does
Step | Result |
| Connects the machine, repairs global/project agent instructions, and verifies activation |
| Runs the command, stores raw output locally, and returns a compact useful summary |
Agent memory/hooks | Tell supported AI agents to use SAGE for noisy terminal work |
Local database | Keeps command history, compression proof, and retry context on the user's machine |
Optional cloud proof | Sends aggregate metrics only when connected proof mode is enabled |
SAGE does not auto-enable MCP. MCP is optional and manual for users who want it.
Live Proof
Latest pulled stats as of 2026-08-01:
Metric | Value |
SAGE telemetry command events | 27,892 |
Tokens processed | 799.5M |
Tokens saved | 783.7M |
Compression rate | 98.02% |
Estimated savings | $16,261.90 |
Command success rate | 88.3% |
PyPI downloads, last 7 days | 632 |
npm downloads, last 7 days | 362 |
GitHub clones, last 14 days | 574 |
Live dashboard: sage.api.marketingstudios.in/dashboard Install page: sage.api.marketingstudios.in/install

Why It Helps
AI coding agents burn context on repeated logs, failed test output, install noise, stack traces, and build spam. SAGE sits between the command and the agent.
Without SAGE | With SAGE |
Agent sees full noisy terminal output | Agent sees the useful summary |
Context disappears fast | Context lasts longer |
Repeated failures waste tokens | Errors are grouped and explained |
Raw logs may enter prompts | Raw logs stay local |
Hard to prove savings | SAGE records proof metrics |
Distribution
Channel | Package | Status |
PyPI | Canonical Python package | |
npm / npx | Node launcher for the Python core | |
MCP Registry |
| Optional/manual MCP entry |
Glama | Optional/manual hosted MCP listing |
The npm package delegates to the Python implementation so both install paths use the same local database, telemetry rules, compression, and command behavior.
Common Commands
sage install # Activate this machine and AI-agent instructions
sage doctor --activation # Verify activation
npx -y psycgod-sage doctor --activation
sage run -- <command> # Wrap any command
sage run --cwd /project -- <command> # Explicit workspace for host integrations
sage pytest # Shortcut for: sage run -- pytest
sage npm test # Shortcut for: sage run -- npm test
sage git status # Shortcut for: sage run -- git status
sage context stats # Token savings summary
sage context report # Full compression report
sage history --limit 10 # Recent command history
sage explain --failed # Explain the latest failed command
sage suggest --failed # Suggest the next fix
sage fix --apply # Try an automatic fix
sage ml setup # Optional ML V2 dependencies
sage mcp install # Optional/manual MCP config
sage dashboard start # Local dashboardPrivacy Modes
Mode | Requires login? | Sends data? | What leaves the machine? |
Local-only | No | No | Nothing |
Connected proof | Machine auth | Yes | Aggregate counters and proof metrics |
Debug telemetry | Optional | Opt-in only | Redacted diagnostic summaries |
SAGE is designed to keep prompts, source code, credentials, raw command output, and project files local unless the user deliberately enables a feature that requires sending data.
Known Limitations
Limitation | What To Do |
Already-open AI-agent sessions may not reload new instructions | Restart Claude/Codex/Cursor/Windsurf/OpenCode after |
Locked-down host apps can disable shell tools | SAGE cannot enable tools the host application has blocked |
A host starts its shell in the wrong folder | Pass |
npm/PyPI installs cannot safely auto-run activation | Run |
MCP can disconnect in some stdio agent sessions | Use normal |
Package installs are passive by design | Real activation starts with |
Demos
Flow | Preview |
PyPI install |
|
npm install |
|
| |
CLI run |
|
Links
Landing: sage.api.marketingstudios.in
Dashboard: sage.api.marketingstudios.in/dashboard
Install guide: sage.api.marketingstudios.in/install
License
MIT. See LICENSE.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-quality-maintenanceA secure and pluggable MCP server to run terminal commands on your local machine or cloud server — remotely, safely, and with LLMs or agentic clients.Last updated
- AlicenseAqualityAmaintenanceLocal-first MCP server that gives any AI coding agent per-project memory, workflow intelligence, and always-on, lossless token & context optimization.Last updated37353MIT
- AlicenseAqualityBmaintenanceAn agent-native shell as an MCP server, designed for LLM agents (like Claude Code) to execute commands with structured output, lazy detail retrieval, and effect tracking, minimizing token usage.Last updated912MIT
- Flicense-qualityAmaintenanceLocal MCP server that lets your AI coding agent query its own cross-tool project history - file/command freshness, past test failures, cost & token spend, cache status, and session handoff - over stdio, 100% local, no telemetry.Last updated36
Related MCP Connectors
User-owned memory for AI agents, Copilot, Claude, IDEs, CLIs, and chat apps over remote MCP.
Local-first RAG engine with MCP server for AI agent integration.
Real-time chat hub for AI agents — Claude Code, Cursor, Cline, Codex over MCP or REST.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/PsYcGoD/sage'
If you have feedback or need assistance with the MCP directory API, please join our Discord server


