Are we tiny?#
gptme is intended to be small and simple, and focus on doing the right thing in the right way, rather than all the things in all the ways.
The benefits of this approach are many:
It is easier to understand and maintain.
It is easier to contribute to.
It is easier to learn.
It is easier to extend.
It is more fun to work on.
Being aggressive about keeping things small and simple is a way to keep the project maintainable and fun to work on. The fastest way to kill a project is to make it too big and complex, and suffer burnout as a result.
Another major benefit of keeping things small and simple is that it makes it easier for AI to understand and work with the codebase. This is a major goal of the project, and it is important to keep in mind that the simpler the codebase is, the easier it will be for AI to work with it:
“The simpler your API is, the more effectively the AI can harness it when generating code.”
—Kenneth Reitz (and many others)
To that end, in this document we will present some statistics about the current state of the project, trying to be mindful to keep an eye on this page and make sure we are not growing too much.
Startup time#
$ make bench-importtime
...
266814 | gptme.commands
275030 | gptme.chat
291583 | gptme.cli
338953 | gptme
360142 | openai
real 0m1.439s
user 0m1.243s
sys 0m0.204s
make[2]: Leaving directory '/home/runner/work/gptme/gptme'
Lines of code#
LoC Core#
$ make cloc-core
make[2]: Entering directory '/home/runner/work/gptme/gptme'
cloc gptme/*.py gptme/tools/__init__.py gptme/tools/base.py --by-file
28 text files.
classified 28 files
28 unique files.
0 files ignored.
github.com/AlDanial/cloc v 1.90 T=0.03 s (831.7 files/s, 133750.8 lines/s)
----------------------------------------------------------------------------------------
File blank comment code
----------------------------------------------------------------------------------------
gptme/logmanager.py 70 55 290
gptme/chat.py 50 75 271
gptme/message.py 54 70 266
gptme/cli.py 50 41 260
gptme/ncurses.py 39 5 238
gptme/commands.py 18 18 204
gptme/llm.py 38 33 165
gptme/tools/base.py 44 59 139
gptme/prompts.py 53 77 136
gptme/llm_openai_models.py 3 9 130
gptme/models.py 24 10 118
gptme/llm_openai.py 22 14 112
gptme/config.py 32 13 107
gptme/tools/__init__.py 23 13 106
gptme/export.py 17 25 86
gptme/llm_anthropic.py 22 7 86
gptme/readline.py 31 24 83
gptme/init.py 21 16 82
gptme/reduce.py 24 32 73
gptme/codeblock.py 13 10 64
gptme/clipboard.py 8 2 35
gptme/dirs.py 15 6 22
gptme/useredit.py 12 13 21
gptme/interrupt.py 13 14 20
gptme/constants.py 4 12 14
gptme/__init__.py 1 0 8
gptme/__version__.py 2 0 7
gptme/__main__.py 1 0 3
----------------------------------------------------------------------------------------
SUM: 704 653 3146
----------------------------------------------------------------------------------------
make[2]: Leaving directory '/home/runner/work/gptme/gptme'
LoC Tools#
$ make cloc-tools
make[2]: Entering directory '/home/runner/work/gptme/gptme'
cloc gptme/tools/*.py --by-file
20 text files.
classified 20 files
20 unique files.
0 files ignored.
github.com/AlDanial/cloc v 1.90 T=0.03 s (797.5 files/s, 127596.7 lines/s)
-------------------------------------------------------------------------------------
File blank comment code
-------------------------------------------------------------------------------------
gptme/tools/shell.py 61 63 273
gptme/tools/_browser_playwright.py 58 28 165
gptme/tools/computer.py 53 84 155
gptme/tools/tmux.py 39 62 152
gptme/tools/patch.py 38 38 148
gptme/tools/base.py 44 59 139
gptme/tools/python.py 47 49 129
gptme/tools/_rag_context.py 49 26 115
gptme/tools/__init__.py 23 13 106
gptme/tools/subagent.py 37 27 99
gptme/tools/chats.py 32 36 94
gptme/tools/save.py 26 36 79
gptme/tools/browser.py 27 49 59
gptme/tools/rag.py 36 64 49
gptme/tools/_browser_lynx.py 9 13 30
gptme/tools/screenshot.py 11 8 28
gptme/tools/youtube.py 10 3 27
gptme/tools/gh.py 12 21 15
gptme/tools/vision.py 7 5 14
gptme/tools/read.py 3 8 10
-------------------------------------------------------------------------------------
SUM: 622 692 1886
-------------------------------------------------------------------------------------
make[2]: Leaving directory '/home/runner/work/gptme/gptme'
LoC Server#
$ make cloc-server
make[2]: Entering directory '/home/runner/work/gptme/gptme'
cloc gptme/server --by-file
8 text files.
classified 8 files
8 unique files.
0 files ignored.
github.com/AlDanial/cloc v 1.90 T=0.01 s (739.0 files/s, 109100.1 lines/s)
------------------------------------------------------------------------------------
File blank comment code
------------------------------------------------------------------------------------
gptme/server/static/main.js 35 45 316
gptme/server/api.py 53 35 177
gptme/server/static/index.html 11 15 148
gptme/server/static/style.css 27 4 143
gptme/server/static/computer.html 1 1 90
gptme/server/cli.py 8 5 55
gptme/server/__init__.py 2 3 3
gptme/server/__main__.py 1 0 3
------------------------------------------------------------------------------------
SUM: 138 108 935
------------------------------------------------------------------------------------
make[2]: Leaving directory '/home/runner/work/gptme/gptme'
LoC Tests#
$ make cloc-tests
make[2]: Entering directory '/home/runner/work/gptme/gptme'
cloc tests/*.py --by-file
21 text files.
classified 21 files
21 unique files.
0 files ignored.
github.com/AlDanial/cloc v 1.90 T=0.02 s (1127.7 files/s, 102191.4 lines/s)
------------------------------------------------------------------------------------------
File blank comment code
------------------------------------------------------------------------------------------
tests/test_cli.py 72 41 243
tests/test_tools_rag.py 83 57 221
tests/test_util_cli.py 32 23 94
tests/test_server.py 28 10 83
tests/test_shell.py 21 19 63
tests/test_tools_patch.py 31 87 48
tests/test_eval.py 8 9 47
tests/test_message.py 7 17 39
tests/test_reduce.py 10 2 39
tests/test_util.py 28 51 38
tests/test_codeblock.py 14 40 37
tests/test_readline.py 7 4 22
tests/test_tools_python.py 15 1 21
tests/test_logmanager.py 8 5 18
tests/test_prompts.py 8 1 16
tests/test_browser.py 9 10 13
tests/test_tools_chats.py 2 0 13
tests/test_tools_shell.py 9 11 13
tests/test_tools_subagent.py 7 10 11
tests/conftest.py 7 3 10
tests/test_config.py 2 0 5
------------------------------------------------------------------------------------------
SUM: 408 401 1094
------------------------------------------------------------------------------------------
make[2]: Leaving directory '/home/runner/work/gptme/gptme'
LoC Eval#
$ make cloc-eval
make[2]: Entering directory '/home/runner/work/gptme/gptme'
cloc gptme/eval/**.py --by-file
8 text files.
classified 8 files
8 unique files.
0 files ignored.
github.com/AlDanial/cloc v 1.90 T=0.01 s (645.8 files/s, 78549.9 lines/s)
-------------------------------------------------------------------------------------
File blank comment code
-------------------------------------------------------------------------------------
gptme/eval/main.py 52 18 302
gptme/eval/run.py 47 27 274
gptme/eval/execenv.py 10 14 55
gptme/eval/agents.py 12 5 52
gptme/eval/filestore.py 5 2 32
gptme/eval/types.py 13 12 32
gptme/eval/__init__.py 1 0 4
gptme/eval/__main__.py 1 0 3
-------------------------------------------------------------------------------------
SUM: 141 78 754
-------------------------------------------------------------------------------------
make[2]: Leaving directory '/home/runner/work/gptme/gptme'
LoC Total#
$ make cloc-total
make[2]: Entering directory '/home/runner/work/gptme/gptme'
cloc gptme/eval/main.py gptme/eval/suites/init_projects.py gptme/eval/suites/basic.py gptme/eval/suites/__init__.py gptme/eval/suites/browser.py gptme/eval/run.py gptme/eval/execenv.py gptme/eval/__init__.py gptme/eval/types.py gptme/eval/__main__.py gptme/eval/agents.py gptme/eval/filestore.py gptme/llm.py gptme/__version__.py gptme/llm_openai_models.py gptme/commands.py gptme/init.py gptme/chat.py gptme/export.py gptme/server/__init__.py gptme/server/api.py gptme/server/cli.py gptme/server/__main__.py gptme/readline.py gptme/ncurses.py gptme/constants.py gptme/message.py gptme/__init__.py gptme/tools/_browser_lynx.py gptme/tools/vision.py gptme/tools/patch.py gptme/tools/chats.py gptme/tools/save.py gptme/tools/python.py gptme/tools/_browser_playwright.py gptme/tools/shell.py gptme/tools/gh.py gptme/tools/youtube.py gptme/tools/__init__.py gptme/tools/subagent.py gptme/tools/tmux.py gptme/tools/screenshot.py gptme/tools/base.py gptme/tools/browser.py gptme/tools/read.py gptme/tools/_rag_context.py gptme/tools/computer.py gptme/tools/rag.py gptme/reduce.py gptme/dirs.py gptme/clipboard.py gptme/util/__init__.py gptme/util/cli.py gptme/models.py gptme/llm_openai.py gptme/codeblock.py gptme/cli.py gptme/logmanager.py gptme/__main__.py gptme/interrupt.py gptme/prompts.py gptme/config.py gptme/useredit.py gptme/llm_anthropic.py tests/test_readline.py tests/test_prompts.py tests/test_codeblock.py tests/test_browser.py tests/test_util_cli.py tests/conftest.py tests/test_tools_chats.py tests/test_cli.py tests/test_reduce.py tests/test_util.py tests/test_message.py tests/test_server.py tests/test_tools_shell.py tests/test_config.py tests/test_shell.py tests/test_logmanager.py tests/test_tools_rag.py tests/test_tools_python.py tests/test_eval.py tests/test_tools_subagent.py tests/test_tools_patch.py scripts/list_user_messages.py scripts/describe_api.py scripts/summarize_project.py scripts/gpt_todoer.py scripts/train/collect.py scripts/shorten_details.py scripts/treeofthoughts.py --by-file
92 text files.
classified 92 files
92 unique files.
0 files ignored.
github.com/AlDanial/cloc v 1.90 T=0.08 s (1117.4 files/s, 147407.8 lines/s)
-------------------------------------------------------------------------------------
File blank comment code
-------------------------------------------------------------------------------------
gptme/eval/main.py 52 18 302
gptme/logmanager.py 70 55 290
gptme/util/__init__.py 66 29 290
gptme/eval/run.py 47 27 274
gptme/tools/shell.py 61 63 273
gptme/chat.py 50 75 271
gptme/message.py 54 70 266
gptme/cli.py 50 41 260
tests/test_cli.py 72 41 243
gptme/ncurses.py 39 5 238
tests/test_tools_rag.py 83 57 221
gptme/commands.py 18 18 204
gptme/server/api.py 53 35 177
gptme/llm.py 38 33 165
gptme/tools/_browser_playwright.py 58 28 165
gptme/tools/computer.py 53 84 155
gptme/tools/tmux.py 39 62 152
gptme/tools/patch.py 38 38 148
gptme/tools/base.py 44 59 139
gptme/prompts.py 53 77 136
scripts/treeofthoughts.py 46 44 131
gptme/llm_openai_models.py 3 9 130
gptme/tools/python.py 47 49 129
gptme/util/cli.py 42 25 119
gptme/models.py 24 10 118
gptme/tools/_rag_context.py 49 26 115
gptme/llm_openai.py 22 14 112
gptme/config.py 32 13 107
scripts/gpt_todoer.py 47 25 107
gptme/tools/__init__.py 23 13 106
scripts/train/collect.py 34 52 103
gptme/tools/subagent.py 37 27 99
gptme/tools/chats.py 32 36 94
tests/test_util_cli.py 32 23 94
gptme/export.py 17 25 86
gptme/llm_anthropic.py 22 7 86
gptme/readline.py 31 24 83
tests/test_server.py 28 10 83
gptme/init.py 21 16 82
gptme/tools/save.py 26 36 79
gptme/reduce.py 24 32 73
gptme/codeblock.py 13 10 64
tests/test_shell.py 21 19 63
gptme/tools/browser.py 27 49 59
gptme/eval/execenv.py 10 14 55
gptme/eval/suites/basic.py 15 1 55
gptme/eval/suites/init_projects.py 21 1 55
gptme/server/cli.py 8 5 55
scripts/describe_api.py 28 25 54
gptme/eval/agents.py 12 5 52
gptme/tools/rag.py 36 64 49
tests/test_tools_patch.py 31 87 48
tests/test_eval.py 8 9 47
tests/test_message.py 7 17 39
tests/test_reduce.py 10 2 39
tests/test_util.py 28 51 38
tests/test_codeblock.py 14 40 37
gptme/clipboard.py 8 2 35
scripts/shorten_details.py 11 6 33
gptme/eval/filestore.py 5 2 32
gptme/eval/types.py 13 12 32
scripts/list_user_messages.py 10 9 32
gptme/tools/_browser_lynx.py 9 13 30
gptme/tools/screenshot.py 11 8 28
gptme/tools/youtube.py 10 3 27
scripts/summarize_project.py 11 1 26
gptme/dirs.py 15 6 22
tests/test_readline.py 7 4 22
gptme/useredit.py 12 13 21
tests/test_tools_python.py 15 1 21
gptme/interrupt.py 13 14 20
gptme/eval/suites/__init__.py 3 0 19
tests/test_logmanager.py 8 5 18
gptme/eval/suites/browser.py 5 0 16
tests/test_prompts.py 8 1 16
gptme/tools/gh.py 12 21 15
gptme/constants.py 4 12 14
gptme/tools/vision.py 7 5 14
tests/test_browser.py 9 10 13
tests/test_tools_chats.py 2 0 13
tests/test_tools_shell.py 9 11 13
tests/test_tools_subagent.py 7 10 11
gptme/tools/read.py 3 8 10
tests/conftest.py 7 3 10
gptme/__init__.py 1 0 8
gptme/__version__.py 2 0 7
tests/test_config.py 2 0 5
gptme/eval/__init__.py 1 0 4
gptme/__main__.py 1 0 3
gptme/eval/__main__.py 1 0 3
gptme/server/__init__.py 2 3 3
gptme/server/__main__.py 1 0 3
-------------------------------------------------------------------------------------
SUM: 2211 2013 7913
-------------------------------------------------------------------------------------
make[2]: Leaving directory '/home/runner/work/gptme/gptme'