Repository navigation
Description
Agreed design as of 2026-10-01, amended during review of #18 (optional data requests). The original proposal is kept at the end.
Foundations: the premises every implementation follows
-
Steps have no access to the workflow. A step can access only what it declares it needs: data from the workflow (its inputs), a contributor for the data it contributes back, and a reporter for its own events. It has no access to the workflow, the data bag, the executor, other steps, or anything else that runs it.
-
Workflows are declarative. A workflow's steps, their order, and the policies and adapters attached to them are fixed before the run starts, and can be listed without running anything, whatever the language's syntax.
-
Policies. A policy is an object that defines one or more hooks, each identified as the specific hook it implements. There are two types:
- step policies define only step hooks, and are attached to steps;
- workflow policies define only workflow hooks, and are attached to workflows.
Policies are reusable: a step policy can be attached to steps in any workflow, and a workflow policy to any workflow. A step policy runs in the context of the step it is attached to, so it names no step; it can request the step's name.
-
Each hook is defined at most once per target. Any number of step policies can be attached to a step; together they may define each step hook at most once. The same holds for the workflow policies attached to a workflow. A hook that no attached policy defines takes its default behaviour. A hook defined twice is a configuration error, detected at admission together with every other violation, and at compile time where the language allows it.
-
Declaration order. Policies are evaluated in the order they are declared. In tier 1 the order has no effect, since each hook is defined at most once; it is preserved because later tiers may add cumulative hooks, which will run in that order.
-
Data from the workflow, through input adapters. A step requests each input from the workflow by a key and a type, as required or optional.
- An input adapter is declared on the workflow and associated with one or more (step, key) pairs. It receives the step name and the key, may obtain the data from anywhere, and returns the value in the requested type or reports that it has no value. Input adapters belong to the workflow that declares them.
- Without an input adapter for a step and key, the value is read from the workflow's data bag.
- When no value can be supplied (the adapter reports none, or the data bag has no such key), a required input aborts the journey, and an optional input leaves the step built with that input absent.
- If an adapter fails, or a value is of the wrong type, the journey is aborted, whether the input is required or optional.
- The engine emits an event when an adapter supplies a value and when one fails (Events #11).
-
Data from the step, without adapters. Only step hooks receive data from a step. A step hook requests data from the step it acts on by a key and a type, as required or optional, and receives exactly what that step contributed under that key. There is no adapter for this direction, so the data is guaranteed to come from the step. If the step did not contribute the key, a required request aborts the journey and an optional request calls the hook with the data absent. A wrong type aborts the journey either way. Any transformation happens inside the hook.
-
Language-specific forms are not part of this proposal. How a language expresses steps, policies, hooks and adapters (annotations, attributes, typed or dynamic adapters) is decided in each language's tech spec. For Rust, see itinera-dev/itinera-rs#2.
Tier
Related tier 1 proposals
Steps #8, running a workflow #9, hooks and lifecycles #10, events #11, the local executor #12.
Original proposal
Summary
The premises every Itinera implementation is built on, in every language: what a step can access, how a workflow declares its steps, how policies are attached and composed, and how data flows between the workflow, its steps and its hooks.
This proposal used to describe the whole core model, across several tiers. It was narrowed on 2026-10-01 to these premises only. The rest of tier 1 is in separate proposals, linked below, and later tiers will be proposed when they are planned.
Motivation
Separating business rules from flow control fails when the separation depends on discipline. These premises make it structural: a step has nothing to call, the flow is visible in one declaration, decisions live in reusable policies attached in one place, and data reaches each part only through adapters.
Premises
-
Steps have no access to the workflow. A step can access only what it declares it needs: its inputs, a contributor for the data it contributes back, and a reporter for its own events. It explicitly has no access to the workflow, the data bag, the executor, other steps, or anything else that runs it.
-
The list of steps is declarative, whenever the language allows it. A workflow's steps, their order and what is attached to them are declared in one place, as a declaration rather than as code that builds the list at run time.
-
Policies are attached where they apply, and are reusable. A policy is a set of hooks.
- Step policies are attached to steps, and react to a step's outcome.
- Workflow policies are attached to the workflow, and react to the executor managing the workflow.
Because a policy is attached rather than written into a step or a workflow, the same policy can be reused on many steps or many workflows.
-
Each step's policies define each hook at most once. A step may have several policies attached. Taken together, they may define each step hook at most once. A hook that none of them defines takes its default behaviour. Two attached policies defining the same hook is a configuration error.
-
Each workflow's policies define each hook at most once. The same rule applies to the policies attached to a workflow, for workflow hooks.
-
Data flows from the workflow to steps through adapters. A step asks for inputs by its own keys and in its own format. An adapter decides where each input comes from. Without a custom adapter, inputs are read from the workflow's data bag.
-
Data flows from contributions to hooks through adapters. What a step contributes reaches the hooks that react to it through an adapter, never by the hook reaching into the step.
Related tier 1 proposals
The rest of tier 1 builds on these premises:
- Steps: Steps #8
- Running a workflow: Running a workflow #9
- Hooks and lifecycles: Hooks, lifecycles and workflow roles #10
- Events: Events #11
- The local executor: The local executor #12
Rust-specific points raised so far are in itinera-dev/itinera-rs#2.
Activity
marlon-sousa commentedon Oct 1, 2026
[-]Core model: steps, workflows, hooks, executors, journeys and events[/-][+]Foundations: step isolation, declarative workflows, policies and data flow[/+]marlon-sousa commentedon Oct 1, 2026
Claude summary
Posted by Claude (Claude Code) from a maintainer's account, as described in PROCESS.md.
Scope change, 2026-10-01. This proposal was narrowed to the foundational premises, at the maintainer's request: one concern per proposal, tier 1 first. The rest of tier 1 is now in #8 (steps), #9 (running a workflow), #10 (hooks and lifecycles), #11 (events) and #12 (the local executor). Later tiers will be proposed when they are planned.
The earlier evaluation comment above is superseded: its questions either move to the proposal they belong to, or wait for their tier. A new evaluation for these premises follows.
marlon-sousa commentedon Oct 1, 2026
marlon-sousa commentedon Oct 1, 2026
If a step finishes abnormally, the step exception (or the appropriate hook can request the error, with na annootated parameter.
If a step fails because its number of retrials are exausted, the step failure is called and the cause is filled exactly with that.
marlon-sousa commentedon Oct 1, 2026
marlon-sousa commentedon Oct 1, 2026
marlon-sousa commentedon Oct 1, 2026
marlon-sousa commentedon Oct 1, 2026
marlon-sousa commentedon Oct 1, 2026
marlon-sousa commentedon Oct 1, 2026
Claude summary
Posted by Claude (Claude Code) from a maintainer's account, as described in PROCESS.md.
Nothing is left open. The issue body now holds the agreed design, with the original proposal kept at the end. The evaluation comments it replaces are hidden as outdated; the maintainer's answers stay visible.
This proposal is ready for a maintainer to set
status: ready.marlon-sousa commentedon Oct 1, 2026
Accepted on 2026-10-01 in #18.