䷀ Yi-Jing Agent — I Ching Six Lines AI Agent Lifecycle Framework
Fusing ancient I Ching wisdom with modern AI agent architecture. A structured lifecycle framework that prevents goal drift, enables graceful degradation, and brings philosophical depth to AI agent execution.
🧠 What is Yi-Jing Agent?
Modern AI agents suffer from three structural problems:
- Goal Drift — Agents forget the original intent mid-task
- Blind Impulse — Agents rush to call APIs without proper planning
- Crash with No Recovery — One error cascades into total failure
The I Ching (易經) Six Lines framework solves this by imposing a 6-stage lifecycle on every task, where each stage (爻) has strict behavioral rules and output gates:
Line Agent Behavior Output Gate
────────────────────────────────────────────────────────────────
初爻 (Hidden Dragon) → Pure understanding, NO actions → Task Graph
二爻 (Dragon in Field) → Sandbox & prototyping → Feasibility Report
三爻 (Alert Dragon) → 3D Reflection Engine → Safety Report
四爻 (Leaping Dragon) → Authorization Gate → Confirm / Pivot
五爻 (Flying Dragon) → Full execution → Core Payload
上爻 (Regretful Dragon) → Memory compression → LTM Write
🔄 Dynamic Fault Tolerance with Hexagram Mutation
When any line encounters an error, the system triggers dynamic hexagram mutation (動爻變卦) — XOR flipping that line's bit and looking up the new hexagram's strategy:
Initial (111111 ䷀ Qian) ──[API Timeout at Line 5]──→ flip bit5
↓
Mutation (111011 ䷉ Lu) ──→ Strategy: degrade to Line 2 sandbox
🧿 3D Reflection Engine (錯綜互卦)
At Line 3, the agent performs a mandatory three-dimensional reflection:
| Dimension | I Ching Concept | Question |
|---|---|---|
| 🔍 Interlocking (互卦) | Hidden motive | What does the user really need? |
| ⚔️ Opposite (錯卦) | Adversarial view | Where would this plan fail if everything is wrong? |
| 👁️ Reversed (綜卦) | User perspective | How will the end-user experience this output? |
🚀 Quick Start
Prerequisites
- Python 3.10+
- An AI agent platform (Hermes Agent, OpenClaw, AutoGPT, etc.)
Install
git clone https://github.com/yayasasapig/yi-jing-agent.git
cd yi-jing-agent
# Copy the skill to your agent's skill directory
cp -r skill/* ~/.hermes/skills/
# Or use the Python library directly
pip install -e .
Basic Usage (Python)
from src.agent_state import YiJingAgentState
from src.executor import YiJingAgentExecutor
import asyncio
async def main():
executor = YiJingAgentExecutor()
result = await executor.execute("Analyze this website's pricing strategy")
print(f"Status: {result['status']}")
print(f"Hexagram path: {' → '.join(
t.transition_name for t in result['hexagram_history']
)}")
asyncio.run(main())
For Hermes/OpenClaw Agents
Load the skill in your SOUL.md or task prompt:
Load the `yi-jing-agent` skill to activate the 六爻 lifecycle.
📂 Repository Structure
yi-jing-agent/
├── README.md # ← You are here
├── LICENSE # MIT
├── CONTRIBUTING.md # How to contribute
├── docs/
│ ├── 六爻AI-Agent架構設計書.md # Original Chinese design document (37KB)
│ └── architecture-overview.md # English architecture summary
├── skill/
│ └── SKILL.md # Hermes/OpenClaw skill definition
├── src/
│ ├── agent_state.py # Core YiJingAgentState
│ ├── executor.py # Full lifecycle executor
│ ├── hexagram_table.py # 64 hexagrams → strategies
│ ├── reflection.py # 3D reflection engine
│ └── yao_positions.py # Line definitions & enums
├── examples/
│ └── six-yao-lifecycle-demo.md # Walkthrough demo
└── .github/
└── workflows/
└── ci.yml # GitHub Actions CI
📖 Documentation
| Resource | Language | Description |
|---|---|---|
| Design Document | 🇭🇰 Chinese (Cantonese) | Full 37KB architectural blueprint |
| Architecture Overview | 🇬🇧 English | English summary of the framework |
| Skill Definition | 🇭🇰 Chinese | Ready-to-use agent skill |
| Lifecycle Demo | 🇭🇰 Chinese | Real-world walkthrough with摘日 |
🌍 Community & Contributions
This project is open for everyone to use, remix, and improve!
- Share your hexagram strategies — Found a new failure mode? Add it to the table!
- Translate — Help translate the docs to Japanese, Korean, English
- Build tools — Dashboard, VSCode extension, visualization
- Report issues — Found a bug in the lifecycle? Open an issue!
See CONTRIBUTING.md for guidelines.
📜 License
MIT — Free for personal and commercial use.
🙏 Credits
- Concept: yayafu × Gemini conversation distillation
- Implementation: Orchestrator Nova (Hermes Agent)
- Platform: OpenClaw Agent Team
「An agent that knows its time uses wisdom to move mountains.」 「識得時機嘅 Agent,用智慧四兩撥千斤。」
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yi_jing_agent-0.1.0.tar.gz.
File metadata
- Download URL: yi_jing_agent-0.1.0.tar.gz
- Upload date:
- Size: 35.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e5f4300dc45b3ab81cd17b5ebb4849c222059e3b9cba43818ee910632148103
|
|
| MD5 |
352a07c914837d4be87f0898e61a0b32
|
|
| BLAKE2b-256 |
2be39a0cfa75d7c299bda28d2b75d675c8aae106bef21aaa3e4a24cc5c6e357f
|
Provenance
The following attestation bundles were made for yi_jing_agent-0.1.0.tar.gz:
Publisher:
publish.yml on yayasasapig/yi-jing-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yi_jing_agent-0.1.0.tar.gz -
Subject digest:
9e5f4300dc45b3ab81cd17b5ebb4849c222059e3b9cba43818ee910632148103 - Sigstore transparency entry: 2268961401
- Sigstore integration time:
-
Permalink:
yayasasapig/yi-jing-agent@37fb3af7f51cc38b79cca07d4fce06213865e8b6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/yayasasapig
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@37fb3af7f51cc38b79cca07d4fce06213865e8b6 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file yi_jing_agent-0.1.0-py3-none-any.whl.
File metadata
- Download URL: yi_jing_agent-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7830815e3f28dbe984b2a9d6ee3171defdb087892468418a271ab137ffdcbee8
|
|
| MD5 |
731867fd6009ac70943a71d4cf80c37b
|
|
| BLAKE2b-256 |
7db668ee3348cd58704c050efbe7d2c2d32c43f3a5ac21c2799c054898f092d1
|
Provenance
The following attestation bundles were made for yi_jing_agent-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on yayasasapig/yi-jing-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
yi_jing_agent-0.1.0-py3-none-any.whl -
Subject digest:
7830815e3f28dbe984b2a9d6ee3171defdb087892468418a271ab137ffdcbee8 - Sigstore transparency entry: 2268961487
- Sigstore integration time:
-
Permalink:
yayasasapig/yi-jing-agent@37fb3af7f51cc38b79cca07d4fce06213865e8b6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/yayasasapig
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@37fb3af7f51cc38b79cca07d4fce06213865e8b6 -
Trigger Event:
workflow_dispatch
-
Statement type: