@dev.sail.money/sailor 0.0.2 → 0.1.0-local

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/AGENTS.md +140 -111
  2. package/LICENSE +21 -21
  3. package/README.md +430 -337
  4. package/docs/PERMISSION_MODEL.md +93 -93
  5. package/examples/permissions/BoundedApproveAndCallBatch.sol +179 -0
  6. package/examples/permissions/BoundedBet_Limitless_Base.sol +97 -96
  7. package/examples/permissions/BoundedBorrow_AaveV3_Arbitrum.sol +94 -94
  8. package/examples/permissions/BoundedPerp_GMXv2_Arbitrum.sol +154 -143
  9. package/examples/permissions/BoundedStake_Venice_Base.sol +85 -0
  10. package/examples/permissions/BoundedSupply_AaveV3_Arbitrum.sol +82 -0
  11. package/examples/permissions/BoundedSwap_UniswapV3_Base.sol +116 -113
  12. package/examples/permissions/BoundedSwap_UniswapV4_Unichain.sol +150 -144
  13. package/examples/permissions/BoundedTransfer_ERC20_Ethereum.sol +73 -73
  14. package/examples/permissions/BoundedVault_ERC4626_Base.sol +97 -0
  15. package/examples/permissions/README.md +79 -52
  16. package/examples/permissions/SailCalldata.sol +118 -0
  17. package/examples/permissions/foundry.toml +10 -10
  18. package/examples/permissions/interfaces/IBatchPermission.sol +38 -0
  19. package/examples/permissions/interfaces/IPermission.sol +18 -18
  20. package/package.json +45 -39
  21. package/packages/cli/README.md +34 -34
  22. package/packages/cli/dist/index.cjs +4571 -2944
  23. package/packages/cli/dist/server.cjs +1252 -2010
  24. package/packages/sdk/README.md +65 -65
  25. package/packages/sdk/dist/chains.d.ts +12 -0
  26. package/packages/sdk/dist/chains.d.ts.map +1 -0
  27. package/packages/sdk/dist/chains.js +94 -0
  28. package/packages/sdk/dist/chains.js.map +1 -0
  29. package/packages/sdk/dist/deployments.d.ts +14 -7
  30. package/packages/sdk/dist/deployments.d.ts.map +1 -1
  31. package/packages/sdk/dist/deployments.js +132 -141
  32. package/packages/sdk/dist/deployments.js.map +1 -1
  33. package/packages/sdk/dist/index.d.ts +3 -2
  34. package/packages/sdk/dist/index.d.ts.map +1 -1
  35. package/packages/sdk/dist/index.js +3 -2
  36. package/packages/sdk/dist/index.js.map +1 -1
  37. package/packages/sdk/dist/intelligence.d.ts +1 -1
  38. package/packages/sdk/dist/intelligence.js +1 -1
  39. package/packages/sdk/dist/lifi.d.ts +17 -0
  40. package/packages/sdk/dist/lifi.d.ts.map +1 -1
  41. package/packages/sdk/dist/lifi.js +24 -0
  42. package/packages/sdk/dist/lifi.js.map +1 -1
  43. package/packages/sdk/dist/safe.d.ts +83 -0
  44. package/packages/sdk/dist/safe.d.ts.map +1 -1
  45. package/packages/sdk/dist/safe.js +92 -1
  46. package/packages/sdk/dist/safe.js.map +1 -1
  47. package/packages/sdk/dist/templates/ammLiquidity.d.ts +24 -11
  48. package/packages/sdk/dist/templates/ammLiquidity.d.ts.map +1 -1
  49. package/packages/sdk/dist/templates/ammLiquidity.js +39 -31
  50. package/packages/sdk/dist/templates/ammLiquidity.js.map +1 -1
  51. package/packages/sdk/dist/templates/approveAndCallBatch.d.ts +24 -10
  52. package/packages/sdk/dist/templates/approveAndCallBatch.d.ts.map +1 -1
  53. package/packages/sdk/dist/templates/approveAndCallBatch.js +36 -23
  54. package/packages/sdk/dist/templates/approveAndCallBatch.js.map +1 -1
  55. package/packages/sdk/dist/templates/boundedBorrow.d.ts +19 -9
  56. package/packages/sdk/dist/templates/boundedBorrow.d.ts.map +1 -1
  57. package/packages/sdk/dist/templates/boundedBorrow.js +28 -19
  58. package/packages/sdk/dist/templates/boundedBorrow.js.map +1 -1
  59. package/packages/sdk/dist/templates/boundedSwap.d.ts +19 -9
  60. package/packages/sdk/dist/templates/boundedSwap.d.ts.map +1 -1
  61. package/packages/sdk/dist/templates/boundedSwap.js +30 -20
  62. package/packages/sdk/dist/templates/boundedSwap.js.map +1 -1
  63. package/packages/sdk/dist/templates/defiBundle.d.ts +35 -9
  64. package/packages/sdk/dist/templates/defiBundle.d.ts.map +1 -1
  65. package/packages/sdk/dist/templates/defiBundle.js +84 -22
  66. package/packages/sdk/dist/templates/defiBundle.js.map +1 -1
  67. package/packages/sdk/dist/templates/pendle.d.ts +23 -8
  68. package/packages/sdk/dist/templates/pendle.d.ts.map +1 -1
  69. package/packages/sdk/dist/templates/pendle.js +34 -14
  70. package/packages/sdk/dist/templates/pendle.js.map +1 -1
  71. package/packages/sdk/dist/templates/transferTarget.d.ts +11 -3
  72. package/packages/sdk/dist/templates/transferTarget.d.ts.map +1 -1
  73. package/packages/sdk/dist/templates/transferTarget.js +14 -7
  74. package/packages/sdk/dist/templates/transferTarget.js.map +1 -1
  75. package/packages/sdk/dist/types.d.ts +19 -1
  76. package/packages/sdk/dist/types.d.ts.map +1 -1
  77. package/packages/sdk/package.json +80 -52
  78. package/packages/ui/dist/assets/{add-DaJhwIBV.js → add-BxpXfVWe.js} +1 -1
  79. package/packages/ui/dist/assets/{all-wallets-BUxsqWXi.js → all-wallets-BKTn_sWK.js} +1 -1
  80. package/packages/ui/dist/assets/{app-store-DkltwTqE.js → app-store-CfuKbwxR.js} +1 -1
  81. package/packages/ui/dist/assets/{apple-owVOeaIT.js → apple-BKSBbNYg.js} +1 -1
  82. package/packages/ui/dist/assets/{arrow-bottom-D2mmNJve.js → arrow-bottom-D4bG6gZi.js} +1 -1
  83. package/packages/ui/dist/assets/{arrow-bottom-circle-CbNYijx-.js → arrow-bottom-circle-BNTs1p0T.js} +1 -1
  84. package/packages/ui/dist/assets/{arrow-left-DJB61s4C.js → arrow-left-2uee3vYv.js} +1 -1
  85. package/packages/ui/dist/assets/{arrow-right-BBrsQ9R4.js → arrow-right-BktjMV6h.js} +1 -1
  86. package/packages/ui/dist/assets/{arrow-top-Cil6bOc8.js → arrow-top-Izu28fX4.js} +1 -1
  87. package/packages/ui/dist/assets/{bank-CbwEmRo3.js → bank-USBaAyFM.js} +1 -1
  88. package/packages/ui/dist/assets/{basic-CLNfjw3m.js → basic-C_9KjTEH.js} +1 -1
  89. package/packages/ui/dist/assets/{browser-B5TtF4Pb.js → browser-DAEMAKV7.js} +1 -1
  90. package/packages/ui/dist/assets/{card-CO7BVB-C.js → card-DT8yDkKN.js} +1 -1
  91. package/packages/ui/dist/assets/{ccip-2W7K3_J3.js → ccip-CkqfGSxX.js} +1 -1
  92. package/packages/ui/dist/assets/{checkmark-BEtSHq9m.js → checkmark-CsgdEXFj.js} +1 -1
  93. package/packages/ui/dist/assets/{checkmark-bold-D9xGHzPE.js → checkmark-bold-D2gjOQo2.js} +1 -1
  94. package/packages/ui/dist/assets/{chevron-bottom-BDztht6i.js → chevron-bottom-tprFynYV.js} +1 -1
  95. package/packages/ui/dist/assets/{chevron-left-EV4GFNbc.js → chevron-left-D2Zj1gNB.js} +1 -1
  96. package/packages/ui/dist/assets/{chevron-right-B4_bB9oR.js → chevron-right-D1rRuAVe.js} +1 -1
  97. package/packages/ui/dist/assets/{chevron-top-D54xPNzF.js → chevron-top-24dL1mbL.js} +1 -1
  98. package/packages/ui/dist/assets/{chrome-store-DYUpAJJq.js → chrome-store-Vy-5niYX.js} +1 -1
  99. package/packages/ui/dist/assets/{clock-Ca1T1Soz.js → clock-qBjLnVdJ.js} +1 -1
  100. package/packages/ui/dist/assets/{close-BZqWjurK.js → close-DARDwgcu.js} +1 -1
  101. package/packages/ui/dist/assets/{coinPlaceholder-e6fl2XDo.js → coinPlaceholder-BvpIbPlD.js} +1 -1
  102. package/packages/ui/dist/assets/{compass-DCLC7zIh.js → compass-BMTO0ayt.js} +1 -1
  103. package/packages/ui/dist/assets/{copy-Th2AaD-O.js → copy-PaXeRHza.js} +1 -1
  104. package/packages/ui/dist/assets/{core-Ckx_cyuH.js → core-BFnStQd-.js} +3 -3
  105. package/packages/ui/dist/assets/cursor-BDvw-B17.js +3 -0
  106. package/packages/ui/dist/assets/{cursor-transparent-BKHeABKB.js → cursor-transparent-BEMdi-8q.js} +1 -1
  107. package/packages/ui/dist/assets/{desktop-CBjY8t6F.js → desktop-CfuLLThw.js} +1 -1
  108. package/packages/ui/dist/assets/{disconnect-DbSs2cli.js → disconnect-DhwgJMiR.js} +1 -1
  109. package/packages/ui/dist/assets/{discord-ZlLOAUkM.js → discord-po8qoN1s.js} +1 -1
  110. package/packages/ui/dist/assets/{etherscan-CKUrqWYN.js → etherscan-BEsz0_yx.js} +1 -1
  111. package/packages/ui/dist/assets/{events-CiKP71cK.js → events-Bz33Unzu.js} +1 -1
  112. package/packages/ui/dist/assets/{exclamation-triangle-DA1QzFiO.js → exclamation-triangle-7CjTAGOQ.js} +1 -1
  113. package/packages/ui/dist/assets/{extension-BVJkmvpJ.js → extension-CmxjEWEt.js} +1 -1
  114. package/packages/ui/dist/assets/{external-link-D_bsR7B2.js → external-link-CmQ--bNS.js} +1 -1
  115. package/packages/ui/dist/assets/{facebook-CmFmhojx.js → facebook-CIBn9b65.js} +1 -1
  116. package/packages/ui/dist/assets/{fallback-Ofl6uSnB.js → fallback-DATyrQlb.js} +1 -1
  117. package/packages/ui/dist/assets/{farcaster-Co-M3Ss8.js → farcaster-OJ3Jasxg.js} +1 -1
  118. package/packages/ui/dist/assets/{filters-B1WwNaFU.js → filters-D4x09zeL.js} +1 -1
  119. package/packages/ui/dist/assets/{github-CP4fP6gn.js → github-ZlIuMArp.js} +1 -1
  120. package/packages/ui/dist/assets/{google-CsOIXJ6V.js → google-Gwg85sfv.js} +1 -1
  121. package/packages/ui/dist/assets/{help-circle-DiMkomdF.js → help-circle-D1uOWYcX.js} +1 -1
  122. package/packages/ui/dist/assets/{id-lmscL5LX.js → id-C0-5UdYk.js} +1 -1
  123. package/packages/ui/dist/assets/{image-B-ubJrY5.js → image-D_DUsv8-.js} +1 -1
  124. package/packages/ui/dist/assets/{index-CZR1Qjhs.js → index-BCzex_R6.js} +1 -1
  125. package/packages/ui/dist/assets/index-BUhrHLpY.js +1775 -0
  126. package/packages/ui/dist/assets/index-Cq02kQmy.css +1 -0
  127. package/packages/ui/dist/assets/{index-BaukYv-x.js → index-CrYzBWfD.js} +1 -1
  128. package/packages/ui/dist/assets/{index-CF0KMmke.js → index-DdbJhIdl.js} +3 -3
  129. package/packages/ui/dist/assets/{index-DVgfCzCo.js → index-DiojfeVM.js} +1 -1
  130. package/packages/ui/dist/assets/{index-Dbh5V1Z0.js → index-izd7vu_r.js} +1 -1
  131. package/packages/ui/dist/assets/{index.es-C78cE5SI.js → index.es-DdkHhQAj.js} +4 -4
  132. package/packages/ui/dist/assets/{info-Cqg57EVo.js → info-CiRd_kEG.js} +1 -1
  133. package/packages/ui/dist/assets/{info-circle-DkeSWNKV.js → info-circle-ypxjqarK.js} +1 -1
  134. package/packages/ui/dist/assets/{lightbulb-DNlO4qKh.js → lightbulb-B-pxLxd8.js} +1 -1
  135. package/packages/ui/dist/assets/{mail-kVQ8Jb9Y.js → mail-BYmicuVZ.js} +1 -1
  136. package/packages/ui/dist/assets/{metamask-sdk-CBalSvz7.js → metamask-sdk-Ccl6DG7Q.js} +1 -1
  137. package/packages/ui/dist/assets/{mobile-BEteuhF7.js → mobile-CtP5PqVT.js} +1 -1
  138. package/packages/ui/dist/assets/{more-DBWmXQli.js → more-6C2733we.js} +1 -1
  139. package/packages/ui/dist/assets/{network-placeholder-Dg1uUHiL.js → network-placeholder-CdhxMzqd.js} +1 -1
  140. package/packages/ui/dist/assets/{nftPlaceholder-i3AHSiD9.js → nftPlaceholder-DVmTWEAY.js} +1 -1
  141. package/packages/ui/dist/assets/{off-BtMm0fi2.js → off-DNYLughs.js} +1 -1
  142. package/packages/ui/dist/assets/{parseSignature-Cb5FlWWg.js → parseSignature-Dq2B5Bu3.js} +1 -1
  143. package/packages/ui/dist/assets/{play-store-iKKkXa6a.js → play-store-D7Qut5ta.js} +1 -1
  144. package/packages/ui/dist/assets/{plus-CA5NaRtb.js → plus-kqMyjt3q.js} +1 -1
  145. package/packages/ui/dist/assets/{qr-code-D2kiqR7h.js → qr-code-DiUCWRbz.js} +1 -1
  146. package/packages/ui/dist/assets/{recycle-horizontal-Dcme7R03.js → recycle-horizontal-Boe3XiS-.js} +1 -1
  147. package/packages/ui/dist/assets/{refresh-Dega3sDp.js → refresh-CrBgBQYO.js} +1 -1
  148. package/packages/ui/dist/assets/{reown-logo-xNkksyWJ.js → reown-logo-CFZCCHSx.js} +1 -1
  149. package/packages/ui/dist/assets/{search-HYl7NO8x.js → search-ChTDrghU.js} +1 -1
  150. package/packages/ui/dist/assets/{secp256k1-Cxd6_SiH.js → secp256k1-DAV5Q_FR.js} +1 -1
  151. package/packages/ui/dist/assets/{send-CJU8CUAo.js → send-DLFbBFe1.js} +1 -1
  152. package/packages/ui/dist/assets/{swapHorizontal-IMUKiUre.js → swapHorizontal-BEs3emfG.js} +1 -1
  153. package/packages/ui/dist/assets/{swapHorizontalBold-CNYnNJ9-.js → swapHorizontalBold-CC-Hfa7W.js} +1 -1
  154. package/packages/ui/dist/assets/{swapHorizontalMedium-B9VxEYsT.js → swapHorizontalMedium-BmR0H8DC.js} +1 -1
  155. package/packages/ui/dist/assets/{swapHorizontalRoundedBold-Dz33l_Jh.js → swapHorizontalRoundedBold-BdP5NGIH.js} +1 -1
  156. package/packages/ui/dist/assets/{swapVertical-CHUmjVJ0.js → swapVertical-CPrGEJPY.js} +1 -1
  157. package/packages/ui/dist/assets/{telegram-kl9S2mbU.js → telegram-CxNoZ80Q.js} +1 -1
  158. package/packages/ui/dist/assets/{three-dots-U5lhA1Am.js → three-dots-BRa6SBpL.js} +1 -1
  159. package/packages/ui/dist/assets/{twitch-KTEUWXEp.js → twitch-BC338bG5.js} +1 -1
  160. package/packages/ui/dist/assets/{twitterIcon-BHiq8mRg.js → twitterIcon-BGZmt2i9.js} +1 -1
  161. package/packages/ui/dist/assets/{verify-CfN-BXNd.js → verify-CEstW0zw.js} +1 -1
  162. package/packages/ui/dist/assets/{verify-filled-DwZccetj.js → verify-filled-OkZb0weU.js} +1 -1
  163. package/packages/ui/dist/assets/{w3m-modal-CS-PFqPE.js → w3m-modal-pS09ECwE.js} +1 -1
  164. package/packages/ui/dist/assets/{wallet-DVlGkhOY.js → wallet-BXVKCgC9.js} +1 -1
  165. package/packages/ui/dist/assets/{wallet-placeholder-CvR_iEWX.js → wallet-placeholder-C_kNhB1c.js} +1 -1
  166. package/packages/ui/dist/assets/{walletconnect-8pZBDvVI.js → walletconnect-CRKIuUHH.js} +1 -1
  167. package/packages/ui/dist/assets/{warning-circle-ylLEE0Yp.js → warning-circle-DB2NnwlJ.js} +1 -1
  168. package/packages/ui/dist/assets/{x-C_TBsTMj.js → x-DT4RmwL5.js} +1 -1
  169. package/packages/ui/dist/index.html +14 -14
  170. package/scripts/check-docs.mjs +262 -262
  171. package/scripts/check-init.mjs +108 -109
  172. package/scripts/postinstall.js +81 -366
  173. package/templates/custom-mandate/.sail/contracts/interfaces/IPermission.sol +18 -18
  174. package/templates/custom-mandate/README.md +116 -85
  175. package/templates/custom-mandate/foundry.toml +8 -8
  176. package/templates/custom-mandate/mandates/BoundedCallPermission.sol +41 -35
  177. package/templates/custom-mandate/mandates/README.md +16 -16
  178. package/templates/custom-mandate/mandates/SailCalldata.sol +118 -0
  179. package/templates/{dca-rebalancer → default}/.cursor/rules +25 -25
  180. package/templates/default/.env.example +20 -0
  181. package/templates/{dca-rebalancer → default}/.github/workflows/agent-tick.yml +33 -32
  182. package/templates/{dca-rebalancer → default}/.sail/README.md +13 -13
  183. package/templates/{dca-rebalancer → default}/.sail/config.json +10 -10
  184. package/templates/default/AGENTS.md +171 -0
  185. package/templates/{dca-rebalancer → default}/CLAUDE.md +2 -2
  186. package/templates/default/README.md +16 -0
  187. package/templates/{dca-rebalancer → default}/_gitignore +13 -13
  188. package/templates/{dca-rebalancer → default}/docs/PERMISSION_MODEL.md +93 -93
  189. package/templates/default/examples/dca/README.md +16 -0
  190. package/templates/default/examples/dca/agent.ts +174 -0
  191. package/templates/{dca-rebalancer/src → default/examples/dca}/mandate.ts +45 -67
  192. package/templates/{dca-rebalancer → default}/package.json +17 -17
  193. package/templates/default/src/agent.ts +37 -0
  194. package/templates/default/src/config.ts +24 -0
  195. package/templates/default/src/mandate.ts +22 -0
  196. package/templates/default/tsconfig.json +17 -0
  197. package/templates/{dca-rebalancer → default}/ui/README.md +3 -3
  198. package/templates/lifi-permissions/LifiBoundedApprovePermissionCloneable.sol +84 -84
  199. package/templates/lifi-permissions/LifiDiamondSwapPermissionCloneable.sol +97 -97
  200. package/templates/lifi-permissions/README.md +53 -53
  201. package/packages/ui/dist/assets/cursor-DV7rOqbJ.js +0 -3
  202. package/packages/ui/dist/assets/index-CKxgNxS9.css +0 -1
  203. package/packages/ui/dist/assets/index-Q2Yai4Fe.js +0 -2103
  204. package/templates/dca-rebalancer/.env.example +0 -6
  205. package/templates/dca-rebalancer/AGENTS.md +0 -246
  206. package/templates/dca-rebalancer/AGENT_PLAYBOOK.md +0 -110
  207. package/templates/dca-rebalancer/README.md +0 -16
  208. package/templates/dca-rebalancer/src/agent.ts +0 -253
  209. package/templates/dca-rebalancer/src/config.ts +0 -27
  210. package/templates/dca-rebalancer/tsconfig.json +0 -8
  211. /package/templates/{dca-rebalancer → default}/.sail/.gitkeep +0 -0
package/README.md CHANGED
@@ -1,337 +1,430 @@
1
- # Sailor
2
-
3
- > A toolkit for building and operating Sail Protocol SMAs with AI agents.
4
-
5
- Sailor is the operator layer for [Sail Protocol](../SailProtocol): the tooling an agent builder uses to create a Separately Managed Account, bound it with permissions, and run a strategy against it. It wraps the on-chain primitives — SailKernel dispatch, MandateFactory registration, EIP-712 mandate signing — behind a TypeScript SDK, a CLI, and a local dashboard. An agent is an async function that receives context and returns intended transactions; Sailor previews each through the kernel, executes the approved ones, and records what happened. It does not deploy the protocol or author new permission templates — that lives in Sail Protocol. It sits one level up: turning a deployed SailKernel into something an operator can actually drive.
6
-
7
- ---
8
-
9
- ## What's inside
10
-
11
- | Package | Name | Role |
12
- |---|---|---|
13
- | `packages/sdk` | `@sail/sdk` | TypeScript library wrapping SailKernel and MandateFactory |
14
- | `packages/cli` | `sailor` | CLI for account setup, mandate signing, and agent execution |
15
- | `packages/chains` | `@sail/chains` | Per-chain address registry (EVM-compatible) |
16
- | `packages/ui` | `sailor-ui` | Local dashboard running on localhost:3333 |
17
- | `templates/dca-rebalancer` | — | Starter template: DCA portfolio rebalancer (default for `sailor init`) |
18
- | `templates/custom-mandate` | — | Solidity reference: allowlist mandate contracts (not a project template) |
19
- | `templates/lifi-permissions` | — | Solidity reference: LiFi clone permission contracts (not a project template) |
20
-
21
- ---
22
-
23
- ## How it works
24
-
25
- The path from nothing to a running agent is seven steps:
26
-
27
- 1. **Generate keys** — a manager key (the agent's dispatch signer) and a permissionSigner key, both generated and encrypted on disk.
28
- 2. **Deploy SMA** — a Safe registered with SailKernel, with the manager and permissionSigner addresses set at registration.
29
- 3. **Write a strategy** — an async `tick` function that receives a context and returns a list of intended dispatches.
30
- 4. **Sign a mandate** a set of registered permissions that bound what the agent can do, authorized via EIP-712 by the permission signer through MetaMask or a local key.
31
- 5. **Dry-run** — the kernel's `previewBatch` confirms the named permission passes before anything executes on-chain.
32
- 6. **Run the agent** locally on a cron schedule, or via GitHub Actions on a timer.
33
- 7. **Monitor** — the local dashboard on localhost:3333 reflects live mandate state, agent status, and activity.
34
-
35
- ---
36
-
37
- ## Roles
38
-
39
- Sailor operates the three roles Sail Protocol separates:
40
-
41
- | Role | Authority | Held by |
42
- |---|---|---|
43
- | **Owner** | Holds the Safe. Custody anchor. | The LP (Safe owner) same wallet as MetaMask |
44
- | **Permission Signer** | Signs mandate registration and revocation via EIP-712. | Same as Owner, or a separate key |
45
- | **Manager** | Executes dispatches within permitted bounds. Signs each dispatch. | The agent key — encrypted in `.sail/keys/manager.json` |
46
-
47
- ---
48
-
49
- ## Installation
50
-
51
- ### Start a new agent project (recommended)
52
-
53
- Open your AI coding assistant and run in its terminal:
54
-
55
- ```sh
56
- npx sailor init my-agent
57
- ```
58
-
59
- Then say **"start"** — your assistant takes it from there.
60
-
61
- ### Global CLI (for direct sailor commands)
62
-
63
- ```sh
64
- npm install -g @sail.money/sailor
65
- sailor init my-agent
66
- ```
67
-
68
- ---
69
-
70
- ## Quickstart
71
-
72
- Prerequisites:
73
-
74
- - Node.js 18+ (the CLI runs on 18; `pnpm install` needs Node 22+)
75
- - A wallet (MetaMask or Rabby)
76
- - An RPC URL (e.g. Alchemy free tier)
77
- - A supported chain: **Base, Base Sepolia, Arbitrum, or Unichain** — these use the verified deployments bundled in `@sail/sdk`, so no `@sail/chains` entry is needed. Other chains require kernel + mandateFactory addresses in `@sail/chains` (see [State of the project](#state-of-the-project)).
78
-
79
- ```bash
80
- npx sailor init my-agent && cd my-agent
81
- npm install # or `pnpm install` (needs Node 22+)
82
-
83
- # 1. Ground yourself — read-only, no gas, no wallet:
84
- sailor capabilities # what you can build on this chain
85
- sailor doctor # kernel model + RPC reachability + gas balances
86
-
87
- # 2. Set up the account in the browser wizard (choose chain, connect wallet,
88
- # generate the agent key, deploy your SMA):
89
- sailor ui start # open http://localhost:3333 and follow steps 1–4
90
-
91
- # 3. Back in the terminal: configure .sail/.env.local, fund the agent key for gas,
92
- sailor mandate prepare # draft permissions approve in the browser
93
- sailor run # start the agent (use --once for a single tick)
94
- ```
95
-
96
- The SMA is deployed through the browser wizard (it submits from your wallet), not a
97
- terminal command see the scaffolded project's `AGENTS.md` for the full 8-step flow.
98
-
99
- ---
100
-
101
- ## Templates
102
-
103
- `sailor init` scaffolds a new agent project from a template. By default it
104
- writes into the **current directory**; pass a name to create a subdirectory.
105
-
106
- ```bash
107
- sailor init # scaffold into cwd
108
- sailor init my-agent # create ./my-agent/ and scaffold there
109
- sailor init --template dca-rebalancer # explicit (same as default)
110
- sailor init my-agent --template <name> # named subdirectory + specific template
111
- ```
112
-
113
- ### Available templates
114
-
115
- | Template | Description |
116
- |---|---|
117
- | `dca-rebalancer` | Dollar-cost-averaging portfolio rebalancer. Includes a full agent loop, Foundry workspace for permission contracts, GitHub Actions cron job, and the operator guide (`AGENTS.md`). **Default.** |
118
-
119
- ### What makes a valid template
120
-
121
- A valid template is any directory under `templates/` that contains a
122
- `package.json`. Directories without one (e.g. `custom-mandate`,
123
- `lifi-permissions`) are Solidity reference sources, not project scaffolds, and
124
- are excluded from the available list.
125
-
126
- ### Adding a template
127
-
128
- 1. Create a directory under `templates/<your-template-name>/`.
129
- 2. Add a `package.json` (the `name` field is patched to the project name on
130
- init).
131
- 3. Add a `.sail/` workspace structure if the agent needs local state.
132
- 4. The template will appear automatically in `sailor init --template <name>`.
133
-
134
- Template files are bundled into the published `sailor` npm package via the
135
- `files` field in the root `package.json`.
136
-
137
- ---
138
-
139
- ## Dashboard (`sailor ui`)
140
-
141
- The Sailor dashboard is a local React app served at `http://localhost:3333`.
142
- It shows live account state, mandate health, signer balances, and recent
143
- activity all read from the project's `.sail/` directory with no hosted
144
- backend.
145
-
146
- ### Commands
147
-
148
- ```bash
149
- sailor ui # start the dashboard (same as sailor ui start)
150
- sailor ui start # start the dashboard at http://localhost:3333
151
- sailor ui stop # stop the running dashboard
152
- sailor ui status # show whether the dashboard is running + pid
153
- ```
154
-
155
- ### How it works
156
-
157
- `sailor ui start` spawns a bundled Express server (`server.cjs`) that:
158
-
159
- - Serves the pre-built React UI as static files on `/`
160
- - Exposes a local API on `/api` that reads `.sail/` state from the current
161
- working directory
162
-
163
- The server PID is written to `.sail/runtime/ui.json` on start. `sailor ui stop`
164
- reads that file, sends `SIGTERM` to the server process, and removes the file.
165
- This means you can start the dashboard in one terminal and stop it from another.
166
-
167
- ### Running in the background
168
-
169
- ```bash
170
- # macOS / Linux
171
- sailor ui start &
172
- sailor ui status # ● running http://localhost:3333 (pid 12345)
173
- sailor ui stop # Stopped Sailor UI (pid 12345).
174
-
175
- # Windows (PowerShell)
176
- Start-Job { sailor ui start }
177
- sailor ui status
178
- sailor ui stop
179
- ```
180
-
181
- ---
182
-
183
- ## Agent-driven onboarding & custom mandates
184
-
185
- For chains with a bundled Sail deployment (Base, Base Sepolia, Arbitrum, Unichain — shipped
186
- in `@sail/sdk`, no `@sail/chains` entry required), an agent can drive the whole
187
- setup through a browser **signing station**. The station is a local HTTP +
188
- WebSocket daemon that bridges the CLI and the owner's wallet: the agent never
189
- holds the owner key it pushes signing requests, the owner approves them in the
190
- browser, and the agent submits the transactions it's allowed to.
191
-
192
- ```bash
193
- sailor keys generate # manager (agent) key
194
- sailor station start & # signing daemon (serves the UI)
195
- # owner opens the printed URL once and connects their wallet
196
- sailor owner connect # detect & persist the owner
197
- sailor scan # discover the owner's Safes + state
198
- sailor onboard --new-sma # create an SMA + (optionally) attach a mandate
199
- ```
200
-
201
- Agents author their own permission contracts and deploy them from the scaffolded
202
- Foundry workspace (`mandates/`, with `@sail/interfaces/IPermission.sol` vendored
203
- under `.sail/contracts/`):
204
-
205
- ```bash
206
- forge build
207
- sailor mandate deploy --contract MyMandate \
208
- --args '["0xPermissionSigner", ["0xTarget"]]' \
209
- --attach --sma 0xSafe
210
- ```
211
-
212
- `deploy` emits a contract-creation signing request (the owner signs it in the
213
- browser); the deployed address is read from the receipt and tracked in
214
- `.sail/state/mandates.json`. `attach` reads the signer nonce, has the owner sign
215
- a `RegisterPermission` EIP-712 message, then the agent submits
216
- `kernel.registerPermission` with the exact registration fee. Every command takes
217
- `--json` for headless agent use; set `SAIL_PASSPHRASE` to unlock the manager key
218
- non-interactively.
219
-
220
- ---
221
-
222
- ## Architecture
223
-
224
- ```
225
- ┌────────────────────┐ ┌────────────────────┐
226
- │ Permission Signer │ │ Manager/Agent │
227
- │ MetaMask / local │ │ .sail/keys/manager │
228
- └─────────┬──────────┘ └─────────┬──────────┘
229
- │ │
230
- EIP-712 mandate │ dispatch
231
- ▼ ▼
232
- ┌─────────────────────────────────────────────────────────────────────┐
233
- │ SailKernel │
234
- │ (Sail Protocol) │
235
- └─────────┬───────────────────────┬───────────────────────┬───────────┘
236
- │ │ │
237
- registration │ execution │ evaluation
238
- ▼ ▼ ▼
239
- ┌────────────────────┐ ┌────────────────────┐ ┌────────────────────┐
240
- │ MandateFactory │ │ Safe │ │ Permissions │
241
- │ (register perms) │ │ (custody) │ │ (named, per-call)
242
- └────────────────────┘ └────────────────────┘ └────────────────────┘
243
-
244
- sailor CLI / @sail/sdk drive both signing paths above.
245
- .sail/ (account · mandate · activity) ──→ sailor-ui (localhost:3333)
246
- ```
247
-
248
- The CLI and SDK sit between the operator and SailKernel: they build the EIP-712 payloads, submit dispatches, and read kernel state via viem. The permission signer authorizes the mandate — registration runs through MandateFactory — while the manager key signs each dispatch the kernel evaluates against a named permission before executing it through the Safe. All local state — the deployed account, the signed mandate, and the agent's activity log — lives under `.sail/` on disk, which the dashboard reads through a small local server. Sailor never holds the Owner key and runs no hosted backend; the wallet talks to the chain directly.
249
-
250
- ---
251
-
252
- ## Security model
253
-
254
- - The agent signs dispatches; the kernel evaluates the named permission on every call. A permission returning false or exceeding its gas cap is treated as denial — fail-closed.
255
- - The Owner key controls the Safe and is never read by Sailor. Mandate signing requires a deliberate action by the permission signer.
256
- - The manager key is encrypted on disk using geth keystore v3 (scrypt + aes-128-ctr) and is never transmitted.
257
- - The session can be paused instantly via `sailor session pause` or the dashboard stop button; this does not affect Safe custody.
258
-
259
- ---
260
-
261
- ## State of the project
262
-
263
- Sailor is functional and published as [`@sail.money/sailor`](https://www.npmjs.com/package/@sail.money/sailor) on npm (v0.0.1). The SDK, CLI, keystore, mandate flows, agent runner, and dashboard are implemented and have been exercised end to end against Base Sepolia.
264
-
265
- The Sail Protocol trusted core is deployed on Base, Base Sepolia, Arbitrum, and Unichain as staging deployments for testing ahead of a formal launch. All four run the selective dispatch model, with verified deployments bundled in `@sail/sdk`. These deployments are under an ongoing external audit by [Octane Security](https://octane.security) and are not final — do not use them with funds you are not prepared to lose. Permission templates are not yet deployed against the Base, Arbitrum, and Base Sepolia kernels; **Unichain** ships the full template suite (7 shared + 12 standalone, source-verified) and its template registries in `@sail/sdk` are populated. `@sail/chains` and the remaining template registries will be filled in as templates are deployed on the other chains and at mainnet launch.
266
-
267
- ---
268
-
269
- ## Deployments
270
-
271
- The Sail Protocol trusted core is live on the following chains as **staging deployments** ahead of a formal launch, bundled in `@sail/sdk`. All run the selective dispatch model with zero fees. Permission templates are not yet deployed against the Base, Arbitrum, and Base Sepolia kernels; **Unichain** ships the full template suite (7 shared + 12 standalone, source-verified on uniscan.xyz) and has its onboarding allowlists seeded at genesis.
272
-
273
- ### Base (8453)
274
-
275
- | Contract | Address |
276
- |---|---|
277
- | SailKernel | `0x6319d3dfDDe3804ba93D65752b00c52bFb05a1ab` |
278
- | SailGovernance | `0x7E897D919872b1587577617ffFC42113679d0C50` |
279
- | Timelock | `0x8eC3Ca951E193C6E3713A70022454d7A1f083281` |
280
- | PermissionFactory | `0x7724EACd97C8601d5AC244Aadbf76ad87353Ff31` |
281
- | StandardFeePolicy | `0x65850a8D5050aeAade68289ff96c4F119a24B82e` |
282
- | SafeModuleEnabler | `0xC84EdE78f93291A1fab19F51c4c7e938AB302Edf` |
283
- | Treasury | `0xB01dCE443d052e44b7D13726c0EC9fFB7f5815B6` |
284
-
285
- ### Arbitrum (42161)
286
-
287
- | Contract | Address |
288
- |---|---|
289
- | SailKernel | `0x2716B12832DED0EF5688519c5Fe069EFc0374E02` |
290
- | SailGovernance | `0xd6AbB7A1036ADc7958Abffec9Da03450c5a2Ec8e` |
291
- | Timelock | `0x114CB7110C780f7E3a6093AfE0B52463a569857C` |
292
- | PermissionFactory | `0x23681A8A4C9819D8EaB37E46B858da6F3c85E683` |
293
- | StandardFeePolicy | `0xAdfB986D48480bC67a7cF3751d30599161632e0D` |
294
- | SafeModuleEnabler | `0xabe2a6D03F592BC602cA1dBDCD885ba2493274f9` |
295
- | Treasury | `0xB01dCE443d052e44b7D13726c0EC9fFB7f5815B6` |
296
-
297
- ### Base Sepolia (84532)
298
-
299
- | Contract | Address |
300
- |---|---|
301
- | SailKernel | `0xf1D0F4C9893612627409948BAa9d82a01a373799` |
302
- | SailGovernance | `0xEaD44bC6999E7b00b9b2E11c1660248DC2a30993` |
303
- | Timelock | `0x97B863e392C9859336788D5Ec454527d33C95B74` |
304
- | PermissionFactory | `0xdfF6a2272F667cDf78Af4681b9c88A219998db95` |
305
- | StandardFeePolicy | `0x05570F7973b46Eb9Ed4518422891EFC26BD58b97` |
306
- | SafeModuleEnabler | `0xB2C2B52d94412e3472C9fb2B52186eA12a935869` |
307
- | Treasury | `0xB01dCE443d052e44b7D13726c0EC9fFB7f5815B6` |
308
-
309
- ### Unichain (130)
310
-
311
- First chain to ship the full permission-template suite (7 shared + 12 standalone, source-verified on [uniscan.xyz](https://uniscan.xyz)). Genesis allowlist bootstrap — onboarding usable without the 48h timelock.
312
-
313
- | Contract | Address |
314
- |---|---|
315
- | SailKernel | `0xD985029960a9B7C2E7E38e102C448b8b8539B156` |
316
- | SailGovernance | `0xAb5C90ECfF2763f6f20f8E553E3b8778dD9C349A` |
317
- | Timelock | `0xd44FbBB37f01e235E0EE5386948F216d36D0CEf2` |
318
- | PermissionFactory | `0x8edDb62Aa49CeB837abf2653be2d93Ad9Fe6777D` |
319
- | StandardFeePolicy | `0x7bBA8BE3c01c972757aA4a230A00D58aB600A1F1` |
320
- | SafeModuleEnabler | `0xFE9227A9F2baf704060c604466df354a5A137b9B` |
321
- | Treasury | `0xB01dCE443d052e44b7D13726c0EC9fFB7f5815B6` |
322
-
323
- The 19 template addresses are in `@sail/sdk` (`knownTemplates` + `standaloneTemplates` for chain 130).
324
-
325
- Addresses are sourced from `@sail/sdk` (`packages/sdk/src/deployments.ts`), the canonical registry.
326
-
327
- ---
328
-
329
- ## Contributing
330
-
331
- Sailor and Sail Protocol are separate repositories with separate concerns. Protocol questions — SailKernel internals, permission templates, MandateFactory, fee policies — belong in the [SailProtocol](../SailProtocol) repository. Sailor questions — the SDK, CLI, dashboard, and agent templates — belong here.
332
-
333
- ---
334
-
335
- ## License
336
-
337
- MIT
1
+ # Sailor
2
+
3
+ > A toolkit for building and operating Sail Protocol SMAs with AI agents.
4
+
5
+ Sailor is the operator layer for [Sail Protocol](../SailProtocol): the tooling an agent builder uses to create a Separately Managed Account, bound it with permissions, and run a strategy against it. It wraps the on-chain primitives — SailKernel dispatch, MandateFactory registration, EIP-712 mandate signing — behind a TypeScript SDK, a CLI, and a local dashboard. An agent is an async function that receives context and returns intended transactions; Sailor previews each through the kernel, executes the approved ones, and records what happened. It does not deploy the protocol or author new permission templates — that lives in Sail Protocol. It sits one level up: turning a deployed SailKernel into something an operator can actually drive.
6
+
7
+ ---
8
+
9
+ ## What's inside
10
+
11
+ | Package | Name | Role |
12
+ |---|---|---|
13
+ | `packages/sdk` | `@sail/sdk` (internal) | TypeScript library: SailorClient, EIP-712 helpers, ABIs, chain registry |
14
+ | `packages/cli` | `@sail.money/sailor` | CLI for account setup, mandate signing, and agent execution |
15
+ | `packages/ui` | `sailor-ui` | Local dashboard running on localhost:3333 |
16
+ | `templates/default` | | Default agent starter (neutral; what `sailor init` scaffolds) |
17
+ | `templates/custom-mandate` | — | Solidity reference: IPermission scaffold (not a project template) |
18
+ | `templates/lifi-permissions` | — | Solidity reference: LiFi clone permission contracts (not a project template) |
19
+
20
+ ---
21
+
22
+ ## How it works
23
+
24
+ The path from nothing to a running agent is five stages, guided by your AI coding assistant through the scaffolded `AGENTS.md`:
25
+
26
+ 1. **Deploy your SMA and create your agent wallet** — done in the browser. Your owner wallet never leaves it.
27
+ 2. **Define your strategy** — describe what you want your agent to do. The assistant asks the right questions to establish on-chain bounds (tokens, amounts, venues), then helps design the permission contracts.
28
+ 3. **Build, test, and sign your mandate** — the assistant authors the permission contracts, proves in plain English what each one permits and blocks, deploys them, and walks you through signing to authorize.
29
+ 4. **Run** — `sailor run` executes your agent locally on a schedule, or via the GitHub Actions workflow the scaffold provides.
30
+ 5. **Extend** *(optional)* — the assistant can wire notifications (Telegram, email) and build a custom dashboard tailored to your strategy.
31
+
32
+ Run `npx sailor init my-agent`, open the scaffolded folder in Claude Code, Cursor, Codex, or any AI coding assistant, and say **"start"**. The `AGENTS.md` in the project drives the assistant through all five stages.
33
+
34
+ ---
35
+
36
+ ## Roles
37
+
38
+ Sailor operates the three roles Sail Protocol separates:
39
+
40
+ | Role | Authority | Held by |
41
+ |---|---|---|
42
+ | **Owner** | Holds the Safe. Custody anchor. | The LP (Safe owner) — same wallet as MetaMask |
43
+ | **Permission Signer** | Signs mandate registration and revocation via EIP-712. | Same as Owner, or a separate key |
44
+ | **Manager** | Executes dispatches within permitted bounds. Signs each dispatch. | The agent key encrypted in `.sail/keys/manager.json` |
45
+
46
+ ---
47
+
48
+ ## Installation
49
+
50
+ ### Start a new agent project (recommended)
51
+
52
+ Open your AI coding assistant and run in its terminal:
53
+
54
+ ```sh
55
+ npx sailor init my-agent
56
+ ```
57
+
58
+ Then say **"start"** — your assistant takes it from there.
59
+
60
+ ### Global CLI (for direct sailor commands)
61
+
62
+ ```sh
63
+ npm install -g @sail.money/sailor
64
+ sailor init my-agent
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Quickstart
70
+
71
+ Prerequisites:
72
+
73
+ - Node.js 18+
74
+ - A wallet (MetaMask or Rabby)
75
+ - An RPC URL (e.g. Alchemy free tier)
76
+ - A supported chain: **Base, Base Sepolia, Arbitrum, or Unichain** — verified deployments are bundled in `@sail.money/sailor`.
77
+
78
+ ### Recommended — assistant-driven
79
+
80
+ ```bash
81
+ npx sailor init my-agent && cd my-agent
82
+ npm install
83
+ ```
84
+
85
+ Open this folder in Claude Code, Cursor, Codex, or any AI coding assistant and say **"start"**. The scaffolded `AGENTS.md` guides the assistant through all five stages — SMA deployment, strategy definition, mandate authoring, running, and automation. No manual steps required.
86
+
87
+ ### Direct CLI reference (advanced)
88
+
89
+ For users who prefer the terminal:
90
+
91
+ ```bash
92
+ sailor capabilities # what you can build on this chain — read-only, no gas
93
+ sailor doctor # kernel model + RPC reachability + gas balances
94
+ sailor ui start # open http://localhost:3333 to deploy SMA + create agent wallet
95
+ sailor run --once # single tick — confirm it works before automating
96
+ sailor run # start the agent (continuous)
97
+ sailor keys export-ci # copy the encrypted agent wallet to ci-keystore.json for CI commits
98
+ sailor mandate sign # sign a mandate — reconciles against live on-chain permissions first
99
+ ```
100
+
101
+ `sailor run` writes reverted transactions to stderr as `reverted: <txHash> (gas used: N)`; successful dispatches are appended to `.sail/activity.jsonl`.
102
+
103
+ ---
104
+
105
+ ## Templates
106
+
107
+ `sailor init` scaffolds a new agent project from a template. By default it
108
+ writes into the **current directory**; pass a name to create a subdirectory.
109
+
110
+ ```bash
111
+ sailor init # scaffold into cwd
112
+ sailor init my-agent # create ./my-agent/ and scaffold there
113
+ sailor init --template default # explicit (same as default)
114
+ sailor init my-agent --template <name> # named subdirectory + specific template
115
+ ```
116
+
117
+ ### Available templates
118
+
119
+ | Template | Description |
120
+ |---|---|
121
+ | `default` | Neutral agent starter. Includes a blank agent loop, Foundry workspace for permission contracts, GitHub Actions cron job, and the operator guide (`AGENTS.md`). For a complete worked example see `examples/dca/`. **Default.** |
122
+
123
+ ### What makes a valid template
124
+
125
+ A valid template is any directory under `templates/` that contains a
126
+ `package.json`. Directories without one (e.g. `custom-mandate`,
127
+ `lifi-permissions`) are Solidity reference sources, not project scaffolds, and
128
+ are excluded from the available list.
129
+
130
+ ### Adding a template
131
+
132
+ 1. Create a directory under `templates/<your-template-name>/`.
133
+ 2. Add a `package.json` (the `name` field is patched to the project name on
134
+ init).
135
+ 3. Add a `.sail/` workspace structure if the agent needs local state.
136
+ 4. The template will appear automatically in `sailor init --template <name>`.
137
+
138
+ Template files are bundled into the published `sailor` npm package via the
139
+ `files` field in the root `package.json`.
140
+
141
+ ---
142
+
143
+ ## Dashboard (`sailor ui`)
144
+
145
+ The Sailor dashboard is a local React app served at `http://localhost:3333`.
146
+ It shows live account state, mandate health, signer balances, and recent
147
+ activity — all read from the project's `.sail/` directory with no hosted
148
+ backend.
149
+
150
+ ### Commands
151
+
152
+ ```bash
153
+ sailor ui # start the dashboard (same as sailor ui start)
154
+ sailor ui start # start the dashboard at http://localhost:3333
155
+ sailor ui stop # stop the running dashboard
156
+ sailor ui status # show whether the dashboard is running + pid
157
+ ```
158
+
159
+ ### How it works
160
+
161
+ `sailor ui start` spawns a bundled Express server (`server.cjs`) that:
162
+
163
+ - Serves the pre-built React UI as static files on `/`
164
+ - Exposes a local API on `/api` that reads `.sail/` state from the current
165
+ working directory
166
+
167
+ The server PID is written to `.sail/runtime/ui.json` on start. `sailor ui stop`
168
+ reads that file, sends `SIGTERM` to the server process, and removes the file.
169
+ This means you can start the dashboard in one terminal and stop it from another.
170
+
171
+ ### Running in the background
172
+
173
+ ```bash
174
+ # macOS / Linux
175
+ sailor ui start &
176
+ sailor ui status # ● running http://localhost:3333 (pid 12345)
177
+ sailor ui stop # Stopped Sailor UI (pid 12345).
178
+
179
+ # Windows (PowerShell)
180
+ Start-Job { sailor ui start }
181
+ sailor ui status
182
+ sailor ui stop
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Agent-driven onboarding & custom mandates
188
+
189
+ For chains with a bundled Sail deployment (Base, Base Sepolia, Arbitrum, Unichain), an agent can drive the whole
190
+ setup through a browser **signing station**. The station is a local HTTP +
191
+ WebSocket daemon that bridges the CLI and the owner's wallet: the agent never
192
+ holds the owner key — it pushes signing requests, the owner approves them in the
193
+ browser, and the agent submits the transactions it's allowed to.
194
+
195
+ ```bash
196
+ sailor keys generate # manager (agent) key
197
+ sailor station start & # signing daemon (serves the UI)
198
+ # owner opens the printed URL once and connects their wallet
199
+ sailor owner connect # detect & persist the owner
200
+ sailor scan # discover the owner's Safes + state
201
+ sailor onboard --new-sma # create an SMA + (optionally) attach a mandate
202
+ ```
203
+
204
+ Agents author their own permission contracts and deploy them from the scaffolded
205
+ Foundry workspace (`mandates/`, with `@sail/interfaces/IPermission.sol` vendored
206
+ under `.sail/contracts/`):
207
+
208
+ ```bash
209
+ forge build
210
+ sailor mandate deploy --contract MyMandate \
211
+ --args '["0xPermissionSigner", ["0xTarget"]]' \
212
+ --attach --sma 0xSafe
213
+ ```
214
+
215
+ `deploy` emits a contract-creation signing request (the owner signs it in the
216
+ browser); the deployed address is read from the receipt and tracked in
217
+ `.sail/state/mandates.json`. `attach` reads the signer nonce, has the owner sign
218
+ a `RegisterPermission` EIP-712 message, then the agent submits
219
+ `kernel.registerPermission` with the exact registration fee. Every command takes
220
+ `--json` for headless agent use; set `SAIL_PASSPHRASE` to unlock the manager key
221
+ non-interactively.
222
+
223
+ `sailor mandate sign` reconciles against the live on-chain `getPermissions()` call
224
+ before building the mandate payload — permissions revoked on-chain are excluded even
225
+ if they remain in the local `.sail/state/mandates.json` (which is an append-only
226
+ historical record and is never modified by the reconciliation).
227
+
228
+ ### GitHub Actions CI
229
+
230
+ The scaffolded `.github/workflows/agent-tick.yml` runs `sailor run --once` on a
231
+ cron schedule using `npm ci` (no pnpm required). Setup:
232
+
233
+ 1. `sailor keys export-ci` — copies the encrypted agent wallet to `ci-keystore.json`
234
+ in the project root and allowlists it in `.gitignore`. The geth v3 keystore is
235
+ safe to commit; the raw private key is never exposed.
236
+ 2. Commit `ci-keystore.json`, `.sail/account.json`, and `.sail/mandate.json`.
237
+ 3. Add two repository secrets (Settings → Secrets → Actions):
238
+ - `SAIL_PASSPHRASE` — the passphrase that encrypts the agent wallet
239
+ - `RPC_URL` — your RPC endpoint
240
+
241
+ The workflow copies `ci-keystore.json` to `.sail/keys/manager.json`, then calls
242
+ `npx sailor run --once` with `SAIL_PASSPHRASE` set so the key is unlocked
243
+ non-interactively. No private key ever appears in the workflow file or in secrets.
244
+
245
+ ---
246
+
247
+ ## Packages
248
+
249
+ Sailor ships as a **single npm package** — the SDK is bundled inside it and exposed via a subpath export:
250
+
251
+ | Package | Contents |
252
+ |---|---|
253
+ | `@sail.money/sailor` | CLI binary, UI server, templates, examples, and SDK |
254
+
255
+ The SDK is available as a subpath export for use in agent code:
256
+
257
+ ```ts
258
+ import type { Agent, AgentContext, Dispatch } from '@sail.money/sailor/sdk'
259
+ ```
260
+
261
+ ### npm (`publish-npm.yml`)
262
+
263
+ Published to the public npm registry under the `@sail.money` scope.
264
+
265
+ | Trigger | Package | Version | dist-tag |
266
+ |---|---|---|---|
267
+ | Tag push (`v*`) | `@sail.money/sailor` | `1.0.0` | `latest` |
268
+ | Manual dispatch | `@dev.sail.money/sailor` | `1.0.0-42` | `dev` |
269
+
270
+ ```bash
271
+ npm install @sail.money/sailor # latest stable (tag push)
272
+ ```
273
+
274
+ For dev builds, the package name changes scope to `@dev.sail.money`. Use an alias so your import paths stay the same:
275
+
276
+ ```bash
277
+ npm install "@sail.money/sailor@npm:@dev.sail.money/sailor@dev"
278
+ ```
279
+
280
+ This installs the latest dev build and makes it available as `@sail.money/sailor` locally — `@sail.money/sailor/sdk` imports continue to work unchanged.
281
+
282
+ ### GitHub Packages (`publish.yml`)
283
+
284
+ Published to GitHub Packages under the `@sail-money` scope for internal testing — no public npm registry required.
285
+
286
+ | Trigger | Package | dist-tag |
287
+ |---|---|---|
288
+ | Merge to `main` | `@sail-money/sailor` | `latest` |
289
+ | Manual dispatch | `@sail-money/sailor-dev` | `dev` |
290
+
291
+ Both builds require an alias since the package scope differs from `@sail.money`:
292
+
293
+ ```bash
294
+ npm install "@sail.money/sailor@npm:@sail-money/sailor@latest" --registry https://npm.pkg.github.com
295
+ npm install "@sail.money/sailor@npm:@sail-money/sailor-dev@dev" --registry https://npm.pkg.github.com
296
+ ```
297
+
298
+ Or pin in `package.json`:
299
+
300
+ ```json
301
+ "dependencies": {
302
+ "@sail.money/sailor": "npm:@sail-money/sailor@latest"
303
+ }
304
+ ```
305
+
306
+ ```json
307
+ "dependencies": {
308
+ "@sail.money/sailor": "npm:@sail-money/sailor-dev@dev"
309
+ }
310
+ ```
311
+
312
+ Either way, `@sail.money/sailor/sdk` imports work unchanged.
313
+
314
+ ---
315
+
316
+ ## Architecture
317
+
318
+ ```
319
+ ┌────────────────────┐ ┌────────────────────┐
320
+ │ Permission Signer │ │ Manager/Agent │
321
+ │ MetaMask / local │ │ .sail/keys/manager
322
+ └─────────┬──────────┘ └─────────┬──────────┘
323
+ │ │
324
+ │ EIP-712 mandate │ dispatch
325
+ ▼ ▼
326
+ ┌─────────────────────────────────────────────────────────────────────┐
327
+ │ SailKernel │
328
+ │ (Sail Protocol) │
329
+ └─────────┬───────────────────────┬───────────────────────┬───────────┘
330
+ │ │ │
331
+ registration │ execution │ evaluation
332
+ ▼ ▼ ▼
333
+ ┌────────────────────┐ ┌────────────────────┐ ┌────────────────────┐
334
+ │ MandateFactory │ │ Safe │ │ Permissions │
335
+ │ (register perms) │ │ (custody) │ │ (named, per-call) │
336
+ └────────────────────┘ └────────────────────┘ └────────────────────┘
337
+
338
+ sailor CLI / @sail.money/sailor/sdk drive both signing paths above.
339
+ .sail/ (account · mandate · activity) ──→ sailor-ui (localhost:3333)
340
+ ```
341
+
342
+ The CLI and SDK sit between the operator and SailKernel: they build the EIP-712 payloads, submit dispatches, and read kernel state via viem. The permission signer authorizes the mandate — registration runs through MandateFactory — while the manager key signs each dispatch the kernel evaluates against a named permission before executing it through the Safe. All local state — the deployed account, the signed mandate, and the agent's activity log — lives under `.sail/` on disk, which the dashboard reads through a small local server. Sailor never holds the Owner key and runs no hosted backend; the wallet talks to the chain directly.
343
+
344
+ ---
345
+
346
+ ## Security model
347
+
348
+ - The agent signs dispatches; the kernel evaluates the named permission on every call. A permission returning false or exceeding its gas cap is treated as denial — fail-closed.
349
+ - The Owner key controls the Safe and is never read by Sailor. Mandate signing requires a deliberate action by the permission signer.
350
+ - The manager key is encrypted on disk using geth keystore v3 (scrypt + aes-128-ctr) and is never transmitted.
351
+ - The session can be paused instantly via `sailor session pause` or the dashboard stop button; this does not affect Safe custody.
352
+ - All addresses passed to the CLI are normalized with `getAddress()` (EIP-55 checksum). Mixed-case or lowercase inputs are accepted and canonicalized before any on-chain call or state write.
353
+
354
+ ---
355
+
356
+ ## State of the project
357
+
358
+ Sailor is functional and published as [`@sail.money/sailor`](https://www.npmjs.com/package/@sail.money/sailor) on npm (v0.0.1). The SDK, CLI, keystore, mandate flows, agent runner, and dashboard are implemented and have been exercised end to end against Base Sepolia.
359
+
360
+ The Sail Protocol trusted core is deployed on Base, Base Sepolia, Arbitrum, and Unichain as staging deployments for testing ahead of a formal launch. All four run the selective dispatch model, with verified deployments bundled in `@sail.money/sailor`. These deployments are under an ongoing external audit by [Octane Security](https://octane.security) and are not final — do not use them with funds you are not prepared to lose. Permission templates are not yet deployed against the Base, Arbitrum, and Base Sepolia kernels; **Unichain** ships the full template suite (7 shared + 12 standalone, source-verified) and its template registries are populated. The remaining template registries will be filled in as templates are deployed on the other chains and at mainnet launch.
361
+
362
+ ---
363
+
364
+ ## Deployments
365
+
366
+ The Sail Protocol trusted core is live on the following chains as **staging deployments** ahead of a formal launch. All addresses are bundled in `@sail.money/sailor` and run the selective dispatch model with zero fees. Permission templates are not yet deployed against the Base, Arbitrum, and Base Sepolia kernels; **Unichain** ships the full template suite (7 shared + 12 standalone, source-verified on uniscan.xyz) and has its onboarding allowlists seeded at genesis.
367
+
368
+ ### Base (8453)
369
+
370
+ | Contract | Address |
371
+ |---|---|
372
+ | SailKernel | `0x6319d3dfDDe3804ba93D65752b00c52bFb05a1ab` |
373
+ | SailGovernance | `0x7E897D919872b1587577617ffFC42113679d0C50` |
374
+ | Timelock | `0x8eC3Ca951E193C6E3713A70022454d7A1f083281` |
375
+ | PermissionFactory | `0x7724EACd97C8601d5AC244Aadbf76ad87353Ff31` |
376
+ | StandardFeePolicy | `0x65850a8D5050aeAade68289ff96c4F119a24B82e` |
377
+ | SafeModuleEnabler | `0xC84EdE78f93291A1fab19F51c4c7e938AB302Edf` |
378
+ | Treasury | `0xB01dCE443d052e44b7D13726c0EC9fFB7f5815B6` |
379
+
380
+ ### Arbitrum (42161)
381
+
382
+ | Contract | Address |
383
+ |---|---|
384
+ | SailKernel | `0x2716B12832DED0EF5688519c5Fe069EFc0374E02` |
385
+ | SailGovernance | `0xd6AbB7A1036ADc7958Abffec9Da03450c5a2Ec8e` |
386
+ | Timelock | `0x114CB7110C780f7E3a6093AfE0B52463a569857C` |
387
+ | PermissionFactory | `0x23681A8A4C9819D8EaB37E46B858da6F3c85E683` |
388
+ | StandardFeePolicy | `0xAdfB986D48480bC67a7cF3751d30599161632e0D` |
389
+ | SafeModuleEnabler | `0xabe2a6D03F592BC602cA1dBDCD885ba2493274f9` |
390
+ | Treasury | `0xB01dCE443d052e44b7D13726c0EC9fFB7f5815B6` |
391
+
392
+ ### Base Sepolia (84532)
393
+
394
+ | Contract | Address |
395
+ |---|---|
396
+ | SailKernel | `0xf1D0F4C9893612627409948BAa9d82a01a373799` |
397
+ | SailGovernance | `0xEaD44bC6999E7b00b9b2E11c1660248DC2a30993` |
398
+ | Timelock | `0x97B863e392C9859336788D5Ec454527d33C95B74` |
399
+ | PermissionFactory | `0xdfF6a2272F667cDf78Af4681b9c88A219998db95` |
400
+ | StandardFeePolicy | `0x05570F7973b46Eb9Ed4518422891EFC26BD58b97` |
401
+ | SafeModuleEnabler | `0xB2C2B52d94412e3472C9fb2B52186eA12a935869` |
402
+ | Treasury | `0xB01dCE443d052e44b7D13726c0EC9fFB7f5815B6` |
403
+
404
+ ### Unichain (130)
405
+
406
+ First chain to ship the full permission-template suite (7 shared + 12 standalone, source-verified on [uniscan.xyz](https://uniscan.xyz)). Genesis allowlist bootstrap — onboarding usable without the 48h timelock.
407
+
408
+ | Contract | Address |
409
+ |---|---|
410
+ | SailKernel | `0xD985029960a9B7C2E7E38e102C448b8b8539B156` |
411
+ | SailGovernance | `0xAb5C90ECfF2763f6f20f8E553E3b8778dD9C349A` |
412
+ | Timelock | `0xd44FbBB37f01e235E0EE5386948F216d36D0CEf2` |
413
+ | PermissionFactory | `0x8edDb62Aa49CeB837abf2653be2d93Ad9Fe6777D` |
414
+ | StandardFeePolicy | `0x7bBA8BE3c01c972757aA4a230A00D58aB600A1F1` |
415
+ | SafeModuleEnabler | `0xFE9227A9F2baf704060c604466df354a5A137b9B` |
416
+ | Treasury | `0xB01dCE443d052e44b7D13726c0EC9fFB7f5815B6` |
417
+
418
+ The 19 template addresses are in `packages/sdk/src/deployments.ts` (`knownTemplates` + `standaloneTemplates` for chain 130).
419
+
420
+ ---
421
+
422
+ ## Contributing
423
+
424
+ Sailor and Sail Protocol are separate repositories with separate concerns. Protocol questions — SailKernel internals, permission templates, MandateFactory, fee policies — belong in the [SailProtocol](../SailProtocol) repository. Sailor questions — the SDK, CLI, dashboard, and agent templates — belong here.
425
+
426
+ ---
427
+
428
+ ## License
429
+
430
+ MIT