SourceMix turns selected C# source files into a single Markdown context file that is easier to hand to an LLM. You can use it in two ways from the same installed dotnet tool:
- CLI mode for scripted or repeatable runs
- TUI mode for interactive file picking and option selection
The tool can include just the files you select, or expand outward to referenced source types, optional decompiled dependency types, reusable skills, and a final prompt block.
Install the tool globally from NuGet:
dotnet tool install --global HenrikJensen.SourceMixAfter that, use the sourcemix command.
Update an existing installation:
dotnet tool update --global HenrikJensen.SourceMixUninstall it:
dotnet tool uninstall --global HenrikJensen.SourceMixUse the interactive experience when you want help choosing files:
sourcemix tuiUse the CLI when you already know the files or patterns you want:
sourcemix "src/**/*.cs" -o context.mdRun the TUI from any directory containing a .sln or .slnx file:
sourcemix tui- Search and select files — type to filter
.csfiles by name in real time, move with↑↓, toggle withSpace, pin withCtrl+P, confirm withEnter, and switch views withTab. - Configure options — choose recursive dependency resolution, optional depth limiting, decompilation of compiled types, whether dependency method bodies should be trimmed, and whether
var/ target-typednew()should be expanded to inferred types. - Select prompt — optionally append a built-in or custom prompt to the generated output.
- Select skills — optionally prepend one or more
SKILL.mdinstruction files. - Generate — write the final Markdown output and persist your preferences for the next run.
Note:
--include-compileddepends on assemblies that already exist inbin/, so rundotnet buildfirst.
sourcemix [<files>...] [--output <path>] [--recursive] [--depth <n>] [--include-compiled] [--trim] [--expand-types]<files>— one or more file paths or glob patterns such assrc/**/*.cs
-o,--output <path>— write output to a file instead of stdout-r,--recursive— include files that define referenced types-d,--depth <n>— limit recursion depth when--recursiveis used-c,--include-compiled— decompile unresolved referenced interfaces/models from compiled assemblies; requires--recursive-t,--trim— trim dependency method bodies while keeping signatures; requires--recursive-e,--expand-types— replacevarwith the inferred type and expand target-typednew()to include the type; anonymous types, tuple deconstruction, and unresolved cases are left unchanged-p,--prompt <name-or-text>— append a built-in prompt key or custom prompt text-s,--skills <key>...— prepend one or more skills by key
nunit-testxunit-testcode-reviewtech-docsexplaindebugrefactorarchitecture
# Write a context file from a glob
sourcemix "src/**/*.cs" -o context.md
# Print selected files to stdout
sourcemix Foo.cs Bar.cs Baz.cs
# Pull in referenced source types and decompiled unresolved types
sourcemix MyService.cs -r -c -o context.md
# Trim dependency bodies and append an xUnit-focused prompt
sourcemix MyService.cs -r -t --prompt xunit-test -o context.md
# Expand inferred types before writing the context file
sourcemix MyService.cs -r -e -o context.md
# Add skills plus a code review prompt
sourcemix MyService.cs -r -t --skills unit-test-style architecture-rules --prompt code-review -o context.mdSourceMix stores per-solution preferences after TUI runs, including pinned files, pinned skills, output path, last-used prompt, and default options.
| Platform | Location |
|---|---|
| Windows | %APPDATA%\sourcemix\sourcemix-<hash>.json |
| Linux | ~/.config/sourcemix/sourcemix-<hash>.json |
| macOS | ~/.config/sourcemix/sourcemix-<hash>.json |
Global custom prompts are stored separately:
| Platform | Location |
|---|---|
| Windows | %APPDATA%\sourcemix\sourcemix-global.json |
| Linux | ~/.config/sourcemix/sourcemix-global.json |
| macOS | ~/.config/sourcemix/sourcemix-global.json |
Skills are reusable Markdown instructions inserted before the collected code. Each skill lives in its own directory and must contain a SKILL.md file. A skill file cannot reference other files.
| Platform | Location |
|---|---|
| Windows | %APPDATA%\sourcemix\skills\ |
| Linux | ~/.config/sourcemix/skills/ |
| macOS | ~/.config/sourcemix/skills/ |
Example:
~/.config/sourcemix/skills/
unit-test-style/
SKILL.md
architecture-rules/
SKILL.md
Restore tools and dependencies:
dotnet tool restore
./scripts/restore.bashBuild with the repository checks:
./scripts/build.bashRun the tests:
./scripts/test.bashRun the benchmarks to measure performance and detect regressions:
./scripts/benchmark.bashResults are saved to tmp/benchmark-latest.md after each run. The previous run is kept as tmp/benchmark-previous.md for comparison.
Create the release package:
./scripts/pack.bashCreate the NuGet package:
./scripts/pack.bashThe package is written to:
src/SourceMix/bin/Release/HenrikJensen.SourceMix.<version>.nupkg
Install that package locally for validation:
dotnet tool install --global --add-source ./src/SourceMix/bin/Release HenrikJensen.SourceMixPublish it to NuGet:
dotnet nuget push src/SourceMix/bin/Release/HenrikJensen.SourceMix.<version>.nupkg --source https://api.nuget.org/v3/index.json --api-key <api-key>pack.bash only creates the Release package. Run ./scripts/build.bash and ./scripts/test.bash separately as your validation steps before publishing.



