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
     232226 |     mcp.types
     234444 |   gptme.tools.mcp_adapter
     323374 |             openai.types
     391018 |           openai
     459302 | gptme.cli.main
     463142 |         gptme.llm.llm_openai
     736903 |       gptme.llm
     738855 |     gptme.commands
     849205 |   gptme.chat
     905444 | gptme

real	0m2.094s
user	0m1.786s
sys	0m0.273s
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.062 s ±  0.053 s    [User: 1.835 s, System: 0.224 s]
  Range (min … max):    2.025 s …  2.148 s    5 runs
 
  Warning: The first benchmarking run for this command was significantly slower than the rest (2.148 s). This could be caused by (filesystem) caches that were not filled until after the first run. You should consider using the '--warmup' option to fill those caches before the actual benchmark. Alternatively, use the '--prepare' option to clear the caches before each timing run.
 
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                                213            219            870
gptme/llm/models.py                                    128            144            853
gptme/config.py                                        212            209            776
gptme/llm/llm_anthropic.py                             147            163            650
gptme/hooks/__init__.py                                170            211            598
gptme/prompts.py                                       174            250            594
gptme/logmanager.py                                    137            165            564
gptme/tools/base.py                                    138            160            553
gptme/llm/llm_openai_subscription.py                   129             95            458
gptme/util/context.py                                  118            174            446
gptme/util/prompt.py                                   103            151            410
gptme/chat.py                                           69             90            377
gptme/util/_telemetry.py                               106            123            357
gptme/telemetry.py                                      85             54            342
gptme/llm/__init__.py                                   79             79            322
gptme/message.py                                        74            102            313
gptme/util/gh.py                                        66             86            305
gptme/info.py                                           85             70            293
gptme/tools/__init__.py                                 84             67            253
gptme/plugins/__init__.py                               84            119            248
gptme/llm/llm_openai_models.py                           3             14            246
gptme/util/auto_naming.py                               68             78            224
gptme/lessons/index.py                                  91            128            214
gptme/lessons/commands.py                               91             48            213
gptme/profiles.py                                       64             67            205
gptme/util/_sound_sounddevice.py                        52             46            204
gptme/util/sound.py                                     65             72            200
gptme/lessons/parser.py                                 70            108            192
gptme/codeblock.py                                      34             97            171
gptme/llm/validate.py                                   30             28            170
gptme/util/__init__.py                                  34             29            155
gptme/llm/utils.py                                      54             73            153
gptme/util/reduce.py                                    45             42            147
gptme/util/cost_display.py                              39             31            145
gptme/util/tool_format.py                               45             72            139
gptme/lessons/hybrid_matcher.py                         53             79            132
gptme/llm/llm_gptme.py                                  47             58            127
gptme/util/clipboard.py                                 22             12            118
gptme/util/cost_tracker.py                              43             62            109
gptme/util/ask_execute.py                               30             41            106
gptme/init.py                                           24             30            103
gptme/dirs.py                                           42             31            102
gptme/lessons/matcher.py                                35             47            102
gptme/lessons/matcher_enhanced.py                       26             40             90
gptme/util/tree.py                                      21             15             87
gptme/util/export.py                                    17             25             86
gptme/util/git_worktree.py                              25             33             83
gptme/lessons/auto_include.py                           31             26             78
gptme/session.py                                        39             64             70
gptme/util/generate_name.py                              5              6             69
gptme/util/master_context.py                            28             38             66
gptme/__version__.py                                    15             11             64
gptme/util/_sound_cmd.py                                22             17             62
gptme/util/uri.py                                       29             42             59
gptme/util/output_storage.py                            26             36             54
gptme/util/tokens.py                                    20             12             44
gptme/util/cost.py                                      11              9             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/terminal.py                                  23             21             34
gptme/util/install.py                                   13             25             30
gptme/util/content.py                                   18             24             29
gptme/constants.py                                      17             19             25
gptme/executor.py                                       18             26             24
gptme/lessons/__init__.py                                7             15             24
gptme/util/interrupt.py                                 13             15             23
gptme/util/useredit.py                                  12             13             21
gptme/__main__.py                                        2              0             12
gptme/__init__.py                                        1              0              7
----------------------------------------------------------------------------------------
SUM:                                                  4016           4700          14601
----------------------------------------------------------------------------------------
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                               213            219            870
gptme/llm/models.py                                   128            144            853
gptme/llm/llm_anthropic.py                            147            163            650
gptme/llm/llm_openai_subscription.py                  129             95            458
gptme/llm/__init__.py                                  79             79            322
gptme/llm/llm_openai_models.py                          3             14            246
gptme/llm/validate.py                                  30             28            170
gptme/llm/utils.py                                     54             73            153
gptme/llm/llm_gptme.py                                 47             58            127
---------------------------------------------------------------------------------------
SUM:                                                  830            873           3849
---------------------------------------------------------------------------------------
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                                329            438           1543
gptme/tools/subagent.py                             229            445            838
gptme/tools/autocompact.py                          222            308            760
gptme/hooks/workspace_agents.py                     147            102            616
gptme/tools/mcp_adapter.py                          206            210            608
gptme/hooks/__init__.py                             170            211            598
gptme/tools/base.py                                 138            160            553
gptme/tools/computer.py                             155            223            450
gptme/tools/gh.py                                    85            121            348
gptme/tools/tmux.py                                  95            171            346
gptme/tools/mcp.py                                  104            105            336
gptme/tools/tts.py                                  119            132            286
gptme/tools/_browser_playwright.py                   85             39            285
gptme/tools/browser.py                              113            165            278
gptme/tools/save.py                                  57             58            261
gptme/tools/patch.py                                 62             95            257
gptme/tools/__init__.py                              84             67            253
gptme/plugins/__init__.py                            84            119            248
gptme/tools/lessons.py                               92            105            244
gptme/tools/todo.py                                  95            109            232
gptme/tools/python.py                                72             84            219
gptme/hooks/elicitation.py                           90            132            213
gptme/tools/precommit.py                             64             87            194
gptme/tools/morph.py                                 43             47            185
gptme/tools/_browser_thread.py                       27             12            156
gptme/tools/restart.py                               51             81            150
gptme/tools/rag.py                                   62             74            146
gptme/tools/form.py                                  38             55            145
gptme/hooks/token_awareness.py                       44             50            142
gptme/tools/chats.py                                 43             48            142
gptme/hooks/cli_confirm.py                           41             37            138
gptme/tools/elicit.py                                36            109            135
gptme/hooks/cost_awareness.py                        45             56            133
gptme/hooks/cache_awareness.py                       95            138            128
gptme/hooks/form_autodetect.py                       48             65            123
gptme/hooks/server_confirm.py                        51             58            122
gptme/tools/read.py                                  23             23            119
gptme/tools/complete.py                              33             42            114
gptme/hooks/server_elicit.py                         52             56            113
gptme/hooks/confirm.py                               53             88            109
gptme/tools/choice.py                                31             37            105
gptme/hooks/active_context.py                        25             23            100
gptme/tools/_browser_perplexity.py                   25             22             85
gptme/hooks/time_awareness.py                        29             31             84
gptme/tools/autocommit.py                            37             58             75
gptme/tools/screenshot.py                            23             29             67
gptme/tools/vision.py                                20             13             62
gptme/hooks/agents_md_inject.py                      23             31             61
gptme/tools/_browser_lynx.py                         12             13             56
gptme/hooks/cwd_changed.py                           15             11             54
gptme/hooks/markdown_validation.py                   36             41             51
gptme/hooks/test.py                                  12              5             33
gptme/hooks/cwd_awareness.py                         11             17             28
gptme/tools/youtube.py                               10              1             26
gptme/hooks/auto_confirm.py                          11              9             24
-------------------------------------------------------------------------------------
SUM:                                               4002           5066          13177
-------------------------------------------------------------------------------------
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                    175            181            737
gptme/server/tasks_api.py                          171            110            596
gptme/server/api_v2.py                             110             72            493
gptme/server/openapi_docs.py                       182            142            476
gptme/server/api.py                                 98            100            399
gptme/server/static/main.js                         35             45            324
gptme/server/workspace_api.py                       57             55            173
gptme/server/static/index.html                      11             16            167
gptme/server/static/style.css                       27              4            143
gptme/server/client.py                              60             78            139
gptme/server/cli.py                                 26             13            133
gptme/server/auth.py                                45             69            121
gptme/server/api_v2_common.py                       56             34             92
gptme/server/static/computer.html                    1              1             90
gptme/server/api_v2_agents.py                       24             15             89
gptme/server/__init__.py                             2              3              3
gptme/server/__main__.py                             1              0              3
gptme/server/constants.py                            1              3              1
------------------------------------------------------------------------------------
SUM:                                              1082            941           4179
------------------------------------------------------------------------------------
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_acp_agent.py                                       311            178           1043
tests/test_llm_openai.py                                      268            170            978
tests/test_tools_subagent.py                                  277            150            771
tests/test_tools_shell.py                                     245            386            705
tests/test_agent.py                                           199            110            664
tests/test_auto_compact.py                                    227            189            543
tests/test_util_gh_mocked.py                                  106             92            534
tests/test_config.py                                          146            270            513
tests/test_lessons_commands.py                                157             82            422
tests/test_tools_computer.py                                  159             93            396
tests/test_codeblock.py                                       262            619            394
tests/context/test_task_analyzer.py                           119             58            389
tests/test_util_cli_mcp.py                                     89             45            380
tests/test_profiles.py                                         84             30            356
tests/test_llm_anthropic.py                                    64             26            348
tests/test_integration_phase4.py                               67             54            344
tests/test_lessons_parser.py                                  152            176            340
tests/test_mcp_discovery.py                                    97             39            315
tests/test_cli.py                                              84             61            307
tests/test_workspace_agents.py                                137             57            296
tests/test_lessons_matcher.py                                  89             80            288
tests/lessons/test_wildcard_matching.py                       114            125            287
tests/test_mcp_adapter.py                                      95             52            286
tests/test_llm_utils.py                                        66             49            281
tests/test_lessons_index.py                                    96             77            280
tests/test_message.py                                         111            105            275
tests/test_doctor.py                                           92             63            270
tests/test_context_selector.py                                 83             45            254
tests/conftest.py                                              79             70            252
tests/test_lessons_integration.py                              97             66            252
tests/test_complete.py                                         56             40            241
tests/test_auto_naming.py                                      69             45            232
tests/test_hooks.py                                           114             46            232
tests/test_server_v2.py                                        70             35            231
tests/test_cost_display.py                                     27             20            220
tests/test_lessons_tool.py                                     62             34            216
tests/test_autocompact_scoring.py                              86             39            208
tests/test_tools.py                                            96             47            208
tests/test_mcp.py                                              58             45            207
tests/test_agent_doctor.py                                     59             26            205
tests/test_plugins.py                                          82             70            203
tests/test_execenv.py                                          52             42            187
tests/test_logmanager.py                                       56             50            187
tests/test_agents_md_inject.py                                 37             29            181
tests/test_dspy_hybrid.py                                      65             45            179
tests/test_hooks_cwd_changed.py                                55             24            176
tests/test_server_v2_hooks.py                                  71             52            175
tests/test_tools_todo.py                                       81             65            173
tests/test_acp_types.py                                        35             12            171
tests/test_context.py                                          80             56            171
tests/test_tool_use.py                                         20             26            169
tests/test_server.py                                           52             39            168
tests/test_util_cli.py                                         55             32            168
tests/test_tools_elicit.py                                     50             25            167
tests/test_tree.py                                             59             37            167
tests/test_acp_protocol_logging.py                             56             15            160
tests/test_acp_client.py                                       64             34            159
tests/test_uri.py                                              55             30            158
tests/test_tools_patch.py                                      85            203            156
tests/test_tools_time_awareness.py                             52             34            155
tests/test_cost_tracker.py                                     21             24            154
tests/test_tools_tmux.py                                       69             63            154
tests/test_acp_stdout.py                                       79             37            152
tests/test_util_cli_skills.py                                  59             41            151
tests/test_util_tree.py                                        44             33            151
tests/test_master_context.py                                   39             24            147
tests/test_file_selector_integration.py                        50             23            145
tests/test_gptme_provider.py                                   66             20            143
tests/test_shell_allowlist_autoconfirm.py                      38             36            142
tests/test_dspy_integration.py                                 54             32            139
tests/test_lesson_selector_integration.py                      45             25            138
tests/test_server_elicitation.py                               47             17            137
tests/test_dspy_basic.py                                       49             31            131
tests/benchmark_context_selector.py                            32             26            130
tests/test_tools_save.py                                       35             25            129
tests/test_acp_adapter.py                                      42             33            128
tests/test_llm_models.py                                       43             31            127
tests/test_active_context.py                                   41             22            126
tests/test_tools_token_awareness.py                            59             47            126
tests/test_chat.py                                             76             96            124
tests/test_prompt.py                                           36             36            120
tests/test_util_clipboard_paste.py                             27             14            117
tests/test_prompt_tools.py                                     23             10            116
tests/test_tools_python.py                                     50             16            114
tests/test_lessons_status.py                                   67             96            113
tests/test_reduce.py                                           30             22            113
tests/test_cost_awareness_delayed_warning.py                   42             32            108
tests/test_server_v2_tool_confirmation.py                      32             32            107
tests/test_git_worktree.py                                     31             19            102
tests/test_llm_validate.py                                     25             19            102
tests/test_tools_tts.py                                        50             58            101
tests/test_command_completion.py                               33             23            100
tests/test_session.py                                          40             21             95
tests/test_util_gh.py                                          44             37             92
tests/test_tools_choice.py                                     47             24             91
tests/test_agent_memory.py                                     26             17             90
tests/test_browser_lynx.py                                     35             15             90
tests/test_prompts.py                                          37             35             87
tests/test_server_v2_auto_stepping.py                          20             22             87
tests/test_util_tokens.py                                      52             21             86
tests/test_server_auth.py                                      40             19             84
tests/test_tools_read.py                                       27             11             84
tests/context/test_adaptive_compressor.py                      35             23             80
tests/test_util.py                                             42             85             78
tests/test_markdown_validation.py                              43             34             75
tests/test_shell_issue729.py                                   50             52             75
tests/test_util_output_storage.py                              18             10             75
tests/test_custom_providers.py                                 32             44             74
tests/test_shell_issue772.py                                   48             47             73
tests/test_browser.py                                          34             31             72
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_eval.py                                             10              8             57
tests/test_chat_history.py                                     14             12             56
tests/test_server_v2_sse.py                                    15             13             50
tests/test_dspy_gepa.py                                        18              9             46
tests/test_util_generate_name.py                               17             10             45
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_prompt_skills_summary.py                            24             22             39
tests/test_shell_fd_leak.py                                    23             16             39
tests/test_utils.py                                            14             17             38
tests/test_util_export.py                                      20             11             36
tests/test_message_command.py                                  13             12             35
tests/test_tools_chats.py                                      12             10             34
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_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_screenshot.py                                        9              6             15
-----------------------------------------------------------------------------------------------
SUM:                                                         8590           6965          25112
-----------------------------------------------------------------------------------------------
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                        74             51            485
gptme/eval/run.py                         58             50            354
gptme/eval/execenv.py                     54             96            350
gptme/eval/filestore.py                   11              8             63
gptme/eval/types.py                       22             19             58
gptme/eval/cost.py                        12             24              6
gptme/eval/__init__.py                     1              0              4
gptme/eval/__main__.py                     1              0              3
-------------------------------------------------------------------------------------
SUM:                                     233            248           1323
-------------------------------------------------------------------------------------
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/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/agents/__init__.py gptme/eval/agents/swebench.py gptme/eval/cost.py gptme/eval/swe_extra/swe_bench_test_spec.py gptme/eval/swe_extra/swe_bench_extra_data.py gptme/eval/swe_extra/__init__.py gptme/eval/swe_extra/swe_bench_constants.py gptme/eval/swe_extra/run_swe_extra.py gptme/eval/execenv.py gptme/eval/run.py gptme/eval/__main__.py gptme/eval/swebench/info.py gptme/eval/swebench/main.py gptme/eval/swebench/utils.py gptme/eval/swebench/__init__.py gptme/eval/swebench/evaluate.py gptme/eval/swebench/__main__.py gptme/info.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/cli/auth.py gptme/agent/service.py gptme/agent/doctor.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/client.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/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/llm_openai_subscription.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_gptme.py gptme/llm/llm_openai.py gptme/hooks/auto_confirm.py gptme/hooks/test.py gptme/hooks/cwd_changed.py gptme/hooks/time_awareness.py gptme/hooks/tests/test_active_context.py gptme/hooks/tests/test_cwd_awareness.py gptme/hooks/tests/test_cli_confirm.py gptme/hooks/tests/test_confirm.py gptme/hooks/tests/test_cost_awareness.py gptme/hooks/tests/test_cache_awareness.py gptme/hooks/tests/__init__.py gptme/hooks/tests/test_time_awareness.py gptme/hooks/tests/test_server_confirm.py gptme/hooks/tests/test_server_elicit.py gptme/hooks/tests/test_workspace_agents.py gptme/hooks/tests/test_elicitation.py gptme/hooks/tests/test_form_autodetect.py gptme/hooks/tests/test_agents_md_inject.py gptme/hooks/tests/test_markdown_validation.py gptme/hooks/tests/test_auto_confirm.py gptme/hooks/tests/test_token_awareness.py gptme/hooks/token_awareness.py gptme/hooks/server_elicit.py gptme/hooks/cli_confirm.py gptme/hooks/markdown_validation.py gptme/hooks/__init__.py gptme/hooks/cwd_awareness.py gptme/hooks/agents_md_inject.py gptme/hooks/active_context.py gptme/hooks/cost_awareness.py gptme/hooks/workspace_agents.py gptme/hooks/form_autodetect.py gptme/hooks/elicitation.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/profiles.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/git_worktree.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/tool_format.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/elicit.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/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_server_elicitation.py tests/test_tools_form.py tests/test_lesson_selector_integration.py tests/test_active_context.py tests/test_lessons_tool.py tests/test_acp_adapter.py tests/test_telemetry.py tests/test_prompt.py tests/test_server_v2_sse.py tests/test_util_tree.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_tools_elicit.py tests/test_server_auth.py tests/test_tool_use.py tests/test_reduce.py tests/test_tools_todo.py tests/test_util_export.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_util_cli_skills.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_acp_types.py tests/test_shell_fd_leak.py tests/test_hooks_cwd_changed.py tests/test_auto_compact.py tests/test_llm_openai.py tests/test_util_tokens.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_util_generate_name.py tests/test_acp_client.py tests/test_hybrid_lessons.py tests/test_acp_protocol_logging.py tests/test_tools_read.py tests/test_tool_loading_duplicate.py tests/test_uri.py tests/test_onboard.py tests/test_tools_rag.py tests/test_agent_memory.py tests/test_acp_agent.py tests/test_git_worktree.py tests/test_cli.py tests/test_agent_doctor.py tests/test_cost_display.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_shell_allowlist_autoconfirm.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_autocompact_scoring.py tests/test_command_completion.py tests/test_workspace_agents.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_lessons_parser.py tests/test_gptme_provider.py tests/test_browser_lynx.py tests/test_agents_md_inject.py tests/test_server.py tests/test_server_v2_hooks.py tests/test_tools_choice.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_util_output_storage.py tests/test_llm_utils.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_acp_stdout.py tests/test_tools_save.py tests/test_tools_shell_multiline.py tests/test_tools.py tests/test_util_clipboard_paste.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_profiles.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                                                329            438           1543
tests/test_acp_agent.py                                             311            178           1043
tests/test_llm_openai.py                                            268            170            978
gptme/acp/agent.py                                                  176            269            903
gptme/llm/llm_openai.py                                             213            219            870
gptme/llm/models.py                                                 128            144            853
gptme/tools/subagent.py                                             229            445            838
gptme/config.py                                                     212            209            776
tests/test_tools_subagent.py                                        277            150            771
gptme/tools/autocompact.py                                          222            308            760
gptme/server/api_v2_sessions.py                                     175            181            737
gptme/cli/util.py                                                   210            104            708
tests/test_tools_shell.py                                           245            386            705
tests/test_agent.py                                                 199            110            664
gptme/llm/llm_anthropic.py                                          147            163            650
gptme/eval/dspy/tasks.py                                            170            374            639
gptme/hooks/workspace_agents.py                                     147            102            616
gptme/tools/mcp_adapter.py                                          206            210            608
gptme/hooks/__init__.py                                             170            211            598
gptme/server/tasks_api.py                                           171            110            596
gptme/prompts.py                                                    174            250            594
gptme/cli/main.py                                                    91             85            592
gptme/logmanager.py                                                 137            165            564
gptme/tools/base.py                                                 138            160            553
tests/test_auto_compact.py                                          227            189            543
tests/test_util_gh_mocked.py                                        106             92            534
tests/test_config.py                                                146            270            513
gptme/server/api_v2.py                                              110             72            493
gptme/eval/main.py                                                   74             51            485
gptme/cli/setup.py                                                  113             58            476
gptme/server/openapi_docs.py                                        182            142            476
gptme/llm/llm_openai_subscription.py                                129             95            458
gptme/tools/computer.py                                             155            223            450
gptme/util/context.py                                               118            174            446
scripts/analyze_compression.py                                      103             68            446
tests/test_lessons_commands.py                                      157             82            422
gptme/util/prompt.py                                                103            151            410
scripts/github_bot.py                                                84             79            409
gptme/server/api.py                                                  98            100            399
tests/test_tools_computer.py                                        159             93            396
tests/test_codeblock.py                                             262            619            394
gptme/eval/dspy/prompt_optimizer.py                                 106             86            393
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/cli/doctor.py                                                  71             58            379
gptme/chat.py                                                        69             90            377
gptme/agent/cli.py                                                  105            125            369
gptme/hooks/tests/test_workspace_agents.py                          102             36            368
gptme/util/_telemetry.py                                            106            123            357
tests/test_profiles.py                                               84             30            356
gptme/eval/dspy/cli.py                                               73             57            355
gptme/eval/run.py                                                    58             50            354
gptme/eval/dspy/experiments.py                                       94             60            350
gptme/eval/execenv.py                                                54             96            350
gptme/tools/gh.py                                                    85            121            348
tests/test_llm_anthropic.py                                          64             26            348
gptme/tools/tmux.py                                                  95            171            346
gptme/eval/dspy/metrics.py                                           97             98            344
tests/test_integration_phase4.py                                     67             54            344
gptme/hooks/tests/test_elicitation.py                                91             45            343
gptme/telemetry.py                                                   85             54            342
tests/test_lessons_parser.py                                        152            176            340
gptme/tools/mcp.py                                                  104            105            336
gptme/agent/workspace.py                                            120            206            323
gptme/llm/__init__.py                                                79             79            322
tests/test_mcp_discovery.py                                          97             39            315
gptme/message.py                                                     74            102            313
gptme/hooks/tests/test_confirm.py                                   100             59            309
tests/test_cli.py                                                    84             61            307
gptme/util/gh.py                                                     66             86            305
gptme/mcp/client.py                                                  93            104            300
scripts/gh-pr-view-with-pr-comments.py                               55             36            299
tests/test_workspace_agents.py                                      137             57            296
gptme/info.py                                                        85             70            293
tests/test_lessons_matcher.py                                        89             80            288
tests/lessons/test_wildcard_matching.py                             114            125            287
gptme/tools/tts.py                                                  119            132            286
tests/test_mcp_adapter.py                                            95             52            286
gptme/tools/_browser_playwright.py                                   85             39            285
gptme/eval/dspy/hybrid_optimizer.py                                 141            345            282
tests/test_llm_utils.py                                              66             49            281
gptme/agent/doctor.py                                                66             30            280
tests/test_lessons_index.py                                          96             77            280
gptme/tools/browser.py                                              113            165            278
tests/test_message.py                                               111            105            275
tests/test_doctor.py                                                 92             63            270
gptme/eval/swe_extra/swe_bench_test_spec.py                          52             29            267
gptme/tools/save.py                                                  57             58            261
gptme/tools/patch.py                                                 62             95            257
tests/test_context_selector.py                                       83             45            254
gptme/hooks/tests/test_form_autodetect.py                            73             25            253
gptme/tools/__init__.py                                              84             67            253
tests/conftest.py                                                    79             70            252
tests/test_lessons_integration.py                                    97             66            252
gptme/plugins/__init__.py                                            84            119            248
gptme/llm/llm_openai_models.py                                        3             14            246
gptme/tools/lessons.py                                               92            105            244
tests/test_complete.py                                               56             40            241
gptme/acp/client.py                                                  61            115            237
gptme/context/task_analyzer.py                                      100            124            237
gptme/commands/meta.py                                               54             20            234
gptme/context/adaptive_compressor.py                                 76            130            232
gptme/tools/todo.py                                                  95            109            232
tests/test_auto_naming.py                                            69             45            232
tests/test_hooks.py                                                 114             46            232
tests/test_server_v2.py                                              70             35            231
gptme/hooks/tests/test_cost_awareness.py                             49             37            227
gptme/util/auto_naming.py                                            68             78            224
gptme/hooks/tests/test_token_awareness.py                            37             28            223
tests/test_cost_display.py                                           27             20            220
gptme/tools/python.py                                                72             84            219
gptme/hooks/tests/test_cli_confirm.py                                75             23            218
gptme/mcp/registry.py                                                59             70            216
tests/test_lessons_tool.py                                           62             34            216
gptme/lessons/index.py                                               91            128            214
gptme/eval/swe_extra/swe_bench_extra_data.py                         69             51            213
gptme/hooks/elicitation.py                                           90            132            213
gptme/lessons/commands.py                                            91             48            213
tests/test_autocompact_scoring.py                                    86             39            208
tests/test_tools.py                                                  96             47            208
tests/test_mcp.py                                                    58             45            207
gptme/profiles.py                                                    64             67            205
tests/test_agent_doctor.py                                           59             26            205
gptme/util/_sound_sounddevice.py                                     52             46            204
tests/test_plugins.py                                                82             70            203
gptme/cli/auth.py                                                    47             28            202
gptme/util/sound.py                                                  65             72            200
gptme/commands/llm.py                                                50             49            199
gptme/hooks/tests/test_active_context.py                             37             29            198
gptme/tools/precommit.py                                             64             87            194
gptme/hooks/tests/test_server_elicit.py                              58             23            192
gptme/lessons/parser.py                                              70            108            192
gptme/cli/onboard.py                                                 61             52            188
tests/test_execenv.py                                                52             42            187
tests/test_logmanager.py                                             56             50            187
gptme/tools/morph.py                                                 43             47            185
tests/test_agents_md_inject.py                                       37             29            181
gptme/hooks/tests/test_server_confirm.py                             48             29            179
tests/test_dspy_hybrid.py                                            65             45            179
gptme/context/selector/file_selector.py                              50             62            178
scripts/reduce_context.py                                            59             72            176
tests/test_hooks_cwd_changed.py                                      55             24            176
tests/test_server_v2_hooks.py                                        71             52            175
gptme/server/workspace_api.py                                        57             55            173
tests/test_tools_todo.py                                             81             65            173
gptme/codeblock.py                                                   34             97            171
gptme/hooks/tests/test_agents_md_inject.py                           31             19            171
tests/test_acp_types.py                                              35             12            171
tests/test_context.py                                                80             56            171
gptme/commands/session.py                                            58             47            170
gptme/llm/validate.py                                                30             28            170
tests/test_tool_use.py                                               20             26            169
tests/test_server.py                                                 52             39            168
tests/test_util_cli.py                                               55             32            168
tests/test_tools_elicit.py                                           50             25            167
tests/test_tree.py                                                   59             37            167
tests/test_acp_protocol_logging.py                                   56             15            160
tests/test_acp_client.py                                             64             34            159
tests/test_uri.py                                                    55             30            158
gptme/tools/_browser_thread.py                                       27             12            156
tests/test_tools_patch.py                                            85            203            156
gptme/util/__init__.py                                               34             29            155
tests/test_tools_time_awareness.py                                   52             34            155
tests/test_cost_tracker.py                                           21             24            154
tests/test_tools_tmux.py                                             69             63            154
gptme/llm/utils.py                                                   54             73            153
tests/test_acp_stdout.py                                             79             37            152
tests/test_util_cli_skills.py                                        59             41            151
tests/test_util_tree.py                                              44             33            151
gptme/eval/agents/swebench.py                                        26             22            150
gptme/tools/restart.py                                               51             81            150
gptme/acp/__main__.py                                                58             70            149
gptme/util/reduce.py                                                 45             42            147
scripts/check_rst_formatting.py                                      41             52            147
tests/test_master_context.py                                         39             24            147
gptme/tools/rag.py                                                   62             74            146
gptme/tools/form.py                                                  38             55            145
gptme/util/cost_display.py                                           39             31            145
tests/test_file_selector_integration.py                              50             23            145
tests/test_gptme_provider.py                                         66             20            143
gptme/hooks/token_awareness.py                                       44             50            142
gptme/tools/chats.py                                                 43             48            142
tests/test_shell_allowlist_autoconfirm.py                            38             36            142
gptme/server/client.py                                               60             78            139
gptme/util/tool_format.py                                            45             72            139
tests/test_dspy_integration.py                                       54             32            139
gptme/hooks/cli_confirm.py                                           41             37            138
tests/test_lesson_selector_integration.py                            45             25            138
tests/test_server_elicitation.py                                     47             17            137
gptme/tools/elicit.py                                                36            109            135
gptme/hooks/cost_awareness.py                                        45             56            133
gptme/server/cli.py                                                  26             13            133
gptme/eval/suites/basic.py                                           27              5            132
gptme/lessons/hybrid_matcher.py                                      53             79            132
tests/test_dspy_basic.py                                             49             31            131
tests/benchmark_context_selector.py                                  32             26            130
tests/test_tools_save.py                                             35             25            129
gptme/hooks/cache_awareness.py                                       95            138            128
tests/test_acp_adapter.py                                            42             33            128
gptme/llm/llm_gptme.py                                               47             58            127
tests/test_llm_models.py                                             43             31            127
gptme/commands/base.py                                               54             58            126
tests/test_active_context.py                                         41             22            126
tests/test_tools_token_awareness.py                                  59             47            126
gptme/hooks/tests/test_cache_awareness.py                            47             34            125
gptme/hooks/tests/test_markdown_validation.py                        29             20            125
tests/test_chat.py                                                   76             96            124
gptme/hooks/form_autodetect.py                                       48             65            123
gptme/commands/export.py                                             31             21            122
gptme/hooks/server_confirm.py                                        51             58            122
gptme/server/auth.py                                                 45             69            121
gptme/eval/agents/__init__.py                                        22             11            120
tests/test_prompt.py                                                 36             36            120
gptme/tools/read.py                                                  23             23            119
gptme/util/clipboard.py                                              22             12            118
tests/test_util_clipboard_paste.py                                   27             14            117
tests/test_prompt_tools.py                                           23             10            116
scripts/auto_rename_logs.py                                          34             23            115
gptme/tools/complete.py                                              33             42            114
tests/test_tools_python.py                                           50             16            114
gptme/hooks/server_elicit.py                                         52             56            113
tests/test_lessons_status.py                                         67             96            113
tests/test_reduce.py                                                 30             22            113
gptme/eval/swebench/evaluate.py                                      25              7            110
gptme/hooks/confirm.py                                               53             88            109
gptme/hooks/tests/test_time_awareness.py                             36             11            109
gptme/util/cost_tracker.py                                           43             62            109
scripts/gpt_todoer.py                                                47             25            108
tests/test_cost_awareness_delayed_warning.py                         42             32            108
tests/test_server_v2_tool_confirmation.py                            32             32            107
gptme/util/ask_execute.py                                            30             41            106
gptme/tools/choice.py                                                31             37            105
scripts/train/collect.py                                             35             52            104
gptme/init.py                                                        24             30            103
gptme/dirs.py                                                        42             31            102
gptme/lessons/matcher.py                                             35             47            102
tests/test_git_worktree.py                                           31             19            102
tests/test_llm_validate.py                                           25             19            102
tests/test_tools_tts.py                                              50             58            101
gptme/hooks/active_context.py                                        25             23            100
tests/test_command_completion.py                                     33             23            100
tests/test_session.py                                                40             21             95
gptme/server/api_v2_common.py                                        56             34             92
tests/test_util_gh.py                                                44             37             92
tests/test_tools_choice.py                                           47             24             91
gptme/acp/types.py                                                   25             13             90
gptme/lessons/matcher_enhanced.py                                    26             40             90
tests/test_agent_memory.py                                           26             17             90
tests/test_browser_lynx.py                                           35             15             90
gptme/server/api_v2_agents.py                                        24             15             89
gptme/util/tree.py                                                   21             15             87
tests/test_prompts.py                                                37             35             87
tests/test_server_v2_auto_stepping.py                                20             22             87
gptme/util/export.py                                                 17             25             86
tests/test_util_tokens.py                                            52             21             86
gptme/tools/_browser_perplexity.py                                   25             22             85
scripts/treeofthoughts.py                                            28             29             85
gptme/hooks/time_awareness.py                                        29             31             84
tests/test_server_auth.py                                            40             19             84
tests/test_tools_read.py                                             27             11             84
gptme/util/git_worktree.py                                           25             33             83
scripts/convert_convo.py                                             34             54             82
gptme/commands/__init__.py                                           14             21             80
gptme/eval/swebench/main.py                                          13              4             80
gptme/eval/swebench/utils.py                                         19              0             80
tests/context/test_adaptive_compressor.py                            35             23             80
gptme/eval/swe_extra/run_swe_extra.py                                16             14             79
gptme/lessons/auto_include.py                                        31             26             78
tests/test_util.py                                                   42             85             78
gptme/context/compress.py                                            63            131             76
gptme/tools/autocommit.py                                            37             58             75
tests/test_markdown_validation.py                                    43             34             75
tests/test_shell_issue729.py                                         50             52             75
tests/test_util_output_storage.py                                    18             10             75
gptme/hooks/tests/test_cwd_awareness.py                              13             12             74
tests/test_custom_providers.py                                       32             44             74
tests/test_shell_issue772.py                                         48             47             73
tests/test_browser.py                                                34             31             72
gptme/session.py                                                     39             64             70
gptme/context/selector/llm_based.py                                  32             38             69
gptme/util/generate_name.py                                           5              6             69
tests/test_hooks_form_autodetect.py                                  22             34             68
gptme/tools/screenshot.py                                            23             29             67
tests/test_tools_form.py                                             22             19             67
gptme/eval/swe_extra/swe_bench_constants.py                           9              9             66
gptme/util/master_context.py                                         28             38             66
gptme/__version__.py                                                 15             11             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/tools/vision.py                                                20             13             62
gptme/util/_sound_cmd.py                                             22             17             62
gptme/hooks/agents_md_inject.py                                      23             31             61
tests/test_shell_output_mixing_issue408.py                           25             29             60
gptme/context/selector/rule_based.py                                 20             13             59
gptme/util/uri.py                                                    29             42             59
tests/test_server_client.py                                          33             26             59
gptme/eval/types.py                                                  22             19             58
tests/test_eval.py                                                   10              8             57
gptme/eval/dspy/signatures.py                                        19             21             56
gptme/tools/_browser_lynx.py                                         12             13             56
tests/test_chat_history.py                                           14             12             56
gptme/context/selector/file_integration.py                           13             10             55
gptme/hooks/cwd_changed.py                                           15             11             54
gptme/util/output_storage.py                                         26             36             54
scripts/describe_api.py                                              28             25             54
gptme/hooks/markdown_validation.py                                   36             41             51
tests/test_server_v2_sse.py                                          15             13             50
gptme/eval/swebench/info.py                                           8              3             48
tests/test_dspy_gepa.py                                              18              9             46
tests/test_util_generate_name.py                                     17             10             45
gptme/util/tokens.py                                                 20             12             44
gptme/util/cost.py                                                   11              9             43
tests/test_pdf_to_images.py                                          13             13             43
gptme/context/selector/file_config.py                                10              8             41
tests/test_onboard.py                                                11             10             41
gptme/lessons/selector_config.py                                     18             20             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_prompt_skills_summary.py                                  24             22             39
tests/test_shell_fd_leak.py                                          23             16             39
tests/test_utils.py                                                  14             17             38
tests/test_util_export.py                                            20             11             36
tests/test_message_command.py                                        13             12             35
gptme/cli/wut.py                                                     13             12             34
gptme/util/terminal.py                                               23             21             34
tests/test_tools_chats.py                                            12             10             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/hooks/tests/test_auto_confirm.py                               12              4             32
scripts/list_user_messages.py                                        10              9             32
gptme/util/install.py                                                13             25             30
gptme/util/content.py                                                18             24             29
gptme/hooks/cwd_awareness.py                                         11             17             28
tests/test_telemetry.py                                              20             15             28
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/acp/adapter.py                                                 19             22             25
gptme/constants.py                                                   17             19             25
gptme/executor.py                                                    18             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/selector/base.py                                       14             23             23
gptme/util/interrupt.py                                              13             15             23
gptme/acp/__init__.py                                                 5             13             21
gptme/context/__init__.py                                             3              8             21
gptme/context/selector/config.py                                      8              8             21
gptme/util/useredit.py                                               12             13             21
gptme/agent/__init__.py                                               3              6             19
gptme/context/config.py                                              11             25             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/eval/suites/browser.py                                          5              0             17
gptme/eval/swebench/__init__.py                                       1              0             16
gptme/cli/__init__.py                                                10             13             15
tests/test_screenshot.py                                              9              6             15
gptme/mcp/__init__.py                                                 1              0             14
gptme/__main__.py                                                     2              0             12
gptme/__init__.py                                                     1              0              7
gptme/eval/dspy/__init__.py                                           6              6              7
gptme/eval/cost.py                                                   12             24              6
gptme/eval/__init__.py                                                1              0              4
gptme/eval/__main__.py                                                1              0              3
gptme/eval/dspy/__main__.py                                           3              5              3
gptme/eval/swebench/__main__.py                                       1              0              3
gptme/server/__init__.py                                              2              3              3
gptme/server/__main__.py                                              1              0              3
gptme/server/constants.py                                             1              3              1
-----------------------------------------------------------------------------------------------------
SUM:                                                              22008          21841          73079
-----------------------------------------------------------------------------------------------------
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: 384
  Total blocks: 5129
  Average complexity: 4.063755117956717

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 573:0 prompt_workspace - E
      F 822:0 prompt_chat_history - E
      F 69: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 321:0 main - D
  gptme/info.py
      F 334:0 format_version_info - D
  gptme/cli/main.py
  gptme/cli/util.py
      F 514:0 skills_list - D
  gptme/telemetry.py
      F 286:0 record_llm_request - E
  gptme/commands/llm.py
      F 129:0 cmd_tools - D
  gptme/commands/meta.py
      F 138:0 cmd_plugin - E
  gptme/acp/agent.py
      M 518:4 GptmeAgent.new_session - D
  gptme/config.py
      F 1058:0 setup_config_from_cli - E
      M 907:4 Config.mcp - D
  gptme/server/api_v2_sessions.py
      F 253:0 step - E
  gptme/server/tasks_api.py
      F 358:0 get_git_status - D
  gptme/server/openapi_docs.py
      F 549:0 _convert_to_openapi_nullable - D
  gptme/lessons/index.py
      M 96:4 LessonIndex._default_dirs - D
  gptme/codeblock.py
      F 84:0 _extract_codeblocks - E
  gptme/llm/llm_anthropic.py
  gptme/llm/models.py
      F 663:0 get_model - E
  gptme/llm/__init__.py
      F 224:0 _reply_stream - D
  gptme/llm/llm_openai.py
      F 204:0 init - D
      F 932:0 _transform_msgs_for_special_provider - D
      F 603:0 stream - D
  gptme/hooks/token_awareness.py
      F 88:0 add_token_usage_warning - D
  gptme/hooks/__init__.py
      M 411:4 HookRegistry.trigger - D
  gptme/plugins/__init__.py
      F 145:0 _load_plugin - D
  gptme/chat.py
      F 280:0 _process_message_conversation - D
  gptme/util/tool_format.py
      F 86:0 format_tools_list - D
  gptme/util/gh.py
  gptme/util/context.py
      F 618:0 _resource_to_codeblock - E
      F 446:0 include_paths - D
  gptme/util/prompt.py
      M 296:4 GptmeCompleter.get_completions - D
  gptme/tools/lessons.py
      F 190:0 auto_include_lessons_hook - D
  gptme/tools/shell.py
      M 963:4 ShellSession._read_output_unix - E
      F 2085:0 _shorten_stdout - E
      M 91:4 BackgroundJob._read_output - D
      M 688:4 ShellSession._run_pipe - D
      M 821:4 ShellSession._read_output_windows - D
      F 1942:0 execute_shell - D
  gptme/tools/gh.py
      F 57:0 _wait_for_checks - D
  gptme/tools/subagent.py
      F 331:0 _create_subagent_thread - D
  gptme/tools/__init__.py
      F 132:0 init_tools - D
  gptme/tools/tmux.py
      F 374:0 execute_tmux - D
  gptme/tools/computer.py
      F 459:0 computer - D
  gptme/tools/autocompact.py
  gptme/tools/mcp.py
  tests/test_server_v2_auto_stepping.py
      F 16:0 test_auto_stepping - E
  tests/test_config.py
      F 525:0 test_project_config_loaded_from_toml - D
      F 558: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 176:4 PRViewer.get_comments - D
  scripts/auto_rename_logs.py
      F 32:0 auto_rename_logs - D

Largest Files (>300 SLOC):
  1654 gptme/tools/shell.py
  1043 tests/test_acp_agent.py
   981 tests/test_llm_openai.py
   955 gptme/tools/subagent.py
   947 gptme/eval/dspy/tasks.py
   913 tests/test_tools_shell.py
   903 gptme/acp/agent.py
   872 gptme/llm/models.py
   871 gptme/llm/llm_openai.py
   778 gptme/tools/autocompact.py
   778 gptme/config.py
   771 tests/test_tools_subagent.py
   751 tests/test_codeblock.py
   737 gptme/server/api_v2_sessions.py
   726 tests/test_config.py
   712 gptme/cli/util.py
   664 tests/test_agent.py
   652 gptme/prompts.py
   652 gptme/llm/llm_anthropic.py
   617 gptme/hooks/workspace_agents.py
   617 gptme/cli/main.py
   608 gptme/tools/mcp_adapter.py
   600 gptme/hooks/__init__.py
   596 gptme/server/tasks_api.py
   580 tests/test_auto_compact.py
   567 gptme/logmanager.py
   559 gptme/tools/base.py
   541 tests/test_util_gh_mocked.py
   506 gptme/tools/computer.py
   500 gptme/server/openapi_docs.py
   493 gptme/server/api_v2.py
   487 gptme/eval/main.py
   485 gptme/cli/setup.py
   480 gptme/llm/llm_openai_subscription.py
   461 gptme/util/context.py
   450 tests/test_lessons_parser.py
   445 scripts/analyze_compression.py
   437 gptme/tools/gh.py
   433 gptme/tools/tmux.py
   430 gptme/util/prompt.py
   422 tests/test_lessons_commands.py
   418 scripts/github_bot.py
   408 tests/test_tools_computer.py
   400 gptme/server/api.py
   398 gptme/agent/service.py
   394 gptme/eval/dspy/prompt_optimizer.py
   389 tests/context/test_task_analyzer.py
   380 tests/test_util_cli_mcp.py
   379 gptme/cli/doctor.py
   377 gptme/chat.py
   372 gptme/agent/workspace.py
   369 gptme/agent/cli.py
   368 gptme/hooks/tests/test_workspace_agents.py
   362 gptme/eval/execenv.py
   357 gptme/util/_telemetry.py
   356 tests/test_profiles.py
   355 gptme/eval/run.py
   355 gptme/eval/dspy/experiments.py
   355 gptme/eval/dspy/cli.py
   352 gptme/tools/mcp.py
   349 gptme/eval/dspy/metrics.py
   348 tests/test_llm_anthropic.py
   346 tests/lessons/test_wildcard_matching.py
   344 tests/test_integration_phase4.py
   343 gptme/hooks/tests/test_elicitation.py
   342 gptme/telemetry.py
   331 gptme/tools/browser.py
   327 tests/test_tools_patch.py
   322 gptme/util/gh.py
   322 gptme/llm/__init__.py
   320 gptme/message.py
   316 tests/test_cli.py
   315 tests/test_mcp_discovery.py
   309 gptme/hooks/tests/test_confirm.py
   308 tests/test_lessons_matcher.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 [92:5 - 103:67] (11 lines, 101 tokens)
   gptme/util/_sound_sounddevice.py [52:5 - 63:27]

Clone found (python):
 - gptme/tools/patch.py [317:5 - 331: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 [200:5 - 210:43] (10 lines, 76 tokens)
   gptme/server/api_v2.py [198:5 - 208:12]

Clone found (python):
 - gptme/server/api.py [211:5 - 229:2] (18 lines, 164 tokens)
   gptme/server/api_v2.py [208:5 - 226:2]

Clone found (python):
 - gptme/server/api.py [266:5 - 286:4] (20 lines, 172 tokens)
   gptme/server/api_v2.py [267:5 - 290:4]

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

Clone found (python):
 - gptme/llm/validate.py [200:37 - 214:14] (14 lines, 99 tokens)
   gptme/llm/validate.py [183:40 - 197:19]

Clone found (python):
 - gptme/llm/validate.py [217:29 - 228:45] (11 lines, 93 tokens)
   gptme/llm/validate.py [183:40 - 194:45]

Clone found (python):
 - gptme/llm/llm_anthropic.py [455:5 - 488:54] (33 lines, 248 tokens)
   gptme/llm/llm_anthropic.py [365:5 - 398:20]

Clone found (python):
 - gptme/llm/llm_anthropic.py [499:7 - 512:2] (13 lines, 106 tokens)
   gptme/llm/llm_anthropic.py [408:7 - 421:69]

Clone found (python):
 - gptme/hooks/tests/test_time_awareness.py [130:24 - 136:3] (6 lines, 77 tokens)
   gptme/hooks/tests/test_time_awareness.py [112:28 - 118:2]

Clone found (python):
 - gptme/hooks/tests/test_time_awareness.py [144:23 - 150:2] (6 lines, 77 tokens)
   gptme/hooks/tests/test_time_awareness.py [112:28 - 118:2]

Clone found (python):
 - gptme/hooks/tests/test_server_confirm.py [244:4 - 256:3] (12 lines, 124 tokens)
   gptme/hooks/tests/test_server_elicit.py [261:4 - 273:3]

Clone found (python):
 - gptme/hooks/tests/test_agents_md_inject.py [105:2 - 120:3] (15 lines, 112 tokens)
   gptme/hooks/tests/test_agents_md_inject.py [73:43 - 88:3]

Clone found (python):
 - gptme/hooks/tests/test_agents_md_inject.py [153:24 - 169:7] (16 lines, 116 tokens)
   gptme/hooks/tests/test_agents_md_inject.py [73:43 - 89:9]

Clone found (python):
 - gptme/hooks/tests/test_agents_md_inject.py [177:11 - 192:4] (15 lines, 104 tokens)
   gptme/hooks/tests/test_agents_md_inject.py [73:43 - 87:2]

Clone found (python):
 - gptme/hooks/tests/test_agents_md_inject.py [203:17 - 219:10] (16 lines, 118 tokens)
   gptme/hooks/tests/test_agents_md_inject.py [73:43 - 169:22]

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/agents/swebench.py [109:13 - 118:4] (9 lines, 93 tokens)
   gptme/eval/agents/swebench.py [85:9 - 92:3]

Clone found (python):
 - gptme/eval/execenv.py [173:9 - 195:50] (22 lines, 229 tokens)
   gptme/eval/execenv.py [64:8 - 85:6]

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

Clone found (python):
 - gptme/eval/execenv.py [359:4 - 373:10] (14 lines, 115 tokens)
   gptme/eval/execenv.py [130:2 - 144:4]

Clone found (python):
 - gptme/eval/execenv.py [436:9 - 460:6] (24 lines, 180 tokens)
   gptme/eval/execenv.py [158:9 - 72:3]

Clone found (python):
 - gptme/commands/meta.py [210:9 - 219:7] (9 lines, 90 tokens)
   gptme/commands/meta.py [161:9 - 170:6]

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

Clone found (python):
 - gptme/acp/client.py [388:5 - 395:14] (7 lines, 139 tokens)
   gptme/acp/client.py [238:9 - 245:5]

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 [303:5 - 326: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     │ 233            │ 62077       │ 399310       │ 35           │ 488 (0.79%)      │ 4038 (1.01%)      │
├────────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ css        │ 1              │ 173         │ 1045         │ 0            │ 0 (0%)           │ 0 (0%)            │
├────────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ javascript │ 1              │ 403         │ 3432         │ 0            │ 0 (0%)           │ 0 (0%)            │
├────────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ markup     │ 2              │ 284         │ 2336         │ 0            │ 0 (0%)           │ 0 (0%)            │
├────────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ markdown   │ 7              │ 1234        │ 8782         │ 0            │ 0 (0%)           │ 0 (0%)            │
├────────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ bash       │ 10             │ 603         │ 3191         │ 0            │ 0 (0%)           │ 0 (0%)            │
├────────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ url        │ 1              │ 2           │ 16           │ 0            │ 0 (0%)           │ 0 (0%)            │
├────────────┼────────────────┼─────────────┼──────────────┼──────────────┼──────────────────┼───────────────────┤
│ Total:     │ 255            │ 64776       │ 418112       │ 35           │ 488 (0.75%)      │ 4038 (0.97%)      │
└────────────┴────────────────┴─────────────┴──────────────┴──────────────┴──────────────────┴───────────────────┘
Found 35 clones.
Detection time:: 4.150s
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