Skip to content

feat(core): batch checkpoints + source-unit-state, ontology-driven#32

Open
mroops0111 wants to merge 5 commits into
masterfrom
feat/source-unit-state-and-checkpoints
Open

feat(core): batch checkpoints + source-unit-state, ontology-driven#32
mroops0111 wants to merge 5 commits into
masterfrom
feat/source-unit-state-and-checkpoints

Conversation

@mroops0111

@mroops0111 mroops0111 commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Closes #27.

Summary

  • Introduce SourceUnitState: framework-level record of "what extract has observed per source unit". File-per-entity at artifacts/source-unit-state/<sourceId>/<path>.json.
  • Introduce OntologyPlugin.batch binding. Framework owns the batch lifecycle and chunk accounting; ontology declares which skills it dispatches at each step:
    • perUnit (the extract step)
    • checkpoint (between-units hook with chunkSize + runAtEnd + extraEnv)
    • deriveUnits (fallback when the workspace has no intent source)
  • BatchPlan.checkpointPhases records every checkpoint run plus the units it consumed; BatchPlan.batchPolicy snapshots the ontology binding at start() so UI labels / anticipated chunks survive resume and ontology config changes.
  • Checkpoint proposals auto-apply alongside extract proposals when autoApply is on (previously only extract proposals applied).
  • batch.archive commits to git history as batch-archive so the audit trail stays continuous.
  • Subprocess auth: caller's Bearer token is forwarded via BRAID_TOKEN env and --auth-type bearer --auth-token '${BRAID_TOKEN}' on the openapi-mcp-gateway, so spawned claude can call the auth-gated REST API.
  • /openapi.json is now public (industry convention) and SSE endpoints accept ?token=... because EventSource cannot send custom headers.
  • Studio Batch page restructured: per-group / per-checkpoint sections with ontology-supplied action labels, unified N/M counter tone, neutral badges to reduce visual noise.

DDD ontology wires braid-extract / braid-model / braid-scan with labels Extract / Model.

mroops0111 and others added 4 commits June 7, 2026 23:41
The sidebar previously only showed workspaces from the active server,
forcing users to round-trip through Settings to see what was on other
servers. Now every configured remote renders as its own section so the
full inventory is visible in one glance and a single click switches
both server and workspace.

- api: rawFetch helper splits transport from singleton resolution so
  the new fetchJsonAt(remoteId, ...) can target any remote without
  disturbing the active one
- useAllRemoteWorkspaces hook parallel-fetches /workspaces from every
  remote via useQueries; unauthenticated and unreachable states are
  surfaced so the sidebar can render Sign In / error affordances inline
- useResetOnRemoteChange clears the react-query cache when the active
  remote flips so workspace-scoped queries don't return stale data from
  the previous server
- Sidebar renders one section per remote with Notion-style heading
  (Laptop / Globe icon + name); clicking a workspace from a non-active
  remote silently switches active before navigating
- ListRow gains stripeClassName / stripeDim so the row can advertise
  which remote it belongs to via a 2px left-edge bar that coexists
  with the active indicator
- Details affordance moved from <button> to <span role="button"> to
  resolve a long-standing nested-button HTML validity warning

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
list() now skips unreadable rootPaths with a warn-level log so one
ghost entry doesn't block boot. load() unchanged. Also drops the
unused api.registerWorkspace shim in Studio whose server endpoint
was removed earlier.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`SourceUnitState` records what extract has observed per source unit;
framework-level entity, ontology-neutral, file-per-entity at
`artifacts/source-unit-state/<sourceId>/<path>.json`.

`OntologyPlugin.batch` binding declares the skills the framework
dispatches: `perUnit` (extract), `checkpoint` (between-units hook
with chunkSize + runAtEnd + extraEnv), `deriveUnits` (scan-mode
fallback). Framework owns lifecycle and chunk accounting; ontology
owns skill ids and env contracts. DDD wires braid-extract /
braid-model / braid-scan with labels "Extract" / "Model".

`BatchPlan.checkpointPhases` is the append-only record of every
checkpoint run plus the units it consumed; `BatchPlan.batchPolicy`
snapshots the ontology binding at start() so UI labels and
anticipated chunks survive resume and ontology config changes.

Other changes:
- Checkpoint proposals auto-apply alongside extracts when autoApply
  is on (previously only extract proposals applied).
- `batch.archive` commits to git history (`batch-archive` kind).
- Subprocess auth: caller Bearer token forwarded via `BRAID_TOKEN`
  env and `--auth-type bearer --auth-token '${BRAID_TOKEN}'` on the
  openapi-mcp-gateway, so claude can call the auth-gated REST API.
- `/openapi.json` public (industry convention; spec describes shape,
  not data) and SSE endpoints accept `?token=...` because
  EventSource cannot send custom headers.
- Studio Batch page restructured: per-group/checkpoint sections,
  ontology-supplied action labels, unified `N/M` counter tone,
  neutral badges to reduce visual noise.

Refactor: extract `enrichCommitAuthor`, `extractBearerToken`,
`runSkillWithAutoApply`, `aggregateUnitsTone` helpers; replace
`as XxxId` casts with `XxxId.parse(...)` in every touched file;
remove dead code.

Closes #27.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(core): run braid-model after batch extract; add intent-extraction ledger

1 participant