Externalized type definitions and reusable workflows for hiivmind-blueprint.
This library introduces a novel approach to workflow execution: the LLM interprets YAML pseudocode directly, eliminating the need for a traditional runtime engine.
| Traditional Approach | LLM-Native Approach |
|---|---|
| YAML defines structure, code implements behavior | YAML defines both structure AND behavior via pseudocode |
| Engine parses YAML → calls handler functions | LLM reads YAML → interprets effect pseudocode directly |
| New features require engine code changes | New features require only new type definitions |
| Deployed runtime with dependencies | Zero deployment - runs wherever the LLM runs |
| Fixed interpolation syntax | Natural language understanding of expressions |
Each type definition includes an effect field containing pseudocode that the LLM interprets:
# From consequences/consequences.yaml
types:
set_flag:
description:
brief: Sets a boolean flag in workflow state
parameters:
- name: flag
type: string
required: true
- name: value
type: boolean
default: true
payload:
kind: state_mutation
effect: |
state.flags[params.flag] = params.valueWhen executing a workflow, the LLM:
- Reads the workflow YAML (nodes, consequences, preconditions)
- Looks up each type's definition from this library
- Interprets the
effectpseudocode to perform the operation - Naturally handles interpolation, error recovery, and tool calls
- Extensibility: Add new consequence/precondition types by creating definition files - no engine changes needed
- Self-describing: Type definitions fully specify their behavior; the LLM needs no special knowledge
- Natural handling: The LLM naturally handles
${...}interpolation, error messages, and edge cases - Zero deployment: Updates to types apply immediately to all workflows using this library
- Transparent: Behavior is documented in readable pseudocode, not buried in implementation code
This package provides semantic type definitions and reusable workflows that can be referenced by URL, similar to how GitHub Actions work:
# In your workflow.yaml
definitions:
source: hiivmind/hiivmind-blueprint-lib@v3.0.0
nodes:
clone_source:
type: action
actions:
- type: git_ops_local # Type resolved from external definitions
operation: clone
args:
url: "${source.url}"
# Reference a reusable workflow
detect_intent:
type: reference
workflow: hiivmind/hiivmind-blueprint-lib@v3.0.0:intent-detection
context:
arguments: "${arguments}"
intent_flags: "${intent_flags}"
intent_rules: "${intent_rules}"
next_node: execute_dynamic_route- Reference this library in your workflow's
definitionsblock - Use consequence and precondition types in your nodes
- Optionally reference reusable workflows
name: my-workflow
version: "1.0.0"
definitions:
source: hiivmind/hiivmind-blueprint-lib@v3.0.0
start_node: check_config
nodes:
check_config:
type: conditional
condition:
type: path_check # Precondition type from library
path: "config.yaml"
check: is_file
branches:
on_true: load_config
on_false: create_config
load_config:
type: action
actions:
- type: local_file_ops # Consequence type from library
operation: read
path: "config.yaml"
store_as: config
on_success: done
on_failure: error_reading
endings:
done:
type: success
message: "Configuration loaded"Workflows execute in a 3-phase model defined in execution/engine_execution.yaml:
FUNCTION initialize(workflow_path, plugin_root, runtime_flags):
workflow = parse_yaml(read_file(workflow_path))
types = load_types(workflow.definitions)
# Check entry preconditions
FOR each precondition IN workflow.entry_preconditions:
IF evaluate_precondition(precondition) == false:
DISPLAY error and STOP
# Initialize state
state = {
current_node: workflow.start_node,
history: [],
user_responses: {},
computed: {},
flags: workflow.initial_state.flags,
checkpoints: {}
}
FUNCTION execute(workflow, types, state):
LOOP:
node = workflow.nodes[state.current_node]
IF state.current_node IN workflow.endings:
GOTO Phase 3
# Dispatch based on node.type
outcome = dispatch_node(node, types, state)
# Record in history
state.history.append({ node, outcome, timestamp })
# Update position
state.previous_node = state.current_node
state.current_node = outcome.next_node
UNTIL ending
FUNCTION complete(ending, state):
# Display result based on ending.type
IF ending.type == "success":
DISPLAY ending.message
ELSE IF ending.type == "error":
DISPLAY "Error: " + ending.message
IF ending.recovery:
DISPLAY "Try running: /{ending.recovery}"
The library defines 4 node types for workflow construction:
| Node Type | Purpose | Routing |
|---|---|---|
action |
Execute consequences (operations) | on_success / on_failure |
conditional |
Branch based on a precondition | branches.on_true / branches.on_false |
user_prompt |
Present AskUserQuestion to user | Routes by handler_id from options |
reference |
Load and execute sub-workflow | next_node after completion |
Action Node - Execute operations:
clone_source:
type: action
actions:
- type: git_ops_local
operation: clone
args:
url: "${computed.repo_url}"
dest: ".source/${computed.source_id}"
on_success: verify_clone
on_failure: handle_clone_errorConditional Node - Branch on condition:
check_config_exists:
type: conditional
condition:
type: path_check
path: "config.yaml"
check: is_file
branches:
on_true: load_config
on_false: create_configUser Prompt Node - Ask user a question:
ask_source_type:
type: user_prompt
prompt:
question: "What type of source?"
options:
- label: "Git repository"
handler_id: git
next_node: configure_git
- label: "Local directory"
handler_id: local
next_node: configure_localRuntime state flows through execution, enabling dynamic behavior:
state:
# Position tracking
current_node: "ask_source_type"
previous_node: "check_url_provided"
# User interaction results
user_responses:
ask_source_type:
handler_id: "git"
raw: { selected: "Git repository" }
# Computed values from consequences
computed:
config: { name: "polars", sources: [] }
repo_url: "https://github.com/pola-rs/polars"
# Boolean routing flags
flags:
config_found: true
is_first_source: true
# Rollback snapshots
checkpoints:
before_clone: { ... }Use ${...} syntax to reference state values:
| Pattern | Example | Description |
|---|---|---|
${field} |
${source_type} |
Top-level state field |
${computed.path} |
${computed.repo_url} |
Computed value |
${flags.flag} |
${flags.config_found} |
Boolean flag |
${user_responses.node.field} |
${user_responses.ask_type.handler_id} |
User response |
${array[0]} |
${computed.sources[0].id} |
Array index |
${array[-1]} |
${history[-1].node} |
Negative index (last) |
| Embedded (Old) | External (New) |
|---|---|
| Definitions copied into each plugin | Single source of truth |
| Manual sync on updates | Version-controlled releases |
| No extension ecosystem | Third-party extensions possible |
| Plugin-coupled versioning | Independent semantic versioning |
| Workflows duplicated | Reusable workflow library |
All types are consolidated into single files per category for easier loading and reference.
| Category | Types | Description |
|---|---|---|
| core/state | 3 | set_flag, mutate_state, inline |
| core/evaluation | 2 | evaluate, compute |
| core/interaction | 1 | display (text, table, markdown, json) |
| core/control | 3 | create_checkpoint, rollback_checkpoint, spawn_agent |
| core/skill | 2 | invoke_skill, invoke_pattern |
| core/utility | 2 | set_timestamp, compute_hash |
| core/intent | 4 | evaluate_keywords, parse_intent_flags, match_3vl_rules, dynamic_route |
| core/logging | 9 | init_log, log_node, log_entry, log_session_snapshot, finalize_log, write_log, apply_log_retention, output_ci_summary, install_tool |
| core/filesystems | 1 | local_file_ops (read, write, mkdir, delete) |
| core/git | 1 | git_ops_local (clone, pull, fetch, get-sha) |
| core/web | 1 | web_ops (fetch, cache) |
| core/scripting | 1 | run_command (bash, python, node, etc.) |
| Category | Types | Description |
|---|---|---|
| core/composite | 4 | all_of, any_of, none_of, xor_of |
| core/expression | 1 | evaluate_expression |
| core/filesystems | 1 | path_check (exists, is_file, is_directory, contains_text) |
| core/logging | 1 | log_state (initialized, finalized, level_enabled) |
| core/state | 1 | state_check (true, false, equals, not_null, null) |
| core/tools | 1 | tool_check (available, version_gte, authenticated, daemon_ready) |
| core/network | 1 | network_available |
| core/python | 1 | python_module_available |
| core/git | 1 | source_check (exists, cloned, has_updates) |
| core/web_fetch | 1 | fetch_check (succeeded, has_content) |
| Type | Description |
|---|---|
| action | Execute operations, route on success/failure |
| conditional | Branch based on precondition evaluation |
| user_prompt | Present AskUserQuestion, route on response |
| reference | Load and execute reference document |
| Workflow | Description |
|---|---|
| intent-detection | Reusable 3VL intent detection for dynamic routing |
The library uses Kleene three-valued logic for intent detection, enabling sophisticated matching when some conditions are uncertain.
| Value | Meaning | Example |
|---|---|---|
T (True) |
Condition definitely matches | User input contains keyword |
F (False) |
Condition definitely doesn't match | User input lacks required keyword |
U (Unknown) |
Condition is uncertain or irrelevant | Optional flag not provided |
In rule definitions, U means "don't care" — the condition is ignored (wildcard). In runtime state, U means the value is uncertain.
When matching state against rules:
| State | Rule | Result | Meaning |
|---|---|---|---|
T |
T |
Hard match | Definite satisfaction |
T |
F |
Exclusion | Definite mismatch |
T |
U |
Skip | Rule doesn't care (wildcard) |
F |
T |
Exclusion | Definite mismatch |
F |
F |
Hard match | Definite non-satisfaction |
F |
U |
Skip | Rule doesn't care (wildcard) |
U |
T |
Soft match | State uncertain, could satisfy |
U |
F |
Soft match | State uncertain, could exclude |
U |
U |
Skip | Rule doesn't care (wildcard) |
Key insight: When rule=U, the condition is skipped entirely (doesn't count toward any counter). When state=U and rule=T/F, it's a soft match (uncertain satisfaction).
When multiple rules match, candidates are ranked by:
(-hard_matches, +soft_matches, +effective_conditions)
- More hard matches wins (negative = descending order)
- Fewer soft matches wins (penalizes uncertainty)
- More effective conditions wins (prefers specific rules)
Where effective_conditions = number of non-U conditions in the rule.
See match_3vl_rules consequence type in consequences/consequences.yaml for implementation details.
The execution/ directory contains the execution engine semantics in pseudocode form:
| File | Purpose |
|---|---|
execution/engine_execution.yaml |
Complete execution engine semantics (traversal, state, dispatch, logging) |
The resolution/ directory defines how types, workflows, and execution semantics are loaded:
| File | Purpose |
|---|---|
resolution/type-loader.yaml |
Load types from GitHub URLs |
resolution/workflow-loader.yaml |
Load reusable workflows |
resolution/execution-loader.yaml |
Load execution semantics |
These files are the authoritative source for execution semantics. The LLM interprets them directly when executing workflows.
Types are fetched directly from raw GitHub URLs at runtime:
definitions:
source: hiivmind/hiivmind-blueprint-lib@v3.0.0This resolves to:
https://raw.githubusercontent.com/hiivmind/hiivmind-blueprint-lib/v3.0.0/
The type loader fetches:
consequences/index.yaml- consequence type registrypreconditions/index.yaml- precondition type registry- Individual type files on demand (lazy loading)
detect_intent:
type: reference
workflow: hiivmind/hiivmind-blueprint-lib@v3.0.0:intent-detection
context:
arguments: "${arguments}"
intent_flags: "${intent_flags}"
intent_rules: "${intent_rules}"
next_node: execute_dynamic_route| Reference | Behavior |
|---|---|
v3.0.0 |
Exact version (recommended for production) |
v3.0 |
Latest patch in v3.0.x |
v3 |
Latest minor in v3.x.x (for development) |
main |
Latest commit (not recommended) |
Create your own extension package:
# mycorp-blueprint-types/package.yaml
name: mycorp-blueprint-types
extends: hiivmind/hiivmind-blueprint-lib@v3
# Reference in workflow
definitions:
source: hiivmind/hiivmind-blueprint-lib@v3.0.0
extensions:
- mycorp/custom-types@v1.0.0hiivmind-blueprint-lib/
├── package.yaml # Package manifest
├── CHANGELOG.md # Version history
│
├── consequences/
│ ├── index.yaml # Type registry
│ └── consequences.yaml # All 31 consequence types
│
├── preconditions/
│ ├── index.yaml # Type registry
│ └── preconditions.yaml # All 14 precondition types
│
├── nodes/
│ ├── index.yaml # Type registry
│ └── workflow_nodes.yaml # 5 node type definitions
│
├── execution/
│ ├── index.yaml # Execution semantics registry
│ └── engine_execution.yaml # Complete execution engine semantics
│
├── resolution/ # Type & workflow loading
│ ├── index.yaml
│ ├── type-loader.yaml # Load types from GitHub URLs
│ ├── workflow-loader.yaml # Load reusable workflows
│ └── execution-loader.yaml # Load execution semantics
│
├── workflows/ # Reusable workflow definitions
│ ├── index.yaml
│ └── core/
│ └── intent-detection.yaml # 3VL intent detection workflow
│
├── lib/
│ └── tool-registry.yaml # Tool availability registry
│
├── examples/ # Usage examples
│ ├── index.yaml
│ ├── consequences.yaml
│ ├── preconditions.yaml
│ ├── nodes.yaml
│ └── execution.yaml
│
└── schema/ # JSON schemas
├── common.json # Shared definitions
├── definitions/ # Type definition schemas
│ ├── consequence-definition.json
│ ├── precondition-definition.json
│ ├── node-definition.json
│ └── execution-definition.json
├── authoring/ # Workflow authoring schemas
│ ├── workflow.json
│ ├── node-types.json
│ └── intent-mapping.json
├── runtime/ # Runtime configuration schemas
│ └── logging.json
├── config/ # Configuration schemas
│ ├── output-config.json
│ └── prompts-config.json
└── resolution/ # Resolution schemas
├── index.json
├── type-loader.json
└── workflow-loader.json
- Removing a type
- Removing a required parameter
- Changing parameter semantics
- Renaming types
- Adding new types
- Adding optional parameters
- Deprecating (not removing) types
- Documentation fixes
- Example corrections
See CONTRIBUTING.md for guidelines on:
- Adding new consequence/precondition types
- Creating extension packages
- Testing changes
MIT