You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Status: rev 4, 2026-10-23. Final revision: all substrate work lands in SpaceGraphJS so any dependent benefits; OpenCode changes stay minimal (thin derivers + adapters). Supersedes TODO.7–TODO.9. Preserves original IDs (T19–T33, G19–G33, D23–D28); new substrate tasks T34–T71, G34–G42.
Testing philosophy: unchanged — integration over unit, golden fixture + contract tests, visual regression for layouts, property-based for pure functions, E2E for user flows.
The Split: SpaceGraphJS owns the substrate, OpenCode owns the vocabulary
The rule: if a feature is domain-agnostic (kernels, derivers, queries, layouts, spatial, a11y, serialization, diff, registry), it lives in SpaceGraphJS. If it names a domain concept (session, turn, commit, file, directory, issue), it stays in OpenCode as a thin definition over the substrate.
What other dependents gain: any app (IDE, debugger, data explorer, CI dashboard) can import { Kernel, pipe, GraphQuery, LayoutStrategy, SpatialIndex2D, Registry } from '@spacegraphjs/kernel' and build their own map with their own vocabulary — the same substrate OpenCode uses.
SpaceGraphJS Work
New package: @spacegraphjs/kernel (dependency-free)
Lives at spacegraphjs/packages/kernel/. Zero runtime dependencies (same discipline as @spacegraphjs/renderer). No THREE, no DOM, no host vocabulary — pure graph substrate.
ClusterSpec (in adapter config): { id, match(node), getLabel(members), layoutHint? } → adapter derives GroupLayout bands/chips in RenderModel. Expansion state flows from ViewState.
Cluster chip renders; expand/collapse changes drawn children
T48
Group rendering in @spacegraphjs/renderer contract: RenderNode.shape: 'group' + GroupLayout { id, bounds, children } in RenderModel. All four renderers (cytoscape, webgl, svg, +future) implement.
Visual regression: groups draw in each renderer; conformance test passes
Upgrade main spacegraphjs — layouts and continuous
Task
Description
Verify
T49
LayoutStrategy interface aligned with kernel: compute(kernel, constraints) → LayoutState, optional computeIncremental(prev, changes). Port force/grid/lane/tree; accept edge weight for force attraction.
Smooth expand/collapse; no thrash on rapid toggles; budget respected
Conformance suite
Task
Description
Verify
T51
@spacegraphjs/kernel/conformance — contract tests any host or extension runs: invariants, codec round-trip, deriver composition, query semantics, a11y completeness. Hosts run it against their registries.
OpenCode registry passes; example extension passes; failures name the broken contract
OpenCode Work (minimal, thin)
packages/session-ui/src/graph/ — domain derivers on the kernel
The existing GraphBuilder class and attachWorkspace become thin derivers. buildGraph keeps its exact signature — internally it becomes buildSessionKernel + pipe(domainDerivers).
Task
Description
Verify
T52
buildSessionKernel(messages, status, sessionID?, lineage?) — port of current builder loop; emits session/turn/phase/message/tool/file/... nodes into a SessionKernel. Same node ids, same edges.
Navigation (T28) — g-grammar and search built on GraphQuery.queryMacros in the OpenCode registry. Help overlay generated from the registry table.
Mixed-domain results; every mnemonic jumps correctly
T57
Lens control (T27) — profiles = saved deriver-set presets in ViewState; Domains menu composes deriveScope; empty states from registry clusterSpecs/derivers metadata.
Profile applies domains+layout once; custom after manual edit
T58
Adaptive UI (T33) — cluster chips from ClusterSpec + ViewState.expansion; continuous transitions via T50.
Toggle animates; state persists reload; no layout thrash
Remaining T19–T28 gates verified end-to-end; budgets in CI
Total: 19 days. Slices 1–2 make SpaceGraphJS valuable standalone. Slice 3 proves parity. Slices 4–6 light up the universal features for every dependent.
Hosts and plugins verify against the same contracts
70
SpatialIndex2D is THREE-free; core SpatialIndex stays for WebGL
Two paths: substrate R-tree for logic, THREE BVH for the WebGL renderer
71
LayoutStrategy lives in kernel interface, main lib implements
Strategies are substrate; renderers are consumers
Immediate Next Action
Slice 1 — create spacegraphjs/packages/kernel/ with Kernel, SessionKernel, WorkspaceKernel, KernelCodec, diffKernels + property/conformance tests. Dependency-free, same discipline as @spacegraphjs/renderer.
Then Slice 3 gate: port OpenCode's GraphBuilder to buildSessionKernel + domain derivers; both golden fixtures (model.golden.json, model.golden.with-snapshot.json) byte-identical; all existing tests pass with buildGraph's signature unchanged.