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-import
make[2]: Entering directory '/home/runner/work/gptme/gptme'
Benchmarking import time for gptme
time poetry run python -X importtime -m gptme --model openai --non-interactive 2>&1 | grep "import time" | cut -d'|' -f 2- | sort -n | tail -n 10
     259720 |       mcp.types
     262155 |     gptme.tools.mcp_adapter
     328364 |             openai.types
     398965 |           openai
     420032 |   gptme.cli.main
     473363 |         gptme.llm.llm_openai
     754431 |       gptme.llm
     756525 |     gptme.commands
     863750 |   gptme.chat
    1341580 | gptme

real	0m2.226s
user	0m1.819s
sys	0m0.289s
make[2]: Leaving directory '/home/runner/work/gptme/gptme'
$ make bench-startup
make[2]: Entering directory '/home/runner/work/gptme/gptme'
Benchmarking startup time for gptme
hyperfine "poetry run gptme '/exit'" -M 5 || poetry run gptme '/exit' || exit 1
Benchmark 1: poetry run gptme '/exit'
  Time (mean ± σ):      2.139 s ±  0.042 s    [User: 1.912 s, System: 0.222 s]
  Range (min … max):    2.096 s …  2.202 s    5 runs
 
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/llm/*.py gptme/util/*.py gptme/tools/base.py gptme/tools/__init__.py gptme/hooks/__init__.py gptme/plugins/__init__.py gptme/lessons/*.py --by-file --hide-rate --quiet | tail -n +2
----------------------------------------------------------------------------------------
File                                                 blank        comment           code
----------------------------------------------------------------------------------------
gptme/llm/llm_openai.py                                203            197            826
gptme/config.py                                        206            201            755
gptme/llm/models.py                                    122            126            700
gptme/llm/llm_anthropic.py                             147            163            656
gptme/hooks/__init__.py                                160            201            544
gptme/prompts.py                                       157            202            531
gptme/logmanager.py                                    132            158            518
gptme/tools/base.py                                    131            141            510
gptme/util/context.py                                  115            170            435
gptme/chat.py                                           69             95            378
gptme/util/_telemetry.py                               106            123            360
gptme/telemetry.py                                      85             54            342
gptme/util/prompt.py                                    83            114            337
gptme/llm/__init__.py                                   76             74            307
gptme/util/gh.py                                        66             86            305
gptme/message.py                                        66             90            304
gptme/plugins/__init__.py                               83            116            248
gptme/tools/__init__.py                                 67             51            227
gptme/lessons/commands.py                               91             48            213
gptme/util/_sound_sounddevice.py                        52             52            208
gptme/lessons/index.py                                  90            126            205
gptme/util/sound.py                                     65             72            200
gptme/util/auto_naming.py                               59             70            199
gptme/lessons/parser.py                                 70            108            192
gptme/llm/validate.py                                   29             27            173
gptme/llm/llm_openai_models.py                           2             11            169
gptme/codeblock.py                                      37             92            168
gptme/llm/utils.py                                      54             73            153
gptme/util/cost_display.py                              39             31            145
gptme/util/__init__.py                                  31             22            140
gptme/lessons/hybrid_matcher.py                         53             79            132
gptme/util/cost_tracker.py                              44             62            112
gptme/init.py                                           24             28            102
gptme/lessons/matcher.py                                35             47            102
gptme/util/tree.py                                      21             13             91
gptme/lessons/matcher_enhanced.py                       26             40             88
gptme/util/ask_execute.py                               25             40             88
gptme/util/export.py                                    17             25             86
gptme/dirs.py                                           33             23             83
gptme/lessons/auto_include.py                           31             26             79
gptme/util/reduce.py                                    24             35             76
gptme/util/generate_name.py                              5              6             69
gptme/util/master_context.py                            28             38             66
gptme/session.py                                        39             63             65
gptme/__version__.py                                    15             11             64
gptme/util/_sound_cmd.py                                22             17             64
gptme/util/uri.py                                       29             42             59
gptme/util/output_storage.py                            26             36             58
gptme/util/tokens.py                                    22             16             44
gptme/util/cost.py                                      12             20             43
gptme/lessons/selector_config.py                        18             20             40
gptme/util/file_storage.py                              30             47             40
gptme/lessons/selector_integration.py                   12             11             39
gptme/util/keyword_matching.py                          35             66             39
gptme/util/clipboard.py                                  8              2             35
gptme/util/terminal.py                                  23             21             34
gptme/util/install.py                                   13             24             31
gptme/util/content.py                                   18             24             29
gptme/constants.py                                      17             19             25
gptme/executor.py                                       17             26             24
gptme/lessons/__init__.py                                7             15             24
gptme/util/useredit.py                                  12             13             21
gptme/util/interrupt.py                                 13             18             20
gptme/__init__.py                                        1              1              9
gptme/__main__.py                                        1              0              3
----------------------------------------------------------------------------------------
SUM:                                                  3449           4068          12432
----------------------------------------------------------------------------------------
make[2]: Leaving directory '/home/runner/work/gptme/gptme'

LoC LLM#

$ make cloc-llm
make[2]: Entering directory '/home/runner/work/gptme/gptme'
cloc gptme/llm/*.py --by-file --hide-rate --quiet | tail -n +2
---------------------------------------------------------------------------------
File                                          blank        comment           code
---------------------------------------------------------------------------------
gptme/llm/llm_openai.py                         203            197            826
gptme/llm/models.py                             122            126            700
gptme/llm/llm_anthropic.py                      147            163            656
gptme/llm/__init__.py                            76             74            307
gptme/llm/validate.py                            29             27            173
gptme/llm/llm_openai_models.py                    2             11            169
gptme/llm/utils.py                               54             73            153
---------------------------------------------------------------------------------
SUM:                                            633            671           2984
---------------------------------------------------------------------------------
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 gptme/hooks/*.py gptme/plugins/*.py --by-file --hide-rate --quiet | tail -n +2
-------------------------------------------------------------------------------------
File                                              blank        comment           code
-------------------------------------------------------------------------------------
gptme/tools/shell.py                                286            359           1159
gptme/tools/autocompact.py                          210            297            707
gptme/tools/subagent.py                             182            371            587
gptme/hooks/__init__.py                             160            201            544
gptme/tools/base.py                                 131            141            510
gptme/tools/mcp_adapter.py                          160            164            505
gptme/tools/computer.py                             151            219            437
gptme/tools/gh.py                                    85             93            348
gptme/tools/tmux.py                                  95            159            330
gptme/tools/mcp.py                                   99            102            310
gptme/tools/_browser_playwright.py                   87             33            287
gptme/tools/tts.py                                  119            132            284
gptme/tools/browser.py                              108            163            280
gptme/tools/patch.py                                 62             89            259
gptme/tools/save.py                                  56             56            252
gptme/plugins/__init__.py                            83            116            248
gptme/tools/lessons.py                               92            105            243
gptme/tools/todo.py                                  95             97            236
gptme/tools/__init__.py                              67             51            227
gptme/tools/precommit.py                             64             87            189
gptme/tools/morph.py                                 43             42            174
gptme/tools/python.py                                56             50            171
gptme/tools/restart.py                               51             81            171
gptme/tools/_browser_thread.py                       27             12            157
gptme/tools/form.py                                  38             43            145
gptme/tools/rag.py                                   62             74            145
gptme/tools/chats.py                                 43             49            142
gptme/hooks/token_awareness.py                       44             51            141
gptme/hooks/cli_confirm.py                           40             37            135
gptme/hooks/cost_awareness.py                        45             56            133
gptme/hooks/cache_awareness.py                       95            138            128
gptme/hooks/form_autodetect.py                       48             65            126
gptme/hooks/server_confirm.py                        51             58            122
gptme/tools/complete.py                              34             42            115
gptme/hooks/confirm.py                               54             88            114
gptme/tools/choice.py                                31             25            105
gptme/tools/parallel.py                              29             37             86
gptme/tools/_browser_perplexity.py                   25             22             85
gptme/hooks/time_awareness.py                        29             31             83
gptme/tools/autocommit.py                            37             59             75
gptme/hooks/active_context.py                        21             22             61
gptme/tools/screenshot.py                            22             28             59
gptme/tools/vision.py                                20             13             57
gptme/hooks/cwd_tracking.py                          18             25             51
gptme/hooks/markdown_validation.py                   36             41             51
gptme/tools/_browser_lynx.py                         13             18             40
gptme/hooks/test.py                                  12              5             33
gptme/tools/youtube.py                               10              1             26
gptme/hooks/auto_confirm.py                          11              9             24
gptme/tools/read.py                                   6              8             13
-------------------------------------------------------------------------------------
SUM:                                               3443           4265          10910
-------------------------------------------------------------------------------------
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 --hide-rate --quiet | tail -n +2
------------------------------------------------------------------------------------
File                                             blank        comment           code
------------------------------------------------------------------------------------
gptme/server/api_v2_sessions.py                    162            167            685
gptme/server/tasks_api.py                          171            110            597
gptme/server/openapi_docs.py                       180            141            462
gptme/server/api_v2.py                             101             65            436
gptme/server/api.py                                 98            100            398
gptme/server/static/main.js                         35             45            316
gptme/server/workspace_api.py                       57             55            173
gptme/server/static/index.html                      11             15            148
gptme/server/static/style.css                       27              4            143
gptme/server/cli.py                                 26             17            139
gptme/server/client.py                              60             78            139
gptme/server/auth.py                                45             69            121
gptme/server/api_v2_agents.py                       24             15             90
gptme/server/static/computer.html                    1              1             90
gptme/server/api_v2_common.py                       49             24             74
gptme/server/__init__.py                             2              3              3
gptme/server/__main__.py                             1              0              3
gptme/server/exceptions.py                           5              8              2
gptme/server/constants.py                            1              3              1
------------------------------------------------------------------------------------
SUM:                                              1056            920           4020
------------------------------------------------------------------------------------
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 --by-file --hide-rate --quiet | tail -n +2
-----------------------------------------------------------------------------------------------
File                                                        blank        comment           code
-----------------------------------------------------------------------------------------------
tests/test_llm_openai.py                                      223            125            810
tests/test_tools_shell.py                                     235            375            680
tests/test_agent.py                                           179             90            562
tests/test_util_gh_mocked.py                                  106             92            534
tests/test_config.py                                          143            267            516
tests/test_tools_subagent.py                                  197            115            515
tests/test_auto_compact.py                                    205            180            434
tests/test_lessons_commands.py                                157             82            422
tests/context/test_task_analyzer.py                           119             58            389
tests/test_util_cli_mcp.py                                     89             45            380
tests/test_llm_anthropic.py                                    64             26            348
tests/test_codeblock.py                                       225            538            342
tests/test_lessons_parser.py                                  152            176            338
tests/test_integration_phase4.py                               66             54            331
tests/test_mcp_discovery.py                                    97             39            315
tests/test_cli.py                                              84             60            305
tests/test_lessons_matcher.py                                  89             80            288
tests/lessons/test_wildcard_matching.py                       114            125            287
tests/test_lessons_index.py                                    96             77            280
tests/test_context_selector.py                                 83             45            254
tests/test_lessons_integration.py                              97             66            252
tests/conftest.py                                              79             70            250
tests/test_complete.py                                         56             40            241
tests/test_hooks.py                                           114             46            232
tests/test_server_v2.py                                        69             34            229
tests/test_doctor.py                                           82             55            226
tests/test_lessons_tool.py                                     62             34            212
tests/test_mcp.py                                              58             45            207
tests/test_message.py                                          83             86            204
tests/test_plugins.py                                          82             70            203
tests/test_mcp_adapter.py                                      64             37            189
tests/test_auto_naming.py                                      54             41            186
tests/test_execenv.py                                          52             42            185
tests/test_dspy_hybrid.py                                      65             45            179
tests/test_server_v2_hooks.py                                  71             52            175
tests/test_context.py                                          80             55            168
tests/test_tools_todo.py                                       75             61            162
tests/test_tools_patch.py                                      85            203            156
tests/test_tools_time_awareness.py                             52             34            155
tests/test_uri.py                                              54             30            155
tests/test_cost_tracker.py                                     21             24            154
tests/test_master_context.py                                   39             24            147
tests/test_file_selector_integration.py                        50             23            145
tests/test_tree.py                                             54             29            142
tests/test_tool_use.py                                         12             19            140
tests/test_dspy_integration.py                                 54             32            139
tests/test_tools_tmux.py                                       64             60            139
tests/test_lesson_selector_integration.py                      45             25            138
tests/test_dspy_basic.py                                       49             31            132
tests/benchmark_context_selector.py                            32             26            130
tests/test_tools_token_awareness.py                            59             47            126
tests/test_server.py                                           42             27            122
tests/test_prompt.py                                           36             36            120
tests/test_lessons_status.py                                   67             96            113
tests/test_tools_save.py                                       29             23            113
tests/test_cost_awareness_delayed_warning.py                   42             32            108
tests/test_server_v2_tool_confirmation.py                      32             32            107
tests/test_util_cli.py                                         35             28            105
tests/test_tools_tts.py                                        50             58            101
tests/test_session.py                                          40             21             93
tests/test_llm_models.py                                       34             26             92
tests/test_tools_computer.py                                   36             27             91
tests/test_llm_validate.py                                     25             19             90
tests/test_parallel.py                                         27             17             89
tests/test_util_gh.py                                          39             28             89
tests/test_prompts.py                                          37             35             87
tests/test_server_v2_auto_stepping.py                          20             22             87
tests/test_browser.py                                          40             35             85
tests/test_server_auth.py                                      40             19             84
tests/context/test_adaptive_compressor.py                      35             23             80
tests/test_prompt_tools.py                                      5              4             77
tests/test_tools.py                                            45              6             76
tests/test_markdown_validation.py                              43             34             75
tests/test_shell_issue729.py                                   50             52             75
tests/test_shell_issue772.py                                   48             47             73
tests/test_command_completion.py                               23             14             71
tests/test_hooks_form_autodetect.py                            22             34             68
tests/test_tools_form.py                                       22             19             67
tests/test_shell_output_mixing_issue408.py                     25             29             60
tests/test_server_client.py                                    33             26             59
tests/test_chat_history.py                                     14             12             56
tests/test_server_v2_sse.py                                    15             13             50
tests/test_custom_providers.py                                 23             32             49
tests/test_eval.py                                              9              9             49
tests/test-integration.sh                                      22             36             43
tests/test_pdf_to_images.py                                    13             13             43
tests/test_onboard.py                                          11             10             41
tests/test_dspy_gepa.py                                        18              9             39
tests/test_prompt_skills_summary.py                            24             22             39
tests/test_reduce.py                                           11              2             39
tests/test_tools_python.py                                     28              3             38
tests/test_utils.py                                            14             17             38
tests/test_util.py                                             28             51             37
tests/test_message_command.py                                  13             12             35
tests/test_tools_rag.py                                        15              8             34
tests/test_hybrid_lessons.py                                   14              8             33
tests/test_shell_for_loop_issue724.py                          16             24             33
tests/test_chat.py                                             16             28             28
tests/test_telemetry.py                                        20             15             28
tests/test_xml_format.py                                       10             31             27
tests/test_chat_config.py                                       8              7             26
tests/data/example-patch-codeblock.txt                          4              0             25
tests/data/example-interrupted.txt                              8              0             24
tests/test_tool_loading_duplicate.py                           16             15             24
tests/test_tools_shell_multiline.py                             7             19             19
tests/test_logmanager.py                                        8              5             18
tests/test_screenshot.py                                        9              6             15
tests/test_tools_chats.py                                       2              0             15
tests/test_browser_lynx.py                                      7              4             12
-----------------------------------------------------------------------------------------------
SUM:                                                         6061           5415          17342
-----------------------------------------------------------------------------------------------
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 --hide-rate --quiet | tail -n +2
-------------------------------------------------------------------------------------
File                                   blank        comment           code
-------------------------------------------------------------------------------------
gptme/eval/main.py                        72             45            461
gptme/eval/execenv.py                     54             96            351
gptme/eval/run.py                         58             51            350
gptme/eval/agents.py                      22             11            121
gptme/eval/filestore.py                   11              8             63
gptme/eval/types.py                       15             12             40
gptme/eval/cost.py                        12             24              6
gptme/eval/__init__.py                     1              0              4
gptme/eval/__main__.py                     1              0              3
-------------------------------------------------------------------------------------
SUM:                                     246            247           1399
-------------------------------------------------------------------------------------
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/mcp/__init__.py gptme/mcp/client.py gptme/mcp/registry.py gptme/context/task_analyzer.py gptme/context/__init__.py gptme/context/adaptive_compressor.py gptme/context/config.py gptme/context/selector/base.py gptme/context/selector/__init__.py gptme/context/selector/llm_based.py gptme/context/selector/file_selector.py gptme/context/selector/config.py gptme/context/selector/file_config.py gptme/context/selector/file_integration.py gptme/context/selector/rule_based.py gptme/context/selector/hybrid.py gptme/context/compress.py gptme/prompts.py gptme/eval/agents.py gptme/eval/dspy/experiments.py gptme/eval/dspy/tasks.py gptme/eval/dspy/metrics.py gptme/eval/dspy/__init__.py gptme/eval/dspy/cli.py gptme/eval/dspy/prompt_optimizer.py gptme/eval/dspy/signatures.py gptme/eval/dspy/hybrid_optimizer.py gptme/eval/dspy/__main__.py gptme/eval/main.py gptme/eval/__init__.py gptme/eval/filestore.py gptme/eval/types.py gptme/eval/suites/browser.py gptme/eval/suites/init_projects.py gptme/eval/suites/basic.py gptme/eval/suites/__init__.py gptme/eval/cost.py gptme/eval/execenv.py gptme/eval/run.py gptme/eval/__main__.py gptme/cli/wut.py gptme/cli/main.py gptme/cli/doctor.py gptme/cli/setup.py gptme/cli/onboard.py gptme/cli/__init__.py gptme/cli/util.py gptme/agent/service.py gptme/agent/__init__.py gptme/agent/cli.py gptme/agent/workspace.py gptme/telemetry.py gptme/commands/export.py gptme/commands/base.py gptme/commands/__init__.py gptme/commands/llm.py gptme/commands/session.py gptme/commands/meta.py gptme/logmanager.py gptme/acp/__init__.py gptme/acp/adapter.py gptme/acp/types.py gptme/acp/agent.py gptme/acp/__main__.py gptme/__init__.py gptme/init.py gptme/config.py gptme/server/api_v2_sessions.py gptme/server/workspace_api.py gptme/server/api.py gptme/server/__init__.py gptme/server/cli.py gptme/server/api_v2_common.py gptme/server/client.py gptme/server/tasks_api.py gptme/server/exceptions.py gptme/server/auth.py gptme/server/openapi_docs.py gptme/server/constants.py gptme/server/api_v2.py gptme/server/__main__.py gptme/server/api_v2_agents.py gptme/lessons/auto_include.py gptme/lessons/index.py gptme/lessons/parser.py gptme/lessons/__init__.py gptme/lessons/matcher.py gptme/lessons/skills/python-repl/python_helpers.py gptme/lessons/commands.py gptme/lessons/hybrid_matcher.py gptme/lessons/selector_config.py gptme/lessons/matcher_enhanced.py gptme/lessons/selector_integration.py gptme/message.py gptme/codeblock.py gptme/__version__.py gptme/session.py gptme/llm/llm_anthropic.py gptme/llm/models.py gptme/llm/llm_openai_models.py gptme/llm/utils.py gptme/llm/__init__.py gptme/llm/validate.py gptme/llm/llm_openai.py gptme/hooks/auto_confirm.py gptme/hooks/test.py gptme/hooks/time_awareness.py gptme/hooks/tests/test_confirm.py gptme/hooks/tests/test_cache_awareness.py gptme/hooks/token_awareness.py gptme/hooks/cli_confirm.py gptme/hooks/markdown_validation.py gptme/hooks/__init__.py gptme/hooks/cwd_tracking.py gptme/hooks/active_context.py gptme/hooks/cost_awareness.py gptme/hooks/form_autodetect.py gptme/hooks/cache_awareness.py gptme/hooks/server_confirm.py gptme/hooks/confirm.py gptme/plugins/__init__.py gptme/constants.py gptme/executor.py gptme/dirs.py gptme/chat.py gptme/util/useredit.py gptme/util/export.py gptme/util/tree.py gptme/util/auto_naming.py gptme/util/uri.py gptme/util/content.py gptme/util/file_storage.py gptme/util/install.py gptme/util/generate_name.py gptme/util/_telemetry.py gptme/util/cost_display.py gptme/util/terminal.py gptme/util/gh.py gptme/util/reduce.py gptme/util/tokens.py gptme/util/_sound_sounddevice.py gptme/util/cost_tracker.py gptme/util/__init__.py gptme/util/keyword_matching.py gptme/util/ask_execute.py gptme/util/context.py gptme/util/cost.py gptme/util/prompt.py gptme/util/sound.py gptme/util/interrupt.py gptme/util/clipboard.py gptme/util/master_context.py gptme/util/_sound_cmd.py gptme/util/output_storage.py gptme/__main__.py gptme/tools/lessons.py gptme/tools/patch.py gptme/tools/_browser_lynx.py gptme/tools/chats.py gptme/tools/_browser_perplexity.py gptme/tools/browser.py gptme/tools/rag.py gptme/tools/shell.py gptme/tools/autocommit.py gptme/tools/base.py gptme/tools/_browser_playwright.py gptme/tools/todo.py gptme/tools/complete.py gptme/tools/tts.py gptme/tools/python.py gptme/tools/gh.py gptme/tools/subagent.py gptme/tools/youtube.py gptme/tools/__init__.py gptme/tools/tmux.py gptme/tools/mcp_adapter.py gptme/tools/restart.py gptme/tools/morph.py gptme/tools/save.py gptme/tools/read.py gptme/tools/parallel.py gptme/tools/precommit.py gptme/tools/_browser_thread.py gptme/tools/vision.py gptme/tools/screenshot.py gptme/tools/computer.py gptme/tools/form.py gptme/tools/autocompact.py gptme/tools/choice.py gptme/tools/mcp.py tests/test_tools_form.py tests/test_lesson_selector_integration.py tests/test_lessons_tool.py tests/test_telemetry.py tests/test_prompt.py tests/test_server_v2_sse.py tests/test_llm_validate.py tests/context/test_adaptive_compressor.py tests/context/test_task_analyzer.py tests/test_master_context.py tests/test_agent.py tests/test_server_v2_auto_stepping.py tests/test_xml_format.py tests/test_cost_awareness_delayed_warning.py tests/test_util_gh_mocked.py tests/test_logmanager.py tests/test_session.py tests/test_dspy_integration.py tests/test_tree.py tests/test_lessons_integration.py tests/benchmark_context_selector.py tests/test_pdf_to_images.py tests/test_tools_tts.py tests/test_server_client.py tests/test_tools_time_awareness.py tests/test_prompt_tools.py tests/test_chat_history.py tests/test_server_auth.py tests/test_tool_use.py tests/test_reduce.py tests/test_tools_todo.py tests/test_context_selector.py tests/test_mcp.py tests/test_shell_issue772.py tests/test_tools_tmux.py tests/test_message.py tests/test_complete.py tests/test_utils.py tests/test_lessons_commands.py tests/conftest.py tests/test_browser.py tests/test_message_command.py tests/test_chat_config.py tests/test_tools_shell.py tests/test_codeblock.py tests/test_auto_compact.py tests/test_llm_openai.py tests/test_server_v2_tool_confirmation.py tests/test_lessons_status.py tests/test_shell_issue729.py tests/test_tools_patch.py tests/test_hybrid_lessons.py tests/test_tool_loading_duplicate.py tests/test_uri.py tests/test_onboard.py tests/test_tools_rag.py tests/test_cli.py tests/test_lessons_index.py tests/test_context.py tests/test_hooks.py tests/test_mcp_adapter.py tests/test_custom_providers.py tests/test_execenv.py tests/test_plugins.py tests/test_llm_models.py tests/lessons/test_wildcard_matching.py tests/test_llm_anthropic.py tests/test_tools_computer.py tests/test_dspy_hybrid.py tests/test_prompt_skills_summary.py tests/test_prompts.py tests/test_eval.py tests/test_command_completion.py tests/test_config.py tests/test_dspy_basic.py tests/test_chat.py tests/test_util.py tests/test_util_cli_mcp.py tests/test_parallel.py tests/test_lessons_parser.py tests/test_browser_lynx.py tests/test_server.py tests/test_server_v2_hooks.py tests/test_doctor.py tests/test_markdown_validation.py tests/test_tools_python.py tests/test_hooks_form_autodetect.py tests/test_tools_subagent.py tests/test_dspy_gepa.py tests/test_mcp_discovery.py tests/test_lessons_matcher.py tests/test_tools_token_awareness.py tests/test_shell_for_loop_issue724.py tests/test_tools_save.py tests/test_tools_shell_multiline.py tests/test_tools.py tests/test_util_cli.py tests/test_integration_phase4.py tests/test_file_selector_integration.py tests/test_tools_chats.py tests/test_shell_output_mixing_issue408.py tests/test_screenshot.py tests/test_auto_naming.py tests/test_util_gh.py tests/test_cost_tracker.py tests/test_server_v2.py scripts/convert_convo.py scripts/analyze_compression.py scripts/check_rst_formatting.py scripts/list_user_messages.py scripts/treeofthoughts.py scripts/github_bot.py scripts/gh-pr-view-with-pr-comments.py scripts/reduce_context.py scripts/gpt_todoer.py scripts/auto_rename_logs.py scripts/shorten_details.py scripts/describe_api.py scripts/train/collect.py scripts/summarize_project.py  --by-file --hide-rate --quiet | tail -n +2
-----------------------------------------------------------------------------------------------------
File                                                              blank        comment           code
-----------------------------------------------------------------------------------------------------
gptme/tools/shell.py                                                286            359           1159
gptme/llm/llm_openai.py                                             203            197            826
tests/test_llm_openai.py                                            223            125            810
gptme/config.py                                                     206            201            755
gptme/tools/autocompact.py                                          210            297            707
gptme/llm/models.py                                                 122            126            700
gptme/server/api_v2_sessions.py                                     162            167            685
tests/test_tools_shell.py                                           235            375            680
gptme/llm/llm_anthropic.py                                          147            163            656
gptme/eval/dspy/tasks.py                                            170            374            639
gptme/server/tasks_api.py                                           171            110            597
gptme/tools/subagent.py                                             182            371            587
tests/test_agent.py                                                 179             90            562
gptme/cli/main.py                                                    87             79            561
gptme/hooks/__init__.py                                             160            201            544
tests/test_util_gh_mocked.py                                        106             92            534
gptme/prompts.py                                                    157            202            531
gptme/logmanager.py                                                 132            158            518
tests/test_config.py                                                143            267            516
tests/test_tools_subagent.py                                        197            115            515
gptme/tools/base.py                                                 131            141            510
gptme/tools/mcp_adapter.py                                          160            164            505
gptme/cli/util.py                                                   142             73            498
gptme/cli/setup.py                                                  113             59            478
gptme/server/openapi_docs.py                                        180            141            462
gptme/eval/main.py                                                   72             45            461
scripts/analyze_compression.py                                      103             68            446
gptme/tools/computer.py                                             151            219            437
gptme/server/api_v2.py                                              101             65            436
gptme/util/context.py                                               115            170            435
tests/test_auto_compact.py                                          205            180            434
tests/test_lessons_commands.py                                      157             82            422
scripts/github_bot.py                                                84             79            409
gptme/eval/dspy/prompt_optimizer.py                                 106             86            398
gptme/server/api.py                                                  98            100            398
gptme/acp/agent.py                                                   87            125            397
tests/context/test_task_analyzer.py                                 119             58            389
tests/test_util_cli_mcp.py                                           89             45            380
gptme/agent/service.py                                              108            103            379
gptme/chat.py                                                        69             95            378
gptme/cli/doctor.py                                                  70             55            373
gptme/util/_telemetry.py                                            106            123            360
gptme/eval/dspy/cli.py                                               73             57            355
gptme/eval/dspy/experiments.py                                       94             60            352
gptme/eval/execenv.py                                                54             96            351
gptme/eval/run.py                                                    58             51            350
gptme/tools/gh.py                                                    85             93            348
tests/test_llm_anthropic.py                                          64             26            348
gptme/eval/dspy/metrics.py                                           97             98            344
gptme/telemetry.py                                                   85             54            342
tests/test_codeblock.py                                             225            538            342
tests/test_lessons_parser.py                                        152            176            338
gptme/agent/cli.py                                                   94            113            337
gptme/util/prompt.py                                                 83            114            337
tests/test_integration_phase4.py                                     66             54            331
gptme/tools/tmux.py                                                  95            159            330
tests/test_mcp_discovery.py                                          97             39            315
gptme/tools/mcp.py                                                   99            102            310
gptme/hooks/tests/test_confirm.py                                   100             59            309
gptme/llm/__init__.py                                                76             74            307
gptme/util/gh.py                                                     66             86            305
tests/test_cli.py                                                    84             60            305
gptme/message.py                                                     66             90            304
scripts/gh-pr-view-with-pr-comments.py                               55             36            298
tests/test_lessons_matcher.py                                        89             80            288
gptme/tools/_browser_playwright.py                                   87             33            287
tests/lessons/test_wildcard_matching.py                             114            125            287
gptme/eval/dspy/hybrid_optimizer.py                                 141            344            286
gptme/tools/tts.py                                                  119            132            284
gptme/tools/browser.py                                              108            163            280
tests/test_lessons_index.py                                          96             77            280
gptme/mcp/client.py                                                  87             91            269
gptme/tools/patch.py                                                 62             89            259
tests/test_context_selector.py                                       83             45            254
gptme/tools/save.py                                                  56             56            252
tests/test_lessons_integration.py                                    97             66            252
tests/conftest.py                                                    79             70            250
gptme/plugins/__init__.py                                            83            116            248
gptme/tools/lessons.py                                               92            105            243
gptme/agent/workspace.py                                            110            183            241
tests/test_complete.py                                               56             40            241
gptme/context/task_analyzer.py                                      100            124            237
gptme/tools/todo.py                                                  95             97            236
gptme/commands/meta.py                                               54             20            232
gptme/context/adaptive_compressor.py                                 76            130            232
tests/test_hooks.py                                                 114             46            232
tests/test_server_v2.py                                              69             34            229
gptme/tools/__init__.py                                              67             51            227
tests/test_doctor.py                                                 82             55            226
gptme/mcp/registry.py                                                59             70            216
gptme/lessons/commands.py                                            91             48            213
tests/test_lessons_tool.py                                           62             34            212
gptme/util/_sound_sounddevice.py                                     52             52            208
tests/test_mcp.py                                                    58             45            207
gptme/lessons/index.py                                               90            126            205
tests/test_message.py                                                83             86            204
tests/test_plugins.py                                                82             70            203
gptme/util/sound.py                                                  65             72            200
gptme/util/auto_naming.py                                            59             70            199
gptme/lessons/parser.py                                              70            108            192
gptme/tools/precommit.py                                             64             87            189
tests/test_mcp_adapter.py                                            64             37            189
gptme/cli/onboard.py                                                 61             52            188
tests/test_auto_naming.py                                            54             41            186
tests/test_execenv.py                                                52             42            185
gptme/context/selector/file_selector.py                              51             71            184
tests/test_dspy_hybrid.py                                            65             45            179
scripts/reduce_context.py                                            59             72            177
tests/test_server_v2_hooks.py                                        71             52            175
gptme/tools/morph.py                                                 43             42            174
gptme/llm/validate.py                                                29             27            173
gptme/server/workspace_api.py                                        57             55            173
gptme/tools/python.py                                                56             50            171
gptme/tools/restart.py                                               51             81            171
gptme/llm/llm_openai_models.py                                        2             11            169
gptme/codeblock.py                                                   37             92            168
tests/test_context.py                                                80             55            168
gptme/commands/session.py                                            57             47            164
tests/test_tools_todo.py                                             75             61            162
gptme/tools/_browser_thread.py                                       27             12            157
tests/test_tools_patch.py                                            85            203            156
tests/test_tools_time_awareness.py                                   52             34            155
tests/test_uri.py                                                    54             30            155
tests/test_cost_tracker.py                                           21             24            154
gptme/llm/utils.py                                                   54             73            153
scripts/check_rst_formatting.py                                      41             52            147
tests/test_master_context.py                                         39             24            147
gptme/tools/form.py                                                  38             43            145
gptme/tools/rag.py                                                   62             74            145
gptme/util/cost_display.py                                           39             31            145
tests/test_file_selector_integration.py                              50             23            145
gptme/tools/chats.py                                                 43             49            142
tests/test_tree.py                                                   54             29            142
gptme/hooks/token_awareness.py                                       44             51            141
gptme/util/__init__.py                                               31             22            140
tests/test_tool_use.py                                               12             19            140
gptme/server/cli.py                                                  26             17            139
gptme/server/client.py                                               60             78            139
tests/test_dspy_integration.py                                       54             32            139
tests/test_tools_tmux.py                                             64             60            139
tests/test_lesson_selector_integration.py                            45             25            138
gptme/hooks/cli_confirm.py                                           40             37            135
gptme/hooks/cost_awareness.py                                        45             56            133
gptme/lessons/hybrid_matcher.py                                      53             79            132
tests/test_dspy_basic.py                                             49             31            132
tests/benchmark_context_selector.py                                  32             26            130
gptme/hooks/cache_awareness.py                                       95            138            128
gptme/commands/llm.py                                                38             36            127
gptme/hooks/form_autodetect.py                                       48             65            126
tests/test_tools_token_awareness.py                                  59             47            126
gptme/hooks/tests/test_cache_awareness.py                            47             34            125
gptme/hooks/server_confirm.py                                        51             58            122
tests/test_server.py                                                 42             27            122
gptme/eval/agents.py                                                 22             11            121
gptme/server/auth.py                                                 45             69            121
tests/test_prompt.py                                                 36             36            120
gptme/commands/export.py                                             31             21            119
gptme/tools/complete.py                                              34             42            115
scripts/auto_rename_logs.py                                          34             23            115
gptme/hooks/confirm.py                                               54             88            114
tests/test_lessons_status.py                                         67             96            113
tests/test_tools_save.py                                             29             23            113
gptme/util/cost_tracker.py                                           44             62            112
tests/test_cost_awareness_delayed_warning.py                         42             32            108
scripts/gpt_todoer.py                                                47             25            107
scripts/train/collect.py                                             35             52            107
tests/test_server_v2_tool_confirmation.py                            32             32            107
gptme/tools/choice.py                                                31             25            105
tests/test_util_cli.py                                               35             28            105
gptme/commands/base.py                                               46             51            104
gptme/init.py                                                        24             28            102
gptme/lessons/matcher.py                                             35             47            102
tests/test_tools_tts.py                                              50             58            101
tests/test_session.py                                                40             21             93
tests/test_llm_models.py                                             34             26             92
gptme/acp/types.py                                                   25             13             91
gptme/util/tree.py                                                   21             13             91
tests/test_tools_computer.py                                         36             27             91
gptme/server/api_v2_agents.py                                        24             15             90
tests/test_llm_validate.py                                           25             19             90
tests/test_parallel.py                                               27             17             89
tests/test_util_gh.py                                                39             28             89
gptme/lessons/matcher_enhanced.py                                    26             40             88
gptme/util/ask_execute.py                                            25             40             88
tests/test_prompts.py                                                37             35             87
tests/test_server_v2_auto_stepping.py                                20             22             87
gptme/tools/parallel.py                                              29             37             86
gptme/util/export.py                                                 17             25             86
gptme/tools/_browser_perplexity.py                                   25             22             85
scripts/treeofthoughts.py                                            28             29             85
tests/test_browser.py                                                40             35             85
tests/test_server_auth.py                                            40             19             84
gptme/dirs.py                                                        33             23             83
gptme/hooks/time_awareness.py                                        29             31             83
scripts/convert_convo.py                                             34             54             82
tests/context/test_adaptive_compressor.py                            35             23             80
gptme/lessons/auto_include.py                                        31             26             79
gptme/commands/__init__.py                                           14             21             77
tests/test_prompt_tools.py                                            5              4             77
gptme/context/compress.py                                            63            131             76
gptme/util/reduce.py                                                 24             35             76
tests/test_tools.py                                                  45              6             76
gptme/tools/autocommit.py                                            37             59             75
tests/test_markdown_validation.py                                    43             34             75
tests/test_shell_issue729.py                                         50             52             75
gptme/server/api_v2_common.py                                        49             24             74
tests/test_shell_issue772.py                                         48             47             73
tests/test_command_completion.py                                     23             14             71
gptme/context/selector/llm_based.py                                  32             38             69
gptme/eval/suites/basic.py                                           17              0             69
gptme/util/generate_name.py                                           5              6             69
tests/test_hooks_form_autodetect.py                                  22             34             68
tests/test_tools_form.py                                             22             19             67
gptme/util/master_context.py                                         28             38             66
gptme/session.py                                                     39             63             65
gptme/__version__.py                                                 15             11             64
gptme/util/_sound_cmd.py                                             22             17             64
gptme/eval/filestore.py                                              11              8             63
gptme/lessons/skills/python-repl/python_helpers.py                   28             26             63
gptme/eval/suites/init_projects.py                                   21              1             62
gptme/hooks/active_context.py                                        21             22             61
tests/test_shell_output_mixing_issue408.py                           25             29             60
gptme/context/selector/rule_based.py                                 20             13             59
gptme/tools/screenshot.py                                            22             28             59
gptme/util/uri.py                                                    29             42             59
tests/test_server_client.py                                          33             26             59
gptme/util/output_storage.py                                         26             36             58
gptme/tools/vision.py                                                20             13             57
gptme/eval/dspy/signatures.py                                        19             21             56
tests/test_chat_history.py                                           14             12             56
gptme/context/selector/file_integration.py                           13             10             55
scripts/describe_api.py                                              28             25             54
gptme/hooks/cwd_tracking.py                                          18             25             51
gptme/hooks/markdown_validation.py                                   36             41             51
tests/test_server_v2_sse.py                                          15             13             50
tests/test_custom_providers.py                                       23             32             49
tests/test_eval.py                                                    9              9             49
gptme/acp/adapter.py                                                 30             36             44
gptme/util/tokens.py                                                 22             16             44
gptme/util/cost.py                                                   12             20             43
tests/test_pdf_to_images.py                                          13             13             43
gptme/context/selector/file_config.py                                13             11             42
tests/test_onboard.py                                                11             10             41
gptme/eval/types.py                                                  15             12             40
gptme/lessons/selector_config.py                                     18             20             40
gptme/tools/_browser_lynx.py                                         13             18             40
gptme/util/file_storage.py                                           30             47             40
gptme/context/selector/hybrid.py                                     14             16             39
gptme/lessons/selector_integration.py                                12             11             39
gptme/util/keyword_matching.py                                       35             66             39
tests/test_dspy_gepa.py                                              18              9             39
tests/test_prompt_skills_summary.py                                  24             22             39
tests/test_reduce.py                                                 11              2             39
tests/test_tools_python.py                                           28              3             38
tests/test_utils.py                                                  14             17             38
tests/test_util.py                                                   28             51             37
gptme/util/clipboard.py                                               8              2             35
tests/test_message_command.py                                        13             12             35
gptme/util/terminal.py                                               23             21             34
tests/test_tools_rag.py                                              15              8             34
gptme/hooks/test.py                                                  12              5             33
scripts/shorten_details.py                                           11              6             33
tests/test_hybrid_lessons.py                                         14              8             33
tests/test_shell_for_loop_issue724.py                                16             24             33
gptme/acp/__main__.py                                                14              9             32
scripts/list_user_messages.py                                        10              9             32
gptme/cli/wut.py                                                     13             12             31
gptme/util/install.py                                                13             24             31
gptme/util/content.py                                                18             24             29
tests/test_chat.py                                                   16             28             28
tests/test_telemetry.py                                              20             15             28
gptme/context/selector/base.py                                       14             23             27
tests/test_xml_format.py                                             10             31             27
gptme/tools/youtube.py                                               10              1             26
scripts/summarize_project.py                                         12              1             26
tests/test_chat_config.py                                             8              7             26
gptme/constants.py                                                   17             19             25
gptme/executor.py                                                    17             26             24
gptme/hooks/auto_confirm.py                                          11              9             24
gptme/lessons/__init__.py                                             7             15             24
tests/test_tool_loading_duplicate.py                                 16             15             24
gptme/context/__init__.py                                             3              8             21
gptme/context/config.py                                              12             26             21
gptme/context/selector/config.py                                      8              8             21
gptme/util/useredit.py                                               12             13             21
gptme/util/interrupt.py                                              13             18             20
gptme/agent/__init__.py                                               3              6             19
gptme/context/selector/__init__.py                                    6             13             19
gptme/eval/suites/__init__.py                                         3              0             19
tests/test_tools_shell_multiline.py                                   7             19             19
gptme/acp/__init__.py                                                 5              8             18
tests/test_logmanager.py                                              8              5             18
gptme/eval/suites/browser.py                                          5              0             17
gptme/cli/__init__.py                                                10             13             15
tests/test_screenshot.py                                              9              6             15
tests/test_tools_chats.py                                             2              0             15
gptme/mcp/__init__.py                                                 1              0             14
gptme/tools/read.py                                                   6              8             13
tests/test_browser_lynx.py                                            7              4             12
gptme/__init__.py                                                     1              1              9
gptme/eval/dspy/__init__.py                                           6              6              7
gptme/eval/cost.py                                                   12             24              6
gptme/eval/__init__.py                                                1              0              4
gptme/__main__.py                                                     1              0              3
gptme/eval/__main__.py                                                1              0              3
gptme/eval/dspy/__main__.py                                           3              5              3
gptme/server/__init__.py                                              2              3              3
gptme/server/__main__.py                                              1              0              3
gptme/server/exceptions.py                                            5              8              2
gptme/server/constants.py                                             1              3              1
-----------------------------------------------------------------------------------------------------
SUM:                                                              17001          17925          55133
-----------------------------------------------------------------------------------------------------
make[2]: Leaving directory '/home/runner/work/gptme/gptme'

Code Metrics#

$ make metrics
make[2]: Entering directory '/home/runner/work/gptme/gptme'
=== Code Metrics Summary ===

Project Overview:
  Files: 314
  Total blocks: 3494
  Average complexity: 4.35174585002862

Most Complex Functions (D+):
  gptme/context/selector/file_selector.py
  gptme/context/selector/rule_based.py
      M 27:4 RuleBasedSelector.select - D
  gptme/prompts.py
      F 483:0 prompt_workspace - E
      F 694:0 prompt_chat_history - E
      F 51:0 get_prompt - D
  gptme/eval/dspy/hybrid_optimizer.py
      C 239:0 TaskComplexity - D
      M 283:4 TaskComplexity.analyze - D
  gptme/eval/main.py
      F 326:0 main - D
  gptme/cli/main.py
  gptme/telemetry.py
      F 286:0 record_llm_request - E
  gptme/commands/meta.py
      F 136:0 cmd_plugin - E
  gptme/config.py
      F 1034:0 setup_config_from_cli - E
      M 906:4 Config.mcp - D
  gptme/server/api_v2_sessions.py
      F 244:0 step - E
  gptme/server/tasks_api.py
      F 358:0 get_git_status - D
  gptme/server/openapi_docs.py
      F 533:0 _convert_to_openapi_nullable - D
  gptme/lessons/index.py
      M 97:4 LessonIndex._default_dirs - D
  gptme/codeblock.py
      F 87:0 _extract_codeblocks - E
  gptme/llm/llm_anthropic.py
  gptme/llm/models.py
      F 514:0 get_model - D
  gptme/llm/__init__.py
      F 209:0 _reply_stream - D
  gptme/llm/llm_openai.py
      F 205:0 init - D
      F 857:0 _transform_msgs_for_special_provider - D
      F 591:0 stream - D
  gptme/hooks/token_awareness.py
      F 88:0 add_token_usage_warning - D
  gptme/hooks/__init__.py
      M 377:4 HookRegistry.trigger - D
  gptme/plugins/__init__.py
      F 141:0 _load_plugin - D
  gptme/util/gh.py
  gptme/util/context.py
      F 600:0 _resource_to_codeblock - E
      F 437:0 include_paths - D
  gptme/util/prompt.py
      M 296:4 GptmeCompleter.get_completions - D
  gptme/tools/lessons.py
      F 189:0 auto_include_lessons_hook - D
  gptme/tools/shell.py
      F 1584:0 _shorten_stdout - D
      F 1444:0 execute_shell - D
  gptme/tools/gh.py
      F 57:0 _wait_for_checks - D
  gptme/tools/tmux.py
      F 365:0 execute_tmux - D
  gptme/tools/computer.py
      F 434:0 computer - D
  gptme/tools/autocompact.py
  gptme/tools/mcp.py
      F 77:0 execute_mcp - E
  tests/test_server_v2_auto_stepping.py
      F 16:0 test_auto_stepping - E
  tests/test_config.py
      F 541:0 test_project_config_loaded_from_toml - D
      F 574:0 test_project_config_loaded_from_json - D
  scripts/check_rst_formatting.py
      F 26:0 check_file - E
  scripts/gh-pr-view-with-pr-comments.py
      M 175:4 PRViewer.get_comments - D
  scripts/auto_rename_logs.py
      F 32:0 auto_rename_logs - D

Largest Files (>300 SLOC):
  1241 gptme/tools/shell.py
   947 gptme/eval/dspy/tasks.py
   888 tests/test_tools_shell.py
   827 gptme/llm/llm_openai.py
   812 tests/test_llm_openai.py
   757 gptme/config.py
   729 tests/test_config.py
   725 gptme/tools/autocompact.py
   712 gptme/llm/models.py
   700 gptme/tools/subagent.py
   685 gptme/server/api_v2_sessions.py
   658 gptme/llm/llm_anthropic.py
   657 tests/test_codeblock.py
   597 gptme/server/tasks_api.py
   579 gptme/prompts.py
   576 gptme/cli/main.py
   562 tests/test_agent.py
   546 gptme/hooks/__init__.py
   541 tests/test_util_gh_mocked.py
   521 gptme/logmanager.py
   516 gptme/tools/base.py
   515 tests/test_tools_subagent.py
   505 gptme/tools/mcp_adapter.py
   500 gptme/cli/util.py
   493 gptme/tools/computer.py
   487 gptme/cli/setup.py
   486 gptme/server/openapi_docs.py
   471 tests/test_auto_compact.py
   463 gptme/eval/main.py
   450 gptme/util/context.py
   448 tests/test_lessons_parser.py
   445 scripts/analyze_compression.py
   436 gptme/server/api_v2.py
   422 tests/test_lessons_commands.py
   418 scripts/github_bot.py
   409 gptme/tools/gh.py
   405 gptme/tools/tmux.py
   399 gptme/server/api.py
   399 gptme/eval/dspy/prompt_optimizer.py
   398 gptme/agent/service.py
   397 gptme/acp/agent.py
   389 tests/context/test_task_analyzer.py
   380 tests/test_util_cli_mcp.py
   378 gptme/chat.py
   373 gptme/cli/doctor.py
   363 gptme/eval/execenv.py
   360 gptme/util/_telemetry.py
   357 gptme/util/prompt.py
   357 gptme/eval/dspy/experiments.py
   355 gptme/eval/dspy/cli.py
   351 gptme/eval/run.py
   349 gptme/eval/dspy/metrics.py
   348 tests/test_llm_anthropic.py
   346 tests/lessons/test_wildcard_matching.py
   342 gptme/telemetry.py
   337 gptme/agent/cli.py
   333 gptme/tools/browser.py
   331 tests/test_integration_phase4.py
   327 tests/test_tools_patch.py
   326 gptme/tools/mcp.py
   322 gptme/util/gh.py
   315 tests/test_mcp_discovery.py
   314 tests/test_cli.py
   310 gptme/message.py
   309 gptme/hooks/tests/test_confirm.py
   308 tests/test_lessons_matcher.py
   307 gptme/llm/__init__.py

make[3]: Entering directory '/home/runner/work/gptme/gptme'
Most Duplicated Files:
npm warn exec The following package was not found and will be installed: jscpd@4.0.8
Clone found (python):
 - gptme/util/_sound_sounddevice.py [95:5 - 106:67] (11 lines, 101 tokens)
   gptme/util/_sound_sounddevice.py [55:5 - 66:27]

Clone found (python):
 - gptme/tools/patch.py [313:5 - 327:4] (14 lines, 93 tokens)
   gptme/tools/save.py [108:5 - 122:41]

Clone found (python):
 - gptme/tools/gh.py [367:9 - 378:30] (11 lines, 92 tokens)
   gptme/tools/gh.py [228:9 - 239:12]

Clone found (python):
 - gptme/server/tasks_api.py [482:5 - 493:42] (11 lines, 79 tokens)
   gptme/server/tasks_api.py [469:26 - 479:5]

Clone found (python):
 - gptme/server/api.py [201:5 - 211:43] (10 lines, 83 tokens)
   gptme/server/api_v2.py [195:5 - 205:12]

Clone found (python):
 - gptme/server/api.py [212:5 - 228:2] (16 lines, 157 tokens)
   gptme/server/api_v2.py [205:5 - 221:2]

Clone found (python):
 - gptme/server/api.py [265:5 - 285:4] (20 lines, 172 tokens)
   gptme/server/api_v2.py [262:5 - 285:4]

Clone found (python):
 - gptme/plugins/__init__.py [399:5 - 424:25] (25 lines, 183 tokens)
   gptme/util/install.py [14:5 - 39:28]

Clone found (python):
 - gptme/llm/validate.py [199:37 - 214:14] (15 lines, 103 tokens)
   gptme/llm/validate.py [181:40 - 196:19]

Clone found (python):
 - gptme/llm/validate.py [217:29 - 229:45] (12 lines, 97 tokens)
   gptme/llm/validate.py [181:40 - 193:45]

Clone found (python):
 - gptme/llm/models.py [643:6 - 654:7] (11 lines, 82 tokens)
   gptme/llm/models.py [574:11 - 585:38]

Clone found (python):
 - gptme/llm/llm_anthropic.py [457:5 - 490:54] (33 lines, 248 tokens)
   gptme/llm/llm_anthropic.py [367:5 - 400:20]

Clone found (python):
 - gptme/llm/llm_anthropic.py [501:7 - 514:2] (13 lines, 110 tokens)
   gptme/llm/llm_anthropic.py [410:7 - 423:69]

Clone found (python):
 - gptme/eval/dspy/cli.py [310:31 - 325:49] (15 lines, 104 tokens)
   gptme/eval/dspy/cli.py [78:1 - 93:7]

Clone found (python):
 - gptme/eval/dspy/cli.py [417:12 - 433:46] (16 lines, 93 tokens)
   gptme/eval/dspy/cli.py [160:9 - 176:41]

Clone found (python):
 - gptme/eval/dspy/cli.py [444:13 - 450:15] (6 lines, 84 tokens)
   gptme/eval/dspy/cli.py [187:13 - 192:17]

Clone found (python):
 - gptme/eval/execenv.py [174:9 - 196:50] (22 lines, 229 tokens)
   gptme/eval/execenv.py [65:8 - 86:6]

Clone found (python):
 - gptme/eval/execenv.py [216:13 - 225:64] (9 lines, 109 tokens)
   gptme/eval/filestore.py [62:13 - 71:6]

Clone found (python):
 - gptme/eval/execenv.py [360:4 - 374:10] (14 lines, 115 tokens)
   gptme/eval/execenv.py [131:2 - 145:4]

Clone found (python):
 - gptme/eval/execenv.py [437:9 - 461:6] (24 lines, 180 tokens)
   gptme/eval/execenv.py [159:9 - 73:3]

Clone found (python):
 - gptme/commands/meta.py [208:9 - 217:7] (9 lines, 90 tokens)
   gptme/commands/meta.py [159:9 - 168:6]

Clone found (python):
 - gptme/cli/doctor.py [178:15 - 193:8] (15 lines, 97 tokens)
   gptme/cli/doctor.py [156:15 - 171:6]

Clone found (python):
 - scripts/generate_sounds.py [165:2 - 173:13] (8 lines, 81 tokens)
   scripts/generate_sounds.py [91:2 - 99:11]

Clone found (python):
 - scripts/analyze_compression.py [152:43 - 164:2] (12 lines, 97 tokens)
   scripts/analyze_compression.py [55:71 - 67:3]

Clone found (python):
 - scripts/analyze_compression.py [220:9 - 231:24] (11 lines, 97 tokens)
   scripts/analyze_compression.py [116:9 - 127:20]

Clone found (python):
 - gptme/telemetry.py [57:2 - 80:4] (23 lines, 106 tokens)
   gptme/util/_telemetry.py [306:5 - 329:7]

Clone found (python):
 - gptme/telemetry.py [445:5 - 456:11] (11 lines, 90 tokens)
   gptme/telemetry.py [110:9 - 121:10]

┌────────────┬────────────────┬─────────────┬──────────────┬──────────────┬──────────────────┬───────────────────┐
│ Format     │ Files analyzed │ Total lines │ Total tokens │ Clones found │ Duplicated lines │ Duplicated tokens │
├────────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ python     │ 200            │ 53768       │ 340010       │ 27           │ 397 (0.74%)      │ 3172 (0.93%)      │
├────────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ css        │ 1              │ 173         │ 1045         │ 0            │ 0 (0%)           │ 0 (0%)            │
├────────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ javascript │ 1              │ 395         │ 3314         │ 0            │ 0 (0%)           │ 0 (0%)            │
├────────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ markup     │ 2              │ 264         │ 2183         │ 0            │ 0 (0%)           │ 0 (0%)            │
├────────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ markdown   │ 7              │ 1231        │ 8776         │ 0            │ 0 (0%)           │ 0 (0%)            │
├────────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ bash       │ 9              │ 335         │ 1587         │ 0            │ 0 (0%)           │ 0 (0%)            │
├────────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ url        │ 1              │ 2           │ 16           │ 0            │ 0 (0%)           │ 0 (0%)            │
├────────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ Total:     │ 221            │ 56168       │ 356931       │ 27           │ 397 (0.71%)      │ 3172 (0.89%)      │
└────────────┴────────────────┴─────────────┴──────────────┴──────────────┴──────────────────┴───────────────────┘
Found 27 clones.
Detection time:: 3.846s
make[3]: Leaving directory '/home/runner/work/gptme/gptme'
make[2]: Leaving directory '/home/runner/work/gptme/gptme'

The metrics above show:

  • Project Overview: Basic stats about the codebase size and complexity

  • Complex Functions: Functions rated D+ (high complexity, should be refactored)

  • Large Files: Files over 300 SLOC (should be split into smaller modules)

  • Duplicated Files: Using jscpd to find duplicated code

We should aim to:

  • Keep average complexity below 4.0

  • Have no E-rated functions (extremely complex)

  • Have few D-rated functions (very complex)

  • Keep files under 300 SLOC where possible