Skip to main content
New aislop v0.13.1 patch — calibrates hidden-fallback detection and fixes regex comment-masker false positives. Read the changelog →
ai-slop/narrative-comment auto-fixable

Narrative comment.

A multi-line comment block that walks through what the function does in prose. The signature already says it; the prose is decorative.

Flagged shape and clean shape.

Each example shows the exact code shape the rule is looking for, then the smallest version that keeps the intent without hiding risk or adding noise.

Flagged example
// This function takes a user ID and a list of orders,
// filters the orders to only those belonging to the user,
// then sums the total amount across them and returns it.
function sumUserOrders(userId: string, orders: Order[]): number {
  return orders
    .filter(o => o.userId === userId)
    .reduce((sum, o) => sum + o.amount, 0)
}
Why this trips

Deterministic comment-block parse: flags consecutive comment lines that paraphrase the immediately following declaration.

Clean example
function sumUserOrders(userId: string, orders: Order[]): number {
  return orders
    .filter(o => o.userId === userId)
    .reduce((sum, o) => sum + o.amount, 0)
}
What changed

Delete the prose that repeats the code and leave the implementation readable through names and structure. Keep a comment only when it explains intent, a constraint, or an external contract the code cannot express.

Agents are trained to "explain" code. They pad function bodies with explanatory preambles even when the signature, parameter names, and operator chain already tell the same story.

How this rule is justified.

Rule id

ai-slop/narrative-comment

Enforcing engine

ai-slop

Detector strategy

Deterministic comment-block parse: flags consecutive comment lines that paraphrase the immediately following declaration.

Legitimate code that is NOT flagged

WHY comments, license headers, doc comments documenting public API contracts, and comments stating a non-obvious constraint are not flagged.

Evidence

Verbosity signals derive from SlopCodeBench, which measured comment padding in long-horizon coding tasks, and recurred across the first public scan batch.