{"type":"thread.started","thread_id":"01a1830d-7d07-7562-90ad-32c91a035fd1"}
{"type":"turn.started"}
{"type":"item.completed","item":{"id":"item_0","type":"agent_message","text":"<requirement name=\"implement-jq\" stories=\"lexer,parser,core,constructors,operators,control,bindings,paths,assignment,loops,conversion,collection-builtins,strings,formats,numeric,dates,traversal,io,sql\">\nBuild an interpreter for the jq language as described in `sources/jq-manual.txt`.\nCorrectness is measured by the upstream jq conformance corpus, `sources/jq.test`, taken\nverbatim from jq 1.8.2. The goal is to pass every case the corpus supplies, with none\nfailed and none errored. The suite's size is a property of the pinned corpus; never\nassert a case count.\n</requirement>\n<requirement name=\"python-implementation\" stories=\"foundation\">\nThe implementation language is Python, fixed by this Target's `TECHNOLOGY_STACK.md` and\ngoverned by `stack/python.md`.\n</requirement>\n<requirement name=\"generator-evaluation\" stories=\"core,constructors,operators,control,bindings,loops\">\njq is a small language with a large semantic core. Almost every filter is a **generator**:\nit takes one input and produces a stream of zero, one, or many outputs, and downstream\nfilters run once per upstream output. Backtracking through that stream is not an\noptimisation, it is the evaluation model, and `reduce`, `foreach`, `limit`, `first`,\n`label`/`break`, and the `?//` destructuring alternative are all defined in terms of it.\n</requirement>\n<requirement name=\"command-interface\" stories=\"cli,core\">\nThe program is a filter: an executable file named `jq` at the application root, invoked as\n\n```\n./jq -c '<program>'\n```\n\nwith JSON on **stdin**. It writes each value the program produces to **stdout** as one\ncompact JSON value per line, and exits `0`.\n</requirement>\n<requirement name=\"exit-codes\" stories=\"cli,parser,core\">\nExit codes follow jq's own, and the distinction is load-bearing because the harness grades\non it:\n\n| Exit | Meaning |\n|---|---|\n| `0` | the program compiled and ran to completion |\n| `3` | the program did not compile — a syntax or static error |\n| `5` | the program compiled but raised at run time |\n\nA case may legitimately emit several values and then raise; the harness compares the values\nproduced before the raise, so exit `5` is not by itself a failure. Exit `3` on a valid\nprogram is always a failure. Diagnostics go to **stderr** and are never compared.\n</requirement>\n<requirement name=\"scoped-acceptance\" stories=\"lexer,parser,core,constructors,operators,control,bindings,paths,assignment,loops,conversion,collection-builtins,strings,formats,numeric,dates,traversal,io,sql,cli,scoped-integration\">\n**Every other story runs its own slice, and the slice executes cases.** Each story's\nacceptance invokes `sources/run_conformance.py` with a `--select` expression scoped to the\nconstruct that story implements, supplies `JQ`, and asserts `result.returncode == 0`. Those\nare exactly the cases the story's code is supposed to pass, so the run is neither slow nor\nred by construction, and the corpus goes green in the order the plan builds it.\n</requirement>\n<requirement name=\"stage-source-assets\" stories=\"corpus-staging\">\nRecord this table in the Analysis so every asset is staged onto disk in the build\ndirectory. `sources/jq-manual.txt`, `sources/jq.test`, `sources/parser.y`, and\n`sources/lexer.l` are large and must be readable from disk during implementation rather\nthan carried in prompt text.\n</requirement>\n<requirement name=\"validate-corpus-harness\" stories=\"corpus-staging\">\n`--list` prints the matching cases and runs nothing. Use it while planning, to size and\ninspect a selector before committing to it. An acceptance check that invokes it executes\nnothing, passes before the story's code exists, and steers no repair; such a check is a\ndefect. The one exception is the story whose only obligation is that the corpus parses, the\nexclusion list applies, and the harness starts — it implements none of the behaviour under\ntest, so listing is the correct thing for it to assert.\n</requirement>\n<requirement name=\"module-grammar-rejection\" stories=\"lexer,parser\">\nThe module *grammar* cases are **not** excluded and must pass. `module (.+1); 0`,\n`module []; 0`, `include \"a\" (.+1); 0`, `include \"a\" []; 0`, `include \"\\ \"; 0`,\n`include \"\\(a)\"; 0`, and `%::wat` are all `%%FAIL` cases: the front end must parse the\nmodule syntax far enough to reject them, without ever touching the filesystem.\n</requirement>\n<requirement name=\"numeric-edge-cases\" stories=\"numeric,operators,lexer\">\n7. **Numbers and edge cases.** `nan`, `infinite`, integer/float equality, large literals,\n   and the `have_decnum` builtin — return `false` from it and the corpus takes its\n   non-decNumber branch, which native floats satisfy.\n</requirement>\n<requirement name=\"terminal-conformance\" stories=\"terminal-verification\">\n**Exactly one acceptance check runs the whole corpus.** One terminal story — the last one —\nruns `sh sources/full_test.sh`, asserts only `result.returncode == 0`, prints the captured\nstdout and stderr so a failure can be diagnosed from the evidence, and carries the Sea\nTrial. No other acceptance check may run the corpus unscoped, and none may invoke\n`full_test.sh` at all.\n</requirement>\n<requirement name=\"document-interface\" stories=\"documentation\">\n- Deliver a concise project `README.md` documenting the stdin/stdout interface, the exit\n  codes, and the `sh sources/full_test.sh` command.\n</requirement>"}}
{"type":"turn.completed","usage":{"input_tokens":19887,"cached_input_tokens":14720,"cache_write_input_tokens":0,"output_tokens":1301,"reasoning_output_tokens":0}}
