From 6692bdb490d6a4e45199e1b4cdbf29c53a88f4ca Mon Sep 17 00:00:00 2001 From: rob thijssen Date: Tue, 10 Mar 2026 12:24:57 +0200 Subject: [PATCH] Prompt: fix method vs kind confusion causing 11/15 validation failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 12:11:39 run shows the model using {"method":"position_quantity"} for every sell rule despite the existing CRITICAL note. Root cause: a contradictory anti-pattern ("Never use an expression object for quantity") was fighting the correct guidance, and the method/kind distinction wasn't emphatic enough. - Expand the CRITICAL note to explicitly contrast: buy uses SizingMethod ("method"), sell uses Expr ("kind") — they are different object types. - Remove the contradictory "never use an expression object" anti-pattern which conflicted with position_quantity and SizingMethod objects. - Add a final anti-pattern bullet as a second reminder of the same mistake. Co-Authored-By: Claude Sonnet 4.6 --- src/prompts.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/prompts.rs b/src/prompts.rs index c4fde39..01c94c9 100644 --- a/src/prompts.rs +++ b/src/prompts.rs @@ -110,10 +110,13 @@ Buy a fixed number of base units (semantic alias for a decimal string): Alternatively, `"9999"` works for exits: sell quantities are automatically capped to the open position size, so a large fixed number is equivalent to `position_quantity`. -CRITICAL mistakes to never make: -- `{{"method":"position_quantity"}}` is WRONG — `position_quantity` is an Expr, not a SizingMethod. - CORRECT: `{{"kind":"position_quantity"}}`. The `"method"` field belongs ONLY to the three - declarative sizing objects (`fixed_sum`, `percent_of_balance`, `fixed_units`). +CRITICAL — the `"method"` vs `"kind"` distinction: +- `"method"` belongs ONLY to the three declarative sizing objects: `fixed_sum`, `percent_of_balance`, `fixed_units`. +- `"kind"` belongs to Expr objects: `position_quantity`, `bin_op`, `func`, `field`, `literal`, etc. +- `{{"method":"position_quantity"}}` is ALWAYS WRONG. It will be rejected every time. + CORRECT: `{{"kind":"position_quantity"}}`. +- If you used `{{"method":"percent_of_balance",...}}` for the buy, use `{{"kind":"position_quantity"}}` for the sell. + These are different object types — buy uses a SizingMethod (`method`), sell uses an Expr (`kind`). - `{{"method":"fixed_sum","amount":"100","multiplier":"2.0"}}` is WRONG — `fixed_sum` has no `multiplier` field. Only `amount` is accepted alongside `method`. - NEVER add extra fields to SizingMethod objects — they use `additionalProperties: false`. @@ -483,8 +486,8 @@ CRITICAL: `apply_func` uses `"input"`, not `"expr"`. Writing `"expr":` will be r - Don't ignore fees — a strategy needs to overcome 0.1% per round trip - Always gate buy rules with position state "flat" and sell rules with "long" - Never add a short-entry (sell when flat) rule — spot markets are long-only -- Never use an expression object for `quantity` — it must always be a plain decimal string like `"0.01"` -- Never use a placeholder string for `quantity` — `"ATR_SIZED"`, `"FULL_BALANCE"`, `"dynamic"`, etc. are all invalid and will be rejected. Use `"0.01"` or similar. +- Never use a placeholder string for `quantity` — `"ATR_SIZED"`, `"FULL_BALANCE"`, `"dynamic"`, etc. are all invalid and will be rejected. +- `{{"method":"position_quantity"}}` is WRONG for exit rules — use `{{"kind":"position_quantity"}}` (see Quantity section above). "## ) }