harbor run -t openthoughts/tasktrove-exp-rle-heavy-padding-v2-5k-heavy-1437harbor download openthoughts/tasktrove-exp-rle-heavy-padding-v2-5k-heavy-1437On a breezy afternoon I found myself tracing through a maze of notebooks and coffee-stained wires, wondering whether the circuits would agree to cooperate or at least pretend to. The mood was conducive to long-winded reflections about how small abstractions can become large, unwieldy beasts when you forget the shape of the inputs you promised to respect.
Moderate context: In a sprawling codebase that ships with a dozen internal toolchains and a dozen more external-facing APIs, teams rely on modular transformer primitives to manipulate Cirq circuits. The goal is to provide a lightweight, self-contained set of primitives that can map, unroll, and merge circuit operations while preserving as much of the original structure (qubits, moments, timing semantics) as possible. This work is orthogonal to performance tuning, but it must be deterministic and reproducible, so unit tests can pin down behavior in the face of edge cases. While we’re at it, it’s tempting to consider whether the same primitives could be repurposed for other quantum circuit formalisms, but the current focus remains squarely on Cirq. Red herrings abound in project documentation and ancillary utilities—ignore them unless they illuminate a corner case relevant to op trees or CircuitOperation tagging.
Heavy noise section (verbose logs, unrelated code snippets, misleading hints):
Original Task: Task: Implement a small transformer primitives module for Cirq that supports mapping, unrolling, and merging circuit operations, including a tag to mark mapped circuit operations. The implementation should be self-contained, rely on Cirq data structures, and satisfy the test suite that exercises mapping, unrolling, and merging behavior as exercised in the provided pytest file.
What to implement
Create and export a constant:
Implement function map_operations(circuit, map_fn) -> cirq.Circuit
Behavior:
Key expectations demonstrated by tests:
Implement function map_operations_and_unroll(circuit, map_fn) -> cirq.Circuit
Implement function unroll_circuit_op(circuit, tags_to_check=None) -> cirq.Circuit
Implement functions:
Implement function merge_moments(circuit, merge_func) -> cirq.Circuit
Implement function merge_operations(circuit, merge_func) -> cirq.Circuit
Behavioral constraints and details to match tests
What you need to deliver
Acceptance criteria