Hello World
Greet a user based on time of day. Demonstrates sequence, selector, and action primitives.
Version: 2.0.0
Files
hello-world/TREE.yaml— main
Install
sh
mkdir -p .abtree/trees/hello-world \
&& curl -fsSL https://raw.githubusercontent.com/flying-dice/abtree/main/.abtree/trees/hello-world/TREE.yaml \
-o .abtree/trees/hello-world/TREE.yamlRun with Claude
sh
claude "Run the abtree hello-world tree. Use 'abtree --help' to learn the execution protocol, then create an execution with 'abtree execution create hello-world \"<summary>\"' and drive it to completion."Tree definition
yaml
# yaml-language-server: $schema=https://abtree.dev/schemas/tree.schema.json
name: hello-world
version: 2.0.0
description: Greet a user based on time of day. Demonstrates sequence, selector, and action primitives.
state:
local:
time_of_day: null
greeting: null
global:
user_name: retrieve by running the shell command "whoami"
tone: friendly
language: english
tree:
type: sequence
name: Hello_World
children:
- type: action
name: Determine_Time
steps:
- instruct: >
Check the system clock to get the current hour.
Classify as: before 12:00 = "morning", 12:00-17:00 = "afternoon", after 17:00 = "evening".
Store the classification string at $LOCAL.time_of_day.
- type: selector
name: Choose_Greeting
children:
- type: action
name: Morning_Greeting
steps:
- evaluate: $LOCAL.time_of_day is "morning"
- instruct: >
Compose a cheerful morning greeting addressing $GLOBAL.user_name
in $GLOBAL.language with a $GLOBAL.tone tone.
Store at $LOCAL.greeting.
- type: action
name: Afternoon_Greeting
steps:
- evaluate: $LOCAL.time_of_day is "afternoon"
- instruct: >
Compose a warm afternoon greeting addressing $GLOBAL.user_name
in $GLOBAL.language with a $GLOBAL.tone tone.
Store at $LOCAL.greeting.
- type: action
name: Evening_Greeting
steps:
- evaluate: $LOCAL.time_of_day is "evening"
- instruct: >
Compose a relaxed evening greeting addressing $GLOBAL.user_name
in $GLOBAL.language with a $GLOBAL.tone tone.
Store at $LOCAL.greeting.
- type: action
name: Default_Greeting
steps:
- instruct: >
Compose a neutral greeting addressing $GLOBAL.user_name
in $GLOBAL.language with a $GLOBAL.tone tone.
Store at $LOCAL.greeting.