Observed since 20 Oct, 23:19 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
An agent that rewrites its own system prompt from execution feedback
A self-improving agent prompt optimizer. Proposes edits to its own system prompt from execution feedback, A/B tests them against a held-out task set, and promotes only statistically-proven winners under deterministic guardrails.
Changelog · v0.2.0 Release Notes · v0.1.0 Field Test Report · v0.2.0 Field Test Report
Most production agents are prompt-tuned once by hand, then frozen at ship time. Every recurring failure is silently absorbed. Two common approaches fall short:
AgentSelfEdit is a sidecar that observes execution traces and proposes prompt edits through a deterministic, evidence-driven loop.
pip install agent-self-edit
agent-self-edit init
agent-self-edit run --once
Agent executes task → Execution trace stored (SQLite)
↓
Feedback Analyzer (LLM)
reviews traces, proposes concrete edits,
each with a written hypothesis
↓
──── A/B Test Engine ────
candidate vs current prompt
held-out task set, bootstrap CI,
effect size, permutation p-value
───────────────────────────
↓
Promotion Gate (deterministic)
1. Sample floor 4. Frozen sections
2. Effect size 5. Edit-distance limit
3. Confidence p-val 6. Drift detection
↓
┌──────────┼──────────┐
▼ ▼ ▼
Promoted Near-miss Rejected
| Component | What it does |
|---|---|
| Feedback Analyzer | LLM that reviews traces and produces edit proposals. v0.2.0: staged 4-pipeline (summarize → select → synthesize → score) with rejection-context feedback. |
| A/B Test Engine | Compares candidate vs current prompt on held-out tasks. v0.2.0: 40-task promotion corpus. |
| Promotion Gate | Six deterministic checks: sample floor, effect size, confidence, frozen sections, edit-distance, drift. Code, not LLM-judged. |
| Prompt Registry | File-based versioned store with full lineage, diff, rollback, SHA-256 integrity. |
| Scorers | Runtime-selectable: ExactMatch, StructuredExtraction, LLMJudge. Label-set-aware, multi-domain. |
| CLI | init, run, status, diff, rollback, guardrails, lineage, propose, ingest, validate. |
Six fail-fast checks before any edit is promoted:
15-iteration loop against Qwen3.5-4B-4bit (local). Gate correctly rejected every edit.
| Metric | Result |
|---|---|
| FP rate (bad edits promoted) | 0% |
| FN rate (good edits rejected) | 0% |
| LLM calls | 4,150 |
| Wall time | 37 min |
| Cost | $0.00 |
Validation across 4 domains, adversarial edits, real-trace ingestion, Docker. Strongest analyzer: Mistral Small 24B (OpenRouter). Directional gains but no promotable edit — framework is sound, analyzer quality is the bottleneck.
| Metric | Result |
|---|---|
| FP rate | 0% |
| FN rate | not observed |
| Multi-domain suites | 4/4 |
| Adversarial edits caught | 5/5 (0 FN) |
| Strongest analyzer | mistralai/mistral-small-3.2-24b-instruct |
| Coverage | 81% (target 92%) |
Agents that repeat a task type and see execution feedback: classification, code review, data extraction, content moderation, sales outreach, documentation generation.
| Area | Status |
|---|---|
| Core loop | ✅ |
| Model role separation | ✅ |
| Staged analyzer | ✅ |
| Multi-domain support | ✅ |
| Runtime scorer selection | ✅ |
| Adversarial rejection (5/5) | ✅ |
| Real-trace ingestion | ✅ |
| Tests (489/489 pass) | ✅ |
| Ruff + mypy strict | ✅ |
| Security (bandit, gitleaks, trufflehog) | ✅ clean |
| Coverage | ⬜ 81% |
| Version | Focus |
|---|---|
| v0.1.0 | ✅ Released — core loop, gate, CLI, Docker |
| v0.2.0 | ✅ Released — staged analyzer, model roles, multi-domain, field test |
| v0.3.0 | Framework adapters, multi-failure clustering, adaptive sample floors |
| v0.4.0 | Fleet-wide learning, cost-aware improvement |
| v1.0.0 | Stable API, production deployment guide |
MIT — see LICENSE
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.3.0 | 4 Sept 2026 | 8 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 23:19 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:0e818122b8f512d30006cecefbe30bc0a8ef34eb291950b4ac6ff8ef9c480e5a