SlopCop Report
itayinbarr/little-coder
- Case
- CASE-54AD8E79
- Access
- Public
- Filed
- Jul 07, 2026
- Surface
- Most Wanted
Scorecard
| Measure | Notes | Score |
|---|---|---|
| Understandability | Measured cyclomatic complexity reaches 48 in `runSubCoderOnce` within `.pi/extensions/subagent/spawn.ts`, with additional measured hotspots at 28 in `orchestrate` within `.pi/extensions/plan-mode/index.ts` and 27 in `summarizeActivity` in `.pi/extensions/subagent/spawn.ts`; the concentration is real but localized to orchestration code. | 6/10 |
| Duplication & Abstraction | Measured clone evidence shows 100% token-similar copies of `askQuestions` across `.pi/extensions/plan-mode/index.ts` and `.pi/extensions/deep-research/index.ts`, plus duplicated `extractJsonArray` logic in `.pi/extensions/plan-mode/index.ts` and `.pi/extensions/deep-research/helpers.ts`. | 7/10 |
| Failure Handling | Sampled source review found blanket `catch {}` handling around `ctx.ui.select` and `ctx.ui.input` in `.pi/extensions/plan-mode/index.ts` and silent JSON-parse fallback in the same module; the same pattern around `proc.kill` in `.pi/extensions/subagent/spawn.ts` was judged reasonable cleanup. | 4/10 |
| Test Signal | Sampled tool output returned zero assertion-smell findings across eight inspected test files, and source review of `.pi/extensions/extra-tools/glob.test.ts`, `.pi/extensions/permission-gate/permission.test.ts`, and `.pi/extensions/thinking-budget/budget.test.ts` showed specific state and regression assertions. | 1/10 |
| Comment Intent | Sampled source review of `.pi/extensions/plan-mode/index.ts`, `.pi/extensions/branding/index.ts`, `.pi/extensions/subagent/spawn.ts`, and `.pi/extensions/context-watchdog/index.ts` found implementation-specific comments tied to edge cases and issue history rather than generic boilerplate. | 1/10 |
Specialist summary
| Specialist | Status | Score | Finding |
|---|---|---|---|
| Det. KnotsCognitive Complexity Specialist | Material findings | N/A | The functions runSubCoderOnce and summarizeActivity in .pi/extensions/subagent/spawn.ts exhibit elevated cyclomatic complexity.
|
| Det. SprawlSize & Sprawl Specialist | Material findings | N/A | The runSubCoderOnce function in spawn.ts exhibits a high cyclomatic complexity of 48.
|
| Det. EchoStructural Duplication Specialist | Material findings | N/A | Verbatim function block copies like askQuestions between decoupled directories.
|
| Det. FallbackError Handling Specialist | Material findings | N/A | Generic UI catch blocks swallow interaction-loop failures and key errors.
|
| Det. MorgueDead Code & Abstraction Specialist | Scoped check | N/A | Det. Morgue found no issue in the sampled scope.
|
| Det. AlibiTest Signal Specialist | Scoped check | N/A | Det. Alibi found no issue in the sampled scope.
|
| Det. MarginsComment Intent Specialist | Scoped check | N/A | Det. Margins found no issue in the sampled scope.
|
Full report
Executive Summary
The engagement lead assessed a small TypeScript and Node.js CLI extension repository built around the pi runtime. Severity is moderate: sampled tests and comment intent are strong, but a few core extension files concentrate too much control flow and sibling features carry exact copy-paste helpers. Maintainability risk is medium because the hotspots sit on central execution paths such as .pi/extensions/subagent/spawn.ts, .pi/extensions/plan-mode/index.ts, and .pi/extensions/deep-research/index.ts. AI-slop confidence is medium rather than high; the exact clones are suspicious, but the repository also shows issue-linked comments, deliberate terminal edge-case handling, and precise regression tests that fit human-maintained software better than indiscriminate generation.
This closing scorecard summarizes the observed slop profile.
Background
The repository appears to be little-coder, a TypeScript package that layers multiple extensions on top of the pi coding-agent runtime. package.json identifies a Node.js 22.19+ package with tsc --noEmit type checking and vitest run tests, while README.md describes a CLI for local and cloud models. The audit scope was hotspot-guided: the engagement lead reviewed repository structure and then validated specialist evidence in .pi/extensions and representative tests rather than enumerating the entire tree.
The following paths anchor the reviewed scope.
Methodology
Maintainability signals were investigated via static analysis covering cognitive and cyclomatic complexity, structural duplication, error-handling smells, dead-abstraction checks, test-signal review, and comment-intent review. Candidate findings were filtered by agent-led triage and then validated through targeted source inspection of README.md, package.json, tsconfig.json, .pi/extensions/plan-mode/index.ts, .pi/extensions/deep-research/index.ts, .pi/extensions/deep-research/helpers.ts, .pi/extensions/subagent/spawn.ts, and sampled test and comment hotspots. Confidence is bounded in two ways: the specialist work was hotspot-guided rather than repo-exhaustive, and the complexity lane reported a parser limitation that left the auditor relying on measured cyclomatic complexity rather than cognitive-complexity scores for the main TypeScript hotspots.
Findings
The validated risk is concentrated rather than repository-wide. Three findings matter most: orchestration complexity in the subagent runner, exact clones between sibling extensions, and selective failure masking in planning prompts and parser helpers. The measured hotspots and directly reviewed clone locations are listed below.
Measured cyclomatic complexity reaches 48 in `runSubCoderOnce`, and the same file also carries measured complexity 27 in `summarizeActivity`. Child-process launch, stdout parsing, watchdog timing, usage aggregation, and tracker updates remain bundled in one hotspot.
proc.stdout.on("data", (d) => {
buffer += d.toString();
const lines = buffer.split("\n");
buffer = lines.pop() ?? "";
for (const line of lines) processLine(line);
});Measured cyclomatic complexity reaches 28 in `orchestrate`. The same file also holds one of the duplicated `askQuestions` implementations and catch-all handling around `ctx.ui.select`, `ctx.ui.input`, and JSON parsing fallback.
try {
choice = await ctx.ui.select(q.q, options);
} catch {
choice = undefined;
}This file contains a verbatim copy of `askQuestions` that matches the `plan-mode` version, including identical skipped-answer behavior and the same `Other` input flow.
async function askQuestions(ctx: any, questions: Question[]): Promise<string> {
const answered: string[] = [];
for (const q of questions) {
const options = [...q.options, OTHER_SENTINEL].filter(Boolean);This file contains a second copy of `extractJsonArray`, duplicating the parser contract already defined in `.pi/extensions/plan-mode/index.ts`.
export function extractJsonArray(text: string): any[] {
const start = text.indexOf("[");
const end = text.lastIndexOf("]");
if (start < 0 || end <= start) return [];
try {
const v = JSON.parse(text.slice(start, end + 1));
return Array.isArray(v) ? v : [];
} catch {
return [];
}
}Finding 1 — Concentrated control flow in the subprocess runner. The measured cyclomatic complexity of 48 in runSubCoderOnce and 27 in summarizeActivity, both in .pi/extensions/subagent/spawn.ts, shows that process launch, stream buffering, JSON event parsing, watchdog timing, and UI state reporting are still bundled together. The file role explains part of that shape, so the finding is a maintainability hotspot rather than a strong AI-slop indicator. The risk is that small changes to child-process behavior will require edits in a densely branched routine that is already doing several jobs.
Finding 2 — Exact clones across sibling orchestration modules. The auditor directly confirmed that askQuestions is duplicated between .pi/extensions/plan-mode/index.ts and .pi/extensions/deep-research/index.ts, and that extractJsonArray is duplicated between .pi/extensions/plan-mode/index.ts and .pi/extensions/deep-research/helpers.ts. This is the strongest AI-slop-adjacent signal in the repository because the duplication is exact and crosses feature boundaries, but a deliberate isolation strategy remains a credible competing explanation. Regardless of origin, the maintenance cost is real: future bug fixes in prompt handling or JSON extraction can diverge unless both copies change together.
Finding 3 — Some catch-all handlers blur cancellation and failure. In .pi/extensions/plan-mode/index.ts, the askQuestions helper collapses all ctx.ui.select and ctx.ui.input exceptions into skipped answers, and extractJsonArray returns an empty array on any parse failure. That is understandable in a terminal-first planner, yet it also hides unexpected UI or model-format regressions. The same lane reviewed silent proc.kill cleanup in .pi/extensions/subagent/spawn.ts; that specific pattern looked proportionate and was not elevated to a material defect.
Validated Non-Findings
Several specialist checks produced useful non-findings within their inspected scope. The dead-abstraction review did not verify any abandoned symbols in the sampled hotspot modules; deriveSessionName in .pi/extensions/branding/index.ts, makeComponent in .pi/extensions/subagent/index.ts, and PlanStatus usage from .pi/extensions/plan-mode/status.ts were all traced as active. The test-signal review scanned eight test files and manually sampled .pi/extensions/extra-tools/glob.test.ts, .pi/extensions/permission-gate/permission.test.ts, and .pi/extensions/thinking-budget/budget.test.ts; no low-value assertion patterns were found in that sample. The comment-intent review sampled .pi/extensions/plan-mode/index.ts, .pi/extensions/branding/index.ts, .pi/extensions/subagent/spawn.ts, and .pi/extensions/context-watchdog/index.ts; no misleading or stale commentary was found there, and several comments tied behavior to specific edge cases and issue history. These are sampled non-findings, not whole-repository cleanliness claims.
Recommendations
The most effective next steps are narrow and behavior-preserving rather than repo-wide rewrites. Each item below maps back to a validated finding.
- Finding 1: Split
runSubCoderOncein .pi/extensions/subagent/spawn.ts into separate helpers for command assembly, stdout line decoding, and timeout or abort supervision; keep current behavior stable by adding characterization tests around JSON event parsing and watchdog cancellation before the refactor. - Finding 1: Extract
summarizeActivityformatting branches in .pi/extensions/subagent/spawn.ts into smaller message-format helpers or a table-driven formatter so UI wording can change without reopening the child-process control path. - Finding 2: Move shared
askQuestionslogic into a.pi/extensions/_sharedhelper and consolidateextractJsonArrayinto one shared parser module; land both call-site migrations in one change set soplan-modeanddeep-researchcannot drift. - Finding 3: In .pi/extensions/plan-mode/index.ts, distinguish expected user cancellation from unexpected UI or JSON parsing faults; a low-noise debug log or typed error guard is sufficient, while the silent
proc.killcleanup in .pi/extensions/subagent/spawn.ts can remain unchanged unless operational evidence says otherwise. - Findings 1 and 2: Add a scoped CI gate for TypeScript function cyclomatic complexity above 20 and duplication checks within
.pi/extensions/plan-modeand.pi/extensions/deep-research; the gate should be warning-oriented at first because orchestration files naturally produce some false positives.
- The functions runSubCoderOnce and summarizeActivity in .pi/extensions/subagent/spawn.ts exhibit elevated cyclomatic complexity.
- The orchestrate function in .pi/extensions/plan-mode/index.ts exhibits elevated cyclomatic complexity.
- The runSubCoderOnce function in spawn.ts exhibits a high cyclomatic complexity of 48.
- The orchestrate function in plan-mode index.ts exhibits a cyclomatic complexity of 28.
- The summarizeActivity helper exhibits a cyclomatic complexity of 27.
- Verbatim function block copies like askQuestions between decoupled directories.
- Verbatim cloning of extractJsonArray helpers between plan-mode and deep-research files.
- Generic UI catch blocks swallow interaction-loop failures and key errors.
- The function has a catch-all block that silences parsing exceptions during LLM array extraction.
- The child process kill handles signal failures cleanly by catching and discarding errors.
Findings:
- No dead code or abandoned abstractions found in active branding modules.
- No dead code or unused helpers in subagent ui components.
Evidence reviewed:
- .pi/extensions/branding/index.ts
- .pi/extensions/plan-mode/index.ts
- .pi/extensions/subagent/spawn.ts
- .pi/extensions/subagent/index.ts
- .pi/extensions/plan-mode/status.ts
Findings:
- No test assertion smells or low-signal test patterns were found in the inspected test files.
- The thinking-budget recovery tests construct a precise harness to verify strict event sequencing in issue #8.
Evidence reviewed:
- .pi/extensions/extra-tools/glob.test.ts
- .pi/extensions/permission-gate/permission.test.ts
- .pi/extensions/benchmark-profiles/profiles.test.ts
- .pi/extensions/quality-monitor/quality.test.ts
- .pi/extensions/thinking-budget/budget.test.ts
- .pi/extensions/subagent/spawn.test.ts
- .pi/extensions/subagent/issue-51-repro.test.ts
- .pi/extensions/llama-cpp-provider/config.test.ts
Findings:
- Comments across the evaluated extensions are outstandingly dense, highly contextual, and demonstrate clear human-driven reasoning rather than boilerplate or machine-generated text.
- Branding component title and header replacement comments align perfectly with actual execution hooks and correctly call out specific dependencies and setting properties.
- The spawn controller features precise comments that coordinate with the CLI launcher and accurately cite community issue reports and performance characteristics.
- The context watchdog extension comments explicitly reference a specific issue number and provide concrete reasoning for the proactive compaction watchdog workflow.
Evidence reviewed:
- .pi/extensions/plan-mode/index.ts
- .pi/extensions/branding/index.ts
- .pi/extensions/subagent/spawn.ts
- .pi/extensions/context-watchdog/index.ts
- .pi/extensions/subagent/index.ts
Conclusion
The repository is not a blanket slop case. The engagement lead found real, localized maintainability debt in central orchestration files and in exact helper duplication between sibling extensions, but also found strong counter-evidence in sampled tests, issue-linked comments, and the absence of verified dead abstractions in inspected hotspots. Maintainability risk is medium because the hardest code sits on critical execution paths, while AI-slop confidence stays medium and capped by mixed evidence rather than strong diagnosis.
The final judgment is therefore cautious: Evidence suggests possible AI slop, but not conclusively.