Skip to content

optimize: session-outlier detector flags every project's founding/bootstrap session as waste #664

Closed

Description

@quietloom

What's happening

detectSessionOutliers in src/optimize.ts flags a project's founding/bootstrap session as a "high-cost session outlier," even though it's legitimate one-off scaffolding work, not waste.

Concretely: a brand-new project's first session ran the full build pipeline in one sitting — brainstorm → plan → subagent-driven-development (24 agent dispatches) → build → promote to v1.0 prod. It cost 26.5x the project's (still-thin, 2-3 session) average and got flagged by the outlier detector. The detector's leave-one-out average math is fine; the issue is that a founding session is a different kind of work than a routine session in the same project, not an expensive instance of the same kind. No cost multiplier threshold can distinguish those — it's a category error, not a magnitude one. This pattern is structural: it will recur for every new project's first session, every time.

Why it matters

The finding is user-facing ("N high-cost session outliers... usually come from broad prompts, runaway loops, or context-heavy work that should be split into smaller sessions") — for a founding session that framing is actively wrong and could push someone to needlessly second-guess a normal project kickoff.

Suggested fix

The exclusion mechanism for this already exists — detectSessionOutliers takes an excludedSessionIds set, currently populated from other findings for cross-finding dedup:

const outlierExclusions = new Set([...lowWorthSessionIds, ...contextBloatVisibleIds]);

Each session already carries firstTimestamp, so identifying each project's earliest session is a cheap addition to the same set:

const firstSessionIds = new Set(
  projects.map(p => p.sessions.reduce((min, s) =>
    !min || s.firstTimestamp < min.firstTimestamp ? s : min, null)?.sessionId
  ).filter(Boolean)
);
const outlierExclusions = new Set([...lowWorthSessionIds, ...contextBloatVisibleIds, ...firstSessionIds]);

Happy to be wrong about "earliest session" being the right proxy — a project could ramp up its founding work across 2-3 sessions rather than one — but it matched the case I hit, and it's cheap/available data versus something like detecting the subagent-driven-development pattern by tool-call shape, which would be far more fragile.

Environment

codeburn 0.9.15, via codeburn optimize --format json, Windows.

Activity

  1. added a commit that references this issue on Jul 16, 2026
    4ef32c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions