# Flows CLI — `@lit-protocol/flows`

Deploy code that **moves your money** across DeFi + CEX, governed by a **policy
that can refuse**. Built on [Lit Protocol](https://litprotocol.com); live at
[flows.litprotocol.com](https://flows.litprotocol.com).

The code you deploy is a **proposer**: it computes the move it wants and never
signs. A certified executor acts on the judged intent only after the policy gate
— running in Lit's TEE — allows it. The gate can **allow**, **hold** (wait for a
human), or **deny**; a deny is absolute, and every move (and refusal) leaves a
signed receipt.

## Try it in under a minute — no account needed

```bash
npm install -g @lit-protocol/flows

flows init                    # scaffolds cex-limit.js + manifest + sample params
flows deploy cex-limit.js --local   # runs the real policy gate on your machine
```

`--local` runs the exact production gate in-process — no login, no backend,
nothing signed — and prints the verdict with the budget math:

```
Policy verdict: ALLOW
  • $46000.00 of $50000.00 remains today after this run
```

Run `flows init --list` to see all templates (rebalance, dca, stop-loss,
yield-enter, contract-call).

## Deploy for real

```bash
flows login                        # opens your browser to sign in (--key <api_key> for CI)
flows deploy cex-limit.js --wallet <venueConnectionId>
```

New installs start in **dry-run** — they tick on their schedule and simulate the
gate verdict without moving funds. An org admin then promotes to live
(`flows automations promote <id>`), and the gate keeps refusing out-of-policy
moves either way.

## Commands

| Command | What it does |
|---------|--------------|
| `flows login` | Sign in via the browser; `--key` for headless/CI ([create a key](https://flows.litprotocol.com/dashboard/api-keys)) |
| `flows init [template]` | Scaffold a runnable fund action + manifest + sample params |
| `flows deploy <file>` | Dry-run against your policy, then install (`--local` = no login, in-process gate) |
| `flows action check <file>` | Judge one candidate move against a policy/grant, no install |
| `flows venues connect\|connect-onchain\|list` | Connect a CEX (Binance, Coinbase…) or on-chain wallet |
| `flows portfolio` | Unified attested portfolio across connected venues |
| `flows automations templates\|install\|tick\|request-grant\|status\|promote\|logs` | Certified automations: install → dry-run → promote |
| `flows policy show\|presets\|apply\|edit` | Your org policy — the law every move is judged against |
| `flows approvals list\|release` | Held moves awaiting a person (release requires being the assigned approver) |
| `flows executor publish\|packet\|approve` | Custom signing executors, owner-approved by exact CID |
| `flows registry inspect <cid>` | Inspect a CID in the on-chain action registry |
| `flows secrets set\|list\|delete` | Per-action encrypted secrets |
| `flows rebalance dry-run` | Preview a CeFi ↔ DeFi rebalance (two legs, one gate) |

## Drive it from an agent

- **MCP**: point Claude / Cursor / Codex at `https://flows.litprotocol.com/mcp`
  with `Authorization: Bearer flows_YOUR_KEY` — setup per client in the
  [MCP docs](https://flows.litprotocol.com/docs/#mcp).
- **Text-first docs for LLMs**: [`llms.txt`](https://flows.litprotocol.com/llms.txt)
  / [`llms-full.txt`](https://flows.litprotocol.com/llms-full.txt).
- **OpenAPI**: `https://flows.litprotocol.com/api/docs/openapi.json`.

## Docs

- [Full documentation](https://flows.litprotocol.com/docs) — quickstart, wallet,
  automations, policy, tutorial
- [Manifest / verb / policy references](https://github.com/LIT-Protocol/flows/tree/main/docs)
- [Source](https://github.com/LIT-Protocol/flows) — open source, MIT

## License

MIT
