File size: 3,742 Bytes
31d768a
 
 
 
 
 
 
 
 
 
 
f560b6a
f9fb9b0
f560b6a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31d768a
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
---
title: 'RFT Agent Simulation Engine '
emoji: 🌖
colorFrom: yellow
colorTo: green
sdk: gradio
sdk_version: 6.6.0
app_file: app.py
pinned: false
license: other
short_description: Agent drift, torque & coherence simulator.
---


RFT Agent Simulation Engine — MVP Release

A symbolic multi‑agent simulation engine built to model drift, stability, coherence, and emergent behaviour in complex systems.
Developed as the first operational software implementation of the Rendered Frame Theory (RFT) agent architecture.

This MVP provides a clean, modular, reproducible simulation environment that runs entirely in Python and is fully compatible with Google Colab and Hugging Face Spaces.

---

🚀 Features

✔ Multi‑Agent Simulation

Each agent evolves over time through:

• Awareness field updates (Φ)
• Collapse‑torque dynamics (τ_eff)
• Mutation
• Drift
• Fitness scoring
• Tier‑independent behaviour


✔ System‑Level Metrics

The engine computes:

• Coherence (average Φ across agents)
• Stability (variance of Φ)
• Emergent divergence patterns


✔ Full Visualization Suite

Automatically generates and saves:

• phi_plot.png
• tau_plot.png
• fitness_plot.png
• coherence_plot.png
• stability_plot.png


All plots are high‑resolution (300 dpi).

✔ JSON Export

Final agent states are exported to:

• final_agent_states.json


✔ One‑Click Packaging

A built‑in ZIP builder creates:

• rft_simulation_engine.zip
containing all project files and generated artifacts.


✔ Colab‑Optimized Dev Mode

When running in Google Colab:

• Gradio UI is bypassed
• Simulation runs automatically
• Plots display inline
• All files save to disk


---

📦 Project Structure

agent.py            # RFTAgent class
simulation.py       # RFTSimulation engine
visualization.py    # Plotting utilities
utils.py            # JSON export + ZIP builder
app.py              # Gradio UI + Colab dev mode
test_runner.py      # Automated test simulation
requirements.txt    # Dependencies
README.md           # Documentation


---

▶️ Running the Simulation (Colab)

To run the engine in Google Colab:

from test_runner import run_test_simulation
run_test_simulation()


This will:

• Run a 3‑agent, 100‑step simulation
• Display all plots inline
• Save all PNGs
• Export final_agent_states.json
• Print file paths


---

🌐 Running the Gradio App (Hugging Face Space)

When deployed on Hugging Face:

python app.py


The UI allows you to configure:

• Number of agents
• Number of steps
• Mutation rate
• Drift rate
• Random seed


And outputs:

• All plots
• JSON export
• Downloadable results


---

🧪 Example Output

The engine produces:

• Divergent agent trajectories
• Torque evolution curves
• Fitness progression
• System coherence decay
• Stability variance growth


These behaviours emerge naturally from the agent update rules.

---

📁 Packaging the Project

To generate a ZIP containing all files and outputs:

from utils import zip_project
zip_project()


This creates:

• rft_simulation_engine.zip
ready for download or distribution.


---

🛠 Requirements

numpy
matplotlib
gradio


---

📣 About This Project

This MVP demonstrates the first operational implementation of the RFT agent architecture.
It is designed for:

• AI researchers
• Complex systems modellers
• Simulation engineers
• Worldbuilders
• Anyone exploring emergent behaviour


Future versions will introduce:

• Agent packs
• Mutation packs
• Universe packs
• Codex integration
• Long‑run simulations
• Advanced metrics


---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference