66
77Give your AI coding agent a map of your codebase.
88
9- Supermodel CLI connects [ Claude Code ] ( https://claude.ai/code ) , [ Codex ] ( https://openai.com/codex ) , and other AI agents to the [ Supermodel API] ( https://api.supermodeltools.com ) — providing call graphs, dependency graphs, dead code detection, and blast radius analysis as live context during your sessions.
9+ Supermodel CLI connects AI coding agents to the [ Supermodel API] ( https://api.supermodeltools.com ) , providing call graphs, dependency graphs, dead code detection, and blast radius analysis as context during your sessions. It operates in two modes: ** file mode ** , which writes ` .graph.* ` sidecar files next to your source so agents can read them at any time, and ** on-demand analysis ** , which runs targeted queries against the graph without touching the filesystem .
1010
1111---
1212
@@ -22,129 +22,147 @@ Supermodel CLI connects [Claude Code](https://claude.ai/code), [Codex](https://o
2222
2323---
2424
25- ## What It Does
26-
27- | Feature | Description |
28- | ---| ---|
29- | ** Graph pregeneration** | Analyze your repo upfront so your agent has instant access to call and dependency graphs without waiting mid-task |
30- | ** Dead code detection** | Surface functions and files with no callers across TypeScript, JavaScript, Python, Go, Rust, and more |
31- | ** Blast radius** | Before making a change, show which files and functions would be affected downstream |
32- | ** Token efficiency** | Ship only the graph slices relevant to the current task — not the whole repo — keeping context lean |
33- | ** Agent integration** | Plug directly into Claude Code, Codex, and Hermes as a context tool |
34-
35- ---
36-
3725## Installation
3826
3927### macOS
4028
4129``` bash
42- # placeholder: brew install supermodeltools/tap/supermodel
30+ brew install supermodeltools/tap/supermodel
4331```
4432
4533### Linux
4634
4735``` bash
48- # placeholder: install script
4936curl -fsSL https://supermodeltools.com/install.sh | sh
5037```
5138
52- ### From Source
39+ ### From source
5340
5441``` bash
5542git clone https://github.com/supermodeltools/cli
5643cd cli
57- # placeholder: build instructions
44+ go build -o supermodel .
5845```
5946
6047---
6148
62- ## Quickstart
63-
64- ### 1. Authenticate
49+ ## Quick start
6550
6651``` bash
67- supermodel login
68- # Opens your browser for GitHub OAuth
52+ supermodel login # authenticate (browser or --token for CI)
53+ cd /path/to/your/repo
54+ supermodel analyze # upload repo, run analysis, write .graph.* files
55+ supermodel status # confirm auth and cache state
6956```
7057
71- ### 2. Pre-generate your graph
58+ ---
7259
73- ``` bash
74- cd /path/to/your/repo
75- supermodel analyze
76- # Uploads repo, runs analysis, caches graph locally
77- ```
60+ ## Commands
7861
79- ### 3. Use with your agent
62+ ### File mode
8063
81- ** Claude Code:**
82- ``` bash
83- # placeholder: MCP server config or plugin setup
84- supermodel claude-code install
85- ```
64+ These commands manage ` .graph.* ` sidecar files written next to each source file. Agents and MCP tools read these files without making API calls.
8665
87- ** Codex:**
88- ``` bash
89- # placeholder: Codex tool integration
90- supermodel codex install
91- ```
66+ | Command | Description |
67+ | ---| ---|
68+ | ` analyze [path] ` | Upload repo, run full analysis, write ` .graph.* ` files (use ` --no-files ` to skip) |
69+ | ` watch [path] ` | Generate graph files on startup, then keep them updated incrementally as you code |
70+ | ` clean [path] ` | Remove all ` .graph.* ` files from the repository |
71+ | ` hook ` | Claude Code ` PostToolUse ` hook — forward file-change events to the ` watch ` daemon |
9272
93- ** Hermes:**
94- ``` bash
95- # placeholder: Hermes integration
96- supermodel hermes install
97- ```
73+ ### On-demand analysis
9874
99- ---
75+ | Command | Description |
76+ | ---| ---|
77+ | ` dead-code [path] ` | Find unreachable functions using static analysis (aliases: ` dc ` ) |
78+ | ` blast-radius [file] ` | Show files and functions affected by changing a file, function, or diff (aliases: ` br ` , ` impact ` ) |
79+ | ` audit ` | Codebase health report: circular deps, coupling metrics, high blast-radius files |
80+ | ` focus <file> ` | Token-efficient graph slice for a file — imports, callers, types (aliases: ` ctx ` , ` context ` ) |
81+ | ` find <symbol> ` | Find usages and callers of a symbol across the codebase |
82+ | ` graph [path] ` | Display the full repository graph (human table, JSON, or Graphviz DOT) |
10083
101- ## Key Commands
84+ ### Code tools
10285
103- ``` bash
104- supermodel docs # Generate static architecture documentation
105- supermodel analyze # Analyze the current repo and cache results
106- supermodel dead-code # List functions and files with no callers
107- supermodel blast-radius < file> # Show what's affected if this file changes
108- supermodel graph # Print or export the graph for the current repo
109- supermodel status # Show cached graph state and last analysis time
110- supermodel login # Authenticate with your Supermodel account
111- supermodel logout # Clear stored credentials
112- ```
86+ | Command | Description |
87+ | ---| ---|
88+ | ` compact [path] ` | Strip comments and shorten identifiers to reduce token usage while preserving semantics (aliases: ` pack ` , ` minify ` ) |
89+ | ` docs [path] ` | Generate a static HTML architecture documentation site |
90+ | ` restore ` | Build a project context summary to restore Claude's understanding after a context compaction |
11391
114- ---
92+ ### Agent integration
11593
116- ## How It Works
94+ | Command | Description |
95+ | ---| ---|
96+ | ` mcp ` | Start a stdio MCP server exposing graph tools to Claude Code and other MCP hosts |
11797
118- 1 . ` supermodel analyze ` zips your repository and uploads it to the [ Supermodel API] ( https://api.supermodeltools.com ) .
119- 2 . The API runs static analysis — building a base IR, call graph, and domain classification.
120- 3 . Results are cached locally (and on the API) keyed by a content hash of your repo.
121- 4 . Your agent tool integration reads from the cache and injects the relevant graph slice into context.
98+ ### Auth and config
12299
123- Graph data is never sent to your AI provider directly — only the slices your agent requests.
100+ | Command | Description |
101+ | ---| ---|
102+ | ` login ` | Authenticate with your Supermodel account (browser or ` --token ` for CI) |
103+ | ` logout ` | Remove stored credentials |
104+ | ` status ` | Show authentication and cache status |
124105
125106---
126107
127- ## Supported Agents
108+ ## Configuration
128109
129- | Agent | Status |
130- | ---| ---|
131- | Claude Code | Planned — [ #1 ] ( https://github.com/supermodeltools/cli/issues/1 ) |
132- | Hermes | Planned — [ #2 ] ( https://github.com/supermodeltools/cli/issues/2 ) |
133- | Codex | Planned — [ #3 ] ( https://github.com/supermodeltools/cli/issues/3 ) |
110+ Settings are stored at ` ~/.supermodel/config.yaml ` . Environment variables override file values.
111+
112+ ``` yaml
113+ api_key : smsk_... # or SUPERMODEL_API_KEY
114+ api_base : https://... # or SUPERMODEL_API_BASE (default: https://api.supermodeltools.com)
115+ output : human # human | json
116+ files : true # set false to disable .graph.* writing globally (or SUPERMODEL_FILES=false)
117+ ` ` `
118+
119+ For CI or non-interactive environments:
120+
121+ ` ` ` bash
122+ SUPERMODEL_API_KEY=smsk_live_... supermodel analyze
123+ ```
134124
135125---
136126
137- ## Pricing
127+ ## Claude Code integration
138128
139- <!-- placeholder: free plan, $19/mo Pro, $199/mo Team — link to pricing page -->
129+ ### Hook setup
140130
141- Usage is metered per analysis. Run ` supermodel status ` to check your balance.
131+ The ` hook ` command forwards file-change events from Claude Code to the ` supermodel watch ` daemon so graph files stay current as your agent edits code. Add the following to ` .claude/settings.json ` :
142132
143- ---
133+ ``` json
134+ {
135+ "hooks" : {
136+ "PostToolUse" : [{
137+ "matcher" : " Write|Edit" ,
138+ "hooks" : [{"type" : " command" , "command" : " supermodel hook" }]
139+ }]
140+ }
141+ }
142+ ```
143+
144+ Then start the daemon in your repo:
145+
146+ ``` bash
147+ supermodel watch
148+ ```
149+
150+ ### MCP setup
144151
145- ## Contributing
152+ To expose Supermodel graph tools directly to Claude Code, add the MCP server to ` ~/.claude/config.json ` :
153+
154+ ``` json
155+ {
156+ "mcpServers" : {
157+ "supermodel" : {
158+ "command" : " supermodel" ,
159+ "args" : [" mcp" ]
160+ }
161+ }
162+ }
163+ ```
146164
147- Issues and PRs welcome. See [ CONTRIBUTING.md ] ( CONTRIBUTING.md ) <!-- placeholder: create this --> for guidelines .
165+ Exposed MCP tools: ` analyze ` , ` dead_code ` , ` blast_radius ` , ` get_graph ` .
148166
149167---
150168
0 commit comments