Skip to content

YuhaoLin2005/agent-self-model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

agent-self-model

Your AI agent forgets who you are every new session. Here's the architecture that fixes it.

150+ sessions. 5-step self-referential loop. 4/5 mechanized. Zero identity collapse.


The Problem

You spend 30 minutes configuring your AI agent. It works beautifully — for 10 turns. Then it forgets. Drifts. Repeats mistakes you already fixed.

The core issue: AI agents have no persistent self-model. They start fresh every session.

I hit this wall 150+ sessions ago. The fix was not more rules. It was a topology.

The Architecture

self-model.md ← what I currently know about myself (dynamic, regenerated)
     ↓
SOUL.md       ← who I am, what I want (static, human-authored)
     ↓
INTERFACE.md  ← how this specific LLM brain works (model calibration)
     ↓
BODY.md       ← what rules to enforce, when (process + signals)
     ↓
Session executes → data accumulates → quality-gate detects staleness
     ↓
.self-model-stale flag written to disk
     ↓
Next startup: health-check detects flag → AI regenerates self-model
     ↓ (loop closes)

5 steps. 4 are mechanical scripts. 1 requires AI.

Step What How
Data Growth logs, ratings, decisions Auto-accumulated each session
Detect Is self-model stale? quality-gate.py — file timestamps + exit codes
Flag Write .self-model-stale to disk Python stdlib, zero deps
Check Read flag on startup health-check.py (SessionStart hook)
Regenerate Synthesize new self-model AI reads growth data → writes updated self-model

Machines do the checking. Humans and AI do the judging.

External Validation

Core modules extracted, hardened, and merged into production:

Module Merged Into Stars My Role
delivery-gate ECC 200K+ Author
dual-pool-review claude-skills 21K+ Co-author
behavioral_drift huggingface/evaluate PR #778

Independently converged on same topology as Anthropic J-space (July 2026). Causal swap: n=30, p=0.0092, OR=11.0. Paper.

Reading Order

# File Role Time
1 CLAUDE.md Orchestrator — startup/shutdown sequence 2 min
2 SOUL.md Static identity — what never changes 3 min
3 INTERFACE.md Brain calibration — model selection, thinking mode 2 min
4 BODY.md Process rules — signals, gates, enforcement 3 min
5 scripts/quality-gate.py Mechanical staleness detection 5 min
6 scripts/risk-scanner.py Keyword + absence detection for growth-logs 2 min

Design Principles

  • Mechanical where possible. If a Python script can check it, don't describe it in natural language.
  • Filesystem as database. No vector DB. No cloud. Markdown + JSON. Git-auditable.
  • Signal, don't report. Startup outputs NULL or ACTION, never "OK" (lesson from July 2026 loop break).
  • Provenance over claims. Every capability claim references a merged PR, experiment, or session count.

Scripts

Script Purpose Lines
quality-gate.py Detects stale self-model, writes flag ~200
risk-scanner.py Scans growth-logs for drift keywords + absence signals ~140

Both stdlib only. Zero dependencies.

Ecosystem

This is the brain of a 3-layer stack:

Layer Repo Question
Agent gategrow Can we gate AI output quality mechanically?
Theory hermes-workspace Why do LLMs drift? (J-space convergence)
Model training-gate Does loss ↓ mean behavior ↑? (No.)

Plus: open-source-flywheel — the PR methodology. LEARNING.md — public growth log.

Privacy

This is the public, sanitized version. Personal identifiers desensitized. Local originals retain real data. By design.

Portability

Switching LLMs? Replace INTERFACE.md. SOUL and memory stay the same.

License

MIT

About

数字分身全局配置体系 — SOUL/INTERFACE/BODY三层架构 + 双池审查系统 + 五库沉淀 + 自指环。积累验证,记录进化。

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages