Skip to content

Draw-Tree/drawtree-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

drawtree-validator

Reference Python implementation of the Draw Tree Protocol (v0.3) — JSON schema validation, six-state verdict aggregation, and Fibonacci-default branch weighting.

This library is intentionally small and dependency-light. It does not implement Phase 1 / Phase 2 research; it only implements the deterministic parts of the protocol that a compliant server can be checked against.

Install

pip install drawtree-validator

Or install from source:

git clone https://github.com/Draw-Tree/drawtree-validator
cd drawtree-validator
pip install -e .

What it does

from drawtree_validator import validate_tree, aggregate_tree

with open("my_tree.json") as f:
    tree = json.load(f)

# 1. Structural validation against the v0.3 JSON Schema.
result = validate_tree(tree)
if not result.is_valid:
    for err in result.errors:
        print(err)

# 2. Aggregate leaf verdicts into branch and root conviction scores.
agg = aggregate_tree(tree)
print(agg.root_score, agg.root_label)
for b in agg.branches:
    print(b.branch_id, b.score, b.label)

What it does NOT do

  • It does not generate trees. There is no LLM call here.
  • It does not perform deep research, Tavily integration, or any evidence ingestion. Those are server concerns.
  • It does not enforce the Phase 1 client contract — that is a client responsibility. See drawtree-skill for the canonical client behaviour rules.

Aggregation algorithm

Branch conviction is the weighted mean of leaf verdict scores within the branch (default leaf weight 1.0). Root conviction is the weighted mean of branch scores (default branch weight 1.0, or Fibonacci normalisation if the server chooses to apply the default scheme).

Verdict-to-score mapping (normative per spec §3):

Verdict Score
validated 1.00
trending_positive 0.75
inconclusive 0.50
trending_negative 0.25
approaching_falsification 0.10
falsified 0.00

Unknown or missing verdicts default to 0.50 so unresearched leaves do not artificially depress a branch's score.

Testing

pip install -e ".[dev]"
pytest

Versioning

This library tracks the protocol's MAJOR.MINOR.PATCH:

  • The library's MAJOR.MINOR matches the protocol spec version it validates against (so 0.3.x validates v0.3 trees).
  • PATCH increments are bug fixes and clarifications, never new invariants.

About

Reference Python validator and aggregator for the Draw Tree Protocol (v0.3).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages