Overview

The Allternit Self-Improve crate provides scaffolding for an evolutionary self-improvement loop in the agents-as-diffs pattern. A meta-agent rewrites a task-agent’s code, and every generation is stored as a diff from its parent. A protected evaluation surface can never appear in a produced diff, and a staged evaluation gate runs a cheap subset before paying for a full evaluation.

Base URL

The crate is consumed as a Rust library. It does not expose HTTP endpoints directly.

Components

The pattern

  1. LineageArchive::record stores each generation as { id, parent_id, patches, valid, score }.
  2. ParentSelection chooses the next breeding parent:
    • Latest
    • Best (highest score)
    • ScoreProportional (sigmoid-weighted sampling with an over-use penalty)
  3. WorkingCopy::create scratch-copies a target repo, excluding protected paths.
  4. WorkingCopy::apply_patches runs git apply over the reconstructed patch chain.
  5. WorkingCopy::finalize_diff force-resets protected paths and filters the resulting diff.
  6. StagedGate runs a ValidityCheck, then a subset Evaluator::eval_subset, then the full evaluation if all staged scores are positive.

Safety rules

  • Protected paths can never appear in a produced diff. Filtering is verified by re-scanning the diff for the protected path string.
  • No network assumptions. The crate only invokes local git apply and git diff.
  • Validity before evaluation. A generation that does not compile or typecheck never reaches an evaluator.
  • Staged before full. Full evaluation only runs after every staged score clears the > 0 bar.

Configuration

JSON examples

Record a generation

Reconstruct a working copy

Run staged evaluation

Error codes