MindAttic.Launcher/BIBLE
MindAttic.Launcher — Project Bible
Single source of truth for what MindAttic.Launcher IS, is NOT, and the rules that keep it coherent. README says how to build/run; this says how to think about the system.
1. The one sentence
MindAttic.Launcher is a single Windows binary (MindAttic.Launcher.exe) that is the launcher and orchestrator for the whole MindAttic workspace: an interactive Spectre.Console menu plus a small set of CLI sub-commands that spawn per-project agent tabs in Windows Terminal, commit/push repos, and back the workspace up.
2. The product promise
- Pick a project, then pick an agent CLI (Claude/Codex/Gemini/Kimi) — a working agent session opens in a titled, colored Windows Terminal tab rooted at the right repo. The provider choice is per-launch, not saved: nothing about "which CLI for this project" is persisted anywhere.
- One menu (or
mindattic commit) to commit + push one or every MindAttic project, with an auto-generated message when none is supplied. - A real backup: a robocopy snapshot of
D:\Projects\MindAttic, fullsqlcmdSQL Server database backups,sqlite3-dumped SQLite databases, and a zip of%APPDATA%\MindAttic(Vault's settings and credentials), into a collision-safe dated folder — the exact same four services whether triggered by hand (the Backup menu) or by thebackupcommand a scheduled task calls. - Restore from that same dated folder (
restore), and a new-machinebootstrap(install prerequisites, clone everywip-tagged repo, restore the latest reachable backup) — this repo now owns the full lifecycle MindAttic.Bob used to (archived; see its README). - Discovery that surfaces new repos under the workspace root without a hand-edit of settings.
- Settings that round-trip cleanly through MindAttic.Vault, never silently dropping keys this version doesn't model.
3. What it is NOT
- NOT an agent itself. It hosts and launches agents (
mindattic hostexecs the provider with inherited stdio); it does not call any LLM, and no code path references an LLM SDK. - NOT a phone/iPad web terminal. That role belongs to the sibling MindAttic.Mobile repo — a WebSocket + xterm.js bridge that streams a Windows terminal session to a mobile browser. This repo only manages launching agents and orchestrating the workspace.
- NOT a deploy engine. Deploys belong to the sibling MindAttic.Deploy repo (
MindAttic.Deploy.exe all); this repo owns no FTP pipeline or per-project deploy state, and has no web deploy of its own: its project page is its GitHub README (https://github.com/mindattic/MindAttic.Launcher). - NOT cross-platform. It targets
net10.0-windows/win-x64and depends on Windows Terminal (wt),robocopy,sqlcmd, and (for SQLite backups)sqlite3. - NOT a general settings UI. It edits only its own roster/providers and the Windows Terminal
schemesarray (idempotent splice).
4. Architecture canon
A single-file, framework-dependent win-x64 exe. Spectre.Console.Cli routes args to a default interactive menu command or to named sub-commands. The interactive menu drives a set of menus that call stateless/injectable services; the services own all external-process and filesystem work.
args
|
Spectre.Console.Cli (Program.cs)
|
+-----------------+------------------+--------------+
| | | |
(default) host commit version
| | |
MainMenuCommand HostAgentCommand CommitCommand
| | |
Menus/* ------> Services/* ------> external tools
(Spectre UI) (logic+IO) wt | git | robocopy | sqlcmd | provider exe
| |
Ui/* (Menu, TitlePinner / HostInputPipeServer
Screen, Theme) (per-tab background loops)
|
Models/* (Project, AgentProvider, AppSettings) <--> SettingsStore <--> MindAttic.Vault
4.1 Projects
MindAttic.Launcher/MindAttic.Launcher.csproj— the exe (net10.0-windows,OutputType=Exe,Version 1.0.0; references MindAttic.Vault 1.0.0, Spectre.Console + Spectre.Console.Cli 0.49.1).MindAttic.Launcher.Tests/MindAttic.Launcher.Tests.csproj— NUnit 4 test project.run.ps1— the shared run menu overdeploy-lib.ps1(M.LNCH-T145): Redeploy publishes Debug and Release toR:\MindAttic\Apps\MindAttic.Launcher\{Debug,Release}(writingrepo.pathbeside each exe), Run Debug / Run Release launch them, and-WaitPidbacks the in-app Redeploy.run.batbeside it is generated byWrite-RunBat.
4.2 Domain model — NOUNS (MindAttic.Launcher/Models/)
- Project (
Models/Project.cs) — a managed repo:Name,Path,RepoUrl, tab alias/color/scheme,SqlServer+Databases,SqliteDatabases,[JsonExtensionData] Extra.TabTitlestrips a project's dot-prefix (e.g.MindAttic.) once the roster (Project.KnownNames) has another project carrying the same one — a prefix unique to one project stays whole. Carries no provider — which CLI to launch with is chosen at Open-Project-Tab time, not stored per project. - AgentProvider (
Models/AgentProvider.cs) — a launchable agent:Key,Name,RunCommand,Extra. - AppSettings (
Models/AppSettings.cs) — the persisted root: WT settings path,AgentProviders,Projects,DiscoveryIgnore,Extra. No default-provider field: the provider is chosen per launch and never persisted. - Service-local records:
GitStatus/GitChange(Services/GitService.cs),DiscoveredRepo(Services/ProjectDiscovery.cs),PaletteColor(Services/ColorPalette.cs),DatabaseBackupResult/BackupTarget(Services/SqlBackupService.cs),SqliteBackupResult/SqliteBackupTarget(Services/SqliteBackupService.cs).
4.3 Key services — VERBS (MindAttic.Launcher/Services/)
- SettingsStore — load/save
AppSettingsvia Vault; one-time legacy-file seed. - AgentProviderRegistry — resolve the configured/default provider list (
All(),ByKey(),Current()= first-listed provider; default order Claude, Codex, Gemini, Kimi) and persist the per-provider model (SetModel). The per-launch provider choice is made inOpenProjectMenuand never persisted; callers with no launch-time choice (mindattic hostwithout--provider) useCurrent(). - GitService —
git status --porcelainsnapshot, short summary, auto commit message. - WindowsTerminalLauncher — build + invoke
wttab command lines (title/color/scheme). - WindowsTerminalSchemes — idempotent splice of a
MindAttic-<Name>scheme into WT settings. - ColorPalette — curated tab colors + pure hex→scheme helpers.
- ProjectDiscovery — find unregistered git repos under the workspace root.
- ProjectRoster — sort / find roster entries.
- BackupService — robocopy snapshot to a collision-safe dated folder.
- SqlBackupService —
sqlcmdfull (BACKUP DATABASE) per database. - SqliteBackupService —
sqlite3 -readonly <file> .dumpper SQLite database, written to a.sqlfile (SQLite's equivalent ofBACKUP DATABASE; the file-exists check before invoking is what keeps sqlite3 from silently creating an empty db at a typo'd path). - AppDataBackupService — zip/unzip
%APPDATA%\MindAttic(Vault's settings and credential tree) into/from{targetFolder}\AppData.zip— the one thing a file+SQL+SQLite backup alone misses, and the reason MindAttic.Bob's pack/bug-out used to be necessary for a full recovery. - SqlRestoreService / SqliteRestoreService — the restore half of the two backup services above:
RESTORE DATABASE ... WITH REPLACE, RECOVERY, MOVE ...(deriving data/log paths fromSERVERPROPERTY, dropping an existing database toSINGLE_USERfirst) and replaying a.sqldump into a fresh SQLite file, respectively. Seerestoreunder §4. - PrerequisiteService — installs what
bootstrapneeds (sqlcmd, SQL Server LocalDB, which it also creates/starts) viawinget, refreshing the process PATH after each install, the AI agent CLIs the tabs run (npm/winget, Kimi's own install script), plus the same optional dev tools Bob offered (VS Code, Visual Studio, SSMS, Notepad++, Node, Claude desktop, Antigravity) — no offline installer cache, since that only existed for the no-network bug-out scenario this app doesn't have. - WorkspaceCloneService — clones every
wip-tagged repo not already present under the workspace root and pulls (--ff-only) every one that is, reusingTopicRepoSync/GitHubTopicRepos(the same GitHub-topic discovery the roster already uses) instead of a hand-maintained repo list. - ProviderModel — read/rewrite the
--model/-mtoken inside a provider'sRunCommand. - ProviderCredentials / KimiConfigSync / LlmCredentials / ClaudeAuthStatus — push each provider's Vault-held API key (edited via
Menus/SettingsMenu.cs, stored in the sharedLlmCredentialStoreat%APPDATA%\MindAttic\LLM\providers.json) to where its CLI reads it (env var for Claude/Codex/Gemini; idempotentconfig.tomlsplice for Kimi) right before launch — except Claude, where an active claude.ai login (~/.claude/.credentials.json) always wins and the push is skipped entirely. - ExecutableResolver — resolve npm
.cmd/.ps1CLI shims thatProcess.Startcan't find. - ProjectCompanionService — ensure a project's companion service (e.g. Prose.Hub) is running before an agent session starts.
- ClaudeStatusService — read Claude Code usage data from
~/.claude/*for the main-menu status block (60 s cache). The rate-limit line reads the orchestrator's pace status from therl-statusrow of itsorchestrator.dbstatetable (read-only, short busy timeout), or~/.claude/rl-status.json, whichever is newer (M.LNCH-T44). - TitlePinner — per-tab watchdog that pins a busy/idle tab title.
- HostInputPipeServer / RemoteControlBroadcaster — per-tab named-pipe input + broadcast.
- BuildFreshness / ExePath — detect a stale running binary; resolve self/release exe paths.
- Interop: CommandLineParser (argv split honoring quotes), ConsoleBuffer, ConsoleInputInjector.
5. The Laws
This project inherits the org-wide laws in MindAttic.HouseRules.md by reference — they are not restated here. The directly load-bearing inherited laws for this repo:
- HOUSE-LAW-1 — whole-number versioning (the csproj is pinned at
1.0.0with a major-only bump comment). - HOUSE-LAW-3 — credentials resolve through MindAttic.Vault (settings + FTP creds via Vault, never hard-coded).
- HOUSE-LAW-6 — one engine, many front doors (the interactive menu and the
commit/hostsub-commands share the same services + DI graph). - HOUSE-LAW-8 — done is verified, not asserted (every
✅in USER_STORIES.md cites a test). - HOUSE-LAW-9 —
psstonly on explicit request.
Project-specific laws:
A failed external command fails loudly, never silently.
An explicit --provider that doesn't resolve, an empty RunCommand, or a missing project is a distinct non-zero exit code (4 / 2 / 1), not a quiet fallback to a default — hiding the mistake would start the wrong agent. (Commands/HostAgentCommand.cs.)
Settings round-trip is loss-free.
Every model that Vault persists carries [JsonExtensionData] Extra so keys a sibling tool wrote, or a future schema adds, survive a Save instead of being silently dropped. (Models/AppSettings.cs, Models/Project.cs, Models/AgentProvider.cs.)
A backup means a real database backup, not a file copy.
robocopy snapshotting a live .mdf or .db is not a backup, so backup also runs sqlcmd BACKUP DATABASE (schema + data, checksummed, copy-only) per configured SQL Server database and sqlite3 .dump per configured SQLite database, alongside the file snapshot and an %APPDATA%\MindAttic zip (Vault settings/credentials — otherwise a restore would come back with every repo and database but none of Vault's own state). restore and bootstrap consume exactly this layout back; there is no second, divergent backup format. (Services/SqlBackupService.cs, Services/SqliteBackupService.cs, Services/BackupService.cs.)
Windows Terminal edits are idempotent splices.
Writing a MindAttic-<Name> scheme into WT settings.json returns the contents unchanged if a scheme with that name already exists — never duplicating or clobbering the user's WT config. (Services/WindowsTerminalSchemes.cs.)
Orchestration only; no agent, no LLM here.
This binary launches and hosts agents; deploys are run from MindAttic.Deploy itself. No code path links an LLM SDK, makes an LLM API call, or owns an FTP/deploy pipeline; spawning an agent CLI that itself talks to an LLM is orchestration, not an LLM call. (Commands/HostAgentCommand.cs.)
6. Verified state
Evidence (2026-10-14, net10.0-windows):
- Build:
dotnet buildsucceeds (TreatWarningsAsErrors=true,Nullable=enable). - Tests:
dotnet test→ 214 passed, 0 failed, 0 skipped (NUnit 4), ~400 ms. - Coverage spans: settings/Vault round-trip + legacy seed + unknown-key preservation (
SettingsStoreTests); provider list resolution + model-flag rewriting (AgentProviderRegistryTests);git --porcelainparsing incl. renames/untracked/both-modified + auto message (GitServiceTests); the dated-backup-folder allocator + exclude lists (BackupServiceTests); SQL Server backup path/SQL composition (SqlBackupServiceTests); SQLite backup path composition + the missing-file guard (SqliteBackupServiceTests); WT scheme splice idempotency (WindowsTerminalSchemesTests); argv quoting (CommandLineParserTests); discovery (ProjectDiscoveryTests); tab-title rules (ProjectTests); title-pinner busy detection (TitlePinnerTests); remote-control broadcast (RemoteControlBroadcasterTests); build freshness (BuildFreshnessTests); color palette (ColorPaletteTests); WT launcher (WindowsTerminalLauncherTests); roster (ProjectRosterTests); model-flag rewriting (ProviderModelTests); provider credential push incl. the claude.ai-login precedence (ProviderCredentialsTests,KimiConfigSyncTests,ClaudeAuthStatusTests); CLI shim resolution (ExecutableResolverTests); companion-service startup (ProjectCompanionServiceTests). - See USER_STORIES.md for the per-capability status + verifying test names.
7. Active frontier
- Open RFC:
rfc/0001-testable-menus.md— make the interactive menu flows testable (closes M.LNCH-US-A5). - Backlog and partial/planned capabilities live in USER_STORIES.md under Priority backlog. The headline goal is a frictionless single-binary workspace orchestrator; the menus exercised only interactively (Backup/Open/Commit/Settings wiring) are the least test-covered surface and the next place to add coverage.
8. Quality bar
A feature is done (✅) only when:
- It builds clean under
TreatWarningsAsErrors=truewith nullable enabled. - Pure logic (parsing, path/SQL/command composition, resolution, allocation, idempotency) is covered by an NUnit test, and that test is green.
- External-process invocations are factored into a pure, testable seam (injectable runner / predicate / enumerator) so the decision is tested even when the process isn't run.
- The capability's story in USER_STORIES.md cites the verifying test. Anything proven only by hand stays
🟡.
9. Glossary
- Workspace root —
D:\Projects\MindAttic, the parent dir holding every MindAttic repo. - Roster — the
Projectslist in settings; the set of managed repos. - Provider — a launchable agent CLI (
AgentProvider.RunCommand, e.g.claude,codex). - Host / host tab — a
wttab runningmindattic host, which execs a provider with inherited stdio rooted at a repo (or--pathdirectory, e.g. a General tab at the workspace root). - Pinner —
TitlePinner, the per-tab loop that keeps a busy/idle glyph in the tab title. - Discovery — startup scan for git repos under the root not yet in the roster.
- Vault — MindAttic.Vault, the
%APPDATA%\MindAttic\...settings/secret store. - Scheme — a
MindAttic-<Name>Windows Terminal color scheme (shared ANSI palette, per-project background). - Sibling repo — another repo under the workspace root (e.g. MindAttic.Deploy).