How maintenance works

Maintenance starts from your corrections. Each time a person on the team fixes an agent's work, by a message, a send-back or a push of their own, Spotlight records it. When the same mistake comes back on several tasks, Spotlight shows it to the team as a pattern, and the team can turn it into a fix that stops the mistake for good.

In the docs' view, a team that corrects the same mistake by hand each week pays for it each week. A prompt or a memory can ask the agents not to repeat it, but an agent can still miss the request. A lint rule, a type or a test cannot be missed. So maintenance tries to move each repeated correction as high up as it can go: into the code first, then into a check, and into prose only last.

Corrections

A correction is one thing a team member did to fix an agent's work on a task, after an agent run on it:

  • a message on the task;
  • a send-back, or a hold as wrong, with its reason;
  • a review comment on the task's pull request;
  • a push to the task's branch over the agent's commits;
  • a revert of the task's merged pull request.

A message before any agent run is a brief, not a correction. Text from a person who is not on the team, such as an outside reviewer, is never a correction. In the docs' view, that keeps text from outside the team out of an agent's brief. Only the work on the line's own repositories counts.

A review comment counts when GitHub marks its author as an owner, member or collaborator of the repository. A comment from a bot never counts. Spotlight cannot link a GitHub login to a team member, so it does not check that the author is on the team.

A person who fixes the agent's work outside the task, such as in a later pull request of their own, makes no correction that Spotlight sees.

Patterns

Once people decide a task, or its pull request closes, Spotlight reads all of the task's new corrections at once with a model. For each, it writes a short line on what was wrong, and joins it to a pattern the line already has, or starts a new one. The call costs money, so a team spends at most 5 USD a month on it. Spotlight reserves 0.25 USD for each call before it starts the call, and replaces the reservation with the real price when the call ends, also when the call fails. A call that reports no price in dollars is unpriced, and keeps the 0.25 USD. A call that never reports its cost, because it waits too long, stops after its retries or its task is deleted, is estimated, and keeps the 0.25 USD too. When what the team spent and reserved reaches the cap, the next tasks wait for the next month.

Each pattern has one of three types, for where the cause is:

  • codebase: in the code, such as an interface that invites the mistake or a check that is missing.
  • station: in the station's config, such as its prompt, skills or check.
  • process: in how the run worked, such as running the tests too late or starting from the wrong branch.

A pattern waits for the team once it has 3 corrections on at least 2 tasks within 14 days. Before that, it is only watched. In the docs' view, one correction can be a matter of taste, and the same correction on two tasks is a habit of the agents. Patterns are ranked by their corrections times their tasks within those 14 days.

What the team does with a pattern

A pattern that waits for the team shows on the Insights Patterns tab, and as a notice in the team's inbox, with the corrections behind it. A person files it or dismisses it. Each type goes where its cause is:

  • A codebase pattern becomes a maintenance task on the line, at the line's maintenance station. The line's own agent works it, because it has the repository. A line with one work station files there. A line with more than one work station must name the station in maintenance.station, or its maintenance stays off.
  • A station pattern starts a search of the station's config, with the pattern as what to fix. See How Spotlight improves a station.
  • A process pattern becomes a proposed team memory, which waits for review in the inbox.

Spotlight shows a pattern before it files anything. In the docs' view, a pattern is a guess by a model, and a person who reads the corrections can tell a real habit from noise. A line can set file = "automatic" to file codebase patterns as soon as they are ready. The limits stay the same: one task for each pattern, at most max_open open maintenance tasks on the line, and the line's own budget and runners.

The maintenance task

The task's description lists the corrections as evidence, with their text, files and links. It asks the agent to make the mistake impossible to repeat, in this order:

  1. A check that fails on it: a lint rule, a type, a test or a CI step.
  2. A change to the code that removes the cause: a helper, a safer default or a clearer interface.
  3. Documentation in the repository, only when neither of the above is possible.

A new check must prove itself on the history. The agent runs spotlight maintenance check, which runs the check on the code before and after each fix that people pushed. A good check fails before the fix, passes after it, and adds no failure that the old checks did not already report. The task's pull request quotes the result, and people review it as any other pull request. Nothing merges without them.

After the fix

When the maintenance task's pull request merges, the pattern is fixed, and Spotlight watches for new corrections that join it. After 30 days with none, it is resolved. A new correction made after the fix merged opens the pattern again, and adds a note to the maintenance task. A correction made before the merge only joins the pattern.

A maintenance task can have more than one pull request. The pattern is fixed when all of them are merged or closed and at least one merged. It is dismissed when all of them closed with no merge.

When a task is deleted, its corrections leave every pattern, and the counts and rank change to match. A pattern with no corrections left is deleted. When a line is deleted, its corrections and patterns are deleted. A pattern that is deleted resolves its notice in the inbox.

A person who dismisses a pattern leaves it for 90 days. It comes back sooner only when people correct the same mistake twice as often. A maintenance task that closes with no merge dismisses its pattern the same way.

Measures

Each line's section of the Patterns tab shows whether maintenance helps:

  • corrections per run on the line's stations in the last 30 days, against the 30 days before. Runs that were refused, cancelled, or ended on a setup or infrastructure failure are not counted;
  • how many times people filed and dismissed patterns;
  • how many maintenance tasks merged, and how many closed without a merge. These counts keep a fix that merged even after its pattern opens again;
  • how many corrections a history check caught, of those it checked;
  • what grouping corrections spent this month, against the cap.

On this page