Create and compare branches
Explore multiple changes against the same cloud baseline without changing the live account.
Create a branch
Start with an analysis_id returned by a completed scan. Give the branch a name that describes the change you want to explore.
emfirge_create_branch({
base_analysis_id: "<analysis_id>",
name: "reduce-db-exposure"
})
Stack changes
Each successful emfirge_apply_change appends a validated mutation. The engine rebuilds from the same base and applies the entire sequence in order. Only open branches can be changed.
Use Apply changes for supported resource types and examples.
Compare alternatives
Create separate branches from the same base to compare designs. Pass their IDs to the comparison tool. The engine summarizes their modeled changes and outcomes across the documented lenses and ranks them according to its checks.
emfirge_list_branches({ base_analysis_id: "<analysis_id>" })
emfirge_compare_branches({
branch_ids: ["<branch_a>", "<branch_b>"]
})
A better modeled score is not a guarantee of application reliability or lower real-world spend.
Fork a branch
Fork an open branch to try a variation without losing the original. The child copies the parent’s base snapshot and complete ordered change log, then evolves independently, like git checkout -b.
emfirge_fork_branch({
branch_id: "<branch_id>",
name: "reduce-db-exposure-v2"
})
Roll back changes
emfirge_rollback_branch removes the most recent change. Call it again to remove another; rolling back an empty change list is a no-op. To jump back several steps at once, emfirge_rollback_branch_to_count keeps only the first N changes, and 0 returns the branch to its base. The underlying AWS account is unaffected.
emfirge_rollback_branch({ branch_id: "<branch_id>" })
emfirge_rollback_branch_to_count({
branch_id: "<branch_id>",
target_change_count: 2
})
Work safely with several agents
emfirge_get_branch returns the branch’s ordered change log and a branch_revision, a SHA-256 of its history. Pass it to apply, rollback, rollback-to-count, or discard: if another agent changed the branch in the meantime, the call fails with HTTP 409 instead of silently building on a stale view.
emfirge_get_branch({ branch_id: "<branch_id>" })
Discard a branch
When an experiment is finished, discard it. The backend marks the branch as discarded, so it can no longer accept mutations. This does not delete cloud resources.
emfirge_discard_branch({ branch_id: "<branch_id>" })