What Is Autopoiesis?
The concept originates from biology — a system's ability to self-produce, self-maintain, and self-repair. In the md2video project, Autopoiesis is an immune mechanism that makes the video generation pipeline turn every failure into an automatic guardrail. Instead of relying on humans to write new rules after the fact, the system self-observes, self-encodes, and self-remembers.
The design philosophy in one sentence: the system is not only producing videos, it is continuously producing a better version of itself.
---
The Three-Stage Immune Loop
Stage 1: Friction Point Capture (Immune Recognition)
Anomalies detected by the three-tier quality checks (L1 hard block / L2 warning / L3 pattern check) — such as missing assets, audio-video desync, or calculation inconsistencies — are captured by capture_friction() in self_report.py, which generates a unique friction point ID. This is analogous to the immune system recognizing an antigen.
Stage 2: Automatic Rule Evolution (Antibody Generation)
This is the heart of the mechanism. auto_encode() maps a friction point category (e.g., "missing asset") to a rule_id via a mapping table, then automatically creates a new rule in the L3 check layer of video-rules.json. New rules are marked with "autopoiesis": true, tracing their origin to the system's own evolution rather than human presets.
Stage 3: Living Memory Update (Immunological Memory)
write_lessons() writes friction points into LESSONS_LEARNED.md (YAML frontmatter + Markdown body), merging with existing entries and deduplicating. Each run inherits the memory of previous runs and appends new knowledge.
---
Three Core Components
- video-rules.json — the antibody library of executable immune rules
- LESSONS_LEARNED.md — the persistent immunological memory (medical record)
- self_report.json — the current health diagnostic report
Key Design Insights
1. Zero-code extension: New quality-check rules only require JSON changes; the Python code stays untouched.
2. Closed immune loop: Friction point → rule_id → rule stored → automatically blocked on next run. From detection to prevention, fully automated.
3. Cross-project migration: The same system has been reused by the sister project md2wechat, letting immune experience flow between projects.
4. Quantifiable evolution: evolution_count tracks cumulative evolution events; new_rules_this_run counts rules generated in the current run.
---
One-Line Summary
Autopoiesis encodes every incident in video generation into immunological memory for the next run. It is an elegant practice of self-evolving systems under Agent-First software architecture.