Skip to content

Quick start

From install to typed JSON in five minutes. Or skip to letting your agent do it.

Install

brew install texomy/tap/texomy

macOS (Apple silicon) and Linux (x64, arm64). Upgrade with brew upgrade texomy/tap/texomy.

Prefer a manual download? Get the binaries from GitHub releases.

Write a spec

Create a folder with a file money.yml. Each top-level key is a type. Nested keys are subtypes. Money has two fields and two patterns, for a currency before or after the amount.

Currency:
  USD: [ 'USD', '\$' ]
  EUR: [ 'EUR', '€' ]

Number:
  Integer: '\d+'
  Decimal: '\d+\.\d+'

Money:
  $fields:
    currency: Currency
    amount: Number
  $patterns:
    - '#{currency}\s?#{amount}'
    - '#{amount}\s?#{currency}'
  • ${Type} uses a type inside a pattern.
  • #{field} captures a field, typed as declared under $fields.
  • Patterns are regular expressions; escape $ and . as usual.

Check that it compiles:

texomy check
ok    money (7 types)
OK: 1 modules, 0 with errors

Parse

echo 'Paid $120.50 on Monday, refund of 40 EUR pending.' | texomy parse -m money --format yml
- type: 'Money'
  start: 5
  end: 12
  fields:
    currency: { type: 'Currency::USD', start: 5, end: 6, text: '$' }
    amount: { type: 'Number::Decimal', start: 6, end: 12, text: '120.50' }
- type: 'Money'
  start: 34
  end: 40
  fields:
    currency: { type: 'Currency::EUR', start: 37, end: 40, text: 'EUR' }
    amount: { type: 'Number::Integer', start: 34, end: 36, text: '40' }

Every node has its concrete type, such as Currency::USD or Number::Decimal, and its start and end as UTF-16 offsets in the input. Leaves carry their text. The default output is JSONL, one match per line; use --format json or yml for one document. A summary goes to standard error, so pipes stay clean.

Parse a file and write the result:

texomy parse payments.txt -m money --output payments.jsonl

Test

Pin the expected output in tests/money.test.yml:

$imports: 'money'

amount after currency:
  input: '$120.50'
  output:
    - !Money { currency: !Currency::USD '$', amount: !Number::Decimal '120.50' }
texomy test
ok    tests/money.test.yml (1 cases)
PASSED: 1 test files

To draft a case, run texomy parse -m money --records whole --format yml on its input, review the output and paste it under output.

Records

Input is split into records before matching, and a match never spans two records. Records are read and written as a stream. Small records bound memory use; a large individual record or a complex spec can still need substantially more memory.

The CLI chooses the available logical CPU count for matching worker threads automatically; you can override it with --threads. Independent records can run in parallel. For logs, use texomy parse app.log -m log-entry --records lines: without --records lines, a log with no blank lines becomes one record, matched by one worker thread. More threads do not imply a proportional speedup.

--recordsA record is
paragraphslines between blank lines (default)
linesevery line
wholethe whole input
start=REGEXa line where REGEX matches, plus the lines after it, such as a stack trace

Let your agent do it

Add the MCP server to your coding agent, point it at a sample and say what you need. It reads the guide, writes the spec, checks and tests it, and parses the file.

claude mcp add texomy -- texomy mcp

More on the workflow and safety: AI agents.

Next

  • Types and inheritance: subtypes, inherited fields, narrowing.
  • Language reference: subtypes, lists, values, flags, imports.
  • CLI reference: every command and option.
  • Examples: invoices, bank statements, academic transcripts, bills of lading, resumes, postal addresses, insurance claims, contract clauses, access logs, reservation emails and financial reports.