AGENT SKILL

glyphsteer-dense

Use when running GlyphSteer's DENSE regime — embedding-based emoji steering via the containerized ONNX sidecar. Covers standing up the glyphsteer-serve Docker image, the MANDATORY emoji-collapse gate (many models map all emoji to one token), the magnitude probe, and the anchor metric-reshape (steer.sim_eff). Triggers on "glyphsteer dense", "embedding steering", "emoji direction", "glyphsteer sidecar", "magnitude probe", "anchor reshape", "is the dense nudge big enough".

License 许可
MIT
最近更新
2026-11-13
Stars
★ 0
Forks
0

01 前言 Front Matter

name
glyphsteer-dense
description
Use when running GlyphSteer's DENSE regime — embedding-based emoji steering via the containerized ONNX sidecar. Covers standing up the glyphsteer-serve Docker image, the MANDATORY emoji-collapse gate (many models map all emoji to one token), the magnitude probe, and the anchor metric-reshape (steer.sim_eff). Triggers on "glyphsteer dense", "embedding steering", "emoji direction", "glyphsteer sidecar", "magnitude probe", "anchor reshape", "is the dense nudge big enough".

03 SKILL.md 正文

GlyphSteer — the dense regime (containerized)

The dense half steers retrieval by the emoji's learned direction in embedding space. The heavy neural runtime lives in a Docker sidecar (fastembed → onnxruntime, no torch); the host calls it over HTTP and the steer/probe math runs host-side in pure numpy.

Run its Python from a plugin install with uv run --no-project --with glyphsteer==0.3.6 python3 — pipe a block in as python3 - <<'PY' … PY — and from a clone of the public repository where ./install.sh ran, with the clone's python3. For the local fastembed backend instead of the sidecar, run it with uv run --no-project --with "glyphsteer[dense]==0.3.6" python3.

The sidecar's compose file and the probes below are in a clone of the public repository: run every packages/... command from the clone's root (.../chaincompiler).

1. Stand up the sidecar

cd packages/glyphsteer/serve
# byte-aware multilingual model — REQUIRED (see the collapse gate below)
GLYPHSTEER_MODEL=sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 \
  docker compose up --build -d
curl localhost:8088/health      # {"status":"ok","model":"...MiniLM-L12-v2"}
curl localhost:8088/info        # {"model":"...","dim":384}
export GLYPHSTEER_EMBED_URL=http://localhost:8088   # host now uses the sidecar

The host dense.embed(texts) auto-routes to the container when GLYPHSTEER_EMBED_URL is set (stdlib urllib — no host deps). Backends: remote (container, default when the env var is set), fastembed (local ONNX), st (local sentence-transformers).

2. THE GATE — check emoji-collapse FIRST (non-negotiable)

Many English tokenizers (BERT/WordPiece, e.g. bge-small-en-v1.5) map every emoji to the same token ([UNK]) → all emoji embed identically → dense steering is impossible. Always run the gate before trusting any dense number:

GLYPHSTEER_EMBED_URL=http://localhost:8088 \
  python3 packages/glyphsteer/experiments/emoji_collapse_check.py
# mean off-diagonal cosine ≈ 1.000 ⇒ COLLAPSED (reject the model)
# well below 1.0 (e.g. 0.77–0.97) ⇒ DISTINCT (proceed)

Verified: bge-small-en-v1.5 → 1.000 (blind). paraphrase-multilingual-MiniLM-L12-v2 → distinct, with clean alignment. Fix a collapse with a one-env-var model swap + rebuild.

3. Magnitude probe (Q1–Q3)

GLYPHSTEER_EMBED_URL=http://localhost:8088 \
  python3 packages/glyphsteer/experiments/magnitude_probe.py
  • Q1 (alignment): cos(glyph, aligned_word) − cos(glyph, unrelated) — should be clearly positive (the emoji means what you think). Measured +0.28…+0.58 with the multilingual model.
  • Q2 (per-token nudge): injecting one emoji shifts a neutral chunk's vector by Δcos ~−0.03…+0.09 — real but modest, and a single token can wash out or slightly invert under mean-pooling (e.g. ❓ measured −0.034). This is why Q2 is a tuning concern, not a guarantee.
  • Q3 (anchor reshape): a controllable gain (×2 at weight 1).

4. Steer — the anchor metric reshape (pure numpy, host-side)

sim_eff (lives in glyphsteer.steer, re-exported at top level — from glyphsteer import sim_eff) bends the similarity metric toward chosen anchors at query time: sim_eff(q,d) = cos(q,d) + Σ_k w_k·⟨q,â_k⟩·⟨d,â_k⟩, with â_k from dense.measure_anchor.

from glyphsteer import dense, sim_eff
anchor = dense.measure_anchor("😡")     # the glyph's learned direction (via the sidecar)
q = dense.embed(["the deploy broke"])[0]
docs = dense.embed(["it crashed badly", "it shipped fine"])
scored = sim_eff(q, docs, anchors=anchor[None, :], weights=[1.5])   # weight = the steering knob

weight 0 = plain cosine; raising it makes that axis dominate (too high → ignores the query).

Honest status

Dense is viable and measured but its per-token strength is a tuning knob, not a free lunch; end-to-end dense retrieval lift on a real (non-toy) corpus is the open item. Lexical faceting (the core glyphsteer skill) is the regime that's a clean win today.

Verify (run this)

cd packages/glyphsteer/serve && docker compose up --build -d && cd -
export GLYPHSTEER_EMBED_URL=http://localhost:8088
python3 packages/glyphsteer/experiments/emoji_collapse_check.py   # gate
python3 packages/glyphsteer/experiments/magnitude_probe.py        # Q1–Q3

Architecture/flows: packages/glyphsteer/.claude/rules/{10,20}-architecture-*.md (DW-6/DW-7).

04 同仓库更多 Skills

sancovp
sancovp/chaincompiler

skill2framework

Turn an already-built AIOS/package into a framework chapter — narrative blog + deep-dive blog → chapter → {aios}-volume index skill → plugin → folded into the author's SkillTome.

★ 0
sancovp
sancovp/chaincompiler

package-plugin

WHAT: package a framework as a Claude Code PLUGIN (its operational face) — run skill2framework.package_plugin to assemble plugin.json + skills/{aios}-volume/SKILL.md + the chapter bundled under resources/, with the skill's chapter links repathed to the bundle. WHEN: when a framework skill + chapter exist and need the installable plugin, or when the user says package the framework / plugin / skill2framework (any of).

★ 0
sancovp
sancovp/chaincompiler

narrative-blog

WHAT: produce Blog 1 of a framework CHAPTER — the narrative chapter-opener — for an already-built AIOS/package by reconstructing its journey from its own dir (CLAUDE.md, README, dev log) and FILLING skill2framework.JourneyCore, then rendering with render_blog1 (never hand-write the blog). WHEN: when making a framework/chapter from something already built, when you need the story post that opens a chapter, or when the user says blog organ / narrative blog / skill2framework (any of).

★ 0
sancovp
sancovp/chaincompiler

framework-skill

WHAT: generate the FRAMEWORK SKILL for an already-built AIOS — the {aios}-volume (its SkillVolume face): one skill that indexes the AIOS's skills + rules + how they relate (as a diagram), gives a decision tree for what to do when, and ROUTES the agent into the AIOS dir. WHEN: when producing the index/router face of a framework package, or when the user says framework skill / volume / skill2framework (any of).

★ 0
sancovp
sancovp/chaincompiler

fold-into-tome

WHAT: the TERMINAL stage — fold a finished framework into the author's SkillTome (the top-level holder + search of all their frameworks) by running skill2framework.fold_into_tome, which registers the framework as a row on a tome volume node's generated ## Frameworks table via skilltree's bind op. WHEN: when a framework package is finished and must be registered in the author's tome/volume, or when the user says fold into the tome / nomicon / skill2framework fold (any of).

★ 0
sancovp
sancovp/chaincompiler

deepdive-blog

WHAT: produce Blog 2 of a framework CHAPTER — the mechanical deep-dive ('how it actually works') — for an already-built AIOS/package by reading its impl docs (README architecture sections, design docs, the code's module docstrings) and assembling a faithful mechanics-only article that links back to Blog 1. WHEN: when producing the deep-dive half of a chapter, when you need the technical how-it-works post Blog 1 links to, or when the user says blog 2 / deep dive / skill2framework (any of).

★ 0