In traditional programming, we think in scripts - fixed sequences of commands. UnifyWeaver lets you create efficient scripts from declarative logic, but the true power of AI-driven development lies in thinking in workflows.
A Workflow is a Strategy Guide for an intelligent AI agent. Instead of a fixed plan, it provides:
The AI agent becomes an economic strategist, not just a script executor.
Within UnifyWeaver, these terms have distinct meanings:
Definition: The overarching strategic guide for an AI agent.
Contains:
Characteristics:
Example: “When compiling Prolog to Bash, analyze the recursion pattern first, then choose between linear recursion, transitive closure, or general recursive compilation based on pattern detection.”
Definition: Specific, detailed project plans for particular tasks.
Contains:
Characteristics:
Example: “To compile factorial: 1) Create /tmp/factorial.pl, 2) Run compiler_driver with factorial/2, 3) Verify output script exists, 4) Test with inputs 0, 5, 10.”
┌─────────────────────────────────────────────────────────┐
│ WORKFLOW │
│ "How to compile Prolog predicates effectively" │
│ │
│ Strategies: │
│ - Quick prototyping (cost: low, speed: fast) │
│ - Production deployment (cost: medium, quality: high) │
│ - Distributed processing (cost: high, scale: massive) │
├─────────────────────────────────────────────────────────┤
│ PLAYBOOKS │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Factorial │ │ Ancestor │ │ CSV Data │ │
│ │ Compilation │ │ Compilation │ │ Pipeline │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
├─────────────────────────────────────────────────────────┤
│ EXAMPLE LIBRARIES │
│ │
│ - compilation_examples.md │
│ - recursion_examples.md │
│ - testing_examples.md │
└─────────────────────────────────────────────────────────┘
Both Workflows and Playbooks reference example libraries - concrete instances of patterns, tool usage, and solutions.
examples_library/
├── compilation_examples.md # Factorial, ancestor compilation
├── recursion_examples.md # Recursive patterns
├── testing_examples.md # Test runner patterns
├── tool_usage_examples.md # UnifyWeaver tool usage
├── log_examples.md # Logging patterns
└── data_source_playbooks.md # Data source integration
Examples use the [!example-record] callout:
> [!example-record]
> id: 20251108-factorial-compile
> name: unifyweaver.compilation.factorial
> pattern: linear_recursion
> child_examples: [unifyweaver.testing.factorial_runner]
**Prolog Source:**
\```prolog
factorial(0, 1).
factorial(N, F) :- N > 0, N1 is N - 1, factorial(N1, F1), F is N * F1.
\```
% Workflow: compile_and_test
workflow_steps([
create_prolog_source,
compile_to_target,
generate_test_runner,
run_tests,
verify_results
]).
:- source(...))% Example: CSV data source
:- source(csv, users, [csv_file('users.csv'), has_header(true)]).
active_users(Name, Email) :-
users(Name, Email, Status),
Status = "active".
% Same predicate, multiple targets
compile_multi_target(Pred, Targets, Results) :-
maplist(compile_to_target(Pred), Targets, Results).
% Example: AWK → Python → Go pipeline
pipeline_stages([
step(parse, awk),
step(analyze, python),
step(aggregate, go)
]).
Every strategy has trade-offs:
| Strategy | Cost | Speed | Quality | When to Use |
|---|---|---|---|---|
| Quick Prototype | Low | Fast | Basic | Development, testing |
| Optimized Build | Medium | Slow | High | Production deployment |
| Parallel Execution | High | Very Fast | High | Large data processing |
| Distributed Pipeline | Very High | Scales | Enterprise | Cloud deployment |
Rules of thumb for strategy selection:
Every strategy should document:
Design playbooks and examples to work together:
Every playbook should include:
Key concepts from this chapter:
The next chapter covers the detailed playbook format for creating actionable execution guides.
| ← Previous: Workflows and Playbooks - Complete Index | 📖 Book 4: Workflows | Next: Chapter 2: Playbook Format → |