ASHRU
Atomic Semantic
Hyper-Relational Unit.
The deterministic semantic transport protocol for AI. JSON was designed for humans writing APIs. ASHRU is designed for machines generating semantics.
Coming from JSON? ASHRU drops 60–80% of your output tokens by killing the brackets, quotes, and repeated field names. Coming from TOON? ASHRU keeps the pipe compression and adds the six grammatical slots TOON leaves on the table — so retrieval is structural, not just compressed.
Built on the case roles Pāṇini formalized in Sanskrit 2,500 years ago, and the AI-knowledge-representation thesis Rick Briggs published at NASA in 1985. Public domain. Drop-in compatible with every LLM you already use.
{
"verbs": [{
"verb_lemma": "buy",
"kartā": "Suman",
"karma": "Tesla",
"karaṇa": "$60000",
"apādāna": "John",
"adhikaraṇa": "SF",
"tense": "past",
"is_negated": false
}]
} ASHRU/1
V|buy|Suman|Tesla|$60000||John|SF|p|0| Same fact. Two formats. Different bills.
An LLM extracting 8 kāraka facts. Token counters tick at the published Gemini Flash output rate (~250 tok/s). Press play.
benchmarks/run_benchmark.py --records 1000 with tiktoken cl100k_base: ASHRU = 0.29× JSON tokens.
How to use it.
Three steps. Bring your own LLM key. No SDK to install beyond a single 250-LOC parser. Works with any model that can follow instructions.
Pick your language
# Python
git clone github.com/ashru-format/\
ashru-format
cp ashru-format/parsers/python/\
ashru.py your_project/
# JavaScript
cp ashru-format/parsers/javascript/\
ashru.js your_project/ Zero runtime dependencies. Single file, ~250 LOC each. MIT-licensed.
One line swap
# BEFORE (JSON)
"Return JSON with verb, kartā,
karma fields"
# AFTER (ASHRU)
"Return ASHRU/1 — one V| line
per fact. 10 columns:
V|verb|kartā|karma|karaṇa|
sampradāna|apādāna|adhikaraṇa|
tense|negated|attributes" The model already knows how to follow column-position instructions. No fine-tuning required.
Replace JSON.parse
# BEFORE
import json
data = json.loads(llm_response)
# AFTER
from ashru import parse
doc = parse(llm_response)
for verb in doc.verbs:
print(verb.verb_lemma,
verb.karta,
verb.karma) Tolerant by design — malformed rows logged + skipped, not raised.
Use the drop-in batch extractor
examples/extract_batch.py — pipe prose in, get an ASHRU document out. Bring your own key (Gemini, OpenAI, or Anthropic). Already on GitHub, ready to run.
$ cat my_text.txt | \
GEMINI_API_KEY=... python extract_batch.py
→ ASHRU/1
→ V|buy|Suman|Tesla|$60000||John|SF|p|0|
→ V|deploy|engineer|api||||staging|f|0|
→ ... (one V| per fact)
The next scaling bottleneck isn't compute.
It's semantic inefficiency.
Verbose. Heavy. Designed for parsing by machines that had cycles to spare.
Lighter. Human-readable. Optimized for engineers writing endpoints.
For machines generating structured meaning under token-billed constraints. The protobuf moment for AI semantics.
Every brace, every quote, every repeated field name in your LLM's output is billable token waste. At one record it doesn't matter. At a million records, it's economically catastrophic.
ASHRU is a positional, schema-implicit, deterministic semantic transport protocol — the protocol gets out of the way so the model can spend tokens on data, not punctuation. Compatible with every LLM you already use — change one line of your prompt's output instruction, replace JSON.parse with ashru.parse.
Change one line of your prompt.
You don't migrate to ASHRU. You don't rewrite anything. You change the line of your existing extraction prompt that says "return JSON" to "return ASHRU/1". The LLM you already pay for emits the new format. Your output bill drops by ~80% the same hour.
# in your existing extraction prompt
prompt = """
You are an entity extractor. Return JSON in this shape:
{
"verbs": [
{ "verb": "...", "subject": "...", "object": "..." }
]
}
Now extract from: {text}
""" {, ", and the field name "verb_lemma"
repeated 1,000 times.
# the same prompt, ASHRU edition
prompt = """
You are an entity extractor. Return ASHRU/1 format —
one V| line per fact:
V|verb|kartā|karma|||apādāna|adhikaraṇa|p|0|
Now extract from: {text}
""" That's it. No new SDK to learn. No new database. Just a different output schema your LLM already knows how to follow.
Ten columns. One pipe. Done.
ASHRU is positional, schema-implicit, and tiny. One line per fact. The columns map onto the six grammatical roles every human sentence has had since Pāṇini formalized them — agent, object, instrument, recipient, source, location — plus tense, negation, and a free key-value slot for anything else.
V|verb_lemma|kartā|karma|karaṇa|sampradāna|apādāna|adhikaraṇa|tense|negated|attributes verb_lemma buy kartā कर्ता Suman karma कर्म Tesla karaṇa करण $60000 sampradāna सम्प्रदान team_lead apādāna अपादान John adhikaraṇa अधिकरण SF tense p · n · f · c attributes price=60000;currency=USD Empty between two pipes = empty cell. No quotes. No keys. The schema is in the position.
The semantic transport layer
between LLMs and your knowledge graph.
OpenAI
Claude
v1
Kinesis
Pub/Sub
Postgres
+ pgvector
RAG
UI
Agents emit ASHRU rows on a shared Kafka topic. Each row is a typed semantic event. Consumers subscribe by verb_lemma, kartā, or sphere — no schema negotiation, no JSON-Schema coordination overhead.
Each ASHRU row → one row in Postgres + pgvector embedding. Retrieval = cosine similarity × harmonic weight × tense decay. Pay once at write, read forever for free. No per-query LLM cost.
ASHRU is a typed schema for LLM behavior. Log every kartā/karma/verb tuple your agent emits. You get structured drift detection, anomaly surfacing, and replayable semantic traces — without invented schemas.
Protocol guarantees, not vibes.
Two things any serious engineer attacks first: what happens when a value contains the delimiter, and what happens when the LLM emits the wrong number of columns. Both are spec-defined, both are tested.
Delimiter escaping
Spec rule §3.4
A literal pipe inside a value is escaped with a backslash. The reference parser un-escapes during column split, so the value Suman | CEO round-trips correctly without inflating column count.
# Source value
"Suman | CEO"
# On the wire
V|hire|Acme|Suman \| CEO|...
# After ashru.parse(...)
verb.karma == "Suman | CEO" ✓ Escape cost: 1 character per pipe. Fields containing pipes are rare in practice (titles, IDs); kāraka role values almost never collide with the delimiter.
Wrong column count
Spec rule §4.2If a row has fewer or more than the 10 V-columns, the reference parser logs the row to a warnings list and skips it. The document does not crash. This is intentional — at million-row scale, one drift-by-one row should not lose the entire batch.
# Hallucinated 9-column row
V|buy|Suman|Tesla|$60000||John|SF|p
# Parser behaviour
doc = ashru.parse(text)
len(doc.verbs) # good rows only
len(doc.warnings) # 1: bad column count
doc.warnings[0].line # source line number Strict mode (parse(..., strict=True)) raises on the first bad row — opt in if you need fail-fast batch semantics.
v1.0 spec covers: 10-column V grammar, F-line file context, S-line sphere context, comments (#), blank-line tolerance, UTF-8, escaping (\|, \\, \n), and parser warnings contract.
Python and JavaScript reference parsers in the repo. Round-trip tested against the v1.0 conformance suite. ~250 LOC each, zero dependencies, MIT.
pip install ashru and npm install @ashru/parser are this week's milestone. Until then, single-file copy. Spec is frozen and versioned (v1.0).
Why not just use [X]?
Every alternative has a real argument. Here are the eight you should be asking — answered honestly, no hand-waving.
Why not JSON?
Different jobDesigned for human-readable APIs. ASHRU is designed for machine-generated semantics. Use both, in different places.
Why not Protobuf?
LLMs can't emit itBinary format. LLMs hallucinate magic numbers and offsets when asked to emit raw bytes. ASHRU is text — what LLMs are actually built to produce.
Why not MessagePack?
Binary, same problemSame as Protobuf — LLMs are not reliable binary emitters. ASHRU stays text-native and BPE-friendly.
Why not YAML?
Repeats the keysYAML is human-friendly but every key is still written out per record. At a million records, you pay for `verb_lemma:` a million times.
Why not CSV / TSV?
Flat-onlyCSV is for flat tables. ASHRU supports nested file (`F|`) and contextual sphere (`S|`) markers in a single payload — semantic structure CSV can't express.
Why not JSON-Schema Structured Outputs?
Caches schema, still pays for outputOpenAI / Gemini / Claude schema caching reduces SCHEMA-PROMPT cost. They still bill you per generated output token. ASHRU attacks the more expensive side: output.
Why not NDJSON / JSONL?
Per-row JSON taxNewline-delimited JSON gives you streaming, but every row still pays the JSON tax (braces, quotes, repeated keys). ASHRU drops both.
Why not XML?
🪦Verbose enough that even Java engineers stopped using it for new wire formats around 2010. We will not relitigate this.
Why अश्रु · ashru.
In Sanskrit, अश्रु (ashru) is most often translated as "tear". But that translation flattens what the word actually means. A tear is not just a single drop — it is the distilled essence of an entire feeling. Grief, joy, love, awe — they fall as one drop, and that drop carries the whole.
The same way grains of rice on a plate are individually tiny, but together they fill the
mouth — the same way a million droplets, scattered, become an ocean — a single
ashru in
our format is one fact, one verb with its grammatical roles. Stack a million of them and
you get something larger: the entire knowledge of a person, a project, an organization.
The drop holds the whole.
That is why the format is called ASHRU — Atomic Semantic Hyper-Relational Unit. Each row is the smallest unit of meaning that still says something true. Many of them, together, become a memory.
Sanskrit is humanity's oldest continuously-studied grammar. It belongs to no one and everyone. By the time it became scripture, scholars had been arguing about it for a thousand years. We did not invent any of this. We just brought one of its oldest grammatical observations — that every action has six named participants — to a 2026-grade transport protocol.
In 1985, Rick Briggs at NASA Ames published "Knowledge Representation in Sanskrit and Artificial Intelligence" in AI Magazine (Vol. 6, No. 1, Spring 1985). Briggs argued that Sanskrit's kāraka case system was a more direct, deterministic formalism for representing knowledge in computers than the first-order logic and semantic-network approaches dominant at the time.
That paper sat as theory for forty years. ASHRU is a practical implementation of Briggs' proposal — the transport protocol he hinted at, shipped in an era where LLMs are the bottleneck Briggs couldn't have predicted.
One LLM call. Many records.
Don't extract one paragraph at a time. Send 10–50
paragraphs in a single call and ask the LLM to return one ASHRU document
with one V| line per fact. The fixed prompt
overhead amortizes across every record. Cost drops ~93% versus the naïve loop.
// my-text.txt
Suman bought a Tesla in SF for $60K.
Naveen deployed the staging API yesterday.
We met John at the office last Tuesday.
The launch happens next month if QA passes.
... (12 more paragraphs)
$ cat my-text.txt | \
GEMINI_API_KEY=... python extract_batch.py \
--model gemini-2.5-flash-lite
ASHRU/1
V|buy|Suman|Tesla|$60000||John|SF|p|0|
V|deploy|Naveen|staging_api|||||p|0|date=yesterday
V|meet|us|John||||office|p|0|date=last_tuesday
V|launch|us|product|||||c|0|condition=qa_passes
... (one V| per fact) Drop-in script: examples/extract_batch.py — bring your own LLM key.
Show your work.
Every number on this page is calculated from public Gemini Flash Lite rates (input $0.10/M, output $0.40/M, May 2026) and the byte counts of the rendered examples. You can verify it with a tokenizer in five minutes. No hand-waving.
{
"verbs": [{
"verb_lemma": "buy",
"kartā": "Suman",
"karma": "Tesla",
"karaṇa": "$60000",
"apādāna": "John",
"adhikaraṇa": "SF",
"tense": "past",
"is_negated": false
}]
} ASHRU/1
V|buy|Suman|Tesla|$60000||John|SF|p|0| - — The 79% savings are output-side. Input prompt overhead is roughly the same in both formats.
- — At very small inputs (chat messages), fixed prompt overhead dominates and the ratio compresses to ~3-4×.
- — At large inputs (10K+ tokens), the asymptote is ~1.8× including required structured-output cost.
- — These are real LLM-pricing math. They are not "up to 95%" hype. They are the ceiling on this example.
Every claim above is reproducible with tiktoken + a calculator.
Tokens, measured. Costs, computed.
Bench script lives in the repo. Tokenizer is real (tiktoken cl100k_base). 1,000 kāraka facts encoded in JSON and ASHRU. Numbers below are reproducible.
SPEC.md. Tokenizer is OpenAI's tiktoken cl100k_base. Pricing reflects published May 2026 list rates; volume discounts not applied. Source code: benchmarks/run_benchmark.py.
How much does JSON cost you at scale?
Plug in your traffic and pick your model. We compute the LLM bill for both formats at published rates, side by side. No login. No telemetry. Pure math, runs in your browser.
Paste JSON. See savings instantly.
100% in your browser. No data leaves your machine. No telemetry. Auto-detects whether you pasted JSON or ASHRU and converts to the other.
Live LLM extraction tester
Paste prose, watch your LLM emit ASHRU records in real time, with token counts and side-by-side cost vs JSON. Bring-your-own-key — free Google AI Studio key works. Going live next week.
Drops in next to every tool you already use.
ASHRU is a transport protocol, not a framework. It coexists with LangChain, the vendor SDKs, your message bus, your graph database, your MCP servers, your AI coding agents. Change one line of your prompt's output instruction. Replace JSON.parse with ashru.parse. Done.
LangChain
Replace Pydantic-JSON output stage with AshruOutputParser. Same chain, ~4× fewer output tokens.
from langchain_core.output_parsers import BaseOutputParser
from ashru import parse
class AshruOutputParser(BaseOutputParser):
def parse(self, text):
return parse(text).verbs
chain = ASHRU_PROMPT | llm | AshruOutputParser() OpenAI · Claude · Gemini
One prompt instruction. Replace JSON-output schema with the ASHRU/1 column convention. Works on every major LLM.
# extract_batch.py — pipe prose in, ASHRU out
cat my_paragraphs.txt | python extract_batch.py \
--provider gemini \
--model gemini-2.5-flash-lite
# → ASHRU/1
# → V|buy|Suman|Tesla|$60000||John|SF|p|0| MCP (Model Context Protocol)
Define an MCP tool that returns ASHRU rows instead of verbose JSON. Claude / Cursor / Windsurf agents see structured semantic output, not bracket-noise.
// MCP server tool — returns ASHRU stream
{
name: "extract_facts",
description: "Extract kāraka facts as ASHRU/1",
inputSchema: { type: "object", properties: { text: { type: "string" }}},
handler: async ({ text }) => {
const ashru = await llm.extract(text); // returns "ASHRU/1\nV|..."
return { content: [{ type: "text", text: ashru }] };
}
} Neo4j · Postgres · pgvector
Each ASHRU row maps to one row in your knowledge graph. No transform layer. No schema migration.
# Each ASHRU verb → one INSERT.
# kartā → :Subject, karma → :Object,
# verb_lemma → :REL_TYPE, attributes → JSON properties.
CREATE (s:Entity {name: $karta})
CREATE (o:Entity {name: $karma})
CREATE (s)-[r:RELATES {verb: $verb, tense: $tense}]->(o) Cursor · Devin · Continue
Long-term agent memory store. Each agent action becomes one ashru row. Replay, audit, and retrieve every step a coding agent took without LLM-summarizing every read.
# Agent emits ashru rows on every action
agent.on('action', (event) => {
const row = `V|${event.verb}|${agent.id}|${event.target}|||||p|0|file=${event.file}`;
await kosha.append(row); // one INSERT, microseconds
});
# Later: query agent's history with pure SQL
SELECT * FROM ashrus WHERE karta = 'cursor-agent-42'
AND verb_lemma = 'edit' AND adhikarana = 'src/auth.py'; Kafka · Kinesis · Pub/Sub
Stream ASHRU rows on a topic. Subscribers filter by verb_lemma or kartā. Multi-agent semantic event bus.
// Producer (any agent emits typed semantic events)
producer.send('semantic-events',
'V|update|order_42|paid|||||p|0|amount=99.00');
// Consumer subscribes by verb_lemma
consumer.subscribe('semantic-events').filter(
row => row.verb_lemma === 'update');
ASHRU bypasses native JSON-Schema validation. You give up Pydantic, OpenAI Structured Outputs,
Anthropic tool-use schema, and Gemini's response_schema — your application
handles validation. The reference parsers are tolerant by design (skip malformed rows, log warnings),
but strict shape enforcement is your responsibility. Token savings come at the cost of native validation libraries.
Worth it for extraction-heavy pipelines at scale; not worth it if every single record must be schema-checked by a framework.
Why semantics become
infrastructure.
For thirty years, every infrastructure layer has standardized — except meaning. We standardized documents with HTTP and XML. We standardized APIs with REST and JSON. We standardized messages with Kafka and Protobuf. We standardized files with cloud object storage. Each standard moved the cost of integration from N × M down to N + M, and the entire software industry compounded on top of it.
Semantics never standardized. Every team that builds an LLM pipeline invents its own JSON schema for what an "extracted fact" looks like — and pays the LLM to render it. At one record, the cost is invisible. At a million records a day, the cost is a tax on every AI company's P&L, paid in tokens that buy nothing.
The next decade of AI will not be limited by compute.
It will be limited by how efficiently semantics move between systems.
ASHRU is a small bet on a specific claim: a deterministic transport protocol is the right abstraction layer for AI semantic exchange — not a framework, not a SaaS, not a vendor lock-in. The format must be open, deterministic, and grammatically grounded so that any LLM, any database, any stream processor, and any agent can produce and consume it without coordination.
It must be positional, not keyed — so the schema lives in the spec, not in every payload. It must be grammatically complete — so the same fact can be retrieved by who, by what, by where, by when. It must be human-readable — so debugging happens without a decoder. And it must be free — public domain, no patents, no rent.
Pāṇini wrote down those grammatical primitives in the 5th century BCE. NASA's Rick Briggs wrote in 1985 that those primitives map directly onto AI knowledge representation. ASHRU is a 21st-century transport protocol for an observation about meaning that has been right for 2,500 years. The window for it to become an infrastructure layer is now — because the LLMs that will define the next decade are being built right now, and they all need to talk to each other, and to your knowledge graph, and to the same agent two weeks from now.
We don't know which AI infrastructure standards will compound for the next thirty years. We do know that some of them will. A semantic transport layer is one of the empty slots — and ASHRU is the most defensible candidate, because it claims nothing more than what humanity already proved 2,500 years ago.
Questions you should be asking.
Why not just use JSON with structured outputs? +
Why not Protobuf or MessagePack? +
Why not YAML? +
Why not CSV / TSV / NDJSON? +
What about hallucinated columns / malformed lines? +
Does ASHRU work with my existing extractor (LangChain / LlamaIndex / Instructor / raw API)? +
Where is the Sanskrit grammar from? Is it copyrighted? +
Does ASHRU work with Pydantic / OpenAI Structured Outputs / native JSON-Schema validation? +
What's the catch? +
Found another concern we didn't address? Open an issue.