cli

command module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 1 Imported by: 0

README

Supermodel CLI

Your AI agent knows your entire codebase — not just the files it's looking at.

Supermodel maps every file, function, and call relationship in your repo and writes a .graph file next to each source file. Your agent reads them automatically via grep and cat. No prompt changes. No extra context windows. No new tools to learn.

curl -fsSL https://supermodeltools.com/install.sh | sh

How it works

1. Map your codebase

supermodel watch

Uploads your repo to the Supermodel API, builds a full call graph, and writes .graph files next to every source file. Stays running to keep files updated as you code.

2. Your agent reads the graph automatically

.graph files are plain text. Any agent that can read files — Claude Code, Cursor, Copilot, Windsurf — picks them up automatically through its normal file-reading tools. No configuration needed on the agent side.

3. Ask anything

Your agent now has full visibility into your call graph, imports, domains, and blast radius — for every file in the repo, not just the ones open in the editor.


Works with any AI agent

.graph files are plain text read via grep and cat. There is no agent-specific integration required.

Agent Setup
Claude Code Run supermodel watch; install the hook for live updates (setup wizard handles this)
Cursor Run supermodel watch; .graph files appear in context when you open any source file
GitHub Copilot Run supermodel watch; open .graph files in the editor to include them in context
Windsurf Same as Cursor
Aider Run supermodel watch, then pass --read '**/*.graph.*' to include all graph files
Any other agent Run supermodel watch — if it can read files, it can read .graph files

For live updates in Claude Code, add this hook to .claude/settings.json:

{
  "hooks": {
    "PostToolUse": [{
      "matcher": "Write|Edit",
      "hooks": [{"type": "command", "command": "supermodel hook"}]
    }]
  }
}

The supermodel setup wizard installs this automatically if Claude Code is detected.


Installation

macOS
brew install supermodeltools/tap/supermodel
Linux / macOS (curl)
curl -fsSL https://supermodeltools.com/install.sh | sh

Runs the setup wizard automatically on first install when attached to a terminal.

From source
git clone https://github.com/supermodeltools/cli
cd cli
go build -o supermodel .

Quick start

supermodel setup          # authenticate + configure (runs automatically after install)
cd /path/to/your/repo
supermodel watch          # generate graph files and keep them updated

Commands

File mode

Manages .graph.* sidecar files written next to each source file. Agents read these without making API calls.

Command Description
analyze [path] Upload repo, run full analysis, write graph files (use --three-file for best results, --no-shards to skip)
skill Print agent awareness prompt — pipe to CLAUDE.md or AGENTS.md
watch [path] Generate graph files on startup, then keep them updated incrementally
clean [path] Remove all .graph.* files from the repository
hook Claude Code PostToolUse hook — forward file-change events to the watch daemon

For best results, use the --three-file flag to generate separate .calls, .deps, and .impact files instead of a single .graph file:

supermodel analyze --three-file

This produces three files per source file:

src/cache.go          → src/cache.calls.go    # who calls what, with file:line
                      → src/cache.deps.go     # imports and imported-by
                      → src/cache.impact.go   # risk level, domains, blast radius

The three-file format is 68% faster in benchmarks because grep hits are more targeted — searching for a function name hits only the .calls file with caller/callee data, not a combined blob.

Tell your agent about the files by adding this to CLAUDE.md or AGENTS.md:

supermodel skill >> CLAUDE.md

Or manually add:

This repository has Supermodel graph shard files next to source files.
Files ending in .calls.* contain function call relationships.
Files ending in .deps.* contain dependency relationships.
Files ending in .impact.* contain blast radius data.
Read these files to understand relationships between modules before making changes.
On-demand analysis
Command Description
dead-code [path] Find unreachable functions using static analysis (aliases: dc)
blast-radius [file] Show files and functions affected by changing a file, function, or diff (aliases: br, impact)
audit Codebase health report: circular deps, coupling metrics, high blast-radius files
focus <file> Token-efficient graph slice for a file — imports, callers, types (aliases: ctx, context)
find <symbol> Find usages and callers of a symbol across the codebase
graph [path] Display the full repository graph (human table, JSON, or Graphviz DOT)
Code tools
Command Description
compact [path] Strip comments and shorten identifiers to reduce token usage (aliases: pack, minify)
docs [path] Generate a static HTML architecture documentation site
restore Build a project context summary to restore Claude's understanding after context compaction
Agent integration
Command Description
mcp Start a stdio MCP server exposing graph tools to Claude Code and other MCP hosts
Auth and config
Command Description
setup Interactive setup wizard — authenticate, configure file mode, install Claude Code hook
login Authenticate with your Supermodel account (browser or --token for CI)
logout Remove stored credentials
status Show authentication and cache status

Add a badge to your README

[![Supermodel](https://img.shields.io/badge/supermodel-enabled-blueviolet)](https://supermodeltools.com)

Supermodel


Configuration

Settings are stored at ~/.supermodel/config.yaml. Environment variables override file values.

api_key: smsk_...        # or SUPERMODEL_API_KEY
api_base: https://...    # or SUPERMODEL_API_BASE (default: https://api.supermodeltools.com)
output: human            # human | json
files: true              # set false to disable .graph.* writing globally (or SUPERMODEL_FILES=false)

For CI or non-interactive environments:

SUPERMODEL_API_KEY=smsk_live_... supermodel analyze

MCP setup

To expose Supermodel graph tools directly to Claude Code via the Model Context Protocol, add the server to ~/.claude/config.json:

{
  "mcpServers": {
    "supermodel": {
      "command": "supermodel",
      "args": ["mcp"]
    }
  }
}

Exposed MCP tools: analyze, dead_code, blast_radius, get_graph.


Website supermodeltools.com
API Docs api.supermodeltools.com
Dashboard dashboard.supermodeltools.com
Twitter / X @supermodeltools
Contact abe@supermodel.software

Questions? Open an issue or email abe@supermodel.software.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
analyze
Package analyze implements the `supermodel analyze` command.
Package analyze implements the `supermodel analyze` command.
api
Package api provides the HTTP client and base request primitives for the Supermodel API.
Package api provides the HTTP client and base request primitives for the Supermodel API.
archdocs
Package archdocs generates static architecture documentation for a repository by uploading it to the Supermodel API, converting the returned graph to markdown via graph2md, and building a static HTML site with pssg.
Package archdocs generates static architecture documentation for a repository by uploading it to the Supermodel API, converting the returned graph to markdown via graph2md, and building a static HTML site with pssg.
auth
Package auth implements the `supermodel login` and `supermodel logout` commands.
Package auth implements the `supermodel login` and `supermodel logout` commands.
blastradius
Package blastradius implements the `supermodel blast-radius` command.
Package blastradius implements the `supermodel blast-radius` command.
build
Package build exposes version information injected at build time via ldflags.
Package build exposes version information injected at build time via ldflags.
cache
Package cache manages the local graph cache stored under ~/.supermodel/cache/.
Package cache manages the local graph cache stored under ~/.supermodel/cache/.
compact
Package compact provides lossless source-code compaction for reducing token usage when feeding code to AI models.
Package compact provides lossless source-code compaction for reducing token usage when feeding code to AI models.
config
Package config manages the user's Supermodel configuration stored at ~/.supermodel/config.yaml.
Package config manages the user's Supermodel configuration stored at ~/.supermodel/config.yaml.
deadcode
Package deadcode implements the `supermodel dead-code` command.
Package deadcode implements the `supermodel dead-code` command.
find
Package find implements the `supermodel find` command — code navigation features inspired by enterprise IDE tools (find usages, call hierarchy, type hierarchy).
Package find implements the `supermodel find` command — code navigation features inspired by enterprise IDE tools (find usages, call hierarchy, type hierarchy).
focus
Package focus implements the `supermodel focus` command.
Package focus implements the `supermodel focus` command.
graph
Package graph implements the `supermodel graph` command.
Package graph implements the `supermodel graph` command.
mcp
Package mcp implements a Model Context Protocol server that exposes Supermodel graph analysis as tools to AI coding agents (Claude Code, Hermes, Codex, and any other MCP-compatible host).
Package mcp implements a Model Context Protocol server that exposes Supermodel graph analysis as tools to AI coding agents (Claude Code, Hermes, Codex, and any other MCP-compatible host).
restore
Package restore implements the "supermodel restore" command: it builds a high-level project summary (a "context bomb") and writes it to stdout so that Claude Code can re-establish codebase understanding after a context compaction event.
Package restore implements the "supermodel restore" command: it builds a high-level project summary (a "context bomb") and writes it to stdout so that Claude Code can re-establish codebase understanding after a context compaction event.
status
Package status implements the `supermodel status` command, which prints the current authentication state, config path, API endpoint, and local cache inventory.
Package status implements the `supermodel status` command, which prints the current authentication state, config path, API endpoint, and local cache inventory.
testutil
Package testutil provides shared helpers for integration tests.
Package testutil provides shared helpers for integration tests.
ui
Package ui provides output formatting primitives: progress spinners, tables, JSON output, and human-readable formatting helpers.
Package ui provides output formatting primitives: progress spinners, tables, JSON output, and human-readable formatting helpers.
pkg
supermodel
Package supermodel is the public Go SDK for the Supermodel API.
Package supermodel is the public Go SDK for the Supermodel API.
scripts
check-architecture command
Command check-architecture validates the vertical slice architecture of the Supermodel CLI using the Supermodel static analysis API.
Command check-architecture validates the vertical slice architecture of the Supermodel CLI using the Supermodel static analysis API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL