GlyphSteer
Dual-regime retrieval steering via compiled in-band glyph annotations.
An LLM annotation pass writes a controlled glyph vocabulary onto a corpus. Those markers steer retrieval in two regimes at once — lexically (a rare glyph-tag is a maximal-IDF exact-match facet) and densely (an emoji carries a learned direction that nudges the chunk's embedding) — and are then stripped from the returned text, so the reader/generator never sees them.
One artifact (the annotated chunk). Two indexes (BM25 + dense). Invisible at output.
This is HoneyC pointed at the index instead of Prolog (a glyph code is a HoneyC chain), and the cousin of Anthropic's Contextual Retrieval — but with a compiled, queryable, faceted controlled vocabulary in place of free-text context.
The sidecar split (the keystone)
indexed-form = clean_text ⊕ glyph_code → embedded / FTS5-indexed (MATCHING)
returned-form = clean_text → handed to the reader (READING)
The glyph lives only in the matching representation. check_hidden / assert_hidden
make the hide a hard invariant.
One axis, two renderings (a verified finding)
FTS5's unicode61 tokenizer drops emoji (verified — it matches 0). So each axis
carries two markers:
| marker | regime | why | |
|---|---|---|---|
| glyph | 😡 | dense | emoji has a learned direction, near-orthogonal to prose |
| tag | gsxnegative |
lexical | rare ASCII single-token ⇒ maximal IDF, exact facet |
What the vocabulary guarantees
- Matching. A vocabulary may hold a glyph that is part of another — an emoji and its variation-selector or
skin-tone form (
⚠and⚠️). Every reader —parse,glyphs_in,code_tags,strip, the hide check,to_honeycand the grammar's order check — reads left to right, at each place the longest glyph that starts there, and never two that overlap:⚠️is one glyph, never⚠with a stray selector. - The hide.
stripremoves each glyph whole and the separator with its space, and goes on until a pass removes nothing — removing one glyph can join its neighbours into another — so the returned form holds no glyph. - Order.
to_honeycwrites the glyphs in the code's own order — a chain is order-significant. - The gate.
GlyphGrammar.lintrefuses (syntax_break) whatever in a code is neither a vocabulary glyph nor the separator, and names it. - Legends.
mergekeeps the last author when two entries clash on a name, a glyph or the tag their names derive (riskandRisk!both derivegsxrisk), and keeps every entry that clashes with nothing — a glyph a name gave up, or an evicted entry held, is free again. - Search. A query with no word in it finds nothing.
tests/test_glyphsteer_regressions.py pins each one.
Install & use
pip install glyphsteer # lexical regime, zero heavy deps
pip install "glyphsteer[dense]" # adds fastembed (local ONNX, no torch) for the dense regime; [st] adds sentence-transformers
pip install "glyphsteer[grammar]" # adds the syntax gate's engine (chaincompiler + rulecatcher) for GlyphGrammar
It installs the glyphsteer command. It is one of the fifteen packages of
ChainCompiler; to work on it, clone the repository and run ./install.sh,
which installs all fifteen editable.
from glyphsteer import SENTIMENT, Chunk, RuleAnnotator, annotate_chunk, build_index, search
ann = RuleAnnotator.keyword(SENTIMENT, {
SENTIMENT.by_name("negative").glyph: ["failed", "broke", "terrible"],
SENTIMENT.by_name("positive").glyph: ["great", "excellent", "succeeded"],
})
chunks = [annotate_chunk(Chunk(c.id, c.text), ann, SENTIMENT) for c in corpus]
con = build_index(chunks)
hits = search(con, "deployment", facet=SENTIMENT.by_name("negative").glyph)
# hits[i]["text"] is CLEAN — the glyph never leaks into the output
CLI: glyphsteer vocab · glyphsteer annotate corpus.jsonl -k 😡=failed,broke ·
glyphsteer query corpus.jsonl "deployment" -f 😡
Flagship use: grade a corpus, search shows grades
The vocabulary is general (SENTIMENT is just the demo). The built-in GRADE vocabulary
(🏆 excellent / ✅ good / ⚠️ fair / ❌ poor) lets an LLM grade "what's good and what isn't";
search then shows the grade and can facet to it. Grading rides the lexical regime — a
grade is a label you filter/display by, not a semantic direction (experiments/grade_demo.py):
search 'database' — results WITH grades (best→worst):
[🏆 excellent ] Use parameterized queries to prevent SQL injection (OWASP A03).
[✅ good ] Connection pooling improves DB throughput; benchmark before tuning.
[⚠️ fair ] Indexes might help query speed, not totally sure when.
[❌ poor ] If the database is slow just restart the server.
facet = poor only (the audit view):
[❌ poor ] You can concatenate user input into SQL strings, usually fine.
The grade glyph rides back in each hit's code for display; the body text stays clean.
The dense sidecar (containerized, no torch)
The heavy neural runtime lives in a Docker image (serve/): fastembed → onnxruntime,
model weights pre-cached, ~888MB, no torch. The host calls it over HTTP and stays
dependency-light (the remote client is stdlib urllib). Swapping the embedding model is one
env var — which is exactly what made the emoji-collapse finding below discoverable.
cd serve && docker compose up --build -d # serves :8088
export GLYPHSTEER_EMBED_URL=http://localhost:8088 # host now uses the sidecar
python experiments/emoji_collapse_check.py # gate: is the model emoji-blind?
python experiments/magnitude_probe.py # Q1–Q3
Results (measured via the sidecar, 2026-06-16)
-
Lexical Q4 (retrieval lift): MRR 0.417 → 1.000 on the toy sentiment-faceted corpus (
experiments/retrieval_lift.py). Zero deps. -
THE dense finding — emoji-direction is model-dependent:
model distinct-emoji cosine Q1 separation verdict bge-small-en-v1.5(English)1.000 (collapse) −0.01…+0.08 (noise) emoji → [UNK], blindparaphrase-multilingual-MiniLM-L12-v2(XLM-R)0.77–0.97 +0.28…+0.58 carries direction ✓ -
With the byte-aware model: Q1 (alignment) passes strongly; Q2 (per-token nudge) is modest (+0.02…+0.09 Δcos); Q3 (anchor reshape) is a controllable gain (×2 at weight 1) — so steering strength is a tuning knob, not a yes/no. See
implementation_plan.md§3.1 andexperiments/results/magnitude_probe.json.
Layout
See implementation_plan.md
(canonical) and .claude/rules/ for
the component/flow diagrams and the discovered
development workflows.
Metadata
Release files for glyphsteer 0.3.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| glyphsteer-0.3.6.tar.gz | 31.0 kB | Without provenance | Details for glyphsteer-0.3.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| glyphsteer-0.3.6-py3-none-any.whl | Python 3 | none | any | Details for glyphsteer-0.3.6-py3-none-any.whl |
Total release size: 56.3 kB
Release files / glyphsteer-0.3.6.tar.gz
| Download URL | glyphsteer-0.3.6.tar.gz |
|---|---|
| Size | 31.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ba0f90bc9a3a344c330d0f58cbef232bb9c0f5d088ba59ada606045dddca70e3
|
|
BLAKE2b-256 checksum How to use checksums |
9f0ef1bd4e3cd2a0e2e4e32a09acb58f0f75f68099551dc99ac7f3b8b00d9da2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.13
|
Release files / glyphsteer-0.3.6-py3-none-any.whl
| Download URL | glyphsteer-0.3.6-py3-none-any.whl |
|---|---|
| Size | 25.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
609d56633713aa16acd08875f01f6496b57d2a1e0a1033634f815d764c092ac3
|
|
BLAKE2b-256 checksum How to use checksums |
ed9249292db6db2afe71cafd2d6013378953727cfadcf512694935b33aafb8eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.13
|
Security for glyphsteer 0.3.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.