Decision Tree
An agent at a fork shows each way forward as a branch – what it changes, which parts worry it, which one it would take – and waits for you to pick a path or tell it something else.
oxyn add decision-treeDecisions
3 waiting for you1 of 3Sign-in errors rose to 9% after build 1207 – how should I proceed?
1,860 failed sign-ins in 15 minutes · support tickets doubling.
- Sign-ins recover in ~3 minDrops the new SSO screenPost a status update?
- Fix is 2 lines · ~20 min to ship
- Instant · old sign-in for everyone
rsx! {
DecisionTree {
decisions: Some(agent.pending_decisions()),
now: clock.now(),
on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
on_other: move |(id, text)| agent.instruct(id, text),
}
}Rendered from Rust at build time · goes live when visible
When to use
- An agent at a fork it should not take alone shows each way forward as a branch – what it changes, which consequence worries it, which one it would take – and waits for a person to pick a path or write a different instruction.
When not to use
- An agent asks before it acts: use Approval Card instead.
- Several open requests in one card: use Approval pager instead.
- An agent's question in its own card above the composer: use Decision Card instead.
Installation
Decision Tree is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add decision-treeuse crate::oxyn::{DecisionTree, STATUS_INDICATOR_CSS};Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{DecisionTree, STATUS_INDICATOR_CSS};
Usage
rsx! {
DecisionTree {
decisions: Some(agent.pending_decisions()),
now: clock.now(),
on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
on_other: move |(id, text)| agent.instruct(id, text),
}
}Examples
Auto
The tree plays itself – the agent's pick lights up, gets picked, its follow-up answered, then the next decision grows in. Touch it to take over.
Decisions
3 waiting for you1 of 3Sign-in errors rose to 9% after build 1207 – how should I proceed?
1,860 failed sign-ins in 15 minutes · support tickets doubling.
- Sign-ins recover in ~3 minDrops the new SSO screenPost a status update?
- Fix is 2 lines · ~20 min to ship
- Instant · old sign-in for everyone
Code
rsx! {
DecisionTree {
decisions: Some(agent.pending_decisions()),
now: clock.now(),
on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
on_other: move |(id, text)| agent.instruct(id, text),
}
}Settled
Waiting for you: three branches and Other…, the follow-ups dimmed until their branch is picked.
Decisions
3 waiting for you1 of 3Sign-in errors rose to 9% after build 1207 – how should I proceed?
1,860 failed sign-ins in 15 minutes · support tickets doubling.
- Sign-ins recover in ~3 minDrops the new SSO screenPost a status update?
- Fix is 2 lines · ~20 min to ship
- Instant · old sign-in for everyone
Code
rsx! {
DecisionTree {
decisions: Some(agent.pending_decisions()),
now: clock.now(),
on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
on_other: move |(id, text)| agent.instruct(id, text),
}
}Hover
Hover a branch: the route from the question to it turns blue and the rest fade to 40 %.
Decisions
3 waiting for you1 of 3Sign-in errors rose to 9% after build 1207 – how should I proceed?
1,860 failed sign-ins in 15 minutes · support tickets doubling.
- Sign-ins recover in ~3 minDrops the new SSO screenPost a status update?
- Fix is 2 lines · ~20 min to ship
- Instant · old sign-in for everyone
Code
rsx! {
DecisionTree {
decisions: Some(agent.pending_decisions()),
now: clock.now(),
on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
on_other: move |(id, text)| agent.instruct(id, text),
}
}Picked
A branch picked: the rest fade away and its follow-up wakes up – press 1 or 2.
Decisions
3 waiting for you1 of 3Sign-in errors rose to 9% after build 1207 – how should I proceed?
1,860 failed sign-ins in 15 minutes · support tickets doubling.
- Sign-ins recover in ~3 minDrops the new SSO screenPost a status update?
- Fix is 2 lines · ~20 min to ship
- Instant · old sign-in for everyone
Code
rsx! {
DecisionTree {
decisions: Some(agent.pending_decisions()),
now: clock.now(),
on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
on_other: move |(id, text)| agent.instruct(id, text),
}
}Outcome
Both levels picked: the path runs on to Approved · running.
Decisions
3 waiting for you1 of 3Sign-in errors rose to 9% after build 1207 – how should I proceed?
1,860 failed sign-ins in 15 minutes · support tickets doubling.
- Sign-ins recover in ~3 minDrops the new SSO screenPost a status update?Approved· running
- Fix is 2 lines · ~20 min to ship
- Instant · old sign-in for everyone
Code
rsx! {
DecisionTree {
decisions: Some(agent.pending_decisions()),
now: clock.now(),
on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
on_other: move |(id, text)| agent.instruct(id, text),
}
}Other
Other… turned into a small text box; Enter sends it, Shift+Enter adds a line break.
Decisions
3 waiting for you1 of 3Sign-in errors rose to 9% after build 1207 – how should I proceed?
1,860 failed sign-ins in 15 minutes · support tickets doubling.
- Sign-ins recover in ~3 minDrops the new SSO screenPost a status update?
- Fix is 2 lines · ~20 min to ship
- Instant · old sign-in for everyone
Code
rsx! {
DecisionTree {
decisions: Some(agent.pending_decisions()),
now: clock.now(),
on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
on_other: move |(id, text)| agent.instruct(id, text),
}
}Sent
An instruction sent instead of a branch, with the agent's short answer.
Decisions
3 waiting for you1 of 3Sign-in errors rose to 9% after build 1207 – how should I proceed?
1,860 failed sign-ins in 15 minutes · support tickets doubling.
- Sign-ins recover in ~3 minDrops the new SSO screenPost a status update?
- Fix is 2 lines · ~20 min to ship
- Instant · old sign-in for everyone
- Revert first, then page whoever owns the buildSent to the deploy agent
Code
rsx! {
DecisionTree {
decisions: Some(agent.pending_decisions()),
now: clock.now(),
on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
on_other: move |(id, text)| agent.instruct(id, text),
}
}Flagged
A flagged consequence with the agent's note open (F cycles through them).
Decisions
3 waiting for you2 of 3A customer asks for 30% off to renew – counter or accept?
Renewal is due Friday · 140 seats on the annual plan.
- Keeps ~$41k a year in marginAsk for a longer term?
- $58k a year · needs approvalAgent's noteDiscounts over 20% need a finance sign-off before they are offered.Pricing policy
- Reply expected within a day
Code
rsx! {
DecisionTree {
decisions: Some(agent.pending_decisions()),
now: clock.now(),
on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
on_other: move |(id, text)| agent.instruct(id, text),
}
}No other
Without Other…: the branches are the only way forward.
Decisions
3 waiting for you1 of 3Sign-in errors rose to 9% after build 1207 – how should I proceed?
1,860 failed sign-ins in 15 minutes · support tickets doubling.
- Sign-ins recover in ~3 minDrops the new SSO screenPost a status update?
- Fix is 2 lines · ~20 min to ship
- Instant · old sign-in for everyone
Code
rsx! {
DecisionTree {
decisions: Some(agent.pending_decisions()),
now: clock.now(),
on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
on_other: move |(id, text)| agent.instruct(id, text),
}
}Single
One decision, two branches, no follow-ups.
Decisions
1 waiting for you1 of 1A duplicate charge was found on 37 orders – refund them all now?
$1,184 in total · customers not told yet.
- $1,184 · not reversible
- Only customers who write in
Code
rsx! {
DecisionTree {
decisions: Some(agent.pending_decisions()),
now: clock.now(),
on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
on_other: move |(id, text)| agent.instruct(id, text),
}
}Narrow
At 380 px the tree turns vertical: question first, then each branch on a line down the left with its consequences beneath.
Decisions
3 waiting for you1 of 3Sign-in errors rose to 9% after build 1207 – how should I proceed?
1,860 failed sign-ins in 15 minutes · support tickets doubling.
- Sign-ins recover in ~3 minDrops the new SSO screenPost a status update?
- Fix is 2 lines · ~20 min to ship
- Instant · old sign-in for everyone
Code
rsx! {
DecisionTree {
decisions: Some(agent.pending_decisions()),
now: clock.now(),
on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
on_other: move |(id, text)| agent.instruct(id, text),
}
}Classic
Classic style: framed, grey title strip, the risk tag moves into the card and each set of consequences gets its own box.
Decisions
4 waiting for you1 of 4A duplicate charge was found on 37 orders – refund them all now?
$1,184 in total · customers not told yet.
- $1,184 · not reversible
- Only customers who write in
Code
rsx! {
DecisionTree {
decisions: Some(agent.pending_decisions()),
now: clock.now(),
on_choose: move |(id, branch, then)| agent.resolve(id, branch, then),
on_other: move |(id, text)| agent.instruct(id, text),
}
}API reference
DecisionTree
| Prop | Type | Default | Description |
|---|---|---|---|
decisions | Option<Vec<DtDecision>> | Default::default() | Everything waiting for a call (the demo queue when `None`). |
allow_other | bool | true | Offer the "Other…" branch. |
title | String | "Decisions" | Heading of the bar. |
auto | bool | Default::default() | Demo: the tree plays itself (hover, pick, follow-up, next) until touched. |
start | usize | Default::default() | Start on this decision. |
branch | Option<usize> | Default::default() | Start with this branch of the first decision picked. |
then | Option<usize> | Default::default() | Start with this follow-up option picked too (decision stays, no fade). |
hover | Option<usize> | Default::default() | Start with this branch pointed at. |
other_open | bool | Default::default() | Start with "Other…" open. |
sent | String | Default::default() | Start with this instruction already sent. |
flag | Option<usize> | Default::default() | Start with the n-th flag's note open. |
nowrequired | ClockMs | — | The clock. |
style | String | Default::default() | `clean`, `classic`, or empty to follow `data-cstyle`. |
on_choose | EventHandler<(String, usize, Option<usize>)> | — | A path was picked: (decision id, branch, follow-up pick). |
on_other | EventHandler<(String, String)> | — | An instruction was sent: (decision id, text). |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| 1 – 4 | Chooses that branch; one past the last number opens Other… |
| Enter | In Other…: sends the instruction (Shift+Enter: new line) |
| →or← or JorK | Next and previous decision |
| F | Cycles through the amber flags and shows why the agent raised each |
| Escape | Closes Other… or a note |
Accessibility
- Branches are real buttons named after their option (the preferred one says so in its name); aria-keyshortcuts lists the digit.
- Amber flags take focus; aria-describedby ties each to its role=tooltip explanation.
- Other… is a labelled textarea whose border darkens on focus; picks, instructions and answers go to a polite live region.
- Connector lines are CSS decoration and never reach assistive tech.
Responsive behaviour
- A container query: wide, question → branches → consequences run left to right.
- Under 520 px it runs top to bottom with the consequences under each branch; nothing scrolls sideways.
Edge cases (spec)
A container query: wide, question → branches → consequences left to right. Under 520 px top to bottom: branches hang down the left below the question, consequences tucked under every branch; the "waiting" count steps aside.
Notes for AI
- Import
DecisionTreefromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus the token stylesheet once. - A GPUI version exists:
DecisionTreeElinoxyn_gpui. - Props to set first:
now. - It reads a clock (
now) for live timers; pass one clock for the whole page rather than one per component. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.