Problem
After long interactive coding sessions, the main agent tends to leak the conversation itself — design rationale, paths not taken, defensive justifications addressed to imagined reviewers — into source comments. The result is files where comments outweigh their cost: large diffs, harder reviews, and "code" that has to be maintained alongside the real code.
This problem is not observed (or is far less pronounced) when orchestrated-coder writes code from a plan, suggesting the trigger is conversational accumulation rather than a general comment-style gap. The main agent, having just argued through a design decision with the user, restates that argument in a /** */ block; having explored an edge case in chat, defensively notes "this case is unreachable" in code; having justified a layout choice in conversation, repeats the justification in a JSX comment.
Concrete examples (from a recent session)
- A 25-line file header on a 281-line component, restating what the per-function JSDoc and section comments already say.
- A 15-line file header on a sandbox demo whose default export already carries a one-line JSDoc — making the entire header redundant.
- Inline comments that paraphrase the next line ("Tab to the combobox" above
await user.tab()).
- Defensive prose about non-existent edge cases ("The singular '1 option' case is unreachable and is not special-cased").
- The same fact (a
maxWidth: 360px constraint and its rationale) documented in two places — a JSX comment at the call site and a JSDoc on the constant.
- Domain coupling in a
common/ component: "Defaults to 2 (the planning-grid contract)."
- Re-teaching the underlying library: "Atlaskit Select renders a combobox role…"
Across three files in one commit, comments accounted for ~120 of ~750 lines. A reasonable target after trimming was ~40 lines — a ~65% reduction without losing any signal.
Relevant considerations
- Function/method/class/component descriptions are non-negotiable. Even a one-line description per function is good. The problem is volume beyond that, not the practice itself.
- One-line JSDoc is usually enough. The current guidance ("favor concision, but prioritize communicating the essential information") leaves room for the current behavior.
- The trigger is conversational, not stylistic. Adding more rules to global guidance alone is unlikely to fix it — the agent has the rules; it just stops applying them under conversational pressure to "show its work."
orchestrated-coder doesn't exhibit the pattern because it works from a written plan with no conversation context to leak. This is a useful contrast — the fix may involve treating interactive coding sessions more like orchestrated ones at the comment-writing step.
Proposed solution
Add a concise set of comment-discipline rules to the global guidance, and reinforce them at a checkpoint the main agent must hit before completing an interactive coding turn.
Rules to add (terse, deletion-oriented)
- One brief description per function/method/class/component. One line is usually enough. Trivial code (simple getters, one-line helpers fully described by their name) may omit it.
- Don't paraphrase the next line. If a comment restates the code below it in English, delete the comment.
- No tutorial-style file headers. A file header earns its place only when it documents non-obvious architecture (composition order, invariants across functions, threading model). It must not duplicate per-function JSDoc. If the default export already has a one-line JSDoc and the file is a single concept, no file header is needed.
- Don't explain unreachable cases or hypothetical bugs. "X is always ≥ 2 by construction" is reviewer-defensive padding. If an invariant matters, encode it as an assertion or type, not prose.
- Don't document the library you're using. "Atlaskit Select renders a combobox role" belongs in Atlaskit's docs, not your code.
- One location per fact. If a constant has JSDoc, its call site doesn't need a comment repeating it.
- Inline comments answer "why," not "what." "Render the pill in place of the next chip" is what the code does; "react-select types value as a union; narrow to array" is why the cast exists. Keep only the second kind.
- No process commentary in code. "Centralizes the typing boundary," "Matches the X precedent," "Future readers should note…" — these document the author's reasoning, not the code's behavior. Put them in the PR description or a commit message.
- No domain leaks in shared/common code. A
common/ component's JSDoc shouldn't reference a specific consumer ("the planning-grid contract").
- Lines of code are lines of code, even when they are comments. They have to be maintained. Every comment must earn its weight.
Mechanism (optional but recommended)
Lightweight self-review step before the agent declares a coding turn complete:
Before finishing a coding turn, scan added/modified comments. For each comment, ask: would a competent reviewer reading the code lose anything if I deleted this? If no, delete it. Pay special attention to comments that restate design discussion from the current session — that material belongs in commit messages or PR descriptions, not in source.
This checkpoint targets the specific failure mode (conversation leakage) rather than relying on the agent to internalize the rules under accumulated context.
Acceptance
- Comment-discipline section added to shared agent guidance.
- A short note added to the interactive-coding flow (or its equivalent) that triggers the self-review step above before turn completion.
- Verified by re-running a comparable interactive coding task and observing that comment density falls into the same range as
orchestrated-coder output.
Problem
After long interactive coding sessions, the main agent tends to leak the conversation itself — design rationale, paths not taken, defensive justifications addressed to imagined reviewers — into source comments. The result is files where comments outweigh their cost: large diffs, harder reviews, and "code" that has to be maintained alongside the real code.
This problem is not observed (or is far less pronounced) when
orchestrated-coderwrites code from a plan, suggesting the trigger is conversational accumulation rather than a general comment-style gap. The main agent, having just argued through a design decision with the user, restates that argument in a/** */block; having explored an edge case in chat, defensively notes "this case is unreachable" in code; having justified a layout choice in conversation, repeats the justification in a JSX comment.Concrete examples (from a recent session)
await user.tab()).maxWidth: 360pxconstraint and its rationale) documented in two places — a JSX comment at the call site and a JSDoc on the constant.common/component: "Defaults to 2 (the planning-grid contract)."Across three files in one commit, comments accounted for ~120 of ~750 lines. A reasonable target after trimming was ~40 lines — a ~65% reduction without losing any signal.
Relevant considerations
orchestrated-coderdoesn't exhibit the pattern because it works from a written plan with no conversation context to leak. This is a useful contrast — the fix may involve treating interactive coding sessions more like orchestrated ones at the comment-writing step.Proposed solution
Add a concise set of comment-discipline rules to the global guidance, and reinforce them at a checkpoint the main agent must hit before completing an interactive coding turn.
Rules to add (terse, deletion-oriented)
common/component's JSDoc shouldn't reference a specific consumer ("the planning-grid contract").Mechanism (optional but recommended)
Lightweight self-review step before the agent declares a coding turn complete:
This checkpoint targets the specific failure mode (conversation leakage) rather than relying on the agent to internalize the rules under accumulated context.
Acceptance
orchestrated-coderoutput.