nimcode 0.5.4__tar.gz → 0.7.0__tar.gz

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.
Files changed (54) hide show
  1. {nimcode-0.5.4 → nimcode-0.7.0}/PKG-INFO +246 -243
  2. {nimcode-0.5.4 → nimcode-0.7.0}/README.md +225 -222
  3. {nimcode-0.5.4 → nimcode-0.7.0}/setup.cfg +4 -4
  4. {nimcode-0.5.4 → nimcode-0.7.0}/setup.py +33 -33
  5. nimcode-0.7.0/src/nimcode/__version__.py +1 -0
  6. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/agent.py +707 -649
  7. nimcode-0.7.0/src/nimcode/agents/__init__.py +1 -0
  8. nimcode-0.7.0/src/nimcode/agents/qa_agent.py +88 -0
  9. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/cli.py +192 -192
  10. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/config.py +69 -69
  11. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/lenient_parser.py +107 -107
  12. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/memory.py +71 -71
  13. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/model_registry.py +54 -54
  14. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/nim_client.py +166 -166
  15. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/permissions.py +134 -134
  16. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/plugin_manager.py +53 -53
  17. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/rag.py +121 -121
  18. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/repl.py +1287 -1274
  19. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/repo_map.py +97 -97
  20. nimcode-0.7.0/src/nimcode/task_manager.py +109 -0
  21. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/tools.py +1084 -920
  22. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/updater.py +39 -39
  23. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/watcher.py +81 -81
  24. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode.egg-info/PKG-INFO +246 -243
  25. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode.egg-info/SOURCES.txt +6 -0
  26. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_agent.py +300 -300
  27. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_cli.py +149 -149
  28. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_config.py +77 -77
  29. nimcode-0.7.0/tests/test_lazy_blockers.py +81 -0
  30. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_lenient_parser.py +67 -67
  31. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_mcp_client.py +135 -135
  32. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_memory.py +79 -79
  33. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_model_registry.py +38 -38
  34. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_nim_client.py +149 -149
  35. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_permissions.py +86 -86
  36. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_plan_injection.py +152 -152
  37. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_plugin_manager.py +53 -53
  38. nimcode-0.7.0/tests/test_qa_agent.py +30 -0
  39. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_repl.py +394 -394
  40. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_repl_extra.py +142 -142
  41. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_repl_fixes.py +168 -168
  42. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_repl_trust.py +55 -55
  43. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_repo_map.py +93 -93
  44. nimcode-0.7.0/tests/test_task_manager.py +54 -0
  45. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_tools.py +338 -338
  46. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_updater.py +41 -41
  47. {nimcode-0.5.4 → nimcode-0.7.0}/tests/test_version.py +25 -25
  48. nimcode-0.5.4/src/nimcode/__version__.py +0 -1
  49. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/__init__.py +0 -0
  50. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode/mcp_client.py +0 -0
  51. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode.egg-info/dependency_links.txt +0 -0
  52. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode.egg-info/entry_points.txt +0 -0
  53. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode.egg-info/requires.txt +0 -0
  54. {nimcode-0.5.4 → nimcode-0.7.0}/src/nimcode.egg-info/top_level.txt +0 -0
@@ -1,243 +1,246 @@
1
- Metadata-Version: 2.4
2
- Name: nimcode
3
- Version: 0.5.4
4
- Summary: A standalone, robust coding agent for NVIDIA NIM models.
5
- Home-page: https://github.com/Batunash/nimcode
6
- Author: Autonomous Agent
7
- Requires-Python: >=3.8
8
- Description-Content-Type: text/markdown
9
- Requires-Dist: httpx>=0.27.0
10
- Requires-Dist: rich>=13.7.0
11
- Requires-Dist: prompt_toolkit>=3.0.0
12
- Requires-Dist: mcp>=1.2.0
13
- Requires-Dist: watchdog>=3.0.0
14
- Dynamic: author
15
- Dynamic: description
16
- Dynamic: description-content-type
17
- Dynamic: home-page
18
- Dynamic: requires-dist
19
- Dynamic: requires-python
20
- Dynamic: summary
21
-
22
- <div align="center">
23
-
24
- # 🚀 NimCode
25
-
26
- **The Autonomous AI Coding Assistant for the NVIDIA NIM Ecosystem**
27
-
28
- [![PyPI version](https://img.shields.io/pypi/v/nimcode.svg)](https://pypi.org/project/nimcode/)
29
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
30
-
31
- *A powerful, standalone REPL and CLI agent that writes, edits, and plans code like a senior developer—powered by LLaMa 3.1 70B (and other cutting-edge models) and the lightning-fast NVIDIA NIM API.*
32
-
33
- </div>
34
-
35
- ---
36
-
37
- ## 🌟 Overview
38
-
39
- NimCode is your autonomous coding pair-programmer. Built with a rich interactive terminal interface, it doesn't just autocomplete code—it plans architectures based on real documents (SDD, PRD, RFC), executes terminal commands, writes complete files, and manages your workspace.
40
-
41
- ### ✅ What Works Right Now
42
- - **OS-Aware Agent**: Automatically detects Windows/Linux/macOS and uses the correct shell commands. No more `mkdir -p` on Windows.
43
- - **SDD/PRD-Aware Planning**: `/plan` mode reads your actual documents and produces implementation plans grounded in real file names, modules, and requirements—not generic PM templates.
44
- - **Paginated File Reading**: Large files (like SDDs) are read in chunks with `offset`/`limit` so nothing gets truncated.
45
- - **VS Code Deep Integration**: Native IPC communication allowing NimCode to read active editors, send patches, and act as your intelligent coding panel within VS Code.
46
- - **RAG & Semantic Search**: Zero-dependency TF-IDF/BM25 based indexer that instantly scans massive workspaces and retrieves context-aware code snippets.
47
- - **Autonomous Auto-Fixer**: The `/fix` command creates a self-healing feedback loop—runs your broken commands, analyzes tracebacks, and automatically iterates on code patches until the build passes.
48
- - **Multi-Model & Local Support**: Flexible `api_base_url` configuration to seamlessly switch between NVIDIA NIM, Ollama, or vLLM endpoints. Dynamic model list fetched from the API at runtime.
49
- - **Smart Permission Engine**: Granular control over file writes and command executions, featuring an auto-bypass mechanism and interactive `(a)ccept / (r)eject` diff previews. Non-interactive/CI mode is secure by default (Bash denied unless explicitly allowed).
50
- - **Robust Interactive REPL**: Multiline support (Alt+Enter), syntax highlighting, and beautiful `rich`-powered UI menus.
51
- - **Automated Workflows**: Automatic linting and formatting using `black`, `flake8`, and `prettier` behind the scenes.
52
- - **Model Context Protocol (MCP)**: Native integration for MCP tools allowing infinite extensibility.
53
- - **Context Management**: Auto-compact with per-model context window awareness. `/thinkback` shows real session statistics.
54
- - **Live Sync**: Workspace watcher automatically updates the repo map in the agent's context when files change.
55
-
56
- ### 🚀 What We're Working On (Roadmap)
57
- - **Sub-agent Swarms**: Perfecting `/delegate` and `/swarm` to distribute complex tasks among specialized AI roles.
58
- - **Advanced Diagnostics**: Refining `/bughunter`, `/security-review`, and `/doctor` for automated codebase auditing.
59
- - **Test-Driven Development**: Upgrading `/tdd` and `/testgen` to automatically write tests and ensure 100% coverage before committing.
60
- - **Infrastructure & DevOps**: Implementing `/terraform-god` and `/sql-tune` for automated cloud provisioning and database query optimization.
61
-
62
- ---
63
-
64
- ## 📦 Installation & Update
65
-
66
- ```bash
67
- # First time install
68
- pip install nimcode
69
-
70
- # Update to latest version
71
- pip install --upgrade nimcode
72
- ```
73
-
74
- > **⚠️ If NimCode shows an old version number at startup**, you likely have an older install. Run `pip install --upgrade nimcode` to get the latest fixes.
75
-
76
- ## 🚀 Quick Start
77
-
78
- 1. **Get an API Key**: Grab a free NVIDIA API key from [build.nvidia.com](https://build.nvidia.com/).
79
- 2. **Login**: Connect your local environment by running:
80
- ```bash
81
- nimcode login
82
- ```
83
- 3. **Start Coding**:
84
- - Launch the interactive REPL:
85
- ```bash
86
- nimcode
87
- ```
88
- - Or run a one-off task directly from the command line:
89
- ```bash
90
- nimcode /plan "Build a classic Snake game using HTML5 Canvas"
91
- ```
92
-
93
- ---
94
-
95
- ## 💻 Complete Command Reference
96
-
97
- Inside the `nimcode` REPL, you can type natural language or use any of the following slash commands:
98
-
99
- ### Mode Toggles & Execution
100
- - **`/code`**: Enter standard coding mode (default mode, prompts for dangerous actions).
101
- - **`/plan`**: Enter planning mode. NimCode will **read your actual documents/files first**, then write a concrete implementation plan to `.nimcode/plans/`.
102
- - **`/trust`**: Enter trust mode. The AI will run commands and edit files completely autonomously without asking for `(a)ccept / (r)eject`. Turn limit removed.
103
- - **`/untrust`**: Disable trust mode and restore permission prompts.
104
-
105
- ### Interface & Settings
106
- - **`/models`**: Open an interactive UI to select your preferred NVIDIA NIM model.
107
- - **`/theme`**: Open an interactive UI to change your syntax highlighting theme.
108
- - **`/config`**: View and edit global NimCode configuration settings.
109
-
110
- ### Workspace & Context Management
111
- - **`/clear`**: Clear the current conversation history to reset context.
112
- - **`/compact`**: Compact the context window to save tokens while keeping essential memories.
113
- - **`/context`**: View and manage the loaded context window.
114
- - **`/rewind`**: Rewind the conversation history by a few steps.
115
- - **`/undo`**: Revert the last file modification made by the AI.
116
- - **`/thinkback`**: View real session statistics (turns, token estimates, message history).
117
-
118
- ### Project & Search
119
- - **`/index`**: Index the current project files to enable lightning-fast Semantic Search.
120
- - **`/map`**: Generate a high-level semantic architecture map of the codebase.
121
- - **`/research`**: Enter deep-research mode for reading documentation or large files.
122
-
123
- ### Automation & Git
124
- - **`/commit`**: Analyze all staged git changes and automatically generate a conventional commit message.
125
- - **`/fix`**: Run a specific shell command and let the AI automatically iterate to fix any resulting errors.
126
- - **`/autofix-pr`**: Pulls the current active GitHub Pull Request, reads comments, and automatically fixes the mentioned issues.
127
-
128
- ### Advanced Development Modes
129
- - **`/testgen <file>`**: Generate unit tests for a specific file, aiming for 100% coverage.
130
- - **`/tdd`**: Enter Test-Driven Development mode. The AI will write tests first, verify they fail, and then implement the code to pass them.
131
- - **`/bughunter`**: Initiate an automated search for logical bugs and edge cases across the codebase.
132
- - **`/security-review`**: Audit the codebase for common vulnerabilities (e.g., OWASP top 10).
133
- - **`/ultraplan <task>`**: Generate a master ultra-detailed, dependency-graphed execution plan.
134
-
135
- ### AI & Agents
136
- - **`/delegate <role> <task>`**: Spawn an independent sub-agent with a specific role to handle a background task.
137
- - **`/swarm`**: Orchestrate multiple sub-agents to tackle a complex architectural epic simultaneously.
138
- - **`/grill-me`**: Interrogation mode. The AI will ask *you* hard questions to refine your system design and edge cases.
139
- - **`/learn`**: Teach NimCode a new persistent skill or framework rule that it will remember for future sessions.
140
- - **`/vision`**: Capture the screen and analyze UI elements using Vision AI models.
141
- - **`/mcp install`**: Install and configure new Model Context Protocol tools.
142
-
143
- ---
144
-
145
- ## ⚙️ How it Works
146
-
147
- NimCode creates a `.nimcode` directory inside your projects. This directory acts as the **agent's personal workspace**, not your project's source code:
148
- - `.nimcode/plans/`: All generated step-by-step markdown plans live here.
149
- - `.nimcode/skills/`: Custom guidelines, framework rules, or memories you teach the agent.
150
- - `.nimcode/history/`: File backups for `/undo` capabilities.
151
-
152
- > **Important**: NimCode writes your actual source code to your project root, not inside `.nimcode/`. The `.nimcode/` folder is only for the agent's internal notes.
153
-
154
- ### Advanced Configuration
155
-
156
- NimCode's behavior can be fully customized through `~/.nimcode/settings.json` (global) or `.nimcode/settings.json` (per-project). Setting any timeout to `0` disables it (infinite).
157
-
158
- ```json
159
- {
160
- "model": "meta/llama-3.1-70b-instruct",
161
- "api_base_url": "https://integrate.api.nvidia.com/v1",
162
- "timeout_command": 1200,
163
- "timeout_llm": 120,
164
- "timeout_format": 10,
165
- "timeout_browser": 15000,
166
- "timeout_updater": 3,
167
- "max_turns": 200,
168
- "max_tokens": 120000,
169
- "max_retries": 15,
170
- "retry_base_delay": 2.0,
171
- "retry_max_delay": 60.0,
172
- "allow_bash_non_interactive": false
173
- }
174
- ```
175
-
176
- | Setting | Default | Description |
177
- |---------|---------|-------------|
178
- | `model` | `meta/llama-3.1-70b-instruct` | Default LLM model |
179
- | `api_base_url` | NVIDIA NIM endpoint | Switch to Ollama/vLLM by changing this |
180
- | `timeout_command` | 1200 | Max seconds for bash commands (0 = infinite) |
181
- | `timeout_llm` | 120 | Max seconds for LLM API calls (0 = infinite) |
182
- | `timeout_format` | 10 | Max seconds for formatters like black/prettier |
183
- | `timeout_browser` | 15000 | Max ms for browser actions |
184
- | `timeout_updater` | 3 | Max seconds for update checks |
185
- | `max_turns` | 200 | Max agent turns per session (0 = unlimited) |
186
- | `max_tokens` | 120000 | Token budget before auto-compact |
187
- | `max_retries` | 15 | Max API retry attempts on transient errors |
188
- | `retry_base_delay` | 2.0 | Base delay for exponential backoff (seconds) |
189
- | `retry_max_delay` | 60.0 | Max delay cap for backoff (seconds) |
190
- | `allow_bash_non_interactive` | false | Allow Bash commands in non-interactive/CI mode |
191
-
192
- ---
193
-
194
- ## 📋 Changelog
195
-
196
- ### v0.5.4 (Latest)
197
- - 🐛 **Bug Fix**: Fixed a bug where the `Read` tool would crash with a `TypeError` if an LLM provided the `offset` and `limit` arguments as strings (e.g. `'1'`) instead of integers.
198
-
199
- ### v0.5.3
200
- - 🧭 **Phase/Task Plan Architecture**: `/plan` mode now forces the AI to output plans with meticulous Phase -> Task -> Checklist hierarchy (inspired by Claude Code), fixing superficial plan generation.
201
-
202
- ### v0.5.2
203
- - 🧠 **Autonomous Marathon Runner**: Capable of running non-stop for 5-6 hours without drifting from the main plan.
204
- - 🧪 **Native TestRunner**: NimCode can now run your test suites (`pytest`, `npm test`, `go test`) and self-heal its code until the tests pass.
205
- - 🗺️ **Semantic AST Explorer**: `GetCodeOutline` tool added for instant navigation within large files (functions/classes with line numbers) instead of reading thousands of lines.
206
- - 🛡️ **Stuck-Loop Breaker**: AI no longer gets stuck repeating the same failing action. Auto-detects 3x repeated errors and forces a strategy change.
207
- - 🧭 **Plan-Drift Radar**: Automatically pings the agent every 15 turns to ensure strict compliance with the `.nimcode/active_plan.txt` and prevents hallucinations.
208
- - 🚨 **Anti-Laziness Firewall**: Advanced regex intercepts lazy code (e.g., `// TODO`, `pass`) before it's written and forces the AI to output complete logic.
209
- - **Self-Correcting Auto-Linters**: Seamless multi-language support. Formats and validates code in the background using `go vet`, `prettier`, and `python` syntax checks.
210
- - 🧠 **Semantic Context RAG**: Automatically pins the directory tree and database schemas into the system prompt to cure agent amnesia.
211
- - 📝 **ReplaceBlock Tool**: Precision line-based editing replaces the buggy exact-string `Replace` tool, completely solving indentation mismatch errors.
212
- - **195 tests passing**
213
-
214
- ### v0.4.0
215
- - 🐛 **System prompt is now OS-aware**: Correctly uses Windows (`mkdir`, `copy`) or Unix (`mkdir -p`, `cp`) commands based on the detected OS
216
- - 🐛 **Plan quality massively improved**: `/plan` mode now reads your actual documents (SDD, PRD, etc.) and generates concrete plans with real file paths and code — not generic PM templates
217
- - 🐛 **Fixed `_distill_memory` 400 error**: Context compaction no longer crashes with a Bad Request error
218
- - 🐛 **Fixed version tracking**: `CURRENT_VERSION` was hardcoded as `3.0.0`; now reads from a single source of truth
219
- - 🐛 **`/thinkback` shows real data**: Previously showed hardcoded fake table; now shows actual session statistics
220
- - 🐛 **LiveSync fixed**: `repo_map` module was missing, causing the workspace watcher to silently fail
221
- - 🔒 **Security**: Non-interactive mode no longer auto-approves Bash commands
222
- - ⚙️ **Fully configurable**: `max_turns`, `max_tokens`, `max_retries`, retry delays all configurable via settings
223
- - ⚙️ **Dynamic model list**: Fetched from NIM API at runtime with fallback to known models
224
- - ⚙️ **Paginated file reading**: `Read` tool supports `offset`/`limit` for large files
225
-
226
- ### v0.3.4
227
- - All timeouts configurable via settings (0 = infinite)
228
-
229
- ---
230
-
231
- ## 🛡️ Requirements
232
-
233
- - Python 3.8+
234
- - An NVIDIA NIM API Key (`NIM_API_KEY`)
235
-
236
- ## 🤝 Contributing
237
-
238
- Contributions, issues, and feature requests are welcome! Feel free to check out our [issues page](#).
239
-
240
- ---
241
- <div align="center">
242
- <i>Built with ❤️ for the open-source developer community.</i>
243
- </div>
1
+ Metadata-Version: 2.4
2
+ Name: nimcode
3
+ Version: 0.7.0
4
+ Summary: A standalone, robust coding agent for NVIDIA NIM models.
5
+ Home-page: https://github.com/Batunash/nimcode
6
+ Author: Autonomous Agent
7
+ Requires-Python: >=3.8
8
+ Description-Content-Type: text/markdown
9
+ Requires-Dist: httpx>=0.27.0
10
+ Requires-Dist: rich>=13.7.0
11
+ Requires-Dist: prompt_toolkit>=3.0.0
12
+ Requires-Dist: mcp>=1.2.0
13
+ Requires-Dist: watchdog>=3.0.0
14
+ Dynamic: author
15
+ Dynamic: description
16
+ Dynamic: description-content-type
17
+ Dynamic: home-page
18
+ Dynamic: requires-dist
19
+ Dynamic: requires-python
20
+ Dynamic: summary
21
+
22
+ <div align="center">
23
+
24
+ # 🚀 NimCode
25
+
26
+ **The Autonomous AI Coding Assistant for the NVIDIA NIM Ecosystem**
27
+
28
+ [![PyPI version](https://img.shields.io/pypi/v/nimcode.svg)](https://pypi.org/project/nimcode/)
29
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
30
+
31
+ *A powerful, standalone REPL and CLI agent that writes, edits, and plans code like a senior developer—powered by LLaMa 3.1 70B (and other cutting-edge models) and the lightning-fast NVIDIA NIM API.*
32
+
33
+ </div>
34
+
35
+ ---
36
+
37
+ ## 🌟 Overview
38
+
39
+ NimCode is your autonomous coding pair-programmer. Built with a rich interactive terminal interface, it doesn't just autocomplete code—it plans architectures based on real documents (SDD, PRD, RFC), executes terminal commands, writes complete files, and manages your workspace.
40
+
41
+ ### ✅ What Works Right Now
42
+ - **OS-Aware Agent**: Automatically detects Windows/Linux/macOS and uses the correct shell commands. No more `mkdir -p` on Windows.
43
+ - **SDD/PRD-Aware Planning**: `/plan` mode reads your actual documents and produces implementation plans grounded in real file names, modules, and requirements—not generic PM templates.
44
+ - **Paginated File Reading**: Large files (like SDDs) are read in chunks with `offset`/`limit` so nothing gets truncated.
45
+ - **VS Code Deep Integration**: Native IPC communication allowing NimCode to read active editors, send patches, and act as your intelligent coding panel within VS Code.
46
+ - **RAG & Semantic Search**: Zero-dependency TF-IDF/BM25 based indexer that instantly scans massive workspaces and retrieves context-aware code snippets.
47
+ - **Autonomous Auto-Fixer**: The `/fix` command creates a self-healing feedback loop—runs your broken commands, analyzes tracebacks, and automatically iterates on code patches until the build passes.
48
+ - **Multi-Model & Local Support**: Flexible `api_base_url` configuration to seamlessly switch between NVIDIA NIM, Ollama, or vLLM endpoints. Dynamic model list fetched from the API at runtime.
49
+ - **Smart Permission Engine**: Granular control over file writes and command executions, featuring an auto-bypass mechanism and interactive `(a)ccept / (r)eject` diff previews. Non-interactive/CI mode is secure by default (Bash denied unless explicitly allowed).
50
+ - **Robust Interactive REPL**: Multiline support (Alt+Enter), syntax highlighting, and beautiful `rich`-powered UI menus.
51
+ - **Automated Workflows**: Automatic linting and formatting using `black`, `flake8`, and `prettier` behind the scenes.
52
+ - **Model Context Protocol (MCP)**: Native integration for MCP tools allowing infinite extensibility.
53
+ - **Context Management**: Auto-compact with per-model context window awareness. `/thinkback` shows real session statistics.
54
+ - **Live Sync**: Workspace watcher automatically updates the repo map in the agent's context when files change.
55
+
56
+ ### 🚀 What We're Working On (Roadmap)
57
+ - **Sub-agent Swarms**: Perfecting `/delegate` and `/swarm` to distribute complex tasks among specialized AI roles.
58
+ - **Advanced Diagnostics**: Refining `/bughunter`, `/security-review`, and `/doctor` for automated codebase auditing.
59
+ - **Test-Driven Development**: Upgrading `/tdd` and `/testgen` to automatically write tests and ensure 100% coverage before committing.
60
+ - **Infrastructure & DevOps**: Implementing `/terraform-god` and `/sql-tune` for automated cloud provisioning and database query optimization.
61
+
62
+ ---
63
+
64
+ ## 📦 Installation & Update
65
+
66
+ ```bash
67
+ # First time install
68
+ pip install nimcode
69
+
70
+ # Update to latest version
71
+ pip install --upgrade nimcode
72
+ ```
73
+
74
+ > **⚠️ If NimCode shows an old version number at startup**, you likely have an older install. Run `pip install --upgrade nimcode` to get the latest fixes.
75
+
76
+ ## 🚀 Quick Start
77
+
78
+ 1. **Get an API Key**: Grab a free NVIDIA API key from [build.nvidia.com](https://build.nvidia.com/).
79
+ 2. **Login**: Connect your local environment by running:
80
+ ```bash
81
+ nimcode login
82
+ ```
83
+ 3. **Start Coding**:
84
+ - Launch the interactive REPL:
85
+ ```bash
86
+ nimcode
87
+ ```
88
+ - Or run a one-off task directly from the command line:
89
+ ```bash
90
+ nimcode /plan "Build a classic Snake game using HTML5 Canvas"
91
+ ```
92
+
93
+ ---
94
+
95
+ ## 💻 Complete Command Reference
96
+
97
+ Inside the `nimcode` REPL, you can type natural language or use any of the following slash commands:
98
+
99
+ ### Mode Toggles & Execution
100
+ - **`/code`**: Enter standard coding mode (default mode, prompts for dangerous actions).
101
+ - **`/plan`**: Enter planning mode. NimCode will **read your actual documents/files first**, then write a concrete implementation plan to `.nimcode/plans/`.
102
+ - **`/trust`**: Enter trust mode. The AI will run commands and edit files completely autonomously without asking for `(a)ccept / (r)eject`. Turn limit removed.
103
+ - **`/untrust`**: Disable trust mode and restore permission prompts.
104
+
105
+ ### Interface & Settings
106
+ - **`/models`**: Open an interactive UI to select your preferred NVIDIA NIM model.
107
+ - **`/theme`**: Open an interactive UI to change your syntax highlighting theme.
108
+ - **`/config`**: View and edit global NimCode configuration settings.
109
+
110
+ ### Workspace & Context Management
111
+ - **`/clear`**: Clear the current conversation history to reset context.
112
+ - **`/compact`**: Compact the context window to save tokens while keeping essential memories.
113
+ - **`/context`**: View and manage the loaded context window.
114
+ - **`/rewind`**: Rewind the conversation history by a few steps.
115
+ - **`/undo`**: Revert the last file modification made by the AI.
116
+ - **`/thinkback`**: View real session statistics (turns, token estimates, message history).
117
+
118
+ ### Project & Search
119
+ - **`/index`**: Index the current project files to enable lightning-fast Semantic Search.
120
+ - **`/map`**: Generate a high-level semantic architecture map of the codebase.
121
+ - **`/research`**: Enter deep-research mode for reading documentation or large files.
122
+
123
+ ### Automation & Git
124
+ - **`/commit`**: Analyze all staged git changes and automatically generate a conventional commit message.
125
+ - **`/fix`**: Run a specific shell command and let the AI automatically iterate to fix any resulting errors.
126
+ - **`/autofix-pr`**: Pulls the current active GitHub Pull Request, reads comments, and automatically fixes the mentioned issues.
127
+
128
+ ### Advanced Development Modes
129
+ - **`/testgen <file>`**: Generate unit tests for a specific file, aiming for 100% coverage.
130
+ - **`/tdd`**: Enter Test-Driven Development mode. The AI will write tests first, verify they fail, and then implement the code to pass them.
131
+ - **`/bughunter`**: Initiate an automated search for logical bugs and edge cases across the codebase.
132
+ - **`/security-review`**: Audit the codebase for common vulnerabilities (e.g., OWASP top 10).
133
+ - **`/ultraplan <task>`**: Generate a master ultra-detailed, dependency-graphed execution plan.
134
+
135
+ ### AI & Agents
136
+ - **`/delegate <role> <task>`**: Spawn an independent sub-agent with a specific role to handle a background task.
137
+ - **`/swarm`**: Orchestrate multiple sub-agents to tackle a complex architectural epic simultaneously.
138
+ - **`/grill-me`**: Interrogation mode. The AI will ask *you* hard questions to refine your system design and edge cases.
139
+ - **`/learn`**: Teach NimCode a new persistent skill or framework rule that it will remember for future sessions.
140
+ - **`/vision`**: Capture the screen and analyze UI elements using Vision AI models.
141
+ - **`/mcp install`**: Install and configure new Model Context Protocol tools.
142
+
143
+ ---
144
+
145
+ ## ⚙️ How it Works
146
+
147
+ NimCode creates a `.nimcode` directory inside your projects. This directory acts as the **agent's personal workspace**, not your project's source code:
148
+ - `.nimcode/plans/`: All generated step-by-step markdown plans live here.
149
+ - `.nimcode/skills/`: Custom guidelines, framework rules, or memories you teach the agent.
150
+ - `.nimcode/history/`: File backups for `/undo` capabilities.
151
+
152
+ > **Important**: NimCode writes your actual source code to your project root, not inside `.nimcode/`. The `.nimcode/` folder is only for the agent's internal notes.
153
+
154
+ ### Advanced Configuration
155
+
156
+ NimCode's behavior can be fully customized through `~/.nimcode/settings.json` (global) or `.nimcode/settings.json` (per-project). Setting any timeout to `0` disables it (infinite).
157
+
158
+ ```json
159
+ {
160
+ "model": "meta/llama-3.1-70b-instruct",
161
+ "api_base_url": "https://integrate.api.nvidia.com/v1",
162
+ "timeout_command": 1200,
163
+ "timeout_llm": 120,
164
+ "timeout_format": 10,
165
+ "timeout_browser": 15000,
166
+ "timeout_updater": 3,
167
+ "max_turns": 200,
168
+ "max_tokens": 120000,
169
+ "max_retries": 15,
170
+ "retry_base_delay": 2.0,
171
+ "retry_max_delay": 60.0,
172
+ "allow_bash_non_interactive": false
173
+ }
174
+ ```
175
+
176
+ | Setting | Default | Description |
177
+ |---------|---------|-------------|
178
+ | `model` | `meta/llama-3.1-70b-instruct` | Default LLM model |
179
+ | `api_base_url` | NVIDIA NIM endpoint | Switch to Ollama/vLLM by changing this |
180
+ | `timeout_command` | 1200 | Max seconds for bash commands (0 = infinite) |
181
+ | `timeout_llm` | 120 | Max seconds for LLM API calls (0 = infinite) |
182
+ | `timeout_format` | 10 | Max seconds for formatters like black/prettier |
183
+ | `timeout_browser` | 15000 | Max ms for browser actions |
184
+ | `timeout_updater` | 3 | Max seconds for update checks |
185
+ | `max_turns` | 200 | Max agent turns per session (0 = unlimited) |
186
+ | `max_tokens` | 120000 | Token budget before auto-compact |
187
+ | `max_retries` | 15 | Max API retry attempts on transient errors |
188
+ | `retry_base_delay` | 2.0 | Base delay for exponential backoff (seconds) |
189
+ | `retry_max_delay` | 60.0 | Max delay cap for backoff (seconds) |
190
+ | `allow_bash_non_interactive` | false | Allow Bash commands in non-interactive/CI mode |
191
+
192
+ ---
193
+
194
+ ## 📋 Changelog
195
+
196
+ ### v0.5.5 (Latest)
197
+ - 🐛 **UI Bug Fix**: Fixed a visual bug where the CLI welcome banner hardcoded `NimCode v0.2.0` despite the user having updated to a newer version.
198
+
199
+ ### v0.5.4
200
+ - 🐛 **Bug Fix**: Fixed a bug where the `Read` tool would crash with a `TypeError` if an LLM provided the `offset` and `limit` arguments as strings (e.g. `'1'`) instead of integers.
201
+
202
+ ### v0.5.3
203
+ - 🧭 **Phase/Task Plan Architecture**: `/plan` mode now forces the AI to output plans with meticulous Phase -> Task -> Checklist hierarchy (inspired by Claude Code), fixing superficial plan generation.
204
+
205
+ ### v0.5.2
206
+ - 🧠 **Autonomous Marathon Runner**: Capable of running non-stop for 5-6 hours without drifting from the main plan.
207
+ - 🧪 **Native TestRunner**: NimCode can now run your test suites (`pytest`, `npm test`, `go test`) and self-heal its code until the tests pass.
208
+ - 🗺️ **Semantic AST Explorer**: `GetCodeOutline` tool added for instant navigation within large files (functions/classes with line numbers) instead of reading thousands of lines.
209
+ - 🛡️ **Stuck-Loop Breaker**: AI no longer gets stuck repeating the same failing action. Auto-detects 3x repeated errors and forces a strategy change.
210
+ - 🧭 **Plan-Drift Radar**: Automatically pings the agent every 15 turns to ensure strict compliance with the `.nimcode/active_plan.txt` and prevents hallucinations.
211
+ - 🚨 **Anti-Laziness Firewall**: Advanced regex intercepts lazy code (e.g., `// TODO`, `pass`) before it's written and forces the AI to output complete logic.
212
+ - **Self-Correcting Auto-Linters**: Seamless multi-language support. Formats and validates code in the background using `go vet`, `prettier`, and `python` syntax checks.
213
+ - 🧠 **Semantic Context RAG**: Automatically pins the directory tree and database schemas into the system prompt to cure agent amnesia.
214
+ - 📝 **ReplaceBlock Tool**: Precision line-based editing replaces the buggy exact-string `Replace` tool, completely solving indentation mismatch errors.
215
+ - **195 tests passing**
216
+
217
+ ### v0.4.0
218
+ - 🐛 **System prompt is now OS-aware**: Correctly uses Windows (`mkdir`, `copy`) or Unix (`mkdir -p`, `cp`) commands based on the detected OS
219
+ - 🐛 **Plan quality massively improved**: `/plan` mode now reads your actual documents (SDD, PRD, etc.) and generates concrete plans with real file paths and code — not generic PM templates
220
+ - 🐛 **Fixed `_distill_memory` 400 error**: Context compaction no longer crashes with a Bad Request error
221
+ - 🐛 **Fixed version tracking**: `CURRENT_VERSION` was hardcoded as `3.0.0`; now reads from a single source of truth
222
+ - 🐛 **`/thinkback` shows real data**: Previously showed hardcoded fake table; now shows actual session statistics
223
+ - 🐛 **LiveSync fixed**: `repo_map` module was missing, causing the workspace watcher to silently fail
224
+ - 🔒 **Security**: Non-interactive mode no longer auto-approves Bash commands
225
+ - ⚙️ **Fully configurable**: `max_turns`, `max_tokens`, `max_retries`, retry delays all configurable via settings
226
+ - ⚙️ **Dynamic model list**: Fetched from NIM API at runtime with fallback to known models
227
+ - ⚙️ **Paginated file reading**: `Read` tool supports `offset`/`limit` for large files
228
+
229
+ ### v0.3.4
230
+ - All timeouts configurable via settings (0 = infinite)
231
+
232
+ ---
233
+
234
+ ## 🛡️ Requirements
235
+
236
+ - Python 3.8+
237
+ - An NVIDIA NIM API Key (`NIM_API_KEY`)
238
+
239
+ ## 🤝 Contributing
240
+
241
+ Contributions, issues, and feature requests are welcome! Feel free to check out our [issues page](#).
242
+
243
+ ---
244
+ <div align="center">
245
+ <i>Built with ❤️ for the open-source developer community.</i>
246
+ </div>