/ USAGE.md
USAGE.md
  1  # Mythogen AME - Usage Guide
  2  
  3  ## Quick Start
  4  
  5  ```bash
  6  # Install dependencies
  7  npm install
  8  
  9  # Run the server
 10  npm run dev
 11  
 12  # Run tests
 13  npm test
 14  ```
 15  
 16  ## API Reference
 17  
 18  ### Seeds (Profiles)
 19  
 20  #### Create a Seed
 21  ```bash
 22  curl -X POST http://localhost:3000/api/seeds \
 23    -H "Content-Type: application/json" \
 24    -d '{
 25      "needs": [
 26        {"name": "community", "description": "Connection with others", "category": "belonging", "priority": 8}
 27      ],
 28      "beliefs": [
 29        {"statement": "Regenerative systems can replace extractive ones", "confidence": 0.9, "origin": "Personal experience"}
 30      ],
 31      "values": [
 32        {"name": "generosity", "description": "Giving without expectation", "practicedLevel": 0.7, "developmentColumn": 5, "developmentCycle": "self-expression"},
 33        {"name": "integrity", "description": "Being honest even when hard", "practicedLevel": 0.8, "developmentColumn": 7, "developmentCycle": "selfless-expression"}
 34      ],
 35      "visibility": "community"
 36    }'
 37  ```
 38  
 39  Response:
 40  ```json
 41  {
 42    "seed": { "id": "...", "needs": [...], "values": [...] },
 43    "timeLock": { "id": "...", "seedId": "...", "maturesAt": "..." }
 44  }
 45  ```
 46  
 47  #### Get a Seed
 48  ```bash
 49  curl http://localhost:3000/api/seeds/:id
 50  ```
 51  
 52  #### Get Y Card (Transparency)
 53  ```bash
 54  curl http://localhost:3000/api/seeds/:id/y-cards
 55  ```
 56  
 57  Returns full algorithmic transparency: why the algorithm was used, how it works, what data was used, and what the result was.
 58  
 59  ### Communities
 60  
 61  #### Create a Community
 62  ```bash
 63  curl -X POST http://localhost:3000/api/communities \
 64    -H "Content-Type: application/json" \
 65    -d '{
 66      "name": "RegenTribe Core",
 67      "description": "A regenerative neighborhood collective",
 68      "memberIds": ["seed-1", "seed-2", "seed-3"],
 69      "sharedMyth": "We grow together like mycelium, connecting and nourishing"
 70    }'
 71  ```
 72  
 73  #### Get FOT Score
 74  ```bash
 75  curl http://localhost:3000/api/communities/:id/fot
 76  ```
 77  
 78  Response:
 79  ```json
 80  {
 81    "overall": 0.75,
 82    "indicators": [
 83      {"type": "mutual-support", "currentValue": 0.8, ...},
 84      {"type": "response-velocity", "currentValue": 0.9, ...},
 85      {"type": "conflict-engagement", "currentValue": 0.7, ...},
 86      {"type": "benefit-distribution", "currentValue": 0.75, ...},
 87      {"type": "psychological-safety", "currentValue": 0.85, ...}
 88    ],
 89    "isPlasmaState": true,
 90    "hologramCoherence": 0.7,
 91    "membraneHealth": 0.82,
 92    "phase": "performing"
 93  }
 94  ```
 95  
 96  ### Trust Events
 97  
 98  Record events to build FOT indicators:
 99  
100  #### Record Mutual Support
101  ```bash
102  curl -X POST http://localhost:3000/api/communities/:id/trust-events \
103    -H "Content-Type: application/json" \
104    -d '{
105      "type": "support",
106      "data": {
107        "spontaneous": true,
108        "frequency": 5,
109        "from": "member-2",
110        "to": "member-1"
111      }
112    }'
113  ```
114  
115  #### Record Response Velocity
116  ```bash
117  curl -X POST http://localhost:3000/api/communities/:id/trust-events \
118    -H "Content-Type: application/json" \
119    -d '{
120      "type": "response",
121      "data": {
122        "avgResponseTimeMs": 1800000,
123        "situation": "member needed help with project"
124      }
125    }'
126  ```
127  
128  #### Record Conflict Engagement
129  ```bash
130  curl -X POST http://localhost:3000/api/communities/:id/trust-events \
131    -H "Content-Type: application/json" \
132    -d '{
133      "type": "conflict",
134      "data": {
135        "deepenedRelationship": true,
136        "resolutionQuality": 0.85,
137        "topic": "resource allocation"
138      }
139    }'
140  ```
141  
142  #### Record Vulnerability
143  ```bash
144  curl -X POST http://localhost:3000/api/communities/:id/trust-events \
145    -H "Content-Type: application/json" \
146    -d '{
147      "type": "vulnerability",
148      "data": {
149        "vulnerableStatements": 3,
150        "weaponizationCount": 0,
151        "topic": "personal struggle"
152      }
153    }'
154  ```
155  
156  ### Anti-Capture
157  
158  #### Trigger Sacred Clown
159  ```bash
160  curl -X POST http://localhost:3000/api/communities/:id/sacred-clown
161  ```
162  
163  Response:
164  ```json
165  {
166    "disruption": {
167      "type": "question-assumption",
168      "message": "What if the assumption we're most certain about is actually what's limiting us?",
169      "purpose": "Prevent premature closure of understanding"
170    },
171    "sacredClownActive": true
172  }
173  ```
174  
175  #### Get Membrane State
176  ```bash
177  curl http://localhost:3000/api/communities/:id/membrane
178  ```
179  
180  ### LJ Map (Values Developmental Map)
181  
182  #### Get All Values
183  ```bash
184  curl http://localhost:3000/api/lj-map
185  ```
186  
187  Returns 50+ values across three cycles:
188  - **Self-Worth** (Columns 1-3): Safety → Belonging → Utility
189  - **Self-Expression** (Columns 4-6): Quality → Service → Co-Creation
190  - **Selfless Expression** (Columns 7-9): Integration → Navigation → No Self
191  
192  ### WebSocket (Real-time FOT)
193  
194  Connect to `ws://localhost:8080` and send:
195  
196  ```json
197  {
198    "type": "subscribe",
199    "communityId": "community-123"
200  }
201  ```
202  
203  Receive real-time FOT updates:
204  
205  ```json
206  {
207    "type": "fot-update",
208    "communityId": "community-123",
209    "fot": {
210      "overall": 0.75,
211      "isPlasmaState": true,
212      ...
213    }
214  }
215  ```
216  
217  ## Key Concepts
218  
219  ### Hologram Principle
220  
221  FOT only manifests when ALL five indicators align. The composite is the **minimum** of all indicators, not the average. If one dimension is off, trust completely fails — not blurry, completely gone.
222  
223  **Example:**
224  - Mutual support: 0.9 ✓
225  - Response velocity: 0.5 ✗
226  - Conflict engagement: 0.8 ✓
227  - Benefit distribution: 0.7 ✓
228  - Psychological safety: 0.9 ✓
229  
230  → FOT = 0.5 (lowest wins)
231  
232  ### Desert Island Test
233  
234  Values require others to practice. Ask for any claimed value: "Can you practice this alone on a desert island?"
235  
236  - **Need:** "I need food" → YES, you can have this alone
237  - **Belief:** "I believe in karma" → YES, you can hold this alone
238  - **Principle:** "I follow non-violence" → YES, you can follow this alone
239  - **Value:** "I value generosity" → NO, you need someone to receive
240  
241  This separates the Four Distinctions rigorously.
242  
243  ### Fractal Growth
244  
245  Communities grow by **multiplying**, not scaling. A pod of 5 → 100 pods of 5. Each pod retains the relational depth of the original.
246  
247  Scaling a pod of 5 into 500 = dilution.
248  Multiplying to 100 pods of 5 = growth.
249  
250  ## Health Check
251  
252  ```bash
253  curl http://localhost:3000/health
254  ```
255  
256  Returns:
257  ```json
258  {
259    "status": "healthy",
260    "seeds": 3,
261    "communities": 1,
262    "uptime": 3600
263  }
264  ```