Skip to content

docs: add strategy quickstart (drift-rebalance pair) - #46

Draft
NicolaBernini wants to merge 1 commit into
mainfrom
docs/strategy-quickstart
Draft

docs: add strategy quickstart (drift-rebalance pair)#46
NicolaBernini wants to merge 1 commit into
mainfrom
docs/strategy-quickstart

Conversation

@NicolaBernini

@NicolaBernini NicolaBernini commented May 20, 2026

Copy link
Copy Markdown

Summary

  • Add operate/strategy/quickstart.mdx — the first hand-authored page in the Strategy Docs redesign IA. A curator landing on it can copy-paste a valid strategy JSON and POST it to the Strategy API on the first try.
  • Add Strategy Authoring group to docs.json navigation under the Operate tab so the page is discoverable.
  • Demonstrates a single-source drift-trigger rebalance pair (deposit + withdraw halves around a 7.5% reserve target). No indicators, no conviction tuning — those land in the Cookbook and Conviction pages.

First deliverable of the redesign plan (Heptabase: "Superform - Strategy Docs Plan - 19 May 2026"; Vik ask, 18 May 2026).

Companion engine PR

superform-xyz/superman-strategy branch docs/strategy-quickstart here
https://github.com/superform-xyz/superman-strategy/pull/50

— adds testdata/cookbook/drift_rebalance_{deposit,withdraw}.json (the two JSON payloads embedded in this page) plus internal/rule/cookbook_test.go which CI-validates them against the live StrategyValidator. The two PRs must merge together so the JSON-in-docs stays in lockstep with the engine.

Notes for review

  • Path is operate/strategy/, not curate/strategy/ as originally specced. Vik's curate/operate/ rename (commit 59c0144, 2026-05-19) landed before this work; followed the rename and updated all in-page links accordingly. Happy to migrate to a different parent if the layered IA wants its own section.
  • Drift-trigger logic was flipped vs the task brief. Brief said "below 5% → deposit, above 10% → withdraw"; this page implements "above 10% → DEPOSIT excess idle; below 5% → WITHDRAW to refill toward 7.5%", which is canonical buffer-rebalance semantics. Depositing when the reserve is already low would push it lower, not correct it.
  • Trigger expressions use multiplicative form (vault_free_assets > 0.10 * vault_tvl) because the validator dry-runs every expression against a zero-valued EvalSnapshot and rejects / vault_tvl with division by zero. The page calls this out as a <Warning> block — it's a real first-time-curator gotcha worth teaching.
  • Three links target future pages that don't exist yet — /operate/strategy/action-config, /operate/strategy/troubleshooting, /operate/strategy/cookbook, /operate/strategy/conviction. They're stubs in the layered-IA roadmap; expected to 404 until those pages land in follow-up PRs.

Frontmatter

Includes the agent-friendly fields (agent_intent, strategy_json, applicability) that the future llms.md CI assembly step will consume.

Test plan

  • mintlify dev (or mintlify build) renders the page cleanly — I could not verify locally (no mintlify CLI on the author machine). Please confirm in preview before merge.
  • Nav shows "Strategy Authoring → Strategy Quickstart" under the Operate tab.
  • Both JSON code blocks copy cleanly and round-trip through jq.
  • Curl examples are sane (auth header, content type, base URL https://strategy.superform.xyz).
  • Reviewer confirms the inverted-logic call matches intended buffer-rebalance semantics.

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an initial Strategy Docs “quickstart” page under Operate to help curators/operators author and POST a valid drift-trigger rebalance strategy pair (deposit + withdrawal) into the Strategy Engine, and wires the page into the docs navigation.

Changes:

  • Added operate/strategy/quickstart.mdx with end-to-end guidance and two copy/paste JSON payloads (deposit/withdraw pair).
  • Updated docs.json to introduce a “Strategy Authoring” nav group under the Operate tab linking to the new page.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
operate/strategy/quickstart.mdx New quickstart guide for authoring and posting a drift-trigger rebalance strategy pair.
docs.json Adds “Strategy Authoring” navigation group so the new page is discoverable under Operate.
Comments suppressed due to low confidence (1)

operate/strategy/quickstart.mdx:162

  • This curl example also uses $SUPERFORM_JWT; for consistency with the rest of the Operate docs (which use SUPERFORMOS_JWT), consider updating the env var name here as well.
```bash
curl -X PATCH https://strategy.superform.xyz/api/v1/strategies/{strategy_id}/state \
  -H "Authorization: Bearer $SUPERFORM_JWT" \
  -H "Content-Type: application/json" \
  --data '{"target_state": "RUNNING", "version": 1}'
</details>



---

💡 <a href="/superform-xyz/docs/new/main?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.

@@ -0,0 +1,177 @@
---
title: "Strategy Quickstart"
description: "Author and POST your first Superman strategy in 10 minutes."
`vault_free_assets` is sourced live from chain as `IERC20(asset).balanceOf(strategy)` through the EVM RPC datafeed, so the trigger reflects the strategy contract's actual idle balance. `vault_tvl` is derived from yield-source allocations on the subgraph cadence. Both are in the underlying asset's base units.

<Warning>
**Avoid division in trigger expressions.** The validator dry-runs every expression against an empty `EvalSnapshot` (all zeros) to catch type errors. `vault_free_assets / vault_tvl > 0.10` would fail with `division by zero` at `POST /strategies` time, even though it's semantically equivalent. Use the multiplicative form `vault_free_assets > 0.10 * vault_tvl` instead.

Both are positive whenever their trigger fires. A `size_expr` that evaluates to ≤ 0 at runtime is dropped before reaching the OMS.

Indicators (SMA, RSI, MACD, etc.) and conviction tuning (graded confidence, dead bands) are out of scope here — they live in the [Cookbook](/operate/strategy/cookbook) and [Conviction](/operate/strategy/conviction) pages.
Comment on lines +148 to +152
```bash
curl -X POST https://strategy.superform.xyz/api/v1/strategies \
-H "Authorization: Bearer $SUPERFORM_JWT" \
-H "Content-Type: application/json" \
--data @deposit.json

## Common rejections

The validator runs at `POST` and `PUT` time only. Most first-time rejections fall into a handful of buckets — unknown identifier, division-by-zero in a dry-run, missing `objective`, non-hex address. The full list with example error strings is on the [Troubleshooting](/operate/strategy/troubleshooting) page.
@mintlify

mintlify Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
superform-docs 🟢 Ready View Preview May 20, 2026, 6:56 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants