@hypelens/hypelens-agent-guard
v0.1.18
Published
Hard stops + trailing stops + smart portfolio stops for Polymarket (PM has no native stops). Hard stop % / trailing stop % / daily loss / max exposure / portfolio kill (flatten all) from chain truth outside the LLM. Smart stops = trailing + portfolio kill
Maintainers
Keywords
Readme
@hypelens/hypelens-agent-guard
Hard stops + trailing stops + smart portfolio stops for Polymarket — PM has no native stops.
Pairs with @hypelens/polymarket-place. Prefer one-install: clawhub install pm-desk.
Polymarket will not stop you out. This sidecar enforces hard stop %, trailing stop %, and smart portfolio stops (trailing + portfolio kill / flatten-all + daily loss / max exposure from chain-truth positions) outside the LLM — Data API / clearinghouse truth, not SOUL.md, not cron prompts. Across ALL positions (PM + Hyperliquid). Other agents read the trust heartbeat before sizing.
Smart stops ≠ TWAP/VWAP/grid. Smart stops = trailing + portfolio kill + daily/max exposure from chain state.
Who it’s for
Funded OpenClaw operators on Polymarket + Hyperliquid who need real stops because exits still live in the trading model. Competitors wrap place; this ships hard / trailing / portfolio stops + machine-readable heartbeat outside the LLM.
Place → Guard (required next step)
# One-command if missing (after polymarket-place / any place skill)
clawhub install agent-guard && npx @hypelens/hypelens-agent-guard setup --wallet 0xYourFundedPmProxy
# wires MCP + writes policy + systemd/cron watcher hints
# Or both tools: clawhub install pm-desk && cd skills/pm-desk/scripts && npm install && node setup.mjs --wallet 0x…Or ClawHub:
clawhub install agent-guard
cd skills/agent-guard/scripts && npm install
npx @hypelens/hypelens-agent-guard setup --wallet 0xYourFundedPmProxyThen: start watcher. Setup auto-arms dry-run stops — call heartbeat before size. Live: EXIT_PK + exits.dryRun:false. Entries stay on polymarket-place; stops are this package.
NautilusTrader process sidecar (zero Nautilus PR)
Nautilus hard-codes its own builderCode on entries. Run this watcher beside the live node on the same funder so protective SELLs stamp Zac builderCode:
npx @hypelens/[email protected] setup --wallet 0xYourFunder
npx @hypelens/[email protected] watcher
# live: AGENT_GUARD_EXIT_PK + exits.dryRun:falseExact-slug: clawhub install polymarket-stops. Full recipe: docs/NAUTILUS-SIDECAR.md.
Fee (honest — do not invent)
| Path | Collects fees NOW? |
|---|---|
| Default dry-run (auto-armed on setup) | $0 (safe) |
| HL protective / place FILLED via builder 0x9548… @ 1bp | YES — NOW (never trade that wallet) |
| PM place + protective SELL with baked builderCode | Attributed now; $0 builder fee until rates >0 (LIVE still 0/0; pending maker ~0.5% ~13 Sep; taker 1% after cooldown ~19–20 Sep) |
Live arm (dryRun: false + EXIT_PK) = fee-on-protection when rates/fills pay. No SaaS.
Bots: see BOT.md (5 lines).
One-command setup
npx @hypelens/hypelens-agent-guard setup --wallet 0xYourFundedPmProxyWhat it does (OpenBroker-style):
- Wires MCP into OpenClaw / Claude / Cursor when configs exist
- Writes
config/policy.yamlfrom the example - Drops
state/agent-guard.service+state/agent-guard.cronwatcher hints - Auto-arms dry-run stops when
--walletset; prints next: watcher → heartbeat → (optional) live exits
npx @hypelens/hypelens-agent-guard watcher # continuous enforce + heartbeat
npx @hypelens/hypelens-agent-guard # MCP (default)MCP tools (obvious names)
| Tool | Purpose |
|---|---|
| stop | Hard-stop floors + armed/dryRun |
| trailing | Trailing-stop floors + peaks |
| portfolio | Smart portfolio stops (daily/max/hard + flatten-all) |
| heartbeat | Trust heartbeat — read before sizing |
| guard_status / guard_positions / guard_tick | Compat / discovery / one-shot enforce |
| guard_arm / guard_disarm | Arm (setup already auto-arms dry-run); disarm needs confirm:true + confirmDisarm:"DISARM" |
| guard_set_policy | Tighten overlay only (cannot loosen YAML) |
| guard_heartbeat | Alias of heartbeat |
HARD rules
- Never trade/farm
0x9548B8E9554a1968843B3C380431b10996247c88(HL builder attribution @1bp only) - No place/entry tools
- Multi-venue one policy: PM + Hyperliquid under the same floors + portfolio kill
- Positions never from agent memory
- Live arm = fee-on-protection (PM builderCode + HL 0x9548@1bp on protective fills)
- Trust heartbeat schema: see
docs/HEARTBEAT.md
Tests
npm testLicense
MIT
