SourceMix makes one Markdown context file from selected C# source files.
Use this tool when you need input for an LLM.
The tool has two user interfaces:
- CLI
- TUI
SourceMix reads C# source files.
It can also add related source files.
It can also add decompiled dependency types from compiled assemblies.
It can prepend skill text.
It can append one prompt block.
The output is Markdown.
Use this command:
sourcemix [<files>...] [--output <path>] [--recursive] [--depth <n>] [--include-compiled] [--trim] [--expand-types] [--prompt <name-or-text>] [--skills <key>...]You can give one or more file paths.
You can also give glob patterns such as src/**/*.cs.
If you do not give --output, the tool writes to standard output.
If you give --output, the tool writes to that file path.
| Option | Function | Rule |
|---|---|---|
-o, --output <path> |
Write output to a file. | The output directory must exist. |
-r, --recursive |
Add source files that define referenced types. | Use this option when you need dependency files. |
-d, --depth <n> |
Limit recursive depth. | This option works with --recursive. |
-c, --include-compiled |
Add decompiled dependency types from compiled assemblies. | This option requires --recursive. Run dotnet build first. |
-t, --trim |
Keep signatures but remove method bodies from dependency files. | This option requires --recursive. |
-e, --expand-types |
Replace var with inferred types and expand target-typed new(). |
The tool does not change anonymous types, tuple deconstruction, or unresolved cases. |
-p, --prompt <name-or-text> |
Append one prompt block. | You can use a built-in key or custom text. |
-s, --skills <key>... |
Prepend one or more skills. | Each key must match one skill directory name. |
The CLI resolves the seed files first.
If --recursive is on, the CLI resolves related source files from the solution directory.
If --include-compiled is on, the CLI scans bin directories for assemblies.
The CLI only decompiles interfaces and simple model types.
The CLI warns if a requested skill is not present.
The CLI stops with an error if:
--trimis used without--recursive--include-compiledis used without--recursive- the output directory does not exist
- the output path cannot be written
Use this command:
sourcemix tuiRun it in a directory that contains a .sln or .slnx file, or in a child directory of that directory.
The TUI shows one shared app header.
The header identifies the product.
The shared wizard header shows only the product name.
The TUI uses a wizard with these steps:
- Search and select files
- Configure options
- Set the output path
- Select one prompt
- Select skills
- Generate output
The TUI keeps user choices when the user moves back to an earlier step.
The file step shows three views:
- Search
- Pinned
- Selected
Use these keys:
UpandDownto move the cursorSpaceto select or clear a fileCtrl+Pto pin or unpin a fileTabto change the viewCtrl+Rto clear the selected set in Search viewCtrl+Uto clear the search textEnterto confirmCtrl+Qto go backEscto quit
The options step can set:
- recursive dependency resolution
- depth limit
- compiled dependency decompilation
- dependency body trim
- type expansion
If depth limit is on, the TUI asks for a positive integer.
The user sets one output file path.
If that file already exists, the TUI asks the user to:
- overwrite
- append
- cancel
The prompt step can use one built-in prompt or one custom prompt.
The skills step can select zero or more skills.
Each skill must come from a directory that contains one SKILL.md file.
The output order is:
- skill content, if present
- source code section
- decompiled dependencies section, if present
- instructions section, if a prompt is present
Source files are written in fenced C# code blocks.
The main source section starts with:
---
# Source codeIf decompiled dependencies exist, the output adds:
## Decompiled DependenciesIf a prompt exists, the output adds:
---
# InstructionsThe source processor removes:
- using directives
- comments
- XML documentation comments
It also removes extra blank lines.
It moves opening braces to the previous line in the final output.
If trim is on for dependency files, the processor removes method bodies but keeps signatures.
If expand-types is on, the processor uses Roslyn semantic analysis.
It can:
- replace local
varwith the inferred type - replace
foreach (var ...)with the inferred element type - replace target-typed
new()with explicit type text
It does not expand:
- anonymous types
- tuple deconstruction
- unresolved or error types
Source dependency resolution uses the solution directory as the search root.
The resolver:
- collects
.csfiles - ignores
binandobj - builds a type-to-file index
- walks referenced type names with breadth-first traversal
- uses namespace data to narrow ambiguous matches
If a type is not found in source, the resolver records it as unresolved.
The decompiler can then try to supply that type from compiled assemblies.
SourceMix stores per-solution preferences.
These preferences include:
- pinned files
- pinned skills
- output path
- default prompt key
- default option values
SourceMix stores global custom prompts in a separate file.
The tool stores skills in the user config directory under skills.
Each skill uses one directory name as its key.
Each skill directory must contain SKILL.md.
The built-in prompt keys are:
nunit-testxunit-testcode-reviewtech-docsexplaindebugrefactorarchitecture
SourceMix is for C# source input.
The TUI requires a solution file.
Compiled dependency support depends on assemblies in bin.
The tool does not stop when one assembly cannot be decompiled.
It skips that assembly and continues.