← sources

Alpha to Beta, reduced code complexity score by 97% - 24.7k lines of core code survived

source: reddit (reddit:ClaudeCode)published 2026-11-18 07:06ingested 2026-11-19 02:39

retained text

https://preview.redd.it/yoq9nug0gb2i1.png?width=1209&format=png&auto=webp&s=f5de2f41bb399dee1d57b4a4a081b9702568d7d2

  
**TLDR: Code is cheap** \- I took an alpha vibecoded app and moved migrated it to a new repo, then run rewrites to lower complexity, while extracting specs and rules.   
  
Alpha had docs and sloppy code out of control, beta still a lot, but significantly reduced. It's a work in progress, this week I spent 100% of my weekly ultra plan in 36 hours to get the stats above - code in the **repo is down to 24.7k lines of code that matters.**  I think I can build the beta from here. 

Most of the analysis is from using [https://github.com/unclebob/ub-mode](https://github.com/unclebob/ub-mode) with some anti-slop ideas sprinkled on top. I still don't know why there are so many functions in .mjs code, is it counting closures or some shorthand?  


I started on October 30, and the process is still ongoing. I realized that I can not get results in the alpha repo anymore and it can not be repaired, the sheer number of markdowns at 268k made the model argue with itself and NEVER settle on precise rules. 



    3. ALPHA vs BETA NOW (different scopes, see section 1)

    --------------------------------------------------------------------------

    SIZE                      Alpha        Beta now    Change

    Source lines              316k         42.8k       -86.5%

    Source files              3.1k         511         -83.8%

    Functions                 20.0k        14.7k       -26.8%   

    Markdown lines            268k         23.0k       -91.4%

    Test cases                4.2k         2.9k        -30.6%   

    Spec lines              7.0k        3.5k       -49.9% 

    Rules lines             0              9.8k       

    Rules debt              ?              571         

    Commits                 3.6k           3.5k      



    COMPLEXITY (same definitions for JavaScript and TypeScript)

                              Alpha        Beta now    Change

    Functions above cc 10     4,419        550         -87.6%

    Functions above cc 30     1,050        90          -91.4%

    Above 10 per 1,000 lines  14.0         12.8        -8.5%

    Above 30 per 1,000 lines  3.3          2.1         -36.7%

    Erosion                   88.8%        56.9%       -31.9 points

    Cloned lines              9.1%         0.6%        -8.5 points

    Maintainability index     58.6         63.7        +5.1 (better)

    Verbosity                 9.8%         14.7%       +4.9 points (worse)

     

    CRAP (direction only)

                              Alpha        Beta now    Change

    Compound complexity       15M          460k        ~-97%

    Per 1,000 lines           47,430       10.7k       ~-77%

    Functions above CRAP 30   8,161        1,077       ~-87%

    2. THE CLEANUP: BETA START -> BETA NOW (like for like)

    --------------------------------------------------------------------------

                              Start        Now         Change

    All component code

      Lines of code           46.3k        42.8k       -7.6%

      Functions               15.9k        14.7k       -7.5%

      Tokens                  1,188k       901k        -24.2%

      Compound complexity     1,133k       460k        -59.4%

      Compound per 1,000 L    24.4k        10.7k       -56.1%

      Above complexity 30     240          90          -62.5%

      Above CRAP 30           1,515        1,077       -28.9%

      Above complexity 10     1,121        550         -50.9%

      Above 10 per 1,000 L    24.2         12.8        -47.1%

      Erosion                 76.4%        56.9%       -19.5 points

      Verbosity               13.4%        14.7%       +1.3 points (worse)

    Core code (the flat .mjs files of each component)

      Lines of code           33.3k        24.7k       -25.8%

      Functions               10.5k        9,023       -14.1%

      Files                   483          242         -49.9%

      Compound complexity     781k         299k        -61.7%

      Above complexity 30     174          61          -64.9%

      Above CRAP 30           1,125        710         -36.9%

      Above complexity 10     792          330         -58.3%

      Erosion                 76.9%        55.3%       -21.6 points

    Around the code (grew or held, not reduced)

      Spec lines              1,904        3,520       +84.9%

      Test cases (tests/)     409          2,949       +621%

      Rules lines             9,836        9,836       no change

      Rules debt              571          571         no change

      Commits                 2,905        3,507       +602



https://preview.redd.it/yabmqqj3gb2i1.png?width=1220&format=png&auto=webp&s=5508d0c6d879eb2b4277b97670cb2b70999ee97c

document fetched 2026-11-19 00:41 · canonical https://reddit.com/r/ClaudeCode/comments/1xz8t43/alpha_to_beta_reduced_code_complexity_score_by_97