[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-75496":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":29,"discoverSource":30},75496,"hunch-it","Omnis-Labs\u002Fhunch-it","Omnis-Labs","Hunch it is your personal AI trading desk for tokenized stocks and crypto on Solana. As you review, skip, and execute trades, you unlock new AI trading agents, level up their capabilities, and receive increasingly personalized trade proposals with one-tap execution and built-in TP\u002FSL.","",null,"TypeScript",104,8,1,23,0,2,31,6,2.86,"GNU Affero General Public License v3.0",false,"main",true,[],"2026-06-12 02:03:34","# Hunch It\n\n[![License: AGPL-3.0](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-AGPL--3.0-blue.svg)](LICENSE)\n\nMandate-driven AI trading proposals for xStocks and crypto on Solana.\n\nUsers define a simple investment mandate, receive AI-assisted BUY proposals for xStocks, tokenized ETFs, and crypto assets, then either **tap to execute** when the price reaches the trigger or opt into **Auto-execute triggers**. The server-side `PositionLifecycle` module owns every state transition, automatically arms take-profit and stop-loss orders after entry, and runs the OCO close + sibling cancellation when an exit fires.\n\n> The execution model is **synthetic-trigger first**. Approve writes DB-only synthetic Orders; `apps\u002Fws-server` watches Pyth. If the user's Privy wallet is delegated, ws-server executes the same Jupiter Ultra swap and emits `trade:filled` (ADR-0003). Otherwise it emits `trigger:hit` and the user signs after tapping Execute (ADR-0001). No external trigger API is part of the runtime.\n\n> Hunch It is experimental software and not financial advice. Use small real-fund test amounts only if you understand the risks.\n\n## What It Does\n\n- Turns market movement into clear BUY proposals tailored to a user's mandate and portfolio\n- Explains each proposal with: what changed, why this trade, and why it fits the mandate\n- Lets users adjust size, trigger price, take-profit, and stop-loss before placing an order\n- Tracks BUY orders, active positions, open TP\u002FSL orders, and portfolio state\n- Uses automatic TP\u002FSL placement after entry, with one-cancels-other behavior when an exit fills\n- Offers optional Auto-execute triggers through Privy wallet v2 signer access, which remains non-custodial and revocable from Settings\n\n## How It Works\n\n```text\nLogin → Mandate setup → Desk → Review BUY proposal → Approve (DB-only Order)\n  → ws-server detects price hit\n    → delegated path: Auto-execute triggers fills through Jupiter Ultra → trade:filled\n    → fallback path: toast → tap Execute (Jupiter Ultra swap)\n  → Position ACTIVE + TP\u002FSL Orders armed atomically\n  → Either auto-execute\u002Ftap TP\u002FSL, or tap Close to exit; sibling exit Order\n    cancelled in the same transaction; realized P&L recorded.\n```\n\nThe app is built around proposals, not a manual trading terminal. All trade-state transitions go through `packages\u002Fdb\u002Fsrc\u002Flifecycle\u002Fposition-lifecycle.ts` so race conditions and partial fills can't leak. See `docs\u002Fadr\u002F0001-frozen-synthetic-trigger-architecture.md`, `docs\u002Fadr\u002F0003-opt-in-delegated-execution.md`, and `docs\u002Fmanual-test-core.md` for the execution model and click-through DoD.\n\n## Current Scope\n\n- **Base currency:** USDC on Solana\n- **Supported assets:** Jupiter-listed xStocks\u002Ftokenized ETFs plus `wBTC`, `ETH`, `BNB`, `wXRP`, `TRX`, and `HYPE`; `SOL` is treated as wallet fee balance, not a proposal asset\n- **Wallet:** Privy auth with embedded Solana wallet support\n- **Execution:** synthetic-trigger Orders (DB-only) + Jupiter Ultra swap. Trigger fills are client-signed when the user taps Execute, or server-signed through opt-in Privy wallet v2 signer access when Auto-execute triggers is enabled. The shared `@hunch-it\u002Fexecution` package owns delegated trigger execution; the server-side `PositionLifecycle` settles every fill atomically and uses `Order.txSignature @unique` for idempotent replay.\n- **Data:** Pyth live prices (ws-server poll loop) + Pyth historical bars, PostgreSQL via Prisma\n- **Signal engine:** standalone `ws-server` process. Default runtime starts the required `trigger-monitor`; `ENABLE_SIGNAL_LOOP`, `ENABLE_BACK_EVAL`, and `ENABLE_THESIS_MONITOR` are opt-in.\n\nSee [docs\u002Fproduct-overview.md](docs\u002Fproduct-overview.md) for the full product scope.\n\n## Quick Start\n\n### Prerequisites\n\n- **Node.js ≥ 20** and **pnpm ≥ 9** (`corepack enable` recommended)\n- A container runtime — **[OrbStack](https:\u002F\u002Forbstack.dev) is recommended on macOS** (lighter, faster boot than Docker Desktop). Docker Desktop, Colima, or any Docker-compatible engine also works.\n  ```bash\n  brew install orbstack   # one-line install on macOS\n  ```\n\n### Setup (once)\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FOmnis-Labs\u002Fhunch-it.git\ncd hunch-it\ncorepack enable\npnpm install\ncp .env.example .env\npnpm db:push      # push the Prisma schema to the (still empty) docker postgres volume\n```\n\nEdit only the root `.env`; `pnpm dev` and `pnpm start` sync it into `apps\u002Fweb\u002F.env` and `apps\u002Fws-server\u002F.env` before booting.\n\n> **Need deterministic local testing?** Set `ENABLE_DEV_TOOLS=true`, run web + ws-server, then open `\u002Fdev-tools`. The page is password-gated, creates real `[DEV_TOOLS]` proposals, persists real DB orders, can force synthetic trigger behavior for owned dev orders, and includes delegated Ultra swap diagnostics.\n\n### Run — pick one\n\n**A. Full Docker** — runs web + ws-server + postgres as containers. Best for an end-to-end smoke test. Slow first build (~10 min cold), fast after that.\n\n```bash\ndocker compose up --build -d\ndocker compose down            # to stop\n```\n\n**B. `pnpm dev` with hot reload** _(recommended for coding)_ — postgres runs in Docker, apps run on the host with hot reload. `pnpm dev` boots your container runtime, brings postgres up, and runs `prisma generate` for you.\n\n```bash\npnpm dev                       # syncs .env → auto-starts OrbStack\u002FDocker → postgres → prisma generate → web + ws-server\n# Stop: Ctrl+C, then `pnpm db:down` if you also want to stop postgres\n```\n\n`pnpm dev` prefers OrbStack (`orb start`) on macOS and falls back to Docker Desktop if OrbStack isn't installed. On Linux it expects the docker daemon to already be running.\n\n### Open\n\n- Web UI: http:\u002F\u002Flocalhost:3000\n- ws-server: http:\u002F\u002Flocalhost:4000 (`\u002Fhealthz` for a liveness check)\n\nFor the full env reference, live trading setup, and `\u002Fdev-tools` testing flow, see [docs\u002Fgetting-started.md](docs\u002Fgetting-started.md). If something breaks, see [docs\u002Ftroubleshooting.md](docs\u002Ftroubleshooting.md).\n\n## Repo Structure\n\n```text\nhunch-it\u002F\n├── apps\u002F\n│   ├── web\u002F           # Next.js 15 PWA frontend + REST API routes\n│   └── ws-server\u002F     # Signal Engine, Socket.IO, synthetic order monitoring\n└── packages\u002F\n    ├── shared\u002F        # Zod schemas, asset registry, shared types\n    └── config\u002F        # Shared TypeScript config\n```\n\n## Scripts\n\n| Command                  | Description                                                                               |\n| ------------------------ | ----------------------------------------------------------------------------------------- |\n| `pnpm dev`               | Sync root `.env`, auto-start docker postgres, generate Prisma client, run web + ws-server |\n| `pnpm dev:no-db`         | Same as `pnpm dev` but skip the postgres preflight (manage db yourself)                   |\n| `pnpm dev:web`           | Run the Next.js app only                                                                  |\n| `pnpm dev:ws`            | Run the ws-server only                                                                    |\n| `pnpm build`             | Build all workspaces                                                                      |\n| `pnpm typecheck`         | Type-check all workspaces                                                                 |\n| `pnpm db:up`             | Run the postgres preflight only (start container, wait healthy)                           |\n| `pnpm db:down`           | `docker compose down` — stop postgres (and any compose services up)                       |\n| `pnpm db:generate`       | Generate the Prisma client                                                                |\n| `pnpm db:push`           | Push the Prisma schema to the database                                                    |\n| `pnpm db:migrate`        | `prisma migrate dev` (interactive, creates a new migration)                               |\n| `pnpm db:migrate:deploy` | `prisma migrate deploy` (apply existing migrations, for prod-like flows)                  |\n| `pnpm db:studio`         | Open Prisma Studio                                                                        |\n\n## Documentation\n\n| Doc                                                                | What it covers                                                              |\n| ------------------------------------------------------------------ | --------------------------------------------------------------------------- |\n| [ADR-0001](docs\u002Fadr\u002F0001-frozen-synthetic-trigger-architecture.md) | Architecture freeze: synthetic-trigger \u002F tap-to-execute fallback model      |\n| [ADR-0002](docs\u002Fadr\u002F0002-canonical-asset-signal-data.md)           | Canonical asset ids, xStock\u002Fcrypto signal data, freshness rule              |\n| [ADR-0003](docs\u002Fadr\u002F0003-opt-in-delegated-execution.md)            | Opt-in Auto-execute triggers through Privy wallet v2 signer access          |\n| [CONTEXT.md](CONTEXT.md)                                           | Domain glossary used by reviews + future ADRs                               |\n| [Manual test core](docs\u002Fmanual-test-core.md)                       | 10-step click-through that defines \"the system works\"                       |\n| [Product Overview](docs\u002Fproduct-overview.md)                       | Product promise, scope, supported assets                                    |\n| [Getting Started](docs\u002Fgetting-started.md)                         | Local setup, `\u002Fdev-tools`, live setup, development commands                 |\n| [Architecture](docs\u002Farchitecture.md)                               | Monorepo layout, infrastructure, realtime design                            |\n| [Screens & Flows](docs\u002Fscreens-and-flows.md)                       | Main screens, user flows, state and error handling                          |\n| [Signal Engine](docs\u002Fsignal-engine.md)                             | Base market analysis, proposal fan-out, trigger monitoring, back-evaluation |\n| [API Contract](docs\u002Fapi-contract.md)                               | REST endpoints, WebSocket events, Jupiter Ultra swap flows                  |\n| [Data Model](docs\u002Fdata-model.md)                                   | Prisma models, enums, JSON fields, asset registry                           |\n| [Troubleshooting](docs\u002Ftroubleshooting.md)                         | Common local setup and runtime issues                                       |\n\n## Contributing\n\nThis is an early project, so contributions are intentionally lightweight: keep changes focused, match the existing style, and update docs when behavior changes.\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for the basics.\n\n## License\n\n[AGPL-3.0](LICENSE)\n","Hunch It 是一个基于Solana的个人AI交易平台，专注于代币化股票和加密货币。其核心功能包括根据用户定义的投资策略生成个性化的AI交易建议，并支持一键执行与内置的止盈止损设置。技术上，它使用TypeScript开发，采用合成触发器机制处理订单，通过Jupiter Ultra进行交换操作，确保交易安全高效。此外，用户可以选择自动执行触发器来实现更便捷的交易体验。该项目适用于希望利用AI辅助决策、简化交易流程并对Solana生态系统感兴趣的投资者。","2026-06-11 03:52:56","CREATED_QUERY"]