Skip to content

Publish lease-backed work claims so preflight sees active drafts #199

Description

@catoncat

Problem

Mainline intentionally keeps drafting intents local-only. That protects unfinished turns and avoids publishing unstable fingerprints, but it leaves a coordination blind spot:

  • mainline status can discover sibling worktree drafts on the same machine.
  • mainline preflight only compares the active work against the shared proposed index.
  • mainline sync cannot make drafting work visible to another clone or machine.

As a result, several agents can start overlapping work and all pass preflight until one of them seals and publishes. Sealing early is not a good workaround: it freezes an unstable intent and contributes to the same-branch staged-proposal problem described in #186.

Desired model

Add a lightweight, lease-backed work claim that is shared separately from the local draft:

claim (shared, renewable, minimal)
  → drafting (local implementation detail)
  → finalize/seal (one immutable intent)
  → proposed
  → Draft PR

A work claim is coordination state, not a new immutable intent status.

Proposed interface

Keep the external interface small:

  • mainline claim — announce or refresh the active branch intent.
  • mainline unclaim — explicitly release it.
  • mainline preflight / sync — consume active local and remote claims automatically.

The implementation may use append-only claim/renew/release events on shared Mainline refs.

A claim should contain only:

  • intent id
  • repository identity
  • actor plus session/worktree identity
  • branch/thread
  • base commit
  • concise goal
  • partial fingerprint (goal keywords and currently known files)
  • created/updated/expires timestamps

Do not publish draft turns, seal summaries, or other unfinished detail.

Important invariants

  • Claims expire unless renewed, so crashed sessions do not create permanent blockers.
  • Exact active intent id is excluded from self-overlap.
  • Different sessions sharing the same human actor id must still see each other; conflict detection must not skip all same-actor work.
  • Local sibling worktree drafts should be surfaced immediately even before remote claim transport succeeds.
  • A failed claim publish is visible as a warning/pending state; local work can remain possible offline.
  • Seal/propose supersedes or releases the claim automatically.
  • Abandon releases the claim.
  • Claims warn by default; they block only when file/scope evidence is strong enough under an explicit policy.

Preflight behavior

Add a distinct overlap kind such as active_claim_overlap containing:

  • intent id
  • branch/thread
  • actor/session
  • matched files or goal keywords
  • lease freshness
  • local sibling vs remote source

Recommended next actions should be inspect/coordinate/re-scope, not seal the other agent's draft.

Relation to #186

This issue owns early work visibility. #186 owns same-branch proposal lineage and final PR closeout.

Together they avoid both failure modes:

  1. hidden drafts that duplicate work;
  2. premature repeated seals that leave noisy staged proposals.

Acceptance criteria

  • Starting a non-trivial intent can produce a shared claim without sealing it.
  • Another worktree on the same machine sees the claim in its next preflight.
  • Another clone sees the claim after sync.
  • Same-actor/different-session claims are not silently excluded.
  • Expired/released claims stop appearing.
  • Sealing/publishing leaves one immutable intent and removes the active claim.
  • No draft turns or unfinished seal payload are placed in shared state.
  • Tests cover local sibling, remote clone, lease expiry, release, same-actor concurrency, publish failure, and claim-to-proposal transition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions