Skip to content

Latest commit

 

History

History
126 lines (107 loc) · 7.16 KB

evolution.md

File metadata and controls

126 lines (107 loc) · 7.16 KB

Self-Evolution System

Autonomous prompt improvement without LLM weight training, staged through the skills lifecycle using interaction evidence.

Pipeline

Record (realtime) → Analyze (daily) → Evolve (every 3 days)

Components

  • Record layer: Trace every interaction, tool call, and outcome
  • Evidence: Decision and memory-access records feed the analyzer; memory safety filtering remains available.
  • Analysis: Automated evaluation with judge model and test suites
  • Prompt proposer: Stages managed skill revisions through the skills lifecycle.
  • Safety: Autonomy checks, immutable sections, blocked keywords, judge review and lifecycle publication gates.
  • Pipeline: Scheduler, pipeline orchestration, annotation system
  • Integrated runtime: evolution state, history, configuration, and manual trigger commands are exposed through the main CLI

CLI

prx evolution status   # Show evolution state
prx evolution history  # Show evolution history
prx evolution trigger  # Manually trigger one evolution cycle

Judge verdicts

Managed skill prompts

A prompt.mutable_files entry of skills/<name>/SKILL.md uses the enabled owner-scoped skill lifecycle. Its projection must match the active immutable revision, and active knowledge patterns must be backed by eligible stored experiences before a model call is made. The bounded lifecycle proposer stages a SkillProposal; the evolution record carries its proposal, skill and revision IDs, with model usage and the physical accounting scope preserved.

These candidates never produce a generic file-write commit. Source review, paired evaluation, the governing holdout suite and publication authorization remain prerequisites of the lifecycle's existing publication and projection transaction, even when the general evolution judge approves a proposal. An unavailable lifecycle or insufficient evidence refuses the managed proposal. Non-skill entries in prompt.mutable_files are ignored with a warning; evolution never writes workspace files directly or moves memories to trash.

Model calls

Prompt proposals are generated by the resolved default model, with bounded input/output and a strict JSON reply. The daemon and manual trigger use the same managed provider construction. Missing providers, accounting ownership, budget or usable output refuse generation instead of producing fixed text. The proposal records model identity, input/output digests, evidence references, reported usage and an opaque scope joining it to the physical cost journal. Real judge verdicts and human-review queue entries carry their own model, usage and accounting scope, separately from the proposal's call.

The judge receives the proposed before/after content as ephemeral review data; that projection is not serialized into cycle records. Whole-document model replies are severity 4 regardless of the requested mutation category. Default human-review thresholds block automatic application. Immutable sections must remain balanced and unchanged. Draft-only persistence retains content hashes. Model calls use [self_system] evolution_model_max_tokens, evolution_model_max_micro_usd and evolution_judge_timeout_secs; see configuration. Existing paid judge configurations now need an explicit nonzero monetary allowance. Set the token allowance to zero to disable these calls without enabling a synthetic fallback.

The prompt engine only proposes its change. The evolution judge scores the staged revision; adoption always requires the skills lifecycle's publication checks, including in auto mode.

Layer Target Adoption
prompt the first skills/<name>/SKILL.md entry of prompt.mutable_files, otherwise the first lifecycle-enabled skill (active enabled binding, suite registered, usable proposal evidence, no live proposal, not immutable, projection present) in skill-id order staged as a lifecycle proposal; publication requires the skills lifecycle

An explicitly configured managed entry that is also immutable is refused without falling through to another skill. Automatic discovery skips immutable skills. The scheduler runs only with [skills_lifecycle] enabled. A cycle with no managed target proposes nothing and does not count against the breaker. Each due cycle uses at most one proposer call under the existing model token and cost limits. Existing lifecycle rollback and projection recovery govern published revisions.

  • A score below the pass threshold writes nothing; the cycle is logged with result rejected.
  • A deferred verdict writes nothing; the cycle is logged with result deferred. A verdict is deferred when there is no model judge (only the built-in mock scorer, error judge_degraded), or when the model judge's call fails, its reply is not a score, it does not answer within [self_system] evolution_judge_timeout_secs (1 to 3600, default 180), or the run is cancelled while it waits (error judge_failed).
  • A run cancelled after the judge accepted but before the change was written writes nothing (error commit_cancelled, result deferred). A change that cannot be written is logged with result deferred and error apply_failed.
  • An accepted and written change is logged with no result yet; the fitness backfill scores it later.
  • Each cycle's row is flushed to the evolution log as soon as it is appended, also for a cancelled run. If the row cannot be written, the run reports record_failed and the commit decision (for example an applied change) stands.
  • On daemon shutdown, after stopping its components, the daemon cancels the evolution verdict tasks and waits for them (up to 10 seconds) before it exits. A judge still working is abandoned, and a run that reaches its verdict after the drain began is not judged: nothing is written and the cycle is recorded as deferred. A write that an accepted verdict already started completes and is recorded if it finishes within that bound; otherwise the runtime shutdown can drop it and its row may be missing.
  • prx evolution status opens the circuit on consecutive regressed or rejected entries; deferred entries are skipped. The running scheduler's own breaker still counts a deferred cycle as a failed run, so the two can disagree.
  • prx evolution trigger prints commit : … (what became of the proposed change) instead of rolled : …; its JSON report has commit and judge_outcome instead of rolled_back.
  • In every mode, including draft_only, a judge_failed verdict marks the evolution_judge health component as an error with the reason, and the scheduler counts the layer run as a failure for its circuit breaker, as it does for a rejected or deferred change. The next scored verdict, or a restart or reload that builds a model judge, marks the component ok again.

Manual triggers default to L2. --layer L1 and --layer L3 return removal errors. When loading evolution_config.toml, retired strategy and memory tuning tables, retrieval settings and each non-skill mutable entry produce a warning on every load. Unknown keys remain readable; remove retired inputs from operator files. The main configuration schema and existing model budgets are unchanged.