- Python 100%
Adds a real hook registration so em dashes are caught even when the barnacleboy-output wrapper plugin fails to load or import this module. The barnacleboy-output plugin is still the PRIMARY transform owner - it chains em-dash-sub + spongebob-vocab + safety-net. This registration is a fallback that fires independently. Both hooks run on every turn. The turn_finalizer uses the first non-None result, so barnacleboy-output's chained transform wins when healthy. |
||
|---|---|---|
| .gitignore | ||
| __init__.py | ||
| plugin.yaml | ||
| README.md | ||
| test_integration.py | ||
| test_new_features.py | ||
| test_plugin.py | ||
Em Dash Sub
A Hermes Agent plugin that replaces em dashes (—) with typographically appropriate punctuation.
Uses the transform_llm_output hook — zero inference tokens, pure regex post-processing.
How it works
Three-pass substitution:
- Paired em dashes — Detects
— text —patterns and wraps them:- Non-restrictive clauses (starting with
which,who,that,where,when) →, commas, - Removable asides and appositives →
(parentheses)
- Non-restrictive clauses (starting with
- Single em dashes — Heuristic substitution based on the word that follows:
- Coordinating conjunction (
but,yet,so,nor) →, - Weak starter (
that,which,who,whom,whose,where,when) →, - Contrasting clause (pronoun or auxiliary verb follows) →
; - Explanation (article, preposition, or infinitive follows) →
: - Everything else →
:(safe default)
- Coordinating conjunction (
- Whitespace hygiene — Cleans up double spaces, leading punctuation, and spacing around parens.
Code blocks, inline code, URLs, and file paths are preserved.
Installation
git clone https://git.jezzahehn.com/KrustyPlanet/em-dash-sub.git ~/.hermes/plugins/em-dash-sub
hermes plugins enable em-dash-sub
Requires a /reset or gateway restart.
Configuration
| Env var | Effect |
|---|---|
EM_DASH_SUB_DISABLED=1 |
Disable the plugin |
EM_DASH_PREFER_SEMICOLON=1 |
Use semicolons for all single em dashes (skip heuristic) |
Debugging
The plugin logs at INFO level when it fires:
em-dash-sub: no em dash found in text— text has no em dashes, passes throughem-dash-sub: transforming N chars with em dashes— em dashes found and replaced
Check logs with:
grep "em-dash-sub" ~/.hermes/logs/agent.log
Stale .pyc files: If the plugin stops working after a code change, the gateway process may be holding a stale .pyc in memory. Restart the gateway:
sudo systemctl restart hermes-gateway
Multiple Plugin Coexistence
The transform_llm_output hook uses a "first non-empty string wins" approach. Multiple plugins can register for the same hook; the first callback to return a non-None string is used as the final response.
This plugin is registered before spongebob-vocab, so it takes priority when em dashes are detected. When no em dashes are present, it returns None and the next plugin's output is used.
Examples
| Before | After |
|---|---|
| The key insight — it's all about scale. | The key insight: it's all about scale. |
| My mentor — a seasoned developer — disagreed. | My mentor (a seasoned developer) disagreed. |
| The system — which handles 10K requests — crashed. | The system, which handles 10K requests, crashed. |
| I thought it was working — it wasn't. | I thought it was working; it wasn't. |
| Three things — speed, cost, reliability. | Three things: speed, cost, reliability. |
| It was hard — but we did it. | It was hard, but we did it. |
| The theory — that morality is pluralistic — is influential. | The theory, that morality is pluralistic, is influential. |
License
MIT