iterare-llm 0.1.2__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.
@@ -0,0 +1,43 @@
1
+ # Prompts directory - contains local prompt experiments
2
+ prompts/
3
+
4
+ # Python
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+ *.so
9
+ .Python
10
+ venv/
11
+ .venv/
12
+ ENV/
13
+ env/
14
+ .coverage
15
+ htmlcov
16
+ .python-version
17
+
18
+ # Node
19
+ node_modules/
20
+ npm-debug.log*
21
+ yarn-debug.log*
22
+ yarn-error.log*
23
+
24
+ # IDE
25
+ .vscode/
26
+ .idea/
27
+ *.swp
28
+ *.swo
29
+ *~
30
+
31
+ # OS
32
+ .DS_Store
33
+ Thumbs.db
34
+
35
+ # Temporary files
36
+ *.tmp
37
+ *.temp
38
+
39
+ # iterare workspaces
40
+ workspaces/
41
+
42
+ # Claude Code
43
+ CLAUDE.md
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sohonet Ltd
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,353 @@
1
+ Metadata-Version: 2.4
2
+ Name: iterare-llm
3
+ Version: 0.1.2
4
+ Summary: Automated Claude Code execution in isolated environments
5
+ Project-URL: Homepage, https://github.com/sohonetlabs/iterare-llm
6
+ Project-URL: Repository, https://github.com/sohonetlabs/iterare-llm
7
+ Project-URL: Issues, https://github.com/sohonetlabs/iterare-llm/issues
8
+ Author-email: Andrew Walker <andrew.walker@sohonet.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: agentic,automation,claude,docker,llm
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Software Development :: Build Tools
16
+ Requires-Python: >=3.13
17
+ Requires-Dist: docker>=7.0.0
18
+ Requires-Dist: platformdirs>=4.0.0
19
+ Requires-Dist: pyyaml>=6.0.1
20
+ Requires-Dist: typer>=0.19.2
21
+ Description-Content-Type: text/markdown
22
+
23
+ # Iterare
24
+
25
+ Automated Claude Code execution in isolated Docker containers.
26
+
27
+ `iterare` creates git worktrees, launches containerised Claude Code instances with autonomous permissions, and
28
+ maintains safety through network firewalls and container isolation. This enables "agentic loops" where Claude
29
+ Code can modify codebases without human confirmation while being restricted to whitelisted network access and
30
+ mounted files.
31
+
32
+ _**Warning – This does not fully protect from malicious code execution or data exfiltration. It simply raises the
33
+ barriers to these things happening. Use at your own risk.**_
34
+
35
+ ## Prerequisites
36
+
37
+ - Python 3.13+
38
+ - [uv](https://docs.astral.sh/uv/) for dependency management
39
+ - Docker
40
+ - A Claude Code API key
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ # Install via pypi
46
+ pip install iterare-llm
47
+
48
+ # Create global config directories
49
+ iterare install
50
+
51
+ # Fetch Claude Code credentials (interactive Docker session)
52
+ iterare credentials
53
+ ```
54
+
55
+ ## Quick Start
56
+
57
+ The easiest way to get started is to use the interactive mode. This launches a Claude Code session in a Docker
58
+ container, mounts your current project directory, and allows you to drive Claude Code yourself.
59
+
60
+ ```bash
61
+ # Initialize a project
62
+ cd /path/to/your/project
63
+ iterare init
64
+
65
+ # Launch in interactive mode
66
+ iterare interactive
67
+ ```
68
+
69
+ Alternatively, you can create a prompt file and execute it. This (by default) creates a git worktree, and branches
70
+ off of the current branch. It then launches Claude Code in a Docker container, mounts the worktree directory, and
71
+ passes the prompt to Claude Code which will then execute the prompt until it's done. This is fantastic for autonomous
72
+ development.
73
+
74
+ ```bash
75
+ # Initialize a project
76
+ cd /path/to/your/project
77
+ iterare init
78
+
79
+ # Create a prompt
80
+ cat > .iterare/prompts/refactor.md << 'EOF'
81
+ ---
82
+ workspace: refactor-auth
83
+ branch: main
84
+ ---
85
+
86
+ Refactor the authentication module to use JWT tokens.
87
+ Add tests for the new implementation.
88
+ EOF
89
+
90
+ # Execute the prompt
91
+ iterare execute refactor
92
+
93
+ # Monitor progress
94
+ iterare log -f
95
+
96
+ # When done, merge changes back
97
+ iterare merge
98
+
99
+ # Clean up the worktree
100
+ iterare cleanup -y
101
+ ```
102
+
103
+ ## Commands
104
+
105
+ ### `iterare init [PATH]`
106
+
107
+ Initialise a project for iterare. Creates the `.iterare/` directory with configuration files and
108
+ a `workspaces/` directory for git worktrees.
109
+
110
+ ```bash
111
+ iterare init # Initialize current directory
112
+ iterare init /path/to/project # Initialize specific directory
113
+ iterare init --force # Overwrite existing configuration
114
+ ```
115
+
116
+ ### `iterare install`
117
+
118
+ Create global configuration directories for credentials and logs.
119
+
120
+ ```bash
121
+ iterare install
122
+ ```
123
+
124
+ ### `iterare credentials`
125
+
126
+ Fetch Claude Code credentials via an interactive Docker session. Launches a container where you can log in,
127
+ then extracts the credential files.
128
+
129
+ ```bash
130
+ iterare credentials # First-time setup
131
+ iterare credentials --force # Re-authenticate
132
+ iterare credentials --image my-image:latest # Use custom image
133
+ ```
134
+
135
+ ### `iterare execute <prompt>`
136
+
137
+ Execute a prompt in an isolated Docker container. Creates a git worktree, mounts it in a container, and launches
138
+ Claude Code in autonomous mode.
139
+
140
+ ```bash
141
+ # By prompt name (looks in .iterare/prompts/)
142
+ iterare execute refactor
143
+
144
+ # By file path
145
+ iterare execute .iterare/prompts/task.md
146
+
147
+ # Reuse an existing workspace
148
+ iterare execute refactor --reuse refactor-abc12345
149
+
150
+ # Pass environment variables to the container
151
+ iterare execute refactor --env PIP_INDEX_URL --env GITHUB_TOKEN
152
+ ```
153
+
154
+ ### `iterare interactive`
155
+
156
+ Launch an interactive Claude Code session in a container. By default runs in the project directory without
157
+ creating a worktree.
158
+
159
+ ```bash
160
+ # Default: run in project directory
161
+ iterare interactive
162
+
163
+ # Create a worktree for isolation
164
+ iterare interactive --worktree
165
+
166
+ # Name the workspace
167
+ iterare interactive --worktree --workspace my-feature
168
+
169
+ # Base on a specific branch
170
+ iterare interactive --worktree --branch main
171
+
172
+ # Reuse an existing workspace
173
+ iterare interactive --worktree --reuse my-feature-abc12345
174
+
175
+ # Pass environment variables
176
+ iterare interactive --env PIP_INDEX_URL
177
+ ```
178
+
179
+ ### `iterare log [RUN_NAME]`
180
+
181
+ View execution logs for a run.
182
+
183
+ ```bash
184
+ iterare log # Most recent run
185
+ iterare log refactor-abc12345 # Specific run
186
+ iterare log -f # Follow live output
187
+ iterare log --raw # Raw JSON output
188
+ iterare log -v 0 # Minimal (text responses only)
189
+ iterare log -v 2 # Verbose (all details)
190
+ ```
191
+
192
+ ### `iterare list`
193
+
194
+ List execution runs for the project.
195
+
196
+ ```bash
197
+ iterare list # Active and finished runs
198
+ iterare list --all # Include cleaned up runs
199
+ ```
200
+
201
+ ### `iterare merge [RUN_NAME]`
202
+
203
+ Merge a worktree branch back into the current branch.
204
+
205
+ ```bash
206
+ iterare merge # Merge most recent run
207
+ iterare merge refactor-abc12345 # Merge specific run
208
+ ```
209
+
210
+ ### `iterare cleanup [RUN_NAME]`
211
+
212
+ Remove the git worktree and branch for a run. Log files are preserved.
213
+
214
+ ```bash
215
+ iterare cleanup # Clean up most recent run
216
+ iterare cleanup -y # Skip confirmation
217
+ iterare cleanup refactor-abc12345 -y # Specific run
218
+ ```
219
+
220
+ ## Configuration
221
+
222
+ ### Project Structure
223
+
224
+ After running `iterare init`, your project will contain:
225
+
226
+ ```
227
+ .iterare/
228
+ ├── config.toml # Main configuration
229
+ ├── Dockerfile # Custom Docker image (optional)
230
+ └── prompts/ # Prompt files
231
+ └── example-prompt.md
232
+
233
+ workspaces/ # Git worktrees (gitignored)
234
+ ```
235
+
236
+ ### Config File (`.iterare/config.toml`)
237
+
238
+ ```toml
239
+ [docker]
240
+ image = "iterare-llm:latest"
241
+
242
+ [session]
243
+ shell = "/bin/bash"
244
+
245
+ [claude]
246
+ credentials_path = "~/.config/iterare"
247
+
248
+ [firewall]
249
+ # Additional domains to allow through the firewall.
250
+ # Default domains (Anthropic API, GitHub, npm) are always included.
251
+ allowed_domains = [
252
+ "pypi.org",
253
+ "files.pythonhosted.org",
254
+ ]
255
+ ```
256
+
257
+ ### Prompt Files
258
+
259
+ Prompts are markdown files with optional YAML frontmatter:
260
+
261
+ ```markdown
262
+ ---
263
+ workspace: my-feature
264
+ branch: main
265
+ ---
266
+
267
+ # Task Description
268
+
269
+ Implement feature X by doing Y and Z.
270
+ ```
271
+
272
+ Frontmatter fields:
273
+ - **workspace** -- Worktree directory name (defaults to prompt filename)
274
+ - **branch** -- Base branch for the worktree (defaults to current branch)
275
+
276
+ ### Environment Variables
277
+
278
+ Pass host environment variables to the container with `--env`:
279
+
280
+ ```bash
281
+ export PIP_INDEX_URL="https://pypi.company.internal/simple"
282
+ iterare execute install-deps --env PIP_INDEX_URL
283
+ ```
284
+
285
+ The flag accepts the variable *name* and reads the value from your shell. If a variable is not set,
286
+ execution fails with an error.
287
+
288
+ ### Network Security
289
+
290
+ The container runs behind a whitelist-based firewall using iptables:
291
+
292
+ - All outbound traffic is blocked by default
293
+ - Only whitelisted domains are allowed (resolved to IPs via DNS)
294
+ - Default whitelist includes `api.anthropic.com`, GitHub APIs, npm registry
295
+ - Additional domains are configured in `config.toml`
296
+
297
+ This prevents the autonomous agent from exfiltrating code or downloading malicious packages from unapproved sources.
298
+
299
+ ### Execution Flow
300
+
301
+ 1. Load configuration from `.iterare/config.toml`
302
+ 2. Parse prompt file (extract frontmatter metadata)
303
+ 3. Create git worktree on a new branch
304
+ 4. Write `.claude-auto-config.json` and `.claude-prompt.md` to worktree
305
+ 5. Launch Docker container with worktree mounted at `/workspace`
306
+ 6. Container initializes firewall, then runs Claude Code autonomously
307
+ 7. Monitor via `iterare log -f`
308
+ 8. Merge results with `iterare merge`, clean up with `iterare cleanup`
309
+
310
+ ## Development
311
+
312
+ ```bash
313
+ make sync # Install dependencies
314
+ make test # Run tests (289 tests)
315
+ make coverage # Run tests with coverage report (100% coverage)
316
+ make lint # Check code style
317
+ make format # Auto-format code
318
+ ```
319
+
320
+ ## Troubleshooting
321
+
322
+ ### Docker image not found
323
+
324
+ Build the images first:
325
+
326
+ ```bash
327
+ make build-base
328
+ make build
329
+ ```
330
+
331
+ ### Container already running
332
+
333
+ ```bash
334
+ docker stop it-<run-name>
335
+ docker rm it-<run-name>
336
+ ```
337
+
338
+ ### Credentials not found
339
+
340
+ Run the credentials command to authenticate:
341
+
342
+ ```bash
343
+ iterare credentials
344
+ ```
345
+
346
+ ### Network blocked in container
347
+
348
+ Add the required domain to your `config.toml`:
349
+
350
+ ```toml
351
+ [firewall]
352
+ allowed_domains = ["example.com"]
353
+ ```