䷀ 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,用智慧四兩撥千斤。」
Metadata
Release files for yi-jing-agent 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yi_jing_agent-0.1.0.tar.gz | 35.4 kB | With provenance | Details for yi_jing_agent-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yi_jing_agent-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for yi_jing_agent-0.1.0-py3-none-any.whl |
Total release size: 58.7 kB
Release files / yi_jing_agent-0.1.0.tar.gz
| Download URL | yi_jing_agent-0.1.0.tar.gz |
|---|---|
| Size | 35.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e5f4300dc45b3ab81cd17b5ebb4849c222059e3b9cba43818ee910632148103
|
|
BLAKE2b-256 checksum How to use checksums |
2be39a0cfa75d7c299bda28d2b75d675c8aae106bef21aaa3e4a24cc5c6e357f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 28, 2026.
Transparency logRelease files / yi_jing_agent-0.1.0-py3-none-any.whl
| Download URL | yi_jing_agent-0.1.0-py3-none-any.whl |
|---|---|
| Size | 23.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7830815e3f28dbe984b2a9d6ee3171defdb087892468418a271ab137ffdcbee8
|
|
BLAKE2b-256 checksum How to use checksums |
7db668ee3348cd58704c050efbe7d2c2d32c43f3a5ac21c2799c054898f092d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 28, 2026.
Transparency logSecurity for yi-jing-agent 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for yi_jing_agent-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.