docs(conditions): Add LLM-friendly authoring resources#12
docs(conditions): Add LLM-friendly authoring resources#12
Conversation
Adds six new pages under conditions/ aimed at developers (and their LLMs) authoring conditions hands-off: - building-with-llms: workflow, prompt template, iteration loop - cookbook: 22 worked JSON examples covering every condition type - discord-tipping-bot-deep-dive: annotated walkthrough of a complex Action Control condition (addresses anonymised) - context-variables: cheatsheet of built-ins, naming rules, gotchas - validating-conditions: 40-line script + usage - troubleshooting: common Zod errors mapped to fixes Schema reference is linked directly to taco-web signing-epic so it stays the source of truth without drift. README and SUMMARY updated to surface the new pages.
Drop "most complex/intricate" language and "TACo supports today" phrasing from the deep-dive and cookbook. Conditions are arbitrarily expressive; the example is illustrative, not a ceiling.
Cookbook examples are now copy-paste runnable through
validate-conditions.ts, which expects the full
{ "version": "1.0.0", "condition": {...} } shape that
ConditionExpression.fromObj parses.
Also drop a stray Collab.Land reference in example 12.
Adds links and integration snippets for the JSON Schema variant of the condition schema (sibling to condition-schemas.md), which lands in nucypher/taco-web#772. Covers three integration points: - Editor inline validation via $schema in conditions.json - LLM structured output via tool input_schema - Standalone validation in any language via ajv / jsonschema / etc. building-with-llms gains a JSON Schema integration section. validating-conditions clarifies when to use JSON Schema vs the TypeScript script. README and cookbook pick up shorter pointer notes.
|
|
||
| ## Source | ||
|
|
||
| A reference copy of this script lives in [`discord-taco-web/scripts/validate-conditions.ts`](https://github.com/nucypher/discord-taco-web/blob/main/scripts/validate-conditions.ts) and is used by the Discord tipping bot integration in CI. |
There was a problem hiding this comment.
Is this URL correct? Is this script actually available somewhere in signing-epic or main?
There was a problem hiding this comment.
yeah that should be on theref repo, my bad. the script is doing anything fancy https://github.com/theref/discord-taco-web/blob/main/scripts/validate-conditions.ts
There was a problem hiding this comment.
If the script is tested and works well, you can add it to the nucypher/taco-web repos.
There was a problem hiding this comment.
Once this URL is fixed, I can approve.
cygnusv
left a comment
There was a problem hiding this comment.
Great work! My only comment is that my agent friend thought that information is scattered through several files. I created a single skill file that summarizes the process and references these new additions to the docs, although I'm not sure what's the best place to share this.
There was a problem hiding this comment.
Nice work
- Important comment about
"then": truenot being valid for anifThenElseCondition. - Not in this PR, but we'll need a follow-up PR down the road to update the URLs that use the
signing-epicbranch to point tomainoncesigning-epicgets merged and released.
|
|
||
| ## 13. `SigningObjectAttributeCondition` — UserOperation field check | ||
|
|
||
| Used in TACo Action Control. Validate that an attribute on the object being signed (e.g. an ERC-4337 `UserOperation`) matches an expected value. |
| - Whether the JSON API endpoint will return data in the shape your JSONPath expects | ||
| - Whether the user will satisfy the condition at decryption time | ||
|
|
||
| For end-to-end testing, use the [TACo Playground](https://playground.taco.build/) or a local testnet (see [Quickstart](../../../access-control/quickstart-testnet.md)). |
There was a problem hiding this comment.
I don't think the TACo playground is up to date. Not sure our plan here. I guess validation as part of the playground is simpler to update than allowing creation of conditions...?
- Cookbook §18 and §21: replace invalid `"thenCondition": true` with real conditions. Only `elseCondition` accepts a boolean in the if-then-else schema. - Cookbook §19: fix NFT-or-allowlist example — replace the broken `eth_getBalance` + `"comparator": "in"` against an address list with a `ContextVariableCondition` on `:userAddress` (the shape `AddressAllowlistCondition` wraps internally). - Cookbook §9 (Solana JsonRpcCondition): hard-code the account address instead of accepting it via `:solanaAddress`. Added a note on when an authenticated channel would be the right pattern. - Cookbook §11 / §12: note that `:jwtToken`, `:message`, and `:signature` are default names that can be renamed — important when a single condition has multiple Jwt/Ecdsa children. - Cookbook §12: retitle as "verify an ECDSA signature" and clarify that `":timestamp:discordPayload"` is a concatenation of two context variables. - Cookbook §13 / §14 / TOC: mark signing-* entries as TACo Action Control only. - Update nesting limit across cookbook §16, building-with-llms prompt template, validating-conditions catch-list, and troubleshooting: 4 levels, counted collectively across CompoundCondition, IfThenElseCondition, and SequentialCondition (per nucypher/nucypher#3683 and taco-web 32f3673). - context-variables: restructure the built-in table to distinguish auto-populated (`:signingConditionObject` only), reserved (`:userAddress`, provided by AuthProvider at request time), and default names (`:message`, `:signature`, `:jwtToken`, which can be overridden). - building-with-llms: reference the JSON Schema export as the primary machine-readable source of truth in the LLM prompt template, with the markdown version alongside. - validating-conditions: fix the script source URL to point at theref/discord-taco-web (where it actually lives) with a note that the link will move once promoted into nucypher/taco-web. - Drop TACo Playground references across validating-conditions, troubleshooting, and building-with-llms — the playground is not currently up to date with signing-epic features. Point readers at the local testnet Quickstart instead.
|
Opened nucypher/taco-web#775 to track updating docs and skill file when signing epic is merged |
Source-verification against taco-web signing-epic surfaced two inaccuracies in the previous commit's context-variables table: - `:nullAddress` is also auto-injected by the node (see `AUTOMATICALLY_INJECTED_CONTEXT_PARAMS` in `taco-web/packages/taco/src/conditions/context/context.ts`) — the previous table claimed `:signingConditionObject` was the only auto-populated variable. Added `:nullAddress` as a row. - Attribution: auto-injection happens on the node side at evaluation time, not by a client-side "signing flow". Reworded accordingly and linked the source file as the authority for future drift.
|
|
||
| ## 18. `IfThenElseCondition` — branching | ||
|
|
||
| `ifCondition` and `thenCondition` must both be full conditions — they cannot be booleans. Only `elseCondition` accepts a boolean shortcut (`true` means "admit", `false` means "deny"). If you want the "then" branch to pass unconditionally, use a `ContextVariableCondition` against a variable known to be true, or simply re-use the `ifCondition` verbatim. |
There was a problem hiding this comment.
I think in general if you are hoping to encompass logic that looks like:
if conditionA then return True
else some other conditionB
Then this is just an OR condition i.e. OR(conditionA, conditionB)
Alternatively if were doing something like
if conditionA then return False
else some other conditionB
Then this is just AND(NOT(conditionA), conditionB)
If you want the "then" branch to pass unconditionally, use a
ContextVariableConditionagainst a variable known to be true, or simply re-use theifConditionverbatim.
^ In other words, not so sure about this statement and feels like it can be removed. If the then condition is intended to be a boolean then just use a compound condition, OR or AND appropriately. No need to have an artificial then condition to pass / fail.
| ## 21. Pattern: weather-based discount with fallback | ||
|
|
||
| If the weather API returns rain, anyone can decrypt; otherwise, only NFT holders. | ||
| If the weather API returns rain, anyone can decrypt; otherwise, only NFT holders. `thenCondition` must be a real condition, so we re-use the rain check as a tautological pass (it already evaluated to true in the `ifCondition` branch). |
There was a problem hiding this comment.
Same comment as above about artificial then condition.
We can rethink the example to be: eg. a backup safety plan for attendees maybe? i.e. if there is rain, then check if wind speed > y, and if both are true anyone can decrypt, otherwise only NFT holders.
Summary
TACo conditions are becoming the primary integration surface, and adopters increasingly author them with LLM assistance. This PR adds six new pages under
for-developers/taco-sdk/references/conditions/designed to make hands-off, LLM-driven condition authoring reliable.The schema reference is linked to `taco-web` `signing-epic` rather than vendored, so it remains the auto-generated source of truth.
`SUMMARY.md` and `conditions/README.md` updated to surface the new pages.
Notes for review
Test plan