@sashabogi/argus-mcp 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Hive Development
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,323 @@
1
+ # Argus
2
+
3
+ ![Argus Banner](assets/argus-banner.jpg)
4
+
5
+ **Codebase Intelligence Beyond Context Limits**
6
+
7
+ Argus is an AI-powered codebase analysis tool that understands your entire project, regardless of size. It provides intelligent answers about code architecture, patterns, and relationships that would be impossible with traditional context-limited approaches.
8
+
9
+ ## Acknowledgments
10
+
11
+ Argus builds upon and extends the innovative work of [Matryoshka RLM](https://github.com/yogthos/Matryoshka) by [Dmitri Sotnikov (yogthos)](https://github.com/yogthos).
12
+
13
+ The Matryoshka project introduced the brilliant concept of **Recursive Language Models (RLM)** - using an LLM to generate symbolic commands (via the [Nucleus DSL](https://github.com/michaelwhitford/nucleus)) that are executed against documents, enabling analysis of files far exceeding context window limits. This approach achieves **93% token savings** compared to traditional methods.
14
+
15
+ **What Argus adds:**
16
+
17
+ | Matryoshka | Argus |
18
+ |------------|-------|
19
+ | Single file analysis | Full codebase analysis |
20
+ | CLI-only | CLI + MCP Server for Claude Code |
21
+ | Ollama/DeepSeek providers | Multi-provider (ZAI, Anthropic, OpenAI, Ollama, DeepSeek) |
22
+ | Manual configuration | Interactive setup wizard |
23
+ | Document-focused | Code-aware with snapshot generation |
24
+
25
+ We encourage you to explore the original [Matryoshka](https://github.com/yogthos/Matryoshka) project and the [RLM research paper](https://arxiv.org/abs/2512.24601) that inspired this approach.
26
+
27
+ ---
28
+
29
+ ## Features
30
+
31
+ - 🔍 **Codebase-Wide Analysis** - Analyze entire projects, not just single files
32
+ - 🧠 **AI-Powered Understanding** - Uses LLMs to reason about code structure and patterns
33
+ - 🔌 **MCP Integration** - Works seamlessly with Claude Code
34
+ - 🌐 **Multi-Provider Support** - ZAI GLM-4.7, Claude, GPT-4, DeepSeek, Ollama
35
+ - 📸 **Smart Snapshots** - Intelligent codebase snapshots optimized for analysis
36
+ - ⚡ **Hybrid Search** - Fast grep + AI reasoning for optimal results
37
+ - 🔧 **Easy Setup** - Interactive configuration wizard
38
+
39
+ ## Quick Start
40
+
41
+ ### Installation
42
+
43
+ ```bash
44
+ # Install globally via npm
45
+ npm install -g @sashabogi/argus-mcp
46
+
47
+ # Interactive setup (configures API keys and preferences)
48
+ argus init
49
+
50
+ # Add to Claude Code (installs MCP + global instructions)
51
+ argus mcp install
52
+
53
+ # Set up any project
54
+ argus setup .
55
+ ```
56
+
57
+ **To update Argus:**
58
+ ```bash
59
+ argus update
60
+ ```
61
+
62
+ ### How It Works
63
+
64
+ The `argus mcp install` command does two things:
65
+
66
+ 1. **Installs the MCP server** - Makes Argus tools available in Claude Code
67
+ 2. **Injects global instructions** - Adds Argus awareness to `~/.claude/CLAUDE.md`
68
+
69
+ The global instructions apply to **ALL projects** and **ALL sub-agents** (coders, testers, reviewers, debuggers, etc.) regardless of their specific configuration. This means:
70
+
71
+ - You don't need to modify individual agent files
72
+ - New agents you install automatically inherit Argus awareness
73
+ - Works with any skill or agent ecosystem
74
+
75
+ ### Per-Project Setup
76
+
77
+ ```bash
78
+ # In any project directory
79
+ argus setup .
80
+ ```
81
+
82
+ This creates `.argus/snapshot.txt` - a compressed representation of your codebase that Argus uses for efficient analysis.
83
+
84
+ ### Basic Usage
85
+
86
+ ```bash
87
+ # Analyze a codebase
88
+ argus analyze ./my-project "What are the main architectural patterns?"
89
+
90
+ # Create a snapshot for repeated analysis
91
+ argus snapshot ./my-project -o .argus/snapshot.txt
92
+
93
+ # Query an existing snapshot
94
+ argus query .argus/snapshot.txt "Find all API endpoints"
95
+
96
+ # Fast grep search (no AI, instant results)
97
+ argus search .argus/snapshot.txt "authentication"
98
+
99
+ # Check if snapshot needs refresh
100
+ argus status .
101
+ ```
102
+
103
+ ### In Claude Code
104
+
105
+ After running `argus mcp install`, you can use Argus directly:
106
+
107
+ ```
108
+ @argus What are the main modules in this codebase?
109
+ @argus Find all error handling patterns
110
+ @argus How does the authentication flow work?
111
+ ```
112
+
113
+ ## Configuration
114
+
115
+ Argus stores configuration in `~/.argus/config.json`. Run `argus init` for interactive setup, or configure manually:
116
+
117
+ ```json
118
+ {
119
+ "provider": "zai",
120
+ "providers": {
121
+ "zai": {
122
+ "apiKey": "your-api-key",
123
+ "model": "glm-4.7",
124
+ "endpoint": "https://api.z.ai/api/coding/paas/v4"
125
+ },
126
+ "anthropic": {
127
+ "apiKey": "your-api-key",
128
+ "model": "claude-sonnet-4-20250514"
129
+ },
130
+ "openai": {
131
+ "apiKey": "your-api-key",
132
+ "model": "gpt-4o"
133
+ },
134
+ "deepseek": {
135
+ "apiKey": "your-api-key",
136
+ "model": "deepseek-chat"
137
+ },
138
+ "ollama": {
139
+ "baseUrl": "http://localhost:11434",
140
+ "model": "qwen2.5-coder:7b"
141
+ }
142
+ },
143
+ "defaults": {
144
+ "maxTurns": 15,
145
+ "turnTimeoutMs": 60000,
146
+ "snapshotExtensions": ["ts", "tsx", "js", "jsx", "rs", "py", "go", "java"]
147
+ }
148
+ }
149
+ ```
150
+
151
+ ## Commands
152
+
153
+ ### `argus init`
154
+ Interactive setup wizard. Configures your preferred AI provider and API keys.
155
+
156
+ ### `argus analyze <path> <query>`
157
+ Analyze a codebase or file with an AI-powered query.
158
+
159
+ Options:
160
+ - `--provider, -p` - Override default provider
161
+ - `--max-turns, -t` - Maximum reasoning turns (default: 15)
162
+ - `--verbose, -v` - Show detailed execution logs
163
+
164
+ ### `argus snapshot <path> [output]`
165
+ Create an optimized snapshot of a codebase for analysis.
166
+
167
+ Options:
168
+ - `--extensions, -e` - File extensions to include (comma-separated)
169
+ - `--exclude` - Patterns to exclude
170
+ - `--output, -o` - Output file path
171
+ - `--enhanced` - Include structural metadata (import graph, exports index)
172
+
173
+ **Enhanced Snapshots** (recommended):
174
+ ```bash
175
+ argus snapshot . -o .argus/snapshot.txt --enhanced
176
+ ```
177
+
178
+ Enhanced snapshots include structural metadata that enables zero-cost queries:
179
+ - **Import Graph** - Which files import which other files
180
+ - **Export Index** - Symbol → files that export it
181
+ - **Who Imports Whom** - Reverse dependency graph
182
+ - **Function Signatures** - With line numbers
183
+
184
+ ### `argus query <snapshot> <query>`
185
+ Query an existing snapshot file.
186
+
187
+ ### `argus search <snapshot> <pattern>`
188
+ Fast grep search without AI (instant results).
189
+
190
+ ## MCP Tools (for Claude Code)
191
+
192
+ When installed via `argus mcp install`, Claude Code gets access to these tools:
193
+
194
+ | Tool | Cost | Description |
195
+ |------|------|-------------|
196
+ | `search_codebase` | **FREE** | Fast regex search across snapshot |
197
+ | `analyze_codebase` | ~500 tokens | AI-powered architecture analysis |
198
+ | `find_importers` | **FREE** | Find all files that import a given file |
199
+ | `find_symbol` | **FREE** | Find where a symbol is exported from |
200
+ | `get_file_deps` | **FREE** | Get all imports of a specific file |
201
+ | `create_snapshot` | ~100 tokens | Create/refresh a snapshot |
202
+
203
+ ### Zero-Cost Tools (Enhanced Snapshots)
204
+
205
+ With enhanced snapshots, Claude Code can answer dependency questions instantly:
206
+
207
+ ```
208
+ # Instead of reading 15 files to understand a flow:
209
+ find_symbol("useAuth") → "contexts/auth-context.tsx:42"
210
+ find_importers("auth-context") → ["app.tsx", "dashboard.tsx", ...]
211
+ get_file_deps("app.tsx") → ["./auth", "./theme", "@/components/ui"]
212
+ ```
213
+
214
+ These tools require an enhanced snapshot (created with `--enhanced` flag).
215
+
216
+ ### `argus setup [path]`
217
+ One-command project setup. Creates snapshot, updates .gitignore, optionally injects into project CLAUDE.md.
218
+
219
+ Options:
220
+ - `--no-claude-md` - Skip CLAUDE.md injection
221
+ - `--no-gitignore` - Skip .gitignore update
222
+
223
+ ### `argus status [path]`
224
+ Check if snapshot is up to date. Shows age and files changed since last snapshot.
225
+
226
+ ### `argus mcp install`
227
+ Install Argus as an MCP server for Claude Code. Also injects global instructions into `~/.claude/CLAUDE.md`.
228
+
229
+ Options:
230
+ - `--no-claude-md` - Skip global CLAUDE.md injection
231
+
232
+ ### `argus mcp uninstall`
233
+ Remove Argus from Claude Code.
234
+
235
+ ### `argus config [key] [value]`
236
+ View or modify configuration.
237
+
238
+ ## How It Works
239
+
240
+ Argus uses a **Recursive Language Model (RLM)** approach:
241
+
242
+ 1. **Snapshot Creation** - Your codebase is compiled into an optimized text snapshot
243
+ 2. **Query Analysis** - The LLM receives your question and the Nucleus DSL reference
244
+ 3. **Iterative Exploration** - The LLM generates symbolic commands (grep, filter, map, etc.)
245
+ 4. **Command Execution** - Commands run against the full snapshot in a sandbox
246
+ 5. **Reasoning Loop** - Results feed back to the LLM for further analysis
247
+ 6. **Final Answer** - Once sufficient information is gathered, a comprehensive answer is provided
248
+
249
+ This allows analysis of codebases **far exceeding** typical context limits (2M+ characters) while using minimal tokens per query.
250
+
251
+ ## Nucleus DSL Reference
252
+
253
+ Argus uses the [Nucleus DSL](https://github.com/michaelwhitford/nucleus) for document operations:
254
+
255
+ ```lisp
256
+ ; Search
257
+ (grep "pattern") ; Find matching lines
258
+ (grep "error" "i") ; Case-insensitive search
259
+
260
+ ; Transform
261
+ (map RESULTS (lambda (x) ...)) ; Transform results
262
+ (filter RESULTS (lambda (x) ...)) ; Filter results
263
+ (sort RESULTS key) ; Sort results
264
+
265
+ ; Aggregate
266
+ (count RESULTS) ; Count items
267
+ (sum RESULTS) ; Sum numeric values
268
+ (first RESULTS) ; Get first item
269
+ (take RESULTS n) ; Get first n items
270
+
271
+ ; Extract
272
+ (match str "pattern" group) ; Regex extraction
273
+ (split str delimiter) ; Split string
274
+
275
+ ; Final Answer
276
+ <<<FINAL>>>your answer here<<<END>>>
277
+ ```
278
+
279
+ ## Supported Providers
280
+
281
+ | Provider | Models | Best For |
282
+ |----------|--------|----------|
283
+ | **ZAI** | GLM-4.7, GLM-4.6 | Best value, excellent coding |
284
+ | **Anthropic** | Claude Sonnet/Opus | Highest quality reasoning |
285
+ | **OpenAI** | GPT-4o, GPT-4 | General purpose |
286
+ | **DeepSeek** | DeepSeek Chat/Coder | Budget-friendly |
287
+ | **Ollama** | Qwen, CodeLlama, etc. | Free, local, private |
288
+
289
+ ## Requirements
290
+
291
+ - Node.js 18+
292
+ - npm or pnpm
293
+ - API key for your chosen provider (or Ollama for free local usage)
294
+
295
+ ## FAQ & Documentation
296
+
297
+ - **[FAQ](./docs/FAQ.md)** - Common questions about costs, workflow, and troubleshooting
298
+ - **[CLAUDE.md Integration](./docs/CLAUDE_MD_INTEGRATION.md)** - How to add Argus to your project's CLAUDE.md
299
+
300
+ ### Quick Answers
301
+
302
+ **"Do I need to pay for another API?"**
303
+ No! Use Ollama (free, local) or `argus search` (no AI at all).
304
+
305
+ **"I'm starting a fresh project - how does Argus help?"**
306
+ Argus works from Day 0. Snapshot your PRD/TDD, then refresh as you build. See [FAQ](./docs/FAQ.md#im-starting-a-brand-new-project---theres-nothing-to-scan-yet).
307
+
308
+ **"How do I keep the snapshot updated?"**
309
+ Run `argus status .` to check, then `argus snapshot .` to refresh. See [FAQ](./docs/FAQ.md#how-do-i-keep-the-snapshot-up-to-date).
310
+
311
+ ## License
312
+
313
+ MIT License - See [LICENSE](./LICENSE)
314
+
315
+ ## Contributing
316
+
317
+ Contributions are welcome! Please read our contributing guidelines before submitting PRs.
318
+
319
+ ## Related Projects
320
+
321
+ - [Matryoshka RLM](https://github.com/yogthos/Matryoshka) - The original RLM implementation that inspired Argus
322
+ - [Nucleus DSL](https://github.com/michaelwhitford/nucleus) - The symbolic language used for document operations
323
+ - [RLM Paper](https://arxiv.org/abs/2512.24601) - Academic research on Recursive Language Models