The workflow
semantic-port.fabro
Key patterns
The commit-processing loop
The core of this workflow is a loop:fetch → analyze → (port or skip) → fetch. Each iteration processes exactly one upstream commit, then loops back for the next. The loop terminates when fetch finds no more unprocessed commits and routes to exit.
Ledger-driven state
The workflow tracks disposition in an external ledger file (ledger.tsv) with three states:
The ledger is the source of truth for what’s been processed. Because it’s a plain file committed to Git, it survives across runs — you can stop and resume the workflow and it picks up where it left off.
Semantic analysis, not literal translation
Theanalyze node is the decision point. It examines each upstream commit for what changed functionally, not just what code was modified. A commit that refactors Python type hints has no semantic impact on a Go port. A commit that changes retry behavior in the HTTP client does.
This distinction is critical — routing a different model (Gemini) to the analysis node via the .analyze class brings a fresh perspective to the port/skip decision:
The fix loop
When ported code fails tests, the workflow enters a bounded fix loop:fix node has max_visits=3, preventing infinite retry cycles. If the fix can’t be resolved in 3 attempts, the run terminates rather than looping forever.
Skip vs. port branching
Theanalyze node uses routing directives to choose between two paths:
fetch immediately — no planning or implementation needed. This keeps the workflow efficient: trivial commits (typo fixes, CI config changes, docs updates) are processed in seconds.
Multi-model routing
The stylesheet assigns three tiers of models:- Sonnet handles routine tasks: fetching commits, finalizing plans, updating the ledger
- Opus handles the hard work: implementing ports and diagnosing test failures
- Gemini Pro handles analysis: a different provider brings independent judgment to the port/skip decision, reducing the risk of a single model’s blind spots
Run configuration
Pair the workflow with a run config TOML for repeatable execution:run.toml
Adapting this pattern
The semantic port pattern generalizes beyond language porting:- Spec tracking — monitor an upstream specification (OpenAPI, protobuf) and propagate changes to client libraries
- Dependency updates — process a queue of dependency version bumps, testing and committing each one
- Issue triage — pull issues from a tracker, classify them, and route to the appropriate workflow
- Log analysis — process a backlog of alerts or log entries, investigating each one
Further reading
Transitions
Edge conditions, routing directives, and how agents control flow.
Model Stylesheets
CSS-like rules for assigning models to workflow nodes.
Failures
Retry policies, loop detection, and max_visits.
Run Configuration
TOML configs for repeatable, parameterized runs.