Skip to main content
A semantic port workflow tracks commits in an upstream repository, analyzes each one for relevance, and either ports the change to a different codebase or acknowledges it as not applicable — then loops back for the next commit. It’s an autonomous maintenance loop, not a one-shot build task. This pattern is useful when you maintain a downstream implementation (e.g., a Go SDK) that tracks an upstream reference (e.g., a Python SDK). Instead of manually reviewing every upstream commit, the workflow processes the backlog commit-by-commit, making intelligent port-or-skip decisions.

The workflow

Semantic Port workflow: Start → Fetch → Analyze → Plan → Implement → Validate → Tests pass? → Finalize → loops back to Fetch, with Skip shortcut from Analyze back to Fetch, Fix loop from gate back to Validate, and Done exit from Fetch
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.
This is fundamentally different from a build workflow that runs once and exits. The semantic port workflow is designed to process an entire backlog autonomously, handling dozens of commits in a single run.

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

The analyze 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:
The 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

The analyze node uses routing directives to choose between two paths:
When the agent decides a commit is irrelevant, it updates the ledger, commits the acknowledgment, and loops back to 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
Launch with:

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
The core structure is always the same: fetch the next item, analyze it, decide on an action, execute, record the disposition, loop.

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.