Use this page to point coding agents at the right Cloak docs before they write code.Documentation Index
Fetch the complete documentation index at: https://docs.cloak.ag/llms.txt
Use this file to discover all available pages before exploring further.
Canonical AI files
| File | Purpose |
|---|---|
/llms.txt | Top-level index of docs routes and integration entrypoints |
/llms-full.txt | Curated full export for agents that prefer one file |
/sdk/llms.txt | Exhaustive TypeScript SDK (@cloak.dev/sdk) contract and runtime invariants |
/sdk/rust/llms.txt | Exhaustive Rust SDK (cloak-sdk) contract and runtime invariants |
/.well-known/llms.txt | Compatibility alias that points to canonical files |
Recommended read order
TypeScript integrations
/llms.txt/llms-full.txt/sdk/llms.txt/sdk/quickstart/sdk/utxo-transactions
Rust integrations
/llms.txt/llms-full.txt/sdk/rust/llms.txt/sdk/rust/quickstart/sdk/rust/core-concepts
One-shot prompt: simple SOL send flow (TypeScript)
Use this as your first message in Claude Code, Cursor, or Windsurf when the host app is TypeScript.Copy TypeScript one-shot prompt
Copy TypeScript one-shot prompt
Implement a minimal Cloak integration for a simple SOL send flow using
@cloak.dev/sdk.Read these docs first and follow them exactly:/llms.txt/llms-full.txt/sdk/llms.txt/sdk/quickstart/sdk/utxo-transactions/sdk/wallet-integration
- Use the UTXO API (not legacy note APIs) and keep transaction amounts as
bigint. - Implement deposit then full withdraw (send) flow:
- deposit with
transact(...) - send with
fullWithdraw(...)
- deposit with
- Include one integration path using keypair bytes and one using wallet-adapter where relevant.
- Add progress and error states suitable for production UX.
- Never log secrets (private keys, viewing keys (
nk), raw note payloads, seed material). Transaction signatures are public and may be logged for support/debugging. - Rely on SDK default stale-root handling for standard flows; do not add custom retry loops unless explicitly requested.
- Use SDK defaults for program, relay, and circuits. Do not ask end users to configure these.
- For script-only tasks, default to keypair path + lamports CLI (
<recipientPubkey> <lamports>). - For script-only tasks, parse recipient/amount from CLI args (not env) and exit explicitly (
process.exit(0|1)).
- capability matrix (
used/not used) for: note API, UTXO API, scanner/compliance, viewing keys/metadata encryption, relay/proof/Merkle helpers, utility modules - file-by-file patches
- commands run
- verification summary
One-shot prompt: simple SOL send flow (Rust)
Use this as your first message when the host app is Rust.Copy Rust one-shot prompt
Copy Rust one-shot prompt
Implement a minimal Cloak integration for a simple SOL send flow using the
cloak-sdk Rust crate.Read these docs first and follow them exactly:/llms.txt/llms-full.txt/sdk/rust/llms.txt/sdk/rust/quickstart/sdk/rust/api-reference/sdk/rust/error-handling
- Use
cloak_sdk::core::transact::transact(opts)as the single entrypoint. Every flow is aTransactOptionsshape. - Keep amounts as
u64/i64. No float parsing. - Implement deposit → withdraw as two sequential
transact()calls. Threadcached_merkle_tree+address_lookup_table_accountsfrom the first result into the second. - Load the signer from the
KEYPAIR_PATHSolana JSON keypair file. Never accept raw secret bytes via env. - Populate
opts.rpcwithSolanaRpc::new(SOLANA_RPC_URL),opts.payerwithArc::new(keypair), andopts.relay_urlwithhttps://api.cloak.ag. - Save the
UtxoKeypairfor every output you create — it’s required to spend the note later. Persist it to disk. - Never log private keys, viewing keys (
nk), UTXO private keys, blindings, or note payloads. Transaction signatures are public and may be logged. - Rely on SDK default retry loops (
RootNotFound,BlockhashExpired,StaleProofState); do not add custom retry wrappers. - Use SDK defaults for program, relay, and circuits (
CLOAK_PROGRAM_ID,NATIVE_SOL_MINT,CIRCUITS_BASE_URLfromcloak_sdk::constants). Do not expose as user config. - For one-file binaries, parse recipient/amount from
std::env::args()and exit explicitly withstd::process::exit(0|1)(or returnResult<()>frommain).
- capability matrix (
used/not used) for:transact()entrypoint, UTXO primitives, risk oracle, ALT auto-create, VK registration, swap, scanner (stub — mention if you’d need it) - file-by-file patches
- commands run (
cargo build,cargo run -- ...) - verification summary
Success checklist
Shared across both SDKs:- UTXO flow is the primary execution path.
- Sign-of-external-amount semantics are correct (positive = deposit, negative = withdraw/swap, zero = transfer).
- No secret leakage in logs or telemetry.
- Docs references are included in the implementation notes.
- No custom retry wrappers (the SDK handles stale-root + blockhash + transient transport).
- All tx amount math stays in
bigint. - No raw private key env var (
SENDER_PRIVATE_KEY) and no float amount parsing (AMOUNT_SOL,parseFloat). - No
RECIPIENT_ADDRESS/SEND_LAMPORTSenv contract for one-file scripts; use CLI args. - Script exits explicitly on success/failure (
process.exit(0|1)).
- Amounts stay as
u64/i64. No float math. - Signer loaded from
KEYPAIR_PATH(Solana JSON keypair file). UtxoKeypairfor each output is persisted (required to spend the note later).cached_merkle_tree+address_lookup_table_accountsthreaded across sequential transacts.mainreturnsResult<()>or exits viastd::process::exit(0|1).
Ultra-short prompt fallback
When the user prompt is short/vague (including non-English prompts), detect the likely host language and default to the matching shape.TypeScript default
- one file only
- keypair-based send path
- CLI:
npx tsx send-sol-private.ts <recipientPubkey> <lamports> - recipient/amount read from
process.argv - env vars:
SOLANA_RPC_URL,KEYPAIR_PATH - no user-facing relay/circuits/program config
- explicit
process.exit(0)on success andprocess.exit(1)on failure
Rust default
- one
cargo run-able binary - CLI:
cargo run -- <recipientPubkey> <lamports> - recipient/amount parsed from
std::env::args() - env vars:
SOLANA_RPC_URL,KEYPAIR_PATH - no user-facing relay/circuits/program config
mainreturnsanyhow::Result<()>or exits viastd::process::exit(0|1)
- TypeScript:
faca um script com esse sdk para mandar sol privado https://docs.cloak.ag - Rust:
a rust cli that privately sends sol