# `mix nous.profile.rebase`
[🔗](https://github.com/nyo16/nous/blob/v0.21.1/lib/mix/tasks/nous.profile.rebase.ex#L1)

Refreshes a profile whose base text changed (`:stale` in
`mix nous.profile.check`): when every component still has a target in the
current agent, re-seals the manifest against the current base text and
writes a child profile whose `parent_id` is the old profile's id.

    mix nous.profile.rebase --agent MyApp.Agents.support priv/profiles/support.json

The task prints which bases changed, with the current base text of each
affected component, so a reviewer can judge whether the profile's text
still fits. Rebasing keeps the profile's text exactly: it only accepts the
new base. The evaluation evidence behind the old profile was measured
against the old base, so re-run the eval before promoting the child.

A profile is refused (exit 1), and nothing is written, when a component's
target is gone (`:unknown_tool`, `:unknown_param`, `:ambiguous_tool`,
`:builtin_tool`, `:dynamic_instructions`) or the profile is otherwise
invalid: such a profile needs a human edit, not a re-pin. A profile that
already applies is left alone.

## Options

  * `--agent Mod.fun` - a public 0-arity function returning the current
    `%Nous.Agent{}` (required)
  * `--out PATH` - where to write the child (default: `PROFILE` with a
    `.json` extension, so a `.json` input is rewritten in place)

## Exit status

  * `0` - rebased and written, or already current
  * `1` - the profile cannot be rebased
  * `2` - an operational error: bad arguments, the agent factory failed,
    an unreadable or unwritable file

---

*Consult [api-reference.md](api-reference.md) for complete listing*
