Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

docs([commands-centralized-parser]): prune already-shipped stale PLAN item

[._.]/ Adam Eivye4a56bb72a5e
diff --git a/PLAN.md b/PLAN.md
index 912bc11965..4eabc20330 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -6,7 +6,6 @@ For project goals, see [GOALS.md](./GOALS.md). For completed work, see [.changel
Claimable, well-specified, no decision needed — `/claim`-able. Unordered.
-- [ ] [commands-centralized-parser] **`commands.js` re-implements command parsing with a naive `split(/\s+/)` instead of the centralized quote-aware parser.** `server/services/commands.js:28` splits on whitespace (breaks quoted args) and only imports `ALLOWED_COMMANDS`/`DANGEROUS_SHELL_CHARS` from `commandSecurity.js` — not its `parseCommandArgs`/`validateCommand`. Route through `validateCommand` so allow-listing, dangerous-char checks, and quote-aware arg parsing are one verified step. Verified (gemini IMPROVEMENT).
- [ ] [settings-getsave-callers-stale-base] **Migrate `getSettings()→saveSettings({...spread})` callers off the external-read pattern.** `settings.js` now serializes `saveSettings`/`updateSettings` on a per-file write queue, but four callers (`server/routes/imageGen.js:724,736`, `server/routes/loras.js:62,76`) still read via `getSettings()` *outside* the queue, mutate, then `saveSettings(...)` — so a concurrent `updateSettings` landing between their read and queued write is clobbered by their stale base. The clean fix is a deep-merge-aware queued updater they can call (a plain `updateSettings` swap would change semantics: loras uses `deepMerge`, but `updateSettings` shallow-merges, which would drop sibling `civitai.*` keys; imageGen:736 deletes a sub-key by spreading rest). Low value in a single-user install (concurrent settings writes are rare) — surfaced by codex review during the settings atomicWrite migration; deferred for scope + merge-semantics risk.
- [ ] [json-state-serialization-one-mechanism] **Two serialization mechanisms guard single-JSON-file writes — pick one.** `server/services/cosState.js` serializes `state.json` writes with the `withStateLock` async mutex (`createMutex`), while `settings.js` (and the issues/series/mediaCollections splits) serialize with `createFileWriteQueue` (single-tail promise chain). Both solve the same "don't let two read-merge-write cycles interleave on one file" problem. Standardize on `createFileWriteQueue` (the documented convention in CLAUDE.md and `fileWriteQueue.js`) and retire the mutex path: route `cosState.saveState`/`loadState`-mutating callers through a per-file queue, then drop `withStateLock`. Low value (both are correct today), and `withStateLock` is imported by several CoS modules so the migration needs care — surfaced by /simplify altitude during the settings atomicWrite migration.
- [ ] [worktree-remove-helper] **Extract the repeated "worktree remove --force → on-fail rm + prune" dance into one helper.** The pattern is now inlined in 4 spots in `server/services/worktreeManager.js`: `removeWorktree`, `reapMergedWorktrees`, `cleanupExternalRepoWorktrees`, and `removePersistentWorktree`. Extract `forceRemoveWorktreeDir(repo, worktreePath, label)` and route all four through it.