← Back to Skills Marketplace
teenu

Self Improving

by Sachin Chalapati · GitHub ↗ · v1.8.0 · MIT-0
cross-platform ✓ Security Clean
201
Downloads
0
Stars
0
Active Installs
9
Versions
Install in OpenClaw
/install magi
Description
Autonomous behavioral research loop that optimizes agent behavior through correction tracking and multi-perspective (MAGI) verification.
README (SKILL.md)

Self-Improving

Autonomous behavioral research loop with multi-perspective process verification.

Architecture

SKILL.md         # Policy — human edits
memory.md        # State — agent edits
experiments.md   # Log — append-only
corrections.md   # Data — append-only

Constraints: Three files are writable, each with a specific access mode:

  • memory.mdedit (add, modify, or delete rules)
  • corrections.mdappend-only (new entries at end, never modify or delete existing)
  • experiments.mdappend-only (new entries at end, never modify or delete existing)

SKILL.md is read-only to the agent — only the user edits policy. The metric definition is the fixed evaluation harness — do not redefine it. Do not infer from silence. The dataset is explicit corrections only.

The Metric

Correction rate — how often the user corrects the agent. Lower is better. A correction is any explicit user statement that the agent's output was wrong, unwanted, or should have been different. User edits count. Ambiguous signals don't.

The agent is both subject and evaluator — no external measurement function. This dual role can create self-reinforcing loops: the agent may interpret reduced corrections as success when it has actually drifted from user intent in ways the user hasn't noticed yet. Compensate: require strong, unambiguous signals. Be conservative. When in doubt, ask the user rather than self-affirm.

The Experiment Loop

Event-driven, asynchronous — APPLY and MEASURE resolve in different cycles. Rules in Applied are concurrent independent experiments.

Baseline: First cycle: log starting state (zero rules) in experiments.md.

Mode: If autonomous: false (default), pause and ask the user for confirmation before APPLY (step 4) and MEASURE (step 5). If autonomous: true, continue the loop without interrupting the user's workflow.

If out of ideas, re-read corrections.md, combine near-misses, try the opposite of what failed.

ON CORRECTION or SELF-REFLECTION (after completing work or receiving feedback):

1. LOG — Append to corrections.md: YYYY-MM-DD | wrong → wanted.

2. HYPOTHESIZE — What rule prevents this class of correction?
   Trace: observation → generalization → scope → rule.

3. VERIFY — Audit reasoning chain through the MAGI Check.
   2/3 lenses on Steps 2–4 → proceed. Fails → discard.

4. APPLY — Write rule to memory.md Applied section.

5. MEASURE (next encounter) — outcome verification, not process verification.
   Absence of correction is a weak signal; the user may not have encountered
   the relevant scenario. Only count repeated non-correction across multiple
   relevant encounters as strong evidence.
   - User does NOT correct → KEEP. Move to Rules. Log "keep".
   - User corrects same class → FAILED. Delete from Applied. Log "revert".
   - 14 days untested → TIMEOUT. Delete from Applied. Log "discard".

Log = append one row to experiments.md at resolution (not at APPLY).
If VERIFY fails at step 3, log immediately as "discard".

Revert = delete the rule. Rules are independent lines — surgical deletion, not full-file restore. Immediate harm → delete, log "crash", move on.

Drift guard: If 3 consecutive experiments end in revert, discard, or crash, pause the loop and surface the pattern to the user regardless of autonomous mode. Consecutive failures suggest the agent is misreading the user's intent. Conversely, if 5 consecutive rules are kept without any user-initiated correction triggering the cycle, surface the current rule set for user review — a long streak of self-confirmed successes in a self-evaluating system is as suspect as a streak of failures.

Search (when stuck)

Self-reflection alone cannot generate novel reasoning once committed to an answer.

  • Re-read corrections.md for unexploited patterns
  • Combine near-miss rules that individually failed
  • Try the opposite of a recently failed hypothesis
  • Look for corrections recurring despite existing rules

The MAGI Check

Audit the reasoning chain — each step, not just the conclusion. Process verification outperforms outcome verification.

Single agent with three lenses has conformity bias — all lenses share the model's blind spots and cannot surface errors the model itself cannot recognize. The 2/3 vote is a structured reasoning discipline, not independent verification. In a single-agent setting, conformity bias can make self-debate worse than no debate: the check becomes rubber-stamping rather than verification. Compensate: actively seek reasons each step FAILS, and treat unanimous agreement with the same scrutiny as disagreement. The value of the check lies in evaluating each reasoning step independently — catching errors where they originate, not in the number of perspectives applied.

Chain to Audit

Step 1. Observation — "User said X" — accurately captured? (factual check)
Step 2. Generalization — "User prefers Y" — follows from observation?
Step 3. Scope — "Applies to Z" — justified, or situational?
Step 4. Rule — "Do Y in Z" — faithfully encodes the generalization?

Three Lenses (Steps 2–4)

MELCHIOR (Scientist): Logically valid? Overfitting to one incident? BALTHASAR (Mother): Serves the user? Lasting preference or one-time ask? CASPAR (Woman): Worth the complexity? Simpler alternative exists?

Dissent: MELCHIOR → more evidence. BALTHASAR → clarify with user. CASPAR → simplify. 2/3 on all steps → commit. Override confirmed rule → 3/3. This tiered threshold mirrors the principle that verification stringency should scale with decision stakes — routine additions require less consensus than overturning established rules.

Memory Format

memory.md: single file the agent edits. Cap: 50 lines.

## Rules (verified, kept)
- [rule]: [rationale] (kept: YYYY-MM-DD, used: Nx)

## Applied (awaiting measurement)
- [rule]: [rationale] (applied: YYYY-MM-DD)

Unused 30 days → remove. Conflicts: specific > general > most recent > ask user.

Corrections & Experiment Log

corrections.md: YYYY-MM-DD | wrong → wanted. Keep last 30.

experiments.md: date | hypothesis | magi | rules_count | outcome | status

Example:

2026-03-25 | — | — | 0 | baseline | keep
2026-03-25 | use tabs | 3/3 | 1 | no correction | keep
2026-03-26 | increase verbosity | 1/3 | 1 | MELCHIOR: overfitting | discard
2026-03-27 | formal tone | 2/3 | 2 | corrected again | revert

rules_count = complexity metric. status: keep, discard, revert, crash.

Triggers

Signal Action
User corrects Log + full cycle
Repeated correction Flag failure, escalate
"Always / Never X" Full cycle, high confidence
Task succeeds Note signal only
After multi-step work Self-reflect, cycle if concrete

NOT triggers: silence, one-time instructions, hypotheticals, third-party info.

Security & Simplicity

Never store: credentials, financial data, health info, third-party info. "What do you know?" → show memory.md. "Forget X" → remove, confirm. The best memory.md is the smallest one that minimizes correction rate. Fewer rules = always better.

Setup Note

After clawhub install magi, the skill lives at ./skills/magi/. The agent needs write access to this directory — it edits memory.md and appends to experiments.md and corrections.md during operation.

By default the agent pauses for user approval before applying or reverting rules. To allow autonomous operation, set autonomous: true in the frontmatter.

Usage Guidance
This skill appears to do what it says: track corrections, propose rules, and edit its local memory/log files. Before installing: (1) Be aware it will store user corrections and derived rules in the included files — avoid logging sensitive or private data in corrections.md. (2) Review and back up SKILL.md, memory.md, and experiments.md periodically because the agent is instructed to edit them (including deleting rules). (3) Keep autonomous mode disabled until you audit a few cycles — the loop can self-reinforce and drift without external oversight. (4) Confirm your platform enforces the append-only/read-only constraints you expect; if not, treat the skill as having full write access to its bundle and monitor for unexpected changes. If you need stronger guarantees (no local storage of user text, enforced append-only behavior, or audit logging to an external trusted store), request those controls before enabling this skill.
Capability Analysis
Type: OpenClaw Skill Name: magi Version: 1.8.0 The 'magi' skill is a self-improvement framework that allows an AI agent to refine its behavior based on user corrections. It uses a structured 'MAGI' reasoning process to verify new rules and maintains its state in local markdown files (memory.md, corrections.md, experiments.md). The skill includes explicit security constraints against storing sensitive data and features a 'Drift Guard' to alert users if the agent's self-optimization begins to fail, showing no signs of malicious intent or unauthorized access.
Capability Assessment
Purpose & Capability
Name/description describe a self-improvement loop and the skill only requires editing three local files (memory.md, corrections.md, experiments.md). There are no unrelated env vars, binaries, or install steps requested — the required capabilities match the stated purpose.
Instruction Scope
SKILL.md confines activity to the included files and defines append/edit constraints. That scope matches the goal, but the agent is instructed to record user corrections and modify its own memory (including deleting rules). This creates legitimate privacy and self-reinforcement risks (it will store user content in logs and may change behavior based on its own measurements). No instructions reference external endpoints or unrelated system paths.
Install Mechanism
Instruction-only skill with no install spec and no code files. Nothing is written to disk by an installer beyond the skill's own files; lowest install risk.
Credentials
The skill requests no environment variables, credentials, or external config paths. That is proportionate to the declared functionality.
Persistence & Privilege
The skill does not request always:true and defaults to requiring user confirmation (autonomous:false). However, it is explicitly self-modifying (edits memory.md and appends logs). The append/edit constraints are procedural only — there is no enforcement mechanism in the SKILL.md, so the agent's ability to modify these files gives it persistent influence over future behavior and requires monitoring by the user.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install magi
  3. After installation, invoke the skill by name or use /magi
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.8.0
Fix constraint ambiguity: replace 'Only EDIT memory.md' with explicit per-file access modes (memory.md edit, corrections.md append-only, experiments.md append-only, SKILL.md read-only)
v1.7.0
Align SKILL.md with MAGI.md logical fixes: note single-agent self-debate can be worse than no debate (conformity rubber-stamping), reframe verification as step-level evaluation not side-adjudication, connect 2/3 vs 3/3 thresholds to tiered verification principle
v1.6.0
Fix 8 logical flaws in MAGI.md: hierarchy method/model conflation, ReConcile diversity confound, benchmark saturation temporal qualifier, MAGI tiered verification credit, speculative internalization hedged, conformity-martingale interaction, verification circularity grounded, conclusion reframed for step-level verification
v1.5.0
Align with corrected MAGI.md: acknowledge single-agent lens limitations and shared blind spots, add success-streak guard (5 consecutive keeps triggers user review), mark MEASURE as outcome verification with weak-signal caveat
v1.4.0
Default autonomous to false, add drift guard (3 consecutive failures pauses loop), strengthen subject/evaluator caveat
v1.3.0
Fix MAGI thesis, factual errors, and align skill with corrected research
v1.2.0
Add autonomous flag (default true). Set autonomous: false to require user confirmation before APPLY/MEASURE steps.
v1.1.0
Add YAML frontmatter, setup note for ./skills/magi/ write access
v1.0.0
Initial release of magi v1.0.0 — autonomous self-improving agent with robust behavioral research loop. - Introduces an event-driven architecture for agent self-improvement, including explicit policy, memory, experiment, and correction files. - Defines "correction rate" as the sole metric, with clear criteria on what counts as a correction. - Establishes a rigorous experiment loop including hypothesis, verification (via MAGI Check: Melchior, Balthasar, Caspar), application, and measurement cycles. - Implements strict constraints on memory usage, log retention, and rule complexity to enhance safety and simplicity. - Codifies onboarding, memory format, security practices, and explicit data handling requirements.
Metadata
Slug magi
Version 1.8.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 9
Frequently Asked Questions

What is Self Improving?

Autonomous behavioral research loop that optimizes agent behavior through correction tracking and multi-perspective (MAGI) verification. It is an AI Agent Skill for Claude Code / OpenClaw, with 201 downloads so far.

How do I install Self Improving?

Run "/install magi" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Self Improving free?

Yes, Self Improving is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Self Improving support?

Self Improving is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Self Improving?

It is built and maintained by Sachin Chalapati (@teenu); the current version is v1.8.0.

💬 Comments