|
| 1 | +== PanLL — AI Coordination Rules |
| 2 | + |
| 3 | +____ |
| 4 | +*Auto-generated from `+coordination.k9+`* — do not edit directly. |
| 5 | +Re-generate with: |
| 6 | +`+deno run --allow-read --allow-write generate.js coordination.k9+` |
| 7 | +Source of truth: `+coordination.k9+` in repository root. |
| 8 | +____ |
| 9 | + |
| 10 | +=== Project |
| 11 | + |
| 12 | +Neurosymbolic IDE built on the Binary Star model — human (symbolic, |
| 13 | +Panel-L) and machine (neural, Panel-N) orbiting a shared world state |
| 14 | +(Panel-W). 106 panels, custom TEA runtime, Gossamer desktop backend. |
| 15 | + |
| 16 | +*Languages:* ReScript, Rust, Elixir, JavaScript *License:* MPL-2.0 |
| 17 | +*Build system:* just *Runtime:* deno |
| 18 | + |
| 19 | +=== Build Commands |
| 20 | + |
| 21 | +[cols=",",options="header",] |
| 22 | +|=== |
| 23 | +|Command |Description |
| 24 | +|`+just build+` |Full build (ReScript + CSS + bundle) |
| 25 | +|`+just res+` |ReScript compile only |
| 26 | +|`+just bundle+` |esbuild bundle |
| 27 | +|`+just css+` |Build CSS |
| 28 | +|`+just dev+` |Start dev server on port 8000 |
| 29 | +|`+just test+` |Run test suite (979 tests, 41 suites) |
| 30 | +|`+just coverage+` |Run tests with coverage |
| 31 | +|`+just lint+` |Lint ReScript source |
| 32 | +|`+just doctor+` |Run project health checks |
| 33 | +|=== |
| 34 | + |
| 35 | +=== INVARIANTS — Do Not Violate |
| 36 | + |
| 37 | +These rules are non-negotiable. Violating them will break the project or |
| 38 | +contradict deliberate architectural decisions. |
| 39 | + |
| 40 | +==== [CRITICAL] custom-tea-runtime |
| 41 | + |
| 42 | +*Rule:* The custom TEA runtime in src/tea/ (18 modules) must NEVER be |
| 43 | +replaced with rescript-tea or any other library |
| 44 | + |
| 45 | +*Why:* rescript-tea was deliberately evaluated and rejected. The custom |
| 46 | +TEA runtime handles PanLL-specific needs: Anti-Crash circuit breaking, |
| 47 | +Vexometer cognitive load adaptation, OrbitalSync multi-panel state |
| 48 | +coherence, and panel lifecycle management. It is not legacy — it is the |
| 49 | +architecture. |
| 50 | + |
| 51 | +==== [CRITICAL] no-typescript |
| 52 | + |
| 53 | +*Rule:* Do not introduce TypeScript files — ReScript is the frontend |
| 54 | +language |
| 55 | + |
| 56 | +*Why:* ReScript provides better type safety with less overhead. This is |
| 57 | +a deliberate, ecosystem-wide decision. |
| 58 | + |
| 59 | +==== [CRITICAL] no-tauri |
| 60 | + |
| 61 | +*Rule:* Do not introduce Tauri references or dependencies — Gossamer is |
| 62 | +the desktop backend |
| 63 | + |
| 64 | +*Why:* PanLL was migrated FROM Tauri 2.0 TO Gossamer. This migration is |
| 65 | +complete and intentional. |
| 66 | + |
| 67 | +==== [CRITICAL] tea-pattern-only |
| 68 | + |
| 69 | +*Rule:* All state management uses TEA (Model -> Msg -> Update -> View) — |
| 70 | +no MVC, Redux, hooks, or other patterns |
| 71 | + |
| 72 | +*Why:* TEA is foundational to PanLL’s architecture. Model.res holds all |
| 73 | +state, Msg.res defines all messages, Update.res is the state transition |
| 74 | +kernel. |
| 75 | + |
| 76 | +==== [CRITICAL] all-state-in-model |
| 77 | + |
| 78 | +*Rule:* ALL application state lives in Model.model — no global mutable |
| 79 | +state, no module-level state, no window.* state |
| 80 | + |
| 81 | +*Why:* TEA requires single state tree. Anti-Crash and OrbitalSync depend |
| 82 | +on this invariant for correctness. |
| 83 | + |
| 84 | +==== [CRITICAL] no-npm-bun |
| 85 | + |
| 86 | +*Rule:* No npm, Bun, pnpm, or yarn — Deno is the orchestrator |
| 87 | + |
| 88 | +*Why:* npm is used ONLY for the ReScript compiler (which requires it). |
| 89 | +All other tooling uses Deno. Do not add npm dependencies. |
| 90 | + |
| 91 | +==== [CRITICAL] anticrash-validates-all |
| 92 | + |
| 93 | +*Rule:* Anti-Crash circuit breaker validates ALL neural tokens before |
| 94 | +symbolic execution — never bypass this |
| 95 | + |
| 96 | +*Why:* Safety-critical: prevents untrusted neural output from corrupting |
| 97 | +symbolic state. The validation path exists for a reason. |
| 98 | + |
| 99 | +==== [HIGH] panels-not-panes |
| 100 | + |
| 101 | +*Rule:* UI elements are called '`panels`', NEVER '`panes`', '`tabs`', or |
| 102 | +'`windows`' |
| 103 | + |
| 104 | +*Why:* PanLL naming convention — '`panels`' is the correct term |
| 105 | +everywhere in code, docs, and communication |
| 106 | + |
| 107 | +==== [CRITICAL] no-bulk-panel-deletion |
| 108 | + |
| 109 | +*Rule:* Do not delete more than 2 panel files in a single operation |
| 110 | +without explicit user approval |
| 111 | + |
| 112 | +*Why:* 106 panels have complex interdependencies. Bulk deletion can |
| 113 | +cascade and break OrbitalSync. |
| 114 | + |
| 115 | +==== [HIGH] gossamer-bridge-pattern |
| 116 | + |
| 117 | +*Rule:* Gossamer commands in src/commands/ are invoke wrappers only — do |
| 118 | +not put business logic there |
| 119 | + |
| 120 | +*Why:* Business logic belongs in Update.res. Commands are thin bridges |
| 121 | +to the Gossamer backend. |
| 122 | + |
| 123 | +==== [CRITICAL] binary-star-model |
| 124 | + |
| 125 | +*Rule:* The Binary Star architecture (Panel-L symbolic + Panel-N neural |
| 126 | ++ Panel-W world) is deliberate — do not flatten into a single panel type |
| 127 | + |
| 128 | +*Why:* The three panel types serve fundamentally different roles. This |
| 129 | +is the core design of PanLL. |
| 130 | + |
| 131 | +==== [CRITICAL] rescript-core-team |
| 132 | + |
| 133 | +*Rule:* The project owner is on the ReScript core team — do not suggest |
| 134 | +migrating away from ReScript |
| 135 | + |
| 136 | +*Why:* ReScript is not a temporary choice. The owner contributes to |
| 137 | +ReScript itself. |
| 138 | + |
| 139 | +=== Protected Files and Directories |
| 140 | + |
| 141 | +Do NOT delete, reorganise, or replace these without explicit user |
| 142 | +approval: |
| 143 | + |
| 144 | +[width="100%",cols="43%,57%",options="header",] |
| 145 | +|=== |
| 146 | +|Path |Reason |
| 147 | +|`+src/tea/+` |Custom TEA runtime — 18 modules. NEVER replace with |
| 148 | +rescript-tea. |
| 149 | + |
| 150 | +|`+src/Model.res+` |Single state tree — all application state lives here |
| 151 | + |
| 152 | +|`+src/Msg.res+` |Message type definitions — the TEA message catalogue |
| 153 | + |
| 154 | +|`+src/Update.res+` |State transition kernel — ~7500 lines, the heart of |
| 155 | +PanLL |
| 156 | + |
| 157 | +|`+src/View.res+` |Root view renderer |
| 158 | + |
| 159 | +|`+src/App.res+` |Application entry point |
| 160 | + |
| 161 | +|`+src/core/+` |Core engines — AntiCrash, OrbitalSync, Contractiles, |
| 162 | +TypeLLEngine, VabEngine |
| 163 | + |
| 164 | +|`+src/components/+` |106 panel views — do not bulk-delete |
| 165 | + |
| 166 | +|`+src/commands/+` |Gossamer bridge commands — thin wrappers only |
| 167 | + |
| 168 | +|`+src/modules/+` |Module registry + TypeLLService — cross-panel type |
| 169 | +intelligence |
| 170 | + |
| 171 | +|`+src-gossamer/+` |Rust backend (WebKitGTK) — Gossamer desktop |
| 172 | +integration |
| 173 | + |
| 174 | +|`+beam/+` |Elixir/BEAM API layer |
| 175 | + |
| 176 | +|`+tests/+` |979 tests, 41 suites — never delete tests |
| 177 | + |
| 178 | +|`+.machine_readable/+` |Canonical location for A2ML state files — MUST |
| 179 | +stay here |
| 180 | + |
| 181 | +|`+coordination.k9+` |This file — source of truth for AI coordination |
| 182 | +|=== |
| 183 | + |
| 184 | +=== Architecture Decisions (Deliberate) |
| 185 | + |
| 186 | +These choices may look unusual but are intentional: |
| 187 | + |
| 188 | +==== gossamer-not-tauri |
| 189 | + |
| 190 | +*Decision:* Gossamer (Zig + WebKitGTK) is the desktop backend — |
| 191 | +migration from Tauri 2.0 is complete |
| 192 | + |
| 193 | +*Why:* Gossamer is the hyperpolymath desktop runtime. Tauri was used |
| 194 | +previously but replaced. |
| 195 | + |
| 196 | +*Rejected alternatives:* Tauri 2.0, Electron, native GTK |
| 197 | + |
| 198 | +==== custom-tea-not-rescript-tea |
| 199 | + |
| 200 | +*Decision:* Custom TEA runtime (src/tea/, 18 modules) instead of the |
| 201 | +rescript-tea library |
| 202 | + |
| 203 | +*Why:* PanLL needs Anti-Crash integration, OrbitalSync, Vexometer hooks, |
| 204 | +and panel lifecycle — none available in rescript-tea |
| 205 | + |
| 206 | +*Rejected alternatives:* rescript-tea, Redux, MobX, React hooks pattern |
| 207 | + |
| 208 | +==== deno-npm-hybrid |
| 209 | + |
| 210 | +*Decision:* Deno orchestrates everything, but npm is used solely for the |
| 211 | +ReScript compiler |
| 212 | + |
| 213 | +*Why:* ReScript compiler requires npm — this is the ONLY permitted npm |
| 214 | +usage. Do not extend npm’s role. |
| 215 | + |
| 216 | +==== binary-star |
| 217 | + |
| 218 | +*Decision:* Four panel types: Panel-A (ambient/substrate), Panel-L |
| 219 | +(logic/symbolic), Panel-N (neural/machine), Panel-W (world/shared) |
| 220 | + |
| 221 | +*Why:* L + N orbit W in the Binary Star core (clear separation of human |
| 222 | +reasoning, machine inference, and shared world state); Panel-A surrounds |
| 223 | +as ambient substrate for persistent context and ergonomic support. |
| 224 | + |
| 225 | +==== vexometer-cognitive-load |
| 226 | + |
| 227 | +*Decision:* Vexometer monitors operator stress and adapts UI detail |
| 228 | +density |
| 229 | + |
| 230 | +*Why:* HTI (Human-Tool Interaction) principle — the IDE adapts to the |
| 231 | +human, not vice versa |
| 232 | + |
| 233 | +==== anticrash-circuit-breaker |
| 234 | + |
| 235 | +*Decision:* Anti-Crash validates all neural tokens before they enter the |
| 236 | +symbolic pipeline |
| 237 | + |
| 238 | +*Why:* Safety boundary between neural and symbolic systems — prevents |
| 239 | +hallucinated code from corrupting state |
| 240 | + |
| 241 | +=== Do NOT Create |
| 242 | + |
| 243 | +These files, patterns, or systems must NOT be introduced: |
| 244 | + |
| 245 | +* ****/*.ts** — TypeScript is banned — use ReScript |
| 246 | +* *Dockerfile* — Use Containerfile (Podman, not Docker) |
| 247 | +* ****/*.py** — Python is banned — use ReScript, Rust, or Elixir |
| 248 | +* *A replacement TEA runtime or state management library* — src/tea/ is |
| 249 | +the TEA runtime — it is custom, deliberate, and must not be replaced |
| 250 | +* *REST API endpoints parallel to existing Groove protocol endpoints* — |
| 251 | +Groove is the inter-service communication protocol — do not create REST |
| 252 | +alternatives |
| 253 | +* *A new panel type beyond Panel-L, Panel-N, Panel-W* — Binary Star |
| 254 | +model has exactly three types — adding more would break OrbitalSync |
| 255 | +* *Direct Tauri imports or tauri.conf.json* — Tauri migration to |
| 256 | +Gossamer is complete — do not reintroduce |
| 257 | + |
| 258 | +=== Terminology |
| 259 | + |
| 260 | +Use the correct terms for this project: |
| 261 | + |
| 262 | +* Say *"`panels`"*, NOT "`panes`", "`tabs`", "`windows`" |
| 263 | +** PanLL UI elements are always called panels — this is enforced |
| 264 | +everywhere |
| 265 | +* Say *"`Binary Star`"*, NOT "`dual-pane`", "`split-view`", |
| 266 | +"`two-panel`" |
| 267 | +** The architectural model is Binary Star (Panel-L + Panel-N orbiting |
| 268 | +Panel-W) |
| 269 | +* Say *"`Anti-Crash`"*, NOT "`validator`", "`sanitizer`", "`filter`" |
| 270 | +** The neural token validation system is called Anti-Crash |
| 271 | +* Say *"`Vexometer`"*, NOT "`stress meter`", "`load indicator`", |
| 272 | +"`fatigue tracker`" |
| 273 | +** The cognitive load monitoring system is called Vexometer |
| 274 | +* Say *"`OrbitalSync`"*, NOT "`state sync`", "`panel sync`", "`sync |
| 275 | +engine`" |
| 276 | +** The multi-panel state coherence system is called OrbitalSync |
| 277 | + |
| 278 | +=== Port Assignments |
| 279 | + |
| 280 | +[cols=",",options="header",] |
| 281 | +|=== |
| 282 | +|Service |Port |
| 283 | +|dev-server |8000 |
| 284 | +|echidna |9000 |
| 285 | +|verisim |8080 |
| 286 | +|boj-server |7700 |
| 287 | +|typell |7800 |
| 288 | +|=== |
| 289 | + |
| 290 | +=== Ecosystem Context |
| 291 | + |
| 292 | +*Depends on:* - *gossamer* — Desktop backend runtime (Zig + WebKitGTK) - |
| 293 | +*verisim* — Persistent storage layer - *typell* — Type intelligence |
| 294 | +engine — cross-panel type checking - *boj-server* — MCP server — all |
| 295 | +external tool integration |
| 296 | + |
| 297 | +*Consumed by:* - *idaptik* — Uses PanLL as level editor for game content |
| 298 | + |
| 299 | +*Related projects:* - *echidna* — Proof engine — formal verification |
| 300 | +integration - *hypatia* — Neurosymbolic CI/CD scanning - *panic-attack* |
| 301 | +— Security scanning tool - *gitbot-fleet* — Bot orchestration (rhodibot, |
| 302 | +echidnabot, etc.) - *proven* — Formally verified alternatives library |
0 commit comments