Skip to main content
Use this setup to make Windsurf generate app code that matches current Cloak SDK behavior on the first pass.

Rule file

Create .windsurf/rules.md:

Cloak SDK Rules (Current)

Project uses @cloak.ag/sdk for private Solana transactions.

Use these APIs by default

  • transact
  • partialWithdraw
  • fullWithdraw
  • swapWithChange
Amounts are bigint (lamports), never floating-point in logic.

Mandatory behavior

  • Enforce viewing-key registration before protocol actions.
  • Keep compliance history cache encrypted in localStorage.
  • Prefer scanner-based history (chain-native) for user-facing flows.

Security

  • Never print secret keys, viewing keys, signatures, or note payload secrets.
  • Never add debug logs containing transaction private inputs.

Program + fee constants

  • Program ID: c1oak6tetxYnNfvXKFkpn1d98FxtK7B68vBQLYQpWKp
  • Fee fixed: 5_000_000
  • Fee variable: amount * 3 / 1000

Error policy

  • Retry stale-root failures with fresh Merkle data.
  • Retry transient RPC/network errors with backoff.
  • Return user-safe error messages in UI.

References

  • /sdk/quickstart
  • /sdk/utxo-transactions
  • /sdk/wallet-integration
  • /sdk/api-reference
  • /services/relay-api
  • /architecture/viewing-keys-compliance

Prompt templates

Build a production-ready Cloak integration layer for this app:
  • wallet adapter wiring
  • deposit/send/withdraw/swap handlers
  • compliance history fetch + cache + CSV export
  • typed status/progress state
Return full file patches and the exact validation commands.
Implement transaction handlers using current SDK APIs with:
  • bigint-safe parsing
  • retry policy for stale roots
  • clear error categories for UI
  • no secret leakage in logs
Audit my existing code and refactor it to current Cloak runtime behavior.Constraints:
  • keep existing UX behavior unless broken
  • minimize API surface changes in UI components
  • include a migration note per changed module