Repository navigation
feat(318): a fork is stored where it is decided — routes on the source task - #131
Merged
Merged
Conversation
…ization A task may declare routes: when its own output matches (output.<path> <op> <literal>, single or combined), the tasks it names run. materializeSkillTasks — the form every run and every validity check uses — gives each routed task the guard its routes imply and the source as a dependency, so a fork is stored once, on the task that decides it. Routes are validated as stored: a route to a missing task or to itself, a task enabled by two sources or carrying its own when, routes that combine into no single-level guard, and a condition that is not a comparison on the source's output. Paths are checked against the source's output through the existing when-path check on the derived guards. A decision step's routes are checked against its questions through a per-operation registry, so the workflow model holds no decision-specific concept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…step The decision draft task becomes an ai.decision.decide operation task carrying routes over its own output; its targets only depend on it, and their guards are derived at materialization. Draft agent, operation and human tasks accept routes, and the assembler carries them onto the workflow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A patch under /tasks/{i}/routes stages update_task_routes with the complete
new list, so adding a branch is one task and one route. Ratification applies
it and re-validates the graph, so removing a task a route still enables is
refused naming that route. The proposal card shows routes added and removed
as "when … → enable …". The op is authoring-only: a Coach keeps replace_task.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guard derivation moves to @aflow/schemas so materialization and the designer share it. The designer draws edges from derived guards, so each route is a labelled conditional edge from its source, while the node keeps the stored task the inspector edits; the inspector shows a source's routes and a routed task's "Enabled by". Route error kinds move to their own module. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
munchist
approved these changes
Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan 318 — a fork is stored on the task that decides it. Spec:
docs/plans/318-a-fork-is-stored-where-it-is-decided.md.What changes
routes: [{ when, enable }], wherewhencompares the task's own output (output.<path> <op> <literal>, single oranyOf/allOf). The guards and dependencies of enabled tasks are derived at materialization — the only form ever executed — and never stored.deriveRouteGuardslives in@aflow/schemasso materialization and the designer share one derivation.when, a combination with no single-level guard, and a condition that is not a comparison on the source's output are each refused with a diagnostic naming the route. Operation-specific checks come from a small registry keyed by operation id;ai.decision.decidecontributes unknown question / option and out-of-range score threshold.decisiontask becomes anai.decision.decideoperation task carrying its routes; its targets only depend on it. Agent, operation and human draft tasks acceptroutes, and the assembler carries them./tasks/{i}/routesstagesupdate_task_routeswith the complete new list, so adding a branch is one task plus one route. Ratification re-validates, so removing a task a route still enables is refused naming that route. The proposal card shows routes added and removed aswhen … → enable …. The op is authoring-only; the Coach union is unchanged.Existing skills with authored guards keep them and keep running (D6).
Verification
yarn build,yarn typecheck,yarn lint,yarn format:checkclean.yarn test:changed: 3546 passed. New suites:routes.test.ts(derivation, branch selection, every refusal),routeProposals.test.ts,workflowPatchRoutes.test.ts, route cases inskill-graph.test.ts, updated decision lowering tests.🤖 Generated with Claude Code