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

chore: update changelog and PLAN.md for subAgentSpawner decomposition

Adam Eivy2becb9a06d43
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index bd08cf1b87..6ec6fb8d4c 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -42,5 +42,14 @@
- `getAllTwinContent()` now parallelizes all `readFile()` calls with `Promise.all`
- Added `extractJSON()` and `ensureDocumentInMeta()` helpers to `digital-twin-helpers.js`; three duplicate document-push blocks in enrichment module replaced with helper calls
+## Changed
+- God file decomposition: split `server/services/subAgentSpawner.js` (3,820 lines) into 9 focused modules (`agentState`, `agentModelSelection`, `agentRunTracking`, `agentErrorAnalysis`, `agentCompletion`, `agentPromptBuilder`, `agentCliSpawning`, `agentLifecycle`, `agentManagement`); main file is now a 187-line orchestrator with re-exports for backward compatibility
+- `isTruthyMeta`/`isFalsyMeta` consolidated into `agentState.js` (single source of truth)
+- `terminateAgent`/`killAgent` runner path de-duplicated via shared `terminateRunnerAgent` helper
+- `killAllAgents` now terminates all agents in parallel with `Promise.all`
+- `buildAgentPrompt` context fetches (memory, CLAUDE.md, digital twin, tools) and `.planning/` file reads now run in parallel
+- `safeParse` in `agentCliSpawning.js` replaced with `safeJSONParse` from fileUtils
+- Removed TOCTOU `existsSync` guards in `agentPromptBuilder.js`; rely on `.catch(() => null)` instead
+
## Fixed
- JIRA report provider discovery now tries all available API providers instead of failing on first unreachable one
diff --git a/PLAN.md b/PLAN.md
index 8e3a8020ef..ab71277025 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -6,7 +6,7 @@ For project goals, see [GOALS.md](./GOALS.md). For completed work, see [DONE.md]
## Next Up
-1. **God file decomposition** — routes/cos.js ✅, routes/scaffold.js ✅, client/api.js ✅, services/digital-twin.js ✅ (split into 10 focused modules). Remaining: services/subAgentSpawner.js (3,820 lines)
+1. **God file decomposition** — routes/cos.js ✅, routes/scaffold.js ✅, client/api.js ✅, services/digital-twin.js ✅ (split into 10 focused modules), services/subAgentSpawner.js ✅ (split into 9 focused modules). **All god files decomposed.**
## Backlog