Audit KMP codebase for bloat via parallel subagents
Session from pi-coding-sessions on Hugging Face by championswimmer · MIT · condensed by Coders Talk
Run an extensive research pass across every module of a Kotlin Multiplatform 2FA app (sharedLib, composeApp, cliApp, androidApp, iosApp, watchApp, website) to find bloat and unnecessary abstractions, using parallel subagents that message each other and coordinating their findings into a structured simplification plan.
- +0Prompt · +0Use subagents (up to 10 parallel) to research the codebase for bloat and useless abstractions, per platform (android, ios, compose, cli, etc), and write findings into .agents/plans/27-code-simplification/ as detailed per-module plans.
- +0mAgent did · +0mExplored repo structure, read AGENTS.md/skill files for each module, and ran file-count/LOC stats per module (sharedLib, composeApp, cliApp, androidApp, iosApp, watchApp, website) to scope the audit.
- +1mAgent did · +1mSpawned 7 parallel subagents via the subagent tool, one per module, each producing a detailed audit report; joined a messenger channel for agents to coordinate. All 7 tasks succeeded and returned full audit reports.
- +14mAgent did · +14mDeep-dived personally into specific suspicious areas (duplicate importer adapters, onboarding contributor classes, watch sync coordinators, tracked build artifacts, duplicate icons/website compare pages) to verify or extend the subagents' findings, including two Perplexity lookups for best-practice guidance (Android backup flags, watchOS timer patterns, coroutine async/await anti-pattern).
- +15mFail · +15mMultiple file-read attempts hit ENOENT because files had moved or didn't exist where the agent expected (e.g. importer adapters, libtwofac.kt, onboarding assemblers, MainActivity.kt), forcing repeated find/grep to locate the real paths.
- +18mAgent did · +18mWrote 8 detailed plan documents (00-overview.md plus 01 through 08, one per module) into .agents/plans/27-code-simplification/, each with phased progress checklists based on the audits.
- +20mAgent did · +20mAttempted to message each subagent back via pi_messenger to confirm their findings were incorporated into the written plans, but all 7 sends failed because the agents were no longer registered/found.
- +20mAgent did · +20mApplied a context-management skill: inspected context usage/log and created a semantic milestone tag 'code-simplification-research-plan-done' as a safe checkpoint before any actual code changes.
- +20mOutcome · +20mProduced 8 plan documents (00-overview plus 01-08, one per module) under .agents/plans/27-code-simplification/, consolidating 7 parallel subagent audits; no code changed yet, session ended with a context checkpoint tag ready for implementation phase.
I'd tell it up front which files/paths are likely stale so it doesn't waste turns hitting ENOENT on renamed importer adapters and onboarding files — that was the main friction. The parallel subagent + messenger setup worked well for the actual research fan-out, but the post-hoc attempt to message agents back after the run was pointless since they'd already gone; I'd skip that step next time and just rely on the written plan files as the source of truth.