pnpm monorepo for Self - identity verification using passport NFC and zero-knowledge proofs.
app/(@selfxyz/mobile-app) - React Native Self Wallet, production mobile app.packages/- SDK surfaces: WebView engine and native shells.
nvm use && corepack enable && pnpm install- Package manager: pnpm only (never npm or yarn). The version is pinned via
packageManagerin the rootpackage.json; workspaces usepnpm-workspace.yamlwithnodeLinker: hoisted. - Respect nested instructions. Read the nearest
AGENTS.mdbefore working underapp/,packages/mobile-sdk-alpha/,packages/webview-app/, ornoir/. - DRY first. Search for existing utilities/components/flows and reuse or refactor before adding new code.
- Extract repeated UI. Same sub-structure in 2+ places becomes a shared component; broad primitives belong in a shared library such as
@selfxyz/euclid. - Keep files small. Aim below 800 LOC; split as files approach it.
- Move static data out of UI. Large maps/lookups/constants belong in
utils/ordata, not screens/components. - Design tokens over hex. Prefer shared color/font/spacing tokens.
- No slop comments. Comment only for non-obvious intent, temporary workarounds,
TODO:/FIXME:, or invariants a future reader would otherwise break. Default to zero new comments in PRs. - Signal over praise. Docs, reviews, specs, and PRs carry issues, risks, decisions, owners, next steps, and validation evidence.
- Test behavior, not mock wiring.
- PR size: 1k-3k LOC; larger PRs need a brief justification. One chunk equals one PR.
- Do not commit generated artifacts unless the build requires them for runtime/distribution.
- Constraint tie-breaker. Correctness/security first, then scope/clarity, then reuse. Document tradeoffs in the spec.
- Unfamiliar term? Check the Self Dictionary in Notion first; it is authoritative before searching the codebase.
- Linear issue descriptions are immutable after creation. Updates go in comments via
save_comment;save_issueon an existing issue is only for structured fields.
- TypeScript is the primary surface. Core logic, state machines, stores, proving flow, and UI live in TS/WebView. Before writing native code ask "Can this run in the WebView?" If yes or maybe, it belongs in TS.
- Native handlers stay thin. Kotlin/Swift are for hardware, OS APIs, lifecycle, keychain, and crypto signing/key-gen only.
- Keychain is native-managed. No web fallback for secure storage.
- No
react-nativeimports in SDK core.packages/mobile-sdk-alpha/src/is platform-agnostic exceptsrc/adapters/react-native/. - Reuse through
mobile-sdk-alpha. Shared types, interfaces, constants, parsing, validation, formatting, state machines, and stores belong in the SDK. - Bridge protocol is the only coupling. Native shells and WebView share a JSON contract; no side channels, custom messaging, or platform extensions.
- Adapter interfaces are the coupling layer. WebView imports SDK adapter interfaces; native shells implement bridge handlers; code does not cross the bridge boundary.
- Fail closed on security boundaries. Reject unknown protocol versions, block remote
devServerUrlin production, and default-deny session lifecycle edge cases. - No RN app regressions.
mobile-sdk-alphachanges stay backwards-compatible with Self Wallet.
cd packages/mobile-sdk-alpha && pnpm test && pnpm types
cd packages/webview-bridge && pnpm build && pnpm test
cd packages/webview-app && pnpm build
pnpm kmp:test
pnpm lint && pnpm types && pnpm build- Every SDK feature needs a repo spec + Linear issue. App-only/non-SDK work needs a Linear issue with inline scope.
- Read the relevant workstream
SPEC.mdbefore implementing. Start at SDK Index; architecture is in SDK Overview. - Specs live in
specs/projects/sdk/workstreams/<scope>/(SPEC.md= backlog;plans/<ID>-<slug>.md= execution). KeepSPEC.mdscannable and update specs when implementation deviates. - Full planning protocol, spec-writing guidelines, and the
/pr-auditto/gaps-to-issuesto/spec-from-auditpipeline: see SDK Contributing.
- app/AGENTS.md - mobile app development, E2E testing, deployment.
- packages/webview-app/AGENTS.md - WebView app development, Euclid migration, assets.
- packages/mobile-sdk-alpha/AGENTS.md - SDK development, testing guidelines.
- noir/AGENTS.md - Noir circuit development.