← EpiDoc Workshop
Digital Epigraphy · An Assessment

EpiDoc XML or a DSL for an Agentic AI Environment?

A comprehensive assessment of which encoding layer best supports AI agents, retrieval pipelines, and model-in-the-loop scholarship in digital epigraphy. Written as a companion to the lecture deck "Boschetti & the ItAnt DSL" and grounded in the same corpus and figures.

1The question, and why its "or" needs unpicking

The question asks whether a domain-specific language (a DSL, of the ItAntDSL kind) or EpiDoc XML would be more suitable for moving toward agentic and other AI-centred working environments. Posed as an either/or, it invites a single winner. A comprehensive answer has to begin by resisting that framing, for two reasons.

First, the two things are not peers. EpiDoc XML is a storage and interchange standard. A DSL of the ItAnt type is a writing surface that compiles, in one direction, into that standard. They already stand in a producer-to-product relation. Asking which is more suitable is a little like asking whether source code or the compiled binary is more suitable: the answer depends entirely on which task, at which layer, you mean.

Second, and more interesting: the case the ItAnt paper made for a DSL was explicitly a case about human difficulty. EpiDoc XML is hard to write because it is verbose, redundant, unscannable, and gated behind training. Every one of those predicates is indexed to a human encoder who tires, mis-scans, and must be taught. An AI agent does not tire, does not lose its place in 310 lines, and does not need to be sent on a course. So the original rationale for a DSL does not transfer to the AI case unchanged. It has to be re-derived. When we re-derive it, we find that some of the DSL's advantages survive the move to AI, some evaporate, and several of EpiDoc XML's apparent vices turn, for a machine, into virtues. That re-derivation is the substance of this assessment.

2What an AI working environment actually demands

Before judging either format we should be explicit about what an agentic or AI-centred environment asks of an encoding. Six demands matter, and they will serve as the scorecard for everything that follows.

Token economy. Language models read and write in tokens and operate inside a finite context window. Every character of markup is a token spent. A format whose stored size is three to twenty times its informational core (the deck measured the abbreviated word m(eddís) at eight meaningful characters inside 135 stored) is, for a model, three to twenty times more expensive to place in context and to emit.

Reliable generation. When a model writes the format, longer and more deeply nested output presents a larger surface for error: unclosed tags, drifting attributes, colliding identifiers. A format the model can emit in few tokens, and whose validity can be checked mechanically, is safer to generate.

Explicit semantics for reasoning. When a model reads the format, to answer a question, to retrieve, to cross-reference, it benefits from semantics carried on the surface rather than implied. A tag that says type="praenomen" can be reasoned over and cited directly. A bare token whose grammatical status must be re-inferred cannot.

Verifiability. Agentic systems act with a degree of autonomy, so every action they take must be checkable. The encoding should make it cheap to validate both what the agent produced and what it claims to have read.

Interoperability and linkage. An agent worth having does not work in a sealed room. It calls tools, exports to other systems, and follows links to gazetteers and authority files. The encoding should connect the corpus to the wider machine-readable world rather than isolating it.

Durability and model-independence. Models, model formats, and the fashions of an "AI-friendly" representation change every year. The layer that is stored and archived must outlast all of them.

The rest of this assessment runs EpiDoc XML and a DSL against these six demands, then draws the architecture that follows.

3EpiDoc XML against the six demands

On token economy EpiDoc XML is weak, and there is no disguising it. Verbosity is its defining cost for a model: the 96 percent of m(eddís) that is scaffolding is, in context-window terms, 96 percent waste. For an agent that must hold many inscriptions at once, this compounds.

On reliable generation it is weak to moderate. Emitting a three-hundred-line file token by token invites structural drift. Two things soften this. Models have seen an enormous quantity of XML and HTML in pretraining, so well-formedness is a strong prior, and the result can be checked against the EpiDoc RELAX NG schema. But a strong prior is not a guarantee, and a schema catches a fault only after it has been produced.

On explicit semantics for reasoning EpiDoc XML is strong, and this is its great strength for AI. Every editorial distinction is a named element. An agent answering "list the praenomina in this corpus" or "find every restoration" reads them straight off the tags. Every claim the model makes maps to a tagged span, which is the precondition for traceability. The file is also self-contained: a single EpiDoc file carries its own meaning without reference to an external rule set.

On verifiability it is strong for the stored artifact. The schema constrains structure, and structure constrains the space of possible errors. The honest limit is that schema validation catches well-formedness and structural legality, not semantic correctness: a wrong but legal tag passes. That limit, though, applies to any format.

On interoperability and linkage EpiDoc XML is strong to the point of being decisive. It is a twenty-year international standard with a large existing tool surface, and its typed external links to Pleiades, Trismegistos and Getty make each file a node in a knowledge graph rather than an isolated text. For agentic, tool-calling, linked-data reasoning this is close to the whole game.

On durability and model-independence it is again decisive. A plain-text, schema-defined, widely-implemented standard will be readable when today's models are historical curiosities.

EpiDoc XML is weak exactly where the model writes, and on raw token cost, and strong everywhere the model reads, reasons, links, and archives.

4The DSL against the six demands

On token economy the DSL is strong. Compactness is its reason for being: roughly threefold on average and up to twentyfold on dense abbreviated tokens. For long-context tasks this is a real and large saving.

On reliable generation the DSL is strong, with one condition. Short output means a small error surface, and the formal ANTLR grammar is the genuine prize here. A formal grammar is not merely a validator after the fact. It is the kind of artifact that can be turned into a decoding constraint, so that the model is prevented from emitting an ill-formed draft in the first place, and any draft can be checked and rejected before it ever touches the corpus. That is real value for agentic generation. The condition is unfamiliarity: the model has never seen ItAntDSL in pretraining, because it is one small project's notation. Without the grammar or worked examples held in context, the model's prior for the DSL is weak, whereas its prior for XML is native. The DSL must be taught in-context every time.

On explicit semantics for reasoning the DSL is weak, and this is its hidden cost. The DSL is compact precisely because it removes information from the text. The identifier, the language tag, the word's position, even the fact that round brackets denote an editorial expansion, all of this lives in the compiler and the shared lookup tables, not in the DSL string. The DSL is only semantically complete as the sum of its text plus its grammar plus its lookup tables plus its compiler. An agent handed a DSL fragment in isolation cannot reason over it as richly as over a self-contained XML file.

On verifiability the DSL is strong for syntax, through the grammar, but only for syntax, and a deeper gap appears under the next demand.

On interoperability and linkage the DSL is weak. A DSL is private by construction. An agent that speaks only DSL is isolated, because nothing else in the ecosystem reads it. This is simply the deck's own fragmentation risk seen from the machine's side.

On durability and model-independence the DSL is weak as a stored form, and the lecture deck's own iron rule already forbids archiving it. Nothing about AI changes this. If anything, AI sharpens it.

The DSL is strong exactly where the model writes, and weak everywhere the model reads, links, and archives. It is the mirror image of EpiDoc XML.

5Scorecard at a glance

Six demands of an AI environment, two formats
DemandEpiDoc XMLDSL (ItAntDSL type)
Token economyWeak: three to twenty times its informational coreStrong: compactness is its reason for being
Reliable generationWeak to moderate: long nested output drifts, though it is familiar from pretraining and schema-checkable after the factStrong: small output, plus a formal grammar that can constrain decoding and reject invalid drafts, but the notation is unfamiliar to models
Explicit semantics for reasoningStrong: every distinction is a named, citable element, and the file is self-containedWeak: compact because the semantics are moved into the compiler and lookup tables, so it is not self-contained
VerifiabilityStrong for the stored artifact, through schema validationStrong for syntax, through the grammar, but undermined by the lack of a round-trip
Interoperability and linkageStrong, near-decisive: a twenty-year standard, large tool surface, typed authority linksWeak: private by construction, and therefore isolating
Durability and model-independenceStrong, near-decisive: plain text, schema-defined, ubiquitousWeak: it must not be archived, by the deck's own rule

6The crux: reading is not writing

Set the two scorecards side by side and a clean asymmetry appears. EpiDoc XML is the better format for a model to read, reason over, retrieve from, link, cite, and archive. A DSL is the better format for a model to write. The verbosity that makes XML a poor generation target is the very explicitness that makes it a good reasoning substrate. The compactness that makes a DSL a good generation target is the very implicitness that makes it a poor reasoning substrate. These are the same property seen from two ends.

This means the either/or in the question dissolves into an and, distributed across the agent's workflow rather than settled once for the whole system. The lecture deck already gestured at this in its slides on connecting the corpus to a local model: the model drafts the compact DSL, the grammar validates the draft, the compiler produces guaranteed-valid EpiDoc. The assessment here simply generalises that picture: the agent reads EpiDoc XML, or a projection of it, and writes a DSL.

It is worth reframing the phrase "hard to write" precisely at this point. For a human, the DSL's payoff was friendliness: it looked like the Leiden conventions, it was scannable, it was learnable. For a machine those payoffs are worth nothing. The machine-relevant payoff of a DSL is narrower and sharper: token economy, and a low-error, grammar-constrained, validatable generation target. A DSL designed for AI would therefore look different from one designed for humans. It would not need to resemble Leiden at all. It would need a clean formal grammar and a minimal token footprint. It is, in truth, closer to a structured-output schema than to a scholarly notation.

7The round-trip problem becomes decisive

For a human-facing DSL the missing round-trip (the deck listed it as risk five) was a fix it labelled merely "recommended." For an agentic environment it is very nearly disqualifying for any DSL-centred design, and the reason is specific.

Agentic work over a living corpus is iterative: read the current state, propose a change, write it back, repeat. If the canonical store is EpiDoc XML, and it must be, on grounds of durability, and the agent can only generate DSL, then to edit an existing inscription the agent needs that inscription as DSL. With no path from XML back to DSL, it cannot get there. The agent is therefore confined to creating new editions from scratch in DSL and is locked out of revising the editions that already exist. Most real scholarly and curatorial work is revision, not creation. A one-way DSL supports only the minority case.

So if a DSL is to serve an AI environment at all, the round-trip the deck called "recommended" is promoted to "required." And the irony the deck itself flagged is worth repeating: even ItAnt cannot regenerate clean DSL from its own files. Until that is solved, a DSL cannot be the agent's working representation for the corpus that already exists. It can only be a generation target for new material.

8The third option, and why explicitness is generative

Agent-native environments increasingly favour neither verbose markup nor a human notation, but typed structured intermediate representations: JSON objects, RDF triples, knowledge-graph nodes, typed function-call schemas. One could reasonably ask whether the right AI format is none of the above but a JSON or RDF projection of the data.

The answer matters, and it favours XML in a subtle but strong way. Because EpiDoc XML is fully explicit, any compact or agent-shaped view can be derived from it mechanically: a JSON record for a tool call, an RDF graph for linked reasoning, a stripped compact string for a context-window payload, even a DSL-like rendering, which is exactly what a round-trip is. Explicitness is generative. From the fully-tagged form you can project, losslessly, to whatever shape a given agent or model wants. The reverse does not hold. From the lossy DSL you cannot recover what the compiler added. From a compact projection you cannot recover what compaction dropped.

The format you should make canonical is the most explicit one, because explicitness is the only property from which all other shapes can be cheaply manufactured.

EpiDoc XML is that format. The DSL, and JSON, and RDF, and the compact context payload, are all best understood as views projected from it for particular consumers, the agent's writing hand among them.

9The verdict

The layered answer, which is the correct one, has four parts.

Canonical layer: EpiDoc XML. The stored, archived, cited, model-independent record. Non-negotiable, and the move to AI strengthens rather than weakens the case, because agents need a ground truth that does not move when models do.

Reasoning and retrieval layer: EpiDoc XML, or projections of it. JSON, RDF, or compact views generated per task. The agent reads explicit structure, retrieves by typed fields, cites tagged spans, and follows authority links.

Generation layer: a DSL, or more precisely a formal grammar. The model's writing target: compact, low-error, and usable both as a decoding constraint and as a validation gate, before the compiler produces guaranteed-valid XML.

Mandatory connective tissue: a round-trip from XML to DSL, without which the agent cannot revise the existing corpus.

The forced-choice answer, if the question insists on a single winner, is EpiDoc XML. Not because it is pleasant for a model to emit, it is not, but because it is the only one of the two that can occupy every layer. An agent can read XML, reason over XML, link from XML, archive XML, and, with validation, even write XML. A DSL can occupy exactly one layer, generation, and even there only for new material, and even then only as a front-end whose output is immediately turned into XML. A format that is load-bearing everywhere beats a format that is an optional optimisation in one place. EpiDoc XML is load-bearing everywhere. The DSL is an optional optimisation at the writing layer.

In an AI working environment EpiDoc XML is the substrate, and a DSL is at most an accelerator. You can build the environment with XML alone. You cannot build it with the DSL alone.

10Caveats and honest limits

Several honest qualifications keep this verdict from hardening into dogma.

The token cost of XML is real, not rhetorical. For very-long-context tasks, a whole edict or a whole dossier, it bites. The mitigation is projection: feed the agent a compact derived view and keep the XML canonical. That is an engineering cost, not a reason to abandon XML.

Models will improve at both formats, and the balance is time-bound. A future model with a far larger context window and stricter structured-output discipline narrows XML's generation disadvantage. A DSL corpus that grew large and public could enter pretraining and lose its unfamiliarity penalty. This assessment describes the situation as it stands, not a permanent law.

Neither format solves the real problem. The hard part of an AI epigraphy environment is not syntax but semantic correctness: is this truly a praenomen, is this restoration sound. No schema and no grammar catches a well-formed falsehood. The choice of format changes the error surface and the cost of checking. It does not remove the need for an expert authority. The discipline the lecture deck insisted on, that the model proposes and the scholar disposes and the EpiDoc XML is the record, survives intact into the agentic case.

The overlapping-hierarchy problem, a name encoded inside a gap, burdens XML and a DSL equally, and so it does not discriminate between them. It is a reason to be modest about any tree-structured encoding, not an argument for one side.

11Bottom line

For moving toward agentic and other AI working environments, EpiDoc XML is the more suitable format, because suitability here means the capacity to serve as the substrate, and only EpiDoc XML has it. It is the explicit, self-contained, interoperable, linkable, durable, model-independent record from which every other useful shape, including the agent's own compact writing format, can be projected. A DSL remains valuable, but in a narrower and now precisely locatable role: as the model's generation interface, where compactness and a formal grammar lower the error surface and constrain decoding. Its worth for AI is genuine, but it is an accelerator at one layer, not a foundation.

The lecture deck's iron rule was that whatever a team writes in, the stored edition must be standard EpiDoc XML. The move to an AI environment does not loosen that rule. It tightens it. When the agents, the models, and the AI-friendly formats of the moment have all been replaced two or three times over, the corpus must still be there, fully tagged, fully linked, and readable without any of them. That is a description of EpiDoc XML, and it is why the substrate question has only one answer.