Raxol.Agent.Curator (Raxol Agent v2.6.0)

Copy Markdown View Source

Keeps agent-authored skills healthy: ages unused ones and bounds their growth.

The Curator runs over the usage telemetry in Raxol.Agent.Skills.Store. Its deterministic phase moves a skill active -> stale -> archived as it goes unused, where archived skills move under <root>/.archive/ and drop out of skills_list. It only ever touches skills whose created_by is :agent; user-authored, external, and pinned skills are left alone.

Passes are gated on time and idleness: a pass runs only when at least interval_hours (default 168) have elapsed since the last one AND the agent has been idle for min_idle_hours (default 2). The first pass after start is deferred a full interval. The runtime reports activity with note_activity/1.

Before any non-dry-run pass, a .tar.gz of the skills root is written to a backups directory (the newest keep_backups are retained); rollback/1 restores the latest. run/1 forces a pass on demand, and run(dry_run: true) reports the transitions it would make without touching anything.

The model-driven consolidation of near-duplicate skills is opt-in (consolidate: true) and not yet implemented.

Summary

Functions

Returns a specification to start this module under a supervisor.

Report that the agent did work, resetting the idle clock.

The transitions a pass would make right now, without applying them.

Restore the skills root from the most recent backup. Returns the path used.

Run a pass now, bypassing the interval/idle gate. Pass dry_run: true to get the transitions without applying them or writing a backup.

Current Curator state: thresholds, last pass time, next eligible time.

Types

transition()

@type transition() :: %{name: String.t(), from: atom(), to: atom()}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

note_activity(server \\ __MODULE__)

@spec note_activity(GenServer.server()) :: :ok

Report that the agent did work, resetting the idle clock.

plan(server \\ __MODULE__)

@spec plan(GenServer.server()) :: [transition()]

The transitions a pass would make right now, without applying them.

rollback(server \\ __MODULE__)

@spec rollback(GenServer.server()) :: {:ok, String.t()} | {:error, term()}

Restore the skills root from the most recent backup. Returns the path used.

run(server \\ __MODULE__, opts \\ [])

@spec run(
  GenServer.server(),
  keyword()
) :: %{transitions: [transition()], backup: String.t() | nil}

Run a pass now, bypassing the interval/idle gate. Pass dry_run: true to get the transitions without applying them or writing a backup.

start_link(init_opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

status(server \\ __MODULE__)

@spec status(GenServer.server()) :: map()

Current Curator state: thresholds, last pass time, next eligible time.