You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue #24 (Flow-to-VirtualTool adapter) covers wrapping a compiled flow as a Tool within ChainWeaver. But it doesn't address the cross-repo contract: exporting a flow as a weaver-spec SelectableItem that contextweaver can ingest into its catalog.
This is the mechanism that directly reduces tool explosion. If an agent has 50 tools but 5 of them are always used in a 5-tool sequence, compiling that sequence into a flow and exposing it as a single SelectableItem reduces the catalog from 50 to 46 (50 - 5 + 1). At scale, this is multiplicative.
A compiled flow exported as a SelectableItem should use kind="flow" (or kind="skill") and derive metadata from the flow definition.
Why it matters
Pillar 1 — Directly reduces the number of tools the LLM sees. A 5-step sequence becomes one option in the ChoiceCard.
Ecosystem value — This is the primary data path from ChainWeaver to contextweaver. Without it, the two repos are independent tools rather than an integrated system.
Composability — Flows-as-items means contextweaver can route to chains, not just individual tools. The LLM can choose "process and email customer report" (a flow) alongside individual tools.
Acceptance Criteria
flow_to_selectable_item(flow: Flow, executor: FlowExecutor) -> SelectableItem function
id = f"flow::{flow.name}" (namespaced to avoid collisions with regular tools)
kind = configured (default "skill" to distinguish from individual tools)
name = flow name or configured display name
description = flow description (or auto-generated from step descriptions)
tags = union of constituent tool tags + "flow" tag
args_schema = derived from flow's first step input schema (or flow-level input_schema if set)
output_schema = derived from flow's last step output schema
Context
Issue #24 (Flow-to-VirtualTool adapter) covers wrapping a compiled flow as a
Toolwithin ChainWeaver. But it doesn't address the cross-repo contract: exporting a flow as a weaver-specSelectableItemthat contextweaver can ingest into its catalog.This is the mechanism that directly reduces tool explosion. If an agent has 50 tools but 5 of them are always used in a 5-tool sequence, compiling that sequence into a flow and exposing it as a single
SelectableItemreduces the catalog from 50 to 46 (50 - 5 + 1). At scale, this is multiplicative.The spec contract
Per weaver-spec, a
SelectableItemhas:contextweaver's
SelectableItemis richer:A compiled flow exported as a
SelectableItemshould usekind="flow"(orkind="skill") and derive metadata from the flow definition.Why it matters
Acceptance Criteria
flow_to_selectable_item(flow: Flow, executor: FlowExecutor) -> SelectableItemfunctionid=f"flow::{flow.name}"(namespaced to avoid collisions with regular tools)kind= configured (default"skill"to distinguish from individual tools)name= flow name or configured display namedescription= flow description (or auto-generated from step descriptions)tags= union of constituent tool tags +"flow"tagargs_schema= derived from flow's first step input schema (or flow-levelinput_schemaif set)output_schema= derived from flow's last step output schemametadata={"flow_name": ..., "step_count": ..., "tool_names": [...]}SelectableItem(fromweaver_contractspackage), not contextweaver's internal typeSelectableItemvia optional parameter or separate functionexport_catalog(registry: FlowRegistry, executor: FlowExecutor) -> list[SelectableItem]weaver_contractsas optional dependencyImplementation Notes
Files likely touched:
chainweaver/export.py— new moduletests/test_export.py— newchainweaver/__init__.py— exportexamples/export_to_contextweaver.py— new exampleDependencies
VirtualTool.from_flow()provides the execution wrapper; this provides the catalog exportweaver_contractspackage as optional dependencyNotes
flow::prefix in the ID prevents collisions if a regular tool has the same name as a flow.chainweaver export --format selectable-items --output catalog.json