Skip to content

Refactor/uri graph minimal kernel#2

Merged
mkotelnikov merged 3 commits intomainfrom
refactor/uri-graph-minimal-kernel
May 1, 2026
Merged

Refactor/uri graph minimal kernel#2
mkotelnikov merged 3 commits intomainfrom
refactor/uri-graph-minimal-kernel

Conversation

@mkotelnikov
Copy link
Copy Markdown
Contributor

No description provided.

mkotelnikov and others added 3 commits April 28, 2026 15:48
Introduce a persistent URI dependency graph kernel with workers as async
generators and a single-writer orchestrator driving a fixpoint loop over
two interchangeable repository backends:

- MemoryGraphStore: in-memory state with abstract persistence
  (lock/load/store/unlock); ships FilesApi-JSON snapshot adapter and an
  in-process variant for tests.
- SqlGraphStore: libSQL/Turso (Node + browser/OPFS) via @statewalker/db-api.

Both backends pass one shared contract test suite (defineGraphStoreContract),
guaranteeing isofunctional behaviour. End-to-end pipeline test runs the full
file -> text -> chunk -> embedding -> index flow against both stores.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…repo-internal links

The previous README was minimal. Rewritten to follow the project's README rules
(What it is / Why it exists / How to use / Examples / Internals / License) with
self-contained content — no relative links to other packages or notes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ermarks

Replaces the prior package (~3200 LOC, 7 SQL tables, staging/run-history,
content-hash no-op rule, scope/role machinery) with a minimal core:

- Engine.runWorker / Engine.stabilize fixpoint over a Store interface.
- Workers are async generators with selects/emits scheme prefixes; the
  engine streams resources whose latest event has stamp > worker watermark.
- Per-worker watermark is the completion stamp minted after the worker
  generator finishes; by construction it is greater than every input or
  output stamp the run touched, so filter workers (consume input, produce
  nothing) advance their watermark and never spin.
- Store has two interchangeable backends: MemoryStore (in-process, kept as
  production-grade for in-memory cell evaluation) and SqlStore (libSQL via
  @statewalker/db-api). Same WorkerFn runs against either.
- Three append-only tables: resources(uri,stamp,status,meta),
  completions(worker,stamp,finished_at), workers(name,selects,emits) plus
  a single-row stamp_seq counter. No staging, no run history, no hashes.
- Operator-driven: store.invalidate(prefix) emits 'removed' events to
  cascade re-execution; purgeResources / purgeCompletions for retention.
- topoLayers is introspection-only; the engine is data-driven by stamps.

Source: 521 LOC (engine 69, sql 224, memory 113, types/store/topo/index).
Tests: 624 LOC including a shared store contract suite exercising both
backends and an e2e pipeline test parametrised over MemoryStore + SqlStore.
All 41 tests pass; tsc clean; biome clean.

Design exploration: notes/2026-04/2026-04-25/10.dependencies-exporation.md
Implementation plan: notes/2026-04/2026-04-25/11.dependencies-implementation-plan.md
Minimal redesign:    notes/2026-05/2026-05-01/notes.md
@mkotelnikov mkotelnikov merged commit 01a058f into main May 1, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant