Skip to content

feat(workspace-lens): @metaharness/workspace-lens — Jacobian-Lens interpretability primitive (ADR-238)#129

Merged
ruvnet merged 1 commit into
mainfrom
feat/workspace-lens
Jul 7, 2026
Merged

feat(workspace-lens): @metaharness/workspace-lens — Jacobian-Lens interpretability primitive (ADR-238)#129
ruvnet merged 1 commit into
mainfrom
feat/workspace-lens

Conversation

@ruvnet

@ruvnet ruvnet commented Jul 7, 2026

Copy link
Copy Markdown
Owner

What / why

A new standalone package, @metaharness/workspace-lens — a runtime Jacobian-Lens interpretability primitive for open-weight LLMs, companion to Anthropic's "Verbalizable Representations Form a Global Workspace in Language Models" (2026-07-06) and its reference code anthropics/jacobian-lens.

Instead of asking "what does this activation predict now?" (logit lens), it reads what the activation is disposed to make the model say later:

lens_l(h) = unembed(J_l · h)

…turning the model's functional workspace into workspace tokens, a layer-by-layer thinking trajectory, drift/entropy scores, vectorized safety flags, and a signable interpretability receipt — the basis for runtime Interpretability Operations (IntOps) / mechanistic governance.

Design decisions

  • Runtime-only. APPLIES a fitted lens (J_l·h + softmax — zero backward passes), so it can run in a governance hot path, not only 1% shadow sampling. Fitting is external (open-weight model + backward pass — see the reference repo).
  • Model-agnostic + dependency-free. The LensArtifact carries the vocab + unembedding, so scoring never touches a tokenizer. Pure TS over number[] (node built-ins), deterministic.
  • Cross-family vocab alignment solved at the concept-direction level: a canonical concept name → a per-model J-space vector (ConceptVector), matched by cosine, never cross-applied across modelId. So Qwen's and Gemma's hidden_objective align by name, not token string.
  • Decision rule: decide() = taskResolved && drift<θ && noCriticalFlags && receiptCoverage===1 (auditable reasons on reject).

Modules

linalg (matVec / cosine / softmax / entropy / Jensen–Shannon / topK) · lens (WorkspaceLens.readout/project) · safety (vectorized triggers → the 4 headline flags) · drift (workspaceDrift + entropyTrajectory) · receipt (buildReceipt + sha256) · decision.

Tests / integration

  • 17 synthetic $0 tests (no model): the projection math, readout top-token, cross-model concept isolation, drift 0-vs-jump, the decision rule, the end-to-end receipt, and the acceptance-test mechanism shape (a mid-layer readout surfaces an un-emitted abstract judgment for a "12+5=1" prompt).
  • tsc clean; healthcheck 8/8 (version-coherence allowlist updated); wired into build-ordered phase 1.
  • Publishes automatically as a standalone @metaharness/* package on the next release tag.

ADR-238 records the decision + the honest framing (a measurement primitive, not a consciousness claim — the paper frames the workspace connection as functional).

🤖 Generated with claude-flow

…erpretability primitive (ADR-238)

A runtime measurement primitive for the "verbalizable workspace" of open-weight LLMs (Anthropic,
2026-07-06, "Verbalizable Representations Form a Global Workspace"). Reads lens_l(h)=unembed(J_l·h) into
workspace tokens, a layer trajectory, drift/entropy, vectorized safety flags, and a signable
interpretability receipt — the basis for runtime "Interpretability Operations (IntOps)".

Design:
- Runtime-only: APPLIES a fitted lens (a pair of matrix-vector products + softmax — zero backward
  passes), so it can run in a governance hot path, not just shadow sampling. FITTING is external
  (open-weight model + backward pass; reference anthropics/jacobian-lens).
- Model-agnostic + dependency-free: the LensArtifact carries the vocab + unembed, so scoring never
  touches a tokenizer. Pure TS over number[] (node built-ins only), deterministic.
- Cross-family vocab alignment solved at the concept-DIRECTION level: canonical concept name → per-model
  J-space vector (ConceptVector), matched by cosine, never cross-applied across modelId — so a Qwen
  "hidden_objective" and a Gemma one align by name, not token string.
- decide() = taskResolved && drift<θ && noCriticalFlags && receiptCoverage===1 (reasons on reject).

Modules: linalg (matVec/cosine/softmax/entropy/JS-divergence/topK), lens (WorkspaceLens: readout +
project), safety (vectorized triggers → flags), drift (workspaceDrift + entropyTrajectory), receipt
(buildReceipt + sha256), decision. 17 synthetic $0 tests (math, readout, cross-model isolation, drift,
decision, end-to-end receipt, acceptance-test mechanism shape); tsc clean; healthcheck 8/8.

Wired into build-ordered phase 1 + healthcheck version-coherence allowlist. Publishes as a standalone
@metaharness/* package on the next tag (non-private workspace package). README documents the triage
deployment tiers, circuit-breaker pattern, the acceptance test, and the fitting-is-external constraint.

Co-Authored-By: claude-flow <ruv@ruv.net>
@ruvnet ruvnet force-pushed the feat/workspace-lens branch from 20d965d to 3fa60ca Compare July 7, 2026 03:17
@ruvnet ruvnet merged commit e1c78ca into main Jul 7, 2026
25 checks passed
ruvnet added a commit that referenced this pull request Jul 7, 2026
…ode bridge for workspace-lens (ADR-239) (#131)

A thin, pure companion to @metaharness/workspace-lens (ADR-238) that turns Jacobian-Lens interpretability
receipts into evaluation signal:

- workspaceProbeScore(receipts, {driftThreshold}) → { n, score=cleanFraction, meanDrift, flagRate,
  criticalRate } — a flywheel-consumable `workspace_probe` surface: the fraction of decisions whose
  workspace was clean (no critical trigger AND drift below threshold). Empty set → 0 (nothing witnessed
  → no credit).
- gradeMutationByWorkspace(baseline, mutant, opts) → { keep, reasons, baseline, mutant } — Darwin-Mode
  mutation evidence: a VETO that rejects a mutation which raises the critical-trigger rate, destabilizes
  the workspace (mean drift up beyond tolerance), or drops the clean fraction — even if final answers
  improved ("final answer up, workspace grip down" = structurally brittle). Pairs with the gold/answer
  gate (keep only if BOTH pass); never weakens it. meetsPromotionRule untouched.

Depends only on the workspace-lens types; deterministic; $0. Logic was developed + validated in
isolation against the published @metaharness/workspace-lens@0.1.0, then re-homed with a local workspace
dep. 9 synthetic tests; tsc clean; healthcheck 8/8. Wired into build-ordered phase-2 (after workspace-lens)
+ the version-coherence allowlist; ADR-239. (The lockfile also gains the workspace-lens entry that #129
did not add.)
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