Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Examples

The examples move from small lineage to the current goal-centered runtime features.

Goal lineage

cargo run --example goal_lineage

Start here for the current core graph shape. It shows a goal being served by a task, blocked by a failure, and advanced by a patch.

flowchart LR
  task["task_retry_timeout"]
  failure["failure_retry_timeout"]
  patch["patch_retry_state"]
  goal["goal_retry_reliability"]

  task -- serves --> goal
  failure -- blocks --> goal
  patch -- advances --> goal

Basic lineage

cargo run --example basic_lineage

Use this first if you want to understand nodes and relations.

It creates:

hypothesis_retry_state_lost --explains--> failure_retry_timeout
flowchart LR
  hypothesis["hypothesis_retry_state_lost"]
  failure["failure_retry_timeout"]

  hypothesis -- explains --> failure

You should see a markdown lineage report with the hypothesis as the root and the failure as an outgoing relation.

Patch, eval, decision

cargo run --example patch_eval_decision

This is the main patch lifecycle demo.

It records:

  • a failure
  • a patch that addresses the failure
  • a fake Git diff artifact
  • an eval result
  • an approval decision
  • a promoted patch status

Use this pattern when an agent proposes a change and needs evidence before promotion.

yoagent integration

cargo run --example yoagent_integration

This uses YoAgentStateSink and YoAgentStateAdapter to record run, model, and tool lifecycle events.

It demonstrates how yoagent-state stays optional: the agent loop emits events to a sink, but the state layer does not take over execution.

yoyo evolve demo

cargo run --example yoyo_evolve_demo

This records a compact growth loop with:

  • a failure
  • a project reference
  • a diff artifact
  • changed file relations
  • an eval result
  • an approval decision
  • a promoted patch status

Use this example when you want to see how project-level artifacts connect to semantic lineage.

Behavior subscription

cargo run --example behavior_subscription

This registers a behavior that reacts to failure.observed and creates an investigation task.

flowchart LR
  failure["failure.observed"]
  behavior["behavior subscription"]
  task["investigation task"]

  failure --> behavior --> task

Policy approval

cargo run --example policy_approval

This registers a policy requiring approval before node creation. The attempted operation is blocked and an approval request node is created.

flowchart LR
  action["create node"]
  policy["policy"]
  request["approval request"]

  action --> policy --> request

Replay and fork

cargo run --example replay_and_fork

This creates a graph, forks at an earlier event, and diffs the fork against current state.

flowchart LR
  event["event cutoff"]
  fork["fork graph"]
  current["current graph"]
  diff["graph diff"]

  event --> fork
  event --> current
  fork --> diff
  current --> diff

Typed pack

cargo run --example typed_pack

This registers a pack that validates goal, task, and serves relation shapes.

Choosing an example

Start here:

new to the current model -> goal_lineage
want the smallest relation -> basic_lineage
want the patch lifecycle -> patch_eval_decision
need behaviors -> behavior_subscription
need policy gates -> policy_approval
need replay/fork/diff -> replay_and_fork
need typed validation -> typed_pack
integrating an agent loop -> yoagent_integration
building yoyo-style project evolution -> yoyo_evolve_demo