acorn-agent 2.1.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.
- acorn_agent-2.1.0/LICENSE +21 -0
- acorn_agent-2.1.0/PKG-INFO +345 -0
- acorn_agent-2.1.0/README.md +315 -0
- acorn_agent-2.1.0/acorn/__init__.py +2 -0
- acorn_agent-2.1.0/acorn/config/__init__.py +0 -0
- acorn_agent-2.1.0/acorn/config/project_config.py +76 -0
- acorn_agent-2.1.0/acorn/config/settings.py +150 -0
- acorn_agent-2.1.0/acorn/core/__init__.py +0 -0
- acorn_agent-2.1.0/acorn/core/agent.py +711 -0
- acorn_agent-2.1.0/acorn/core/context.py +73 -0
- acorn_agent-2.1.0/acorn/core/costs.py +69 -0
- acorn_agent-2.1.0/acorn/core/planner.py +94 -0
- acorn_agent-2.1.0/acorn/core/router.py +64 -0
- acorn_agent-2.1.0/acorn/core/session.py +68 -0
- acorn_agent-2.1.0/acorn/main.py +112 -0
- acorn_agent-2.1.0/acorn/tools/__init__.py +0 -0
- acorn_agent-2.1.0/acorn/tools/filesystem.py +154 -0
- acorn_agent-2.1.0/acorn/tools/git_tools.py +63 -0
- acorn_agent-2.1.0/acorn/tools/terminal.py +117 -0
- acorn_agent-2.1.0/acorn/ui/__init__.py +0 -0
- acorn_agent-2.1.0/acorn/ui/terminal_ui.py +464 -0
- acorn_agent-2.1.0/acorn_agent.egg-info/PKG-INFO +345 -0
- acorn_agent-2.1.0/acorn_agent.egg-info/SOURCES.txt +28 -0
- acorn_agent-2.1.0/acorn_agent.egg-info/dependency_links.txt +1 -0
- acorn_agent-2.1.0/acorn_agent.egg-info/entry_points.txt +2 -0
- acorn_agent-2.1.0/acorn_agent.egg-info/requires.txt +1 -0
- acorn_agent-2.1.0/acorn_agent.egg-info/top_level.txt +1 -0
- acorn_agent-2.1.0/pyproject.toml +40 -0
- acorn_agent-2.1.0/setup.cfg +4 -0
- acorn_agent-2.1.0/setup.py +33 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andama Godwin
|
|
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.
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: acorn-agent
|
|
3
|
+
Version: 2.1.0
|
|
4
|
+
Summary: An autonomous coding agent that lives in your terminal — powered by Gemini 3.1 Pro
|
|
5
|
+
Home-page: https://github.com/andamagodwin/Acorn
|
|
6
|
+
Author: Andama Godwin
|
|
7
|
+
Author-email: Andama Godwin <andamagodwin@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/andamagodwin/acorn
|
|
10
|
+
Project-URL: Repository, https://github.com/andamagodwin/acorn
|
|
11
|
+
Project-URL: Issues, https://github.com/andamagodwin/acorn/issues
|
|
12
|
+
Keywords: ai,coding-agent,gemini,vertex-ai,cli,autonomous
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Topic :: Software Development
|
|
19
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
20
|
+
Classifier: Intended Audience :: Developers
|
|
21
|
+
Classifier: Environment :: Console
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: google-genai>=1.0.0
|
|
26
|
+
Dynamic: author
|
|
27
|
+
Dynamic: home-page
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
Dynamic: requires-python
|
|
30
|
+
|
|
31
|
+
# Acorn
|
|
32
|
+
|
|
33
|
+
**An autonomous coding agent that lives in your terminal.**
|
|
34
|
+
|
|
35
|
+
Acorn reads your code, writes files, runs commands, and refactors across your entire codebase — powered by Google's Gemini 3.1 Pro via Vertex AI.
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
█████╗ ██████╗ ██████╗ ██████╗ ███╗ ██╗
|
|
39
|
+
██╔══██╗██╔════╝██╔═══██╗██╔══██╗████╗ ██║
|
|
40
|
+
███████║██║ ██║ ██║██████╔╝██╔██╗ ██║
|
|
41
|
+
██╔══██║██║ ██║ ██║██╔══██╗██║╚██╗██║
|
|
42
|
+
██║ ██║╚██████╗╚██████╔╝██║ ██║██║ ╚████║
|
|
43
|
+
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
- **Streaming responses** — see output as it's generated
|
|
49
|
+
- **Smart model routing** — Flash for simple questions, Pro for complex tasks
|
|
50
|
+
- **Surgical file editing** — modifies specific lines, not entire files
|
|
51
|
+
- **Multi-file refactoring** — reads and edits across your whole codebase
|
|
52
|
+
- **Image/screenshot analysis** — attach images for the model to analyze
|
|
53
|
+
- **Auto-retry with error recovery** — adapts when things fail
|
|
54
|
+
- **Session persistence** — resume conversations where you left off
|
|
55
|
+
- **Undo support** — revert the last file change instantly
|
|
56
|
+
- **Cost tracking** — see what you're spending per session
|
|
57
|
+
- **Project config** — per-repo `.acorn.toml` for custom settings
|
|
58
|
+
- **Permission system** — 3-tier safety (safe/ask/deny)
|
|
59
|
+
- **Git-aware** — understands your branch, status, and project structure
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Quick Start
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Install from PyPI (easiest)
|
|
67
|
+
pip install acorn-agent
|
|
68
|
+
|
|
69
|
+
# Or install from GitHub
|
|
70
|
+
pip install git+https://github.com/andamagodwin/acorn.git
|
|
71
|
+
|
|
72
|
+
# Run it
|
|
73
|
+
acorn
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
On first run it will ask for your GCP project ID. That's it.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Installation (Full Guide)
|
|
81
|
+
|
|
82
|
+
### Prerequisites
|
|
83
|
+
|
|
84
|
+
| Requirement | Why |
|
|
85
|
+
|-------------|-----|
|
|
86
|
+
| Python 3.11+ | Runtime |
|
|
87
|
+
| Google Cloud account | Vertex AI access |
|
|
88
|
+
| `gcloud` CLI | Authentication |
|
|
89
|
+
|
|
90
|
+
### Step 1: Clone and Install
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
git clone https://github.com/andamagodwin/acorn.git
|
|
94
|
+
cd acorn
|
|
95
|
+
pip install -e .
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
This installs `acorn` as a global command you can run from anywhere.
|
|
99
|
+
|
|
100
|
+
### Step 2: Set Up Google Cloud
|
|
101
|
+
|
|
102
|
+
You need a GCP project with Vertex AI API enabled and authentication configured.
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Install gcloud CLI if you don't have it
|
|
106
|
+
# https://cloud.google.com/sdk/docs/install
|
|
107
|
+
|
|
108
|
+
# Login to Google Cloud
|
|
109
|
+
gcloud auth login
|
|
110
|
+
gcloud auth application-default login
|
|
111
|
+
|
|
112
|
+
# Set your project
|
|
113
|
+
gcloud config set project YOUR_PROJECT_ID
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Step 3: Enable Vertex AI API
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
gcloud services enable aiplatform.googleapis.com
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Or enable it in the console: https://console.cloud.google.com/apis/library/aiplatform.googleapis.com
|
|
123
|
+
|
|
124
|
+
### Step 4: Configure Your Project ID
|
|
125
|
+
|
|
126
|
+
Edit `acorn/config/settings.py` and set your project:
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
project: str = "your-gcp-project-id"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Or use the CLI flag:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
acorn --project your-gcp-project-id
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Or use a `.acorn.toml` in your repo (see below).
|
|
139
|
+
|
|
140
|
+
### Step 5: Run
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
cd ~/your-project
|
|
144
|
+
acorn
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Usage
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Start in current directory
|
|
153
|
+
acorn
|
|
154
|
+
|
|
155
|
+
# Use a specific model
|
|
156
|
+
acorn --model gemini-2.5-flash
|
|
157
|
+
|
|
158
|
+
# List available models
|
|
159
|
+
acorn --models
|
|
160
|
+
|
|
161
|
+
# Disable streaming
|
|
162
|
+
acorn --no-stream
|
|
163
|
+
|
|
164
|
+
# Disable smart routing (always use Pro)
|
|
165
|
+
acorn --no-routing
|
|
166
|
+
|
|
167
|
+
# Auto-approve all file writes (careful!)
|
|
168
|
+
acorn --unsafe
|
|
169
|
+
|
|
170
|
+
# Override GCP project
|
|
171
|
+
acorn --project my-project-id
|
|
172
|
+
|
|
173
|
+
# Help
|
|
174
|
+
acorn --help
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Attach Images
|
|
178
|
+
|
|
179
|
+
Just include an image path in your message:
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
> what's wrong in screenshot.png
|
|
183
|
+
> implement the design in mockup.jpg
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Gemini will analyze the image and respond accordingly.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Commands
|
|
191
|
+
|
|
192
|
+
| Command | What it does |
|
|
193
|
+
|---------|--------------|
|
|
194
|
+
| `/help` | Show all commands |
|
|
195
|
+
| `/model <name>` | Switch model (or list available) |
|
|
196
|
+
| `/cost` | Show session cost breakdown |
|
|
197
|
+
| `/status` | Token usage, routing stats, cost |
|
|
198
|
+
| `/plan` | Show current task execution plan |
|
|
199
|
+
| `/undo` | Revert the last file change |
|
|
200
|
+
| `/clear` | Reset context and session |
|
|
201
|
+
| `/sessions` | List saved sessions |
|
|
202
|
+
| `/routing on\|off` | Toggle smart routing |
|
|
203
|
+
| `/exit` | Quit |
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Project Configuration
|
|
208
|
+
|
|
209
|
+
Drop a `.acorn.toml` in any project root to customize Acorn's behavior for that repo:
|
|
210
|
+
|
|
211
|
+
```toml
|
|
212
|
+
[model]
|
|
213
|
+
pro = "gemini-2.5-pro"
|
|
214
|
+
flash = "gemini-2.5-flash"
|
|
215
|
+
temperature = 0.2
|
|
216
|
+
max_output_tokens = 65536
|
|
217
|
+
|
|
218
|
+
[routing]
|
|
219
|
+
enabled = true
|
|
220
|
+
threshold = 200
|
|
221
|
+
|
|
222
|
+
[project]
|
|
223
|
+
gcp_project = "your-project-id"
|
|
224
|
+
location = "us-central1"
|
|
225
|
+
|
|
226
|
+
[permissions]
|
|
227
|
+
safe_commands = [
|
|
228
|
+
"npm run", "npm test", "cargo build",
|
|
229
|
+
"python -m pytest", "make",
|
|
230
|
+
]
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Acorn auto-detects this file by walking up from your working directory.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## For Collaborators
|
|
238
|
+
|
|
239
|
+
### Joining the Project
|
|
240
|
+
|
|
241
|
+
1. Get added as a collaborator on the GitHub repo
|
|
242
|
+
2. Clone and install:
|
|
243
|
+
```bash
|
|
244
|
+
git clone https://github.com/andamagodwin/acorn.git
|
|
245
|
+
cd acorn
|
|
246
|
+
pip install -e .
|
|
247
|
+
```
|
|
248
|
+
3. Set up GCP authentication:
|
|
249
|
+
```bash
|
|
250
|
+
gcloud auth login
|
|
251
|
+
gcloud auth application-default login
|
|
252
|
+
```
|
|
253
|
+
4. Ask the project owner to add you to the GCP project with the **"Vertex AI User"** role in IAM
|
|
254
|
+
5. Run `acorn` from any directory
|
|
255
|
+
|
|
256
|
+
### IAM Setup (For Project Owner)
|
|
257
|
+
|
|
258
|
+
To add a collaborator to your GCP project:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
gcloud projects add-iam-policy-binding YOUR_PROJECT_ID \
|
|
262
|
+
--member="user:their-email@gmail.com" \
|
|
263
|
+
--role="roles/aiplatform.user"
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Or in the console: IAM & Admin > IAM > Grant Access > Role: "Vertex AI User"
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Architecture
|
|
271
|
+
|
|
272
|
+
```
|
|
273
|
+
acorn/
|
|
274
|
+
├── config/
|
|
275
|
+
│ ├── settings.py — Models, permissions, safety rules
|
|
276
|
+
│ └── project_config.py — .acorn.toml loader
|
|
277
|
+
├── core/
|
|
278
|
+
│ ├── agent.py — Main brain: streaming agentic loop
|
|
279
|
+
│ ├── context.py — Context window with auto-compaction
|
|
280
|
+
│ ├── costs.py — Token usage and cost tracking
|
|
281
|
+
│ ├── planner.py — Multi-step task planning
|
|
282
|
+
│ ├── router.py — Smart model routing (Flash vs Pro)
|
|
283
|
+
│ └── session.py — Session persistence to ~/.acorn/sessions/
|
|
284
|
+
├── tools/
|
|
285
|
+
│ ├── filesystem.py — Read, write, edit, search, list
|
|
286
|
+
│ ├── terminal.py — Command execution with timeout
|
|
287
|
+
│ └── git_tools.py — Git-aware project understanding
|
|
288
|
+
├── ui/
|
|
289
|
+
│ └── terminal_ui.py — Terminal UI with markdown rendering
|
|
290
|
+
└── main.py — CLI entry point
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## How It Works
|
|
296
|
+
|
|
297
|
+
1. You type a message
|
|
298
|
+
2. Acorn routes it to Flash (simple) or Pro (complex)
|
|
299
|
+
3. The model calls tools — reads files, edits code, runs commands
|
|
300
|
+
4. Tool results feed back for up to 25 iterations per turn
|
|
301
|
+
5. If something fails, it sees the error and adapts
|
|
302
|
+
6. Final response renders with markdown formatting
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## Safety
|
|
307
|
+
|
|
308
|
+
| Layer | What it does |
|
|
309
|
+
|-------|--------------|
|
|
310
|
+
| Blocked commands | `rm -rf /`, `mkfs`, fork bombs — permanently blocked |
|
|
311
|
+
| Safe commands | `ls`, `git status`, `grep` — auto-execute |
|
|
312
|
+
| Permission prompts | File writes, unknown commands — asks you first |
|
|
313
|
+
| File backups | Every edit is backed up for `/undo` |
|
|
314
|
+
| Context isolation | Won't touch `.env` files or expose secrets |
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Cost
|
|
319
|
+
|
|
320
|
+
| Model | Input | Output | Typical session |
|
|
321
|
+
|-------|-------|--------|-----------------|
|
|
322
|
+
| Gemini 3.1 Pro | $1.25/M tokens | $10.00/M tokens | $0.50–$2.00 |
|
|
323
|
+
| Gemini 2.5 Flash | $0.15/M tokens | $0.60/M tokens | $0.02–$0.10 |
|
|
324
|
+
|
|
325
|
+
Smart routing saves ~70% by using Flash for greetings, questions, and simple lookups.
|
|
326
|
+
|
|
327
|
+
Use `/cost` to see your spending mid-session.
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## Troubleshooting
|
|
332
|
+
|
|
333
|
+
| Problem | Fix |
|
|
334
|
+
|---------|-----|
|
|
335
|
+
| `ModuleNotFoundError: No module named 'acorn'` | Run `pip install -e .` from the acorn directory |
|
|
336
|
+
| `404 NOT_FOUND` model error | Gemini 3.1 requires `location="global"` (already set). If using 2.5 models only, you can use `us-central1` |
|
|
337
|
+
| `Permission denied` on gcloud | Run `gcloud auth application-default login` |
|
|
338
|
+
| `Vertex AI API not enabled` | Run `gcloud services enable aiplatform.googleapis.com` |
|
|
339
|
+
| Session won't resume | Delete `~/.acorn/sessions/` and restart |
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## License
|
|
344
|
+
|
|
345
|
+
MIT
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
# Acorn
|
|
2
|
+
|
|
3
|
+
**An autonomous coding agent that lives in your terminal.**
|
|
4
|
+
|
|
5
|
+
Acorn reads your code, writes files, runs commands, and refactors across your entire codebase — powered by Google's Gemini 3.1 Pro via Vertex AI.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
█████╗ ██████╗ ██████╗ ██████╗ ███╗ ██╗
|
|
9
|
+
██╔══██╗██╔════╝██╔═══██╗██╔══██╗████╗ ██║
|
|
10
|
+
███████║██║ ██║ ██║██████╔╝██╔██╗ ██║
|
|
11
|
+
██╔══██║██║ ██║ ██║██╔══██╗██║╚██╗██║
|
|
12
|
+
██║ ██║╚██████╗╚██████╔╝██║ ██║██║ ╚████║
|
|
13
|
+
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- **Streaming responses** — see output as it's generated
|
|
19
|
+
- **Smart model routing** — Flash for simple questions, Pro for complex tasks
|
|
20
|
+
- **Surgical file editing** — modifies specific lines, not entire files
|
|
21
|
+
- **Multi-file refactoring** — reads and edits across your whole codebase
|
|
22
|
+
- **Image/screenshot analysis** — attach images for the model to analyze
|
|
23
|
+
- **Auto-retry with error recovery** — adapts when things fail
|
|
24
|
+
- **Session persistence** — resume conversations where you left off
|
|
25
|
+
- **Undo support** — revert the last file change instantly
|
|
26
|
+
- **Cost tracking** — see what you're spending per session
|
|
27
|
+
- **Project config** — per-repo `.acorn.toml` for custom settings
|
|
28
|
+
- **Permission system** — 3-tier safety (safe/ask/deny)
|
|
29
|
+
- **Git-aware** — understands your branch, status, and project structure
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Install from PyPI (easiest)
|
|
37
|
+
pip install acorn-agent
|
|
38
|
+
|
|
39
|
+
# Or install from GitHub
|
|
40
|
+
pip install git+https://github.com/andamagodwin/acorn.git
|
|
41
|
+
|
|
42
|
+
# Run it
|
|
43
|
+
acorn
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
On first run it will ask for your GCP project ID. That's it.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Installation (Full Guide)
|
|
51
|
+
|
|
52
|
+
### Prerequisites
|
|
53
|
+
|
|
54
|
+
| Requirement | Why |
|
|
55
|
+
|-------------|-----|
|
|
56
|
+
| Python 3.11+ | Runtime |
|
|
57
|
+
| Google Cloud account | Vertex AI access |
|
|
58
|
+
| `gcloud` CLI | Authentication |
|
|
59
|
+
|
|
60
|
+
### Step 1: Clone and Install
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
git clone https://github.com/andamagodwin/acorn.git
|
|
64
|
+
cd acorn
|
|
65
|
+
pip install -e .
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
This installs `acorn` as a global command you can run from anywhere.
|
|
69
|
+
|
|
70
|
+
### Step 2: Set Up Google Cloud
|
|
71
|
+
|
|
72
|
+
You need a GCP project with Vertex AI API enabled and authentication configured.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Install gcloud CLI if you don't have it
|
|
76
|
+
# https://cloud.google.com/sdk/docs/install
|
|
77
|
+
|
|
78
|
+
# Login to Google Cloud
|
|
79
|
+
gcloud auth login
|
|
80
|
+
gcloud auth application-default login
|
|
81
|
+
|
|
82
|
+
# Set your project
|
|
83
|
+
gcloud config set project YOUR_PROJECT_ID
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Step 3: Enable Vertex AI API
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
gcloud services enable aiplatform.googleapis.com
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Or enable it in the console: https://console.cloud.google.com/apis/library/aiplatform.googleapis.com
|
|
93
|
+
|
|
94
|
+
### Step 4: Configure Your Project ID
|
|
95
|
+
|
|
96
|
+
Edit `acorn/config/settings.py` and set your project:
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
project: str = "your-gcp-project-id"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Or use the CLI flag:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
acorn --project your-gcp-project-id
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Or use a `.acorn.toml` in your repo (see below).
|
|
109
|
+
|
|
110
|
+
### Step 5: Run
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
cd ~/your-project
|
|
114
|
+
acorn
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Usage
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Start in current directory
|
|
123
|
+
acorn
|
|
124
|
+
|
|
125
|
+
# Use a specific model
|
|
126
|
+
acorn --model gemini-2.5-flash
|
|
127
|
+
|
|
128
|
+
# List available models
|
|
129
|
+
acorn --models
|
|
130
|
+
|
|
131
|
+
# Disable streaming
|
|
132
|
+
acorn --no-stream
|
|
133
|
+
|
|
134
|
+
# Disable smart routing (always use Pro)
|
|
135
|
+
acorn --no-routing
|
|
136
|
+
|
|
137
|
+
# Auto-approve all file writes (careful!)
|
|
138
|
+
acorn --unsafe
|
|
139
|
+
|
|
140
|
+
# Override GCP project
|
|
141
|
+
acorn --project my-project-id
|
|
142
|
+
|
|
143
|
+
# Help
|
|
144
|
+
acorn --help
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Attach Images
|
|
148
|
+
|
|
149
|
+
Just include an image path in your message:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
> what's wrong in screenshot.png
|
|
153
|
+
> implement the design in mockup.jpg
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Gemini will analyze the image and respond accordingly.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Commands
|
|
161
|
+
|
|
162
|
+
| Command | What it does |
|
|
163
|
+
|---------|--------------|
|
|
164
|
+
| `/help` | Show all commands |
|
|
165
|
+
| `/model <name>` | Switch model (or list available) |
|
|
166
|
+
| `/cost` | Show session cost breakdown |
|
|
167
|
+
| `/status` | Token usage, routing stats, cost |
|
|
168
|
+
| `/plan` | Show current task execution plan |
|
|
169
|
+
| `/undo` | Revert the last file change |
|
|
170
|
+
| `/clear` | Reset context and session |
|
|
171
|
+
| `/sessions` | List saved sessions |
|
|
172
|
+
| `/routing on\|off` | Toggle smart routing |
|
|
173
|
+
| `/exit` | Quit |
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Project Configuration
|
|
178
|
+
|
|
179
|
+
Drop a `.acorn.toml` in any project root to customize Acorn's behavior for that repo:
|
|
180
|
+
|
|
181
|
+
```toml
|
|
182
|
+
[model]
|
|
183
|
+
pro = "gemini-2.5-pro"
|
|
184
|
+
flash = "gemini-2.5-flash"
|
|
185
|
+
temperature = 0.2
|
|
186
|
+
max_output_tokens = 65536
|
|
187
|
+
|
|
188
|
+
[routing]
|
|
189
|
+
enabled = true
|
|
190
|
+
threshold = 200
|
|
191
|
+
|
|
192
|
+
[project]
|
|
193
|
+
gcp_project = "your-project-id"
|
|
194
|
+
location = "us-central1"
|
|
195
|
+
|
|
196
|
+
[permissions]
|
|
197
|
+
safe_commands = [
|
|
198
|
+
"npm run", "npm test", "cargo build",
|
|
199
|
+
"python -m pytest", "make",
|
|
200
|
+
]
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Acorn auto-detects this file by walking up from your working directory.
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## For Collaborators
|
|
208
|
+
|
|
209
|
+
### Joining the Project
|
|
210
|
+
|
|
211
|
+
1. Get added as a collaborator on the GitHub repo
|
|
212
|
+
2. Clone and install:
|
|
213
|
+
```bash
|
|
214
|
+
git clone https://github.com/andamagodwin/acorn.git
|
|
215
|
+
cd acorn
|
|
216
|
+
pip install -e .
|
|
217
|
+
```
|
|
218
|
+
3. Set up GCP authentication:
|
|
219
|
+
```bash
|
|
220
|
+
gcloud auth login
|
|
221
|
+
gcloud auth application-default login
|
|
222
|
+
```
|
|
223
|
+
4. Ask the project owner to add you to the GCP project with the **"Vertex AI User"** role in IAM
|
|
224
|
+
5. Run `acorn` from any directory
|
|
225
|
+
|
|
226
|
+
### IAM Setup (For Project Owner)
|
|
227
|
+
|
|
228
|
+
To add a collaborator to your GCP project:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
gcloud projects add-iam-policy-binding YOUR_PROJECT_ID \
|
|
232
|
+
--member="user:their-email@gmail.com" \
|
|
233
|
+
--role="roles/aiplatform.user"
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Or in the console: IAM & Admin > IAM > Grant Access > Role: "Vertex AI User"
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Architecture
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
acorn/
|
|
244
|
+
├── config/
|
|
245
|
+
│ ├── settings.py — Models, permissions, safety rules
|
|
246
|
+
│ └── project_config.py — .acorn.toml loader
|
|
247
|
+
├── core/
|
|
248
|
+
│ ├── agent.py — Main brain: streaming agentic loop
|
|
249
|
+
│ ├── context.py — Context window with auto-compaction
|
|
250
|
+
│ ├── costs.py — Token usage and cost tracking
|
|
251
|
+
│ ├── planner.py — Multi-step task planning
|
|
252
|
+
│ ├── router.py — Smart model routing (Flash vs Pro)
|
|
253
|
+
│ └── session.py — Session persistence to ~/.acorn/sessions/
|
|
254
|
+
├── tools/
|
|
255
|
+
│ ├── filesystem.py — Read, write, edit, search, list
|
|
256
|
+
│ ├── terminal.py — Command execution with timeout
|
|
257
|
+
│ └── git_tools.py — Git-aware project understanding
|
|
258
|
+
├── ui/
|
|
259
|
+
│ └── terminal_ui.py — Terminal UI with markdown rendering
|
|
260
|
+
└── main.py — CLI entry point
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## How It Works
|
|
266
|
+
|
|
267
|
+
1. You type a message
|
|
268
|
+
2. Acorn routes it to Flash (simple) or Pro (complex)
|
|
269
|
+
3. The model calls tools — reads files, edits code, runs commands
|
|
270
|
+
4. Tool results feed back for up to 25 iterations per turn
|
|
271
|
+
5. If something fails, it sees the error and adapts
|
|
272
|
+
6. Final response renders with markdown formatting
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Safety
|
|
277
|
+
|
|
278
|
+
| Layer | What it does |
|
|
279
|
+
|-------|--------------|
|
|
280
|
+
| Blocked commands | `rm -rf /`, `mkfs`, fork bombs — permanently blocked |
|
|
281
|
+
| Safe commands | `ls`, `git status`, `grep` — auto-execute |
|
|
282
|
+
| Permission prompts | File writes, unknown commands — asks you first |
|
|
283
|
+
| File backups | Every edit is backed up for `/undo` |
|
|
284
|
+
| Context isolation | Won't touch `.env` files or expose secrets |
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Cost
|
|
289
|
+
|
|
290
|
+
| Model | Input | Output | Typical session |
|
|
291
|
+
|-------|-------|--------|-----------------|
|
|
292
|
+
| Gemini 3.1 Pro | $1.25/M tokens | $10.00/M tokens | $0.50–$2.00 |
|
|
293
|
+
| Gemini 2.5 Flash | $0.15/M tokens | $0.60/M tokens | $0.02–$0.10 |
|
|
294
|
+
|
|
295
|
+
Smart routing saves ~70% by using Flash for greetings, questions, and simple lookups.
|
|
296
|
+
|
|
297
|
+
Use `/cost` to see your spending mid-session.
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Troubleshooting
|
|
302
|
+
|
|
303
|
+
| Problem | Fix |
|
|
304
|
+
|---------|-----|
|
|
305
|
+
| `ModuleNotFoundError: No module named 'acorn'` | Run `pip install -e .` from the acorn directory |
|
|
306
|
+
| `404 NOT_FOUND` model error | Gemini 3.1 requires `location="global"` (already set). If using 2.5 models only, you can use `us-central1` |
|
|
307
|
+
| `Permission denied` on gcloud | Run `gcloud auth application-default login` |
|
|
308
|
+
| `Vertex AI API not enabled` | Run `gcloud services enable aiplatform.googleapis.com` |
|
|
309
|
+
| Session won't resume | Delete `~/.acorn/sessions/` and restart |
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## License
|
|
314
|
+
|
|
315
|
+
MIT
|
|
File without changes
|