Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@kernel.chat/prompt-evolver

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kernel.chat/prompt-evolver

GEPA-style prompt self-optimization for AI agents. Prompts evolve from execution traces — auto-mutate, measure, rollback bad changes. Zero LLM calls.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

@kernel.chat/prompt-evolver

GEPA-style prompt self-optimization for AI agents. Prompts evolve from execution traces — auto-mutate, measure, rollback bad changes. Zero LLM calls.

Part of the kernel.chat open-source stack. Used by @kernel.chat/kbot to let specialist prompts improve in place without a human in the loop.

Why this exists

Prompt iteration is usually a human-in-the-loop process: read failures, hypothesize a fix, edit the prompt, retest. That loop is slow and doesn't scale across dozens of specialists.

This package codifies an alternative: feed execution traces in, let the evolver propose small mutations, measure them in production, and roll back any mutation whose success rate regresses past a threshold. The whole loop is deterministic — no model call ever — so it costs nothing per evolution step.

The pattern is loosely modeled on GEPA (Genetic-Evolutionary Prompt Augmentation) but simplified for production use.

Install

npm install @kernel.chat/prompt-evolver

Usage

import { PromptEvolver } from '@kernel.chat/prompt-evolver'

const evolver = new PromptEvolver({
  // Optional: see EvolverConfig type for thresholds, rollback windows, etc.
})

// Feed in execution traces — successes and failures both.
evolver.recordTrace({
  agent: 'researcher',
  promptHash: 'sha256:...',
  outcome: 'success',
  // ...additional fields per Trace interface
})

// Ask the evolver to propose a mutation for an agent's prompt.
const mutation = evolver.evolve('researcher')
if (mutation) {
  // Apply mutation.amendment to the live prompt and start measuring.
}

// Periodically check whether any mutation should be rolled back.
const rollback = evolver.checkRollback('researcher')
if (rollback) {
  // Revert and record the failure.
}

// Get the current prompt amendment for an agent (the active set of mutations).
const amendment = evolver.getAmendment('researcher')

// Persist state across runs.
evolver.save('./evolver-state.json')
evolver.load('./evolver-state.json')

// Inspect what's happening.
console.log(evolver.summary())

Public API

ExportShape
PromptEvolverMain class — recordTrace, evolve, checkRollback, getActiveMutations, getAmendment, getGeneration, toJSON/fromJSON, save/load, summary
TraceInterface — what you feed into recordTrace
MutationInterface — what evolve() and checkRollback() return
EvolverConfigInterface — constructor config
EvolverStateInterface — serialized state shape

Status

v1.0.x — production use inside @kernel.chat/kbot; light external test coverage. The core algorithm has been running in production behind kbot since early 2026. The public API is stable. External test suite is being expanded in v1.1.

If you're using this outside kernel.chat and hit edge cases, file an issue at github.com/isaacsight/kernel.

PackageDiscipline
@kernel.chat/kbotThe agent itself
@kernel.chat/memory-tiersThree-tier memory (observations → reflections → identity)
@kernel.chat/skill-routerBayesian routing across specialists
@kernel.chat/tool-forgeRuntime tool creation

See docs/agentic-engineering.md for the field map this package sits inside.

License

MIT.

Keywords

ai-agent

FAQs

Package last updated on 18 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts