Review before applying
Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
TreeSentinel provides a Windows workspace for AI-assisted review of binary-search-tree ordering. Use a project conversation to question ancestor bounds, duplicate keys and malformed nodes, then examine the suggested edits.
def is_strict_bst(root):
pending, seen, checks = [(root, None, None)], set(), []
while pending:
node, low, high = pending.pop()
if node is None:
continue
if type(node) is not list or len(node) != 3 or type(node[0]) is not int:
raise ValueError("tree.node")
if id(node) in seen or len(seen) == 1000:
raise ValueError("tree.structure")
seen.add(id(node))
value, left, right = node
checks.append((value, low, high))
pending.extend([(right, value, high), (left, low, value)])
return all((low is None or low < value) and
(high is None or value < high) for value, low, high in checks)Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
Base URL, credentials and a reachable server.
Check empty trees and ancestor bounds, returning false for duplicate keys while rejecting cycles, shared children, malformed nodes or over 1000 nodes.
def is_strict_bst(root):
pending, seen, checks = [(root, None, None)], set(), []
while pending:
node, low, high = pending.pop()
if node is None:
continue
if type(node) is not list or len(node) != 3 or type(node[0]) is not int:
raise ValueError("tree.node")
if id(node) in seen or len(seen) == 1000:
raise ValueError("tree.structure")
seen.add(id(node))
value, left, right = node
checks.append((value, low, high))
pending.extend([(right, value, high), (left, low, value)])
return all((low is None or low < value) and
(high is None or value < high) for value, low, high in checks)TreeSentinel gives structured-data maintenance a Windows project workspace and an AI conversation tied to source files. Start by showing where the application receives a structure and how it uses the validation result. Ask the model to inspect that full boundary before proposing a simpler check or a different traversal.
For example, a task around bst_order.py could investigate a tree whose immediate children look ordered while a deeper value violates an ancestor’s bound. Include the failing structure and expected result. Then ask how malformed nodes and repeated references are handled, so an ordering fix does not overlook assumptions about the shape being traversed.
Review the resulting proposal for distinct outcomes: a valid tree, an ordering failure and a malformed structure. Run the relevant project checks and inspect how each outcome reaches the consumer. Keep any change to duplicate-key policy explicit. What appears to be a minor comparison edit can alter which data the surrounding application accepts.
TreeSentinel connects to supported OpenAI-compatible or Anthropic endpoints, with credentials where needed. You may select an abliterated AI model if your endpoint offers one. Its provider restrictions, context limits and available tools remain part of that setup; the review should rely on concrete structures and observable outcomes rather than the model’s confidence.
A local comparison can pass while a descendant violates an earlier ancestor’s bound. Supply a small nested fixture that exposes that difference and state the expected result. Review the proposed traversal against it before accepting a simplification of the validation logic.
Define that in the application contract. The example enforces strict ordering, which excludes equal keys. Inspect whether the consumer distinguishes malformed input from a well-formed structure that fails ordering, and preserve those response conventions in the proposed change.
It may mean the input is not the tree shape the routine expects, even when individual values look acceptable. Include a shared-reference or cyclic fixture where appropriate. Check termination and rejection behavior rather than relying exclusively on ordinary nested examples.
Only after accounting for the structure and failure behavior the caller needs. A flattened value check may conceal malformed nodes or traversal assumptions. Ask the model to explain those tradeoffs using the actual source before changing the validation contract.
TreeSentinel · Updated 2026-10-25