Skip to content
PirefactorCLI & tooling9 files · +592 −0

Audit KMP codebase for bloat via parallel subagents

Session from pi-coding-sessions on Hugging Face by championswimmer · MIT · condensed by Coders Talk

20msession
0interventions
GOAL

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.

  1. Prompt · +0
    Use 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.
  2. Agent did · +0m
    Explored 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.
  3. Agent did · +1m
    Spawned 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.
  4. Agent did · +14m
    Deep-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).
  5. Fail · +15m
    Multiple 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.
  6. Agent did · +18m
    Wrote 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.
  7. Agent did · +20m
    Attempted 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.
  8. Agent did · +20m
    Applied 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.
  9. Outcome · +20m
    Produced 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.
VERDICT

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.

I tried this · 0

Discussion · 0

How Builds work