Sloc Cloc and Code (scc)
scc powers searchcode.com — structured code intelligence over any repo, built for AI agents.
A tool similar to cloc, sloccount and tokei. For counting the lines of code, blank lines, comment lines, and physical lines of source code in many programming languages.
Goal is to be the fastest code counter possible, but also perform COCOMO calculation like sloccount, LOCOMO estimation for LLM-based development costs, estimate code complexity similar to cyclomatic complexity calculators and produce unique lines of code or DRYness metrics. In short one tool to rule them all.
Also it has a very short name which is easy to type scc.
If you don't like sloc cloc and code feel free to use the name Succinct Code Counter.
Licensed under MIT licence.
Table of Contents
- Install
- Background
- Pitch
- Usage
- Configuration Files
- Complexity Estimates
- Unique Lines of Code (ULOC)
- COCOMO
- LOCOMO
- Git Insight Reports
- HTML Report
- Output Formats
- Performance
- Development
- MCP Server Mode
- Adding/Modifying Languages
- Issues
- Badges
- Language Support
- Citation
scc for Teams & Enterprise
While scc will always be a free and open tool for individual developers, companies and businesses, we are exploring an enhanced version designed for teams and businesses. scc Enterprise will build on the core scc engine to provide historical analysis, team-level dashboards, and policy enforcement to help engineering leaders track code health, manage technical debt, and forecast project costs.
We are currently gathering interest for a private beta. If you want to visualize your codebase's evolution, integrate quality gates into your CI/CD pipeline, and get a big-picture view across all your projects, sign up for the early access list here
Install
Go Install
You can install scc by using the standard go toolchain.
To install the latest stable version of scc:
go install github.com/boyter/scc/v4@latest
To install a development version:
go install github.com/boyter/scc/v4@master
Note that scc needs go version >= 1.25.
Snap
A snap install exists thanks to Ricardo.
$ sudo snap install scc
NB Snap installed applications cannot run outside of /home
Homebrew
Or if you have Homebrew installed
$ brew install scc
Fedora
Fedora Linux users can use a COPR repository:
$ sudo dnf copr enable lihaohong/scc && sudo dnf install scc
MacPorts
On macOS, you can also install via MacPorts
$ sudo port install scc
Scoop
Or if you are using Scoop on Windows
$ scoop install scc
Chocolatey
Or if you are using Chocolatey on Windows
$ choco install scc
WinGet
Or if you are using WinGet on Windows
winget install --id benboyter.scc --source winget
FreeBSD
On FreeBSD, scc is available as a package
$ pkg install scc
Or, if you prefer to build from source, you can use the ports tree
$ cd /usr/ports/devel/scc && make install clean
Run in Docker
Go to the directory you want to run scc from.
Run the command below to run the latest release of scc on your current working directory:
docker run --rm -it -v "$PWD:/pwd:ro" --network none ghcr.io/boyter/scc:master scc /pwd
Manual
Binaries for Windows, GNU/Linux and macOS for both i386 and x86_64 machines are available from the releases page.
GitLab
Other
If you would like to assist with getting scc added into apt/chocolatey/etc... please submit a PR or at least raise an issue with instructions.
Background
Read all about how it came to be along with performance benchmarks,
scc
scc in GitLab
scc (press S to see speaker notes)
Other similar projects,
- SLOCCount the original sloc counter
- cloc, inspired by SLOCCount; implemented in Perl for portability
- gocloc a sloc counter in Go inspired by tokei
- loc rust implementation similar to tokei but often faster
- loccount Go implementation written and maintained by ESR
- polyglot ATS sloc counter
- tokei fast, accurate and written in rust
- sloc coffeescript code counter
- stto new Go code counter with a focus on performance
scc to process 40 TB of files from GitHub/Bitbucket/GitLab
Pitch
Why use scc?
- It is very fast and gets faster the more CPU you throw at it
- Accurate
- Works very well across multiple platforms without slowdown (Windows, Linux, macOS)
- Large language support
- Can ignore duplicate files
- Has complexity estimations
- You need to tell the difference between Coq and Verilog in the same directory
- cloc yaml output support so potentially a drop in replacement for some users
- Can identify or ignore minified files
- Able to identify many #! files ADVANCED!
- Can ignore large files by lines or bytes
- Can calculate the ULOC or unique lines of code by file, language or project
- Supports multiple output formats for integration, CSV, SQL, JSON, HTML and more
scc?
- You don't like Go for some reason
- It cannot count D source with different nested multi-line comments correctly
Differences
There are some important differences between scc and other tools that are out there. Here are a few important ones for you to consider.
Blank lines inside comments are counted as comments. While the line is technically blank the decision was made that once in a comment everything there should be considered a comment until that comment is ended. As such the following,
/* blank lines follow
*/
Would be counted as 4 lines of comments. This is noticeable when comparing scc's output to other tools on large repositories.
scc is able to count verbatim strings correctly. For example in C# the following,
``C#
private const string BasePath = @"a:\";
// The below is returned to the user as a version
private const string Version = "1.0.0";
Because of the prefixed @ this string ends at the trailing " by ignoring the escape character \ and as such should be
counted as 2 code lines and 1 comment. Some tools are unable to
deal with this and instead count up to the "1.0.0" as a string which can cause the middle comment to be counted as
code rather than a comment.
scc will also tell you the number of bytes it has processed (for most output formats) allowing you to estimate the
cost of running some static analysis tools.
Usage
Command line usage of scc is designed to be as simple as possible.
Full details can be found in scc --help or scc -h. Note that the below reflects the state of master not a release, as such
features listed below may be missing from your installation.text
$ scc -h
Sloc, Cloc and Code. Count lines of code in a directory with complexity estimation.
Version 4.1.0
Ben Boyter
Usage: scc [flags] [files or directories]
Examples: Count the current directory: scc
Count a specific folder or file: scc myproject/ scc main.go
Count several paths at once: scc src/ docs/ README.md
Show a per-file breakdown instead of the per-language summary: scc --by-file
Output as CSV or JSON (e.g. for further processing): scc --format csv scc --format json -o counts.json
Count an unrecognised extension as a known language: scc --count-as jsp:html
Count files matching a path pattern as a new category (glob by default): scc --count-as-pattern '*_spec.rb:Ruby Spec:Ruby'
Generate a self-contained HTML infographic report: scc --report scc --report=out.html --report-title "myrepo" --report-skip cocomo
Use a project config file (./.sccconfig) or a global one (precedence: global < project < CLI): export SCC_CONFIG_PATH=~/.sccconfig scc --config team.sccconfig
Tune the COCOMO cost estimate, or turn it off (see https://en.wikipedia.org/wiki/COCOMO): scc --avg-wage 75000 --cocomo-project-type semi-detached scc --no-cocomo
Flags:
--avg-wage int average wage value used for basic COCOMO calculation (default 56286)
--binary disable binary file detection
--buckets int time-bucket resolution for the git timeline reports (default 60)
--by-author render the author rollup report (bus factor and last-toucher attribution over recent git history)
--by-file display output for every file
-m, --character calculate max and mean characters per line
--ci enable CI output settings where stdout is ASCII
--cocomo-project-type string change COCOMO model type [organic, semi-detached, embedded, "custom,1,1,1,1"] (default "organic")
--cognitive calculate cognitive (nesting-weighted) complexity
--config string load this file as the global config source; overrides SCC_CONFIG_PATH, honored even with --no-config
--cost-comparison show both COCOMO and LOCOMO estimates side by side
--count-as string count extension as language [e.g. jsp:htm,chead:"C Header" maps extension jsp to html and chead to C Header]
--count-as-pattern stringArray count files matching a path pattern as a new named category backed by a base language [repeatable; pattern is glob by default, prefix with re: for regex; e.g. *_spec.rb:"Ruby Spec":Ruby or re:\.test\.js$:"JavaScript Tests":JavaScript]
--count-ignore set to allow .gitignore and .ignore files to be counted
--count-unsupported count files with an unrecognised language under an "Unknown" category as plain text
--coupling render the change-coupling report (file pairs that change together over recent git history)
--coupling-for string blast-radius view: given a file path, show what tends to change with it over recent git history
--coupling-weighted weight coupling by file complexity so pairs of complex files rank above generated/data-file churn (implies --coupling)
--currency-symbol string set currency symbol (default "$")
--debug enable debug output
--depth int commit window size for git history reports; 0 means entire history (large repos may be slow) (default 1000)
--directory-walker-job-workers int controls the maximum number of workers which will walk the directory tree (default 8)
-a, --dryness calculate the DRYness of the project (implies --uloc)
--eaf float the effort adjustment factor derived from the cost drivers (1.0 if rated nominal) (default 1)
--exclude-dir strings directories to exclude (default [.git,.hg,.svn])
-x, --exclude-ext strings ignore file extensions (overrides include-ext) [comma separated list: e.g. go,java,js]
-n, --exclude-file strings ignore files with matching names (default [package-lock.json,Cargo.lock,yarn.lock,pubspec.lock,Podfile.lock,pnpm-lock.yaml])
--exp-per-language-counters experimental, may change or be removed: count with the scanner written for the file's language where there is one, currently C, C Header and Java
--file-gc-count int number of files to parse before turning the GC on (default 10000)
--file-list-job-workers int number of goroutine workers that turn a walked path into a job to be counted (default 8)
--file-list-queue-size int the size of the queue of files found and ready to be read into memory (default 8)
--file-process-job-workers int number of goroutine workers that process files collecting stats (default 8)
--file-summary-job-queue-size int the size of the queue used to hold processed file statistics before formatting (default 8)
--find-root-config discover the project .sccconfig by walking up to the repository root instead of using ./.sccconfig
-f, --format string set output format [tabular, wide, json, json2, csv, csv-stream, cloc-yaml, html, html-table, sql, sql-insert, openmetrics] (default "tabular")
--format-multi string have multiple format output overriding --format [e.g. tabular:stdout,csv:file.csv,json:file.json]
--gen identify generated files
--generated-markers strings string markers in head of generated files (default [do not edit,
Output should look something like the below for the redis projecttext
$ scc redis
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Blanks Comments Code Complexity
───────────────────────────────────────────────────────────────────────────────
C 437 267,353 31,103 45,998 190,252 48,269
JSON 406 25,392 4 0 25,388 0
C Header 288 48,831 5,648 11,302 31,881 3,097
TCL 215 66,943 7,330 4,651 54,962 3,816
Shell 75 1,626 239 343 1,044 185
Python 34 4,802 694 498 3,610 621
Markdown 26 4,647 1,226 0 3,421 0
Autoconf 22 11,732 1,124 1,420 9,188 1,016
Lua 20 525 69 71 385 89
Makefile 20 1,956 368 170 1,418 85
YAML 20 2,696 147 53 2,496 0
MSBuild 11 1,995 2 0 1,993 160
Plain Text 10 1,773 313 0 1,460 0
Ruby 9 817 73 105 639 123
C++ 8 546 85 43 418 43
HTML 5 9,658 2,928 12 6,718 0
License 3 90 17 0 73 0
CMake 2 298 49 5 244 12
CSS 2 107 16 0 91 0
Systemd 2 80 6 0 74 0
BASH 1 143 16 5 122 38
Batch 1 28 2 0 26 3
C++ Header 1 9 1 3 5 0
Extensible Styleshe… 1 10 0 0 10 0
JavaScript 1 31 1 0 30 5
Module-Definition 1 11,375 2,116 0 9,259 167
SVG 1 1 0 0 1 0
Smarty Template 1 44 1 0 43 5
m4 1 951 218 64 669 0
───────────────────────────────────────────────────────────────────────────────
Total 1,624 464,459 53,796 64,743 345,920 57,734
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop (organic) $12,517,562
Estimated Schedule Effort (organic) 35.93 months
Estimated People Required (organic) 30.95
───────────────────────────────────────────────────────────────────────────────
Processed 16601962 bytes, 16.602 megabytes (SI)
───────────────────────────────────────────────────────────────────────────────
bash $ scc | nc paste.c-net.org 9999 https://paste.c-net.org/ExampleNote that you don't have to specify the directory you want to run against. Runningsccwill assume you want to run against the current directory.scc directory1 directory2 file1 file2You can also run against multiple files or directories
with the results aggregated in the output.sccSince
writes to standard output, there are many ways to easily share the results. For example, using netcat and one of many pastebins gives a public URL:
scc --ignore-file ~/.gitignore --ignore-file ./.dockerignore### Ignore Filessccsupports .ignore files inside directories that it scans. This is similar to how ripgrep, ag and tokei work. .ignore files are 100% the same as .gitignore files with the same syntax, and as suchsccwill ignore files and directories listed in them. You can add .ignore files to ignore things like vendored dependency checked in files and such. The idea is allowing you to add a file or folder to git and have ignored in the count..sccignoreIt also supports its own ignore file
if you wantsccto ignore things while having ripgrep, ag, tokei and others support them.--ignore-fileYou can also supply additional ignore files from outside the scanned tree with
. The file uses the same gitignore syntax and its patterns are anchored at the scan root (so/buildmatches only the top-levelbuild). This is handy for applying a shared ruleset such as a.dockerignoreor a personal global ignore:
The flag can be repeated and order matters: a later file can re-include something an earlier one ignored (via a!negation), and any.gitignore,.ignoreor.sccignorediscovered inside the scanned tree takes precedence over everything supplied with--ignore-file.--ignore-fileIf you want to apply your global git excludes file, point
at it directly (for example--ignore-file ~/.config/git/ignore).sccdeliberately does not shell out togitto discover it for you, but you can make it automatic by putting the flag in a.sccconfigconfiguration file and pointing theSCC_CONFIG_PATHenvironment variable at it, so every run picks it up without typing:
~/.config/scc/global.sccconfig
--ignore-file /home/me/.config/git/ignore
export SCC_CONFIG_PATH=~/.config/scc/global.sccconfig
scc # now applies your global ignore on every run
### Configuration Filesscccan read default flags from a configuration file to avoid creating shell aliases. The format is an opts-list in the style of ripgrep and bat: the file is simply a list of the same command-line flags you would otherwise type, and anything valid on the command line is valid in the file, with the exception of output flags.--exclude-dir vendorFormat rules:
- One flag per line is the recommended style, but multiple whitespace-separated tokens per line are allowed (
).--Lines use the normal prefix, e.g.--no-cocomo.#begins a comment. Whole-line and inline trailing comments are stripped.--exclude-dir vendorBlank lines are ignored. Tokenization is quote-aware, so both and--count-as 'jsp:html'work. Quotes (single or double) are the only grouping mechanism; to include a literal quote, switch quote style (--count-as "a'b").--exclude-dir C:\build\outBackslash is an ordinary literal, not an escape character, so a Windows path such as survives verbatim.-A line whose first token does not start with (a bare positional such assrc/) is skipped with a warning, so a config file cannot inject extra count targets. Example.sccconfig:
count the way I like it
--no-cocomo --exclude-dir vendor,node_modules --format wide # default to the wider tableconfig: --exclude-dir vendor CLI: --exclude-dir dist result: vendor, dist#### Sources and discoverySCC_CONFIG_PATHThere are two configuration tiers:
- Global — there is no fixed default location and no per-run home-directory stat. The global source is consulted only when set explicitly via the
environment variable or the--config <path>flag.--configwhich overridesSCC_CONFIG_PATH..sccconfigProject — a file named in the current working directory (./.sccconfig), found with a single stat and no walk-up.cd project && sccpicks upproject/.sccconfig; runningsccfrom a subdirectory does not pick up an ancestor's.sccconfig. Path arguments do not move the anchor —scc ./projectstill reads./.sccconfig, not./project/.sccconfig. To read the repository root's.sccconfigfrom a subdirectory, pass--find-root-config, which walks back from the current directory to the git/hg root. It is off by default and affects config discovery only - it changes which.sccconfigis read, not which directory is counted. Outside a repository it degrades to./.sccconfig.--exclude-dirPrecedence
Lowest to highest, later wins: global config < project config < command line. Scalar and boolean flags follow last-wins, so the command line always overrides config.
Slice flags (
,--exclude-file,--exclude-ext,--include-ext,--not-match) union instead of overriding:
bash $ scc -a -i c redis ─────────────────────────────────────────────────────────────────────────────── Language Files Lines Blanks Comments Code Complexity ─────────────────────────────────────────────────────────────────────────────── C 437 267,353 31,103 45,998 190,252 48,269 (ULOC) 149892 ─────────────────────────────────────────────────────────────────────────────── Total 437 267,353 31,103 45,998 190,252 48,269 ─────────────────────────────────────────────────────────────────────────────── Unique Lines of Code (ULOC) 149892 DRYness % 0.56 ─────────────────────────────────────────────────────────────────────────────── Estimated Cost to Develop (organic) $6,681,762 Estimated Schedule Effort (organic) 28.31 months Estimated People Required (organic) 20.97 ─────────────────────────────────────────────────────────────────────────────── Processed 9390815 bytes, 9.391 megabytes (SI) ───────────────────────────────────────────────────────────────────────────────The three slice flags that ship with built-in defaults —--exclude-dir(.git,.hg,.svn),--exclude-file(the lockfile set) and--generated-markers— keep those defaults as a non-removable safety net: a config or CLI value is added to the defaults rather than replacing them, so puttingvendorin.sccconfignever stopssccskipping.git.sccConfig can never write a file
A configuration file can change how
counts and formats, including selecting a stdout format such as--format json, but it can never causesccto write a file. The file-output flags —--output/-o,--reportand--format-multi— are honoured only from the command line; the same flags supplied by config are ignored (output goes to stdout, the default). This is because a project.sccconfigis auto-discovered, so a cloned repository could otherwise silently overwrite one of your files. Only the command line can makesccwrite to disk.--no-configControl flags
| Flag | Effect | |------|--------| |
| Disable auto-discovery: skip theSCC_CONFIG_PATHglobal and the project.sccconfig. | |--config <path>| Load this file as the global source. Always honoured, even with--no-config; overridesSCC_CONFIG_PATH. | |--find-root-config| Discover the project.sccconfigby walking up to the repository root instead of using./.sccconfig. No-op under--no-config. |--config test.sccconfig --no-configloads exactlytest.sccconfigand nothing else — a clean isolated-config mode. A--configor--no-configwritten inside a config file is inert (a config file cannot chain-load another config file).@fileThe
argument bundlescc @flags.txtexpands the contents offlags.txtas if its lines had been typed on the command line. It uses the same opts-list tokenizer as config files (comments, quotes, backslash-literal), but unlike config files it keeps positional paths and may write files — an@fileis an explicit, user-supplied argument bundle equivalent to typing the flags, so it is trusted like the command line (including a--configinside it being honoured).@fileexpansion fires only when@fileis the sole argument.@fileNote that because config discovery now runs on the post-
arguments,scc @flags.txtin a directory containing./.sccconfigloads both — the@filetokens sit above the config in precedence. To get the old "exactly these args, nothing else" behaviour, add--no-config.sccInteresting Use Cases
Used inside Intel Nemu Hypervisor to track code changes between revisions <https://github.com/intel/nemu/blob/topic/virt-x86/tools/cloc-change.sh#L9> Appears to also be used inside both <http://codescoop.com/> <https://pinpoint.com/> <https://github.com/chaoss/grimoirelab-graal>
It also is used to count code and guess language types in <https://searchcode.com/> which makes it one of the most frequently run code counters in the world.
You can also hook scc into your gitlab pipeline <https://gitlab.com/guided-explorations/ci-cd-plugin-extensions/ci-cd-plugin-extension-scc>
Used by the following products and services,
- GitHub CodeQL - The CodeQL engine uses
for line countingsccJetBrains Qodana - The Qodana CLI leverages as a command-line helper for code analysissccScaleway - Cloud provider using sccLinux Foundation LFX Insights - COCOMO cost estimation OpenEMS Features
uses a small state machine in order to determine what state the code is when it reaches a newline\n. As such it is aware of and able to countfor if switch while else || && != ==Because of this it is able to accurately determine if a comment is in a string or is actually a comment.
- Single Line Comments
- Multi Line Comments
- Strings
- Multi Line Strings
- Blank lines
It also attempts to count the complexity of code. This is done by checking for branching operations in the code. For example, each of the following
if encountered in Java would increment that files complexity by one.scc --by-file -s complexityComplexity Estimates
Let's take a minute to discuss the complexity estimate itself.
The complexity estimate is really just a number that is only comparable to files in the same language. It should not be used to compare languages directly without weighting them. The reason for this is that its calculated by looking for branch and loop statements in the code and incrementing a counter for that file.
Because some languages don't have loops and instead use recursion they can have a lower complexity count. Does this mean they are less complex? Probably not, but the tool cannot see this because it does not build an AST of the code as it only scans through it.
Generally though the complexity there is to help estimate between projects written in the same language, or for finding the most complex file in a project
which can be useful when you are estimating on how hard something is to maintain, or when looking for those files that should probably be refactored.sort -u .h .c | wc -lAs for how it works.
It's my own definition, but tries to be an approximation of cyclomatic complexity <https://en.wikipedia.org/wiki/Cyclomatic_complexity> although done only on a file level.
The reason it's an approximation is that it's calculated almost for free from a CPU point of view (since its a cheap lookup when counting), whereas a real cyclomatic complexity count would need to parse the code. It gives a reasonable guess in practice though even if it fails to identify recursive methods. The goal was never for it to be exact.
In short when scc is looking through what it has identified as code if it notices what are usually branch conditions it will increment a counter.
The conditions it looks for are compiled into the code and you can get an idea for them by looking at the JSON inside the repository. See <https://github.com/boyter/scc/blob/master/languages.json#L3869> for an example of what it's looking at for a file that's Java.
The increment happens for each of the matching conditions and produces the number you see.
Unique Lines of Code (ULOC)
ULOC stands for Unique Lines of Code and represents the unique lines across languages, files and the project itself. This idea was taken from <https://cmcenroe.me/2018/12/14/uloc.html> where the calculation is presented using standard Unix tools
. This metric is there to assist with the estimation of complexity within the project. Quoting the source-u> In my opinion, the number this produces should be a better estimate of the complexity of a project. Compared to SLOC, not only are blank lines discounted, but so are close-brace lines and other repetitive code such as common includes. On the other hand, ULOC counts comments, which require just as much maintenance as the code around them does, while avoiding inflating the result with license headers which appear in every file, for example.
You can obtain the ULOC by supplying the
or--ulocargument toscc.DRYness %It has a corresponding metric
which is the percentage of ULOC to CLOC orDRYness = ULOC / SLOC. The higher the number the more DRY (don't repeat yourself) the project can be considered. In general a higher value here is a better as it indicates less duplicated code. The DRYness metric was taken from a comment by minimax <https://lobste.rs/s/has9r7/uloc_unique_lines_code>-aTo obtain the DRYness metric you can use the
or--drynessargument toscc, which will implicitly set--uloc.Note that there is a performance penalty when calculating the ULOC metrics which can double the runtime.
Running the uloc and DRYness calculations against C code a clone of redis produces an output as follows.
Further reading about the ULOC calculation can be found at <https://boyter.org/posts/sloc-cloc-code-new-metic-uloc/>
Interpreting Dryness,
- 75% (High Density): Very terse, expressive code. Every line counts. (Example: Clojure, Haskell)
- 60% - 70% (Standard): A healthy balance of logic and structural ceremony. (Example: Java, Python)
- < 55% (High Boilerplate): High repetition. Likely due to mandatory error handling, auto-generated code, or verbose configuration. (Example: C#, CSS)
See <https://boyter.org/posts/boilerplate-tax-ranking-popular-languages-by-density/> for more details.
COCOMO
The COCOMO statistics displayed at the bottom of any command line run can be configured as needed.
text
Estimated Cost to Develop (organic) $664,081
Estimated Schedule Effort (organic) 11.772217 months
Estimated People Required (organic) 5.011633
To change the COCOMO parameters, you can either use one of the default COCOMO models.text
scc --cocomo-project-type organic
scc --cocomo-project-type semi-detached
scc --cocomo-project-type embedded
You can also supply your own parameters if you are familiar with COCOMO as follows,text
scc --cocomo-project-type "custom,1,1,1,1"
$ scc --locomo . ... LOCOMO LLM Cost Estimate (medium) Tokens Required (in/out) 3.0M / 0.7M Cost to Generate $20 Estimated Cycles 2.1 Generation Time (serial) 3.9 hours Human Review Time 5.9 hours Disclaimer: rough ballpark for regenerating code using a LLM. Does not account for context reuse, test generation, or heavy debugging.See below for details about how the model choices, and the parameters they use.scc --cocomo-project-type "organic,2.4,1.05,2.5,0.38"Organic – A software project is said to be an organic type if the team size required is adequately small, the problem is well understood and has been solved in the past and also the team members have a nominal experience regarding the problem.
scc --cocomo-project-type "semi-detached,3.0,1.12,2.5,0.35"Semi-detached – A software project is said to be a Semi-detached type if the vital characteristics such as team-size, experience, knowledge of the various programming environment lie in between that of organic and Embedded. The projects classified as Semi-Detached are comparatively less familiar and difficult to develop compared to the organic ones and require more experience and better guidance and creativity. Eg: Compilers or different Embedded Systems can be considered of Semi-Detached type.
scc --cocomo-project-type "embedded,3.6,1.20,2.5,0.32"Embedded – A software project with requiring the highest level of complexity, creativity, and experience requirement fall under this category. Such software requires a larger team size than the other two models and also the developers need to be sufficiently experienced and creative to develop such complex models.
sccLOCOMO
LOCOMO (LLM Output COst MOdel) estimates the cost to regenerate a codebase using a large language model. It is the LLM-era counterpart to COCOMO - a rough ballpark estimator, not a project planning tool.
Note: LOCOMO was developed as part of
and is not an industry-standard model. Unlike COCOMO, which is based on decades of empirical research by Barry Boehm, LOCOMO is an experimental heuristic designed to give a useful order-of-magnitude estimate for LLM-assisted development costs. Treat its output as a conversation starter, not a definitive answer.--locomoImportant distinction: LOCOMO estimates the cost to regenerate known code - essentially "given this exact codebase, how much would it cost to have an LLM produce it?" This is fundamentally different from the cost to create something from scratch, which involves exploration, architectural decisions, dead ends, debugging, and iteration that can cost orders of magnitude more. COCOMO estimates the human creation cost; LOCOMO estimates the LLM regeneration cost. They answer different questions.
LOCOMO is opt-in. Enable it with
or use--cost-comparisonto display both COCOMO and LOCOMO side by side.
scc --locomo --locomo-preset large . scc --locomo --locomo-preset local .#### How it workssccLOCOMO uses SLOC and complexity data that
already computes. The model works per-file and aggregates:--locomo-preset
- Output tokens - each line of code maps to ~10 LLM output tokens (configurable).
- Input tokens - estimated prompting cost, scaled by code complexity. More complex code (higher branch density) requires more detailed prompts. Scales to prevent runaway estimates.
- Iteration factor - LLMs rarely produce correct code on the first try. A retry multiplier scales with complexity, also scales.
- Dollar cost - input and output tokens multiplied by per-token pricing.
- Generation time - total serial output tokens divided by tokens-per-second throughput.
- Human review time - estimated per-line overhead for planning, review, testing, and integration.
Model presets
Presets are tier-based rather than tied to specific models, so they don't go stale as models are retired or renamed. Use
to select a tier:large| Preset | Represents | Input $/1M | Output $/1M | TPS | |--------|-----------|-----------|-------------|-----| |
| Frontier models (Opus, GPT-5.3, Gemini 3.1 Pro, etc.) | 10.00 | 30.00 | 30 | |medium(default) | Balanced models (Sonnet, Gemini Flash, etc.) | 3.00 | 15.00 | 50 | |small| Fast/cheap models (Haiku, GPT-4o-mini, etc.) | 0.50 | 2.00 | 100 | |local| Self-hosted models (Llama, Mistral, Qwen etc.) | 0.00 | 0.00 | 15 |localFor
, cost is $0 but generation time is still reported to capture the compute/time investment. Preset pricing reflects approximate tier rates as of early 2026 and can be overridden with explicit flags.
#### Overriding preset values
You can override individual preset values for pricing or throughput:
scc --locomo --locomo-input-price 1.0 --locomo-output-price 5.0 .
scc --locomo --locomo-tps 100 .
scc --locomo --locomo-review 0.05 . scc --locomo --locomo-review 0.1 .#### Human review time--locomo-reviewThe
flag controls estimated human review minutes per line of code (default: 0.01, i.e. 0.6 seconds per line). This is intentionally optimistic and assumes light oversight.For mission-critical, security-sensitive, or complex algorithmic code you should increase this:
#### Power-user configuration
The five internal model parameters can be overridden with a single comma-separated config string:
scc --locomo --locomo-config "tokensPerLine,inputPerLine,complexityWeight,iterations,iterationWeight"
scc --locomo --locomo-config "8,15,3,2.0,1.5"The defaults are"10,20,5,1.5,2". Here is what each parameter controls:inputFactor = 1 + sqrt(density) * weight| Position | Name | Default | Description | |----------|------|---------|-------------| | 1 | tokensPerLine | 10 | Average LLM output tokens per line of code | | 2 | inputPerLine | 20 | Base LLM input (prompt) tokens per output line | | 3 | complexityWeight | 5 | How much complexity density scales input tokens:
| | 4 | iterations | 1.5 | Base iteration/retry cycles before complexity adjustment | | 5 | iterationWeight | 2 | How much complexity density adds extra cycles:cycles = iterations + sqrt(density) * weight|--locomo-cyclesThe iteration factor (cycles) scales both input and output tokens - it represents how many generation attempts the LLM needs. Simple code (~0.05 complexity density) produces ~1.9 cycles; complex code (~0.3 density) produces ~2.6 cycles. Use
to override this with a fixed value.For example, to model a cheaper/faster LLM that needs fewer tokens but more retries:
scc --cost-comparison . ``#### Comparing COCOMO and LOCOMO--cost-comparisonUse
to show both estimates side by side. This enables COCOMO (if it was disabled) and LOCOMO together:
What LOCOMO does not account for
LOCOMO is a
... (README truncated for length)