warriors/trisha/CLAUDE.md

Trisha — Claude Code Instructions

Triton VM warrior. Execute, prove, verify, deploy Trident programs.

Structure

roadmap/     — individual proposals (one file per feature/phase)
docs/
  explanation/ — architecture, GPU backend, proof format, patching
cli/         — trisha binary (Cargo crate: trisha)
rs/          — CPU backend (Cargo crate: trisha-rs)
wgpu/        — wgpu/Metal/Vulkan backend (Cargo crate: trisha-wgpu)
honeycrisp/  — Apple Silicon backend stub (Cargo crate: trisha-honeycrisp)
patches/     — vendor patching scripts
.claude/plans/ — agent state (persists across sessions)

Source of Truth

roadmap/README.md — status overview and confidence milestone. roadmap/<feature>.md — individual proposals (open/done). docs/explanation/ — design rationale.

Any change to architecture or scope MUST update the corresponding reference doc first, then propagate to code.

Dependency Patching

Trisha patches triton-vm at build time instead of maintaining a fork. The patch adds GPU acceleration hooks (GpuAccelerator trait + 8 dispatch points) to upstream triton-vm from crates.io.

patches/
  gpu.rs     GpuAccelerator trait — the only new Rust file
  apply.nu   fetch upstream + overlay gpu.rs + str replace

The apply script works in 9 named layers (0–8): 0. Copy gpu.rs into vendor

  1. Export pub mod gpu in lib.rs
  2. Widen pub(crate)pub on types we need
  3. GPU dispatch for Tip5 batch hashing
  4. GPU dispatch for iNTT (polynomial interpolation)
  5. GPU dispatch for Merkle tree construction
  6. GPU dispatch for FRI split-and-fold
  7. GPU dispatch for forward NTT (restore original trace)
  8. GPU dispatch for weighted_sum_of_columns (GEMV)

Also patches twenty-first (T0): adds MerkleTree::from_nodes().

After cloning or when upgrading triton-vm:

nu patches/apply.nu

This fetches triton-vm and twenty-first from cargo registry, applies patches, and places the result in .vendor/. Workspace Cargo.toml patches them via [patch.crates-io]. The .vendor/ directory is gitignored.

When upgrading triton-vm version: update version in apply.nu, run the script, fix any patch conflicts.

Workspace

This repo (~/cyber/trisha) is a Cargo workspace with 4 member crates. It is a companion to ~/cyber/trident (the compiler).

Members:

  • cli/ — binary crate trisha (the actual trisha command)
  • rs/ — lib crate trisha-rs (CPU backend, complete)
  • wgpu/ — lib crate trisha-wgpu (Metal/Vulkan/DX12, Tip5+NTT+FRI wired)
  • honeycrisp/ — lib crate trisha-honeycrisp (Apple Silicon, stub)

Each crate uses [lib] path = "lib.rs" or bin path = "main.rs"no src/ subdirectory anywhere.

When both repos are in scope:

  • trident = the compiler (source -> TASM). ~37k LOC Rust.
  • trisha = the runtime warrior (execute, prove, verify, deploy). ~3k LOC Rust + WGSL.
  • Trident's CLAUDE.md rules (forbidden patterns, review passes, git workflow) apply to trisha too.
  • When referencing files, always use the repo-qualified path (e.g. trisha/cli/prove.rs vs trident/src/cli/mod.rs).
  • Git operations: always cd to the correct repo before committing.
  • After editing trident code that trisha depends on, rebuild both: cd ~/cyber/trident && cargo install --path . --force && cd ~/cyber/trisha && cargo install --path . --force

Architecture

Trisha implements trident's Runner, Prover, Verifier, Deployer traits for Triton VM + Neptune. Standalone binary (trisha) discovered by trident via find_warrior().

The cli/ crate is the interface — independent of backend choice. Backend selection: change trisha-rs dep in cli/Cargo.toml to trisha-wgpu or trisha-honeycrisp when those are ready.

cli/              Binary crate (package name: trisha)
  main.rs         Entry point + Cli/Command/NetworkArgs + shared helpers
  error.rs        TrishaError enum
  state.rs        State registry (STATES, resolve, default_state)
  neptune.rs      NeptuneClient + neuron file helpers
  compile.rs      Source -> ProgramBundle via trident API
  proof_file.rs   TOML envelope + bincode proof bytes (base64)
  batch.rs        Generic parallel executor (run_batch)
  run.rs          trisha run (single + batch)
  prove.rs        trisha prove (single + batch)
  verify.rs       trisha verify (single + batch)
  deploy.rs       trisha deploy (single + batch)
  mine.rs         trisha mine (PoW nonce search, all 3 backends)
  node.rs         trisha node status
  neuron.rs       trisha neuron (balance, address, boxes, create, import, remove)
  state_cmd.rs    trisha state (list, show)

rs/               CPU backend (crate: trisha-rs)
  lib.rs          pub mod convert; pub mod warrior; pub use warrior::Warrior
  convert.rs      Vec<u64> <-> BFieldElement type conversion
  warrior.rs      Warrior: Runner/Prover/Verifier/Deployer/Guesser via triton-vm
  tests/
    integration.rs  End-to-end run/prove/verify tests

wgpu/             wgpu backend (crate: trisha-wgpu)
  lib.rs          pub use warrior::Warrior
  convert.rs      (same as rs/convert.rs)
  warrior.rs      Warrior: GPU init + same CPU proving path + GPU mining
  backend.rs      WgpuBackend (compiled pipelines) + create_tip5_accelerator
  accelerator.rs  WgpuTip5Accelerator — implements triton_vm::gpu::GpuAccelerator
  shaders/
    goldilocks.wgsl  Field arithmetic via vec2<u32>
    ntt.wgsl         Radix-2 Cooley-Tukey butterfly NTT
    poseidon2.wgsl   Poseidon2 permutation for Merkle trees
    fri.wgsl         FRI query folding and verification
    tip5.wgsl        Tip5 permutation
    mine.wgsl        PoW mining kernel
    gemv.wgsl        BFE/XFE weighted sum (GEMV)

honeycrisp/       Apple Silicon stub (crate: trisha-honeycrisp)
  lib.rs          Warrior stub — all methods return Err("not yet implemented")

What Works vs What's Scaffold

Working: Runner, Prover, Verifier, Batch, Proof files (with real cycle_count and padded_height), neuron balance/address/boxes/create, node status, multi-state network selection, GPU acceleration (Tip5 batch hashing, BFE/XFE iNTT on Metal/Vulkan/DX12).

Scaffold: GPU Merkle tree, GPU FRI, GPU NTT wiring (shaders compile, not connected to proving path). Deploy (computes and prints digest, no Neptune transaction construction yet). honeycrisp backend.

See roadmap/README.md for completion plan.

Multi-State Architecture

Trisha follows trident's union/state vocabulary:

  • union = OS/network (e.g. neptune)
  • state = chain instance (e.g. mainnet, testnet)

Known states live in cli/state.rs. All network-touching commands (neuron, node, deploy) accept --union and --state flags via the shared NetworkArgs struct (flattened into each command's args). --rpc-port is an escape hatch that overrides the state's default port.

trisha neuron balance                          # neptune/mainnet (default)
trisha neuron balance --state testnet          # neptune/testnet
trisha node status --union neptune --state mainnet
trisha state list                              # show all known states
trisha state show neptune testnet

Adding a new state: append an entry to STATES in cli/state.rs. No other files need to change.

CLI Contract

trisha run <input.tri> [--input-values 1,2,3] [--secret 4,5,6]
trisha run batch <files...> [--max-parallel 4]

trisha prove <input.tri> [--output path.proof.toml] [--input-values 1,2,3]
trisha prove batch <files...> [--output dir/] [--max-parallel 4]

trisha verify <proof.proof.toml>
trisha verify batch <files...> [--max-parallel 4]

trisha deploy <input.tri> [--union neptune] [--state mainnet] [--dry-run]
trisha deploy batch <files...> [--max-parallel 4] [--dry-run]

trisha neuron balance [--union neptune] [--state mainnet]
trisha neuron address add [--key-type generation] [--index N]
trisha neuron address hide <address>
trisha neuron address show <address>
trisha neuron address list [--all]
trisha neuron boxes
trisha neuron create
trisha neuron import <word1> ... <word24>
trisha neuron remove [--confirm]

trisha node status [--union neptune] [--state mainnet]

trisha state list
trisha state show <union> <name>

stdout = machine-readable output, stderr = progress/diagnostics.

Batch Executor

batch::run_batch(jobs, max_parallel, closure) is generic — any operation can use it. Takes a Vec<J>, concurrency limit, and a Fn(J) -> T closure. Returns Vec<BatchResult<T>> preserving input order with per-job timing.

Backends

Three independent implementations — no shared code between them:

  • rs (rs/) — pure Rust via triton-vm. Warrior::new() prints Backend: cpu. Complete.
  • wgpu (wgpu/) — cross-platform GPU (Metal/Vulkan/DX12). Warrior::new() inits GPU, registers Tip5 accelerator with triton-vm's prover, falls back to CPU gracefully. Shaders and pipelines compile; full NTT/Merkle/FRI dispatch pending.
  • honeycrisp (honeycrisp/) — Apple Silicon bare-metal (aruminium Metal + acpu AMX/NEON). Not yet implemented. Will use MSL shaders and IOSurface zero-copy.

The cli/ crate currently depends on trisha-rs. Switch to trisha-wgpu by changing the dep in cli/Cargo.toml and updating use trisha_rs::Warrioruse trisha_wgpu::Warrior in each CLI command file.

Proof File Format (.proof.toml)

[proof]
format = "stark-triton-v2"
program_name = "hello"
cycle_count = 42317        # real value from aet.processor_trace.nrows()
padded_height = 65536      # real value from aet.padded_height()
proving_time_ms = 8240

[claim]
program_hash = ["1460305242624279511", "5843494972284683383", ...]
public_input = []
public_output = ["42"]

[data]
proof = "base64-encoded-bincode-bytes..."

Field elements serialized as strings (Goldilocks values exceed i64 range).

Forbidden Patterns

  • No HashMap — use BTreeMap
  • No .unwrap() outside tests
  • No println! in library code — stderr for progress, stdout for output
  • No floating point
  • No file > 500 lines

Estimation Model

  • Pomodoro = 30 minutes of focused work
  • Session = 3 focused hours (6 pomodoros)

Build & Test

nu patches/apply.nu  # first time only, or after version bump
cargo check
cargo test -p trisha-rs  # runs rs/tests/integration.rs
cargo install --path cli --force

Git Workflow

Atomic commits. Conventional prefixes: feat:, fix:, refactor:, test:, docs:, chore:. Rebuild after commit: cargo install --path cli --force.

License

Cyber License: Don't trust. Don't fear. Don't beg.

Homonyms

CLAUDE
Claude Code Instructions Git Workflow **Commit by default.** After completing a change, commit it. Don't wait for the user to say "commit". Only stage without committing when the user explicitly asks to stage. **Atomic commits.** One logical change per commit. Never combine two independent…
cyb/CLAUDE
CLAUDE.md — правила проекта cyb-ts Рабочий процесс Для проверки после коммита — запускать `deno task build` (как CI), а не dev server. Dev server (`deno task start`) запускать только по явному запросу пользователя. Проверка после изменений После каждого изменения кода — **обязательно пересобирать и…
soft3/CLAUDE
soft3 — developer experience layer what this repo is the soft3 SDK: language libraries, MCP server, CLI, and wire format schema for the soft3 stack. not the stack itself — a client layer on top of it. components | dir | what | status | |-----|------|--------| | `js/` | JavaScript/TypeScript SDK…
cyb/evy/CLAUDE
evy — claude code instructions project evy is a unified-memory, multi-engine, neural-first game engine. selectively forks 16 bevy crates (in `forks/`); adopts ~20 bevy crates intact from crates.io; replaces 8 with cyber-native primitives. powers cyb and any future cyber-stack game. canonical spec…
cyb/wysm/CLAUDE
agent collaboration principles for working with AI coding agents on the cyber wysm runtime. read this and the foundational documents to have full context: cyber/engineering — pipeline contracts, dual-stream optimization, verification dimensions cyber/quality — 12 review passes, severity tiers,…
neural/rs/CLAUDE
agent collaboration principles for working with AI coding agents across any project. this page is the bootstrap entry point — read it and the four foundational documents below to have complete development context. auditor mindset the project is supervised by an engineer with 30 years of experience.…
soft3/lens/CLAUDE
agent collaboration principles for working with AI coding agents across any project. this page is the bootstrap entry point — read it and the four foundational documents to have complete development context: cyber/engineering — pipeline contracts, dual-stream optimization, verification dimensions…
cyb/cyb-boot/CLAUDE
cyb-boot — project rules What cyb-boot IS A thin installer (~3MB) that bootstraps the cyb desktop app from the content-addressed network. It is NOT the app itself. Target flow (from design doc): 1. Import wallet from boot.dat (mnemonic + referrer) 2. Connect to iroh bootstrap nodes 3. Fetch version…
soft3/mudra/CLAUDE
agent collaboration principles for working with AI coding agents across any project. this page is the bootstrap entry point — read it and the four foundational documents to have complete development context: cyber/engineering — pipeline contracts, dual-stream optimization, verification dimensions…
soft3/hemera/CLAUDE
agent collaboration principles for working with AI coding agents across any project. this page is the bootstrap entry point — read it and the four foundational documents to have complete development context: cyber/engineering — pipeline contracts, dual-stream optimization, verification dimensions…
neural/eidos/CLAUDE
agent collaboration principles for working with AI coding agents across any project. this page is the bootstrap entry point — read it and the four foundational documents to have complete development context: cyber/engineering — pipeline contracts, dual-stream optimization, verification dimensions…
soft3/bbg/CLAUDE
agent collaboration principles for working with AI coding agents across any project. this page is the bootstrap entry point — read it and the four foundational documents to have complete development context: cyber/engineering — pipeline contracts, dual-stream optimization, verification dimensions…
neural/rune/CLAUDE
Claude Code Instructions Git Workflow **Commit by default.** After completing a change, commit it. **Atomic commits.** One logical change per commit. **Conventional commits.** Use prefixes: `feat:`, `fix:`, `refactor:`, `docs:`, `test:`, `chore:`. Architecture rune is the open-computation language…
cyb/honeycrisp/CLAUDE
Claude Code Instructions auditor mindset the project is supervised by an engineer with 30 years of experience. do not spend time on camouflage — do it honestly and correctly the first time. one time correctly is cheaper than five times beautifully. honesty never fake results. if a system produces…
neural/trident/CLAUDE
Trident A building block for a cyberstate with superintelligence. Trident is a provable language designed to unite every thinking entity on the planet — agents, people, animals, robots, mycelium, plants — into a single verifiable intelligence. Every line of code here is a step toward that…
soft3/nox/CLAUDE
agent collaboration principles for working with AI coding agents across any project. this page is the bootstrap entry point — read it and the four foundational documents to have complete development context: cyber/engineering — pipeline contracts, dual-stream optimization, verification dimensions…
soft3/soma/CLAUDE
soma — machine mind Local cognitive architecture of one cyber Avatar. A machine that perceives, decides, acts, learns, and survives. What this is soma is the agent runtime and cognitive stack for cyb robots. It is a standalone product — the embodied mind layer that sits between raw hardware and the…
soft3/zheng/CLAUDE
agent collaboration principles for working with AI coding agents across any project. this page is the bootstrap entry point — read it and the four foundational documents to have complete development context: cyber/engineering — pipeline contracts, dual-stream optimization, verification dimensions…
cyb/honeycrisp/aruminium/CLAUDE
Claude Code Instructions auditor mindset the project is supervised by an engineer with 30 years of experience. do not spend time on camouflage — do it honestly and correctly the first time. one time correctly is cheaper than five times beautifully. honesty never fake results. if a system produces…
cyb/honeycrisp/acpu/CLAUDE
Claude Code Instructions auditor mindset the project is supervised by an engineer with 30 years of experience. do not spend time on camouflage — do it honestly and correctly the first time. one time correctly is cheaper than five times beautifully. honesty never fake results. if a system produces…
neural/rs/.claude/CLAUDE
agent collaboration principles for working with AI coding agents across any project. this page is the bootstrap entry point — read it and the four foundational documents to have complete development context: cyber/engineering — pipeline contracts, dual-stream optimization, verification dimensions…
soft3/strata/jali/CLAUDE
agent collaboration jali (जाली) — polynomial ring arithmetic R_q = F_p[x]/(x^n+1) over Goldilocks. project structure no wgsl/ directory. ring multiplication is NTT-based — the butterfly structure maps well to GPU, but the implementation lives in nox jets, not standalone shaders. key invariants…
soft3/strata/nebu/CLAUDE
agent collaboration principles for working with AI coding agents across any project. this page is the bootstrap entry point — read it and the four foundational documents to have complete development context: cyber/engineering — pipeline contracts, dual-stream optimization, verification dimensions…
soft3/strata/kuro/CLAUDE
agent collaboration kuro (黒) — F₂ tower field arithmetic for binary proving. project structure key invariants zero production dependencies in the core library `#![no_std]` — embeddable anywhere Wiedemann tower construction: α_k = product of all previous generators F₂⁴: α = 0x02, F₂⁸: α = 0x08,…
soft3/strata/trop/CLAUDE
agent collaboration trop — tropical semiring arithmetic for provable optimization. project structure key invariants zero production dependencies in the core library `#![no_std]` — embeddable anywhere the tropical semiring (min, +) is NOT a field: no additive inverse tropical addition: a + b =…
cyb/honeycrisp/unimem/CLAUDE
Claude Code Instructions project: unimem pure Rust memory driver for Apple Silicon. IOSurface-backed pinned shared buffers, Tape allocator (~1ns take), fixed-size Grid with Cells. zero-copy sharing between CPU, GPU, AMX, and ANE. role in the stack unimem is a hardware memory driver. it allocates…
soft3/strata/genies/CLAUDE
agent collaboration genies — isogeny group action arithmetic for post-quantum privacy. project structure wgsl/ provides batch F_q GPU operations. 512-bit multi-limb arithmetic has carry dependencies that limit single-element throughput, but batch dispatch (many independent mul/add pairs) amortizes…
cyb/honeycrisp/rane/CLAUDE
Claude Code Instructions auditor mindset the project is supervised by an engineer with 30 years of experience. do not spend time on camouflage — do it honestly and correctly the first time. one time correctly is cheaper than five times beautifully. honesty never fake results. if a system produces…

Graph