Overlaps and stacked intents
Many agents can work on one project at once, each in its own fork. Two of them editing the same file would otherwise find out at merge time. Wayglass checks for that as early as it can.
When overlaps are checked
Section titled “When overlaps are checked”The Worker compares an intent’s paths (declared and actually changed) with those of every other open or proposed intent:
- at
intent declare, using the declared paths and globs, - at every
push, using the files the push changed.
Globs are compared with each other, so docs/** and docs/guide.md overlap, as do **/*.md and src/**, which could both name src/README.md.
Overlaps are reported, not enforced. Nothing is blocked because of an overlap. People see a warning on stderr; agents get an overlaps list in the JSON data of intent declare and push. Intents with no push for STALE_INTENT_HOURS (a Worker variable, default 24) are marked stale in overlaps, intent lists and watch; they are never abandoned automatically. wayglass overlaps lists every overlapping pair in the project, or only those involving one intent:
wayglass overlapswayglass overlaps i269d1c348e --jsonEach overlap names the other intent, its goal, agent and status, and the path pairs that collide (mine and theirs).
Suggested re-plans
Section titled “Suggested re-plans”For each overlap the CLI suggests a re-plan, computed from both intents’ paths and statuses. It is a suggestion: "suggested": true in JSON, and nothing about either intent changes until an agent or person acts on it.
The rules, in order:
- One side is already proposed: it lands first, the other lands after it (
land_first). - Both pushed edits to a contested file: stack the newer intent on the older one (
stack). - Only one side pushed edits to a contested file: it lands first (
land_first). - Nothing pushed yet, and both declared the same literal file: the older intent lands first (
land_first). - Nothing pushed yet, and only globs collide: split the glob, each side declares the narrower paths it needs (
split).
In push --json, each overlap carries a replan object:
{ "action": "stack", "first": "i1f0c9a2b31", "then": "i7d42e8a0c5", "paths": ["web/login.ts"], "summary": "stack i7d42e8a0c5 on i1f0c9a2b31; both edited web/login.ts", "command": "wayglass intent restack i7d42e8a0c5 --on i1f0c9a2b31 --reason \"...\"", "suggested": true}A stack re-plan carries the command that carries it out; the reason is left for the agent. “Lands after it” works because land merges onto a moved trunk instead of rebasing; see Landing.
Re-stacking an existing intent
Section titled “Re-stacking an existing intent”wayglass intent restack <id> --on <other> --reason "..." moves an open or proposed intent onto another unlanded intent in one step, instead of declaring again and abandoning. Only the intent’s author or the admin may. The Worker forks the other intent’s fork into a new repo (<project>--<id>--r<n>; the old fork is kept and its tokens revoked), and the CLI merges the intent’s pushed commits onto the other intent’s head in a temporary worktree, checking for conflicts before anything changes, and pushes. From then on the intent is classified on its own change only and lands after the other one. A decision made before the restack becomes superseded: it leaves every queue, cannot be approved, rejected or landed, and the change is proposed again. Cycles, landed or abandoned targets and rubber-stamp reasons are refused.
The same re-stacking happens when a parent is abandoned: wayglass intent abandon <id> --reason "..." re-stacks every active child onto the abandoned intent’s base, so the child now carries the abandoned commits and must propose again. A rejected parent is not terminal (its author can fix and re-propose), so its children keep waiting.
Stacked intents
Section titled “Stacked intents”To build on work that has not landed yet, declare the new intent on top of it with --on:
wayglass intent declare --on i1f0c9a2b31 \ --goal "Lock accounts after repeated failures" \ --reason "Rate limiting alone still allows slow guessing" \ --path "web/login.ts"A stacked intent:
- forks from the parent intent’s pushed head, not from the trunk,
- is classified on its own change only (its diff base is the parent’s head), so the reviewer sees just the new work,
- is judged by the trunk’s current policy when proposed, like any other intent,
- can land only after its parent has landed;
landandsyncrefuse before that, - is not reported as overlapping its parent, since sharing the parent’s code is the point.
intent declare fetches the commit the new fork starts from (for a stacked intent, the parent’s head) and fast-forwards a clean checkout that is behind it, reported as fast_forwarded in JSON. A dirty or diverged checkout is left alone with a warning. If the Worker does not support stacking, declare --on fails with stack_unsupported rather than silently forking from the trunk.