Single source of truth for agents working in this repo. CLAUDE.md imports this file via
@AGENTS.md, so Claude Code, Codex, and any other agent that reads AGENTS.md share the same
instructions.
Behavioral guidelines to reduce common LLM coding mistakes. (Adapted from Andrej Karpathy's CLAUDE.md.)
Tradeoff: These guidelines bias toward caution over speed. For trivial tasks, use judgment.
Don't assume. Don't hide confusion. Surface tradeoffs.
- State your assumptions explicitly. If uncertain, ask.
- If multiple interpretations exist, present them — don't pick silently.
- If a simpler approach exists, say so. Push back when warranted.
- If something is unclear, stop. Name what's confusing. Ask.
Minimum code that solves the problem. Nothing speculative.
- No features beyond what was asked.
- No abstractions for single-use code.
- No "flexibility" or "configurability" that wasn't requested.
- If you write 200 lines and it could be 50, rewrite it.
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
Touch only what you must. Clean up only your own mess.
- Don't "improve" adjacent code, comments, or formatting.
- Don't refactor things that aren't broken.
- Match existing style, even if you'd do it differently.
- Remove imports/variables YOUR changes made unused; leave pre-existing dead code unless asked.
The test: every changed line should trace directly to the request.
Define success criteria. Loop until verified.
- "Add validation" → "Write tests for invalid inputs, then make them pass."
- "Fix the bug" → "Write a test that reproduces it, then make it pass."
For multi-step tasks, state a brief plan with a verify step for each item.
For any third-party library, use the context7 MCP to fetch up-to-date documentation rather than relying on training data, which lags real library APIs. If the context7 MCP server is not available, set it up: https://context7.com/install
This repository is a Swift 6 package for the OMS SDK. It exposes the OMS_SDK
module and supports iOS 15+ and macOS 12+. The SDK covers wallet auth, Keychain
request signing and session persistence, OIDC flows, transactions, message and
typed-data signing, signature verification, token balances, and unit formatting.
The package, product, target, and several directories contain spaces. Quote paths
and target names in shell commands, for example "Sources/Swift SDK" and
"OMS SDK".
Package.swiftdefines the Swift package, the"OMS SDK"library target, and the"OMS SDKTests"test target.Sources/Swift SDK/contains the SDK implementation.Sources/Swift SDK/Clients/containsWalletClientandIndexerClient.Sources/Swift SDK/Signer/contains Keychain/P-256 signing and credential session code.Sources/Swift SDK/Models/contains public model types and auth/session state.Sources/Swift SDK/Utils/contains encoding, hashing, request, time, byte, and unit helpers.Sources/Swift SDK/Generated/waas.gen.swiftis generated WebRPC client code. Do not edit it by hand unless the user explicitly asks for a generated-code patch.Tests/Swift SDKTests/contains Swift Testing tests using@Testand#expect.Examples/sdk-demo/oms-sdk-demo.xcodeprojandExamples/sdk-demo/oms-sdk-demo/contain the SwiftUI demo app.Examples/trails-actions/trails-actions.xcodeprojandExamples/trails-actions/trails-actions/contain the Trails Actions demo app.README.mdis the user-facing guide;API.mdis the detailed API reference.
swift build
swift test
xcodebuild -list -project Examples/sdk-demo/oms-sdk-demo.xcodeproj
xcodebuild -project Examples/sdk-demo/oms-sdk-demo.xcodeproj -scheme oms-sdk-demo build CODE_SIGNING_ALLOWED=NO
xcodebuild -list -project Examples/trails-actions/trails-actions.xcodeproj
xcodebuild -project Examples/trails-actions/trails-actions.xcodeproj -scheme trails-actions build CODE_SIGNING_ALLOWED=NORun swift test for SDK changes. For demo app changes, also build the relevant
Xcode project with signing disabled when feasible.
See TESTING.md for testing conventions, unit vs. integration boundaries, and execution commands.
- Prefer the existing public API style:
async throwsSDK methods, explicit public model types, and Foundation-native data handling. - Preserve platform availability requirements with
@available(macOS 12.0, iOS 15.0, *)on public SDK surfaces that need it. - Keep wallet/session/security changes conservative. The Keychain-backed P-256 credential is intentionally non-extractable; do not introduce code paths that persist private key material in SDK session storage.
- Keep OIDC redirect state separate from completed wallet session state. Invalid or unrelated callbacks should not clear pending redirect auth.
- Verification APIs require an explicit
walletAddress. Public wallet methods should validate activewalletIdand credential state before building signed requests. - Avoid floating-point math for token amounts. Use or extend
parseUnitsandformatUnitsfor base-unit conversions. - When editing paths with spaces, keep command examples quoted and prefer
rg --files,rg,swift build, andswift testfrom the repository root. - Commit messages and PR titles follow Conventional Commits.
CI runs on every PR and push to master via .github/workflows/ci.yml:
swift build, swift test, and the demo app Xcode builds are required to pass.
Claude GitHub Actions are defined in .github/workflows/claude.yml (mention handler) and
.github/workflows/claude-code-review.yml (auto-review on PRs).
Update README.md when user-facing setup or flow examples change. Update
API.md when public methods, parameters, models, or behavior change. Keep docs
aligned with the actual Swift names, labels, return types, and the OMS_SDK
import name. Avoid adding method descriptions in source code.
The demo app should handle OMS SDK errors and open an error window when that happens.
The demo app may contain local Xcode or macOS metadata changes. Do not revert
unrelated user changes, generated assets, or .DS_Store churn unless explicitly
asked.
- Paths and target names contain spaces — always quote them in shell commands.
waas.gen.swiftis generated; do not edit by hand unless explicitly asked.- Never persist private key material in session storage — the P-256 credential is intentionally non-extractable.
- Do not use floating-point for token amounts; use
parseUnits/formatUnits.
| When this changes… | Also update… |
|---|---|
| Public API methods or models | API.md, README.md (if user-facing), tests |
| Test commands | TESTING.md, ci.yml, AGENTS.md Common Commands |
| Repository structure | AGENTS.md Repository Layout |
| Swift version or platform targets | Package.swift, ci.yml, README.md |
| New third-party dependency added | Package.swift, AGENTS.md (note the lib), context7 setup |
| Demo app flows change | README.md, Examples/ |