Repository navigation
The Optimizer
python iamnotacoder.py --files src/module.py --repo https://github.com/user/repo --branch main --token $GITHUB_TOKENTaken from the @click.option declarations in iamnotacoder.py, which is the authority when this disagrees with the README.
| Flag | Short | Default | Meaning |
|---|---|---|---|
--files |
-f |
none | The only required option. Comma-separated paths to improve |
--repo |
-r |
none | Repository URL |
--branch |
-b |
none | Target branch |
--token |
-t |
none | GitHub PAT with the repo scope |
--config |
none | none | Path to a TOML config. No short flag, see gotchas |
--tools |
-T |
black,isort,pylint,flake8,mypy |
Static analysis tools to run |
--exclude-tools |
-e |
empty | Tools to skip even if listed above |
--llm-model |
-m |
qwen2.5-coder-14b-instruct-mlx |
Model name |
--llm-temperature |
none | 0.2 |
Higher is more random |
--llm-custom-prompt |
-p |
. |
Directory holding prompt_<category>.txt files |
--llm-optimization-level |
-l |
balanced |
fast, balanced, thorough
|
--min-coverage |
-c |
none | Minimum coverage percentage. -c is this, not --config
|
--categories |
-C |
style,maintenance,security,performance |
Which improvements to apply |
--test-framework |
-F |
pytest |
Only pytest today |
--output-file |
-o |
overwrite | Where to write the improved file |
--output-info |
none | report.txt |
Text report path |
--openai-api-base |
none | none | Base URL for a local LLM |
--fork-repo |
flag | off | Fork first, work on the fork |
--fork-user |
none | inferred | Your username, when it cannot be inferred |
--dry-run |
flag | off | Do everything, change nothing |
--local-commit |
flag | off | Commit locally, no pull request |
--no-dynamic-analysis |
flag | off | Skip test generation and execution |
--force-push |
flag | off | Force-push the branch if it exists |
--line-length |
none | 79 |
Formatting width |
--debug |
flag | off | Verbose logs, and keeps the temporary directory |
--verbose |
flag | off | Show detailed static analysis errors |
--no-output |
flag | off | Suppress most console output |
Note that only --files is enforced as required, even though the README lists four. That is deliberate in effect: without --repo you are working locally, and the GitHub steps are skipped.
- Shallow-clones the repository into a temporary directory
- Creates a branch with a generated name
- Runs the selected static analysis tools, caching results when
cache_diris set - Generates tests with the LLM, unless
--no-dynamic-analysis, and fixes syntax errors in what it generated - Runs the tests, and checks coverage if
--min-coverageis set - Asks the LLM to improve the code, one pass per category, guided by the prompt files
- Checks whether anything actually changed
- Commits, including generated tests
- Pushes the branch, to your fork when
--fork-repois used - Opens a pull request
- Writes a text report and a JSON log
- Removes the temporary directory, unless
--debug
Steps 8 to 10 are the ones --dry-run and --local-commit cut off.
export OPENAI_API_KEY=none
export OPENAI_API_BASE=http://localhost:1234/v1
python3 iamnotacoder.py --repo https://github.com/user/repo --files script.py \
-b main -t $GITHUB_TOKEN --config config.toml --fork-repoAny OpenAI-compatible server works, LM Studio being the one the defaults assume. With a local model, openai_api_key = "none" is the expected value rather than a placeholder to replace.
Each run writes a text report (report.txt by default) and a JSON log: which tools ran, what they found, what the LLM changed, and how the tests went. When a pull request looks wrong, the JSON log is where you find out which stage produced it.