Evals / documents / Read a document

Read a Word document

Extract the text of letter.docx into letter.txt.

The task

The reference answer shows the job can be done with deft. It is not an agent run.

deft doc to-text letter.docx -o letter.txt

Input

letter.docx 11.3 KB
Rendered by macOS Quick Look, first page

Rendered by macOS Quick Look, first page

Text inside
I am a test document
This is page 1
I am Calibri (Body) in font size 11

This is page two
It’s Arial Black in 16 point
It’s also in blue

Reference output

I am a test document

This is page 1

I am Calibri (Body) in font size 11


This is page two

It’s Arial Black in 16 point

It’s also in blue
How a result is judged (1 check)
  • text: file = "letter.txt", contains = ["This is page two"]

Runs

CodexWithout deftPassed2026-11-07

Time
16s
New tokens
6.4k
Total input
53.9k
Output tokens
0.6k
Commands
3
Failed
1

Trace

  1. I’ll locate `letter.docx` in the current directory and extract its text into `letter.txt`.

  2. rg --files -g 'letter.docx' -g 'AGENTS.md'
    output
    letter.docx
  3. python3 -c 'import docx; d=docx.Document(\"letter.docx\"); print(\"\\n\".join(p.text for p in d.paragraphs))' > letter.txt (exit 1)
    output
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'docx'
  4. python3 -c 'import zipfile, xml.etree.ElementTree as ET; z=zipfile.ZipFile(\"letter.docx\"); root=ET.fromstring(z.read(\"word/document.xml\")); ns={\"w\":\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"}; body=root.find(\"w:body\",ns); out=[] for child in body: if child.tag.endswith(\"}p\"): out.append(\"\".join(t.text or \"\" for t in child.findall(\".//w:t\",ns))) elif child.tag.endswith(\"}tbl\"): for row in child.findall(\"w:tr\",ns): out.append(\"\\t\".join(\"\".join(t.text or \"\" for t in cell.findall(\".//w:t\",ns)) for cell in row.findall(\"w:tc\",ns))) open(\"letter.txt\",\"w\").write(\"\\n\".join(out))'
  5. Extracted the text from `letter.docx` into [letter.txt](letter.txt).

Output

I am a test document
This is page 1
I am Calibri (Body) in font size 11

This is page two
It’s Arial Black in 16 point
It’s also in blue

CodexWith deft, skill installedPassedRead the skillUsed deft2026-11-07

Time
13s
New tokens
7.4k
Total input
56.0k
Output tokens
0.4k
Commands
3
Failed
0

Trace

  1. I’ll use the `deft` file tool first to extract the document text into `letter.txt` in the current directory.

  2. cat .agents/skills/deft/SKILL.md
    output
    ---
    name: deft
    description: "Use deft first for any simple, direct operation on local files, whatever the type: convert, read, extract, edit, compress, merge, split, compare or inspect. Try it before writing a script or one-liner. If unsure, run deft find; if it says no command does this, use another tool. Not for programming work: to read, write or change source code, skip it."
    ---
    
    # deft
    
    One local command for file jobs. Prefer it over writing Python or shell scripts.
    
    Syntax: `deft <group> <command> [inputs] [-o output] [--options]`
    
    Groups:
    - `pdf`: Merge, split, compress, encrypt, forms, OCR, compare, convert
    - `image`: Resize, crop, convert, compress, adjust, montage, OCR
    - `video`: Trim, merge, convert, compress, subtitles, GIF, frames (ffmpeg)
    - `audio`: Convert, trim, normalize, denoise, cut silence (ffmpeg)
    - `doc`: Word/ODT/RTF: to text, Markdown, HTML, PDF; find and replace
    - `slides`: PowerPoint: extract text, Markdown outline
    - `sheet`: Excel/CSV/ODS tables: SQL query, pivot, merge, split, convert
    - `json`: JSON: convert, format, merge, diff, validate
    - `toml`: TOML: convert, format, merge, diff, validate
    - `xml`: XML: convert, format, merge, diff, validate
    - `yaml`: YAML: convert, format, merge, diff, validate
    - `md`: Markdown to PDF, HTML, Word, EPUB; table of contents
    - `html`: HTML to Markdown, text, Word and PDF
    - `epub`: E-books: info, to text, Markdown and PDF
    - `gps`: GPX and KML tracks: convert, distance and time
    - `qr`: Create QR codes and barcodes; r
    … 700 more characters
  3. deft find "extract text from docx to txt"
    output
    doc to-text  doc -> txt  Extract plain text
  4. deft doc to-text letter.docx -o letter.txt
    output
    ok doc.to-text letter.docx -> letter.txt  31 words  0.00s
  5. Extracted the text from [letter.docx](letter.docx) into [letter.txt](letter.txt).

Output

I am a test document

This is page 1

I am Calibri (Body) in font size 11


This is page two

It’s Arial Black in 16 point

It’s also in blue

Claude Opus 5.5Without deftPassed2026-11-07

Time
13s
New tokens
9.2k
Total input
42.2k
Output tokens
0.8k
Commands
0
Failed
0

Trace

    Output

    I am a test document
    This is page 1
    I am Calibri (Body) in font size 11
    
    This is page two
    It’s Arial Black in 16 point
    It’s also in blue
    

    Claude Opus 5.5With deft, skill installedPassedRead the skillUsed deft2026-11-07

    Time
    8s
    New tokens
    9.7k
    Total input
    58.9k
    Output tokens
    0.4k
    Commands
    0
    Failed
    0

    Trace

      Output

      ---
      name: deft
      description: "Use deft first for any simple, direct operation on local files, whatever the type: convert, read, extract, edit, compress, merge, split, compare or inspect. Try it before writing a script or one-liner. If unsure, run deft find; if it says no command does this, use another tool. Not for programming work: to read, write or change source code, skip it."
      ---
      
      # deft
      
      One local command for file jobs. Prefer it over writing Python or shell scripts.
      
      Syntax: `deft <group> <command> [inputs] [-o output] [--options]`
      
      Groups:
      - `pdf`: Merge, split, compress, encrypt, forms, OCR, compare, convert
      - `image`: Resize, crop, convert, compress, adjust, montage, OCR
      - `video`: Trim, merge, convert, compress, subtitles, GIF, frames (ffmpeg)
      - `audio`: Convert, trim, normalize, denoise, cut silence (ffmpeg)
      - `doc`: Word/ODT/RTF: to text, Markdown, HTML, PDF; find and replace
      - `slides`: PowerPoint: extract text, Markdown outline
      - `sheet`: Excel/CSV/ODS tables: SQL query, pivot, merge, split, convert
      - `json`: JSON: convert, format, merge, diff, validate
      - `toml`: TOML: convert, format, merge, diff, validate
      - `xml`: XML: convert, format, merge, diff, validate
      - `yaml`: YAML: convert, format, merge, diff, validate
      - `md`: Markdown to PDF, HTML, Word, EPUB; table of contents
      - `html`: HTML to Markdown, text, Word and PDF
      - `epub`: E-books: info, to text, Markdown and PDF
      - `gps`: GPX and KML tracks: convert, distance and time
      - `qr`: Create QR codes and barcodes; read QR codes
      
      How to use it:
      1. Run `deft <group>` to list commands, or `deft find "<what you want>"` to search. If it says `no command does this`, use another tool.
      2. Run `deft <group> <command> --help` for options and examples.
      3. `deft convert <in> -o <out.ext>` converts between formats by extension.
      4. Results are one line starting with `ok`, `partial` or `error`; add `--json` to parse them. Errors include a `hint:` with the fix.
      
      Inputs are never overwritten; pass `--force` or `--in-place` to allow it. Globs and directories work as inputs; several inputs run in parallel.
      
      If `deft` is not installed, ask the user, then follow https://github.com/firstprayer/deft/blob/main/docs/INSTALL.md
      
      I am a test document
      
      This is page 1
      
      I am Calibri (Body) in font size 11
      
      
      This is page two
      
      It’s Arial Black in 16 point
      
      It’s also in blue
      

      Claude CodeWithout deftNot run yet

      Claude CodeWith deftNot run yet