Skip to content

feat(core): add reactor that runs incremental extract + model on source.synced #29

@mroops0111

Description

@mroops0111

Today every extract requires a human to click "Run skill". The
next step is to react to source changes automatically: when a
sync brings in new or changed intent, fire extract on just those
units and one model pass over the resulting graph. HITL stays
intact — proposals still land in the pending inbox for human
review before they touch the graph.

Scope

  • New domain port Reactor in @braidhq/core/domain/reactor/.
  • ReactorService subscribes to WorkspaceEventBus; reacts to
    source.synced only.
  • On source.synced:
    1. Call IntentExtractionLedger.diff for the synced source.
    2. For each new ∪ changed unit, dispatch braid-extract via
      the existing SkillRunner.
    3. Dispatch one braid-model pass once all extracts finish
      (or fail).
    4. Update the ledger.
  • PRODUCT.md gains:
    reactor:
      enabled: false        # off by default
      maxRunsPerHour: 5     # hard cap, fail-closed
  • SSE events on the workspace bus: reactor.dispatched,
    reactor.completed, reactor.throttled.
  • Studio: small banner under the existing in-flight-run banner.
    Reuse cancel-run plumbing.

Out of scope

  • Reacting to proposal.applied (graph-delta drift sweep).
  • Refining existing proposals; needs a Fork primitive.
  • Per-workspace budget / cost meter. Hard cap is the v0
    guardrail.
  • Cohort tracking of proposals across reactor runs.

Acceptance

  1. Service unit test with fake event bus + fake skill runner:
    emitting source.synced with 3 new units triggers 3 extracts
    then 1 model.
  2. maxRunsPerHour blocks the 6th dispatch within an hour and
    emits reactor.throttled.
  3. Dogfood: enable reactor on a workspace whose intent source
    points at this repo's issues. Close one issue, sync, observe
    extract + model fire automatically — no CLI invocation.

Depends on: #27 #28.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions