Hive Intelligence

Documentation

/ Reference

hive-ingest

0.9.0 docs, commit 05e2eb4PyPI packages at 0.9.0docs/reference/hive-ingest.mdpublic repository on GitHub
Coming after 0.9.0vf-hive-ingest is not on PyPI yet. The install commands on this page work after its first release.

Ingest tools for a folder of technical files. Package hiveingest, CLI hiveingest. It runs on the machine that holds the files.

Today the package does eleven jobs:

  1. It accounts for every file of a folder, and it says which handler takes each file.
  2. It excludes credential files before any handler sees them, also an archive or an Office package that holds one.
  3. It settles which handler takes each file that the claims leave open, on the escalation ladder. The ladder also takes the questions about sheets.
  4. It makes document records from DOCX, PPTX, PDF, HTML, Markdown and plain text files. Docling reads these files.
  5. It makes mapping records and table records from XLSX and CSV files. It reads these files itself.
  6. It makes diagram records from drawings and pictures. Code reads Visio and PowerPoint shapes and the text of metafiles. The assistant session reads the pictures that code cannot read.
  7. It builds API records from API specifications. The api handler hands its files to hive-apispec.
  8. It masks secrets inside text before a record holds the text, and before Jev or Claude sees it.
  9. It leaves bloat out of the document records, and it lists every removal.
  10. It builds the gap map of a corpus: what the corpus lacks or holds weakly.
  11. It places the elements of records in a corpus, and it proposes each change.

The other handlers only claim files. The package writes no concept card into a corpus. The package puts only the API records, which are dbobject cards, into a corpus, and only into the folder that you name. If you copy the other records into a corpus, hive-serve reads them.

The scan calls no model. No extraction calls a language model. The escalation ladder can call one model: Jev, TypeSafe's System One model. It settles open routing questions, diagram questions and sheet questions, it judges the passages of a document record that may be bloat, and it picks the place of an element.

Run it

pip install vf-hive-ingest
hiveingest scan /path/to/ingest-folder
hiveingest decide <job>
hiveingest --docling-url http://127.0.0.1:5001 extract <job> --namespace acme
hiveingest extract-sheets <job>
hiveingest diagrams <job>
hiveingest decide <job>
hiveingest coverage <job>
Command What it does
scan <folder> [--routing FILE] scans every file into a new job and prints the run summary
coverage <job> prints the summary of a job, and fails if a ledger has a hole
decide <job> settles the open questions with code, then Jev: handlers, diagrams, bloat and sheets
pending <job> [--limit N] prints the decisions that wait for Claude (--limit defaults to 5)
answer <job> <decision> <choice> --reason TEXT records the answer of Claude
queue <job> prints the items that wait for a person
settle <job> <decision> <choice> --reason TEXT records the answer of a person
extract <job> [PATH ...] [--namespace NAME] makes document records and prints what it made
extract-sheets <job> [PATH ...] [--namespace NAME] makes mapping records and table records and prints what it made
elements <job> <document> [--state STATE] [--offset N] [--limit N] prints a page of the elements of one record (--offset 0, --limit 20, max 100)
diagrams <job> [PATH ...] [--namespace NAME] makes diagram records and prints what it made
diagram-elements <job> [--state STATE] [--offset N] [--limit N] prints a page of the shapes and pictures (--offset 0, --limit 20, max 100)
pictures <job> [--limit N] prints the pictures that wait for transcription (--limit defaults to 5, max 20)
transcribe <job> <file> takes a JSON file with a list of transcriptions
restore <job> <element> --reason TEXT a person restores a left-out element with a correction
apispec <job> --out DIR --product NAME [--id-prefix ID] [--plugin FILE] builds API records from a job
gaps <corpus> [--scope NAME] [--eval-reports DIR] prints the gap map of a corpus
place <job> <element> ... --corpus DIR --scope NAME places elements of records in a corpus
changes <job> [--limit N] prints the placements that wait for a change (--limit defaults to 5)
write <job> <file> takes a JSON file with a list of changes
serve runs the MCP server over stdio

These options go before the command.

Option What it names
--version prints the installed vf-hive-ingest version and exits
--jobs-dir DIR the directory that holds the jobs. The default is $XDG_STATE_HOME/hive-ingest/jobs, or ~/.local/state/hive-ingest/jobs
--docling-url URL the docling-serve that reads the files. See Docling
--docling-api-key-file FILE a file that holds the API key of docling-serve

A command that refuses prints the reason and exits with a nonzero status.

Use it from an assistant

Register the server with your MCP client. For Claude Code:

claude mcp add hive-ingest -- hiveingest --docling-url http://127.0.0.1:5001 serve
Tool Arguments Returns
scan_folder path, optional routing_file the run summary of a new job
extract_documents job, optional namespace, optional paths what the run made: the first left-out elements and gaps, counts, bloat counts, tracked change counts, short lists and the directory of the records
extract_sheets job, optional namespace, optional paths what the run made: the first left-out elements and gaps, the counts of rows and pairs, and a short list of records
list_elements job, document, optional state, offset, limit a page of at most 100 elements of one record
extract_diagrams job, optional namespace, optional paths counts of drawings, edges and pictures, the first gaps and left-out elements, and the documents that still need a record
list_diagram_elements job, optional state, offset, limit a page of at most 100 shapes and pictures
pending_pictures job, optional limit a few pictures that wait for the assistant, each with the path of its file and the text around it
transcribe_pictures job, pictures the state of each picture after the label check. One bad item applies none
coverage job the run summary of that job, with the bloat counts
decide job the run summary after code and Jev, and the Jev counts of this run
pending_decisions job, optional limit a few decisions that wait for Claude, each with its options and a short excerpt
answer_decisions job, answers (each an id, choice and reason) counts after the answers. One bad answer applies none
person_queue job the items for a person, each with the path of its draft card
run_apispec job, out, product, optional id_prefix the counts of the API records
find_gaps corpus, optional scope, eval_reports the gap map: counts and short lists
place_record job, corpus, scope, elements counts of the placements and the first ten
pending_changes job, optional limit a few placements that wait for a change of the assistant
write_changes job, changes counts after the changes. One bad change applies none

The two paths of scan_folder, the out folder of run_apispec, the corpus folder and the eval_reports folder must be absolute. The paths of the three extractions are ledger paths. The tools return ids, counts and short lists. They never return a whole file, sheet or document, or the bytes of a picture. The summaries hold file names. pending_decisions holds the first rows or lines of a file, a grey-zone passage with the text around it, or the rows of a sheet question. extract_documents and extract_sheets return up to 200 characters of each listed left-out text or gap, and list_elements returns up to 200 characters of the text of each element that has one, also of a tracked change. list_diagram_elements returns up to 200 characters of the text of a shape or picture element. pending_decisions and person_queue name the edge or the transcribed text that an item is about. pending_pictures returns the text around a picture, and the assistant opens the picture file itself. For a placement, pending_decisions and pending_changes return the element and the paths of cards, and the assistant opens the cards itself. So the assistant sees these, apart from what the credential check withholds. A refusal of run_apispec can quote a name or a reference from a specification. The URL of docling-serve comes from the command line only. A tool call cannot change where the extraction sends the files.

No tool records the answer of a person. A person records it with hiveingest settle or hiveingest restore, and nothing else records the actor person. A pin has its own actor, pin.

The flow

How hive-ingest accounts for every file
Rendered at build time from the document's own Mermaid source, in the repository's house style.

The file ledger

Each file of the folder has exactly one entry. Hidden files, files with unknown extensions, symbolic links and special files all count. The scan never follows a link.

Each entry holds these fields.

Field Content
path path relative to the ingest folder
size, sha256 size in bytes and hash of the content
format, evidence the detected format and what showed it
extension_mismatch a note when the extension does not match the content
family, file_version the version family
state, handler, candidates the routing result
claims each certain or probable claim, with its evidence
pin the pin that matched the file, if one did, with the path of its routing file in source
reason why a file is unhandled or excluded
member, members_checked the member that excluded the file, if one did, and the number of checked members
decided_by the actor that decided the state: code, pin, jev, claude or person. Empty while the file is ambiguous
decision the id of the ladder decision on the file, if one exists
failed_handler the handler that failed on the file, kept on an unhandled entry after an extraction failure until a later run or decision clears it

The gate

The scan fails, and it saves no job, in each of these cases:

  • the ledger and the folder do not list the same files;
  • a file changes while the scan runs;
  • a directory cannot be listed, so its files cannot be counted;
  • two handlers are each certain of one file;
  • the routing file is not valid.

coverage checks the stored ledger again. It fails when an entry has no state, when a path occurs twice, or when the counts do not add up to the file count of the folder. It also fails when a decided entry names no actor, and when the person queue holds an item of another kind than the four kinds.

An unhandled file does not fail the scan. The summary lists these files first.

Credential files

A credential or secret file must never reach a model or a converter. The scan reads the content of each file before it names the format and before a handler sees the file.

The content Reason in the ledger
a JSON service account key with a private key credential: service account key
a JSON OAuth client file with a client secret credential: OAuth client secret
a JSON OAuth user file with a refresh token credential: OAuth refresh token
a PEM private key block, also inside a text, JSON or YAML file credential: private key block
an OpenSSH, PGP or PuTTY private key credential: OpenSSH private key, and so on
a DER private key (PKCS#1, PKCS#8 or SEC1) credential: private key (DER)
a PKCS#12 file credential: PKCS#12 keystore
a JKS or JCEKS file credential: Java keystore
a KeePass database credential: KeePass database
a settings file that gives a value to a name such as API_KEY, CLIENT_SECRET, GITHUB_TOKEN, DB_PASSWORD, SMTP_PASS or password, or a URL with a password, such as postgres://user:password@host credential: settings file with secrets
a settings file with an AWS access key or session token, such as an AWS credentials or config file credential: AWS access keys
a kubeconfig in which a user has client-key-data, client-certificate-data or a token credential: kubeconfig credentials
a .netrc file with a password credential: netrc password file
a .pgpass file credential: PostgreSQL password file

Such a file has the state excluded and no handler. Its format is credential, and it has no evidence and no claim. A pin cannot send it to a handler, and the summary lists the pin as unused. The summary counts these files by kind under credentials. The check keeps the kind, and the name of the member if one holds the credential. It never logs, prints, returns or stores a value from the file. If the check itself fails, the file is unhandled.

A private key marker with no key after it does not count, so a text that only names the marker stays a document. Each extraction runs the same check again on the bytes that it reads, before it sends or records them.

The content decides, not the file name, with one exception for Markdown files. JSON credential parsing applies to files up to 8 MiB, UTF-16 decoding up to 64 MiB, and the last five kinds count only in a file of at most 1 MiB.

Settings files

A settings file is a file in which every line is a name=value assignment, a section name such as [database], a comment or empty. For example, .env files and INI files are settings files. A file with any other line is not one, so it stays a document.

A name is secret when one of its words is key, keys, pass, pw or creds, or ends in a word such as secret, token, password, pwd or credentials. A name whose last word is url or uri, such as TOKEN_URL, is not secret. A URL with a password counts under every name. A value that is empty does not count. A value, or a password in a URL, also does not count if the whole of it is a bare reference such as ${API_KEY} or a placeholder such as <your key>. A bare reference has only letters, digits and _ between the braces. Therefore $API_KEY counts as a value in every quoting style, and so does a reference with a fallback, such as ${API_KEY:-value}. As in python-dotenv, # starts a comment after = only if white space comes before it.

A Markdown file (.md or .markdown) with a # heading is a document even when every line has this shape. An AWS access key in it still counts.

The rule does not read lines of the form name: value. Therefore it does not judge YAML files, such as an API description or a CI workflow.

Archives and Office packages

The scan opens each ZIP archive and each Office package, and it runs the same check on each member. The members include the embedded files, the custom XML, the document properties and the embedded objects. The scan also opens an archive inside an archive, and an embedded object that holds a whole file.

If one member is a credential file, the whole outer file is excluded. The reason names the kind and the member, such as credential: private key block (member: backup.zip!keys/id_rsa). The character ! separates an archive from a member inside it. The file ledger holds the member and the number of checked members. The summary counts, under members, the checked members and the files that a member excluded.

If a file cannot be checked whole, it is unhandled with the reason credential check failed. This covers a damaged member, more than five levels of archives, more than 100,000 members, and more than 16 GiB of unpacked content. A member that has its own password is not read. An encrypted archive stays unhandled, as before.

Limits

  • The credential check finds files that are secrets. A password or a token inside the text of a document does not exclude the file. Masking removes it.
  • The check opens ZIP archives, Office packages and embedded objects. It does not open other archive formats, such as 7z or tar.

Secrets inside text

A document often holds a password in a sentence or in a table. Such a file stays, and code masks the value. The tool writes [masked] in its place. The label, the user name, the host and the other facts stay. The rules are in hiveapispec/mask.py, and hive-apispec uses the same rules for API records.

The text What goes
a label for a password, token, secret or key, with one word or several, such as Admin password: ... the value
a login note, such as log in with <user> / <value>, the password is <value> or user/password: <user> / <value> the password
a call or an element that pairs such a name with a value, such as set("password", "<value>") or <add key="password" value="<value>"/> the value
a column of a table that such a label heads, and the cell beside such a label (tables of two columns) the value in the cell
a URL or a connection string with a password the password
an Authorization, cookie or API key header, also a cookie header in quotes as a JSON field writes it, and a Bearer or Basic value the value
a key or token of a known format the key
a long random string near a word such as token or secret the string
another occurrence of a masked value that reads like a token the copy

Only ${NAME} and <name> count as a reference to a value, so they stay. A bare $NAME counts as a value.

Code masks these texts:

  • every part of a document record, its docling.json and the quotes in its element ledger;
  • every part of a mapping record or a table record: cells, formulas, comments, links, sheet names and the quotes in its element ledger;
  • what the diagram run reads in drawings and pictures, its diagram records and ledger, and what OCR and Claude read in a picture;
  • the rows and lines that the escalation ladder shows to Jev or Claude, before it cuts them short;
  • the text of a failure, of a failed check and of a card override, and the reason of an answer to a decision or of a restore;
  • the element that placement reads, the title and description of a card in its question, and the text and reason of a change;
  • API records, which hive-apispec masks.

Code reads each cell formula and each defined name in two ways: as written, and with its strings joined. Therefore a label in one string, as in ="password="&"...", marks the value in the next.

Each masked value of a document, a sheet, a drawing, a picture, an excerpt or an API record is on a left-out list, without the value. For a document record, a mapping record or a table record, the element ledger has an entry of kind masked value. The diagram ledger has the same kind of entry. In a PPTX file, the tables of the slides also mark values for the diagram run. For an excerpt, the decision has a step with the outcome masked. For an API record, gaps.jsonl has a row. Each states the state left out, the actor code, the place, the label and the detector. The label of a value in a text or a table is the secret word only, such as password for Admin password: the words around it may hold another secret.

Tables of two columns

If a secret label starts a table of two columns, the first row can name the two columns, or it can be a label and its value. Code reads the shape from the cell beside that label and the cells below the label. A cell is clearly a value if it is a reference, a long random string, or one word that reads like a secret and has a digit and a symbol. A cell is like the label if it holds only words and starts in the same letter case. Code applies the first row of this table that fits.

The cell beside the label The cells below the label What code reads
clearly a value any a label and its value. A cell below goes only if it reads like a secret, so keys such as Host stay
like the label, such as Owner beside Password, or empty at least one is not like the label two column names. The values below the label go
anything else, such as used by, Environment 2 or a password of letters only any both shapes, because nothing tells which one it is. A key or a column name can go with the password

Secrets in tracked changes

A deleted value or an inserted value is also a secret. In a Word file with tracked changes, code reads each text in three ways:

  • the text with all changes accepted;
  • the original text;
  • the text with all its characters.

Code masks each secret that one of these readings shows. The CriticMarkup marks stay. If the marks divide a value into parts, code masks each part inside its own marks:

Password: [masked]{--[masked]--}{++[masked]++}[masked]

Such a value is one secret. The ledger entry of a change quotes the change with the secret masked. If code cannot find the position of a part in that quote, it masks the full quote. The names of the authors of changes are not secrets, so they stay.

What masking does not find

  • A plain word that no label, table or sentence marks as a password.
  • A plain word of letters after a dash, as in Password - <word>, or in a sentence such as the password is <word>. It also stays after a label when more words follow it.
  • A plain word of letters in a table cell under or beside a label for a token, secret or key. After such a label in a line, such as secret: or token:, the word goes only if it has 8 or more letters, is not written as Word, and stands in quotes or ends the phrase.
  • A word of letters only after a label such as First token, because such a token is often a part of a screen or of a permission.
  • A word of letters with a question mark after it, as in save the password Always?, because it ends a question. After a label such as Password:, the value goes.
  • A value in the pixels of a picture. Code changes no picture, so the job keeps it and Claude sees it. Code masks only the text that OCR and Claude read in it.
  • A secret in the name of a file or a folder.

Masking is a guard, not a proof. Review records from client files before you commit them.

Document records

extract and extract_documents read the files that the document handler claimed in these formats: DOCX, PDF, HTML, Markdown and plain text. They also read the text and tables of each PPTX file, although the diagram handler claims it. The document handler also claims DOC and MHTML files. The summary lists these files under not_extracted_yet. DOC extraction, and an exact check of the text and tables of a PDF, are later work.

For each file, the run does these steps:

  1. It reads the bytes, and it runs the credential check on them and on the members of a package.
  2. It checks these bytes against the hash in the ledger.
  3. It counts the elements in the source itself.
  4. If a Word file holds tracked changes, it makes a copy that marks them.
  5. It sends the file, or that copy, to Docling under the name source.<format>. Markdown and plain text go as UTF-8 under the name source.markdown. Docling reads plain text only as Markdown, so the run puts plain text in one code block, and the text stays as it is written.
  6. It builds the record from the DoclingDocument, it masks the secrets as it builds, and it compares the record with the source.
  7. It writes the record into the job directory.

A file that already has a record is not read again, so you can run a stopped extraction again. If no converter can run, the run refuses before it touches a file.

What an extraction returns

The summary of extract and extract_documents starts with the job id, then left_out and gaps. Each of the two holds the count for the records that this run made, the first ten elements under listed, and the number not_listed. list_elements pages through all of them, one record at a time. bloat holds the bloat counts of the new records. The counts of files, elements, masked values and tracked changes follow. masked counts the masked values by detector. Each listed document also has its own tracked change counts. coverage gives the counts for all records of the job.

Where a record is

<job>/documents/<document>/<version>/
    record.yaml    the source file and version, the converter, the counts, sections, tables and figures
    text.md        the whole body text with section anchors, table row ids, figure marks and changes
    rows.jsonl     every table row below the column row, with its cells and its fields
    ledger.jsonl   every element and its state
    blocks.jsonl   each block of text.md as it was read, with the element that it shows
    docling.json   the DoclingDocument from Docling, with pictures, changes in CriticMarkup and masks

The records hold the content of the files. The run writes them into the job directory, which only its owner can read. find_records and get_record of hive-serve read records that you copy into a corpus. The citation lint resolves the ids that cards cite.

Ids

A document id is <namespace>/doc/<document>. The namespace is a client or a product name, and it is optional. One job keeps one namespace. The document name comes from the version family. The version is the one that the file name states, such as v1.2. A file with no version in its name gets sha- and the start of its hash. If two files with different content get the same document and version, both versions also get the start of their hash. Files with the same content share one record, and the record cites each of them.

Element Id
section acme/doc/widget-design@v1.2#list-of-widgets
table acme/doc/widget-design@v1.2#t4
table row acme/doc/widget-design@v1.2#t4.r9: table 4 in reading order, row 9 below the column row r0
figure acme/doc/widget-design@v1.2#fig05
tracked change acme/doc/widget-design@v1.2#chg-12: change 12 of the file

A section id comes from the heading text, not from its number, because numbers change between versions. The record keeps the number that this version shows. If two headings have the same text, the second one also carries the id of its parent section. Each slide of a presentation is a section.

The element ledger

Each element gets an id as the run reads it. Each element ends in one state.

State Meaning
recorded the element is in the record
left out the element is not in the record text. The entry holds the reason, the actor and the text or the picture hash. A bloat entry also holds its rule. An entry of kind masked value holds the place, the label and the detector in place of a text or a hash
gap the element is missing, damaged or not read yet. The entry holds the reason

The run stops if an element has no state. coverage checks every element ledger again.

Docling puts page headers, page footers and header pictures on its furniture layer. The run lists each of them as left out with the actor code. A footer can hold the real date of the last change, so the list keeps its text. Hidden content is left out too. A copy of a picture that a Word file keeps for old readers is left out.

Footnotes and endnotes of a Word file are body content, and the run keeps them, although Docling puts them on its furniture layer. Each one is recorded as a footnote or an endnote. The record text shows it at the end of the section that refers to it, and the ledger entry names that section. Docling does not say what refers to a note, so the run reads that from the source file. A note that only deleted or moved-away content refers to is part of that tracked change. Any other note that nothing in the accepted document refers to is left out. If the text that Docling returns for a note matches no note of the source, the record keeps it at the end of the text as section not known.

A review comment of a Word or PowerPoint file is recorded as a comment, and the record text starts it with > Comment:. An XML comment inside a Word file is a comment too. Only the notes of a slide are a speaker note.

The run keeps each figure, but it does not read what the picture shows. Therefore each figure is a gap until the diagram run settles its picture. A figure also holds the class that Docling gives the picture.

Tracked changes

A record keeps the tracked changes of a Word file in CriticMarkup:

The service {--used to poll --}{++now receives ++}each order.

A moved text appears two times: as {--text--} at its old place and as {++text++} at its new place. Deleted text is only inside {-- and --}. Code masks the secrets in all these texts. If the text of a change holds its own closing mark, the record writes --\} or ++\}. If a change holds a symbol that Word stores with its own font, the record writes the private use character U+E000 in its place.

Docling reads a Word file as it looks with all changes accepted. It drops deleted text, and it loses moved text. So the run sends Docling a copy of the file. In the copy, each change is normal text between two private use characters. Docling returns these characters with the text, so it puts each change in its correct place. The run then writes them as CriticMarkup. The source file does not change.

Section ids, section titles and column names come from the text with all changes accepted. The heading in text.md shows the changes of a section title. A heading that a change deleted or moved away opens no section. A deleted table row keeps its row id.

A paragraph that a change deleted or moved away together with its paragraph mark takes no list number. Recorded Docling output for a deleted list item shows that the next item then has the number that Word shows. There is one known limit. If a list item keeps some of its text but loses its paragraph mark, Word joins it to the next item. The record keeps two items with two numbers. Therefore each later item of that list has a number one higher than in Word.

Each change that holds text is an element of the kind tracked change. Its entry holds:

Field Content
change inserted, deleted, moved from or moved to
author, date as the file gives them. A field that the file does not give is absent
move the name that the two ends of a move share
section, row where the change is in the record
text the change in CriticMarkup

A masked value does not make a change a gap. The run looks for each change before it masks the text.

record.yaml, the extraction summary and coverage count the recorded changes under tracked_changes, for each of the four values of change. list_elements pages through them with the other elements of a record.

One change of the file is one change of the record, also when it has several formats. A merged table cell repeats its text in text.md, so the text can show more spans than the counts. These changes are not in the counts:

  • A change in a page header or a page footer is left out, as is the rest of that text.
  • A change in an equation is a gap, because an equation cannot carry the marks. The record does not show deleted equation text in its text.
  • A change that Docling does not return is a gap. If Docling returns deleted text without its marks, or cuts it apart, the extraction of that file fails.
  • A change with no text is not an element. Examples are a new paragraph mark, a format change and a deleted picture.
  • A change of only white space is not an element.

A deleted picture is not a figure of the record. It is left out, as a picture inside a tracked deletion.

A record that was made without tracked change support does not change. To read the tracked changes of its file, scan the folder into a new job and extract again. The older record can also list a deleted picture as a figure, so the figure ids of the two records can differ. Section ids and table row ids do not change.

The check against the source

The run counts the source without Docling, and then it looks for each counted element in the result. Anything that it does not find becomes a gap. The record holds the counts under checked. The check reads the text before masking. A quote that goes into the ledger is masked.

Format What the run counts in the source
DOCX headings, every table row with its cells, every paragraph with all tracked changes accepted, footnotes and endnotes, headers and footers, pictures (also those of a footnote or an endnote), charts and SmartArt
PPTX table rows, every paragraph of the slides and the speaker notes, pictures. Slide numbers, dates and slide footers that Docling skips are left out
HTML every visible text and every image
Markdown headings, every table row with its cells, every paragraph, list item and code line, the text of raw HTML, and images, as a CommonMark parser with tables reads them
plain text every line
PDF pages. A page from which nothing was read is a gap

Docling 2.156.0 loses some pictures in the old Word picture format (VML), for example a picture alone in a table cell. The run finds such a lost picture in the source file itself. It compares the pixels of each source picture with the pixels of the pictures that Docling returned. A lost picture becomes a figure of the record, at the end of its section, and the figure names its source part. It is a gap until the diagram run reads it.

Docling renders EMF and WMF pictures, so their pixels do not compare. The run pairs them by place: the heading or the slide that they stand under, and their order among the raster pictures there. Where Docling returned as many drawings as the source holds in a place, they pair in order. Otherwise none of that place is paired, and every EMF or WMF picture there with readable text becomes a figure that the run reads from the file. So one lost picture does not unpair the drawings of other places, and no metafile text is lost. What happens to the renderings of such a place depends on what else the place holds:

  • If every drawing there is an EMF or WMF picture with readable text, each rendering is left out with the actor code and the reason rendering of a drawing that is read from the file. It is not a figure of the record, so the diagram run does not judge or transcribe it. Its caption stays in the record text.
  • If the place also holds another picture, the renderings stay figures with no source part. Such a picture is a raster picture that Docling did not return as it is, a chart, or an EMF or WMF picture with no readable text, for example one whose text is written as glyph numbers. A rendering can be the only view of such a metafile, so it can go to transcription. If Docling returned too few, a picture of that place that code cannot read is a missing figure gap.

The extraction summary holds two counts under unsure_drawing_places. renderings_left_out is the number of renderings that the first case leaves out. mixed is the number of places of the second case. A lost chart or SmartArt graphic is a missing figure gap too. For HTML, only the counts of pictures compare.

Docling 2.156.0 does not return the front matter of a Markdown file or the check box of a task list item. The check lists each as a gap.

A one-cell table is a box around text. If Docling returns its text as paragraphs, the row counts as kept.

Bloat removal

The run removes bloat from the record text so that the text reads well. It hides nothing. Every removal is a left out entry of the element ledger. The entry holds the rule, the reason, the actor and, if Jev decided, the probability of the choice that Jev made. A removed passage keeps its text in the entry.

Code makes these removals at the end of each extraction:

Rule What goes
furniture page headers, page footers and header pictures that Docling puts on its furniture layer
page-number a line Page N of M
copyright a standalone notice that starts with © or Copyright and holds a year, or that starts with (c) directly before a year
all-rights-reserved a standalone notice with All Rights Reserved
dot-leader a line of dots and a page number
contents-entry a paragraph that a Word file styles as an entry or as the title of its table of contents
repeated-picture a figure whose SHA-256 is that of an earlier figure of the record, or of a header or footer picture of any record of the job

The first four rules after furniture start from the default rules of hive-prep. contents-entry is the form that a contents dot leader takes in a Word file. A rule takes whole lines only. It never takes a line of a code block. If only some lines of a paragraph match, only those lines go, and each one gets an entry of kind line. The first place of a repeated picture stays. The entry of a later place names that first element in same_as, also if the diagram run leaves that first place out as decoration. The caption of a repeated picture, and the text in the picture, stay in the record text.

A notice is standalone when its line holds, beside Copyright, (c) and All Rights Reserved, only an owner name, years and punctuation. Code reads an owner name as words that start with a capital, and words such as and, of, its or plc. A line that says more stays for the grey zone, which nominates it as a legal-notice or a sign-off. So an item that starts with the enumerator (c) is not a copyright line.

The grey zone

Some bloat needs a judgment. Code only nominates it, and decide puts it on the escalation ladder:

Rule What code nominates
legal-notice a passage with legal words, such as confidential, trademark or terms and conditions
sign-off a passage with words of a sign-off block, such as signature, approver or proof of acceptance
template-text a template instruction, such as <Insert the owner here>, and a passage of 40 or more characters that two document families share
empty-section a section without subsections, tables or figures in which nothing or only a placeholder such as N/A or TBD stands under the heading. Heading and placeholder are one question

Code nominates from the text that its own rules leave. It does not nominate a passage that a person restored, a passage with a restored line or a passage that the check kept.

Jev answers one Noul question for each nomination: "Does this passage carry product or design content?" The state of each question holds the document, the section, the passage and the text before and after it, after masking. A passage that reads like it holds a credential does not go to Jev: code keeps it. If the text before or after a passage reads like that, the state does not hold that text. The questions of a run go in as few requests as a bound of 24,000 bytes of quoted text and headings allows. The same passage under the same heading is one question, also if many records hold it.

The ladder reads the answer against its two floors. Claude gets each passage that Jev does not settle, with the options keep and remove. If Claude disagrees with a side that Jev took, a person settles it. A passage stays in the record until a decision says remove. Such a removal takes the whole passage as one entry, with any line that a code rule matches.

The check after the clean stage

Before the run writes a record, a check refuses each removal that does one of these things:

  • it takes a table or a row of a recorded table;
  • it takes the last copy in the record text of a name with an underscore, such as the name of a topic.

A refused element stays recorded. Its entry says so under check, with the rule, the actor and the reason. Then the check proves that every row of rows.jsonl is still in the text, with each such name of its cells. A passage with a tracked change is never touched.

Restore an element

A person restores an element from the left-out list of a document record with a correction:

hiveingest restore <job> 'acme/doc/widget-design@v1.2#p14' --reason "The reader needs it."

The command writes the correction in the shape of the corpus (corrects names the element) into corrections/ in the job. An element that the bloat pass took out of the text comes back to its place. An element that was never in the text, such as a page header or footer, goes to the end of the text. If it holds no text, such as a header picture, it is then a gap. A restore of one element of an empty section restores the whole section. A masked value and a tracked change cannot be restored. No later run removes a restored element again, or the passage of a restored line. This holds for the diagram run too. A figure that it left out as decoration comes back as a gap at its place.

Bloat counts

The run summary and the extraction summary hold these counts under bloat:

Count Meaning
removed the left out entries with a rule
rules those entries by rule
actors those entries by actor: code, jev, claude or person
restored the elements that a person restored
kept_by_check the removals that the check refused

A record that was made before the bloat pass holds no blocks.jsonl. The pass does not change it. Extract its file into a new job.

When a file fails

If a file cannot be counted or converted, its ledger entry changes to unhandled. The handler is then catch-all, and the reason starts with the name of the handler that had the file:

File The reason starts with
a file of the document handler, also a PPTX file that a pin gave to it document extraction failed:
a PPTX file of the diagram handler diagram extraction failed:

The summary lists the file with the other unhandled files. The next extraction tries it again. If it succeeds, the entry is claimed again.

The failed entry has code in decided_by. An earlier claim of the escalation ladder does not hide the failure. The next decide puts the file into the person queue. If the person answers exclude or needs-handler, no later extraction tries the file. A run that is already in progress reads the ledger again before it sends a document, and again before it writes the record. So it does not send a file that it has not reached yet. If the answer arrives while Docling converts the file, the file has already been sent, but the run writes no record that cites it. If the extraction finds that the file is now a credential, the file stays excluded, whatever a decision says.

Mapping and table records

extract-sheets and extract_sheets read the XLSX and CSV files that the mapping handler or the table handler claimed. The ladder settles which of the two takes a spreadsheet, so run decide first. A file of the mapping handler becomes a mapping record. A file of the table handler becomes a table record. The summary lists XLS and XLSB files under not_extracted_yet, and the files that still wait for a decision under waiting_for_a_decision.

The package reads these files itself. It uses no PDF step, no Docling and no model.

For each file, the run does these steps:

  1. It reads the bytes, and it runs the credential check on them and on the members of a package.
  2. It checks these bytes against the hash in the ledger.
  3. If the workbook opens with the default password of Excel, it decrypts the workbook, and it runs the credential check on the content too.
  4. It reads every sheet, and it finds the header rows.
  5. It builds the rows, and it masks the secrets.
  6. It compares the record with a second reading of the file.
  7. It puts each new sheet question on the escalation ladder.
  8. It writes the record into the job directory.

A file that already has a record is not read again, unless the answer to one of its sheet questions changed. If a file cannot be read whole, its ledger entry changes to unhandled, the handler is catch-all, and the reason starts with mapping extraction failed: or table extraction failed:. The next run tries it again. The other rules of a failed document for the person queue also apply.

Rows and cells

A record keeps every row that holds something, in every sheet, also hidden ones. A row keeps each of its cells under the name of its column. Therefore a field and all its mapping values stand in one row. Nothing is cut short: not a sheet, a row or a cell.

In the sheet In the row
a cell with text the text, with its line breaks and its spaces
a number the stored value. If a number format changes what a person sees, formats holds the format
a date or a time the date in ISO form. stored holds the stored number
a boolean TRUE or FALSE
a formula the stored result. formulas holds the formula
a range merged down a column the value in each row of the range that holds other values. merged names the first cell
a link links holds the target
a comment comments holds the column, the author and the text
a hidden row or column hidden or hidden_columns marks it

Each row has a kind: header, field (a row of a table that makes pairs), section (a row that holds only the title of a group of fields), row (any other row below a header, or a row of a sheet with no header) or preamble (any other row above the first header). A field row holds at least one value of its own, so a row with only spaces, a comment, a link or a formula with an empty result is not one. A field row also names its field, the columns that hold its mapping values and the section above it. A column with no name, and each column of a header row or a preamble row, has its column letter as its name. If two columns have the same name, the second one also carries its letter, such as Value (D).

Below a header that makes pairs, a row with only one value of its own, in the field column or in column A, is a section row. Code is not always sure of this. See where code is unsure.

In a mapping record, if the first header makes pairs, code also reads the rows above it with the columns of that header:

  • A row with only one cell of its own, in the field column or in column A, is a section row. A title of the sheet is such a row. The record stores it under the name of its column, such as {"Field": "Widget mapping"}, but it is not a field.
  • A row with a field and values in two or more attribute columns is a field row.

Header rows

Code finds the header rows from the names of the columns. Where it is unsure, it asks a sheet question. The extraction itself calls no model.

  • The main header is the row with the most column names in the first 40 filled rows. It needs two names or more.
  • If no row has known names, a first row of three or more different names can be a header. Such a header names the columns, but it makes no mapping pair.
  • A further header is a row in which each of three or more cells is a column name. An empty row or a title must set it apart, or it must start as the main header does.

In a mapping record, one column of a header names the field. It is the column whose name says so, such as Field or Source Field Name. A name with mapping, destination or target in it does not count. If there are several, code takes the one that the table fills most. If there is none, code takes the leftmost column. A column that describes the field, such as its type, length, default or notes, is an attribute. Every other named column holds mapping values.

A header with no mapping column makes no pair. If code read the header from its names and found no column that names the field, one more rule applies. The header makes pairs only if the name of a mapping column shows a mapping, such as JSON Mapping or Source Value.

A pair is a field with the value of one mapping column. pairs counts every pair. pairs_not_applicable counts the pairs whose value is NA, N/A, N.A., N.A, - or not applicable. field_rows counts the field rows. title_rows counts the section rows.

Where code is unsure

Code is unsure in two places, and it asks a question for each one.

The place Question Until the answer Answers
a header that code read from the shape of a row only header-row the header names the columns and makes no pair mapping (in a mapping record only), columns, none
a table with no header row: no known names, and three or more rows with three or more cells. The question is about the first such row header-row the sheet has no header mapping (in a mapping record only), columns, none
a row below a header that makes pairs, with only one value of its own, in the field column title-row the row is a section row title, field

Code is sure that such a row is a title in three cases. Its cell is merged across columns, or it is in column A and the field column is another one, or the row stands above the first header. Then it asks nothing. For each section row that code is sure of, the row element names code and the reason.

Each question that waits is a gap in the element ledger. It names the row and the decision. Its reason starts with waits for a decision:, or with waits for a person: when no model may see the question. open_questions counts these gaps.

To settle the questions:

  1. Run extract_sheets. It makes the records and the questions.
  2. Run decide. Jev answers each question, or it passes the question to Claude.
  3. Answer the pending decisions.
  4. Show the person the items of the person queue. A person settles each disagreement, and each question that no model may see.
  5. Run extract_sheets again. It makes each record again whose answers changed.

An answer can raise new questions. For example, the answer mapping for a header can make a row below it a title-row question. Then do the steps again from step 2.

The answer In the record
title or field the row is a section row or a field row. Its row element names the actor and the decision
mapping or columns the row is a header. An element of kind header-row names the actor and the decision
none the row names no columns. In a mapping record, this is a gap, because no pair of the sheet is identified
mapping, but code finds no mapping column in the row a gap

What a workbook holds outside its cells

Content State
shape text, data validations, defined names, link tooltips, comments recorded
page headers and footers, header pictures, copies of threaded comments, pivot caches, data connections, external links, revision history left out, with the reason
pictures, charts, chart sheets, shapes without text, SmartArt, ink, form controls, macros, embedded objects, ActiveX controls, data models, rich values, a formula with no stored result, a part that the reader does not know gap

Each record also lists a gap for each sheet question that waits. A mapping record also lists these gaps:

  • a row with mapping values but no field, because the pair is not identified;
  • a header answer that leaves the pairs of a sheet unidentified;
  • a record in which no header names a field and a mapping column, when no header question waits.

The check of a sheet record

The run compares each source with the cells as the rows of the record write them. For a masked cell, it compares the text before masking.

  • For an XLSX file, openpyxl reads the file a second time.
  • For a CSV file, the run does not parse the file a second time. It walks over the text and looks for each value of the record, in order. Between two values, only delimiters, quotes and line breaks can stand. The walk uses the same text decoding and delimiter as the reader of the record.
Under checked What is counted
sheets the sheets of the source that the record holds
cells the cells of the source that the record holds verbatim
pairs in a mapping record, the pairs of the source that stand in one row of the record

Each count is [found, counted in the source]. In a CSV file, the second number of pairs is different: the run counts it from the cells of the reader of the record. Therefore it is not an independent count of the source. A pair counts as found only if the walk confirms both of its cells. If the reader loses text, the walk reports a gap, but the pairs count may not show the loss.

Each difference is a gap, which names the sheet, the cell and the row if they are known, but not the text. If openpyxl cannot read an XLSX file, nothing counts as found, and one gap says so.

In a mapping record, the check also looks for rows that name a field and got lost. It takes the header rows and field columns from the record. Then it reads each source row below a header that makes pairs, without the row rules of the record. A row with a value in the field column must be one of these:

  • a field row;
  • a title whose cell is merged across columns;
  • a row with a sheet question.

Any other such row is a gap of kind field row.

Where a sheet record is

<job>/mappings/<name>/<version>/    or    <job>/tables/<name>/<version>/
    record.yaml    the source file and version, the counts, each sheet with its headers, and the notes
    rows.jsonl     every row of every sheet
    ledger.jsonl   every element and its state

The ids follow the rules of document ids, and one job keeps one namespace for all its records.

Element Id
record acme/mapping/widget-fields@v1.2 or acme/table/widget-log@v1.2
sheet acme/mapping/widget-fields@v1.2#schema
row acme/mapping/widget-fields@v1.2#schema.r14: row 14 as the spreadsheet numbers it

A CSV file has one sheet with the name (csv) and the id csv. list_elements pages through the elements of a record.

What a sheet extraction returns

The summary starts with the job id, then left_out and gaps, as for documents. Then it gives the counts of this run: records by kind, sheets, rows, cells, field_rows, pairs, pairs_not_applicable, title_rows, open_questions, checked, elements by state and masked values by detector. records lists at most ten records, those with the most gaps first. The reply never holds a sheet. coverage gives the counts for all records of the job under sheets.

Limits of sheet records

  • The reader keeps the stored value of a number. It does not format it as Excel shows it.
  • A colour, a strike-through and other formatting are not in the record.
  • The rules for header rows read English column names.
  • A very large workbook needs much memory, because the run reads it whole.

Docling

Docling is the reader. The run uses Docling 2.155.0 or later, on a docling-serve and on this machine. It refuses an older release. We measured the records with Docling 2.156.0, and we checked a Word file again with Docling 2.155.0 on a docling-serve 1.41.0.

  1. If you give --docling-url, the run sends each file to that docling-serve. It uses no proxy from the environment, and it follows no redirect. For a private certificate authority, set SSL_CERT_FILE.
  2. If you give no URL, or if the server fails, runs a Docling older than 2.155.0 or returns no document, the Docling on this machine converts the file.
  3. The record names the converter under converter. After a fallback, it also gives the fallback_reason.

The Docling on this machine is an optional extra, because it brings a large machine learning stack:

pip install "vf-hive-ingest[local-docling]"

It runs in a process of its own. Office files, HTML, Markdown and plain text need no model. For PDF, Docling runs its own layout and OCR models, and it downloads them on first use. It calls no remote service.

It also classifies each picture. A picture file goes to Docling only for the label check of a transcription, and Docling then reads all of it by OCR.

Diagram records

diagrams and extract_diagrams read what the diagram handler claimed, and the pictures of the document records. Make the document records first. The summary lists each document that has no record under documents_waiting. A second run reads only what is new.

For each file, the run reads the bytes, runs the credential check on them and on the members of a package, and compares them with the hash in the ledger. A credential file stays excluded, and this run does not read it. Code masks the secrets in what the run reads before the job keeps it.

What code reads

Source What code reads What stays a gap
VSDX each shape, and each connector from its Connect elements or from where its free end lies a connector with an end that joins no shape
PPTX on each slide with a connector or a block arrow: the shapes, the connector ends (a:stCxn, a:endCxn), free ends and straight block arrows by where they lie, and the texts beside the arrows a turning arrow, a chart, SmartArt, ink, and a connector with an end that joins no box
EMF, WMF the text records and where each text stands the lines: the record has labels only
PNG, JPEG, GIF, BMP, TIFF, WEBP the picture itself its content, until the ladder settles it
figures of DOCX, PPTX, PDF, HTML and Markdown records the picture, its caption, the text around it and its Docling class its content, until the ladder settles it
pictures of Visio and PowerPoint shapes, headers, footers, slide templates and slide backgrounds the picture as above
a Visio drawing embedded in a DOCX or PPTX file the drawing, as a VSDX file. The picture that previews it points to this record as for VSDX
BPMN, draw.io, VSD, SVG, HEIF nothing yet the whole file

A slide with no connector and no block arrow is not a diagram. Its text is in the document record, and the diagram ledger lists the slide as left out. A Visio lane, a container and a title are labels, not nodes. The shapes of a Visio background page are left out. In a metafile, a copyright notice and a number alone in the margin are left out.

Of a PPTX file, the run reads only the slides that the presentation lists. The file can also hold a slide that the list does not name, and nobody sees that slide. If only such a slide refers to a picture or to an embedded Visio drawing, the diagram ledger lists it as left out with the actor code. The ledger also lists, in the same way, an embedded Visio drawing of a PPTX file that no slide refers to.

Of a DOCX file, the run reads an embedded Visio drawing only if content that stays refers to it. That content is in the body, a header, a footer, a comment, or a footnote or endnote that the body refers to. The diagram ledger lists every other embedded drawing as left out with the actor code. The reason says if only removed content refers to the drawing, or if no content does. Removed content is a tracked deletion, the old place of a move, or a note that only one of these refers to.

The content check of a reading

Code reads the source texts of each VSDX page, each PPTX diagram slide and each metafile a second time, and it compares them with the record. White space does not count.

Source What is compared What the record may hold
VSDX page the Text of each shape those texts, and the texts of the masters
PPTX diagram slide the text of each shape and table those texts, their paragraphs, and picture descriptions
EMF, WMF the text of each text record lines that are made of those texts

A source text that the record does not hold, or a record text that the source does not hold, is a failed check. The diagram ledger lists it as a gap with the role content check and the text.

Edges and how they were derived

Derivation Meaning Review
exact the file states it: a Visio Connect element or a PowerPoint connector end none
geometric code read it from where shapes lie on the ladder
transcribed the assistant read it from a picture on the ladder, as is every text of a transcription
labels-only a metafile: its texts are read, its edges are not known none

How a picture is judged

The SHA-256 of its bytes names a picture. Every copy of it, in any file, is one picture with one decision. A later job of the same jobs directory and namespace uses the settled decision and transcription of an earlier job.

A transcription that a job kept before code masked secrets is not read. This applies to the job that made it and to every later job. Its picture waits to be judged or transcribed again. The queues do not show a question about such a transcription, and the next run that writes the diagram records closes it.

  1. Code settles what it can. A picture in a page header, a page footer, a slide template or a background is decoration. So is a picture of at most 16 pixels on one side or at most 2,304 pixels in all, and a picture that Docling classes as a logo, icon, signature, stamp, bar code or QR code with a confidence of 0.9 or more. A metafile with text becomes a labels-only record. A picture that Docling classes as a chart, diagram, table or screenshot with that confidence goes to transcription.
  2. Jev gets a Choice question about each other picture that some text speaks of: decoration, content or "the texts do not say". The state holds the caption, the section, the text around the picture and the text in it. Jev does not see the picture.
  3. Claude gets each picture that no text speaks of and each picture that Jev does not settle. It sees the picture.
  4. A person gets a picture only when Jev and Claude disagree, or a label check fails.

Transcription

pending_pictures lists the pictures that wait. The assistant opens each one at its view path and gives one of these to transcribe_pictures.

Kind What it holds
decoration only the reason
diagram nodes with an id and a label, and edges between node ids, with a label if the picture shows one
table rows of cells
screenshot the labels that the screen shows

Each label is checked against the text of the files that show the picture, and against what Docling reads in the picture by OCR. So a transcription other than decoration needs Docling. Code masks the secrets in the transcription and in the OCR lines before it compares or keeps them. Case, punctuation and line breaks do not count, and a few characters that OCR misreads do not either. If a label is nowhere, the transcription goes to the person queue as a failed-check. If the person answers reject, the picture waits for transcription again.

A transcription becomes a record only when its label check has passed, or a person has accepted it, and every edge and text of it is reviewed. Until then it is in no record. The diagram ledger and the figure of the document record list it as a gap whose reason starts with pending: and says what it waits for.

How edges and transcriptions are reviewed

decide asks Jev about each geometric edge, with one request for the edges of a page. It also asks about each edge, node label, table row and other label, such as one of a screenshot, of a transcription, once its label check has passed. For a transcription, the state holds the text around the picture and the lines that OCR read in it. A request holds at most 20 questions. Jev answers "holds", "wrong" or "the texts say nothing".

Answer of Jev geometric edge an edge or a text of a transcription, which Claude already read
"holds", 0.93 or more confirmed by Jev confirmed by Jev
"holds", 0.80 to under 0.93 Claude decides. If Claude says "wrong", a person settles it confirmed by Claude
"wrong", 0.80 or more Claude decides. If Claude says "holds", a person settles it a person settles it
any other answer Claude decides confirmed by Claude

If Jev gives no usable answer, a geometric edge goes to Claude, and an edge or a text of a transcription is confirmed by Claude. The same applies where the credential check keeps a question from Jev.

Claude answers a waiting geometric edge with answer_decisions. A rejected edge or text stays in the record with that state. The Mermaid rendering leaves out a rejected edge, and it draws a node with a rejected label under its id. If the texts of a drawing may hold credentials, no edge of it goes to Jev, and the tools return none of its texts.

Where the diagram records are

<job>/diagrams/
    records/              one YAML record for each drawing and each reviewed transcription
    ledger.jsonl          every shape and picture and its state
    pictures/             each picture as the assistant opens it
    sources.jsonl         what code read in each file and record
    transcriptions.jsonl  what Claude read
    reused.jsonl          decisions that an earlier job made
    ocr/                  what OCR read in a picture
<jobs>/pictures/<namespace>/<sha256>.json
                          the settled decision about one picture, for later jobs

A record holds its nodes, edges, labels, for a table its rows, and a Mermaid rendering. Each edge holds its derivation and its review. In a transcribed record, each node, label and row holds its review too. A drawing record is <namespace>/diagram/<document>@<version>, and a node or an edge adds # and its id: n3 or e6, from the number of the shape, with p2- before it on the second page. A picture record is <namespace>/diagram/pic-<hash>@sha-<hash>.

Each element of the diagram ledger is recorded, left out or gap, as in a document record. When a picture is settled, its figure in the document record changes too. A decoration is left out with its actor. A transcribed figure is recorded, it names its diagram record, and the record text shows that id under the figure mark. A figure that waits stays a gap that says what it waits for.

A VSDX, EMF, WMF or picture file that cannot be read changes to unhandled, and the reason starts with diagram extraction failed:. The next run tries it again. A PPTX file keeps its entry, and the diagram ledger holds a gap for it.

How the format is named

The content decides. The extension only breaks a tie between text formats.

Evidence Formats
magic bytes PDF, pictures, EMF, WMF, video, audio, OneNote, SQLite, ELF executables, other archives
ZIP with [Content_Types].xml DOCX, XLSX, XLSB, PPTX, VSDX
ZIP without it ODF files, and plain ZIP
OLE compound file streams DOC, XLS, PPT, VSD, MSG, MS Project, encrypted Office
XML root element and namespace XSD, WSDL, BPMN, draw.io, SVG, HTML, other XML
JSON top-level keys OpenAPI, Swagger, JSON Schema, Postman collection or environment, other JSON
text content MHTML, ZPL, Velocity, YAML OpenAPI or Swagger, SQL DDL
text with no other marker Markdown, CSV, SQL or plain text, by extension

An empty, corrupt or encrypted file has a defect. It goes to the catch-all with that reason.

A file is encrypted when it cannot be read without a password. The scan looks for these marks.

File Mark
ZIP a member with the encryption flag
DOCX, XLSX, PPTX an EncryptedPackage stream in a compound file
DOC the fEncrypted flag of the file information block
XLS a FILEPASS record
PPT a CryptSession10Container
PDF an /Encrypt dictionary

Some protected files open with a default password.

File Default password
PDF an empty user password
Excel VelvetSweatshop
PPT /01Hannes Ruescher/01

These files have no defect. Their evidence says protected but readable. A binary DOC, XLS or PPT whose mark cannot be read counts as corrupt.

Handlers and claims

Each handler answers certain, probable or no for a file.

Handler certain probable
document DOCX, DOC, PDF, HTML, MHTML, Markdown, text with .txt, .text or .rst other plain text
mapping none XLSX, XLSB, XLS, CSV
table none XLSX, XLSB, XLS, CSV
diagram VSDX, VSD, PPTX, BPMN, draw.io, EMF, WMF, PNG, JPEG, GIF, BMP, TIFF, WEBP SVG, HEIF
api OpenAPI 3, JSON Schema, XSD, WSDL, Postman collection or environment none
xml-schema none other XML
dbobject SQL DDL other .sql and .ddl files
template Velocity, ZPL none
archive ZIP none
media video and audio none

The result follows these rules, in this order:

  1. If the file has a defect, the state is unhandled.
  2. If a handler raises an error, the state is unhandled and the reason names the handler.
  3. If a pin matches the file, the pinned handler takes it. The state is claimed.
  4. If two handlers are certain, the run stops and names both.
  5. If one handler is certain, it takes the file. The state is claimed.
  6. If a handler is probable, the state is ambiguous and the entry names the candidates.
  7. If no handler claims the file, the state is unhandled.

An unhandled entry has the handler catch-all and a reason. No handler claims a Swagger 2.0 file. Its reason is Swagger 2.0: hive-apispec reads OpenAPI 3 only.

A spreadsheet is ambiguous after the scan, because the scan does not read its rows. The ladder settles which handler takes it. Then extract-sheets reads it.

An archive has one entry. The scan opens it only for the credential check, and the entry counts the checked members.

The escalation ladder

Each decision starts with the cheapest actor that can make it well. It goes up only when that actor is unsure, or when two actors disagree. The ladder escalates eight kinds of decision: which handler takes an ambiguous file, whether a picture is decoration, whether an edge of a drawing is right, whether a transcribed text is right, whether a grey-zone passage of a record is bloat, the two sheet questions, and where an element of a record belongs. decisions.jsonl also records three direct person/queue kinds (check, restore and card). The diagram of this section shows the first kind.

Which actor settles an open decision
Rendered at build time from the document's own Mermaid source, in the repository's house style.

Claude is the assistant session that calls the tools. The package makes no call to Claude, and it needs no Anthropic key.

How a handler is decided

  1. Code reads the header row of each sheet of an XLSX or CSV file. The header row is the first row with two or more filled cells, so a title above it does not count. Code decides mapping only for a plain header row. Code never decides table.
  2. Jev gets a Choice question. The options are the candidate handlers and none. The state holds the relative path, the format, the sheet names and the first rows, or the first lines of a text file. A question holds at most 12,000 bytes of state.
  3. Claude gets each decision that Jev does not settle. Claude is not shown the answer of Jev. A file that the credential check holds back skips both models.
  4. A person gets only the four kinds of item.

The header rule of code

A code decision is final, so the rule takes only plain cases. A header row is plain when it holds one of these pairs. Case, underscores, a final * and a final : do not count.

One column The other column
source with field, column, attribute or element target or destination with one of the same four words
field, field name, json field, attribute or attribute name mapping or json mapping, as the whole column name

In the first pair, name can follow the word, as in Source Field Name. A bare Source or Target column is not enough, and neither is a longer name such as Mapping Status. Every other spreadsheet goes to Jev.

Files with the same content and the same candidates are one question. The answer applies to each of them. A copy that the ladder may open, and that changed after the scan, leaves that question and becomes its own failed check.

Sheet questions

An extraction of sheets asks a question where code is unsure. The kinds are header-row and title-row. A question starts with the status open. The next decide puts it to Jev, and from there it climbs the ladder like a handler decision. The ladder counts show the open questions under waiting_for_jev. A question that no model may see goes straight to the person queue instead.

Jev and Claude see the sheet name, the path, the format, the row in question and a few rows around it. For a title-row question, they also see the header row. Each cell is masked before it is cut to 60 characters. The element ledger of the record lists each masked value.

The two floors of a Jev answer

The ladder reads the probability of the option that Jev chose. For a Noul, a yes or no question, the side with the higher probability is the choice. The floors were set on Choice answers about spreadsheets. No calibration run has measured them on the grey-zone question or the placement question.

Probability What happens
0.93 or more Jev decides
0.80 to under 0.93 Claude decides. A different answer is a disagreement, and a person settles it
under 0.80 Jev takes no side. Claude decides alone

The model is jev-1.13.0, the validated model of the System One contract. The floors hold for that model only.

The first calibration runs asked one set of spreadsheet questions. They started at the points that the Jev confidence documentation gives for a Choice: 0.67 and 0.93. They moved the lower floor to 0.80, because answers under it were too often wrong to count as a side. Then the header rule of code became narrower, so more spreadsheets go to Jev. New runs on the same folder therefore asked more questions. The table shows the new runs. A Claude session labelled each file from the first rows of its sheets, before it saw an answer of Jev. No person checked the labels.

Probability Answers compared with the label
0.93 or more Every answer was the same
0.80 to under 0.93 No answer was different. Some labels were unsure
under 0.80 Some answers were different, and some labels were unsure

Both floors stay. No clear mismatch scored above 0.75 in any of the runs. The probabilities are not fixed: one question moved by 0.19 between runs. In the new runs, a few questions changed their answer. The sample holds one folder of one project, and mostly one pair of handlers (mapping and table). Run the calibration again for another model, or when another kind of decision comes onto the ladder. The questions about pictures, edges, transcribed texts and sheets use the same floors, and no calibration run has asked one yet.

What the credential check keeps from a model

Jev is a hosted service, and Claude is a model too. The scan has already excluded each credential file. The ladder adds a wider check of its own. For the routing decision, it guards the content that the decision would send to one of them. If that content may hold credentials, code leaves the file unhandled. The file goes to the person queue with that reason, and no tool returns its content. These are the files:

  • a file whose path reads like keys or passwords, for example .pem, .env or passwords.xlsx. The ladder does not open it. Its identical copies go to the person with it. The ladder opens such a copy only to see that it did not change;
  • a file whose first rows or lines hold a credential or a label for one, for example a Password column, a private key block or a URL with a password, unless code settles the file as mapping.

A Postman environment is not on this list. The api handler claims it at the scan, so the ladder never asks about it.

Code does not apply this check to a file that it settles as mapping. A mapping often names fields such as Password or Access Token, and these are names, not secrets.

The excerpt that passes the check is also masked before Jev or Claude sees it.

The diagram run has the same guard. If the text around a picture, or the text of a drawing, may hold credentials, none of it goes to Jev, and pending_pictures and pending_decisions withhold it. The same applies to the edges and texts of a transcription when its OCR text or the transcription itself may hold credentials. A failed label check of such a picture does not list its labels. Claude still sees the picture, because the picture comes from a file that passed the credential check.

A sheet question has the same guard. A row around the row in question is left out if it reads like it holds credentials. If the row in question, the sheet name or the file path reads so, no model sees the question. It goes straight to the person queue as an unhandled-file item. The item names the file, the number of the sheet, the row and the question. It holds no text of a cell and no sheet name. The person opens the file and answers with an answer of the question.

The grey zone of the document records applies the check to each passage. Placement applies it to each element and to each card that it offers.

A file of a format that code reads no excerpt of, for example XLS or HEIF, is not sent to Jev. It goes to Claude, and the ladder does not check its content for credentials.

The checks read the first 40 rows of at most 40 sheets, or the first 40 lines. They are a guard, not a proof. Do not point the ladder at a folder whose content may not go to Jev. A file that the scan marks excluded or unhandled is never sent.

Errors

Event Result
transient Jev error (429, 529, time-out, no connection, a body that is not JSON) the decision goes to Claude, and the decision records why
Jev answer that is malformed or has no single leading option the decision goes to Claude
permanent Jev error (401, 422) the run stops with a message. Earlier decisions stay. A new decide asks only the rest
a file that the ladder may open changed after the scan, or is gone a failed check for a person. rescan means that the file needs a new job
code cannot read a workbook or text file the file is unhandled, decided by code

The person queue

A person sees four kinds of item only. Each one is a draft card under queue/ in the job directory, with status: draft. settle removes the draft of the item that it answers. The answer and the steps stay in decisions.jsonl. If edges or texts of a diagram wait for Jev after an answer, for example after a person accepts a transcription, settle returns next: decide. Run decide again, because the transcription becomes a record only after that.

Kind Draft Answers
disagreement note (type: memory) a candidate handler, exclude, needs-handler; for a picture, decoration, content; for an edge or a transcribed text, holds, wrong; for a passage, keep, remove; for a sheet question, its answers; for a placement, a candidate card, new concept, duplicate, skip
unhandled-file note, also for a file that the credential check holds back exclude, needs-handler; for a sheet question that no model may see, its answers
failed-check note exclude, rescan; for the labels of a transcription, accept, reject; for a placement, exclude, and also each place if a duplicate failed the check
card-override correction (type: correction) accept, reject

The note and the correction have the shapes of the corpus, from hivegen.memory and hivegen.corrections. The client and product fields of a note are empty. Whoever files a draft names them. Each unhandled file of a scan enters the queue at the first decide. A file that an extraction fails on enters it at the next decide.

A changed file and a transcription can raise a failed check. A placement can raise a failed check, and a correction raises a card override. Later phases report these two kinds with report_failed_check and report_card_override in hiveingest.queues.

The Jev key

decide and place, and the MCP tools decide and place_record, read the key only when a question first needs Jev. They read HIVE_INGEST_TYPESAFE_API_KEY. If that variable is unset, they run pass show against HIVE_INGEST_PASS_ENTRY (default hive/typesafe-jev). They do not read TYPESAFE_API_KEY, which can belong to another product. The package does not print, log or store the key.

To set the variable from pass for one command:

HIVE_INGEST_TYPESAFE_API_KEY="$(pass show hive/typesafe-jev | head -n1)" hiveingest decide <job>

Under the MCP server, pass cannot ask for a passphrase. Unlock it first, or set the variable.

The gap map

hiveingest gaps /path/to/corpus --scope acme

The gap map says what a corpus lacks or holds weakly. Code builds it from the corpus itself. It calls no model, and it changes nothing. It returns counts and lists of at most ten ids. It never returns a card.

Source What the map counts
taxonomy the topics of taxonomy.<product>[.<area>].yaml, not of a .draft file: topics with no card, and thin cards, with fewer than 150 words in the body above ## Related
api_gaps the operations of the gaps.jsonl files under concepts/: how many list a gap, the kinds of gap and the components. A row for a skipped file or a left-out value is not an operation. A component is the component of a row, else the module record of the operation
open_questions the cards with an open question, for each folder
eval_questions the questions of eval/*.jsonl: a set that marks a card gap, an expected card that does not exist, and, from stored reports, a wrong answer or an expected card that was not selected. Questions of the type not-documented are counted apart
memory_and_records for each client and product: memory cards, memory cards that cite a record, records, records that no card cites, rows, rows that no card cites, rows that no card holds, and rows with no technical name

The stored reports are the report-*-<set>.json files of the eval runner of hive-serve. The map reads them from .data/eval of the corpus, or from the --eval-reports folder. Without a report, verdicts of a set is null.

--scope takes a client or a product. The taxonomy files and the API gap files belong to products, so a client scope counts none of them. The map counts only the records that the corpus holds. It reads shared records from sources/<product>/ of the corpus and client records from clients/<client>/. It does not read RECORDS_DIR.

Open questions

A card has an open question if its front matter lists open_items. It also has one if its text says "open question", "to be confirmed" or "not documented" in any case, or TODO.

Placement

hiveingest place <job> 'acme/doc/widgets@v1.0#t1' --corpus /path/to/corpus --scope acme
hiveingest pending <job>
hiveingest changes <job>
hiveingest write <job> changes.json

Placement says where an element of a record belongs in a corpus, and what changes there. It only proposes, and it writes nothing into the corpus.

An element is a row, a section or a figure. The id of a table or a sheet places each of its rows that holds text. The record comes from the job or from the corpus, from the same folders as in the gap map. Placement cannot take an element of a diagram record yet. One bad id refuses the whole request before a question is asked. An id that gives no text to place is a bad id.

The scope is a client or a product of the corpus:

  • A client scope offers only the memory and issue cards of that client.
  • A product scope offers only the cards under concepts/<product>/.
  • A record with the namespace of a client can be placed only in the scope of that client.

Draft cards are not read. One job places against one corpus and one scope. A job places each element once.

When a card holds an element

Code reads the technical names of each element, with each tracked change accepted. A technical name is one of these:

  • a word with an underscore,
  • a camel case word,
  • a word of two or more capitalised parts,
  • a word that starts with two or more capitals before a capitalised part, such as ACMELabelOrder.

A single capital word is no name. The own names of a row are the names that no other row of its record has. The own names of a section or a figure are the names that at most one section of its record has.

  • A card holds the element if it holds one of its own names.
  • If some own names have an underscore, only those names count.
  • An element with no own name is held only by a card that holds all its names.

So each element is held, a gap that no card of the scope holds, or unknown because it has no technical name.

Candidate cards and the question

Code offers at most eight cards of the scope. A correction card is never a candidate. The order is:

  1. a card that cites the element,
  2. a card that holds it,
  3. a card that shares its names, where a name of fewer elements weighs more,
  4. a card that cites its record,
  5. a card that shares its words.

For shared words, a rare word weighs more. A word in the file name, title, description or tags of a card weighs more. A word weighs less in a long card. A word that stands only inside a technical name of the element weighs less.

Jev gets one Choice question for each element. The options are the candidate cards, new concept and duplicate, skip. The state holds the masked element, and the id, title and description of each card, with the names that the card shares and whether it cites the element or its record. It holds at most 12,000 bytes. If no card is a candidate, code decides new concept.

The floors apply. Claude answers the rest with pending and answer, and Claude is not shown the answer of Jev. These checks also apply:

  • If an element reads like it holds a credential, it goes to a person as a failed check, and no model sees it.
  • A title or description of a card that reads like a credential is left out of the question. If a card reads like it holds a credential, the tools withhold its path.
  • If Jev or Claude says duplicate, skip, but no card of the scope holds some name of the element, the check fails and a person settles it.

Changes

Claude reads the chosen card and writes the change. pending_changes lists a few of the placements that wait, each with the card, the changes allowed and, in chosen_by, who chose the place.

Place The element is Changes allowed
a card a gap fill a gap, correct
a card held extend, correct, and fill a gap if the card has an open question
a card unknown fill a gap, extend, correct
new concept a gap, held or unknown fill a gap, because a new card fills a gap in the corpus

Each change is an id, a change, its text and a reason:

[{"id": "d-0001", "change": "extend", "text": "The queue is WIDGET_IN_Q.", "reason": "same interface"}]
  • A correct change contradicts the card. It goes to the person queue as a card override, with a draft in the shape of a correction. The person answers accept or reject.
  • If Jev chose the place and it is wrong, give dispute with another option and a reason, in place of a change. This is a disagreement of Jev and Claude, so a person settles the place.
  • You cannot dispute a place that Claude, code or a person chose. The tool refuses it.

The placement ledger

placements.jsonl in the job directory has one line for each placement: the element, the scope, whether it is held, the status, the actor, the answer and probability of Jev, the target, the outcome, the text and reason of the change, and the answer of a person to a correction. decisions.jsonl keeps each step, as for every decision of the ladder.

API specifications

hiveingest apispec <job> --out /path/to/corpus/concepts/widgets-api --product widgets-api --id-prefix widgets-api

The command, or the run_apispec tool, takes the files that the ledger gives to the api handler. hive-apispec builds the records, runs its gate and its round-trip check, and publishes into <out>/db.

  • A file that changed since the scan is refused. Scan the folder again.
  • If the run fails and names a claimed file, the job ledger moves that file to unhandled. Its handler is then catch-all, and the reason starts with api extraction failed:. This includes a file with a known key or token where nothing removes it. The reason gives the place and never the value.
  • After such a failure, the job refuses a further run. Correct the cause and scan the folder again.
  • The next decide puts each such file in the person queue. After a person answers, the job runs without that file.
  • A failure that names no file leaves the ledger as it was.
  • An ambiguous file is not built. The result counts these files as candidates_not_built.
  • A file that a specification refers to must also be claimed. If it has no format of its own, pin it to api.
  • A Postman environment is claimed and gives a record of its variables. Plain values stay in it.
  • Secrets are removed or masked in the records, as possible credentials describes. gaps.jsonl lists each one. The message of a failed run is masked too.
  • The --plugin option exists on the command line only.

The routing file

A routing file pins files to handlers. Put hive-ingest-routing.toml at the root of the ingest folder. As an alternative, give a file with --routing or routing_file. That file then replaces the one in the folder.

[[pin]]
path = "mappings/*.xlsx"
handler = "mapping"

[[pin]]
sha256 = "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
handler = "document"

Each pin has a handler and exactly one of path or sha256. A path pattern is relative to the ingest folder, it is case-sensitive, and * also matches /. To match a literal [, write [[]. A hash pin wins over a path pin for the same file. If two pins that match one file name different handlers, the run stops.

A file that a pin claims has pin in decided_by, not person, because a routing file does not show who decided. The pin field of its entry names the pin and, in source, the path of the routing file: the one in the folder, or the one that --routing or routing_file names.

The summary lists each pin that matched no file. A pin cannot take a link, a special file, a file that cannot be read, a file with a defect or a file that a handler fails on. A pin that matches only links, special files, unreadable files or routing files is in that list too.

A routing file inside the folder has its own entry. This applies to the file at the root and to a file that the job names. The state is excluded, the reason is hive-ingest routing file, and no pin takes it.

Version families

Files that differ only by a version, date, copy mark or status word at the end of the name share a family. Design.V.1.3.docx and Design v1.4 - Copy.docx are both in the family design. The entry keeps the version that the name states. A bare whole number stays in the name, so Rollout Wave 2 is its own family.

The run summary

The summary holds the job id, the file count and the count for each state. Then it lists the unhandled files, grouped by format, and the ambiguous files, grouped by format and candidates. It counts the credential files by kind, the checked members of archives, the document records and the sheet records, with their elements by state and their masked values by detector. It holds the bloat counts of the document records. Under placements, it counts the placements by whether a card holds the element and by outcome. Under diagrams, it counts the diagram records, their elements by state, their edges by derivation and the pictures by what became of them. Each group names at most ten files and counts the rest. An extraction returns a summary of its own. The summary also holds the count for each handler, the count for each deciding actor, the ladder counts, unused pins, extension mismatches, family counts and the path of the full ledger.

The job store

Each job is one directory with job.json, ledger.jsonl and a .lock file. The ledger has one JSON object on each line. The ladder adds decisions.jsonl and the draft cards under queue/, an extraction adds documents/, mappings/ or tables/ (each with a namespace.json for its namespace), and a restore adds corrections/. A placement adds placement.json, which names its corpus and scope, and placements.jsonl. Each line of decisions.jsonl is the state of one decision: its kind, its files, its options, its status and its steps. A decision on a passage, a restore or a placement also names its elements. A placement also holds its masked element, what code found in the corpus and the change. A step names its actor. A Jev step also holds the model, the question, the state that was sent, the answer and the probabilities. The last line of a decision counts. After each ladder command and each extraction, ledger.jsonl holds the current states and their actors. The diagram run adds diagrams/.

The store must be outside the ingest folder. Ledgers name the files of the folder, so the tool creates each job directory with access for its owner only.

Modules

Module Purpose
credentials.py find credential files from their content, and keep what looks like a credential out of what the ladder sends
packages.py run the credential check on the members of archives and Office packages
masking.py mask the secrets of documents, drawings, pictures, excerpts and messages, with the rules of hiveapispec.mask
detect.py name the format of a file from its content
family.py the version family from a file name
handlers/ one module for each handler kind, and the claim contract in base.py
apispec.py hand the files of the api handler to hive-apispec
registry.py turn the claims into one routing result
pins.py read and apply the routing file
scan.py walk the folder, build the entries and run the gate
ledger.py the checks of the two gates: files and elements
bloat/ the bloat rules, the clean pass and its check, the grey zone on the ladder and the restore
ladder.py the actors, the decisions, the floors, the Noul and Choice questions and the gate on the person queue
routing.py the handler decision: code rules, then Jev. decide then asks the diagram questions and the bloat questions, and puts the sheet questions to Jev
excerpt.py read the start of a file for the routing decision
jev.py the key and the Jev client, on hivegen.systemone
queues.py, drafts.py the decisions for Claude, the person queue and its draft cards
placement/ the corpus reader, the gap map, the technical names, the candidate cards, the placement question, the changes and the placement ledger
jobs.py the job store
summary.py the run summary
docling.py, docling_local.py docling-serve, and the Docling on this machine
selection.py which files each extraction takes
extraction.py what the extractions share: record identities, the checked read, failures and the element pages
records.py the document, mapping and table records of a job on disk
document/ the source count, the tracked-change marks, the document record, its check, the lost pictures and its extraction run
sheets/ the native reader, the header rows, the sheet questions, the mapping and table records, their check and their extraction run
diagram/ the Visio, PowerPoint and metafile readers and their content check, the picture collection, the judgments, the transcription and its label check, and the diagram records
opc.py, images.py read an Office package part by part, and read the pixels of a picture
names.py escape non-UTF-8 paths cleanly for display and logs
server.py, cli.py the MCP server and the command line

Tests

The tests build synthetic files and fake keys. They use no client file, no real key and no network except a server on 127.0.0.1 that answers as docling-serve does. Jev is a fake in each test. tests/fixtures/ holds two synthetic Word files, one of them with tracked changes, and the DoclingDocument that Docling 2.156.0 returned for each. tests/fixtures/lists/ holds synthetic numbered lists with removed paragraph marks, and the DoclingDocument that docling-serve returned for each. Its README.md names each file. The tests build synthetic spreadsheets in memory. The tests do not need Docling. Run uv sync --extra dev && uv run pytest -q in tooling/hive-ingest/.