| name | architecture |
| description | Explore RegiLattice codebase architecture, data flow, dependencies, and design decisions. Use when asked to explain how the system works, trace a feature end-to-end, understand module structure, or find where specific logic lives. Triggers on: 'how does', 'where is', 'explain', 'architecture', 'data flow', 'TweakEngine', 'RegistrySession'. |
| argument-hint | What to explore (e.g. 'how tweaks are applied', 'where profiles are defined') |
Architecture Explorer โ RegiLattice
Solution Map
RegiLattice.sln
โโโ src/RegiLattice.Core/ # Class library โ zero UI dependency
โ โโโ TweakEngine.cs # Central engine (register, search, filter, apply, profiles)
โ โโโ SnapshotManager.cs # Save/load/restore state snapshots
โ โโโ TweakValidator.cs # Integrity check + circular dependency detection
โ โโโ DependencyResolver.cs # Topological sort for DependsOn
โ โโโ Models/TweakDef.cs # Immutable tweak definition + RegOp + TweakScope
โ โโโ Models/ProfileDefinitions.cs # 5 built-in profiles (gaming, privacy, business, โฆ)
โ โโโ Registry/RegistrySession.cs # All Win32 registry I/O (DryRun + backup)
โ โโโ Services/ # Analytics, AppConfig, CorporateGuard, Elevation,
โ โ # Favorites, HardwareInfo, Locale, Ratings,
โ โ # ShellRunner, SystemMonitor, TweakHistory
โ โโโ Plugins/ # Tweak Pack marketplace (JSON packs)
โ โโโ Tweaks/ # 195 module files, 7,718 tweaks across 158 categories
โโโ src/RegiLattice.GUI/ # WinForms app (depends on Core)
โ โโโ Theme.cs # 11-theme engine (ThemeDef records)
โ โโโ Forms/MainForm.cs # Main window โ categories, search, tray, log panel
โ โโโ Forms/BasePackageManagerDialog # Abstract template for 5 package manager dialogs
โ โโโ PackageManagers/ # WinGet, Scoop, pip, Chocolatey, PSModule wrappers
โโโ src/RegiLattice.CLI/ # Console app (depends on Core)
โ โโโ Program.cs # 25+ commands via args parsing
โ โโโ CliArgs.cs # Extracted CLI argument model
โโโ tests/ # 2,507+ Core + 434+ CLI + 363+ GUI = 3,304 tests
Data Flow โ Tweak Lifecycle
RegisterBuiltins() TweakEngine indexes by ID/Category/Scope
โ
โผ
Search() / Filter() Returns IReadOnlyList<TweakDef>
โ
โผ
DetectStatus(td) RegistrySession.Evaluate(DetectOps) โ Applied / NotApplied
โ
โผ
Apply(id) / Remove(id) RegistrySession.Execute(ApplyOps) โ DryRun or real write
โ
โผ
TweakHistory.Record() Append entry to %LOCALAPPDATA%\RegiLattice\history.json
Key Design Decisions
| Decision | Rationale |
|---|
| Declarative tweaks (95%) | Pure data โ no code needed for registry-only tweaks |
Immutable TweakDef (required init) | Thread-safe, can't be mutated after construction |
All registry I/O via RegistrySession | DryRun, backup, structured logging, testability |
| Sealed classes everywhere | JIT devirtualisation + prevent unintended subclassing |
| Only 4 P/Invoke calls | GetComputerNameExW, GlobalMemoryStatusEx ร2, GetSystemTimes |
IReadOnlyList<T> for all public collections | Consumers can't mutate engine state |
Investigation Commands
# Count tweaks per module
Select-String -Path "src\RegiLattice.Core\Tweaks\*.cs" -Pattern 'new TweakDef' |
Group-Object Filename | Sort-Object Count -Descending
# Find all registry paths
Select-String -Path "src\RegiLattice.Core\Tweaks\*.cs" -Pattern 'HKEY_' | Select-Object -First 30
# Detect duplicate IDs
Select-String -Path "src\RegiLattice.Core\Tweaks\*.cs" -Pattern 'Id = "' |
ForEach-Object { ($_ -replace '.*Id = "([^"]+)".*','$1') } |
Group-Object | Where-Object Count -gt 1
# Check category module list
Get-ChildItem "src\RegiLattice.Core\Tweaks\*.cs" | Select-Object -ExpandProperty BaseName
Entry Points for Common Questions
| Question | Starting File |
|---|
| How is a tweak applied? | TweakEngine.cs โ Apply() โ RegistrySession.Execute() |
| Where are profiles? | Models/ProfileDefinitions.cs, Models/ProfileDef.cs |
| How is the GUI built? | Forms/MainForm.cs โ BuildCategoryPanels() |
| How does search work? | TweakEngine.cs โ Search() using pre-built _searchPairs |
| What is CorpSafe? | Services/CorporateGuard.cs โ P/Invoke + WMI domain checks |
| How are themes applied? | Theme.cs โ SetTheme() โ ApplyTheme(control) |