This document defines the Git branching, rebasing, and merging discipline for Holon.
- Every intent gets its own branch
- All work happens in branches, never directly on
main mainis the canonical "promoted" state- Branches are cheap; exploration is encouraged
- Intents can spawn sub-intents recursively
- Each sub-intent gets its own intent branch, nested under the node whose stage decided the split (the deciding node, sections 2.2-2.3 and 8). The branch is cut from the deciding node's branch and merges back into it, and its provenance records that node
- In practice a split is decided by a plan: the planner writes a
## Sub-intent listin its plan, and the flow runs each item as a sub-intent nested under that plan, which sits between the intent and its sub-intents in the hierarchy. This is what the flow does and what every worked example in this document shows. The model leaves other stages open -- a split may also be decided at the intent, execution or review stage, as long as the hierarchy is honoured (section 2.2) - Depth is capped:
holon flowrefuses to nest sub-intents more thanMAX_SUB_INTENT_DEPTHlevels below the root intent (see Stage 3 under the flow equivalence guarantee)
- Root intents (top-level intents) require human review before merging to
main: the maintainer's PR merge is the only human step, and no stage before it waits for a human - Sub-intents merge only into the branch of their deciding node (in practice the plan branch that listed them),
never directly into
main. Below the root no human intervention is needed: the agent raises each sub-intent's PR automatically and merges it automatically into the deciding plan or execution branch, for leaf sub-intents and nested parents alike (sections 4.1, 4.2 and 13). Only the root intent's PR tomainstops for a human (the flow behaviour is specified once, in Stage 3 under the flow equivalence guarantee) - This applies recursively: sub-sub-intents merge into the deciding node inside their parent sub-intent, and the root
intent's whole tree reaches
mainonly through the root PR
- Root Intent: Top-level intent that will eventually merge to
main(requires human review) - Parent Intent: Immediate parent of a sub-intent in the tree (may itself be a sub-intent)
- Deciding Node: The intent, plan or execution branch whose stage decided the split (in practice the plan). Its branch is the sub-intent's branch base and merge target
- Sub-Intent: Any intent spawned from another intent, in practice by the plan that decided the split (can have its own sub-intents)
- Root intent, sub-intent, plan and execution IDs are generated using the current Unix timestamp.
- An intent ID is the timestamp plus the slug. A plan or execution ID is the timestamp plus the runner's ticker and the
model code (section 2.5.2), so it is unique only under its parent: a plan is always keyed by its intent and plan ID
together (plan file, calibration report,
plans.jsonllookups and the duplicate check), and an execution by its fullI-.../P-.../E-...path. - Siblings under one deciding node always have different slugs, so their intent IDs (timestamp plus slug) cannot collide, even when they are created in the same second.
- Example:
I-1771422315-example-intent,P-1771422316-CLA-CS4.6,E-1771422317-CLA-CS4.6
Any branch in the hierarchy that can have child branches (including root intents, nested sub-intents, and plan variants)
must finish with the /_ suffix. This serves as a terminal leaf node for that specific directory level, preventing
branch/sub-branch naming collisions in Git and enabling the creation of a clean, filesystem-like hierarchy.
I-{timestamp}-{slug}/_
Example:
I-1771890389-refactor-metrics/_
A sub-intent's branch nests under the branch node whose stage decided the split, with no child marker in the name. An intent can have several competing plans (section 2.4), so a branch nested only under the intent would not say which plan spawned the sub-intent; nesting under the deciding node records it in the branch path itself.
| Split decided by | Sub-intent branch |
|---|---|
| The intent stage | I-{timestamp}-{slug}/I-{timestamp}-{slug}/_ |
| A plan (in practice) | I-{timestamp}-{slug}/P-{timestamp}-{ticker}-{model code}/I-{timestamp}-{slug}/_ |
| An execution | I-{timestamp}-{slug}/P-{timestamp}-{ticker}-{model code}/E-{timestamp}-{ticker}-{model code}/I-{timestamp}-{slug}/_ |
| A review | The reviewed plan's node or the reviewed execution's node (either is acceptable; a review has no branch node of its own) |
In practice, splits are decided by a plan: the planner writes a ## Sub-intent list in its plan, the executor records
it, and the flow runs each item as a sub-intent nested under that plan. Example:
I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890392-improve-estimators/_
For illustration of the general rule only, the same sub-intent would be named as follows had the split been decided at the intent stage or during execution:
I-1771890389-refactor-metrics/I-1771890392-improve-estimators/_
I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/E-1771890391-CLA-CS4.6/I-1771890392-improve-estimators/_
The sub-intent's own plan and execution branches continue below its node:
I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890392-improve-estimators/P-1771890398-CLA-CO4.6/_
I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890392-improve-estimators/P-1771890398-CLA-CO4.6/E-1771890399-CLA-CO4.6/_
Whichever node decided the split, the sub-intent branch is cut from the deciding node's branch and merges back into it
(sections 3 and 4.1): a plan-decided sub-intent is cut from and merges into that plan branch (I-.../P-.../_), an
execution-decided one is cut from and merges into that execution branch (I-.../P-.../E-.../_), and for an intent-stage
split the deciding node is the intent branch itself (I-.../_). A sub-intent's flow checkpoint is keyed on its intent
branch, so a child and a grandchild sharing a slug never overwrite each other's.
Provenance. A sub-intent's intents.jsonl row and its plan header record the node that decided the split:
parent_intent_id: the parent intent.deciding_branch: the deciding node's branch (I-.../_,I-.../P-.../_orI-.../P-.../E-.../_).parent_plan_id: the deciding plan, when a plan, an execution of that plan or a review decided the split (a review-decided split records the reviewed plan).parent_execution_id: the deciding execution, when an execution decided the split, or when a review-decided split nests under the reviewed execution.target_branch: the branch the sub-intent merges into, which is the deciding node's branch (equal todeciding_branch).
The specific item of the deciding node's sub-intent list is identified by the sub-intent's own recorded goal and description.
{
"intent_id": "I-1771890392-improve-estimators",
"parent_intent_id": "I-1771890389-refactor-metrics",
"deciding_branch": "I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_",
"parent_plan_id": "P-1771890390-CLA-CS4.6",
"target_branch": "I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_"
}Promotion. If an operator promotes a sub-intent to its own root intent, the root intent records its source plan
(parent_plan_id), so the lineage is not lost even though the new root no longer nests under that plan.
Deeper nesting repeats the pattern. For plan-decided splits:
I-{timestamp}-{slug}/P-{timestamp}-{ticker}-{model code}/I-{timestamp}-{slug}/P-{timestamp}-{ticker}-{model code}/I-{timestamp}-{slug}/_
Example:
I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890392-improve-estimators/P-1771890398-CLA-CO4.6/I-1771890400-p-success/_
Pattern: Each level appends the deciding node and the sub-intent to the path, creating a filesystem-like hierarchy.
Plan branches are created as siblings to the /_ node within the same intent directory, using a timestamped identifier
to allow for multiple competing proposals.
I-{timestamp}-{slug}/P-{timestamp}-{ticker}-{model code}/_
Example:
I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_
Execution branches are branched off a specific plan, appending the action slug to the plan's path to maintain a strict lineage from intent to proposal to implementation.
I-{timestamp}-{slug}/P-{timestamp}-{ticker}-{model code}/E-{timestamp}-{ticker}-{model code}/_
Example:
I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/E-1771890391-CLA-CS4.6/_
GitHub rejects a push whose full ref name is too long. Measured against the real service, a full ref of 255 characters,
counting the refs/heads/ prefix (11 characters), is accepted and 256 is rejected, so a branch name without the prefix
can be at most 244 characters. One module, sandbox_executor/ref_names.py, owns the limit (MAX_REF_LENGTH = 255) and
every branch name the engine creates goes through it: the root intent, plan, execution and calibration branches, and
every decomposed child intent, plan and execution branch at any depth.
- Calibration rule: the calibration branch ends in
/calibratedwhere the others end in/_, which is 9 characters more. Every name is therefore measured as if it ended in/calibrated:len("refs/heads/" + name + "/calibrated")must be at most 255. - A name that fits is unchanged. No existing branch, checkpoint or ledger row changes.
- Shortening order: when a name is over the limit, only the parts the engine controls are cut, in this order: the
child slug, then the root intent slug. Plan and execution segments are short (section 2.5.2) and never shortened. A
cut part keeps a prefix of its original text and ends in a 6-character hexadecimal digest (
sha256, first six characters) of the full original text, so two different long inputs never collide and the same input always gives the same name. A part is cut only as far as needed and never below the digest alone. - Never touched: timestamps, tickers, model codes and the
--{n}-child markers. - Room for what comes next: an intent branch is measured with room left for one plan and one execution segment below it, using the real ticker and model code of the configured runner and model (a reserved length when they are not known yet). A plan is measured with room for the execution below it.
- Slug limit: a slug is at most 32 characters, for a root intent and for each child intent. A root slug supplied in
the intent file that is longer is rejected when the intent is opened, before any branch exists, with a message giving
the limit and the length; a slug the engine derives (from a description or a sub-intent title) is cut to 32 characters
at a word boundary. A root intent and two levels of nested child intents, each with a 32-character slug, fit the limit
(including
refs/heads/and/calibrated) with no shortening; deeper nesting falls back to the slug shortening above and the length check. - Resume: a resumed flow keeps the names it already created. The recorded
branch(intent), the checkpoint and the per-child progress entries are used as they are and the shortening rule is never re-run on them. - Ledger: the original text stays recoverable. An intent row records
original_slugonly when its slug was shortened. Plan and execution rows record the fullagentandmodel; the ticker and model code appear only in names. Older rows may still carryoriginal_agentandoriginal_modelfrom the retired label shortening; readers accept them. - Failure: if a name cannot fit even after shortening, Stage 1 fails before any branch exists, naming the limit, the
computed length and the segment that cannot be shortened (for example
the segment that cannot be shortened is 'parent'). If a push is still rejected for ref length, the host push fails withref too long: branch <name> (<n> characters). A child branch name that cannot fit at Stage 3 fails that stage with the same named limit rather than raising.
A new plan is P-{epoch}-{ticker}-{model code} and a new execution E-{epoch}-{ticker}-{model code}, with no hex, for
example I-1794567515-sleepfix/P-1794567531-CLA-CS5.5/E-1794567598-CLA-CS5.5/calibrated.
- Ticker: each runner that may run a flow declares a ticker of exactly three uppercase letters beside its definition
in
agent_defaults.py:claude-agentisCLA,antigravity-agentisANAandpi-agentisPIA. A ticker is never reassigned or reused, and a test fails when two runners share one. A runner with no ticker is rejected byholon doctorand when an intent is opened, before any branch is created, with a message naming the runner; there is no fallback. - Model code: derived from the model name by a pure rule (
sandbox_executor/naming.py, no table): anything before a/is dropped, each word contributes its first letter in upper case, version numbers are kept and joined with a dot, and every character invalid in a git ref is removed.claude-sonnet-5-5isCS5.5,claude-fable-5isCF5,gemini-3.8-flash-mediumisG3.8FM,gpt-5-codexisG5Candanthropic/claude-opus-5-5isCO5.5. - Same parent, same second: two plans or executions that would get the same name under the same parent never
overwrite each other: the second gets a deterministic
-2(up to-9) variant, and fails clearly once those are taken. Two intents planned in the same second by the same runner and model may share a plan ID; they never collide, because every plan is keyed by its intent (its plan file, its calibration report and itsplans.jsonlrow), and every execution by its full path. - Older generations stay valid:
P-{epoch}-{agent}-{model}andP-{epoch}-{hex}-{agent}-{model}(and the same forE-) are still parsed, found and calibrated everywhere. No existing ID is renamed, because existing IDs match the head branch names of the pull requests that carried them.
Plan files follow the branch name. The plan on {parent}/{plan id}/_ lives at plans/{parent}/{plan id}.md and its
calibration report beside it at plans/{parent}/{plan id}_calibration.md, mirroring the full nesting: a root intent
(plans/I-.../P-....md), a child intent (plans/I-...--{index}-{slug}/P-....md) and a plan nested under another plan
(plans/I-.../P-.../P-....md). sandbox_executor/plan_paths.py owns the layout. Plans created before this layout were
moved once by scripts/migrate_plan_layout.py; a plan file that no branch could be found for lives under
plans/legacy/.
/_ is the Intent Root (The "What") /P-.../_ is the Plan (The "How") /P-.../E-.../_ is the Execution (The "Do")
The five stages form one lifecycle (Stage 3 admission, refresh):
| Stage | Name | CLI Command | Artifacts & Outputs |
|---|---|---|---|
| 1. Intent | Intent Initialisation | holon intent <intent.json> |
Intent branch I-.../_ + holon-knowledge/ledger/intents.jsonl |
| 2. Plan | Plan Generation | holon plan <intent_branch> |
Plan branch I-.../P-.../_ + plans/I-.../P-*.md + plans.jsonl |
| 3. Execute | Sandbox Execution | holon execute <plan_branch> |
Execution branch I-.../P-.../E-.../_ + executions.jsonl |
| 4. Review Loop | PR Review Loop | holon review-loop <execution_branch> |
PR raised + sandboxed reviewer ensemble (unanimity) + micro-actions in executions.jsonl |
| 5. Calibrate | Calibration Analysis | holon calibrate <execution_branch> |
/calibrated branch + plans/I-.../P-*_calibration.md (included in PR diff) |
holon flow runs host git operations (checkouts, commits, pushes) in its target worktree, so it never uses a worktree
that has the default branch checked out. Naming the main worktree as --target-worktree, or running from it with the
default ., selects the repository and the base branch only:
- Redirect: when the target worktree has the intent's
target_branchchecked out (origin/mainandmainare the same branch here), the run happens in the sibling worktreeflow-<slug>next to the repository's top-level directory, on branchflow-<slug>branched offorigin/<target_branch>. An existingflow-<slug>worktree is reused as it is. The redirect is logged at info level and happens after the pre-flight probe and before any stage, so every stage, the checkpoint and the run summary (target worktree: <path>, andtarget_worktreein--jsonoutput) use the flow worktree. The main worktree'sHEAD, branch andgit statusare never changed. - Other branches: a target worktree on any other branch is used as it is. A detached
HEADis not a default-branch checkout. Bare and absent targets keep the existing auto-provisioning. - Checkpoints: a new checkpoint records the flow worktree. Resuming from a checkpoint whose recorded
target_worktreehas the default branch checked out fails before any stage runs, with an error naming theflow-<slug>worktree to pass as--target-worktree(passing the main worktree explicitly redirects the resume as above). Nothing is created by the refusal. - Engine guard:
run_flow_pipelinealso fails the first stage, before any stage or checkpoint, when the context's target worktree has the base branch checked out, so callers that bypass the CLI are protected too. - Direct commands:
holon review(and itsreview-loopandpr-review-loopaliases) andholon calibratecommit review and calibration records to the branch they run on, so they refuse a worktree that has the repository's default branch (the branchorigin/HEADpoints at, otherwisemain) checked out, with an error naming the path and how to create a dedicated worktree. Run them in theflow-<slug>worktree of the run instead.
holon flow <intent.json> is equivalent to running the five commands above by hand, in order. Stages 1-3 call the same
dispatch function as holon intent, holon plan and holon execute (dispatch_role_agent in cli.py), so they
launch the same containers with the resolved runner and model: holon/agent-<runner> for the planner and executor, and
holon/orchestrator for the intent creator (which does not run a model). Those containers author every Stage 1-3
branch, plan file and ledger row; the flow only fetches origin, adopts the branch each container pushed and validates
it, except that it appends a superseding failure row to an empty execution's branch (see the limits below). A branch is
adopted only if it was not on origin before the container was dispatched and its name carries the dispatched runner
and model; when no such branch or more than one appears, the stage fails instead of guessing, so neither clock skew
between host and container nor a concurrent run under the same parent branch can redirect the flow. Stages 4 and 5 run
the same review loop and calibration code as holon review-loop and holon calibrate. Because Stages 1-3 leave the
host checkout where holon flow started, Stages 4 and 5 each first check out the adopted execution branch (and fail if
it cannot, for example because local changes would be overwritten; nothing is discarded), so the review loop's ledger
rows and the Stage 5 calibration report and ledger reconciliation land on that branch even on a resume that enters at
Stage 5. The conflict probes of Stages 2-5 name the branch each stage works from (Stage 1 has none yet), and the review
records the execution branch's tip, freshly fetched from origin, as the reviewed commit, never the operator's HEAD.
Stage 5 also syncs with origin before it reads or branches anything, because containers and out-of-band conflict
resolution push to origin/<execution_branch> without moving the local ref (flow/calibrate_sync.py owns this):
- Fetch and base: Stage 5 fetches the execution branch and fast-forwards a local ref that is behind. The
/calibratedbranch is created from theoriginhead, so calibration analyses exactly the reviewed and approved head. Whenoriginhas no such branch (a--skip-pushrun), the local ref is used. - Divergence: a local ref holding commits that
originlacks stops Stage 5 with an error naming the branch, both SHAs and the recovery (git push origin <branch>, or a deliberategit branch -f <branch> origin/<branch>, then resume). Nothing is reset, forced or overwritten. - Guaranteed fast-forward: because the
/calibratedbranch descends from theoriginhead,merge --ff-onlyonto the execution branch succeeds and the report reaches the PR without a merge commit. A failure is logged, not ignored. An existing/calibratedbranch that lacks theoriginhead is reported as stale, with the command to delete it. - Restored worktree: the branch (or detached commit) that was checked out before the flow first moved
HEADis checked out again when Stage 5 ends, including on failure. A failed restore is a warning and never changes the stage result.
Stage 3 never halts for a human. The executor's outcome is judged against the plan's persisted entropy budget (see Turn and Stage Budgets):
-
Fits the budget: the plan is executed as usual.
-
Explicit sub-intent list: the plan row holds the list; the executor only records a
decomposedsummary that refers to it (plan_decision, see Ledger Schema) and writes nointents.jsonlrows. The flow then runs each item as a child intent, strictly one after another and never concurrently, through the full pipeline (intent, plan, execute, review, calibrate). Nesting is bounded byMAX_SUB_INTENT_DEPTH, checked against the plan before the executor is dispatched when the plan can be read.- Nesting under the plan branch. Each child is named
{plan}--{n}-{slug}(the plan branch without/_, the item's 1-based position and its sanitised slug) and records the plan branch that listed it as both itstarget_branchand itsparent_intent_id, never the intent branch and nevermain. Stage 1 cuts the child fromorigin/{plan branch}, so it starts from the plan branch tip as it stands then. The plan branch comes from the flow context, else from the decision record; when neither is known, Stage 3 fails rather than fall back. - One after another, each merged before the next. A child is ready to merge when its own Stage 4 reached consensus
approval (
StageStatus.APPROVED, or legacyStageStatus.HALTED_FOR_HUMAN) and its Stage 5 succeeded (or was skipped by flag). The flow then merges the child's PR into the plan branch withflow/github/merge.py: a merge commit when the repository allows it, otherwise a squash (gh pr merge --mergeor--squash, always with--match-head-commit; a failed merge-method lookup or neither method allowed refuses), CI green andMERGEABLE, after first merging the plan branch into the child head if it moved; a base ofmain,master, the repository default branch or anything other than the plan branch is refused, as is a PR head that is protected or is not the child's recorded execution branch (see Safety). Only after that merge does the next child start, so it is cut from a tip that already holds every earlier child's merge or squash commit. The first child that fails or is not ready marks its progressfailed; one refused only by the merge guard staysreview_donewith amerge_error, so a resume retries just the merge. Either way the parent's Stage 3 fails, naming the child; later children do not start.--dry-runand--skip-pushfail at the first child (no consensus approval, no PR number to merge). - The combined PR. After the last child merged, Stage 3 merges the plan branch into the parent execution branch
with a merge commit and appends a superseding
decomposedsummary row withintegrated: true, theplan_branchand the list ofchildren(slug, intent and execution branch, PR number and URL, merge commit). The parent's own Stage 4 and Stage 5 then run as for any execution: Stage 4 raises and reviews one combined PR from the parent execution branch into the intent'starget_branch, carrying the parent plan, the parent execution record and every child's plan, execution record and code, and completesAPPROVEDfor maintainer merge when that target ismain. A child that itself decomposed is merged into this plan branch through its own combined PR in the same way. - Resume. Per-child progress (
children_progress: intent branch, execution branch, PR, status and merge commit) lives in the parent's Stage 3 payload and is checkpointed after every change, and each child keeps its own checkpoint keyed on its branch. Resuming a decomposed Stage 3 never dispatches the parent executor: the recorded progress is reconciled with origin (origin wins), merged children are skipped, a reviewed child is merged, a child with an execution branch or a PR resumes from its own checkpoint, and only a child with nothing recorded anywhere is dispatched. Ledger-only conflicts during these merges keep every row of the checked-out side in place and insert the merged side's appended rows at theircreated_atslot; any other conflict fails the stage. The same reconciliation runs on a fresh Stage 3 (--from-stage executewithout the parent checkpoint), and an unexpected exception in the loop fails Stage 3 while keeping the recorded progress.
The
holon flowsummary lists each child's PR (or branch) and whether it was merged into the plan branch, nests a child that itself decomposed with its own children below it, and names the combined PR that Stage 4 raises. - Nesting under the plan branch. Each child is named
-
Over budget without a list: the flow returns to Stage 2 automatically, asking for a smaller plan or an explicit sub-intent list (only a smaller plan when the intent is at the sub-intent depth limit), at most
MAX_REPLAN_ATTEMPTStimes; then Stage 3 fails with a message naming the entropy, the budget and the attempts. When the plan can be read, the flow refuses each over-budget plan before dispatching the executor, so those attempts create no execution branch and append noexecutions.jsonlrow; each rejected plan keeps itsplans.jsonlrow, and the refusals are recorded only in the flow's stage results, log and checkpoint. When the plan cannot be read before dispatch, the executor refuses the plan itself and the flow reads theover_budgetrow it records on an execution branch (exit code 3). That row also covers a directholon executerun, which exits with code 3 (so the refusal is not mistaken for success) only when that row is committed and then either pushed or kept local because pushing is disabled, and with code 1 otherwise (see Entropy Budget and Decomposition Evaluation).
The guarantee has five deliberate limits:
- No fabricated plans. If no planner agent produced
plans/I-.../P-*.mdon a plan branch under the intent branch, Stage 2 fails; the flow never writes a plan from a template. On entry to Stage 2, the stage adopts the newest complete plan branch of the intent when one already exists (complete: itsplans.jsonlrow and the plan file that row records both exist at the branch ref), pushes it first when it exists only locally, and logs the adopted branch and every candidate it ignored. The checkpoint names the plan branch before the host pushes it. An engine re-plan (over budget or a touch-set violation) always plans afresh; to plan afresh by hand, delete the plan branch locally and onorigin, then resume with--from-stage plan. - Empty executions fail. An execution branch with no changes outside
holon-knowledge/ledger/,plans/andexecutions/relative to its plan branch (content merged in from the target branch does not count) is recorded asstatus: "failed"(failure_reason: "empty_diff", notest_pass_rate), Stage 3 fails and no PR is created or updated. The same guard runs insideholon executeand in every non-dryholon review-looprun, whatever--auto-pris, whether or notghis installed and for every target (a PR number or URL is first resolved to its head SHA and base branch, and the head SHA is compared with the PR's own base branch, or with the intent's target branch whenghreports no base; a PR whose base cannot be resolved or fetched isdiff_unverified); for an execution branch it first fetches the execution and plan branches and compares the origin copies the PR is opened from, and for any other branch it fetches both that branch and the base, so stale or unpushed local branches never decide it (a failed fetch, or a git command that times out, skips the PR asdiff_unverified; only a repository without anoriginremote compares its local branches). Inside the mounted review-loop container the guard never fetches, because the container has nossh: before dispatch the host fetches the plan, execution and base branches intorefs/remotes/origin/, and the guard only resolves those refs. A ref the host did not fetch isdiff_unverifiedwith a refusal naming the branch and saying the host must fetch it before dispatch (a branch that exists only locally in the container is refused as well, even when it resolves); a failed host fetch stops the stage before the container starts. The execution-branch comparison (_execution_effective_diff) follows the same rule, and no other fetch is reachable from the review-loop container: the remaininggit fetchcallers are host-side code (among others: the child-branch prefix and snapshot fetches of Stages 1 to 3, the merge helper, calibration,git_flow.fetch_origin_branch, the PR-worktree provisioning fetch) or guarded byworkspace_mounted()(_pr_head_ref). When the guard refuses the PR (empty_diffordiff_unverified), the review loop fails closed: it does not wait for CI, runs no review iteration and posts no consensus, so no evidence -- not even a Stage 3test_pass_rateof 1.0 or green CI on an existing PR -- can approve it. The loop returnsapproved: falsewith the refusal as itserror(anempty_diffrefusal appends no ledger rows; adiff_unverifiedrefusal appends only afailed"halted without consensus" summary row naming it and the review action event, with noACT-REV,ACT-FINDorACT-POSTrows), and Stage 4 fails with the refusal's own reason (Autonomous review halted: Refusing to create or update a PR for ...), never as a test failure or as unmeasured tests, so Stage 5 does not run. An empty diff has consensus statusrejectedand an unverifiable onefailed. Dry runs never invoke the guard, dispatch no reviewer and are never approved: a clean simulation reportsnot_measured. A consensus whose post to the PR fails or raises ispost_failedand not approved, andholon review-loopexits 1 unless the ensemble verdict isAPPROVEDand the consensus is approved and posted. - Dispatch needs
origin.--dry-runvalidates the payload and names the branches without dispatching anything.--skip-pushis rejected outside--dry-run-- on every run, including a--from-stageor--checkpointresume from any stage -- before any stage runs, because the host fetches from and pushes tooriginfor the role containers, Stage 4 opens the PR fromorigin, Stage 5 pushes/calibrated(push checks). - Unmeasured tests are never a pass. The executor container runs
uv run task testafter the agent's turn and before the execution commit, and recordstest_pass_rate, the counts,test_exit_codeand anytest_run_errorin itsexecutions.jsonlsummary row (bounded byHOLON_TEST_MEASUREMENT_TIMEOUT_SECONDS, default 900). Stage 3 carries them; when the row records no rate, it isnull("not measured"). A measured rate below1.0, or a non-zero test exit code, is a failed test result that Stage 3 and Stage 4 treat as failed. Stage 4 reportstest_resultswith itssourceand counts (pass_rate: null,measured: false,passed: nullwhen unmeasured). The Stage 4 test gate judges the currentHEADcommit, never reusing stale Stage 3 results across commits, by the precedence in Test evidence and its source; only whenreview_localcannot execute does it reportNOT_MEASUREDand withhold consensus. Before a clean gate's CI probe, when the head lacks confirmed resolver or Stage 3 evidence, the loop waits for CI checks to register on the PR (whenghis available; up toHOLON_CI_REGISTRATION_TIMEOUTseconds, default 180,0disables the wait), without consuming review iterations or writing ledger rows. If none register andreview_localcannot run, the loop stops after that single iteration with consensus statusnot_measured(one iteration's review rows and one summary row), Stage 4 fails withtest results not measured: no recorded Stage 3 test result and no CI checks, and the pipeline halts before Stage 5 calibration runs. Checks that registered but are still pending are waited out on their own CI wait budget (see CI wait budget and outcomes), never the iteration'sreview_iterationbudget.--dry-rundoes not wait, and its simulated consensus reportsnot_measured. Stacked sub-intent pull requests, whose base is the plan branch that listed them, receive the same checks as pull requests intomain, because every CI workflow runs for pull requests into any base branch (see.github/workflows/README.md). - Token reduction is auto-detected.
holon flow(likeholon review-loop) resolves token reduction withdetect_holon_coherence: unlessHOLON_TOKEN_REDUCEopts out (0,false,no,off), it is enabled by--token-reduce,--mitm-web, a truthyHOLON_TOKEN_REDUCEorHOLON_PASSIVE_MONITORING, a reachable proxy port, a local holon-coherence or mitmproxy image, or aholon-coherencebinary onPATH, and the result is passed to the Stage 1-3 containers.holon intent,holon planandholon executeenable it only on the explicit opt-ins (--token-reduce,--mitm-web,HOLON_TOKEN_REDUCE,HOLON_PASSIVE_MONITORING), so on a host where detection succeeds the flow routes the role containers through the proxy and the manual commands do not. To launch identical containers either way, pass--token-reduceto the manual commands or setHOLON_TOKEN_REDUCE=0for both.
Reviewer ensemble. Every Stage 4 iteration is decided by real reviewers: after the mergeability and CI probes,
run_review_loop() runs --ensemble-size (default 3, on both holon flow and holon review-loop) independent,
mutually blind reviewer agent turns on the real diff between the base and the resolved head SHA
(sandbox_executor/review_ensemble.py). Approval needs every reviewer to approve with zero findings, plus a mergeable
PR and green CI; zero or failed reviewers, any finding (a single nit) and unknown CI never approve. There is no
automatic resolver: the first iteration that is not approved stops the stage, its ACT-FIND rows are recorded in
executions.jsonl and the command exits 1. The posted report contains only real reviewer data and is posted only when
at least one reviewer completed. Reviewer turns run only inside the sandbox. holon review-loop runs the loop in the
review-loop role container. When holon flow Stage 4 runs on the host, it dispatches reviewer turns into the
review-loop role container via _dispatch_role() and retrieves verified reviewer outcomes across a structured result
file transport, preserving host ownership of mergeability verification, CI gating, and official review posting. If
container dispatch fails, it fails closed before any PR review is approved. See the
sandbox-executor README.
Consensus integrity. The loop decides consensus only from what the reviewers returned; role, container and adjudication checks can only withhold an approval. See review_consensus.md.
Host worktree workspace. Every Stage 4 reviewer-ensemble and resolver dispatch runs in a fresh --rm container that
works in place on the run's flow-<slug> worktree, bind-mounted from the host together with the git directories its
.git pointer names; the repository config, hooks, git pointers and the whole worktrees/ administrative directory are
mounted read-only, so no sibling worktree's admin files are reachable, with only the mounted worktree's own admin
directory re-mounted read-write on top. The container never clones, fetches, pushes, resets or cleans: it validates that
HEAD is on the review branch and equals the resolved head SHA, and fails closed otherwise. Edits, logs and tmp/review/
scratch are on the host at once and survive a container crash. No Docker volume or root init container is involved.
Canonical ACT-REV/ACT-FIND/ACT-RES/ACT-POST rows and the summary row remain host-written. A standalone
holon review-loop <PR> reuses the worktree that has the PR's head branch checked out (normally flow-<slug>) and
creates a pr<N>-<slug> worktree only when none exists. See the
sandbox-executor README. One worktree for every stage.
The Stage 1 intent creator, Stage 2 planner, Stage 3 executor and Stage 4 review-loop and resolver all run in the same
mounted flow-<slug> worktree with the same protections; none clones. No container touches the remote: roles only
commit, the host fetches the base before each container starts and pushes the committed branch after it returns (Stage 1
the intent branch, Stage 2 the new plan branch, Stage 3 every new execution branch including a failed one, Stage 4's
resolver head fast-forward only). Before the Stage 4 review-loop container starts, the host also fetches the plan,
execution and base branches, so the container's diff check resolves them without fetching. A failed host fetch or push
names the operation, branch and remote. No ssh-agent or repository URL variable is involved, so an SSH origin works.
Waiting for CI and judging code run on different clocks. After the reviewers approve, the review loop waits for pending
GitHub checks under a wall-clock CI wait budget of HOLON_REVIEW_CI_WAIT_SECONDS (default 1800 s, in seconds, at most
7 days). A value that is not a number, is not finite, is zero, negative or above 7 days is invalid: the loop logs a
warning that names the variable and keeps 1800 s, so the wait cannot be switched off through the variable. The wait is
not drawn from the review_iteration budget, so a slow runner never costs an iteration. Polling backs off from
CI_REGISTRATION_POLL_SECONDS (15 s), doubling each poll to a ceiling of CI_WAIT_POLL_CEILING_SECONDS (120 s), so
the intervals are 15, 30, 60, 120, 120 s and so on. The wait ends as soon as no check is pending, or as soon
as any check has failed (that is already a CI failure, so the remaining checks are not waited on).
That first-failure rule applies to the review gate only. Before the host pushes a resolver fix, the loop waits for the
pipeline run being fixed to settle, under the same HOLON_REVIEW_CI_WAIT_SECONDS budget and without stopping at the
first failure, because a pull-request push cancels the run still in progress and the failures it would report later
would be lost. The wait runs only when a push will follow (the pass succeeded, its head moved, skip_push is off and
the target has a head branch) and only for GitHub CI. A spent budget logs the checks still pending and pushes; a probe
or failure-lookup error is logged and never blocks the push.
The settled run is recorded per fixed head in the checkpointed review state as review_state.fixed_runs[<sha>]:
checks (each failed check with name, run_id, conclusion, failed_steps, its classification from the CI
failure routing, failing_test_ids and log_tail), handed (the failed checks the resolver pass already saw),
pending (the checks still pending when the wait ended) and recorded_at (UTC, YYYY-MM-DDTHH:MM:SSZ), with
review_state.last_fixed_head naming the latest. Both log fields come from gh run view <run> --log-failed, scoped
with --job <job> when the check link names a job and falling back to the whole run otherwise: failing_test_ids lists
the pytest node ids that failed, and log_tail keeps the last 25 non-empty log lines, redacted and then cut to at most
1500 characters. An unreadable log leaves [] and '' and never blocks the push or loses the rest of the record. The
next resolver pass receives one FIND-CI-<iteration>-RUN finding naming each recorded check, with its run id, failed
steps, failing test ids and log tail, that is classified as a defect, was not handed over yet, and is neither passing
nor already failing on the current head (a failing one is already in that iteration's FIND-CI finding), so it does not
wait for the new head's run to report the failure again. Each check is handed over once. A timing-gate, runner or
cancelled failure is recorded with its class but never handed over, and the row is added only after the approval checks,
so an approved head is never blocked by it.
A CANCELLED or STALE check counts as failed, never as passed, while a NEUTRAL one still passes. After a clean
review on the host, each failed run is classified on its own, and every noise run (a timing gate, a runner failure or a
cancelled run) is rerun once: a cancelled run as a whole, any other noise run by its failed jobs. This holds when the
noise classes are mixed and when the noise sits beside a defect, in which case the defect goes to the resolver at once
without waiting for the rerun. A noise check that shares its run with a defect is not rerun, because rerunning the run's
failed jobs would also rerun the defect. The names of the noise checks rerun on the head are kept in the checkpointed
review_state.ci_routing.noise_rerun, and those checks are left out of the FIND-CI-<iteration> finding; when only
such checks failed, no FIND-CI finding is handed over. A noise check still red after its one rerun is no longer left
out and goes to the resolver as before.
The budget applies per wait, not per loop: each iteration that reaches the post-review CI gate gets a fresh wait, so a
loop of N iterations whose checks each settle after a long wait can spend up to N times the budget. A wait that ends
because the budget is spent is recorded in the loop result (and the posted consensus data) as ci_wait
(state: pending, budget_seconds, waited_seconds, pending_checks); while the same checks stay pending, later
iterations on the same head do not wait again. The record is cleared once a later iteration sees nothing pending, or
when the resolver pushes a new head (the new head's pending checks get their own wait), so it never contradicts the
final ci_checks. Checks still pending at the deadline are unknown: never all_passed, never a failed test run, and
after a clean review no FIND-CI finding is recorded for them unless the local test run itself failed. A dry run, a
dirty mergeability state, a missing ref or a review infrastructure failure skips the wait, and there pending checks
still count as not passed and record FIND-CI.
When the review ends without approval, the Stage 4 error says which outcome occurred:
| Outcome | Stage 4 error |
|---|---|
| CI still pending | CI still pending after the wait budget: <names> still running after <budget> s ...; no test failed. |
| CI failed | CI failed: <every failed check name>. |
| Tests not measured | test results not measured: no recorded Stage 3 test result and no CI checks. |
test suite reported failures appears only when the local test run really failed. When nothing specific blocked the
review, the error says no specific blocker was recorded instead of blaming the tests.
Stage 5 pushes the calibration commit to the execution branch, which starts CI again on a head the reviewers did not
vote on. After that push, and only then, Stage 5 waits for the checks on that head with the same wait facility and
budget (HOLON_REVIEW_CI_WAIT_SECONDS) and records the outcome as final_head_ci in the stage result, the stage log
and the flow summary:
| State | Meaning |
|---|---|
success |
Every check on the final head passed. |
failed |
At least one check failed, a CI Timing Gate step included; the names and durations are kept. |
unknown |
CI was not measured, or checks were still pending when the budget ran out. Never success. |
skipped |
Nothing was pushed: a dry run, --skip-push or a failed calibration. |
A job that exceeds its time limit is a failed check, so a timing-gate failure fails the final-head check like any other.
The job's failed steps and duration come from one extra gh run view call and only annotate the failure, for example
final head CI: failed: macos-unit (CI Timing Gate, 6 min).
A runner can be slow on identical code, so a timing-gate failure on unchanged code is rerun before consensus is
withdrawn. When every failing check failed only in its timing-gate step, no check is pending, and every path changed
between the approved head and the measured head is a bookkeeping record (plans/, executions/, holon-knowledge/) or
nothing changed, Stage 5 reruns the failed jobs up to three times in sequence. Each attempt starts only when the
previous one is still a timing-gate-only failure on unchanged code, and the first green result ends the loop. Any
changed code, test or workflow path, an unreadable diff, any other failing check or any pending check means no rerun.
The record final_head_ci.timing_rerun keeps attempted, run_ids (of the first attempt), outcome (of the last
attempt), attempts and outcomes (one state per attempt), and reason when a rerun could not be dispatched.
Consensus is withdrawn only when the last attempt still fails.
The rule applies to every check whose failed steps are all timing-gate steps: a step whose name starts with
CI Timing Gate or a step named exactly Timing gate. That covers the unit jobs on ubuntu-latest and
macos-latest, including both macOS unit shards (CI Timing Gate (compare with main)), the Workspace survival and
build-images jobs (Timing gate), and the hygiene, integration, make, docker-build, CI durations and promote-ledger
jobs (CI Timing Gate (Check ...)).
Stage 5 then re-verifies the head it published and records ci_verdict in the stage result, with the approved head, the
final head and whether the head moved:
green(or nothing pushed): Stage 5 ends as a success.red: Stage 5 ends asfailed, with an error naming each failing check. The pull request is not reported as ready to merge, and a child sub-intent is not merged. The calibration commit stays pushed.unverified: CI was not measured or was still pending. The report says "not verified" and "not merge-ready"; it is never reported as ready to merge.
When the verdict is red and Stage 4 posted an approval, Stage 5 posts one follow-up comment saying the consensus
approval no longer stands. It names the head the approval covered, the failing head and each failing check, with the
duration for a timing gate. A hidden marker holding the failing SHA keeps it to one comment per head; a pull request
whose comments cannot be listed gets no comment. The approval itself names the head it covers and the measured CI result
at that commit (for example "11 of 11 checks passed"), so a re-approval on a later green head names its own head.
When the only failing check is a timing gate, the resolver finding names the slowest tests of the failing job (five at
most, from the ci-timing-* artefact or the job log's --durations section) and says to speed them up or split the
job. It never offers a rerun. When the tests cannot be fetched, the finding says so and points at
pytest --durations=10. Apart from the bounded rerun on unchanged code, Stage 5 never reruns CI; it never changes the
300 s timing limit, and the merge stays with the human maintainer.
Merging to main is reserved for the human maintainer. On Stage 4 consensus approval (StageStatus.APPROVED,
[REVIEW APPROVED]) and Stage 5 calibration, the flow completes and leaves the PR ready for human merge; it never
merges itself. StageStatus.HALTED_FOR_HUMAN ([SAFETY HALT]) is reserved for dry-run and manual-intervention halts;
no earlier stage waits for a human, and merging the PR is the only human step.
Every sub-intent must rebase from its deciding node's branch (in practice the plan branch I-.../P-.../_), not the
parent intent branch (section 2.2):
- Before execution (to get that branch's latest state)
- After execution (to ensure clean merge)
Building on siblings. Siblings build on each other through the deciding node's branch: a sub-intent that depends on
earlier siblings starts from, or rebases onto, that branch only after those siblings have merged into it, so no
sub-intent is implemented blind to the work it depends on. The before-execution rebase of the dual rebase rule is that
step. holon flow cuts each child from the plan branch tip only after the previous child merged into it (see Stage 3
under the flow equivalence guarantee).
Before execution:
$ git checkout I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890392-improve-estimators/_
$ git fetch origin
$ git rebase origin/I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_After execution:
$ git fetch origin
$ git rebase origin/I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_If rebase fails:
- Log conflict to ledger
- Spawn reactive intent to resolve conflict
- If unresolvable automatically, escalate to human
Trigger: Sub-intent execution completes successfully. The agent raises the sub-intent's PR into the deciding plan or
execution branch automatically and merges it automatically, with no human intervention. This holds for a leaf sub-intent
and for a nested parent alike; a nested parent merges once its own sub-intents have merged into their deciding node
inside it, and its PR carries that deciding node's branch. holon flow performs these merges with merge commits
(squashes on a squash-only repository) through the guarded child merge (see Stage 3 under the flow equivalence
guarantee).
In the worked commands a leaf sub-intent's merge source is written as its intent branch (I-.../_), shorthand for the
branch that carries its work and that its PR carries; a nested parent's merge source is the branch of the deciding node
inside it (the plan or execution that decided its own sub-intents), which its PR carries.
Process:
- Evaluate all completed sub-intents under the same deciding node
- Compute
merge_valuefor each:merge_value = impact_actual - conflict_risk - entropy_actual - redundancy_penalty - Filter by success (
success_actual == 1) - Sort by
merge_value(descending) - Merge sequentially or in parallel (based on conflict detection)
Example:
# Sub-intent completes: the agent merges it into the deciding plan branch
$ git checkout I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_
$ git merge --no-ff I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890394-add-logging/_
# Automatic for every sub-intent, no human review
$ git push origin I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_Ledger event:
{
"event_type": "git_merge_attempted",
"payload": {
"intent_id": "I-1771890394-add-logging",
"from_branch": "I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890394-add-logging/_",
"to_branch": "I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_",
"status": "success",
"merge_type": "automatic_sub_intent",
"human_review_required": false
}
}Trigger: All sub-intents merged, root intent ready for promotion
Root PR: once all sub-intents have merged into their deciding node's branch, the root intent's PR to main is
raised, reviewed (Stage 4) and calibrated (Stage 5) on the combined diff, stopping at the human merge boundary. This is
the only human stop in the tree. A nested parent is a sub-intent and merges automatically into its deciding node's
branch as in section 4.1. In holon flow the root PR is the combined PR that the root's own Stage 4 raises from its
execution branch after the plan branch was integrated into it (see Stage 3 under the flow equivalence guarantee).
Process:
- Generate review package:
- Intent goal and constraints
- Predicted vs actual metrics
- Diff summary
- Test results
- Calibration errors
- Request human review
- Human approves or rejects
- If approved, merge to
main
Example:
# Human reviews
$ holon review approve I-1771890389-refactor-metrics
# System merges
$ git checkout main
# The root PR carries the deciding plan branch, into which every sub-intent merged
$ git merge I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_
$ git push origin mainLedger event:
{
"event_type": "intent_promoted_to_main",
"payload": {
"intent_id": "I-1771890389-refactor-metrics",
"merge_sha": "abc123",
"reviewer": "human@example.com"
}
}Forbidden:
- Sub-intent merging directly to
mainor into any branch other than its deciding node's branch (the tree reachesmainonly through the root intent's PR) - Merging without prior rebase
- Merging failed intents (unless explicitly overridden by human)
Allowed:
- Discarding sub-intents (close branch without merging)
- Multiple sub-intents merging into the same deciding node's branch
- Recursive sub-intent trees up to
MAX_SUB_INTENT_DEPTHlevels below the root intent
def compute_merge_value(sub_intent):
return (
sub_intent.impact_actual
- estimate_conflict_risk(sub_intent)
- sub_intent.entropy_actual
- compute_redundancy_penalty(sub_intent)
)def estimate_conflict_risk(sub_intent):
# Check file overlap with other pending sub-intents
overlapping_files = find_overlapping_files(sub_intent)
# Check if files are "hot" (frequently modified)
hot_file_penalty = sum(is_hot_file(f) for f in sub_intent.files_modified)
return len(overlapping_files) * 5.0 + hot_file_penalty * 2.0def compute_redundancy_penalty(sub_intent):
# Check if another sub-intent already solved the same problem
siblings = get_sibling_intents(sub_intent)
for sibling in siblings:
if solves_same_problem(sub_intent, sibling):
if sibling.merge_value > sub_intent.merge_value:
return 1000.0 # High penalty, discard this one
return 0.0def sequential_merge(sub_intents, deciding_branch):
# Sort by merge_value descending
sorted_subs = sorted(sub_intents, key=lambda s: s.merge_value, reverse=True)
for sub in sorted_subs:
rebase_onto(sub, deciding_branch)
if rebase_successful():
merge_into(sub, deciding_branch)
log_merge(sub, "automatic_sequential")
else:
handle_conflict(sub)def parallel_merge(sub_intents, deciding_branch):
# Cluster by file overlap
clusters = cluster_by_file_overlap(sub_intents)
for cluster in clusters:
if cluster.no_internal_conflicts():
# Merge all in parallel
for sub in cluster:
rebase_and_merge(sub, deciding_branch)
else:
# Fall back to sequential within cluster
sequential_merge(cluster, deciding_branch)# Root intent
$ git checkout main
$ git checkout -b I-1771890389-refactor-metrics/_
# Deciding plan: cut from the root intent branch and pushed, so sub-intents can be cut from it
$ git checkout -b I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_ I-1771890389-refactor-metrics/_
$ git push origin I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_
# Sub-intent: nested under the plan that decided the split, cut from that plan branch, which it targets
$ git checkout -b I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890394-add-logging/_ origin/I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_- Work happens in the branch
- Commits are made
- Tests run in sandbox
- Metrics measured
$ git rebase origin/I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_The agent raises the sub-intent's PR and merges it automatically into the deciding plan branch, whether the sub-intent is a leaf or a nested parent (section 4.1).
# The sub-intent branch merges automatically into the deciding plan branch
$ git checkout I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_
$ git merge --no-ff I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890394-add-logging/_
$ git push origin I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_$ holon review approve I-1771890389-refactor-metrics
$ git checkout main
# The root PR carries the deciding plan branch, into which every sub-intent merged
$ git merge I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_
$ git push origin main# Delete merged branches
$ git branch -d I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890394-add-logging/_
$ git branch -d I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_
$ git branch -d I-1771890389-refactor-metrics/_Intent Hierarchy (each split decided by a plan):
I-1771890389-refactor-metrics (root)
└── P-1771890390-CLA-CS4.6 (plan, decided the split)
├── I-1771890392-improve-estimators (sub-intent)
│ └── P-1771890398-CLA-CO4.6 (plan, decided the split)
│ ├── I-1771890400-p-success (sub-sub-intent)
│ ├── I-1771890401-entropy (sub-sub-intent)
│ └── I-1771890402-impact (sub-sub-intent)
├── I-1771890394-add-logging (sub-intent)
└── I-1771890395-add-tests (sub-intent)
Git branch structure:
main
└── I-1771890389-refactor-metrics
├── _
├── P-1771890390-CLA-CS4.6
│ ├── _
│ ├── I-1771890392-improve-estimators
│ │ ├── _
│ │ └── P-1771890398-CLA-CO4.6
│ │ ├── _
│ │ ├── I-1771890400-p-success
│ │ │ └── _
│ │ ├── I-1771890401-entropy
│ │ │ └── _
│ │ └── I-1771890402-impact
│ │ └── _
│ ├── I-1771890394-add-logging
│ │ └── _
│ └── I-1771890395-add-tests
│ └── _
└── P-1771890397-ANA-G3.6F
├── _
└── E-1771890403-CLA-CS4.6
└── _
P-1771890397-ANA-G3.6F is a competing plan for the same root intent; the sub-intents sit under
P-1771890390-CLA-CS4.6, the plan whose ## Sub-intent list created them.
Sub-intents merge into the deciding plan branch, not the parent intent branch. Every merge below the root is raised and merged automatically by the agent.
-
Depth 2 → deciding plan inside the sub-intent (automatic):
I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890392-improve-estimators/P-1771890398-CLA-CO4.6/I-1771890400-p-success/_→I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890392-improve-estimators/P-1771890398-CLA-CO4.6/_I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890392-improve-estimators/P-1771890398-CLA-CO4.6/I-1771890401-entropy/_→I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890392-improve-estimators/P-1771890398-CLA-CO4.6/_I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890392-improve-estimators/P-1771890398-CLA-CO4.6/I-1771890402-impact/_→I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890392-improve-estimators/P-1771890398-CLA-CO4.6/_
-
Depth 1 → root's deciding plan (automatic):
I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890394-add-logging/_→I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_(leaf sub-intent)I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890395-add-tests/_→I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_(leaf sub-intent)I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/I-1771890392-improve-estimators/P-1771890398-CLA-CO4.6/_(the nested parent's PR, carrying the deciding plan branch inside it) →I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_(nested parent, after step 1)
-
Root → Main (human review, the only human step):
- The root intent's PR, carrying the combined diff of
I-1771890389-refactor-metrics/P-1771890390-CLA-CS4.6/_, →main(after human approval)
- The root intent's PR, carrying the combined diff of
def auto_resolve_conflict(sub_intent, deciding_branch):
# Try simple strategies
if conflict_is_whitespace_only():
accept_deciding_branch_version()
return True
if conflict_is_import_order():
sort_imports()
return True
if conflict_is_non_overlapping():
accept_both_changes()
return True
return False # EscalateTarget-sync code conflicts first go to the conflict-resolver role. The reactive intent is
decided during the sub-intent's execution, so it nests under that execution (section 2.2): its deciding_branch and
target_branch are both that execution branch, which it is cut from and merges back into automatically. Like Example 3
in Examples, this illustrates the general rule only; the plan-decided split stays the practice.
import time
def handle_conflict(sub_intent):
spawn_intent(
{
"intent_id": f"I-{int(time.time())}-resolve-conflict",
"parent_intent_id": sub_intent.intent_id,
"deciding_branch": sub_intent.execution_branch,
"parent_plan_id": sub_intent.plan_id,
"parent_execution_id": sub_intent.execution_id,
"target_branch": sub_intent.execution_branch,
"goal": f"Resolve rebase conflict in {sub_intent.conflict_files}",
"intent_type": "reactive",
"trigger": "rebase_conflict",
}
)All Git operations are logged to the ledger:
{
"event_type": "git_branch_created",
"payload": {
"branch": "I-1771890389-refactor-metrics/_"
}
}
{
"event_type": "git_rebase_completed",
"payload": {
"status": "success",
"conflict_files": []
}
}
{
"event_type": "git_merge_attempted",
"payload": {
"status": "success",
"merge_type": "automatic_sub_intent"
}
}
{
"event_type": "intent_promoted_to_main",
"payload": {
"merge_sha": "abc123"
}
}Sub-intents should be discarded (branch closed without merging) when:
- Execution failed (
success_actual == 0) - Negative merge value (
merge_value < 0) - Redundant with higher-value sibling (another sub-intent solved the same problem better)
- Conflicts with higher-value sibling (unresolvable conflict, lower-value intent discarded)
- Entropy budget exceeded (sub-intent consumed too much entropy)
# Close branch and delete locally/remotely
$ git branch -D <branch-name>
$ git push origin --delete <branch-name>Even discarded intents provide value:
- Failure modes extracted to KB
- Calibration data (predicted vs actual metrics)
- Negative examples (what not to do)
| Operation | Automatic? | Human Review? | Rebase Required? |
|---|---|---|---|
| Sub-intent → Deciding node merge | ✓ Yes | ✗ No | ✓ Yes (before & after) |
| Root intent → Main merge | ✗ No | ✓ Yes | ✓ Yes (before) |
| Branch creation | ✓ Yes | ✗ No | N/A |
| Conflict resolution | Attempted | If fails | N/A |
| Sub-intent discard | ✓ Yes | ✗ No | N/A |
Key insight: Human review is required only at the root intent level: the root intent's PR to main is the only
human stop. Every sub-intent merge, for leaf sub-intents and nested parents alike, is raised and merged automatically by
the agent into the deciding node's branch, evaluation-based and with no human intervention.
Sections 13.2 and 13.3 describe the decided model. In the current flow the children of a sub-intent list run one at a time, and the first failing child fails the parent's Stage 3, so the remaining children do not run, nothing is merged automatically and no stage waits for a human.
If a root intent has no sub-intents (leaf intent):
- Execute directly in root intent branch
- Still requires human review before merging to
main
If all sub-intents under a parent fail:
- Parent intent is marked as failed
- If parent is root intent, human review requested (may choose to retry or abandon)
- If parent is sub-intent, it is discarded automatically
When Stage 3 is resumed (holon flow --checkpoint ... --from-stage execute) and the mounted worktree holds uncommitted
edits from an interrupted run, the host commits them onto the failed execution branch of the plan as a partial-work
commit (execute: <execution_id> partial work (interrupted) for plan <plan_branch>) and records it in
executions.jsonl, then resumes from that commit. The ledgers and the execution notes file are excluded, so dirty
engine-owned files alone produce no commit. Nothing is discarded, reset or amended, and the commit stays on the
execution branch, never on main or the plan branch. A never-pushed execution branch reaches origin only in the one
push that already carries its salvage row.
- The override is recorded once per plan. A Stage 3 run admitted by
--allow-overlapappends itsadmission_overriderow to the plan branch'sexecutions.jsonlonly when no such row for the plan exists yet, so a resume under the same override adds no commit to the plan branch. - Partial work from an earlier plan tip is kept. A recorded
partial_headqualifies when it descends from the current plan tip, or when its fork point lies on the plan branch's first-parent history after the intent branch tip and every first-parent commit of the plan branch since changed onlyholon-knowledge/ledger/*.jsonlor is a Stage 3 refresh merge (plan_refresh.md). The executor then merges the current plan tip into the new execution branch (ledger conflicts keep the plan side's rows in place and insert the execution rows bycreated_at), so the branch always descends from today's plan tip. Any other merge conflict aborts the merge and the execution starts from the plan tip. - The branch tip is preferred. When the failed execution branch's tip strictly descends from the recorded
partial_head, adds more than the failure commit's ledgers and notes, and passes the same lineage rule (a merge oforigin/mainto settle a sync conflict, for example), the resume starts from the tip; no hand-written ledger row is needed. A tip that does not contain the recorded head is passed over and the log says why. - An execution branch is pushed only with its ledger row. After Stage 3 dispatch the host pushes a new execution branch only when its tip carries the execution's summary row (any status). A branch whose executor failed before committing that row stays local in the host worktree, untouched, and the Stage 3 log names it.
If some sub-intents succeed and others fail:
- Successful sub-intents, leaf or nested parent, merge automatically into their deciding node's branch
- Failed sub-intents discarded
- Parent intent continues with merged work
If a root intent remains open for extended period (e.g., weeks):
- Periodic rebase from
mainrecommended - System entropy monitoring triggers maintenance
- Human may choose to merge incrementally or wait for completion
- Each sub-intent should have a single, clear goal
- Avoid "mega sub-intents" that do too much
- Better to have more sub-intents with smaller scope
- Track which files are "hot" (frequently modified)
- Consider sequential execution for sub-intents touching hot files
- Use finer-grained decomposition to reduce overlap
- Don't let branches diverge too far
- Rebase from the deciding node's branch regularly, not just before/after execution
- Reduces conflict resolution cost
- Discard low-value sub-intents early
- Don't wait for all sub-intents to complete before merging high-value ones
- Keep branch count low to reduce system entropy
metrics.md— merge value calculation, entropy formulasexamples.md— concrete examples of merge flowsledger_schema.md— event logging for Git operationsarchitecture.md— overall system design