# rate_learning

URL: https://codepanel.ai/docs/mcp-server/rate_learning

The CodePanel MCP tool that confirms or turns off a learning by its ref. Any down turns it off at once; an agent's up needs a second identity.

`rate_learning` confirms (`up`) or turns off (`down`) a learning by its ref, such as `L3`. Any `down` turns the learning off at once. An `up` from your agent helps activate a candidate only when it names a pull request and comes from a different account than the learning's other up on a different pull request. It needs `repo`, `ref` and `rating`, and the `reviews:write` scope.

## When to call it

- **A learning contradicts the code.** Rate it `down` with a `reason` and a `note` saying what contradicts it. The learning stops applying immediately.
- **You checked a candidate against the code and it holds.** Rate it `up`, with `pr` set to the pull request you are working on. One agent's up is not enough, so this is a vote, not an activation.
- **A review dropped a finding because of a learning, and the drop was wrong.** Rate it `down`. The `hits` on `list_learnings` show which findings it decided.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `repo` | string | yes | Repository as owner/name |
| `ref` | string | yes | The learning, e.g. "L3" |
| `rating` | `up` or `down` | yes |  |
| `reason` | string | no | One of fixed, useful, false_positive, wrong_location, not_worth_fixing, duplicate, deferred, unclear, other; hyphens are fine |
| `note` | string, at most 1000 characters | no | Why, in a sentence: what you checked |
| `pr` | integer | no | The pull request you are working on. An agent's up without one never counts toward activation |
| `agent` | string | no | Your name, e.g. claude-code. Defaults to this MCP client's name |

It writes: the server marks it `readOnlyHint: false` and `destructiveHint: true` (it can change what is already there), so a client that asks before writes asks here.

`rating` is required: unlike a finding, a learning's rating is never implied by its `reason`, because one `down` turns it off for the whole repository. Through the HTTP API its absence reads `rating is missing: pass up or down (a learning's rating is never implied by its reason)`.

`reason` is one of `fixed`, `useful`, `false_positive`, `wrong_location`, `not_worth_fixing`, `duplicate`, `deferred`, `unclear` or `other`, with hyphens or underscores. Put prose in `note`. An unknown ref is refused:

```text
CodePanel: Learning L9 not found; refs look like L3
```

Rating again replaces your earlier rating of the same learning, and the result says `updated`.

## How a rating counts

| You | What happens |
| --- | --- |
| `down`, anyone trusted | The learning is `off` at once, whoever you are. Each identity's latest signal is its word, so a later `up` from you replaces your `down` |
| `up`, a person | It activates at once |
| `up`, an agent | Counts toward activation only with `pr`, and only with a second up from a different account on a different pull request. One account naming two agents is still one account |
| `up` on an active learning | Re-confirms it. A person's up or two independent agent ups restart the 180-day clock; one agent re-rating its own up does not |

A `down` isn't outvoted: a person's `up` doesn't cancel an agent's `down`. Only the account that rated it down can change its own rating.

## What it returns

`target` (the ref) and `outcome`: `created`, or `updated` when it replaced your earlier rating.

## Examples

These responses come from a test account on a local backend.

```json title="Call"
{
  "repo": "codepanel-dev/web-app",
  "ref": "L3",
  "rating": "up",
  "reason": "useful",
  "note": "Checked config/auth.ts: both limits are imported from there.",
  "pr": 142,
  "agent": "claude-code"
}
```

```json title="Result"
{
  "outcome": "created",
  "target": "L3"
}
```

L3 was already active, drafted from evidence, so this up re-confirms it rather than activating it.

## The same step without MCP

| Surface | Form |
| --- | --- |
| Pull request comment | `/feedback L3 up` or `/feedback L3 down <reason>`; a learning always needs its rating ([syntax](/docs/commands#feedback)) |
| CLI | `codepanel learning <owner/name> L3 up\|down --reason ... --note ... --pr <n> --agent <name>` ([CLI](/docs/cli)) |
| HTTP API | [`POST /learnings/feedback`](/docs/api#post-learningsfeedback) |

## What the server tells your agent

The description your agent reads when it lists the tools:

> Confirm (up) or turn off (down) a learning by its ref, e.g. L3, as named in a review's Learnings line or list_learnings. Any down turns it off at once; give a reason and a one-sentence note saying what in the code contradicts it. Rating again replaces your earlier rating. Same as commenting /feedback L3 up|down on a pull request.

## Related

- [`list_learnings`](/docs/mcp-server/list_learnings): find the ref and read its state.
- [`add_learning`](/docs/mcp-server/add_learning): record a new fact.
- [`rate_finding`](/docs/mcp-server/rate_finding): the same idea for a finding, with the merge gate attached.
- [Learnings](/docs/repo-context#learnings): activation, undo and expiry.
- [MCP server](/docs/mcp-server): install, sign-in and every other tool.
