Skip to main content

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_honeyc and 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. strip removes 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_honeyc writes the glyphs in the code's own order — a chain is order-significant.
  • The gate. GlyphGrammar.lint refuses (syntax_break) whatever in a code is neither a vocabulary glyph nor the separator, and names it.
  • Legends. merge keeps the last author when two entries clash on a name, a glyph or the tag their names derive (risk and Risk! both derive gsxrisk), 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], blind
    paraphrase-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 and experiments/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.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for glyphsteer 0.4.1
File Size Uploaded Provenance Actions
glyphsteer-0.4.1.tar.gz 30.9 kB Without provenance Details for glyphsteer-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for glyphsteer 0.4.1
File Interpreter ABI Platform Actions
glyphsteer-0.4.1-py3-none-any.whl Python 3 none any Details for glyphsteer-0.4.1-py3-none-any.whl

Total release size: 56.2 kB

Release files / glyphsteer-0.4.1.tar.gz

Download URL glyphsteer-0.4.1.tar.gz
Size 30.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2e058e5b363cf2054aee00b7131cce43170c3ef0e0c296c743a65418f970160d
BLAKE2b-256 checksum
How to use checksums
909dadb85d5028404b48ff4e0881e40c2001eded797f6d991584ec7419c9902e
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.4.1-py3-none-any.whl

Download URL glyphsteer-0.4.1-py3-none-any.whl
Size 25.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16b68e18dffe5d4239ed6c37c73f5e9c6c2328d304abc745c800b4fa31129d10
BLAKE2b-256 checksum
How to use checksums
2141628fef6a052f168a26442c4b05826cec02e75e201e8b72b2330a54fae904
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.4.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page