what_if
Apply hypothetical fact modifications to a knowledge base and compare query results before and after, without committing changes.
Instructions
Apply hypothetical fact changes and compare the query before and after.
Use this to test a change without committing to it: promoting a user to a
role, adding a resource, revoking an assignment. modifications is one change
per line, + fact(...) to add or - fact(...) to remove. Only facts can be
changed, not rules. A - line that matches no existing fact is an error, so a
typo cannot silently produce a misleading comparison.
Returns WhatIfResult:
ok(bool): false when the request could not be evaluated.before_count,after_count(int): solution counts on each knowledge base.delta(int):after_count - before_count.solutions_before,solutions_after(list): full solutions with proofs.applied(list of str): the modifications as applied, normalized.conclusion(str): a readable description of the impact.error(str | null): a readable message whenokis false.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | False when the request could not be evaluated. | |
| delta | No | after_count - before_count. | |
| error | No | Readable, actionable message when ok is False. | |
| applied | No | Modifications that were applied, normalized. | |
| conclusion | No | Human-readable description of the impact. | |
| after_count | No | Solutions on the modified knowledge base. | |
| before_count | No | Solutions on the base knowledge base. | |
| solutions_after | No | ||
| solutions_before | No |