# Local task specification

Availability: **Reference 0.2**  
Documentation: **1.1** | Updated: **19 September 2026**

[Documentation home](../README.md)

The input is a JSON object with exactly five fields. The local runtime performs explicit validation rather than invoking a general JSON Schema engine. Its structural schema uses JSON Schema Draft 2020-12. [S1](https://json-schema.org/draft/2020-12)

| Field | Type | Constraint |
| --- | --- | --- |
| version | String | Exactly "0.2" |
| operation | String | Exactly "literal-line-search" |
| document | String | Valid Unicode scalar text; 1 to 20,000 UTF-8 bytes |
| terms | Array of strings | 1 to 16 entries; each raw term contains 1 to 80 Unicode code points |
| top_k | Integer-valued JSON number | 1 to 10; booleans are rejected |
| Additional fields | Not permitted | Missing or unknown fields fail validation |

## Normalization and ranking

1. Reject isolated Unicode surrogate code points. Convert CRLF and CR line endings to LF before splitting the document. Line numbering begins at 1; empty lines retain their positions.
2. Reject a term containing CR or LF. Trim only leading and trailing ASCII spaces and tabs, then fold ASCII A through Z to lowercase. Reject empty normalized terms and remove duplicates in first-occurrence order.
3. Match each normalized term as a literal substring of each line after ASCII case folding. Other scripts remain literal. There is no tokenization, Unicode normalization or language-dependent case folding.
4. Set score to the number of distinct normalized terms matched in the line. Sort by descending score, then ascending original line number. Return at most top_k entries.

## Input parsing

JSON object member names must be unique for interoperable input. The Python parser rejects duplicates; the browser editor uses native JSON.parse, which retains the last duplicate. Python also rejects nonstandard NaN and Infinity constants.

The schema cannot by itself enforce the UTF-8 byte limit or the nonempty-after-trimming rule. A schema-valid object can still fail runtime validation. The CLI limits the complete task file to 150,000 bytes, separately from the 20,000-byte document limit.

[Previous](./quickstart.md) | [Next](./local-results.md)
