Run artifact

evidence/prompts/20260822.045941.036Z_jq_plan_codex.prompt.md

<pblock label="Plan artifact repair" kind="repair">

Plan Artifact Repair

Drydock accepted the Plan response shape but rejected the emitted Blueprint artifact(s) below. Repair only the deterministic defect. Preserve all unrelated content, contracts, headings, decisions, and acceptance assertions byte-for-byte where possible. Do not remove or weaken a valid assertion while adding a missing one. Every artifact with a programmatic surface retains at least two concrete Python acceptance assertions. Every DECISIONS.json is the sole decision disclosure surface; do not emit Markdown question sections.

Emit each artifact below in exactly this form, and emit no other text:

=== BEGIN ARTIFACT <FILENAME> === <the complete file body> === END ARTIFACT ===

The filename appears once, in the opening delimiter. The closing delimiter is the constant token above and never carries a name.

Emit exactly one such block for each of: ARCHITECTURE.md, FEATURE-Accessors.md, FEATURE-Advanced-Grammar.md, FEATURE-Arithmetic-and-Structural-Operators.md, FEATURE-Assignment-Operators.md, FEATURE-Boolean-and-Alternative-Operators.md, FEATURE-Collection-Transformations.md, FEATURE-Complex-Assignments.md, FEATURE-Composition.md, FEATURE-Conditionals-and-Exception-Flow.md, FEATURE-Conformance-Assets.md, FEATURE-Destructuring-Alternatives.md, FEATURE-Errors-and-Optional.md, FEATURE-Executable-Entry-Point.md, FEATURE-Filter-Grammar.md, FEATURE-Formats-and-Serialization.md, FEATURE-Function-Definitions.md, FEATURE-Function-Parameters.md, FEATURE-Generator-Core.md, FEATURE-Index-and-Membership.md, FEATURE-Labels-and-Breaks.md, FEATURE-Lexer.md, FEATURE-Literals-and-Strings.md, FEATURE-Object-Entries-and-Containment.md, FEATURE-Path-Discovery.md, FEATURE-Path-Primitives.md, FEATURE-Process-Contract.md, FEATURE-Recursive-Generators.md, FEATURE-Reductions-and-Iteration-Control.md, FEATURE-Regular-Expressions.md, FEATURE-Scoped-Conformance.md, FEATURE-Slices-and-Iteration.md, FEATURE-Sorting-and-Grouping.md, FEATURE-Streaming.md, FEATURE-String-Manipulation.md, FEATURE-Truthiness-and-Comparison.md, FEATURE-Type-and-Numeric-Primitives.md, FEATURE-Value-Model.md, FEATURE-Variable-Bindings.md.

Repair pass: 1

Deterministic validation defect:
Plan generation failed: an acceptance criterion cannot pass as written. ARCHITECTURE.md [architecture-sources]: story architecture-foundation is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Accessors.md [value-002-conformance]: story VALUE-002 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Advanced-Grammar.md [parse-004-conformance]: story PARSE-004 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Advanced-Grammar.md [parse-004-module-rejection]: story PARSE-004 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Arithmetic-and-Structural-Operators.md [flow-001-conformance]: story FLOW-001 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Arithmetic-and-Structural-Operators.md [flow-001-errors]: story FLOW-001 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Assignment-Operators.md [path-003-conformance]: story PATH-003 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Boolean-and-Alternative-Operators.md [flow-002-conformance]: story FLOW-002 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Boolean-and-Alternative-Operators.md [flow-002-short-circuit]: story FLOW-002 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Collection-Transformations.md [data-001-conformance]: story DATA-001 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Complex-Assignments.md [path-004-conformance]: story PATH-004 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Composition.md [core-002-conformance]: story CORE-002 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Composition.md [core-002-cartesian]: story CORE-002 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Conditionals-and-Exception-Flow.md [flow-003-conformance]: story FLOW-003 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Conditionals-and-Exception-Flow.md [flow-003-runtime-flow]: story FLOW-003 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Conformance-Assets.md [conformance-assets-present]: story CONF-001 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Destructuring-Alternatives.md [func-004-conformance]: story FUNC-004 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Errors-and-Optional.md [core-003-conformance]: story CORE-003 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Executable-Entry-Point.md [executable-basic-filters]: story EXEC-001 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Filter-Grammar.md [parse-003-conformance]: story PARSE-003 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Filter-Grammar.md [parse-003-optional]: story PARSE-003 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Formats-and-Serialization.md [formats-conformance]: story TEXT-002 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Formats-and-Serialization.md [formats-roundtrip]: story TEXT-002 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Function-Definitions.md [function-definitions-scoped-conformance]: story FUNC-003 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Function-Parameters.md [function-parameters-scoped-conformance]: story FUNC-002 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Generator-Core.md [core-001-conformance]: story CORE-001 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Generator-Core.md [core-001-ordering]: story CORE-001 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Index-and-Membership.md [data-004-conformance]: story DATA-004 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Labels-and-Breaks.md [flow-004-conformance]: story FLOW-004 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Labels-and-Breaks.md [flow-004-scope]: story FLOW-004 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Lexer.md [lexer-basic-tokens]: story PARSE-001 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Literals-and-Strings.md [parse-002-conformance]: story PARSE-002 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Literals-and-Strings.md [parse-002-escapes]: story PARSE-002 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Object-Entries-and-Containment.md [data-003-conformance]: story DATA-003 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Path-Discovery.md [path-001-conformance]: story PATH-001 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Path-Primitives.md [path-002-conformance]: story PATH-002 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Process-Contract.md [process-runtime-slice]: story EXEC-002 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Recursive-Generators.md [recursive-generators-scoped-conformance]: story FLOW-006 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Reductions-and-Iteration-Control.md [reductions-scoped-conformance]: story FLOW-005 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Regular-Expressions.md [regex-conformance]: story TEXT-003 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Regular-Expressions.md [regex-streams]: story TEXT-003 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Scoped-Conformance.md [scoped-conformance]: story CONF-002 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Scoped-Conformance.md [scoped-conformance-contract]: story CONF-002 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Slices-and-Iteration.md [value-003-conformance]: story VALUE-003 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Sorting-and-Grouping.md [data-002-conformance]: story DATA-002 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Streaming.md [streaming-conformance]: story IO-003 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Streaming.md [streaming-roundtrip-suite]: story IO-003 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-String-Manipulation.md [text-001-conformance]: story TEXT-001 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Truthiness-and-Comparison.md [core-004-conformance]: story CORE-004 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Type-and-Numeric-Primitives.md [value-004-conformance]: story VALUE-004 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Type-and-Numeric-Primitives.md [value-004-numeric-contract]: story VALUE-004 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Value-Model.md [value-001-conformance]: story VALUE-001 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. FEATURE-Variable-Bindings.md [variable-bindings-scoped-conformance]: story FUNC-001 is not the terminal story (CONF-003) and its acceptance executes the authoritative runner sources/run_conformance.py. Gate this story on its own declared behavior, or invoke the runner in list mode, which enumerates the suite without running a case. No Blueprint or Manifest artifacts were written.
Execution output: /mnt/c/Users/barlo/projects/drydock/uat/jq/runs/20260822.044627/workspace/logs/20260822.044845.296Z_jq_plan_codex.output.txt

Normative Compass sections. They bind every assertion you write or retain, including one you add to satisfy the defect above.

Constraints

when it compiled and raised at run time. The harness grades on this distinction.

Guardrails

are restored before grading and an edit is reported as tampering.

Verification Protocol

This section is normative. It governs which story may invoke the supplied harness, and how.

Invoking the harness

sources/run_conformance.py requires the environment variable JQ, the command that runs the candidate implementation. Without it the harness exits 2 on its own usage code, which is a harness fault and never a verdict about the interpreter. Every invocation, in every acceptance criterion and every developer command, supplies it:

JQ="$PWD/jq" python3 sources/run_conformance.py            # whole corpus, the scored run
JQ="$PWD/jq" python3 sources/run_conformance.py --select 'reduce'   # run one construct for real

Those two commands are the only ways this build runs the harness. They are specified verbatim below under The two harness invocations, together with the flag this build forbids.

sources/ is read only. No story edits, patches, or regenerates sources/run_conformance.py, sources/jq.test, or sources/exclusions.txt; a harness defect is reported, not repaired in place. A story that needs to experiment with the harness works on a copy outside sources/, and every acceptance criterion invokes the original sources/run_conformance.py.

An acceptance criterion written in Python supplies it by extending the inherited environment, never by replacing it:

env={**os.environ, "JQ": str(build_dir / "jq")}

env={"JQ": ...} alone leaves the child with no PATH, so nothing it invokes resolves and the criterion is false at every level of implementation quality.

sources/full_test.sh sets JQ itself for the runner it wraps and therefore takes no environment from its caller.

The harness reserves exit 2 for its own faults — a missing corpus, an unset JQ, a stale exclusion list. Exit 2 never means the interpreter is wrong.

The summary line is:

jq conformance: NNN passed, N failed, N errored, N skipped (corpus jq.test @ jq-1.8.2)

The two harness invocations

An acceptance criterion that runs sources/run_conformance.py uses one of these two commands. No criterion in this build passes any other flag to the harness.

Story kindCommandExecutes cases?Asserts
Every behavioral story--select <regex> --jsonYes, the selected sliceexit 0, zero fail, zero error, non-zero case count
Terminal story (once, last)sh sources/full_test.shYes, all of themexit 0

The staging story does not appear in this table. It does not run the harness at all; see The staging story below.

--list is never run

sources/run_conformance.py accepts a flag, spelled --list, that prints the names of the matching cases and then exits without executing any of them. sources/INSTRUCTIONS.md, the file header, and --help all document it.

This build never runs it. Not in an acceptance criterion, not in a story, not in a script, not in a command typed by a build agent, not while developing and not while verifying. The string --list does not appear anywhere in this project's output. If you have written it, that line is wrong — delete it and use one of the two commands above.

A Drydock build is headless. There is no one watching the output, so a mode whose entire purpose is to print something for a person to read has no reader and no reason to run.

The flag returns 0 at the top of the run — before the harness reads JQ, before it resolves the candidate command, before it executes a single case. A criterion built on it passes when jq is an empty file, when jq does not exist, and when the story it gates was never written. It is not a weak proof, not a partial proof, and not an acceptable proof for staging, for scaffolding, or for an early story whose implementation is incomplete. It is not a proof. Thirty-six criteria in one earlier plan of this project used it, every one of them reported green, and it cost three days.

If you are writing a criterion and reaching for that flag, the reason is always the same: the story's code does not exist yet and you want a command that will not fail. That is the definition of a criterion that proves nothing. Write the --select ... --json form instead and let it be red until the story makes it green. A criterion is supposed to fail before its story is built.

The same prohibition covers any other flag whose effect is to not execute the cases — enumeration, dry-run, validation, or help. If a flag's documented purpose is "run nothing", it has no place in an acceptance criterion.

Behavioral criterion — copy this, changing only SELECT

import json
import os
import subprocess
import sys

SELECT = r"reduce"

result = subprocess.run(
    [sys.executable, "sources/run_conformance.py", "--select", SELECT, "--json"],
    capture_output=True,
    text=True,
    env={**os.environ, "JQ": f"{os.getcwd()}/jq"},
)
print(result.stdout)
print(result.stderr, file=sys.stderr)
report = json.loads(result.stdout)
tally = report["summary"]
assert sum(tally.values()) > 0, f"selector matched no case: {SELECT}"
assert tally["fail"] == 0 and tally["error"] == 0, tally
assert result.returncode == 0, result.returncode

Three assertions, and all three are required.

  1. The selector matched something. --select is a regular expression matched against the

program text of each case. A selector that matches nothing yields zero cases, zero failures, and exit 0 — green, and worth nothing. Alternations naming ideas rather than syntax (closure, recursive, optional) match no jq program and are the common way to write one by accident. Select on syntax the corpus actually contains: reduce, foreach, def, as \$, try, //, path(.

  1. No case failed or errored. Read off the parsed JSON tally, not off any printed line.
  2. The exit status is 0. The harness returns 0 only when fail and error are both zero,

and reserves 2 for its own faults — a missing corpus, an unset JQ, a stale exclusion list. Exit 2 is never a verdict about the interpreter.

--json writes the report and nothing else to stdout, so json.loads(result.stdout) is total. Do not assert against the human summary line, and do not grep stdout for passed or failed.

The terminal story

The terminal story is the last story in the build order: the one on which every other story is a transitive dependency, and after which no further story runs. It is a verification story. Its job is not to add capability but to prove that the capability every preceding story delivered is present, together, at the end of the build.

The terminal story of this project runs sh sources/full_test.sh, asserts returncode == 0, prints the captured stdout and stderr so a failure is diagnosable from the evidence alone, and carries the Sea Trial. It is the only story permitted to run the whole corpus.

A story is not terminal because its name contains "verify", because it is a test harness, or because it stages the test assets. Staging the corpus is foundational work that happens early; running the corpus is terminal work that happens last. Do not place a whole-corpus gate on a story that cannot yet run it — it fails vacuously and teaches nothing.

Scope of every other story

Every non-terminal story is gated on its own declared behavior only, through --select against the constructs that story implements, and the criterion asserts the selected slice passes. A non-terminal story never invokes sources/full_test.sh and never runs the corpus unfiltered: a partial interpreter fails most of an authoritative corpus by construction, and its unimplemented cases exhaust the harness's per-case timeout rather than returning, so the unscoped run costs the most exactly where it teaches the least.

Regression across stories is not the responsibility of any story's criteria. Drydock re-runs every previously proven criterion after each block and attributes a criterion that was green and is now red to the block that broke it, so a criterion proven at story 2 and broken at story 6 fails story

  1. Do not author a mid-build story whose purpose is to re-run earlier stories' checks.

The staging story

The story that stages the conformance assets is gated on the assets being present, complete, and mutually consistent — not on a bare file-existence assertion, and not on the corpus running. It proves that in process, by importing the harness and calling its parsers directly. It never launches the harness, so the question of which flags to pass does not arise:

import sys

sys.path.insert(0, "sources")
import run_conformance as harness

EXPECTED_CASES = 550
EXPECTED_EXCLUSIONS = 13

cases = harness.parse_corpus(harness.CORPUS.read_text(encoding="utf-8"))
excluded = harness.apply_exclusions(cases, harness.parse_exclusions(harness.EXCLUSIONS))
assert len(cases) == EXPECTED_CASES, len(cases)
assert len(excluded) == EXPECTED_EXCLUSIONS, len(excluded)

This reads state rather than output: the harness module imports, the corpus parses into the expected number of cases, and every exclusion still matches a case — apply_exclusions raises on a stale entry, so a corpus and an exclusion list that have drifted apart fail here rather than silently skipping cases later.

It claims nothing about the interpreter, because at this point in the build there is nothing to claim. Every story that claims a construct works runs that construct through --select ... --json.

Original ARCHITECTURE.md, in the same form your reply must use: === BEGIN ARTIFACT ARCHITECTURE.md ===

ARCHITECTURE: jq

FieldValue
Version20260822 V1
DescriptionDefines the standard-library-only architecture for the standalone jq interpreter.
Depends On—
Providesjq interpreter architecture
Consumes—

Questions

Intent

The application is a standalone executable named jq that parses jq filters, evaluates them as ordered generators over JSON input, and emits compact JSON values.

Module Boundaries

ModuleResponsibility
jqExecutable process boundary and argument handling
LexerTokenization, comments, literals, strings, and formats
Parserjq grammar, precedence, declarations, and AST construction
EvaluatorGenerator execution, scopes, errors, and control flow
ValuesJSON values, numeric behavior, comparison, and serialization
Builtinsjq standard functions and formats
PathsPath discovery, access, mutation, and assignment
I/OInput streams, diagnostics, and streaming values

The implementation uses only Python standard-library modules. It does not invoke a system jq executable or import a third-party jq implementation.

Runtime Flow

  1. The executable validates the -c '<program>' interface.
  2. JSON values are read from standard input.
  3. The filter is lexed and parsed into an internal representation.
  4. The evaluator executes the representation as an ordered generator.
  5. Each produced value is serialized compactly to standard output.
  6. Compile and runtime failures are mapped to exit codes 3 and 5.

Error Boundary

Compile errors are detected before evaluation and exit with status 3. Runtime errors use status 5 while preserving output already emitted. Diagnostics are written only to standard error.

Technology Stack

Guardrails

Programmatic Acceptance

=== AC architecture-boundary ===
Intent: The application exposes the declared executable boundary without requiring a third-party runtime.

from pathlib import Path import ast

entry = Path("jq") assert entry.is_file() assert entry.stat().st_mode & 0o111

tree = ast.parse(entry.read_text(encoding="utf-8")) imports = [ node.names[0].name for node in ast.walk(tree) if isinstance(node, ast.Import) and node.names ] assert all(not name.startswith(("jq", "pyjq", "jqlang", "gojq", "jaq")) for name in imports) === END AC architecture-boundary ===

=== AC architecture-sources ===
Intent: The implementation keeps the supplied scoring assets available at their required build-relative paths.

from pathlib import Path

required = [ Path("sources/run_conformance.py"), Path("sources/full_test.sh"), Path("sources/jq.test"), Path("sources/exclusions.txt"), ] assert all(path.is_file() for path in required) === END AC architecture-sources ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Accessors.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Accessors.md ===

FEATURE: Accessors

FieldValue
Version20260822 V1
DescriptionDefines object-field access, array indexing, dynamic keys, optional access, and negative indices.
Depends OnFEATURE-Value-Model.md, FEATURE-Generator-Core.md
Providesfield, index, optional, dynamic-key, and negative-index access
Consumesjq value model and ordered jq generator evaluation

Questions

Behavior

Object fields shall return their value or null when absent. Array indexing shall support integer and negative indices, dynamic keys, optional access, and jq-compatible errors for invalid or out-of-range access.

Programmatic Acceptance

=== AC value-002-conformance ===
Intent: The authoritative conformance cases covering field access, indexing, optional access, and negative indices pass.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"\.[A-Za-z]|\[[-0-9]" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 assert summary["error"] == 0 assert result.returncode == 0 === END AC value-002-conformance ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Advanced-Grammar.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Advanced-Grammar.md ===

FEATURE: Advanced Grammar

FieldValue
Version20260822 V1
DescriptionParse jq declarations, control constructs, bindings, modules, and destructuring syntax.
Depends OnFEATURE-Filter-Grammar.md
Providesdeclarations and control-flow AST forms
Consumesjq filter AST

Questions

Scope

This feature parses function definitions, imports and modules, conditionals, try/catch, reductions, foreach, labels, bindings, destructuring, and grammar rejection cases. Module-loader fixtures are not required.

Programmatic Acceptance

=== AC parse-004-conformance ===
Intent: Declarations and control syntax pass the authoritative corpus slice selected by their concrete jq syntax.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"%%FAIL|if |try |reduce |foreach |def | as |label |module|include" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC parse-004-conformance ===

=== AC parse-004-module-rejection ===
Intent: Invalid module metadata, imports, and unbound grammar forms are rejected with compile status 3.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"module|include|%::wat|break" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC parse-004-module-rejection ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Arithmetic-and-Structural-Operators.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Arithmetic-and-Structural-Operators.md ===

FEATURE: Arithmetic and Structural Operators

FieldValue
Version20260822 V1
DescriptionProvide jq arithmetic, string, array, and recursive object operators.
Depends OnFEATURE-Type-and-Numeric-Primitives.md, FEATURE-Composition.md
Providesjq +, -, *, /, %, unary negation, recursive merge, repetition, and splitting
Consumesjq value model, numeric primitives, comparison semantics

Questions

Intent

Implement arithmetic and structural operator behavior across numbers, strings, arrays, objects, and null, including division and modulo errors and recursive object merging.

Programmatic Acceptance

=== AC flow-001-conformance ===
Intent: The implementation passes the executed corpus slice covering arithmetic and structural operators.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"\+|\-|\*|/|%" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC flow-001-conformance ===

=== AC flow-001-errors ===
Intent: The executed operator slice includes runtime-error cases while remaining fully conformant. import json import os import subprocess import sys

selector = r"\+|\-|\*|/|%" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) report = json.loads(result.stdout) summary = report["summary"] assert summary["pass"] > 0 assert summary["fail"] == 0 assert summary["error"] == 0 === END AC flow-001-errors ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Assignment-Operators.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Assignment-Operators.md ===

FEATURE: Assignment Operators

FieldValue
Version20260822 V1
DescriptionImplement jq deletion and immutable assignment operators.
Depends OnFEATURE-Path-Primitives.md, FEATURE-Boolean-and-Alternative-Operators.md
Providesdel, =,=, +=, -=, *=, /=, %=, and //=
Consumesgetpath, setpath, delpaths, path expressions

Questions

Purpose

Provide jq’s path-based deletion, plain assignment, update assignment, arithmetic assignment, and defined-or assignment semantics.

Behavior

Programmatic Acceptance

=== AC path-003-conformance ===
Intent: The scoped conformance corpus executes deletion and assignment-operator cases owned by PATH-003 and passes.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

select = r"=|\|=|\+=" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", select, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0

=== END AC path-003-conformance ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Boolean-and-Alternative-Operators.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Boolean-and-Alternative-Operators.md ===

FEATURE: Boolean and Alternative Operators

FieldValue
Version20260822 V1
DescriptionProvide jq boolean, negation, defined-or, and defined-or assignment semantics.
Depends OnFEATURE-Truthiness-and-Comparison.md, FEATURE-Errors-and-Optional.md
Providesand, or, not, //, and //=
Consumesjq truthiness, comparisons, generators, and assignment primitives

Questions

Intent

Implement boolean operators and defined-or behavior with jq truthiness, generator multiplicity, fallback evaluation, short-circuiting, and assignment semantics.

Programmatic Acceptance

=== AC flow-002-conformance ===
Intent: The implementation passes the executed corpus slice covering boolean and alternative operators.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"and|or|not|//" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC flow-002-conformance ===

=== AC flow-002-short-circuit ===
Intent: The executed operator slice passes cases exercising fallback and short-circuit behavior. import json import os import subprocess import sys

selector = r"and|or|not|//" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) report = json.loads(result.stdout) summary = report["summary"] assert summary["pass"] > 0 assert summary["fail"] == 0 and summary["error"] == 0 === END AC flow-002-short-circuit ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Collection-Transformations.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Collection-Transformations.md ===

FEATURE: Collection Transformations

FieldValue
Version20260822 V1
DescriptionProvides jq collection transformation and recursive traversal builtins.
Depends OnARCHITECTURE.md, FEATURE-Composition.md, FEATURE-Assignment-Operators.md, FEATURE-Recursive-Generators.md
Providesmap, map_values, select, add, flatten, transpose, combinations, walk
Consumesordered jq generator evaluation, assignment operators, recursive generators

Questions

Workflow

Collection filters transform arrays and objects while preserving jq generator ordering and multiplicity. map collects all outputs for each input element, map_values updates values while dropping paths whose update is empty, and select retains inputs whose condition is truthy. add, flatten, transpose, and combinations implement the corresponding collection operations, including empty and bounded cases. walk recursively visits descendants before applying its filter to composite values.

Programmatic Acceptance

=== AC data-001-conformance ===
Intent: The authoritative jq corpus passes the collection-transformation cases selected by map, flatten, transpose, combinations, and walk syntax.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"map|flatten|transpose|combinations|walk" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC data-001-conformance ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Complex-Assignments.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Complex-Assignments.md ===

FEATURE: Complex Assignments

FieldValue
Version20260822 V1
DescriptionHandle jq assignment edge cases across generated and deep paths.
Depends OnFEATURE-Assignment-Operators.md, FEATURE-Reductions-and-Iteration-Control.md
Providescomplex assignment edge-case behavior
Consumesdeletion and assignment operators, generated paths

Questions

Purpose

Complete assignment semantics for iterated paths, empty updates, array expansion, invalid indices, NaN indices, and deeply nested structures.

Behavior

Programmatic Acceptance

=== AC path-004-conformance ===
Intent: The scoped conformance corpus executes complex assignment edge cases owned by PATH-004 and passes.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

select = "negative|NaN|depth|empty" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", select, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0

=== END AC path-004-conformance ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Composition.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Composition.md ===

FEATURE: Composition

FieldValue
Version20260822 V1
DescriptionImplement jq composition, collection, object construction, and cartesian stream semantics.
Depends OnFEATURE-Generator-Core.md
Providespipe, comma, collection, object, and cartesian semantics
Consumesordered jq generator evaluation

Questions

Scope

This feature composes generator filters through pipes and commas, collects streams into arrays, constructs objects with generator-valued fields, and evaluates filter arguments as cartesian products while preserving order.

Programmatic Acceptance

=== AC core-002-conformance ===
Intent: Composition and cartesian evaluation pass the authoritative corpus slice selected by pipe, comma, collection, and object syntax.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"\||,|\[|\{" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC core-002-conformance ===

=== AC core-002-cartesian ===
Intent: Multi-output arguments and constructed values preserve the authoritative corpus ordering and multiplicity.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"range\(0,1|range\(0;1|x: \(1,2\)|\[\.\[" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC core-002-cartesian ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Conditionals-and-Exception-Flow.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Conditionals-and-Exception-Flow.md ===

FEATURE: Conditionals and Exception Flow

FieldValue
Version20260822 V1
DescriptionProvide jq conditional branches, try/catch handling, and optional evaluation.
Depends OnFEATURE-Errors-and-Optional.md, FEATURE-Boolean-and-Alternative-Operators.md
Providesif, elif, else, try, catch, and optional control flow
Consumesempty, error, try, catch, optional, and boolean semantics

Questions

Intent

Implement conditional branch streams, omitted else behavior, nested try/catch, runtime error propagation, and the optional ? operator.

Programmatic Acceptance

=== AC flow-003-conformance ===
Intent: The implementation passes the executed corpus slice covering conditionals and exception flow.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"if |try |\?" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC flow-003-conformance ===

=== AC flow-003-runtime-flow ===
Intent: The executed slice passes cases that exercise both successful branches and caught errors. import json import os import subprocess import sys

selector = r"if |try |\?" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) report = json.loads(result.stdout) summary = report["summary"] assert summary["pass"] > 0 assert summary["fail"] == 0 assert summary["error"] == 0 === END AC flow-003-runtime-flow ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Conformance-Assets.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Conformance-Assets.md ===

FEATURE: Conformance Assets

FieldValue
Version20260822 V1
DescriptionStage and validate the immutable jq conformance assets.
Depends OnARCHITECTURE.md
Providesstaged conformance corpus and harness
Consumesjq interpreter architecture

Questions

Intent

The build must contain the supplied manual, grammar references, builtin reference, corpus, exclusions, runner, and scoring script unchanged. The staging story validates the harness parsers and corpus/exclusion consistency without launching the candidate interpreter.

Behavior

Programmatic Acceptance

=== AC conformance-assets-parse ===
Intent: The staged corpus and exclusion list parse to the authoritative expected counts.

import sys

sys.path.insert(0, "sources") import run_conformance as harness

expected_cases = 550 expected_exclusions = 13 cases = harness.parse_corpus(harness.CORPUS.read_text(encoding="utf-8")) excluded = harness.apply_exclusions( cases, harness.parse_exclusions(harness.EXCLUSIONS), ) assert len(cases) == expected_cases assert len(excluded) == expected_exclusions assert all(case.line in excluded for case in cases if case.line in excluded) === END AC conformance-assets-parse ===

=== AC conformance-assets-present ===
Intent: Every required staged asset is present for implementation and scoring.

from pathlib import Path

required = [ "sources/jq-manual.txt", "sources/jq.test", "sources/parser.y", "sources/lexer.l", "sources/builtin.jq", "sources/run_conformance.py", "sources/full_test.sh", "sources/exclusions.txt", ] missing = [path for path in required if not Path(path).is_file()] assert missing == [] === END AC conformance-assets-present ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Destructuring-Alternatives.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Destructuring-Alternatives.md ===

FEATURE: Destructuring Alternatives

FieldValue
Version20260822 V1
DescriptionProvide jq destructuring patterns and fallback alternatives.
Depends OnFEATURE-Variable-Bindings.md, FEATURE-Conditionals-and-Exception-Flow.md
Provides?// destructuring alternatives
Consumesas bindings, lexical scope, try/catch

Questions

Purpose

Support array and object destructuring in as bindings, including missing bindings and the ?// alternative operator.

Behavior

Programmatic Acceptance

=== AC func-004-conformance ===
Intent: The scoped conformance corpus executes the destructuring-alternative cases owned by FUNC-004 and passes them.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

select = r"\?//| as \{" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", select, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0

=== END AC func-004-conformance ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Errors-and-Optional.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Errors-and-Optional.md ===

FEATURE: Errors and Optional Evaluation

FieldValue
Version20260822 V1
DescriptionDefines empty streams, runtime errors, exception handling, optional evaluation, and partial output behavior.
Depends OnFEATURE-Composition.md, FEATURE-Process-Contract.md
Providesempty, error, try, catch, and optional filter semantics
Consumesordered jq generator evaluation, compile and runtime exit contract

Questions

Behavior

The interpreter shall support filters that produce no values, raise runtime errors, catch errors with try and catch, and suppress errors with ?. Values emitted before an uncaught runtime error remain on standard output, and the process exits with status 5.

Programmatic Acceptance

=== AC core-003-conformance ===
Intent: The authoritative conformance cases covering empty streams, errors, try/catch, and optional evaluation pass.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"try|error|\?" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 assert summary["error"] == 0 assert result.returncode == 0 === END AC core-003-conformance ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Executable-Entry-Point.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Executable-Entry-Point.md ===

FEATURE: Executable Entry Point

FieldValue
Version20260822 V1
DescriptionProvides the executable jq command and its compact filter interface.
Depends OnARCHITECTURE.md
Provides./jq -c program interface
Consumesjq interpreter architecture

Questions

Capability

The application root contains an executable named jq. It accepts the exercised -c '<program>' form, reads JSON values from standard input, evaluates the supplied filter, and emits one compact JSON value per output line.

The command does not require a package installation or external runtime.

Interface Contract

Programmatic Acceptance

=== AC executable-basic-filters ===
Intent: The executable runs the foundational literal filters through the supplied conformance slice.

import json import os import subprocess import sys

select = r"^(true|false|null|1)$" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", select, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC executable-basic-filters ===

=== AC executable-permission ===
Intent: The deliverable is executable at the application root.

from pathlib import Path

entry = Path("jq") assert entry.is_file() assert entry.stat().st_mode & 0o111 === END AC executable-permission ===

=== AC executable-interface ===
Intent: The command accepts the required compact-output invocation and completes successfully.

import subprocess

result = subprocess.run( ["./jq", "-c", "."], input="null\n", capture_output=True, text=True, ) assert result.returncode == 0 assert result.stdout === END AC executable-interface ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Filter-Grammar.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Filter-Grammar.md ===

FEATURE: Filter Grammar

FieldValue
Version20260822 V1
DescriptionParse jq filter expressions with precedence, composition, indexing, construction, and optional operators.
Depends OnFEATURE-Literals-and-Strings.md
Providesjq filter AST
Consumesjq string and literal expressions

Questions

Scope

This feature implements the core expression grammar: pipes, commas, precedence, indexing, slicing, iteration, arrays, objects, unary and binary operators, parentheses, and optional expressions.

Programmatic Acceptance

=== AC parse-003-conformance ===
Intent: The core expression grammar passes the authoritative corpus slice covering access, construction, operators, and composition syntax.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"\.|\[|\{|\+|\-|\*|/|%" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC parse-003-conformance ===

=== AC parse-003-optional ===
Intent: Optional access and slicing syntax executes successfully across the authoritative grammar slice.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"\?|\[.*:|\{\." result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC parse-003-optional ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Formats-and-Serialization.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Formats-and-Serialization.md ===

FEATURE: Formats and Serialization

FieldValue
Version20260822 V1
DescriptionDefine JSON conversion and jq output-format filters.
Depends OnFEATURE-String-Manipulation.md, FEATURE-Value-Model.md
Providestostring, tojson, fromjson, @text, @json, @html, @uri, @urid, @csv, @tsv, @sh, @base64, @base64d
Consumesjq value model, string manipulation, generator evaluation

Questions

Scope

Implement conversion between jq values and JSON text, plus the documented text, JSON, HTML, URI, CSV, TSV, shell, and Base64 format filters. Preserve interpolation behavior and compact JSON semantics.

Programmatic Acceptance

=== AC formats-conformance ===
Intent: The authoritative corpus cases covering jq format filters and JSON conversion execute successfully.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

select = r"@text|@json|@html|@uri|@csv|@tsv|@sh|@base64|tojson|fromjson" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", select, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC formats-conformance ===

=== AC formats-roundtrip ===
Intent: The authoritative corpus verifies JSON and Base64 round trips together with required escaping formats.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

select = r"tojson|fromjson|@base64|@base64d|@uri|@urid" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", select, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert summary["pass"] > 0 assert summary["fail"] == 0 assert summary["error"] == 0 assert result.returncode == 0 === END AC formats-roundtrip ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Function-Definitions.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Function-Definitions.md ===

FEATURE: Function Definitions

FieldValue
Version20260822 V1
DescriptionProvides jq function definitions, lexical scope, redefinition, and recursion.
Depends OnFEATURE-Function-Parameters.md
Provideslexical function definitions and recursion
Consumesfilter and value function arguments

Questions

Workflow

Definitions introduce named filters in lexical scope. Definitions support zero and multiple arities, self and forward references where permitted by jq, lexical closure behavior, replacement by matching arity, and recursive user functions.

Programmatic Acceptance

=== AC function-definitions-scoped-conformance ===
Intent: The authoritative corpus slice covering function definitions, scope, redefinition, and recursion executes with no failures or errors.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"def " result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 assert summary["error"] == 0 assert result.returncode == 0 === END AC function-definitions-scoped-conformance ===

=== AC function-definitions-interface ===
Intent: A recursive user-defined function compiles and runs through the executable interface.
Requires: executable=python3; scope=test

import subprocess

program = "def descend: if . == 0 then . else . - 1 | descend end; descend" input_text = "1\n" result = subprocess.run( ["./jq", "-c", program], input=input_text, capture_output=True, text=True, ) assert result.returncode == 0 assert result.stdout.endswith("\n") === END AC function-definitions-interface ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Function-Parameters.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Function-Parameters.md ===

FEATURE: Function Parameters

FieldValue
Version20260822 V1
DescriptionProvides jq user-defined filter and value function parameter evaluation.
Depends OnFEATURE-Variable-Bindings.md, FEATURE-Composition.md
Providesfilter and value function arguments
Consumeslexical variable bindings, generator evaluation

Questions

Workflow

User-defined functions accept filter parameters and value parameters with semicolon-separated arguments. Filter parameters are re-evaluated against each invocation input; value parameters capture evaluated values. Multiple arities, closures, generator-valued arguments, and cartesian combinations are supported.

Programmatic Acceptance

=== AC function-parameters-scoped-conformance ===
Intent: The authoritative corpus slice covering function parameters executes with no failures or errors.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"def .*\(" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 assert summary["error"] == 0 assert result.returncode == 0 === END AC function-parameters-scoped-conformance ===

=== AC function-parameters-interface ===
Intent: A filter-parameter function compiles and runs through the executable interface.
Requires: executable=python3; scope=test

import subprocess

program = "def twice(f): f | f; twice(. + 1)" input_text = "1\n" result = subprocess.run( ["./jq", "-c", program], input=input_text, capture_output=True, text=True, ) assert result.returncode == 0 assert result.stdout.endswith("\n") === END AC function-parameters-interface ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Generator-Core.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Generator-Core.md ===

FEATURE: Generator Core

FieldValue
Version20260822 V1
DescriptionEvaluate jq filters as ordered streams with multiplicity, backtracking, and empty results.
Depends OnFEATURE-Advanced-Grammar.md
Providesordered jq generator evaluation
Consumesjq filter AST

Questions

Scope

Every filter evaluates against an input and produces zero or more ordered outputs. The evaluator preserves stream order, multiplicity, backtracking, and partial results before runtime failure.

Programmatic Acceptance

=== AC core-001-conformance ===
Intent: The generator evaluator passes the authoritative corpus slice covering identity, iteration, ranges, commas, and empty.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"\.|,|\[\.\]|range|empty" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC core-001-conformance ===

=== AC core-001-ordering ===
Intent: Multi-output generator ordering and multiplicity pass the authoritative corpus cases selected by comma and iteration syntax.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r",|\[\]|\.\[\]" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC core-001-ordering ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Index-and-Membership.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Index-and-Membership.md ===

FEATURE: Index and Membership

FieldValue
Version20260822 V1
DescriptionProvides jq search, quantifier, emptiness, and SQL-style membership utilities.
Depends OnARCHITECTURE.md, FEATURE-Sorting-and-Grouping.md, FEATURE-Object-Entries-and-Containment.md, FEATURE-Reductions-and-Iteration-Control.md
Providesindices, index, rindex, bsearch, all, any, isempty, INDEX, JOIN, IN
Consumesjq comparison, collection, reduction, and generator semantics

Questions

Behavior

Search utilities locate scalar or sequence occurrences in arrays and strings, including first and last matches. bsearch returns an existing index or the encoded insertion point. all, any, and isempty preserve generator short-circuiting. INDEX, JOIN, and IN evaluate streams and index expressions with jq's cartesian and membership behavior.

Programmatic Acceptance

=== AC data-004-conformance ===
Intent: The authoritative jq corpus passes index, membership, quantifier, emptiness, and SQL-style utility cases selected by their syntax.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"indices|index\(|rindex|bsearch|any|all|IN\(" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC data-004-conformance ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Labels-and-Breaks.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Labels-and-Breaks.md ===

FEATURE: Labels and Breaks

FieldValue
Version20260822 V1
DescriptionProvide lexically scoped jq labels and break control.
Depends OnFEATURE-Conditionals-and-Exception-Flow.md
Provideslabel and break control
Consumesconditional evaluation, generators, and runtime error flow

Questions

Intent

Implement lexical label scopes and break behavior so the matching generator terminates without leaking outputs, while unbound breaks fail compilation.

Programmatic Acceptance

=== AC flow-004-conformance ===
Intent: The implementation passes the executed corpus slice covering labels and breaks.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"label|break" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC flow-004-conformance ===

=== AC flow-004-scope ===
Intent: The executed slice passes both scoped-break behavior and invalid-break compilation cases. import json import os import subprocess import sys

selector = r"label|break" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) report = json.loads(result.stdout) summary = report["summary"] assert summary["pass"] > 0 assert summary["fail"] == 0 assert summary["error"] == 0 === END AC flow-004-scope ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Lexer.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Lexer.md ===

FEATURE: Lexer

FieldValue
Version20260822 V1
DescriptionTokenizes jq programs into literals, identifiers, operators, delimiters, and formats.
Depends OnFEATURE-JSON-I-O.md
Providesjq tokenization
ConsumesJSON input stream and compact JSON output

Questions

Lexical Scope

The lexer recognizes:

Whitespace and comments are ignored outside strings. Tokens inside strings retain their JSON escape and Unicode semantics.

Programmatic Acceptance

=== AC lexer-basic-tokens ===
Intent: The supplied lexer-focused corpus slice executes literal, identity, and keyword token cases successfully.

import json import os import subprocess import sys

select = r"^(true|false|null|1|\.)$" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", select, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC lexer-basic-tokens ===

=== AC lexer-invalid-escape ===
Intent: Invalid string escapes are rejected during compilation.

import subprocess

result = subprocess.run( ["./jq", "-c", '"u\\vw"'], input="null\n", capture_output=True, text=True, ) assert result.returncode == 3 assert result.stderr === END AC lexer-invalid-escape ===

=== AC lexer-comments ===
Intent: Comments are lexically ignored while the executable still evaluates the surrounding filter.

import subprocess

result = subprocess.run( ["./jq", "-c", "1 # comment\n"], input="null\n", capture_output=True, text=True, ) assert result.returncode == 0 assert result.stdout.splitlines() === END AC lexer-comments ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Literals-and-Strings.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Literals-and-Strings.md ===

FEATURE: Literals and Strings

FieldValue
Version20260822 V1
DescriptionParse jq literals, escaped strings, formatted strings, and interpolation.
Depends OnFEATURE-Lexer.md
Providesjq string and literal expressions
Consumesjq tokenization

Questions

Scope

This feature parses JSON literals, Unicode and escaped string content, format expressions, and \(expression) interpolation. Invalid escapes and malformed interpolations are compile errors.

Programmatic Acceptance

=== AC parse-002-conformance ===
Intent: The literal and string implementation passes the authoritative corpus slice selected by interpolation and format syntax.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"interpolation|@base64|@uri" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC parse-002-conformance ===

=== AC parse-002-escapes ===
Intent: Invalid string escapes are rejected as compile failures by the authoritative corpus.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"@base64|@uri|interpolation|Invalid escape" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC parse-002-escapes ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Object-Entries-and-Containment.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Object-Entries-and-Containment.md ===

FEATURE: Object Entries and Containment

FieldValue
Version20260822 V1
DescriptionProvides jq object-key, entry-conversion, and containment builtins.
Depends OnARCHITECTURE.md, FEATURE-Accessors.md, FEATURE-Truthiness-and-Comparison.md, FEATURE-Collection-Transformations.md
Provideskeys, keys_unsorted, has, in, inside, contains, to_entries, from_entries, with_entries
Consumesjq value accessors, structural comparison, and collection transformations

Questions

Behavior

keys sorts object keys by Unicode codepoint order and returns array indices for arrays; keys_unsorted preserves object insertion order. has and in test object keys or valid array indices. contains and inside perform recursive containment checks for strings, arrays, objects, and scalar values. Entry conversion supports the accepted key and value spellings, and with_entries transforms entries through a filter.

Programmatic Acceptance

=== AC data-003-conformance ===
Intent: The authoritative jq corpus passes object-entry, key, containment, and entry-transformation cases selected by their builtin syntax.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"keys|has\(|contains|inside|to_entries|from_entries" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC data-003-conformance ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Path-Discovery.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Path-Discovery.md ===

FEATURE: Path Discovery

FieldValue
Version20260822 V1
DescriptionDiscover jq paths and construct projections from path expressions.
Depends OnFEATURE-Slices-and-Iteration.md, FEATURE-Recursive-Generators.md
Providespath, paths, and pick
Consumesaccessors, iteration, recursive generators

Questions

Purpose

Implement path discovery for exact and generated path expressions, filtered recursive paths, and projected values.

Behavior

Programmatic Acceptance

=== AC path-001-conformance ===
Intent: The scoped conformance corpus executes the path-discovery and projection cases owned by PATH-001 and passes.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

select = r"path\(|paths|pick\(" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", select, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0

=== END AC path-001-conformance ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Path-Primitives.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Path-Primitives.md ===

FEATURE: Path Primitives

FieldValue
Version20260822 V1
DescriptionRead, update, and delete nested jq values through path arrays.
Depends OnFEATURE-Path-Discovery.md, FEATURE-Accessors.md
Providesgetpath, setpath, and delpaths
Consumespath arrays, jq value model, field and index access

Questions

Purpose

Implement immutable nested path operations for reading, creation, replacement, array expansion, and deletion.

Behavior

Programmatic Acceptance

=== AC path-002-conformance ===
Intent: The scoped conformance corpus executes the getpath, setpath, and delpaths cases owned by PATH-002 and passes.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

select = "getpath|setpath|delpaths" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", select, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0

=== END AC path-002-conformance ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Process-Contract.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Process-Contract.md ===

FEATURE: Process Contract

FieldValue
Version20260822 V1
DescriptionDefines jq compilation, runtime failure, success, and diagnostic process behavior.
Depends OnFEATURE-Executable-Entry-Point.md
Providescompile and runtime exit contract
Consumes./jq -c program interface

Questions

Capability

The process boundary distinguishes compilation from evaluation:

Failure Semantics

Invalid syntax and statically invalid references are compile failures. Errors raised while evaluating a valid filter are runtime failures. Diagnostic wording is not part of the contract.

Programmatic Acceptance

=== AC process-runtime-slice ===
Intent: Runtime-error cases in the supplied corpus preserve the required process contract.

import json import os import subprocess import sys

select = r"try error|error\(" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", select, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC process-runtime-slice ===

=== AC process-compile-exit ===
Intent: A syntactically invalid filter is rejected with the compile-failure exit status.

import subprocess

result = subprocess.run( ["./jq", "-c", "{"], input="null\n", capture_output=True, text=True, ) assert result.returncode == 3 assert result.stderr === END AC process-compile-exit ===

=== AC process-runtime-exit ===
Intent: A valid filter that raises at runtime uses the runtime-failure exit status.

import subprocess

result = subprocess.run( ["./jq", "-c", "error"], input="null\n", capture_output=True, text=True, ) assert result.returncode == 5 assert result.stderr === END AC process-runtime-exit ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Recursive-Generators.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Recursive-Generators.md ===

FEATURE: Recursive Generators

FieldValue
Version20260822 V1
DescriptionProvides jq recursive generator filters with correct termination and stream ordering.
Depends OnFEATURE-Reductions-and-Iteration-Control.md, FEATURE-Conditionals-and-Exception-Flow.md
Provideswhile, until, repeat, recurse, recursive descent
Consumesordered jq generator evaluation, conditionals, exception flow

Questions

Workflow

Recursive filters repeatedly evaluate an update or child generator, emitting values in jq order. The implementation supports conditional recursion, recursive descent through arrays and objects, repeat-until-error behavior, and bounded recursive traversal without leaking unrelated outputs.

Programmatic Acceptance

=== AC recursive-generators-scoped-conformance ===
Intent: The authoritative corpus slice covering recursive generators executes with no failures or errors.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"while|until|recurse|repeat" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 assert summary["error"] == 0 assert result.returncode == 0 === END AC recursive-generators-scoped-conformance ===

=== AC recursive-generators-interface ===
Intent: Recursive generator evaluation completes through the executable filter interface.
Requires: executable=python3; scope=test

import subprocess

program = "[while(. < 4; . + 1)]" input_text = "1\n" result = subprocess.run( ["./jq", "-c", program], input=input_text, capture_output=True, text=True, ) assert result.returncode == 0 assert result.stdout.endswith("\n") === END AC recursive-generators-interface ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Reductions-and-Iteration-Control.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Reductions-and-Iteration-Control.md ===

FEATURE: Reductions and Iteration Control

FieldValue
Version20260822 V1
DescriptionProvides jq reductions, iteration controls, and generator selection builtins.
Depends OnFEATURE-Labels-and-Breaks.md, FEATURE-Generator-Core.md
Providesreduce, foreach, range, limit, skip, first, last, nth
Consumesordered jq generator evaluation, lexical labels and breaks

Questions

Workflow

This capability evaluates reduction and iteration expressions over ordered generator streams. It supports accumulator state, intermediate extraction, bounded selection, skipping, range generation, and first/last/nth selection while preserving cartesian argument behavior and backtracking.

Programmatic Acceptance

=== AC reductions-scoped-conformance ===
Intent: The authoritative corpus slice covering reductions and iteration controls executes with no failures or errors.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"reduce|foreach|limit|skip|nth|first|last" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 assert summary["error"] == 0 assert result.returncode == 0 === END AC reductions-scoped-conformance ===

=== AC reductions-process-contract ===
Intent: The executable remains invocable through the required jq command interface while exercising a reduction.
Requires: executable=python3; scope=test

import subprocess

program = "reduce .[] as $x (0; . + $x)" input_text = "[1,2,3]\n" result = subprocess.run( ["./jq", "-c", program], input=input_text, capture_output=True, text=True, ) assert result.returncode == 0 assert result.stdout.endswith("\n") === END AC reductions-process-contract ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Regular-Expressions.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Regular-Expressions.md ===

FEATURE: Regular Expressions

FieldValue
Version20260822 V1
DescriptionDefine jq regular-expression matching, capture, scanning, splitting, and substitution filters.
Depends OnFEATURE-String-Manipulation.md, FEATURE-Generator-Core.md
Providestest, match, capture, scan, split, splits, sub, gsub
Consumesstring manipulation and ordered generator evaluation

Questions

Scope

Implement the regex filters required by the jq manual and corpus using Python standard-library regular expressions. Support supported flags, global matching, named and unnamed captures, UTF-8 codepoint offsets, stream-valued scan and split behavior, and substitution interpolation.

Programmatic Acceptance

=== AC regex-conformance ===
Intent: The authoritative corpus cases covering jq regular-expression filters execute successfully.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

select = r"test\(|match\(|capture\(|scan\(|sub\(|gsub\(" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", select, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC regex-conformance ===

=== AC regex-streams ===
Intent: The authoritative corpus verifies matching streams, captures, regex splitting, and global substitutions.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

select = r"match\(|capture\(|scan\(|split\(|splits\(|sub\(|gsub\(" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", select, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert summary["pass"] > 0 assert summary["fail"] == 0 assert summary["error"] == 0 assert result.returncode == 0 === END AC regex-streams ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Scoped-Conformance.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Scoped-Conformance.md ===

FEATURE: Scoped Conformance Verification

FieldValue
Version20260822 V1
DescriptionProvide executable, selector-scoped conformance verification for implementation slices.
Depends OnFEATURE-Conformance-Assets.md, FEATURE-Executable-Entry-Point.md
Providesscoped conformance verification
Consumesstaged conformance corpus and harness, ./jq -c program interface

Questions

Intent

Implementation stories use the supplied runner over a construct-specific selector. The verification must set JQ by extending the inherited environment, execute matching cases, parse the machine-readable report, and distinguish an empty selection from a passing slice.

Behavior

Programmatic Acceptance

=== AC scoped-conformance ===
Intent: The reduce conformance slice executes and passes through the candidate executable.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"reduce" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 assert summary["error"] == 0 assert result.returncode == 0 === END AC scoped-conformance ===

=== AC scoped-conformance-contract ===
Intent: Scoped verification reports a parsed, non-empty result while preserving the runner's exit contract.

import json import os import subprocess import sys

selector = r"reduce" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) report = json.loads(result.stdout) summary = report["summary"] assert isinstance(summary, dict) assert sum(summary.values()) > 0 assert result.returncode == 0 === END AC scoped-conformance-contract ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Slices-and-Iteration.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Slices-and-Iteration.md ===

FEATURE: Slices and Iteration

FieldValue
Version20260822 V1
DescriptionDefines array and string slicing together with array and object iteration.
Depends OnFEATURE-Accessors.md
Providesarray slices, string slices, array iteration, object iteration, and optional iteration
Consumesfield, index, optional, and negative-index access

Questions

Behavior

The interpreter shall support inclusive-exclusive slices over arrays and strings, omitted and negative bounds, fractional bounds, iteration over arrays and object values, optional iteration, and jq-compatible behavior for out-of-range operands.

Programmatic Acceptance

=== AC value-003-conformance ===
Intent: The authoritative conformance cases covering slices and array/object iteration pass.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"\[.*:|\.\[\]" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 assert summary["error"] == 0 assert result.returncode == 0 === END AC value-003-conformance ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Sorting-and-Grouping.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Sorting-and-Grouping.md ===

FEATURE: Sorting and Grouping

FieldValue
Version20260822 V1
DescriptionProvides jq sorting, grouping, uniqueness, and extrema builtins.
Depends OnARCHITECTURE.md, FEATURE-Truthiness-and-Comparison.md, FEATURE-Collection-Transformations.md
Providessort, sort_by, group_by, unique, unique_by, min, max, min_by, max_by
Consumesjq structural comparison, generator evaluation, and collection transformations

Questions

Behavior

Sorting follows jq's total ordering across nulls, booleans, numbers, strings, arrays, and objects. Keyed variants evaluate their filters for each element and compare generated keys lexicographically. Grouping sorts by keys before forming groups; uniqueness removes duplicate keys while retaining the first representative. Minimum and maximum filters operate on arrays and support keyed forms.

Programmatic Acceptance

=== AC data-002-conformance ===
Intent: The authoritative jq corpus passes sorting, grouping, uniqueness, and extrema cases selected by their builtin syntax.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"sort|group_by|unique|min|max" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC data-002-conformance ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Streaming.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Streaming.md ===

FEATURE: Streaming Transformations

FieldValue
Version20260822 V1
DescriptionReconstruct, emit, and truncate jq streaming representations.
Depends OnARCHITECTURE.md, FEATURE-Generator-Core.md, FEATURE-Input-Controls.md
Providestostream, fromstream, truncate_stream
Consumesordered jq generator evaluation, input stream controls

Questions

Intent

Streaming filters convert JSON values to jq's path/value stream representation and reconstruct values from that representation. The implementation must preserve ordering, empty-container markers, nested paths, and truncation semantics while remaining within the standard-library-only runtime.

Behavior

Programmatic Acceptance

=== AC streaming-conformance ===
Intent: The streaming filters pass every matching case in the authoritative conformance slice.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"tostream|fromstream|truncate_stream" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 assert summary["error"] == 0 assert result.returncode == 0 === END AC streaming-conformance ===

=== AC streaming-roundtrip-suite ===
Intent: The authoritative suite executes the stream round-trip and truncation behaviors without failures.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"tostream|fromstream|truncate_stream" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) report = json.loads(result.stdout) summary = report["summary"] assert summary["pass"] > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC streaming-roundtrip-suite ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-String-Manipulation.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-String-Manipulation.md ===

FEATURE: String Manipulation

FieldValue
Version20260822 V1
DescriptionProvides jq string trimming, conversion, splitting, joining, and case filters.
Depends OnARCHITECTURE.md, FEATURE-Literals-and-Strings.md, FEATURE-Type-and-Numeric-Primitives.md, FEATURE-Arithmetic-and-Structural-Operators.md
Providestrim, ltrim, rtrim, ltrimstr, rtrimstr, trimstr, ascii_downcase, ascii_upcase, explode, implode, split, splits, join, startswith, endswith
Consumesjq string values, Unicode handling, numeric primitives, and generator evaluation

Questions

Behavior

String filters operate on Unicode codepoints. Trimming uses the Unicode whitespace definition; prefix and suffix filters remove matching strings only. ASCII case filters affect only ASCII letters. explode and implode convert between strings and codepoint arrays with jq's replacement behavior for invalid codepoints. split, splits, and join preserve empty fields and generator semantics, while startswith and endswith validate string operands.

Programmatic Acceptance

=== AC text-001-conformance ===
Intent: The authoritative jq corpus passes string manipulation cases selected by split, join, trimming, case, codepoint, prefix, and suffix syntax.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"split|join|trim|ascii_|explode|implode|startswith|endswith" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC text-001-conformance ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Truthiness-and-Comparison.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Truthiness-and-Comparison.md ===

FEATURE: Truthiness and Comparison

FieldValue
Version20260822 V1
DescriptionDefines jq truthiness, equality, inequality, and structural ordering semantics.
Depends OnFEATURE-Generator-Core.md, FEATURE-Composition.md
Providesjq truthiness, equality, inequality, and ordering
Consumesordered jq generator evaluation, jq value model

Questions

Behavior

Only false and null are falsey. Equality and inequality shall distinguish booleans from numbers, treat numerically equivalent values as equal, compare arrays and objects structurally, and implement jq's ordering across all supported value types.

Programmatic Acceptance

=== AC core-004-conformance ===
Intent: The authoritative conformance cases covering truthiness, equality, inequality, and ordering pass.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"==|!=|<=|>=|<|>" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 assert summary["error"] == 0 assert result.returncode == 0 === END AC core-004-conformance ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Type-and-Numeric-Primitives.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Type-and-Numeric-Primitives.md ===

FEATURE: Type and Numeric Primitives

FieldValue
Version20260822 V1
DescriptionProvide jq type, length, numeric conversion, predicates, and mathematical primitive filters.
Depends OnFEATURE-Value-Model.md, FEATURE-Truthiness-and-Comparison.md
Providestype, length, utf8bytelength, numeric predicates, conversions, and math filters
Consumesjq JSON value model, comparison semantics

Questions

Intent

Implement type, length, utf8bytelength, tonumber, toboolean, tostring, numeric predicates, and the required standard-library math functions with jq-compatible errors and numeric behavior.

Programmatic Acceptance

=== AC value-004-conformance ===
Intent: The implementation passes the executed corpus slice covering type and numeric primitives.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"length|type|sqrt|floor|tonumber" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 and summary["error"] == 0 assert result.returncode == 0 === END AC value-004-conformance ===

=== AC value-004-numeric-contract ===
Intent: The scoped report contains executed cases and no harness-level failure. import json import os import subprocess import sys

selector = r"length|type|sqrt|floor|tonumber" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) report = json.loads(result.stdout) summary = report["summary"] assert summary["pass"] + summary["fail"] + summary["error"] + summary["skip"] > 0 assert result.returncode == 0 === END AC value-004-numeric-contract ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Value-Model.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Value-Model.md ===

FEATURE: Value Model

FieldValue
Version20260822 V1
DescriptionDefines the runtime representation and numeric behavior of jq values.
Depends OnFEATURE-JSON-I-O.md, FEATURE-Truthiness-and-Comparison.md
Providesnull, boolean, number, string, array, object, NaN, and infinity values
ConsumesJSON input stream and compact JSON output

Questions

Behavior

The interpreter shall represent all jq JSON value kinds, including non-finite numeric values produced by jq filters. Numeric equality, conversion, preservation, and compact serialization shall follow the supplied jq 1.8.2 behavior.

Programmatic Acceptance

=== AC value-001-conformance ===
Intent: The authoritative conformance cases covering NaN, infinity, JSON conversion, and numeric values pass.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r"nan|infinite|tojson|fromjson" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 assert summary["error"] == 0 assert result.returncode == 0 === END AC value-001-conformance ===

User Acceptance

Guardrails

=== END ARTIFACT ===

Original FEATURE-Variable-Bindings.md, in the same form your reply must use: === BEGIN ARTIFACT FEATURE-Variable-Bindings.md ===

FEATURE: Variable Bindings

FieldValue
Version20260822 V1
DescriptionProvides lexical jq variable bindings, shadowing, and destructuring patterns.
Depends OnFEATURE-Advanced-Grammar.md, FEATURE-Generator-Core.md
Providesas bindings, variables, shadowing, destructuring patterns
Consumesjq filter AST, ordered jq generator evaluation

Questions

Workflow

Binding expressions evaluate a generator, bind each produced value in lexical scope, and evaluate the remainder against the original input. Bindings support nested scopes, shadowing, keyword names, array and object patterns, and missing values represented as null.

Programmatic Acceptance

=== AC variable-bindings-scoped-conformance ===
Intent: The authoritative corpus slice covering jq variable bindings executes with no failures or errors.
Suite: scoped
Requires: executable=python3; scope=test

import json import os import subprocess import sys

selector = r" as \$|\$[A-Za-z]" result = subprocess.run( [sys.executable, "sources/run_conformance.py", "--select", selector, "--json"], capture_output=True, text=True, env={**os.environ, "JQ": f"{os.getcwd()}/jq"}, ) print(result.stdout) print(result.stderr, file=sys.stderr) report = json.loads(result.stdout) summary = report["summary"] assert sum(summary.values()) > 0 assert summary["fail"] == 0 assert summary["error"] == 0 assert result.returncode == 0 === END AC variable-bindings-scoped-conformance ===

=== AC variable-bindings-interface ===
Intent: Lexical binding syntax compiles and runs through the required executable interface.
Requires: executable=python3; scope=test

import subprocess

program = ". as $value | $value" input_text = "null\n" result = subprocess.run( ["./jq", "-c", program], input=input_text, capture_output=True, text=True, ) assert result.returncode == 0 assert result.stdout.endswith("\n") === END AC variable-bindings-interface ===

User Acceptance

Guardrails

=== END ARTIFACT === </pblock>