Run artifact

evidence/prompt_outputs/20261028.150010.129Z_jq_plan_codex.output.txt

=== BEGIN ARTIFACT TOPOLOGY.md ===
## Declarations

## story foundation
summary: Establish the Python application structure and interpreter boundaries.
type: foundational
kind: capability
phase: 1
implements: ARCHITECTURE.md
stack: python.md
provides: Python application foundation
acceptance: yes
instructions: |
  Establish a standard-library Python application tree and its test interface. Define boundaries for lexing, parsing, generator evaluation, builtins, and the command entry point. Preserve ordered lazy streams, lexical environments, and distinct compile and runtime errors as the shared contracts. Do not install packages or introduce an external jq runtime.

## story corpus-staging
summary: Stage and validate the supplied conformance assets.
type: service
kind: test harness
phase: 1
implements: FEATURE-CorpusStaging.md
stack: python.md
provides: staged conformance assets
consumes: Python application foundation
depends: foundation
acceptance: yes
instructions: |
  Stage the manual, grammar, lexer, builtin reference, corpus, exclusions, runner, and scoring script unchanged under sources. Validate corpus parsing and exclusion consistency by importing the runner and calling its parsers directly; do not launch the runner for this staging gate. Preserve the Compass staging criterion and its pinned counts.

## story lexer
summary: Tokenize jq programs including strings and interpolation.
type: service
kind: capability
phase: 1
implements: FEATURE-Lexer.md
covers: FRONTEND-002
stack: python.md
provides: jq token stream
consumes: Python application foundation, staged conformance assets
depends: foundation, corpus-staging
acceptance: yes
instructions: |
  Implement lexical rules from sources/lexer.l, including comments, literals, escapes, interpolation, format tokens, balanced delimiters, and source locations. Reject invalid escapes and tokens as compile errors. Gate the delivered lexer directly where corpus programs would require an evaluator not yet built; assign their executing corpus coverage to later stories.

## story parser
summary: Parse and statically validate jq programs.
type: service
kind: capability
phase: 1
implements: FEATURE-Parser.md
covers: FRONTEND-001
stack: python.md
provides: jq abstract syntax tree
consumes: jq token stream
depends: lexer
acceptance: yes
instructions: |
  Implement the grammar and precedence in sources/parser.y, including lexical scope and static rejection of invalid bindings, labels, object keys, and module grammar. Produce an AST and distinguish compilation failure from evaluation failure. Gate the parser directly until the executable and evaluator exist; retain the relevant corpus cases for later executing slices.

## story core
summary: Evaluate basic filters as ordered generators.
type: service
kind: capability
phase: 1
implements: FEATURE-GeneratorCore.md
covers: CORE-001
stack: python.md
provides: jq generator evaluation
consumes: jq abstract syntax tree
depends: parser
acceptance: yes
instructions: |
  Evaluate identity, literals, empty, comma, and pipes as lazy ordered streams. Feed each pipe output downstream and evaluate combining operands against the same input, preserving multiplicity, backtracking, and outputs produced before an error. Provide the minimal executable interface needed for scoped conformance runs.

## story constructors
summary: Construct and access jq arrays and objects.
type: service
kind: capability
phase: 1
implements: FEATURE-Collections.md
covers: CORE-002
stack: python.md
provides: jq collection expressions
consumes: jq generator evaluation
depends: core
acceptance: yes
instructions: |
  Implement array collection, object construction, field and index access, iteration, and slicing with jq generator ordering and type rules. Preserve null and out-of-range behavior and multi-output constructor combinations.

## story operators
summary: Evaluate jq arithmetic and comparison operators.
type: service
kind: capability
phase: 1
implements: FEATURE-Operators.md
covers: CORE-003
stack: python.md
provides: jq operators
consumes: jq collection expressions
depends: constructors
acceptance: yes
instructions: |
  Implement arithmetic, equality, ordering, and Boolean operators with jq type rules, truthiness, operand streams, and short-circuit behavior. Preserve non-decnum numeric semantics and runtime errors.

## story control
summary: Evaluate conditional and error-control expressions.
type: service
kind: capability
phase: 1
implements: FEATURE-Control.md
covers: CORE-004
stack: python.md
provides: jq conditional and error control
consumes: jq operators
depends: operators
acceptance: yes
instructions: |
  Implement conditionals, alternative expressions, try and catch, and optional expressions. Preserve each condition's output multiplicity, false-or-null semantics, error boundaries, and partial output before a caught or uncaught error.

## story bindings
summary: Support lexical bindings, destructuring, and user functions.
type: service
kind: capability
phase: 1
implements: FEATURE-Bindings.md
covers: CORE-006
stack: python.md
provides: jq lexical bindings and functions
consumes: jq conditional and error control
depends: control
acceptance: yes
instructions: |
  Implement lexical variables, array and object patterns, destructuring alternatives, function definitions and arities, filter and value parameters, closures, shadowing, and recursion. Alternatives retry on binding or downstream errors as specified and preserve generator behavior.

## story paths
summary: Generate and retrieve jq paths.
type: service
kind: capability
phase: 1
implements: FEATURE-Paths.md
covers: PATHS-001
stack: python.md
provides: jq path lookup
consumes: jq lexical bindings and functions
depends: bindings
acceptance: yes
instructions: |
  Implement path expressions, path, paths, getpath, and pick. Track paths through generators and filters, distinguish exact paths from traversal, preserve order, and reject invalid path expressions with runtime errors.

## story assignment
summary: Update and delete values through jq paths.
type: service
kind: capability
phase: 1
implements: FEATURE-Assignment.md
covers: PATHS-002
stack: python.md
provides: jq path mutation
consumes: jq path lookup
depends: paths
acceptance: yes
instructions: |
  Implement setpath, delpaths, del, and assignment operators with immutable value semantics. Plain assignment evaluates the right side on the original input and emits one result per value; updates apply to selected old values, use the first result, and delete when no result is produced. Preserve slice and negative-index rules.

## story loops
summary: Implement reductions and generator control.
type: service
kind: capability
phase: 1
implements: FEATURE-GeneratorControl.md
covers: CORE-005
stack: python.md
provides: jq reductions and generator control
consumes: jq lexical bindings and functions, jq path mutation
depends: bindings, assignment
acceptance: yes
instructions: |
  Implement reduce, foreach, lexical labels and break, limit, skip, first, last, and nth. Evaluate generator inputs in order, carry accumulator states and extraction streams correctly, and stop lazy evaluation at the specified boundary.

## story conversion
summary: Implement jq type and conversion builtins.
type: service
kind: capability
phase: 1
implements: FEATURE-Conversion.md
covers: BUILTINS-001
stack: python.md
provides: jq type and conversion builtins
consumes: jq reductions and generator control
depends: loops
acceptance: yes
instructions: |
  Implement type inspection, length, numeric and Boolean parsing, JSON and string conversion, and Unicode codepoint conversion according to the manual and corpus. Preserve jq error values where caught by programs.

## story collection-builtins
summary: Implement array and object utility builtins.
type: service
kind: capability
phase: 1
implements: FEATURE-CollectionBuiltins.md
covers: BUILTINS-002
stack: python.md
provides: jq collection builtins
consumes: jq type and conversion builtins
depends: conversion
acceptance: yes
instructions: |
  Implement collection utilities including map, sorting and grouping, uniqueness, entries, containment, combinations, flatten, transpose, and related functions. Follow jq ordering and stream semantics and the definitions in sources/builtin.jq.

## story strings
summary: Implement string and regular-expression builtins.
type: service
kind: capability
phase: 1
implements: FEATURE-Strings.md
covers: BUILTINS-003
stack: python.md
provides: jq string and regex builtins
consumes: jq collection builtins
depends: collection-builtins
acceptance: yes
instructions: |
  Implement string operations and corpus-required regular-expression matching, captures, splitting, scanning, and substitution using the standard library. Preserve Unicode offsets, generator results, flags, and jq error behavior.

## story formats
summary: Implement jq format and encoding filters.
type: service
kind: capability
phase: 1
implements: FEATURE-Formats.md
covers: BUILTINS-004
stack: python.md
provides: jq format filters
consumes: jq string and regex builtins
depends: strings
acceptance: yes
instructions: |
  Implement text, JSON, HTML, URI, CSV, TSV, shell, and Base64 formats and their specified inverse filters. In formatted strings escape interpolations while retaining literal text.

## story numeric
summary: Implement mathematical and numeric edge-case builtins.
type: service
kind: capability
phase: 1
implements: FEATURE-Numeric.md
covers: BUILTINS-005
stack: python.md
provides: jq numeric builtins
consumes: jq format filters
depends: formats
acceptance: yes
instructions: |
  Implement the corpus-required math functions, IEEE floating-point edge cases, numeric conversion and serialization behavior. Return false for have_decnum and support the corpus's non-decnum branch.

## story dates
summary: Implement jq date and time builtins.
type: service
kind: capability
phase: 1
implements: FEATURE-Dates.md
covers: BUILTINS-006
stack: python.md
provides: jq date builtins
consumes: jq numeric builtins
depends: numeric
acceptance: yes
instructions: |
  Implement the corpus-required date parsing, formatting, epoch conversion, and broken-down time operations with the manual's UTC and local-time semantics and specified error behavior.

## story traversal
summary: Implement recursive traversal and streaming utilities.
type: service
kind: capability
phase: 1
implements: FEATURE-Traversal.md
covers: BUILTINS-007
stack: python.md
provides: jq traversal and streaming builtins
consumes: jq date builtins, jq path mutation
depends: dates, assignment
acceptance: yes
instructions: |
  Implement recurse, walk, tostream, fromstream, and truncate_stream according to the manual and builtin reference. Preserve traversal and stream event ordering, empty structures, backtracking, and specified deep-value boundaries.

## story io
summary: Implement jq input, environment, and diagnostic filters.
type: service
kind: capability
phase: 1
implements: FEATURE-InputDiagnostics.md
covers: BUILTINS-008
stack: python.md
provides: jq input and diagnostic builtins
consumes: jq traversal and streaming builtins
depends: traversal
acceptance: yes
instructions: |
  Implement input and inputs against the shared input stream, environment bindings, debug and stderr side effects, and source location values. Preserve output streams and error handling independently of diagnostics.

## story sql
summary: Implement SQL-style filters and builtin inventory.
type: service
kind: capability
phase: 1
implements: FEATURE-SqlBuiltins.md
covers: BUILTINS-009
stack: python.md
provides: jq SQL-style builtins and inventory
consumes: jq input and diagnostic builtins
depends: io
acceptance: yes
instructions: |
  Implement INDEX, JOIN, IN, and builtins with their specified arities and generator behavior. Report the supported builtin inventory in name/arity form.

## story cli
summary: Deliver the standalone jq command interface.
type: service
kind: capability
phase: 1
implements: FEATURE-Command.md
covers: CLI-001
stack: python.md
provides: ./jq -c
consumes: jq SQL-style builtins and inventory
depends: sql
acceptance: yes
instructions: |
  Complete the executable interface: read JSON values from standard input, compile the supplied filter, and emit compact JSON values in stream order. Return 0 on completion, 3 for compilation failure, and 5 for runtime failure, preserving partial output and sending diagnostics to stderr. Use only Python standard-library runtime facilities.

## story documentation
summary: Document the command and verification interface.
type: service
kind: capability
phase: 1
implements: FEATURE-Documentation.md
covers: CLI-002
stack: python.md
provides: jq usage documentation
consumes: ./jq -c
depends: cli
acceptance: yes
instructions: |
  Deliver a concise application README documenting the stdin and stdout contract, exit codes, and supplied full-suite command. Verify the documented interface through the delivered command and a scoped executing corpus slice.

## story scoped-integration
summary: Execute the remaining cross-feature conformance slices.
type: service
kind: integration
phase: 1
implements: FEATURE-ScopedConformance.md
covers: VERIFY-001
stack: python.md
provides: scoped conformance integration
consumes: ./jq -c, staged conformance assets
depends: cli, corpus-staging
acceptance: yes
instructions: |
  Execute scoped corpus cases whose program text combines capabilities that could not be gated at their earlier provider stories, including lexer and parser cases. Partition or overlap selectors as needed so every runnable corpus case is covered by an executing intermediate slice. Each selected run supplies JQ, parses the JSON report, asserts a nonzero case count, zero failures and errors, and exit zero. Never invoke a non-executing runner mode.

## story terminal-verification
summary: Verify the completed interpreter against the scoring script.
type: service
kind: test harness
phase: 1
implements: VERIFICATION.md
covers: VERIFY-002
accepts: st-001
stack: python.md, common.md
consumes: scoped conformance integration, jq usage documentation
depends: scoped-integration, documentation
acceptance: yes
instructions: |
  Run sh sources/full_test.sh once as the terminal full-suite acceptance, print captured stdout and stderr, and assert its exit status is zero. This story adds no interpreter capability and follows every implementation and staging story.
=== END ARTIFACT ===
=== BEGIN ARTIFACT DECISIONS.json ===
[]
=== END ARTIFACT ===