feat(workspace-lens): @metaharness/workspace-lens — Jacobian-Lens interpretability primitive (ADR-238)#129
Merged
Merged
Conversation
4 tasks
…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>
20d965d to
3fa60ca
Compare
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.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 codeanthropics/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:
…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
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).LensArtifactcarries the vocab + unembedding, so scoring never touches a tokenizer. Pure TS overnumber[](node built-ins), deterministic.ConceptVector), matched by cosine, never cross-applied acrossmodelId. So Qwen's and Gemma'shidden_objectivealign by name, not token string.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
$0tests (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).tscclean; healthcheck 8/8 (version-coherence allowlist updated); wired intobuild-orderedphase 1.@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