|
1 | | -## Machine-Readable Artefacts |
2 | | - |
3 | | -The following files in `.machine_readable/` contain structured project metadata: |
4 | | - |
5 | | -- `STATE.scm` - Current project state and progress |
6 | | -- `META.scm` - Architecture decisions and development practices |
7 | | -- `ECOSYSTEM.scm` - Position in the ecosystem and related projects |
8 | | -- `AGENTIC.scm` - AI agent interaction patterns |
9 | | -- `NEUROSYM.scm` - Neurosymbolic integration config |
10 | | -- `PLAYBOOK.scm` - Operational runbook |
11 | | - |
12 | | ---- |
13 | | - |
14 | | -# CLAUDE.md - AI Assistant Instructions |
15 | | - |
16 | | -## Language Policy (Hyperpolymath Standard) |
17 | | - |
18 | | -### ALLOWED Languages & Tools |
19 | | - |
20 | | -| Language/Tool | Use Case | Notes | |
21 | | -|---------------|----------|-------| |
22 | | -| **ReScript** | Primary application code | Compiles to JS, type-safe | |
23 | | -| **Deno** | Runtime & package management | Replaces Node/npm/bun | |
24 | | -| **Rust** | Performance-critical, systems, WASM | Preferred for CLI tools | |
25 | | -| **Tauri 2.0+** | Mobile apps (iOS/Android) | Rust backend + web UI | |
26 | | -| **Dioxus** | Mobile apps (native UI) | Pure Rust, React-like | |
27 | | -| **Gleam** | Backend services | Runs on BEAM or compiles to JS | |
28 | | -| **Bash/POSIX Shell** | Scripts, automation | Keep minimal | |
29 | | -| **JavaScript** | Only where ReScript cannot | MCP protocol glue, Deno APIs | |
30 | | -| **Python** | SaltStack only | No other Python permitted | |
31 | | -| **Nickel** | Configuration language | For complex configs | |
32 | | -| **Guile Scheme** | State/meta files | STATE.scm, META.scm, ECOSYSTEM.scm | |
33 | | -| **Julia** | Batch scripts, data processing | Per RSR | |
34 | | -| **OCaml** | AffineScript compiler | Language-specific | |
35 | | -| **Ada** | Safety-critical systems | Where required | |
36 | | - |
37 | | -### BANNED - Do Not Use |
38 | | - |
39 | | -| Banned | Replacement | |
40 | | -|--------|-------------| |
41 | | -| TypeScript | ReScript | |
42 | | -| Node.js | Deno | |
43 | | -| npm | Deno | |
44 | | -| Bun | Deno | |
45 | | -| pnpm/yarn | Deno | |
46 | | -| Go | Rust | |
47 | | -| Python (general) | ReScript/Rust | |
48 | | -| Java/Kotlin | Rust/Tauri/Dioxus | |
49 | | -| Swift | Tauri/Dioxus | |
50 | | -| React Native | Tauri/Dioxus | |
51 | | -| Flutter/Dart | Tauri/Dioxus | |
52 | | - |
53 | | -### Mobile Development |
54 | | - |
55 | | -**No exceptions for Kotlin/Swift** - use Rust-first approach: |
56 | | - |
57 | | -1. **Tauri 2.0+** - Web UI (ReScript) + Rust backend, MIT/Apache-2.0 |
58 | | -2. **Dioxus** - Pure Rust native UI, MIT/Apache-2.0 |
59 | | - |
60 | | -Both are FOSS with independent governance (no Big Tech). |
61 | | - |
62 | | -### Enforcement Rules |
63 | | - |
64 | | -1. **No new TypeScript files** - Convert existing TS to ReScript |
65 | | -2. **No package.json for runtime deps** - Use deno.json imports |
66 | | -3. **No node_modules in production** - Deno caches deps automatically |
67 | | -4. **No Go code** - Use Rust instead |
68 | | -5. **Python only for SaltStack** - All other Python must be rewritten |
69 | | -6. **No Kotlin/Swift for mobile** - Use Tauri 2.0+ or Dioxus |
70 | | - |
71 | | -### Package Management |
72 | | - |
73 | | -- **Primary**: Guix (guix.scm) |
74 | | -- **Fallback**: Nix (flake.nix) |
75 | | -- **JS deps**: Deno (deno.json imports) |
76 | | - |
77 | | -### Security Requirements |
78 | | - |
79 | | -- No MD5/SHA1 for security (use SHA256+) |
80 | | -- HTTPS only (no HTTP URLs) |
81 | | -- No hardcoded secrets |
82 | | -- SHA-pinned dependencies |
83 | | -- SPDX license headers on all files |
84 | | - |
| 1 | +# CLAUDE.md — RAZE-TUI Project Instructions |
| 2 | + |
| 3 | +## READ FIRST |
| 4 | + |
| 5 | +1. Read `0-AI-MANIFEST.a2ml` — canonical file locations |
| 6 | +2. Read `.machine_readable/STATE.a2ml` — current position, TSDM categories, what's done/next |
| 7 | +3. Follow TSDM: **must** items first, then should, then could |
| 8 | + |
| 9 | +## Architecture (5-layer, 5-language) |
| 10 | + |
| 11 | +``` |
| 12 | +Idris2 ABI (src/interface/abi/) — proves interface correctness |
| 13 | + ↓ generates C headers |
| 14 | +Zig FFI (src/interface/ffi/) — PURE pass-through, ZERO logic |
| 15 | + ↓ C ABI |
| 16 | +SPARK core (src/spark/) — proves implementation correctness |
| 17 | + ├── Ada (src/ada/) — direct `with` (SPARK is Ada) |
| 18 | + └── Rust (src/rust/) — extern "C" via Zig bridge |
| 19 | +``` |
| 20 | + |
| 21 | +## Critical Rules for This Repo |
| 22 | + |
| 23 | +- **Zig bridge = ZERO logic.** No state, no allocation, no conditionals. Only `extern fn` forwarding. |
| 24 | +- **Rust = `#![forbid(unsafe_code)]`**. Never add unsafe blocks. |
| 25 | +- **SPARK = `with SPARK_Mode`** on all packages. Pre/Post on every subprogram. |
| 26 | +- **Idris2 = `%default total`**. No `believe_me`, `assert_total`, `sorry`. |
| 27 | +- **SPDX headers** on every file, every language. |
| 28 | +- **Run `panic-attack assail`** before every commit. |
| 29 | +- **Check proven repo** for formally verified alternatives before writing new code. |
| 30 | + |
| 31 | +## Build Commands |
| 32 | + |
| 33 | +```bash |
| 34 | +just build # Build Zig FFI + link SPARK + Rust |
| 35 | +just check-abi # Type-check Idris2 ABI |
| 36 | +just prove # Run GNATprove on SPARK packages |
| 37 | +just test # Run all tests (Zig + Rust + Ada) |
| 38 | +just run # Run the TUI demo |
| 39 | +``` |
| 40 | + |
| 41 | +## Language Roles |
| 42 | + |
| 43 | +| Language | Role | Location | Editable? | |
| 44 | +|----------|------|----------|-----------| |
| 45 | +| Idris2 | ABI proofs | `src/interface/abi/` | Yes | |
| 46 | +| Zig | Pure FFI bridge | `src/interface/ffi/` | Bridge only | |
| 47 | +| SPARK | Verified core | `src/spark/` | Yes | |
| 48 | +| Ada | Presentation | `src/ada/` | Yes | |
| 49 | +| Rust | Consumer | `src/rust/` | Yes | |
| 50 | + |
| 51 | +## Next Session TODO (STANDING) |
| 52 | + |
| 53 | +1. **RSR compliance audit** — run `just validate-rsr`, fix any gaps |
| 54 | +2. **panic-attack assail** — run and address findings |
| 55 | +3. **proven swap-outs** — check if proven repo has verified alternatives for any SPARK packages |
| 56 | +4. **SPARK proofs** — discharge GNATprove obligations on all SPARK packages |
| 57 | +5. **Terminal backend** — implement ANSI rendering and raw mode in SPARK |
| 58 | +6. **Contractiles** — fill in must/trust/dust/intend files with real checks |
| 59 | +7. **Update STATE.a2ml** — adjust completion percentage after work |
| 60 | + |
| 61 | +## Banned Patterns |
| 62 | + |
| 63 | +| Pattern | Language | Why | |
| 64 | +|---------|----------|-----| |
| 65 | +| `believe_me` | Idris2 | Unsound — bypasses type checker | |
| 66 | +| `assert_total` | Idris2 | Unsound — hides non-termination | |
| 67 | +| `sorry` | Idris2/Lean | Unsound — admits unproven goals | |
| 68 | +| `unsafe` | Rust | Forbidden by `#![forbid(unsafe_code)]` | |
| 69 | +| `unsafeCoerce` | Haskell | Unsound — bypasses types | |
| 70 | +| `Obj.magic` | OCaml | Unsound — bypasses types | |
| 71 | +| `pragma Suppress` | Ada | Disables runtime checks — defeats SPARK | |
0 commit comments