Wednesday, July 29, 2026

Why your AI agent likes em-dashes and long sentences

 Recently I've been working on a RAG, understanding how it works, how RAGs and Agentic technology produces tokens, and how they are trained to recognize material, and how the various layering of training accumulates information in the multi-layer massive neural network that gets trained.  As a result of that, and my NLP background, I now have a theory about em-dashes and long sentences.

When an AI trains on text, it tokenizes the content.  The tokens it uses are typically byte-pair encodings (BPE) that are learned over a corpus; these become a new "alphabet" for language learned from character frequencies and adjacencies.  The alphabet produced can be defined to be a fixed size or achieve a certain encoding metric over text. This results in a token alphabet of say 30,000 mappings.  Base letters and punctuation and numbers get a BPE encoding that is an identity mapping. If the input language is expressed in the Unicode character set, and the text is UTF-8 encoded, then each byte is either a UTF-8 lower 128 character, or a lead byte for longer encodings of unicode text. BPE works on the bytes.  Thus, any sequence of UTF-8 encoded text can be represented in the initial 256 byte pair codes that are identity mapped to bytes 0 - 255.  Thereafter, the first most frequent pairing gets encoded as character 256.  The text is rencoded to the new langauge left to right using the new "character", and the process repeats.  As a result of this process, commonly used upper 128 characters in ANSI, such as curly-quotes, mathematical symbols, en-dash, em-dash, elipses (...), et cetera, might get encoded in a single token.  Sadly, emoji such as ðŸŽ‰might require 4 tokens to encode.

That's the first stage.  Then the neural network training begins.  As that training continues, it will start to collapse concept in language that represent certain features.  One of the features of language is the "pause".  The period, comma, colon, semi-colon, en-dash, and em-dash all represent pauses, and () pairs also invoke the "pause" mechanics.  Ending of a concept or thought.  The period plays a dual role as ending of a thought or concept but also plays a separate role (as does comma) of a digit separator and/or decimal separator, as well as an initial separator.  The LLM learns the idea of a conversational pause.  Anywhere a period, comma, colon, semi-colon, en-dash or parenthetical expression appear, the em-dash can step in without further loss of meaning -- making it the universal concept representing a pause.  The LLM learns this and then decides that any pause deserves its own cluster in the model as it were.  So all of these pauses lean towards the pause cluster.  Since -- can fit in both places the model might cluster -- with , and -- with ; and so forth, and when these clusters in the model again become bigger clusters of meaning, the representation of them, reversed out becomes the token having the biggest hold on the space, the --, rather than the more meaningful siblings.

I believe this is an example of learned bias.  But it also means something else.  Thought ending behavior the period, conflates with em-dash, which is also concept ending behavior, indistinguishable from thought ending.  And thereafter, the training loses track of the human concept of the need for a bigger pause (the period) to make concepts easier to understand.

As a result of this, the training leans towards longer sentences, some taking three lines or more to complete, and therefore, you get lost in the AI noise -- causing you to scratch you head and wonder "is this ever going to stop?" and then finally, it does -- or not, based on the training process and random noise inputs that keep the output variable and interesting

To combat this, I've devised a set if writing instructions (and skills because most agents I work with lose track of their instructions after a few context compressions where they haven't been important).  It basically says replace em-dashes with other forms of punctuation, period, comma, colon, semi-colon, or parentheses for conversational asides and clarifications.  I have another set of skills based on HHS simple language training materials that breaks sentences down to less than N words depending on the reading score I'm reaching for.  For technical content, about 25 words is good, 20 is better for conversational text.

As I said, this is a theory, based on (what little) I know about how this stuff works, but it might be worth investigating further. The bigger pause (the blank line or newline) likely gets different treatment during learning, which is why agents might be keen on writing shorter paragraphs.  As a theory, it's worth investigating further, but I'm not at a point where I would be able to do that myself.


Sunday, July 19, 2026

A URI Scheme for AI Agent Prompts

Gratuitous AI related Image of 
Max Headroom by juzmental on DeviantArt
So, I made some minor editorial changes, built out an MCP to demonstrate its use, and submitted my draft The prompt URI Scheme for AI Agent Sessions and Prompts to the IETF.  We'll see where this goes, it's my first time through this process.

At the same time, if you look at AudaciousInquiry/prompt-url: The prompt: URL scheme for AI agent session provenance project on GitHub, you'll see a readily installable MCP and skill for using it in that repo.  The skill documents one use of the MCP, to create a URL for annotating commits, and another use enabling resolution of the prompt via the MCP so that the prompt truly is a traceable link on
the machine and user account where it was run from.

There should be a second skill that describes the use of the MCP to actually find the right Prompt-URL: value to use for a github checkin.  Both the agents I use already know how to do this so I should have one of them write it up.  By the time you see this, it might already be present in the .claude folder.

For what it's worth, GitHub Copilot reads CLAUDE.md and .claude/skills folders so you only have to write things once for Claude and Copilot will use the tooling.  

The MCP framework is highly reusable, and eventually I will extract it from the base MCP APIs.  It runs in node.js in three modes, as a standalone HTTP server, in stdio mode launching a server if one is not already running and connecting to it over HTTP when commands are sent to it, or via CLI where it basically does the same kind of thing.  This makes standalone MCP testing very easy, because the framework handles transport and the rest, so you can just implement commands and get three different ways to activate them.

     Keith


Tuesday, July 7, 2026

A URI Scheme for AI Agent Prompts

If you've ever read John Moehrke's blog you know he talks a lot about provenance.  One of the challenges I've been faced with recently is the need to track the provenance of an AI output.  The things I need to know are:

  1. What was the prompt that produced this, so I can reproduce it again at a later date (this can be used to detect drift and change).
  2. What files or inputs were used to produce it.  These should be URIs where feasible so that I can get to the content, not just summary descriptions found in the prompt, and when tied to an HTTP address, even the date of retrieval for the content used.
  3. What agent generated it.  Like many, I'm using multiple agents.  What version of the agent is also useful.
  4. What LLM and version were used.  Many agents support multiple models.
The first of these is actually not too difficult to identify.  I wanted this to be a URI as well, but right now there is no URI for a prompt, so I made up a syntax.  It follows and can also be found here.  I'm interested in getting community feedback before I spend any time trying to submit this to IETF.