Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- LICENSEAdded+202
- LICENSE-DATAAdded+395
- MANIFEST.sha256Added+72
- NOTICEAdded+16
- POLICY-PROVENANCE.mdAdded+17
- README.md+89-3
- REPRODUCING.mdAdded+70
- SCHEMAS.mdAdded+44
- analysis/reproduce.pyAdded+337
- analysis/verify_results.pyAdded+77
- configs/arms/codex-luna-final.yamlAdded+23
- configs/arms/codex-sol-all.yamlAdded+18
- configs/arms/codex-terra-control-always-verify.yamlAdded+8
- configs/arms/codex-terra-control-reconsider.yamlAdded+8
- configs/arms/codex-terra-control-sham.yamlAdded+8
- configs/arms/codex-terra-final.yamlAdded+26
- configs/arms/harness/codex.baseline.jsonAdded+4
- configs/arms/harness/codex.policy.jsonAdded+8
- configs/base.yamlAdded+74
- configs/final-analysis-run-ledger.yamlAdded+70
- configs/policy_profiles.jsonAdded+45
- configs/terra-controls-analysis.yamlAdded+54
- policies/_lib/profile.mjsAdded+22
- policies/_lib/state.mjsAdded+155
- policies/codex-final-binary-equivalence/binary-equivalence.mjsAdded+64
- policies/codex-final-build/build-provenance.mjsAdded+65
- policies/codex-final-enumeration/multi-answer-enumeration.mjsAdded+36
- policies/codex-final-latex/latex-log-validation.mjsAdded+37
- policies/codex-final-replacements/exact-replacements.mjsAdded+99
- policies/codex-final-token-accounting/token-accounting.mjsAdded+41
- policies/codex-luna-v4/evidence/preserve-before-open.mjsAdded+57
- policies/codex-luna-v4/liveness/service-persistence.mjsAdded+86
- policies/codex-sol/criteria/measured-acceptance.mjsAdded+43
- policies/codex-sol/liveness/service-survival.mjsAdded+56
- policies/codex-sol/requirements/provenance-ledger.mjsAdded+36
- policies/codex-sol/runtime/public-contract.mjsAdded+43
- policies/codex-sol/scope/exact-diff.mjsAdded+35
- policies/paper-appendix-terra/binary-equivalence.mjsAdded+64
- policies/paper-appendix-terra/exact-replacements.mjsAdded+99
- policies/paper-appendix-terra/latex-log-validation.mjsAdded+37
- policies/paper-appendix-terra/multi-answer-enumeration.mjsAdded+36
- policies/paper-appendix-terra/preserve-before-open.mjsAdded+57
- policies/paper-appendix-terra/service-persistence.mjsAdded+86
- policies/paper-appendix-terra/token-accounting.mjsAdded+41
- policies/terra-control-always-verify/always-verify.mjsAdded+17
- policies/terra-control-reconsider/reconsider.mjsAdded+19
- policies/terra-control-sham/triggered-sham.mjsAdded+40
- results/complete-suite/README.mdAdded+25
- results/complete-suite/attempts.csvAdded
- results/complete-suite/comparisons.csvAdded+4
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395Attribution 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm anddoes not provide legal services or legal advice. Distribution ofCreative Commons public licenses does not create a lawyer-client orother relationship. Creative Commons makes its licenses and relatedinformation available on an "as-is" basis. Creative Commons gives nowarranties regarding its licenses, any material licensed under theirterms and conditions, or any related information. Creative Commonsdisclaims all liability for damages resulting from their use to thefullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms andconditions that creators and other rights holders may use to shareoriginal works of authorship and other material subject to copyrightand certain other rights specified in the public license below. Thefollowing considerations are for informational purposes only, are notexhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC- licensed material, or material used under an exception or limitation to copyright. More considerations for licensors: wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor's permission is not necessary for any reason--for example, because of any applicable exception or limitation to copyright--then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public: wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agreeto be bound by the terms and conditions of this Creative CommonsAttribution 4.0 International Public License ("Public License"). To theextent this Public License may be interpreted as a contract, You aregranted the Licensed Rights in consideration of Your acceptance ofthese terms and conditions, and the Licensor grants You such rights inconsideration of benefits the Licensor receives from making theLicensed Material available under these terms and conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
i. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
3. Term. The term of this Public License is specified in Section 6(a).
4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a) (4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
b. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to thefollowing conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified form), You must:
a. retain the following if it is supplied by the Licensor with the Licensed Material:
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
b. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights thatapply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does notreplace Your obligations under this Public License where the LicensedRights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its publiclicenses. Notwithstanding, Creative Commons may elect to apply one ofits public licenses to material it publishes and in those instanceswill be considered the “Licensor.” The text of the Creative Commonspublic licenses is dedicated to the public domain under the CC0 PublicDomain Dedication. Except for the limited purpose of indicating thatmaterial is shared under a Creative Commons public license or asotherwise permitted by the Creative Commons policies published atcreativecommons.org/policies, Creative Commons does not authorize theuse of the trademark "Creative Commons" or any other trademark or logoof Creative Commons without its prior written consent including,without limitation, in connection with any unauthorized modificationsto any of its public licenses or any other arrangements,understandings, or agreements concerning use of licensed material. Forthe avoidance of doubt, this paragraph does not form part of thepublic licenses.
Creative Commons may be contacted at creativecommons.org.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE9e5f1b3c610b9c2da5c313bf81d577a7d1acec686bdb0384edefa6df0f90cd94 LICENSE-DATAd56d5530025e70ce5a1125d29fe0b2c281ae43ba2e9b2bd30ef63c5754c08c13 NOTICE80bd0d62df51177dfc8ed92d768b09b2c26709b6743bd0d2523d210f6389fa64 POLICY-PROVENANCE.md1b80bd5b277308cc7ce12c28a0d74920362fb3c6e41c03807c41c648d534fd8f README.md6b2a4021302c5ec6ad0ab87ff861ec63f46e55636fe4197567dc4fe33e3400a4 REPRODUCING.md55ddf80067b0b4379dddb705525bee2bdd48a756b176fb2f5eef2af6a3de9a84 SCHEMAS.md4dea4ac3da30caf3ec3fc9b9c1011ed057394a9e4810a34630007dd3eb380353 analysis/reproduce.py0503f2aa59e991b1f106c5f89eaa05e19be02d625fee124977b69c604d24cd20 analysis/verify_results.py3c0e9c23f8c749abfddc2554330621e307543fb58d34d2faffacf38a4454cbd6 configs/arms/codex-luna-final.yaml8fce67bf9b6029cfa1b79f929d0f249b448951eeddab0377eb905afcdc16d31c configs/arms/codex-sol-all.yaml95dc022caea022407645c4195c22632658eecb96ab6b5f717177698f5da283e1 configs/arms/codex-terra-control-always-verify.yaml83605b409244a460522df685b8a7409aed9cafa501f666990c32101d0f10d715 configs/arms/codex-terra-control-reconsider.yaml807d81548bb6798820978cac83b83b8a1937829a117d633ff9d23b9b0fe6e089 configs/arms/codex-terra-control-sham.yaml9a769d1e2c437ec2476704ebaec5b55d68dd06ccc9616cb3bc45a26985524ead configs/arms/codex-terra-final.yamld4ba74bfd18fc99f172a1d9f9755ccf4a3b4ffb83de8afb299c52f325d7bcdea configs/arms/harness/codex.baseline.json5ac0dc7ee37d92c4176869a4e20e42652223adf2ec49774561c78265f8cd9a08 configs/arms/harness/codex.policy.json4b528cafb05f15e08d988bb458e7c18f596e2f5076ec05cf2429e08ffa8422cc configs/base.yamla114b70b0f27c3ab8d38c57322e8596404d3b349e3c37ceb25569b792327f605 configs/final-analysis-run-ledger.yaml62132159f374c61e7d2557a914ad4ce10beed838f065dd32fa108066352c6b64 configs/policy_profiles.jsonfe825979f63ef5219513ed013c164eda4d77bcfdbdc5cbd15e9b68538a1fb5a0 configs/terra-controls-analysis.yamld5854bccdc4d7a9811b09e47a3a40ef24dce508c458eae7b3819d378f9090a3b policies/_lib/profile.mjsf5239a19bd9d2f2743108418bcef930ea6994c8fda66f2437b2f0e176f15560c policies/_lib/state.mjsdb861cfb21c1312455e63b1237179973fe6c484c4818e68ca862a74d86690e5b policies/codex-final-binary-equivalence/binary-equivalence.mjs0dae15cdf9eefd320d316a158cb3b0dfc339b9240a25e9778b8f1bebd118fe47 policies/codex-final-build/build-provenance.mjs4b6bd757abb81f44e0019ec8ed07d5c9b9663e6dc8de508ee8956fcc4c3f44bb policies/codex-final-enumeration/multi-answer-enumeration.mjs0aa683406b49785532a11fdb1b831e7c564ed4d5caa5c514cfa8cc8cde2028eb policies/codex-final-latex/latex-log-validation.mjs4b9f61d57a0499ea5c8b7525e3a56ed447f02ac33aa7c04a9dfe427a49c33c09 policies/codex-final-replacements/exact-replacements.mjs95eb9971c2109a0f636a12324933f5ca25ea4f4279d83d5ec36aecb2ea0a3028 policies/codex-final-token-accounting/token-accounting.mjsef67adb180fcffc56b3298b0e681ea29d20bc1497deaae52f97c9a6345905f0d policies/codex-luna-v4/evidence/preserve-before-open.mjsfae2fd0c5b4faaaf474302cd3288b68237ef04e2f3fa63a70ae796dca0a57e11 policies/codex-luna-v4/liveness/service-persistence.mjs6e3e2f729cfa384ac98cac96e340cf2118e97ded7229824c1b90351d7973af7e policies/codex-sol/criteria/measured-acceptance.mjsafdf9077711c3c19387c90a2267052665ecd1d5eb85ddd0b2252de3601c7d48c policies/codex-sol/liveness/service-survival.mjsa484c452bfd20cca52547eb9e01157412827b3cc09ef3f06865ae1adc2988c4b policies/codex-sol/requirements/provenance-ledger.mjs16ca16a3f74211e335ebf7294634d5e28c9fa946c938bff2d325726c58e5e777 policies/codex-sol/runtime/public-contract.mjsf04aaa2371fdd48e3172d79181129d92a1bbb9c6ad4fa68e0720a21db773ffe4 policies/codex-sol/scope/exact-diff.mjsdb861cfb21c1312455e63b1237179973fe6c484c4818e68ca862a74d86690e5b policies/paper-appendix-terra/binary-equivalence.mjs4b9f61d57a0499ea5c8b7525e3a56ed447f02ac33aa7c04a9dfe427a49c33c09 policies/paper-appendix-terra/exact-replacements.mjs0aa683406b49785532a11fdb1b831e7c564ed4d5caa5c514cfa8cc8cde2028eb policies/paper-appendix-terra/latex-log-validation.mjs4b6bd757abb81f44e0019ec8ed07d5c9b9663e6dc8de508ee8956fcc4c3f44bb policies/paper-appendix-terra/multi-answer-enumeration.mjsef67adb180fcffc56b3298b0e681ea29d20bc1497deaae52f97c9a6345905f0d policies/paper-appendix-terra/preserve-before-open.mjsfae2fd0c5b4faaaf474302cd3288b68237ef04e2f3fa63a70ae796dca0a57e11 policies/paper-appendix-terra/service-persistence.mjs95eb9971c2109a0f636a12324933f5ca25ea4f4279d83d5ec36aecb2ea0a3028 policies/paper-appendix-terra/token-accounting.mjs342149a989303908107a99c18e5dcaf0457f3161ea7f0c22ea2a5052cf714eb7 policies/terra-control-always-verify/always-verify.mjs171c4999e32bb4ce0580357b185867a2c87487edf54cd14966c422de7ea5b96f policies/terra-control-reconsider/reconsider.mjs663187006c244dbab963163d8e7f6e2b3dd2d0a42a0f20462f3b7448e67ebd32 policies/terra-control-sham/triggered-sham.mjs1dec143e3065e0df357ba775819874249a557194ff05645d643602a01aeca4b6 results/complete-suite/README.md8f75b83cf25f02d6664a64f9a745d64e2a36620d184a01e3fc478613bdfe8119 results/complete-suite/attempts.csv3eb4ff93584a5b399e9a375b605439ec526f98488be8d77b4dc452d8b44eb6ce results/complete-suite/comparisons.csv0cf82c00c3feff8c246019bc100d74d51b91b9e74a27941f1a8fbc36cf0b2411 results/complete-suite/cost-latency.csvcb4410e735216962cf84c1d47b41ca6f82bd0cd1fc76219a4b950b011f90fd06 results/complete-suite/high-memory-third-attempt.csv322d6645d295080cd7011e8a97f866da8fd6b496647f4b6dff6e871ffda31f7c results/complete-suite/policy-firing-summary.csv199870d52472a31a0167517de080325ef56ef1e313c21ed263c21873e2a8f67c results/complete-suite/policy-firing.csvea75c43effecc9b402a3c7cade524abb64098c9e9a8abca9b2798ebcfd453485 results/complete-suite/primary.csvac5d8380c5342dde4fcd3f86d48d54b8b4c59a190c903bbd14245f586ce8924a results/complete-suite/primary.texc57d2c8c30306981ea652703c61bdb82b4e95c64e8c708d867e7e0865af9b18d results/complete-suite/protocol-deviations.csv2b9ebcbbde17cf9fccae852706d43e631ab841f1787e312bd4c5b5e9009c6eb8 results/complete-suite/selected-attempts.csv74407258656907e1d104a01bc51bce35c42f5020c598f886353231fb1a8c4c24 results/complete-suite/summary.json3f3bbbcae2e76bac3f401f634107ec01a79e8ebdba5e0eeb9d724d747a707849 results/complete-suite/task-transitions.csvf9d8331887d1f8e56f460449695a86b5eb251b83b2af895ea8550a54be231282 results/complete-suite/terminations.csv20e5acbb8488ad9c98f15ee0ff1ee0309345b3013fb2d3aaf8eb6534639f3eeb results/complete-suite/terra-sol-eligible-cohort.csv149b922c8a63b9281c57bf23920e252814efa8b276b7a9fbf722c04eeccf0049 results/five-arm-panel/README.mdb858f3b6cb4924aeeab49cdb23c3f65571a6c75a4c946f14c723fff343988f5e results/five-arm-panel/attempt-funnel.csvd88319772a1affdb4d57ed675a90b0872302c19c43caadffcd799ba73c2cf40b results/five-arm-panel/cohort-summary.csv28b2cab5382fd38dc75f33d0d5b3b41f98edf78c767474bd80195092d2c483cd results/five-arm-panel/comparisons.csva2ad24a2d2ddcd48990748991570dcd1da58fde077445d8b03ec6ff86e340ba7 results/five-arm-panel/condition-progress.csvf8fb081766a31ba761822db7b6f7b0e794cb178b4662bf62bcff1ec6ed9154f3 results/five-arm-panel/family-funnel.csv78e3b9e63be029b3c7b954fc0aaafd5264032f3cdf8b0b09fd269ae78ab74783 results/five-arm-panel/interaction.json51bdc6a550f5eb10462bf36c7c03c47cb3615c3fd1f5815d8c38ff954a49f8cd results/five-arm-panel/lineage-audit.csv1598dee59434b8b9f380f50d65db6f7232b8c4347b18368df0056c09585912b3 results/five-arm-panel/lineage-summary.csvabfbfcdd55d09af4284de57a239fafaec99d1cfc91f2a11675487651edcba14a results/five-arm-panel/summary.jsoncfe23dd5f5b88896ccc0b30c4f8b1064fbc0b91448bb95825491b439da2da2c7 results/five-arm-panel/task-matrix.csv12345678910111213141516FIRE: Failure-Informed Runtime Engineering for Reliable Language-Model AgentsCopyright 2026 Failproof AI
The experiments used these third-party projects:
- Terminal-Bench 2.1, dataset revision 6 at content digest sha256:7d7bdc1cbedad549fc1140404bd4dc45e5fd0ea7c4186773687d177ad3a0699a, Apache License 2.0, https://github.com/laude-institute/terminal-bench- Harbor 0.20.0, Apache License 2.0, https://github.com/laude-institute/harbor- OpenAI Codex CLI 0.146.0, Apache License 2.0, https://github.com/openai/codex
The external projects are not redistributed or relicensed by this artifact.The Apache-2.0 and CC BY 4.0 grants in this folder apply only to material forwhich the authors hold the necessary rights.1234567891011121314151617# Policy provenance
`policies/paper-appendix-terra/` is a paper-layout snapshot, not a separatelyexecuted policy bundle. It collects the seven Terra policies in one directoryso the appendix and artifact can refer to stable filenames.
| Paper-layout file | Executed source ||---|---|| `binary-equivalence.mjs` | `codex-final-binary-equivalence/binary-equivalence.mjs` || `exact-replacements.mjs` | `codex-final-replacements/exact-replacements.mjs` || `latex-log-validation.mjs` | `codex-final-latex/latex-log-validation.mjs` || `multi-answer-enumeration.mjs` | `codex-final-enumeration/multi-answer-enumeration.mjs` || `preserve-before-open.mjs` | `codex-luna-v4/evidence/preserve-before-open.mjs` || `service-persistence.mjs` | `codex-luna-v4/liveness/service-persistence.mjs` || `token-accounting.mjs` | `codex-final-token-accounting/token-accounting.mjs` |
Each pair is byte-identical. `MANIFEST.sha256` makes that identity auditable.1231234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889---license: cc-by-4.0---# FIRE artifact
This artifact accompanies *FIRE: Failure-Informed Runtime Engineering forReliable Language-Model Agents*. It contains the frozen policies,trajectory-free attempt outcomes, analysis code, and derived tables used inthe paper. It does not contain prompts, agent transcripts, tool calls, or taskworkspace contents.
## Start here
Python 3.10 or newer is the only requirement for analysis. From this folder:
```bashpython3 analysis/verify_results.py```
The command validates the attempt populations and task digests, regeneratesthe statistical tables from attempt-level inputs, compares them with thepublished tables, and verifies every file against `MANIFEST.sha256`. It doesnot rewrite the artifact or its manifest.
To inspect regenerated tables separately:
```bashpython3 analysis/reproduce.py --out /tmp/fire-reproduced```
See `REPRODUCING.md` for the verification levels and experiment requirements,and `SCHEMAS.md` for field definitions.
## Contents
- `policies/`: frozen Luna, Terra, Sol, and Terra control policy source.- `configs/`: model routes, harness settings, run-selection and replacement ledgers, exclusions, and inference settings.- `results/complete-suite/attempts.csv`: 1,044 sanitized scalar outcome rows, covering six cells, 87 tasks, and two attempts per task.- `results/five-arm-panel/attempt-funnel.csv`: 300 selected scalar outcome rows.- `results/five-arm-panel/lineage-audit.csv`: selection and replacement provenance for the panel. This is metadata, not trajectory content.- `analysis/reproduce.py`: analysis implementation for all derivable released CSV tables, including bootstrap intervals and permutation tests.- `analysis/verify_results.py`: non-mutating cross-table and checksum validator.- `POLICY-PROVENANCE.md`: relationship between executed and paper-layout policy copies.
## Paper map
| Paper item | Artifact source ||---|---|| Fig. 2 and Tables 1, 3 (`fig:controls`, `tab:contrasts`, `tab:funnel`) | `results/five-arm-panel/` || Table 4 (`tab:suite`) | `results/complete-suite/primary.csv`, `comparisons.csv` || Table 5 (`tab:transitions`) | `results/complete-suite/task-transitions.csv` || Table 6 (`tab:terminations`) | `results/complete-suite/terminations.csv` || Fig. 4 and Table 7 (`fig:scatter`, `tab:tiers`) | `results/complete-suite/cost-latency.csv`, `primary.csv` || Policy-family listings | `policies/`, `configs/policy_profiles.json` || Population and deviations | `configs/final-analysis-run-ledger.yaml`, `results/complete-suite/protocol-deviations.csv` |
## Population and outcomes
Terminal-Bench 2.1 contains 89 tasks. `qemu-alpine-ssh` and `qemu-startup`were uniformly excluded because their pinned Bullseye images could not installthe agent from the live Debian security mirror. Every complete-suite celltherefore contains 87 tasks and 174 attempts.
The primary outcome is the verifier reward. A successful verifier can coexistwith a later `timeout` lifecycle label. This occurs in exactly three Sol rows:
- baseline, `extract-moves-from-video`- policy, `extract-moves-from-video`- policy, `make-doom-for-mips`
This explains why Sol verifier passes are 131 and 140 while `passed`termination labels are 130 and 138. No rows are dropped or relabeled.
## Scope
The released scalar records are sufficient to regenerate the reported tables,confidence intervals, permutation tests, transitions, and aggregate resourcestatistics. Full model reruns require Terminal-Bench, Harbor, Codex CLI,FailproofAI runtime integration, paid model access, and credentials. The rawrun directories are not part of this package, so this is an analysis-reproducibleartifact rather than a self-contained model-execution archive.
## Licenses
Original software and policy source are Apache-2.0 licensed; see `LICENSE`.Original manifests, annotations, derived data, and scalar outcome records areCC BY 4.0 licensed; see `LICENSE-DATA`. Third-party provenance is in `NOTICE`.12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970# Reproducing the FIRE results
## Level 1: validate the package (seconds)
Requirements: Python 3.10 or newer. The analysis uses only the standardlibrary; Node.js is needed only for the optional syntax check.
```bashpython3 analysis/verify_results.pyfind policies -name '*.mjs' -print0 | xargs -0 -n1 node --check```
The first command is non-mutating. It checks source-row cardinality, pairing,task-digest agreement, cross-table identities, regenerated statistics, andthe frozen checksum manifest.
## Level 2: regenerate statistics (minutes)
```bashpython3 analysis/reproduce.py --out /tmp/fire-reproduced```
This recomputes the complete-suite primary metrics, task transitions,task-cluster bootstrap intervals, paired sign-flip permutation tests, costs,termination counts, policy-firing summaries, eligible-cohort comparison, andthe five-arm aggregate and comparison tables. The frozen settings are 10,000bootstrap repetitions, 100,000 permutations, seed 20260909 for the completesuite, and seed 20260910 for the control panel.
The inputs are `results/complete-suite/attempts.csv`,`results/five-arm-panel/attempt-funnel.csv`, and the panel lineage and taskmatrix files. These contain scalar outcomes and provenance only.
## Level 3: rerun model experiments (expensive)
The recorded environment was:
- Terminal-Bench 2.1, revision 6, digest recorded in `configs/base.yaml`- Harbor 0.20.0 with Docker and task-declared CPU, memory, and timeouts- Codex CLI 0.146.0, medium reasoning effort- `openai/gpt-5.6-luna`, `openai/gpt-5.6-terra`, and `openai/gpt-5.6-sol`- FailproofAI policy hook registered as shown in `configs/arms/harness/codex.policy.json`
Baseline runs use `configs/arms/harness/codex.baseline.json`; policy runs use`configs/arms/harness/codex.policy.json` and the corresponding arm YAML. Exactsource-run selection and panel replacement order are frozen in the two configledgers.
A full rerun requires access to the named models and service credentials, theTerminal-Bench task environments, Harbor, Docker, Codex CLI, and theFailproofAI runtime package. Model calls are paid. The released experimentcosts can be summed from the `cost_usd` columns; wall-clock time depends onhost capacity and concurrency. Several tasks request 8 GB RAM, and tasktimeouts range from 600 to 12,000 seconds.
This package does not ship the private runtime launcher or raw run directories,so it does not claim one-command experiment reproduction. The public artifactdoes provide the exact arm settings and enough sanitized outcome data to auditand rerun the full statistical analysis.
## Statistical conventions
- Primary score: mean verifier reward across two attempts per task (`pass@1`).- Bootstrap: resample paired tasks with replacement; percentile endpoints.- Paired test: two-sided task-level sign-flip permutation test.- Monte Carlo p-values use the plus-one correction `(hits + 1)/(reps + 1)`.- Missing infrastructure attempts in the panel follow the frozen replacement lineage. Scored failures remain failures.- Firing-conditioned analyses are diagnostic because firing is post-treatment.1234567891011121314151617181920212223242526272829303132333435363738394041424344# Data schemas
## Complete-suite attempts
`results/complete-suite/attempts.csv` has one row per selected attempt.
- Identity: `cell`, `run_id`, `task`, `trial_index`, `trial_name`, `model`.- Provenance: `task_digest` identifies immutable task content.- Outcome: `passed` is the binary verifier outcome and `reward` is its numeric value. `termination_reason` and `exception_type` describe harness lifecycle.- Resources: `cost_usd`, token counts, and `agent_seconds`.- Mechanism: `policy_fired` and semicolon-delimited `policies`. These are blank for baseline cells.
`passed` is the paper's primary outcome. It must not be inferred from`termination_reason`; a verifier may finish successfully before a laterlifecycle timeout.
## Five-arm panel
`attempt-funnel.csv` contains the two selected fair attempts for everycondition-task pair. `lineage-audit.csv` also contains superseded infrastructureattempt metadata and marks the selected row.
- `eligible` and `eligible_families`: preregistered task-policy applicability.- `runtime_condition_observed`: whether the relevant runtime situation arose.- `fired`, `fired_policies`, `fired_families`: policy activation metadata.- `behavior_marker`: coded target behavior (`yes`, `no`, `manual`, or `not_applicable`).- `scored`, `no_fair_attempt`, `selected`, `lineage_rank`, and `replaced_no_fair_attempts`: frozen selection metadata.- `passed`, `reward`, cost, token counts, and duration: scalar outcomes.
## Derived files
- `primary.csv`: cell-level pass@1, pass@2, pass-squared, and bootstrap CIs.- `comparisons.csv`: paired task-level effects, CIs, and permutation p-values.- `task-transitions.csv` and `task-matrix.csv`: paired task outcomes.- `cost-latency.csv`, `terminations.csv`, and policy/family funnel files: resource, lifecycle, and mechanism summaries.- `summary.json`: convenience serialization of the corresponding analysis.
Run `python3 analysis/reproduce.py --check` to audit derivable CSVs againsttheir attempt-level inputs.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337#!/usr/bin/env python3"""Regenerate released statistics from trajectory-free attempt records."""
from __future__ import annotations
import argparseimport csvimport jsonimport mathimport randomimport tempfilefrom collections import Counter, defaultdictfrom pathlib import Path
ROOT = Path(__file__).resolve().parents[1]COMPLETE = ROOT / "results/complete-suite"PANEL = ROOT / "results/five-arm-panel"
def read_csv(path: Path) -> list[dict[str, str]]: with path.open(newline="", encoding="utf-8") as handle: return list(csv.DictReader(handle))
def write_csv(path: Path, rows: list[dict]) -> None: path.parent.mkdir(parents=True, exist_ok=True) if not rows: return fields: list[str] = [] for row in rows: fields.extend(key for key in row if key not in fields) with path.open("w", newline="", encoding="utf-8") as handle: writer = csv.DictWriter(handle, fieldnames=fields) writer.writeheader() writer.writerows(rows)
def truth(value: str | bool) -> bool: return value is True or str(value).lower() in {"1", "true"}
def number(value: str) -> float | None: return None if value in {"", "None"} else float(value)
def quantile(values: list[float], probability: float) -> float: ordered = sorted(values) position = (len(ordered) - 1) * probability low = int(position) high = min(low + 1, len(ordered) - 1) return ordered[low] + (ordered[high] - ordered[low]) * (position - low)
def vectors(rows: list[dict]) -> dict[str, tuple[int, ...]]: grouped: dict[str, list[dict]] = defaultdict(list) for row in rows: grouped[row["task"]].append(row) return { task: tuple(int(truth(row["passed"])) for row in sorted(items, key=lambda x: (int(x.get("trial_index", x.get("replicate", 0))), x["trial_name"]))) for task, items in grouped.items() }
def bootstrap_rate(task_vectors: dict[str, tuple[int, ...]], repetitions: int, rng: random.Random) -> list[float]: rates = [sum(value) / len(value) for value in task_vectors.values()] samples = [sum(rates[rng.randrange(len(rates))] for _ in rates) / len(rates) for _ in range(repetitions)] return [quantile(samples, 0.025), quantile(samples, 0.975)]
def compare_vectors(left: dict[str, tuple[int, ...]], right: dict[str, tuple[int, ...]], repetitions: int, permutations: int, rng: random.Random) -> dict: tasks = sorted(left) differences = [sum(right[task]) / 2 - sum(left[task]) / 2 for task in tasks] samples = [sum(differences[rng.randrange(len(differences))] for _ in differences) / len(differences) for _ in range(repetitions)] observed = abs(sum(differences) / len(differences)) hits = 0 for _ in range(permutations): statistic = abs(sum(value if rng.getrandbits(1) else -value for value in differences) / len(differences)) hits += statistic >= observed - 1e-12 return { "delta": sum(differences) / len(differences), "ci_low": quantile(samples, 0.025), "ci_high": quantile(samples, 0.975), "p": (hits + 1) / (permutations + 1), }
def reproduce_complete(out: Path) -> None: rows = read_csv(COMPLETE / "attempts.csv") bootstrap = 10_000 permutations = 100_000 rng = random.Random(20260909) by_cell: dict[str, list[dict]] = defaultdict(list) for row in rows: by_cell[row["cell"]].append(row)
primary = [] costs = [] terminations = [] for cell in ("luna_baseline", "luna_policy", "terra_baseline", "terra_policy", "sol_baseline", "sol_policy"): cell_rows = by_cell[cell] tv = vectors(cell_rows) distribution = Counter(sum(value) for value in tv.values()) attempts = len(cell_rows) passes = sum(sum(value) for value in tv.values()) ci = bootstrap_rate(tv, bootstrap, rng) primary.append({ "cell": cell, "model": cell_rows[0]["model"], "condition": cell.split("_", 1)[1], "tasks": len(tv), "attempts": attempts, "passes": passes, "pass_at_1": passes / attempts, "pass_at_2": sum(any(value) for value in tv.values()) / len(tv), "pass_squared": sum(all(value) for value in tv.values()) / len(tv), "pass_at_1_ci_low": ci[0], "pass_at_1_ci_high": ci[1], "zero_of_two": distribution[0], "one_of_two": distribution[1], "two_of_two": distribution[2], }) def mean(key: str): values = [number(row[key]) for row in cell_rows if number(row[key]) is not None] return sum(values) / len(values) costs.append({ "cell": cell, "total_cost_usd": sum(number(row["cost_usd"]) or 0 for row in cell_rows), "mean_cost_usd": mean("cost_usd"), "mean_agent_sec": mean("agent_seconds"), "mean_input_tokens": mean("input_tokens"), "mean_cache_tokens": mean("cache_tokens"), "mean_output_tokens": mean("output_tokens"), }) for reason, count in Counter(row["termination_reason"] for row in cell_rows).items(): terminations.append({"cell": cell, "termination_reason": reason, "attempts": count})
comparisons = [] transitions = [] for model in ("luna", "terra", "sol"): left = vectors(by_cell[f"{model}_baseline"]) right = vectors(by_cell[f"{model}_policy"]) result = compare_vectors(left, right, bootstrap, permutations, rng) changes = {task: sum(right[task]) - sum(left[task]) for task in left} comparisons.append({ "model": model, "delta_pass_at_1": result["delta"], "ci_low": result["ci_low"], "ci_high": result["ci_high"], "paired_permutation_p": result["p"], "improved": sum(value > 0 for value in changes.values()), "regressed": sum(value < 0 for value in changes.values()), "unchanged": sum(value == 0 for value in changes.values()), }) for task in sorted(left): a, b = sum(left[task]), sum(right[task]) transitions.append({"model": model, "task": task, "baseline_passes": a, "policy_passes": b, "transition": f"{a}->{b}"})
eligible = {row["task"] for row in read_csv(PANEL / "task-matrix.csv") if truth(row["eligible"])} cohort = [] for cell in ("terra_baseline", "sol_baseline", "terra_policy"): selected = [row for row in by_cell[cell] if row["task"] in eligible] tv = vectors(selected) passes = sum(sum(value) for value in tv.values()) cohort.append({"cell": cell, "tasks": len(tv), "attempts": len(selected), "passes": passes, "pass_at_1": passes / len(selected), "delta_pass_at_1": "", "ci_low": "", "ci_high": "", "paired_permutation_p": ""}) left = vectors([row for row in by_cell["sol_baseline"] if row["task"] in eligible]) right = vectors([row for row in by_cell["terra_policy"] if row["task"] in eligible]) result = compare_vectors(left, right, bootstrap, permutations, rng) cohort.append({"cell": "terra_policy_minus_sol_baseline", "tasks": len(eligible), "attempts": "", "passes": "", "pass_at_1": "", "delta_pass_at_1": result["delta"], "ci_low": result["ci_low"], "ci_high": result["ci_high"], "paired_permutation_p": result["p"]})
firing_rows = [row for row in rows if row["policy_fired"] != ""] firing_summary = [] for cell in sorted({row["cell"] for row in firing_rows}): selected = [row for row in firing_rows if row["cell"] == cell] firing_summary.append({"cell": cell, "attempts": len(selected), "fired_attempts": sum(truth(row["policy_fired"]) for row in selected), "silent_attempts": sum(not truth(row["policy_fired"]) for row in selected), "tasks_with_fire": len({row["task"] for row in selected if truth(row["policy_fired"])})})
write_csv(out / "primary.csv", primary) write_csv(out / "comparisons.csv", comparisons) write_csv(out / "task-transitions.csv", transitions) write_csv(out / "cost-latency.csv", costs) write_csv(out / "terminations.csv", terminations) write_csv(out / "policy-firing-summary.csv", firing_summary) write_csv(out / "terra-sol-eligible-cohort.csv", cohort)
def panel_compare(left: list[dict], right: list[dict], tasks: list[str], repetitions: int, permutations: int, rng: random.Random) -> dict: a = {task: [truth(row["passed"]) for row in left if row["task"] == task and truth(row["scored"])] for task in tasks} b = {task: [truth(row["passed"]) for row in right if row["task"] == task and truth(row["scored"])] for task in tasks} complete = [task for task in tasks if len(a[task]) == 2 and len(b[task]) == 2] if len(complete) != len(tasks): return {"status": "pending", "tasks_complete": len(complete), "tasks_required": len(tasks)} result = compare_vectors({task: tuple(map(int, a[task])) for task in tasks}, {task: tuple(map(int, b[task])) for task in tasks}, repetitions, permutations, rng) return {"status": "complete", "tasks": len(tasks), **result}
def reproduce_panel(out: Path) -> None: rows = read_csv(PANEL / "attempt-funnel.csv") lineage = read_csv(PANEL / "lineage-audit.csv") conditions = ["baseline", "real", "sham", "always_verify", "reconsider"] by_condition = {condition: [row for row in rows if row["condition"] == condition] for condition in conditions} task_rows = read_csv(PANEL / "task-matrix.csv") tasks = sorted(row["task"] for row in task_rows) eligible = sorted(row["task"] for row in task_rows if truth(row["eligible"])) silent = sorted(set(tasks) - set(eligible))
progress = [] cohort = [] for condition in conditions: selected = by_condition[condition] seconds = [number(row["agent_seconds"]) for row in selected if number(row["agent_seconds"]) is not None] outputs = [number(row["output_tokens"]) for row in selected if number(row["output_tokens"]) is not None] progress.append({ "condition": condition, "runs": len({row["run_id"] for row in lineage if row["condition"] == condition}), "attempts": len(selected), "scored_attempts": sum(truth(row["scored"]) for row in selected), "unscored_attempts": sum(not truth(row["scored"]) for row in selected), "tasks": len({row["task"] for row in selected}), "passes": sum(truth(row["passed"]) for row in selected if truth(row["scored"])), "eligible_attempts": sum(truth(row["eligible"]) and truth(row["scored"]) for row in selected), "fired_attempts": sum(truth(row["fired"]) and truth(row["scored"]) for row in selected), "behavior_yes": sum(row["behavior_marker"] == "yes" and truth(row["scored"]) for row in selected), "behavior_manual": sum(row["behavior_marker"] == "manual" and truth(row["scored"]) for row in selected), "cost_usd": sum(number(row["cost_usd"]) or 0 for row in selected), "mean_agent_seconds": sum(seconds) / len(seconds), "mean_output_tokens": sum(outputs) / len(outputs), }) for name, task_set in (("eligible", set(eligible)), ("silent", set(silent)), ("all", set(tasks))): subset = [row for row in selected if row["task"] in task_set and truth(row["scored"])] cohort.append({"condition": condition, "cohort": name, "tasks": len({row["task"] for row in subset}), "attempts": len(subset), "passes": sum(truth(row["passed"]) for row in subset), "pass_rate": sum(truth(row["passed"]) for row in subset) / len(subset), "fired_attempts": sum(truth(row["fired"]) for row in subset), "cost_usd": sum(number(row["cost_usd"]) or 0 for row in subset)})
lineage_summary = [] for condition in conditions: selected = by_condition[condition] for replicate in (1, 2): subset = [row for row in selected if int(row["replicate"]) == replicate] lineage_summary.append({"condition": condition, "replicate": replicate, "tasks": len(subset), "original_selected": sum(int(row["lineage_rank"]) == 0 for row in subset), "first_recovery_selected": sum(int(row["lineage_rank"]) == 1 for row in subset), "second_recovery_selected": sum(int(row["lineage_rank"]) == 2 for row in subset), "discarded_no_fair_attempts": sum(int(row["replaced_no_fair_attempts"]) for row in subset)})
families = sorted({family for row in rows for family in row["eligible_families"].split(";") if family}) family_rows = [] for condition in conditions: for family in families: subset = [row for row in by_condition[condition] if truth(row["scored"]) and family in row["eligible_families"].split(";")] family_rows.append({"condition": condition, "family": family, "eligible_attempts": len(subset), "condition_observed": sum(row["runtime_condition_observed"] == "True" for row in subset), "fired": sum(family in row["fired_families"].split(";") for row in subset), "behavior_yes": sum(row["behavior_marker"] == "yes" for row in subset), "scored_attempts": len(subset), "verifier_passes": sum(truth(row["passed"]) for row in subset)})
repetitions, permutations = 10_000, 100_000 rng = random.Random(20260910) comparisons = [] for left, right in [("real", "sham"), ("real", "baseline"), ("real", "always_verify"), ("real", "reconsider"), ("sham", "baseline")]: for name, task_set in (("eligible", eligible), ("silent", silent), ("all", tasks)): result = panel_compare(by_condition[left], by_condition[right], task_set, repetitions, permutations, rng) # panel_compare computes right-left; the registered panel reports left-right. if result.get("status") == "complete": result["delta"] *= -1 result["ci_low"], result["ci_high"] = -result["ci_high"], -result["ci_low"] comparisons.append({"left": left, "right": right, "cohort": name, **result})
def task_differences(condition_left: str, condition_right: str, task_set: list[str]) -> list[float]: left_rows, right_rows = by_condition[condition_left], by_condition[condition_right] return [ (sum(truth(row["passed"]) for row in left_rows if row["task"] == task) - sum(truth(row["passed"]) for row in right_rows if row["task"] == task)) / 2 for task in task_set ]
eligible_diffs = task_differences("real", "sham", eligible) silent_diffs = task_differences("real", "sham", silent) observed = sum(eligible_diffs) / len(eligible_diffs) - sum(silent_diffs) / len(silent_diffs) samples = [] for _ in range(repetitions): eligible_sample = sum(eligible_diffs[rng.randrange(len(eligible_diffs))] for _ in eligible_diffs) / len(eligible_diffs) silent_sample = sum(silent_diffs[rng.randrange(len(silent_diffs))] for _ in silent_diffs) / len(silent_diffs) samples.append(eligible_sample - silent_sample) combined = [(value, "eligible") for value in eligible_diffs] + [(value, "silent") for value in silent_diffs] hits = 0 for _ in range(permutations): rng.shuffle(combined) first = [value for value, _ in combined[:len(eligible_diffs)]] second = [value for value, _ in combined[len(eligible_diffs):]] statistic = sum(first) / len(first) - sum(second) / len(second) hits += abs(statistic) >= abs(observed) - 1e-12 interaction = {"status": "complete", "interaction": observed, "ci_low": quantile(samples, 0.025), "ci_high": quantile(samples, 0.975), "p": (hits + 1) / (permutations + 1)}
write_csv(out / "condition-progress.csv", progress) write_csv(out / "cohort-summary.csv", cohort) write_csv(out / "lineage-summary.csv", lineage_summary) write_csv(out / "family-funnel.csv", family_rows) write_csv(out / "comparisons.csv", comparisons) (out / "interaction.json").write_text(json.dumps(interaction, indent=2) + "\n", encoding="utf-8")
def equivalent(left: Path, right: Path) -> bool: a, b = read_csv(left), read_csv(right) if len(a) != len(b) or [set(row) for row in a] != [set(row) for row in b]: return False for x, y in zip(a, b): for key in x: try: if not math.isclose(float(x[key]), float(y[key]), rel_tol=1e-12, abs_tol=1e-12): return False except ValueError: if x[key] != y[key]: return False return True
def main() -> None: parser = argparse.ArgumentParser() parser.add_argument("--out", type=Path, help="write regenerated tables here") parser.add_argument("--check", action="store_true", help="compare regenerated tables with the release") args = parser.parse_args() if not args.out and not args.check: parser.error("choose --out DIR or --check") if args.check: with tempfile.TemporaryDirectory() as directory: root = Path(directory) reproduce_complete(root / "complete-suite") reproduce_panel(root / "five-arm-panel") failures = [] for section in ("complete-suite", "five-arm-panel"): for generated in (root / section).glob("*.csv"): if not equivalent(generated, ROOT / "results" / section / generated.name): failures.append(f"{section}/{generated.name}") generated_interaction = json.loads((root / "five-arm-panel/interaction.json").read_text()) released_interaction = json.loads((PANEL / "interaction.json").read_text()) if generated_interaction != released_interaction: failures.append("five-arm-panel/interaction.json") if failures: raise SystemExit("Regenerated tables differ: " + ", ".join(failures)) print("All derivable released tables regenerated successfully.") else: reproduce_complete(args.out / "complete-suite") reproduce_panel(args.out / "five-arm-panel") print(args.out)
if __name__ == "__main__": main()1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677#!/usr/bin/env python3"""Validate source records, regenerate statistics, and check the release."""
from __future__ import annotations
import csvimport hashlibimport subprocessimport sysfrom collections import Counter, defaultdictfrom pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def rows(relative: str) -> list[dict[str, str]]: with (ROOT / relative).open(newline="", encoding="utf-8") as handle: return list(csv.DictReader(handle))
def require(condition: bool, message: str) -> None: if not condition: raise AssertionError(message)
def verify_attempts() -> None: attempts = rows("results/complete-suite/attempts.csv") grouped: dict[str, Counter] = defaultdict(Counter) for row in attempts: grouped[row["cell"]][row["task"]] += 1 require(len(attempts) == 6 * 87 * 2, "complete suite must contain 1,044 attempts") require(len(grouped) == 6, "complete suite must contain six cells") for cell, counts in grouped.items(): require(len(counts) == 87 and set(counts.values()) == {2}, f"{cell}: expected 87 tasks x 2") digests: dict[str, set[str]] = defaultdict(set) for row in attempts: digests[row["task"]].add(row["task_digest"]) require(all(len(values) == 1 for values in digests.values()), "task digest differs across cells") primary = {row["cell"]: row for row in rows("results/complete-suite/primary.csv")} for cell in grouped: cell_rows = [row for row in attempts if row["cell"] == cell] require(int(primary[cell]["passes"]) == sum(int(row["passed"]) for row in cell_rows), f"{cell}: pass count mismatch") terminations = rows("results/complete-suite/terminations.csv") for cell in grouped: total = sum(int(row["attempts"]) for row in terminations if row["cell"] == cell) require(total == 174, f"{cell}: termination count mismatch")
def verify_panel() -> None: attempts = rows("results/five-arm-panel/attempt-funnel.csv") grouped = Counter((row["condition"], row["task"]) for row in attempts) require(len(attempts) == 5 * 30 * 2, "five-arm panel must contain 300 selected attempts") require(set(grouped.values()) == {2}, "each panel condition-task pair must contain two attempts") require(all(row["scored"] == "True" for row in attempts), "all selected panel attempts must be scored")
def verify_manifest() -> None: manifest = ROOT / "MANIFEST.sha256" require(manifest.exists(), "MANIFEST.sha256 is missing") listed: set[str] = set() for line in manifest.read_text(encoding="utf-8").splitlines(): digest, relative = line.split(" ", 1) listed.add(relative) path = ROOT / relative require(path.is_file(), f"manifest path missing: {relative}") require(hashlib.sha256(path.read_bytes()).hexdigest() == digest, f"manifest digest mismatch: {relative}") present = {str(path.relative_to(ROOT)) for path in ROOT.rglob("*") if path.is_file() and path != manifest} require(listed == present, f"manifest file set mismatch: missing={sorted(present-listed)}, stale={sorted(listed-present)}")
if __name__ == "__main__": verify_attempts() verify_panel() subprocess.run([sys.executable, str(ROOT / "analysis/reproduce.py"), "--check"], check=True) verify_manifest() print("Artifact records, derived tables, and manifest are consistent.")1234567891011121314151617181920212223# Revised Luna policy portfolio after the k=2 subset session review.# Only policies with a narrow trigger and positive focused mechanism evidence# are included. Broad runtime/requirements policies and failed assembly or# finite-format policies are intentionally excluded.agent: codexmodel: openai/gpt-5.6-lunapolicies: - codex-luna-v4/liveness - codex-luna-v4/evidence - codex-final-build - codex-final-replacements - codex-final-latexpolicy_profile: lunapredicted_failure_modes: - persistent_service_not_left_reachable - recovery_evidence_mutated_before_copy - source_build_provenance_mismatch - exact_replacement_or_protected_scope_violation - latex_warning_check_false_negative - verified_deployment_removed_after_probeharness_config: configs/arms/harness/codex.policy.jsonagent_kwargs: [reasoning_effort=medium, version=0.146.0]agent_env: []123456789101112131415161718agent: codexmodel: openai/gpt-5.6-solpolicies: - codex-sol/liveness - codex-sol/criteria - codex-sol/runtime - codex-sol/requirements - codex-sol/scopepolicy_profile: solpredicted_failure_modes: - service_or_vm_not_available_to_verifier - measured_acceptance_bar_not_closed - public_invocation_not_exercised_on_representative_input - required_version_provenance_or_final_artifact_omitted - exact_content_or_scope_mismatchharness_config: configs/arms/harness/codex.policy.jsonagent_kwargs: [reasoning_effort=medium, version=0.146.0]agent_env: []12345678agent: codexmodel: openai/gpt-5.6-terrapolicies: [terra-control-always-verify]policy_profile: terrapredicted_failure_modes: [generic_final_artifact_verification_control]harness_config: configs/arms/harness/codex.policy.jsonagent_kwargs: [reasoning_effort=medium, version=0.146.0]agent_env: []12345678agent: codexmodel: openai/gpt-5.6-terrapolicies: [terra-control-reconsider]policy_profile: terrapredicted_failure_modes: [token_matched_generic_reconsideration_control]harness_config: configs/arms/harness/codex.policy.jsonagent_kwargs: [reasoning_effort=medium, version=0.146.0]agent_env: []12345678agent: codexmodel: openai/gpt-5.6-terrapolicies: [terra-control-sham]policy_profile: terrapredicted_failure_modes: [attention_and_runtime_timing_control]harness_config: configs/arms/harness/codex.policy.jsonagent_kwargs: [reasoning_effort=medium, version=0.146.0]agent_env: []1234567891011121314151617181920212223242526# Revised Terra policy portfolio after the k=2 subset session review.# The bundle includes current policies with positive focused evidence and two# narrow successors to previously over-broad requirement/quantifier policies.agent: codexmodel: openai/gpt-5.6-terrapolicies: - codex-luna-v4/liveness - codex-luna-v4/evidence - codex-final-replacements - codex-final-latex - codex-final-binary-equivalence - codex-final-token-accounting - codex-final-enumerationpolicy_profile: terrapredicted_failure_modes: - persistent_service_not_left_reachable - recovery_evidence_mutated_before_copy - exact_replacement_or_protected_scope_violation - latex_warning_check_false_negative - explicit_acceptance_threshold_missed - dataset_token_fields_or_domain_mapping_omitted - multiple_valid_answers_incompletely_enumerated - verified_deployment_removed_after_probeharness_config: configs/arms/harness/codex.policy.jsonagent_kwargs: [reasoning_effort=medium, version=0.146.0]agent_env: []1234{ "_comment": "Clean baseline Codex config, no policy hook. Preflight hard-fails if a failproof hook is present in a no-policy arm.", "hooks": {}}12345678{ "_comment": "Codex config for POLICY arms. Must carry the failproofai hook; preflight hard-fails a policy arm whose config lacks one, and a baseline arm whose config has one.", "hooks": { "PreToolUse": [ { "command": "npx failproofai hook" } ] }}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374# Shared settings used by the released Codex Luna, Terra, and Sol runs.# Model, policy, and harness choices live in configs/arms/. The exact runs used# for analysis live in configs/final-analysis-run-ledger.yaml and# configs/terra-controls-analysis.yaml. This file records shared execution# defaults only; it is not a standalone launch configuration.
dataset: name: terminal-bench/terminal-bench-2-1 # Harbor registry dataset revision 6, resolved from `latest` on 2026-08-19. # The immutable dataset content hash is accepted as the package reference. # Per-task sha256 digests are also recorded automatically in lock.json. ref: sha256:7d7bdc1cbedad549fc1140404bd4dc45e5fd0ea7c4186773687d177ad3a0699a n_tasks_expected: 89 # Task names are namespaced. Filters must use the full name. name_prefix: terminal-bench/
harbor: version: "0.20.0"
environment: type: docker # local Docker for every stage, incl. Stage 0 (see plan: sandbox decision) # Resource declarations come from each task.toml. Do NOT override them: # `--memory ignore` / `--override-memory` would change declared task conditions # and turn an OOM into an unexplained agent failure. cpu_enforcement_policy: auto memory_enforcement_policy: auto force_build: false delete: true
concurrency: # Execution-capacity setting only. Derive a safe value from the current host; # record it for diagnostics, but do not require baseline and policy runs to # use identical values. Task resources and timeouts remain unchanged. # Ceiling is set by Docker VM RAM vs task memory_mb (8 tasks want 8192 MB). # Derived from the host at run time when null; set an int to cap it. # An override can only LOWER concurrency: memory capacity is a hard ceiling. n_concurrent: null max_per_tier: null # optional clamp, e.g. to leave host headroom n_concurrent_agents: null
timeouts: # There is NO turn/step limit in TB 2.1 — budget is wall-clock agent.timeout_sec, # declared per task (600 s .. 12000 s, median 900 s). Use the declared budgets. timeout_multiplier: 1.0 agent_timeout_multiplier: null verifier_timeout_multiplier: null agent_setup_timeout_multiplier: null environment_build_timeout_multiplier: null
retries: # Harbor's default exclude_exceptions already covers AgentTimeoutError, # VerifierTimeoutError, VerifierOutputParseError, RewardFile*Error, auth/model # errors — i.e. exactly "retry infra, never retry grader outcomes". # So: set max_retries and keep stock excludes. Record the resolved list from lock.json. max_retries: 3 use_default_excludes: true
scoring: # Timeouts and aborts are FAILS for pass@1, and are excluded from token averages # so means are not computed over truncated runs. timeout_counts_as: fail abort_counts_as: fail exclude_from_token_averages: [timeout, abort, harness_crash] termination_reasons: [passed, failed, timeout, agent_gave_up, harness_crash]
evaluation: harness: codex-cli harness_version: "0.146.0" reasoning_effort: medium models: - openai/gpt-5.6-luna - openai/gpt-5.6-terra - openai/gpt-5.6-sol attempts_per_task_condition: 212345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970version: 1frozen_at: 2026-09-09population: dataset: terminal-bench/terminal-bench-2-1 tasks: 87 attempts_per_cell: 2 excluded_tasks: [qemu-alpine-ssh, qemu-startup]selection_rule: first two rows per task in the listed runs, ordered by run timestamp then trial indexcells: luna_baseline: model: openai/gpt-5.6-luna condition: baseline runs: - 20260807T120828Z__baseline-codex-luna__k1 - 20260821T062048Z__baseline-codex-luna__k1 luna_policy: model: openai/gpt-5.6-luna condition: policy runs: - 20260828T120739Z__codex-luna-final__k1 - 20260828T172048Z__codex-luna-final__k1 - 20260908T070729Z__codex-luna-final__k1 - 20260908T074654Z__codex-luna-final__k1 - 20260908T112032Z__codex-luna-final__k3 terra_baseline: model: openai/gpt-5.6-terra condition: baseline runs: - 20260803T080950Z__baseline-codex__k1 - 20260804T102835Z__baseline-codex__k1 - 20260908T103659Z__baseline-codex__k1__set-terra-baseline-4096-completion - 20260908T134418Z__baseline-codex__k1 terra_policy: model: openai/gpt-5.6-terra condition: policy runs: - 20260827T074903Z__codex-terra-final__k1 - 20260827T130817Z__codex-terra-final__k1 - 20260908T045930Z__codex-terra-final__k1 - 20260908T054355Z__codex-terra-final__k1 - 20260908T093831Z__codex-terra-final__k1__set-iclr-terra-stream-replacement - 20260908T095139Z__codex-terra-final__k1__set-iclr-terra-stream-replacement - 20260908T144536Z__codex-terra-final__k2 sol_baseline: model: openai/gpt-5.6-sol condition: baseline runs: - 20260807T072327Z__baseline-codex-sol__k1 - 20260819T124458Z__baseline-codex-sol__k1 - 20260819T153357Z__baseline-codex-sol__k1__rerun - 20260820T055854Z__baseline-codex-sol__k1 - 20260820T063606Z__baseline-codex-sol__k1 - 20260820T075732Z__baseline-codex-sol__k1 - 20260908T170400Z__baseline-codex-sol__k1__set-sol-baseline-k2-completion sol_policy: model: openai/gpt-5.6-sol condition: policy runs: - 20260820T100152Z__codex-sol-all__k2 - 20260820T183926Z__codex-sol-all__k2 - 20260820T215313Z__codex-sol-all__k2high_memory_third_attempt: luna_policy: 20260908T112032Z__codex-luna-final__k3deviations: - tasks: [qemu-alpine-ssh, qemu-startup] disposition: uniformly_excluded reason: pinned Bullseye images could not install the agent from the live Debian security mirror - task: break-filter-js-from-html disposition: counted_as_failure reason: repeated provider response.failed stream termination is a system-level failure, not a no-fair-attempt replacement123456789101112131415161718192021222324252627282930313233343536373839404142434445{ "model_profiles": { "openai/gpt-5.6-sol": "sol", "openai/gpt-5.6-terra": "terra", "openai/gpt-5.6-luna": "luna" }, "profiles": { "sol": { "nudge_limits": { "liveness": 1, "runtime": 1, "quantifier": 1, "criteria": 1, "scope": 1, "optimization": 1 }, "require_runtime_probe": true, "require_requirement_ledger": false }, "terra": { "nudge_limits": { "liveness": 1, "runtime": 1, "quantifier": 1, "criteria": 1, "scope": 1, "optimization": 1 }, "require_runtime_probe": true, "require_requirement_ledger": false }, "luna": { "nudge_limits": { "liveness": 2, "runtime": 2, "quantifier": 2, "criteria": 2, "scope": 2, "optimization": 2 }, "require_runtime_probe": true, "require_requirement_ledger": true } }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354version: 1frozen_at: 2026-09-10task_set: terra-controls-30attempts_per_task_condition: 2conditions: baseline: baseline-codex real: codex-terra-final sham: codex-terra-control-sham always_verify: codex-terra-control-always-verify reconsider: codex-terra-control-reconsider# Each replicate contributes exactly one observation per task. Replicate 2# follows the frozen replacement protocol: retain the original observation# when it was a fair attempt, otherwise take the first fair replacement in# recovery order. Later broad reruns never overwrite an earlier fair result.lineage: baseline: - [20260910T140734Z__baseline-codex__k1__set-terra-controls-30] - [20260910T155042Z__baseline-codex__k1__set-terra-controls-30, 20260911T071212Z__baseline-codex__k1__rerun, 20260911T185204Z__baseline-codex__k1__rerun] real: - [20260910T075815Z__codex-terra-final__k1__set-terra-controls-30] - [20260910T165440Z__codex-terra-final__k1__set-terra-controls-30, 20260911T122417Z__codex-terra-final__k1__rerun, 20260911T192508Z__codex-terra-final__k1__rerun] sham: - [20260910T123447Z__codex-terra-control-sham__k1__set-terra-controls-30] - [20260910T212142Z__codex-terra-control-sham__k1__set-terra-controls-30, 20260911T081531Z__codex-terra-control-sham__k1__rerun] always_verify: - [20260910T092608Z__codex-terra-control-always-verify__k1__set-terra-controls-30] - [20260910T182005Z__codex-terra-control-always-verify__k1__set-terra-controls-30, 20260911T102239Z__codex-terra-control-always-verify__k1__rerun, 20260911T191500Z__codex-terra-control-always-verify__k1__rerun] reconsider: - [20260910T111903Z__codex-terra-control-reconsider__k1__set-terra-controls-30] - [20260910T194553Z__codex-terra-control-reconsider__k1__set-terra-controls-30, 20260911T162436Z__codex-terra-control-reconsider__k1__rerun, 20260911T194229Z__codex-terra-control-reconsider__k1__rerun]primary: population: eligible contrast: [real, sham] outcome: verifier_rewardsecondary_contrasts: - [real, baseline] - [real, always_verify] - [real, reconsider] - [sham, baseline]subgroups: [eligible, silent]interaction: real_minus_sham_difference_between_eligible_and_silentinference: unit: task bootstrap_repetitions: 10000 permutation_repetitions: 100000 seed: 20260910 interval: percentile_task_cluster_bootstrap test: paired_task_level_sign_flip_permutationmissingness: scored_agent_or_verifier_failure: fail no_fair_attempt_infrastructure_failure: replace_under_frozen_retry_rule incomplete_running_attempt: pendingfiring_note: policy firing is post-treatment and is reported only as a mechanism diagnosticdenial_control_note: sham preserves eligibility and event timing but represents real denial hooks as generic instructions, avoiding retention of the mechanism or repeated-denial deadlock12345678910111213141516171819202122import { readFileSync } from "node:fs";
let cached;
export function policyProfile() { if (cached) return cached; const name = process.env.FAILPROOF_PROFILE; const path = process.env.FAILPROOF_PROFILE_CONFIG; if (!name || !path) { throw new Error("policy profile environment is missing"); } const doc = JSON.parse(readFileSync(path, "utf8")); const values = doc?.profiles?.[name]; if (!values) throw new Error(`unknown policy profile: ${name}`); cached = Object.freeze({ name, ...values }); return cached;}
export function profileNudgeLimit(key, fallback = 1) { const value = policyProfile()?.nudge_limits?.[key]; return Number.isInteger(value) && value >= 0 ? value : fallback;}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155// Shared helpers for the study's policies.//// FailproofAI runs each policy as a SUBPROCESS per tool call, so nothing is// retained in memory between calls. Any counter that must survive across the// run has to live on disk. State is keyed per working directory so concurrent// trials on the same host never share counters -- Harbor runs many tasks in// parallel, and cross-contaminated state would silently couple them.
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";import { join } from "node:path";import { tmpdir } from "node:os";import { createHash } from "node:crypto";
const dir = join(tmpdir(), "failproof-study");
// Key on the session, NOT the directory. `ctx.cwd` does not exist -- the hook// context carries `ctx.session.{sessionId,cwd}` (verified by dumping ctx from a// real hook invocation), so keying on `ctx?.cwd` silently fell through to the// hook process's own cwd. Codex spawns the hook from the tool's workdir, so a// task that worked in two directories got two independent sets of counters and// nudged twice for what the design calls "at most twice per run" -- observed as// 2 verify-depth nudges in one trial, where the cap is 1.//// sessionId is per agent run, which is the unit the caps are written against,// and it is distinct across concurrent Harbor trials.function pathFor(ctx) { const id = ctx?.session?.sessionId || ctx?.session?.cwd || process.cwd(); const key = createHash("sha1").update(String(id)).digest("hex").slice(0, 16); return join(dir, `${key}.json`);}
export function load(ctx) { try { return JSON.parse(readFileSync(pathFor(ctx), "utf8")); } catch { return { writes: 0, checks: 0, reads: {}, nudges: {}, cmds: 0 }; }}
export function save(ctx, s) { try { mkdirSync(dir, { recursive: true }); writeFileSync(pathFor(ctx), JSON.stringify(s)); } catch { /* never let bookkeeping break the agent's run */ }}
// Extract a shell command from whatever shape the harness passes. Codex sends// exec_command payloads; Claude Code sends a plain `command` field.export function commandOf(ctx) { const i = ctx?.toolInput || {}; if (typeof i.command === "string") return i.command; if (Array.isArray(i.command)) return i.command.join(" "); if (typeof i.cmd === "string") return i.cmd; const blob = typeof i === "string" ? i : typeof i.input === "string" ? i.input : JSON.stringify(i || {}); // Code-mode wraps exec_command in JavaScript, so the key is commonly an // unquoted object-literal key (`cmd:"..."`) inside toolInput.input. Older // harnesses serialize it as JSON (`"cmd":"..."`). Accept both shapes. const m = blob.match(/(?:"cmd"|\bcmd)\s*:\s*"((?:[^"\\]|\\.)*)"/); if (m) { try { return JSON.parse(`"${m[1]}"`); } catch { return m[1]; } } return "";}
// UserPromptSubmit has changed shape across supported CLIs. Keep prompt// detection defensive so policies can decide whether they are relevant without// firing on every task. This reads only the user's task text; no task names or// fixtures are embedded in policy source.export function promptOf(ctx) { for (const value of [ ctx?.prompt, ctx?.userPrompt, ctx?.message, ctx?.input, ctx?.payload?.prompt, ctx?.payload?.message, ctx?.payload?.content, ctx?.toolInput?.prompt, ctx?.toolInput?.message, ctx?.toolInput?.content, ]) { if (typeof value === "string") return value; } return "";}
// A command that verifies work, as opposed to producing it.export const CHECK = /\b(pytest|py\.test|unittest|npm\s+(?:run\s+)?test|yarn\s+test|go\s+test|cargo\s+test|make\s+(?:test|check)|tox|jest|mocha|rspec|bats|shellcheck|mypy|ruff|flake8|diff|cmp|sha256sum|md5sum|grep\s+-q)\b/i;
export const WRITE = /(apply_patch|\bAdd File:|\bUpdate File:|>>?\s|\btee\b|\bmkdir\b|\btouch\b|\bcp\b|\bmv\b)/;
export const READ = /\b(?:cat|head|tail|less|nl|bat|sed\s+-n)\s+(\S+)/;
// Anything that EXERCISES the work, which is broader than CHECK. The host-2// baseline showed failures run test-runner commands slightly MORE often than// passes (46% vs 39%), so "did it run pytest" is the wrong question. "Did it// execute what it just built and look at the output" is the one that matters:// measured behaviourally, 89% of failures executed something, and the single// trial that did neither is the only run that truly checked nothing.export const EXEC = /(^|[|;&]\s*)(python3?|node|bash|sh|zsh|java|go\s+run|cargo\s+run|Rscript|perl|ruby|make\b|\.\/\S+)|\b(pytest|py\.test|unittest|npm\s+(?:run\s+)?test|jest|mocha|curl\s)/i;
// The file a write-ish command touched, so guidance can name the agent's own// artifact instead of asking abstractly for "verification". Task-agnostic by// construction: the path comes from what the agent did, never from the task.const PATCH_PATH = /\*\*\*\s+(?:Add|Update)\s+File:\s+(\S+)/;const REDIRECT_PATH = />>?\s*(\S+)/;const TOUCH_PATH = /\b(?:tee|touch|cp|mv)\s+(?:-\S+\s+)*(?:\S+\s+)?(\S+)/;
export function writtenPath(cmd) { for (const re of [PATCH_PATH, REDIRECT_PATH, TOUCH_PATH]) { const m = re.exec(cmd); if (m && m[1] && !m[1].startsWith("-")) return m[1]; } return "";}
// Ordering, not counts. A Stop gate needs to know whether anything ran AFTER// the last edit -- an agent that edits, verifies, then edits again has left its// final state unexercised even though it "did verify" at some point.export function noteCommand(s, cmd) { s.seq = (s.seq || 0) + 1; if (WRITE.test(cmd)) { s.lastWrite = s.seq; const p = writtenPath(cmd); if (p) s.lastWritePath = p; } if (EXEC.test(cmd)) s.lastExec = s.seq; return s;}
// True when the agent's most recent edit was never exercised afterwards.export function endsUnverified(s) { if (!s.lastWrite) return false; // nothing written: nothing to exercise return !s.lastExec || s.lastExec < s.lastWrite;}
// Fire a given nudge at most `max` times per run. Repeating the same guidance// wastes context and trains the agent to ignore it.export function shouldNudge(s, key, max = 2) { // A state file written before `nudges` existed -- or any partial write -- // would make this throw, and a throw inside a hook takes the policy layer // down mid-trial. Bookkeeping must never be able to break the agent's run. if (!s.nudges || typeof s.nudges !== "object") s.nudges = {}; const n = s.nudges[key] || 0; if (n >= max) return false; s.nudges[key] = n + 1; return true;}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364// Narrow threshold policy for reverse-engineered replacement programs. It// avoids exposing ordinary threshold-bearing tasks to a generic optimization// nudge.
import { customPolicies, allow, instruct } from "failproofai";import { load, save, commandOf, promptOf, shouldNudge } from "../_lib/state.mjs";
const REIMPLEMENT = /\b(?:compiled|existing)\s+(?:an?\s+|the\s+)?(?:program|binary|executable)\b/i;const EQUIVALENCE = /\b(?:identical|equivalent|same)\s+(?:operation|output|behavio[u]?r)\b/i;const INDEPENDENT = /\b(?:independent|isolation|must not invoke|without (?:calling|running|using))\b/i;const SIZE_BAR = /(?:<|under|at most|no more than)\s*\d+\s*(?:k|kb|bytes?)\b/i;const MEASURE = /\b(?:cmp|diff|sha256sum|gzip\s*\|\s*wc|wc\s+-c)\b/i;const CANDIDATE_BUILD = /\bgcc\b[^\n]{0,240}\b(?:mystery\.c|reversed)\b|\.\/reversed\b/i;
customPolicies.add({ name: "final-binary-equivalence-track", match: { events: ["UserPromptSubmit", "PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const prompt = promptOf(ctx); if (prompt && REIMPLEMENT.test(prompt) && EQUIVALENCE.test(prompt) && INDEPENDENT.test(prompt) && SIZE_BAR.test(prompt)) { s.finalBinaryEquivalence = true; } const cmd = commandOf(ctx); if (cmd && MEASURE.test(cmd)) s.finalBinaryMeasurement = true; save(ctx, s); return allow(); },});
customPolicies.add({ name: "final-binary-equivalence-before-candidate-run", match: { events: ["PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const cmd = commandOf(ctx); if (!s.finalBinaryEquivalence || !cmd || !CANDIDATE_BUILD.test(cmd)) return allow(); if (!shouldNudge(s, "final-binary-before-run", 1)) return allow(); save(ctx, s); return instruct( `The first candidate must be measured against the original immediately, before further approximation. ` + `Run both in isolated directories with the evaluator-facing build and invocation, compare every output ` + `artifact and stream byte-for-byte, and record the actual similarity or mismatch. If equivalence fails, ` + `switch to reverse-engineering the missing operation instead of polishing a visually similar renderer.` ); },});
customPolicies.add({ name: "final-binary-equivalence", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.finalBinaryEquivalence || !shouldNudge(s, "final-binary-equivalence", 1)) return allow(); save(ctx, s); return instruct( `Before stopping, validate the replacement program against the original over a diverse input set using ` + `the exact build and invocation contract. Record output differences and the compressed source size, and ` + `verify that the replacement remains independent when the original executable is unavailable. If any ` + `measured acceptance bar is missed, change the implementation method rather than declaring approximate ` + `behavior sufficient. Preserve the best measured artifact.` ); },});1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465// Frozen source-build policy. Split from the broader exactness bundle after a// focused fired-policy pass on its provenance target.
import { customPolicies, allow, instruct } from "failproofai";import { load, save, commandOf, promptOf, shouldNudge, noteCommand } from "../_lib/state.mjs";
const SOURCE_BUILD = /\b(?:build|compile)\b[^.\n]{0,100}\bfrom source\b|\bsource archives?\b[^.\n]{0,100}\b(?:compile|build|extract)\b/i;const INSTALL_CONTRACT = /\/usr\/local\/bin\/|\binstall (?:the )?binary\b/i;const BUILD_ACTION = /\b(?:make|cmake|ninja|meson|configure|gcc|g\+\+|clang|cargo\s+build|go\s+build)\b|\binstall\s+(?:-[A-Za-z0-9]+\s+)*\S+\s+\/usr\/local\/bin\/|\bcp\s+[^\n]{0,160}\/usr\/local\/bin\//i;const INSTALL_ACTION = /\binstall\s+(?:-[A-Za-z0-9]+\s+)*\S+\s+\/usr\/local\/bin\/|\bcp\s+[^\n]{0,160}\/usr\/local\/bin\//i;
customPolicies.add({ name: "final-build-provenance-track", match: { events: ["UserPromptSubmit", "PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const prompt = promptOf(ctx); if (prompt && SOURCE_BUILD.test(prompt) && INSTALL_CONTRACT.test(prompt)) s.finalSourceBuild = true; const cmd = commandOf(ctx); if (cmd) { noteCommand(s, cmd); if (BUILD_ACTION.test(cmd)) s.finalBuildAction = s.seq; } save(ctx, s); return allow(); },});
customPolicies.add({ name: "final-build-provenance-before-install", match: { events: ["PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const cmd = commandOf(ctx); if (!s.finalSourceBuild || !cmd || !INSTALL_ACTION.test(cmd)) return allow(); if (!shouldNudge(s, "final-build-before-install", 1)) return allow(); save(ctx, s); return instruct( `Before installing this binary, verify the extracted tree is the exact requested project and version. ` + `Check version-identifying files and the expected archive contents, including small metadata files that ` + `distinguish releases; confirm the executable was compiled from this tree. Do not install a compatible ` + `binary assembled from a partial, adjacent, or different-version archive.` ); },});
customPolicies.add({ name: "final-build-provenance", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.finalSourceBuild || !s.finalBuildAction || !shouldNudge(s, "final-build-provenance", 1)) return allow(); save(ctx, s); return instruct( `This task grades source provenance as well as whether the installed binary runs. Verify that the ` + `source archive or repository is the requested project and version, that it was extracted at the ` + `required path, and that the installed executable came from that exact tree. Keep protected inputs ` + `unchanged, then run the requested installed-binary check. A working executable from another source, ` + `version, or build tree is still a failure.` ); },});123456789101112131415161718192021222324252627282930313233343536// Narrow successor to the generic quantifier policy. It targets tasks that// explicitly require every valid/winning answer as separate output records.
import { customPolicies, allow, instruct } from "failproofai";import { load, save, promptOf, shouldNudge } from "../_lib/state.mjs";
const MULTIPLE = /\b(?:multiple|more than one|all|every)\b[^.\n]{0,100}\b(?:winning|valid|correct|acceptable)\b[^.\n]{0,80}\b(?:moves?|answers?|solutions?|results?)\b/i;const OUTPUT_EACH = /\b(?:one per line|each on (?:a|its own) line|print them all|write them all|output them all)\b/i;
customPolicies.add({ name: "final-multi-answer-track", match: { events: ["UserPromptSubmit"] }, fn: async (ctx) => { const s = load(ctx); const prompt = promptOf(ctx); if (prompt && MULTIPLE.test(prompt) && OUTPUT_EACH.test(prompt)) s.finalMultiAnswer = true; save(ctx, s); return allow(); },});
customPolicies.add({ name: "final-multi-answer-enumeration", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.finalMultiAnswer || !shouldNudge(s, "final-multi-answer", 1)) return allow(); save(ctx, s); return instruct( `The output contract requires every valid answer, not one witness. Enumerate the complete candidate ` + `set, test each candidate against the task's winning or validity condition, remove duplicates, and emit ` + `all surviving answers in the exact requested one-record-per-line format. Before stopping, verify that ` + `no additional candidate satisfies the same condition.` ); },});12345678910111213141516171819202122232425262728293031323334353637// Frozen LaTeX log policy from the focused fired-policy pass.
import { customPolicies, allow, instruct } from "failproofai";import { load, save, commandOf, promptOf, shouldNudge } from "../_lib/state.mjs";
const CONTRACT = /\bno\s+["'`]?overfull\s+(?:\\hbox|hbox)\b/i;const BUILD = /\b(?:pdflatex|xelatex|lualatex|latexmk)\b/i;
customPolicies.add({ name: "final-latex-log-track", match: { events: ["UserPromptSubmit", "PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const prompt = promptOf(ctx); if (prompt && CONTRACT.test(prompt)) s.finalLatexContract = true; const cmd = commandOf(ctx); if (cmd && BUILD.test(cmd)) s.finalLatexBuild = true; save(ctx, s); return allow(); },});
customPolicies.add({ name: "final-latex-log-validation", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.finalLatexContract || !s.finalLatexBuild || !shouldNudge(s, "final-latex-log", 1)) return allow(); save(ctx, s); return instruct( `Inspect the log produced by the final LaTeX compile and search for the literal text ` + `'Overfull \\hbox' with exactly one backslash. Do not infer cleanliness from exit status. ` + `If it is present, make only a replacement explicitly authorized by the task, then rerun both ` + `the compile and literal log check. If it is absent and the allowed-replacement diff is valid, stop.` ); },});123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899// Frozen exact-replacement policy. Its narrow credential path produced a// focused fired-policy pass after write tracking was corrected.
import { customPolicies, allow, instruct } from "failproofai";import { load, save, commandOf, promptOf, shouldNudge, noteCommand, WRITE as GENERIC_WRITE } from "../_lib/state.mjs";
const REPLACEMENT = /\b(?:replace\b[^.\n]{0,100}\bwith\b|specified synonyms?|allowed synonyms?|placeholder values?|only edits? you may make)\b/i;const PROTECTED = /\b(?:do not (?:modify|change|edit|touch)|leave [^.\n]{0,80} (?:unchanged|intact)|only (?:modify|change|edit)|only edits? you may make)\b/i;const EXACT_PLACEHOLDERS = /\bplaceholder values?\b[^.\n]{0,160}\b(?:consistent|exact|same|as follows)\b/i;const SECRET = /\b(?:api keys?|access keys?|secret keys?|github tokens?|huggingface tokens?|credentials?)\b/i;const WRITE = /\b(?:perl\s+-p?i|sed\s+-i|python(?:3)?\b[^\n]{0,180}(?:write_text|write_bytes|open\([^\n]{0,80}['"]w))\b/i;const DIFF = /\bgit\s+diff\b|\bcmp\b|\bsha256sum\b|\bdiff\s+(?:-[A-Za-z]+\s+)*\S+/i;const FINAL_CHECK = /\b(?:pytest|py\.test|pdflatex|git\s+diff\s+--check|grep\s+-[A-Za-z]*q|rg\s+)[^\n]*/i;const PATCH_WRITE = /apply_patch|\*\*\*\s+(?:Add|Update|Delete)\s+File:/;
customPolicies.add({ name: "final-replacement-track", match: { events: ["UserPromptSubmit", "PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const prompt = promptOf(ctx); if (prompt && REPLACEMENT.test(prompt)) { if (SECRET.test(prompt) && EXACT_PLACEHOLDERS.test(prompt)) s.finalSecretReplacement = true; else if (PROTECTED.test(prompt)) s.finalRestrictedReplacement = true; } const cmd = commandOf(ctx); if (cmd) { noteCommand(s, cmd); if (WRITE.test(cmd)) s.finalReplacementWrite = s.seq; if (DIFF.test(cmd)) s.finalReplacementDiff = s.seq; if (FINAL_CHECK.test(cmd)) s.finalReplacementCheck = s.seq; } else if (/apply_patch|\*\*\*\s+(?:Add|Update|Delete)\s+File:/.test(JSON.stringify(ctx?.toolInput || {}))) { s.seq = (s.seq || 0) + 1; s.lastWrite = s.seq; s.finalReplacementWrite = s.seq; } save(ctx, s); return allow(); },});
customPolicies.add({ name: "final-replacement-before-first-write", match: { events: ["PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const blob = JSON.stringify(ctx?.toolInput || {}); const cmd = commandOf(ctx); const isWrite = WRITE.test(cmd) || GENERIC_WRITE.test(cmd) || PATCH_WRITE.test(blob); if ((!s.finalSecretReplacement && !s.finalRestrictedReplacement) || !isWrite) return allow(); if (!shouldNudge(s, "final-replacement-before-write", 1)) return allow(); save(ctx, s); return instruct( `Before making the first edit, treat the supplied replacement map as a byte-level allowlist. ` + `Change only listed source tokens to members of their own listed family; never substitute an article, ` + `whitespace, punctuation, quoting, or newline unless it is explicitly listed. Record each source-to-target ` + `pair so the final diff can be checked mechanically, and preserve every file's original EOF-newline state.` ); },});
customPolicies.add({ name: "final-secret-replacements", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.finalSecretReplacement || !s.finalReplacementWrite || !shouldNudge(s, "final-secret-replacements", 1)) return allow(); save(ctx, s); return instruct( `This credential-sanitization task specifies exact placeholder text. Replace each credential token ` + `character-for-character while preserving every surrounding byte; do not add quotes or escapes around ` + `a placeholder. Inspect all working-tree files, including ignored or generated files unless excluded, ` + `but do not rewrite history or delete refs unless explicitly requested. Verify every original value is ` + `absent, every placeholder is exact, and only contaminated files changed. Inspect the full patch and ` + `preserve each file's original end-of-file newline state.` ); },});
customPolicies.add({ name: "final-restricted-replacements", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.finalRestrictedReplacement || !s.finalReplacementWrite) return allow(); if (!shouldNudge(s, "final-restricted-replacements", 1)) return allow(); save(ctx, s); return instruct( `This task supplies a closed replacement or synonym map and protects other content. Inspect the final ` + `diff without editing it. Mechanically parse the replacement map and compare the original and final token ` + `streams: every changed token must map to a member of the same explicit family, while punctuation, ` + `whitespace, token count, protected files, and EOF-newline state remain unchanged. Do not accept a visual ` + `inspection or a clean compiler log as proof. Also identify every source-to-allowed-replacement pair; ` + `reject invented synonyms, approximate placeholders, newline-only changes, and unrelated files. Search ` + `once more for every original value, then run the task's end-to-end check after the final edit. If the ` + `diff and check already pass, stop immediately and do not rewrite anything.` ); },});1234567891011121314151617181920212223242526272829303132333435363738394041// Narrow successor to the broad requirement ledger. It preserves the exact// field-reconciliation intervention that recovered the token-counting target.
import { customPolicies, allow, instruct } from "failproofai";import { load, save, promptOf, shouldNudge } from "../_lib/state.mjs";
const DATASET = /\b(?:dataset|corpus)\b/i;const TOKEN_COUNT = /\b(?:how many|count|number of|total)\b[^.\n]{0,100}\btokens?\b|\btokens?\b[^.\n]{0,100}\b(?:count|total|number)\b/i;const SELECTION = /\b(?:domain|category|split|label|subset)\b/i;const TOKENIZER = /\btokeni[sz]er\b/i;
customPolicies.add({ name: "final-token-accounting-track", match: { events: ["UserPromptSubmit"] }, fn: async (ctx) => { const s = load(ctx); const prompt = promptOf(ctx); if (prompt && DATASET.test(prompt) && TOKEN_COUNT.test(prompt) && SELECTION.test(prompt) && TOKENIZER.test(prompt)) { s.finalTokenAccounting = true; } save(ctx, s); return allow(); },});
customPolicies.add({ name: "final-token-accounting", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.finalTokenAccounting || !shouldNudge(s, "final-token-accounting", 1)) return allow(); save(ctx, s); return instruct( `Before reporting this dataset token count, write a compact reconciliation table. Inspect the source's ` + `actual distinct domain/category/split values. Use the exact requested value if present; otherwise use ` + `only a mapping explicitly documented by the dataset and verify the selection is non-empty. Apply the ` + `named tokenizer. List every text field that contributes to the requested entity, compute each field's ` + `subtotal, and reconcile their sum to the final integer. Do not report one field as the total.` ); },});123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657// Luna v4: prevent destruction of damaged-state evidence before inspection.//// This preserves the narrow, high-consequence half of v3's evidence policy.// The broad prompt-time enumeration instruction is intentionally removed: it// fired on both chess regressions despite not identifying their real failure.
import { customPolicies, allow, deny } from "failproofai";import { load, save, commandOf, promptOf } from "../_lib/state.mjs";
const RECOVERY_TASK = /\b(?:corrupt\w*|damaged|encrypted|recover\w*|repair\w*|forensic\w*|salvage|truncated|deleted|lost)\b/i;const BACKUP = /\b(?:cp|rsync|tar|dd|cpio|zip)\b/;const DATABASE_TASK = /\b(?:database|sqlite|wal)\b/i;// A database backup is complete only if the command preserves the surrounding// directory or explicitly includes sidecars. Copying just `main.db` is not// enough: opening it can replay and delete the only useful `main.db-wal`.const DATABASE_BACKUP = /(?:\b(?:cp|rsync)\b[^\n]*(?:\/app(?:\/\.?)?\s|\.db(?:\*|\{[^}]*-wal)|\.db-wal)|\b(?:tar|zip|cpio)\b[^\n]*\/app\b)/i;const MUTATING_OPEN = /(?:\bsqlite3\s+\S+\.(?:db|sqlite3?)|\b(?:python3?|pypy3?)\b[\s\S]{0,1000}?(?:import\s+sqlite3|sqlite3\.connect)|\bmysql\b|\bpsql\b|\bmongo\b|\bredis-cli\b|\bunzip\s+-o|\bmount\b|\bfsck\b|\bgit\s+(?:checkout|reset|clean|gc)|\btruncate\b)/i;
customPolicies.add({ name: "luna4-preserve-track", match: { events: ["UserPromptSubmit", "PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const prompt = promptOf(ctx); if (prompt && RECOVERY_TASK.test(prompt)) { s.l4RecoveryTask = true; if (DATABASE_TASK.test(prompt)) s.l4DatabaseRecovery = true; } const cmd = commandOf(ctx); if (cmd && BACKUP.test(cmd)) { if (!s.l4DatabaseRecovery || DATABASE_BACKUP.test(cmd)) s.l4BackupMade = true; } save(ctx, s); return allow(); },});
customPolicies.add({ name: "luna4-preserve-before-open", match: { events: ["PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const cmd = commandOf(ctx); if (!cmd || !s.l4RecoveryTask || s.l4BackupMade || !MUTATING_OPEN.test(cmd)) return allow(); // Keep blocking until a sufficient backup exists. Repeating this deny is // intentional: one warning followed by an incomplete single-file copy // must not silently unlock the destructive operation. return deny( `This recovery task has not preserved the original evidence yet, and this command can mutate it ` + `while opening or repairing it. Make a byte-preserving copy of the artifact and its sidecars ` + `first, perform recovery work on the copy, and use a read-only reader or hex dump on the original.` ); },});1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586// Luna v4: durable service lifecycle, with both prompt and command evidence.//// v3's Stop hook fired on 82/178 trials because any Python or Node script was// treated as a service launcher. This version requires an explicit persistent// service contract in the prompt AND a recognizable server/VM launch command.
import { customPolicies, allow, deny, instruct } from "failproofai";import { load, save, commandOf, promptOf, shouldNudge } from "../_lib/state.mjs";
const PERSISTENT_SERVICE = /\b(?:web\s*server|server|service|daemon|listener|endpoint|ssh|telnet|socket|virtual machine|vm)\b[^.\n]{0,180}\b(?:run|running|listen|listening|reachable|available|accessible|connect|background|port|should be able)\b|\b(?:leave|keep|remain|stay)\b[^.\n]{0,80}\b(?:running|listening|reachable|available)\b|\bshould be able to (?:run\s+)?["'`]*(?:ssh|curl|telnet|connect)\b/i;
// Do not classify arbitrary `python foo.py` or `node foo.js` executions as// services. The command must name a conventional server/VM launcher or contain// an explicit listen/serve flag.const SERVICE_LAUNCH = /\b(?:qemu-system-[\w-]+|uvicorn|gunicorn|flask\s+run|python(?:3)?\s+-m\s+http\.server|nginx|redis-server|grpc[_-]?(?:server|serve)|npm\s+(?:run\s+)?start)\b|\b(?:python(?:3)?|node)\b[^;&|\n]{0,160}\S*(?:server|serve|service|daemon|listen)[\w.-]*\.(?:py|js)\b|--(?:host|port|listen)\b/i;
const DETACHED = /\bsetsid\b|\bsystemd-run\b|\bscreen\s+-d|\btmux\s+new-session\s+-d/;const PROBE = /\b(?:curl|wget|grpcurl|ssh|sshpass)\b|\bnc\s+-z|\bss\s+-l|\blsof\s+-i|socket\.create_connection|channel_ready_future|requests\.(?:get|post|put|delete)/i;const DEPLOYMENT_TASK = /\b(?:bare\s+git|git\s+repository|git\s+server)\b[\s\S]{0,500}(?:\b(?:web\s*server|post-receive)\b|\bport\s+8080\b|curl\s+https?:\/\/)/i;const DEPLOYMENT_PROBE = /\bgit\s+push\b|\bcurl\b[^\n]{0,200}\bhello\.html\b/i;const DESTROY_DEPLOYMENT = /\b(?:git\s+--git-dir=\S+\s+)?update-ref\s+-d\b|\brm\s+(?:-[A-Za-z]+\s+)*[^\n;&|]*(?:hello\.html|\/var\/www\/|\/git\/server)|\bgit\s+(?:reset\s+--hard|clean\b)/i;
customPolicies.add({ name: "luna4-service-track", match: { events: ["UserPromptSubmit", "PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const prompt = promptOf(ctx); if (prompt && PERSISTENT_SERVICE.test(prompt)) s.l4PersistentService = true; if (prompt && DEPLOYMENT_TASK.test(prompt)) s.l4DeploymentTask = true;
const cmd = commandOf(ctx); if (cmd) { s.l4Seq = (s.l4Seq || 0) + 1; if (s.l4PersistentService && SERVICE_LAUNCH.test(cmd)) { s.l4Launch = s.l4Seq; if (DETACHED.test(cmd)) s.l4Detached = s.l4Seq; } if (s.l4Launch && PROBE.test(cmd) && s.l4Seq > s.l4Launch) { s.l4ProbeAfter = s.l4Seq; } if (s.l4DeploymentTask && DEPLOYMENT_PROBE.test(cmd)) s.l4DeploymentProbe = s.l4Seq; } save(ctx, s); return allow(); },});
customPolicies.add({ name: "luna4-preserve-verified-deployment", match: { events: ["PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const cmd = commandOf(ctx); if (!s.l4DeploymentTask || !s.l4DeploymentProbe || !cmd || !DESTROY_DEPLOYMENT.test(cmd)) return allow(); return deny( `Blocked cleanup of the deployment state after an evaluator-facing push or HTTP probe. Leave the tested ` + `branch, commit, deployed file, document root, and running server intact; the verifier consumes that final ` + `state. Narrow the command only if its target is unambiguously unrelated temporary data.` ); },});
customPolicies.add({ name: "luna4-service-persistence", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.l4PersistentService || !s.l4Launch) return allow(); if (s.l4Detached && s.l4ProbeAfter) return allow(); if (!shouldNudge(s, "luna4-service", 1)) return allow(); save(ctx, s); return instruct( `The task explicitly requires a persistent service or VM, and you launched one. ` + `Before finishing, make the evaluator-facing process survive this shell: launch it in a new ` + `session with all standard streams redirected, then issue a separate later command that probes ` + `the required port or endpoint. A live PID or a probe chained into the launch command is not ` + `enough. If the detached process already passes that later probe, stop without changing it.` ); },});12345678910111213141516171819202122232425262728293031323334353637383940414243// Sol-specific policy authored from the Sol discovery baseline.// TARGET: measured_acceptance_bar_not_closed
import { customPolicies, allow, instruct } from "failproofai";import { load, save, commandOf, promptOf, shouldNudge } from "../_lib/state.mjs";import { profileNudgeLimit } from "../_lib/profile.mjs";
const BAR = /(>=|<=|>|<|at least|at most|within|accuracy|latency|seconds?\/call|performance|benchmark|faster|speed-?up|size limit|under \d+\s*(?:mb|bytes))/i;const MEASURE = /\b(benchmark|timeit|hyperfine|perf\s+stat|\/usr\/bin\/time|fasttext\s+test|pytest|eval\w*)\b/i;
customPolicies.add({ name: "sol-criteria-track", match: { events: ["UserPromptSubmit", "PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); if (BAR.test(promptOf(ctx))) s.solMeasuredCriterion = true; const cmd = commandOf(ctx); if (cmd && MEASURE.test(cmd)) { s.solMeasuredCriterion = true; s.solLastMeasurementCommand = cmd.slice(0, 600); } save(ctx, s); return allow(); },});
customPolicies.add({ name: "sol-measured-acceptance", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.solMeasuredCriterion || !shouldNudge(s, "sol-criteria", profileNudgeLimit("criteria", 1))) return allow(); save(ctx, s); return instruct( `Close the stated measurable acceptance bar before stopping. Record: exact evaluator-facing command, ` + `required comparator and value, observed value on the final delivered artifact, and margin to the bar. ` + `A score from a different split, wrapper, input, warmup regime, or pre-quantized artifact is not evidence ` + `for the submitted artifact. Re-run the exact measurement after the final transformation. If only some ` + `parameter cases miss, measure and repair those cases rather than reporting an aggregate that hides them. ` + `Do not stop on a value merely close to the threshold.` ); },});1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556// Sol-specific policy authored from the Sol discovery baseline.// TARGET: service_or_vm_not_available_to_verifier
import { customPolicies, allow, instruct } from "failproofai";import { load, save, commandOf, promptOf, shouldNudge } from "../_lib/state.mjs";import { profileNudgeLimit } from "../_lib/profile.mjs";
const PERSISTENT = /\b(server|service|daemon|listener|port|endpoint|ssh|virtual machine|vm\b|qemu|emulator|keep .*running|leave .*running|remain .*running)\b/i;const LAUNCH = /\b(http\.server|flask|uvicorn|gunicorn|nginx|grpc|server\.py|qemu(?:-system)?|serve\b)\b/i;const DETACHED = /\bsetsid\b/;const PROBE = /\b(curl|wget|nc\s+-z|ss\s+-l|lsof\s+-i|grpcurl|sshpass\b|ssh\b|socket\.create_connection)\b/i;const NONINTERACTIVE = /\b(sshpass|batchmode=yes|passwordauthentication|strictHostKeyChecking)\b/i;
customPolicies.add({ name: "sol-service-track", match: { events: ["UserPromptSubmit", "PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); if (PERSISTENT.test(promptOf(ctx))) s.solPersistentRuntime = true; const cmd = commandOf(ctx); if (cmd) { s.solServiceSeq = (s.solServiceSeq || 0) + 1; if (LAUNCH.test(cmd)) { s.solServiceLaunch = s.solServiceSeq; if (DETACHED.test(cmd)) s.solDetachedLaunch = s.solServiceSeq; } if (PROBE.test(cmd)) { s.solServiceProbe = s.solServiceSeq; if (NONINTERACTIVE.test(cmd)) s.solNoninteractiveProbe = s.solServiceSeq; } } save(ctx, s); return allow(); },});
customPolicies.add({ name: "sol-service-survival", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.solPersistentRuntime && !s.solServiceLaunch) return allow(); const detached = s.solDetachedLaunch >= s.solServiceLaunch; const probedLater = s.solServiceProbe > s.solServiceLaunch; if (detached && probedLater) return allow(); if (!shouldNudge(s, "sol-service", profileNudgeLimit("liveness", 1))) return allow(); save(ctx, s); return instruct( `The evaluator must reach this service or VM after the tool shell exits. Launch the final process ` + `with setsid in a new session, redirect stdin/stdout/stderr, and use a bounded readiness loop. ` + `Then run the exact public probe from a fresh shell. For SSH, prove the required non-interactive ` + `command and credentials rather than an interactive login. Record the surviving PID/listener and ` + `leave that exact verified process running.` ); },});123456789101112131415161718192021222324252627282930313233343536// Sol-specific policy authored from the Sol discovery baseline.// TARGET: required_version_provenance_or_final_artifact_omitted
import { customPolicies, allow, instruct } from "failproofai";import { load, save, promptOf, shouldNudge } from "../_lib/state.mjs";import { profileNudgeLimit } from "../_lib/profile.mjs";
const OBLIGATION = /\b(version|release|from source|source archive|archive|extract|compile|install|us(?:e|es|ed|ing)|must include|must contain|required file|exact path|all|each|every|exactly|in .* order|marker|manifest|provenance|\d+\.\d+)\b/i;
customPolicies.add({ name: "sol-requirements-track", match: { events: ["UserPromptSubmit"] }, fn: async (ctx) => { const s = load(ctx); if (OBLIGATION.test(promptOf(ctx))) s.solProvenanceObligation = true; save(ctx, s); return allow(); },});
customPolicies.add({ name: "sol-provenance-ledger", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.solProvenanceObligation || !shouldNudge(s, "sol-requirements", profileNudgeLimit("quantifier", 1))) return allow(); save(ctx, s); return instruct( `Audit every non-functional requirement separately: exact version/source, required construction method, ` + `all named files, final paths, counts, order, and provenance markers. Evidence inside a downloaded archive ` + `or build directory does not satisfy a requirement for the delivered final tree. List each obligation beside ` + `an independent command showing it exists at the evaluator-visible path and in the required form. A working ` + `binary does not prove it came from the mandated release.` ); },});12345678910111213141516171819202122232425262728293031323334353637383940414243// Sol-specific policy authored from the Sol discovery baseline.// TARGET: public_invocation_not_exercised_on_representative_input
import { customPolicies, allow, instruct } from "failproofai";import { load, save, commandOf, promptOf, shouldNudge, WRITE } from "../_lib/state.mjs";import { profileNudgeLimit } from "../_lib/profile.mjs";
const CONTRACT = /\b(command|cli|script|executable|run\w*|invok\w*|input file|output file|argument|usage|video|image|dataset|artifact)\b/i;const EXECUTE = /(^|[|;&]\s*)(python3?\s+\S|node\s+\S|bash\s+\S|sh\s+\S|\.\/\S+)/i;
customPolicies.add({ name: "sol-runtime-track", match: { events: ["UserPromptSubmit", "PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); if (CONTRACT.test(promptOf(ctx))) s.solPublicContract = true; const cmd = commandOf(ctx); if (cmd) { s.solRuntimeSeq = (s.solRuntimeSeq || 0) + 1; if (WRITE.test(cmd)) s.solRuntimeLastWrite = s.solRuntimeSeq; if (EXECUTE.test(cmd)) s.solRuntimeLastExec = s.solRuntimeSeq; } save(ctx, s); return allow(); },});
customPolicies.add({ name: "sol-public-contract", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.solPublicContract || !shouldNudge(s, "sol-runtime", profileNudgeLimit("runtime", 1))) return allow(); save(ctx, s); return instruct( `Exercise the final public interface exactly as stated, after the final edit, from a clean shell. ` + `Use the required path, interpreter, arguments, and output location; require exit status zero and inspect ` + `stderr. Do not validate only the provided example when the interface must handle arbitrary evaluator ` + `inputs: run at least one structurally different or boundary input and confirm the promised artifact and ` + `semantics. Compilation, import success, or an internal helper is not a public-interface test.` ); },});1234567891011121314151617181920212223242526272829303132333435// Sol-specific policy authored from the Sol discovery baseline.// TARGET: exact_content_or_scope_mismatch
import { customPolicies, allow, instruct } from "failproofai";import { load, save, promptOf, shouldNudge } from "../_lib/state.mjs";import { profileNudgeLimit } from "../_lib/profile.mjs";
const RESTRICTED = /\b(only (?:edit|change|modify)|do not (?:edit|change|modify|touch|delete)|not (?:delete|modify|change|touch)|must not|leave .*unchanged|exact(?:ly)?|identical|byte-for-byte|preserve|no other files|without changing|be careful|consistent across|should not read|may not|must be)\b/i;
customPolicies.add({ name: "sol-scope-track", match: { events: ["UserPromptSubmit"] }, fn: async (ctx) => { const s = load(ctx); if (RESTRICTED.test(promptOf(ctx))) s.solExactScope = true; save(ctx, s); return allow(); },});
customPolicies.add({ name: "sol-exact-diff", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.solExactScope || !shouldNudge(s, "sol-scope", profileNudgeLimit("scope", 1))) return allow(); save(ctx, s); return instruct( `Perform an exact final diff audit. Account for every changed byte against the allowed transformation, ` + `including indentation, key ordering, spaces, quoting, and the trailing newline. Verify protected content ` + `is byte-identical and that only permitted files changed. Semantic equivalence or valid parsing is not ` + `enough when the task specifies exact content or restricted scope. Revert every unlicensed difference.` ); },});12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364// Narrow threshold policy for reverse-engineered replacement programs. It// avoids exposing ordinary threshold-bearing tasks to a generic optimization// nudge.
import { customPolicies, allow, instruct } from "failproofai";import { load, save, commandOf, promptOf, shouldNudge } from "../_lib/state.mjs";
const REIMPLEMENT = /\b(?:compiled|existing)\s+(?:an?\s+|the\s+)?(?:program|binary|executable)\b/i;const EQUIVALENCE = /\b(?:identical|equivalent|same)\s+(?:operation|output|behavio[u]?r)\b/i;const INDEPENDENT = /\b(?:independent|isolation|must not invoke|without (?:calling|running|using))\b/i;const SIZE_BAR = /(?:<|under|at most|no more than)\s*\d+\s*(?:k|kb|bytes?)\b/i;const MEASURE = /\b(?:cmp|diff|sha256sum|gzip\s*\|\s*wc|wc\s+-c)\b/i;const CANDIDATE_BUILD = /\bgcc\b[^\n]{0,240}\b(?:mystery\.c|reversed)\b|\.\/reversed\b/i;
customPolicies.add({ name: "final-binary-equivalence-track", match: { events: ["UserPromptSubmit", "PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const prompt = promptOf(ctx); if (prompt && REIMPLEMENT.test(prompt) && EQUIVALENCE.test(prompt) && INDEPENDENT.test(prompt) && SIZE_BAR.test(prompt)) { s.finalBinaryEquivalence = true; } const cmd = commandOf(ctx); if (cmd && MEASURE.test(cmd)) s.finalBinaryMeasurement = true; save(ctx, s); return allow(); },});
customPolicies.add({ name: "final-binary-equivalence-before-candidate-run", match: { events: ["PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const cmd = commandOf(ctx); if (!s.finalBinaryEquivalence || !cmd || !CANDIDATE_BUILD.test(cmd)) return allow(); if (!shouldNudge(s, "final-binary-before-run", 1)) return allow(); save(ctx, s); return instruct( `The first candidate must be measured against the original immediately, before further approximation. ` + `Run both in isolated directories with the evaluator-facing build and invocation, compare every output ` + `artifact and stream byte-for-byte, and record the actual similarity or mismatch. If equivalence fails, ` + `switch to reverse-engineering the missing operation instead of polishing a visually similar renderer.` ); },});
customPolicies.add({ name: "final-binary-equivalence", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.finalBinaryEquivalence || !shouldNudge(s, "final-binary-equivalence", 1)) return allow(); save(ctx, s); return instruct( `Before stopping, validate the replacement program against the original over a diverse input set using ` + `the exact build and invocation contract. Record output differences and the compressed source size, and ` + `verify that the replacement remains independent when the original executable is unavailable. If any ` + `measured acceptance bar is missed, change the implementation method rather than declaring approximate ` + `behavior sufficient. Preserve the best measured artifact.` ); },});123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899// Frozen exact-replacement policy. Its narrow credential path produced a// focused fired-policy pass after write tracking was corrected.
import { customPolicies, allow, instruct } from "failproofai";import { load, save, commandOf, promptOf, shouldNudge, noteCommand, WRITE as GENERIC_WRITE } from "../_lib/state.mjs";
const REPLACEMENT = /\b(?:replace\b[^.\n]{0,100}\bwith\b|specified synonyms?|allowed synonyms?|placeholder values?|only edits? you may make)\b/i;const PROTECTED = /\b(?:do not (?:modify|change|edit|touch)|leave [^.\n]{0,80} (?:unchanged|intact)|only (?:modify|change|edit)|only edits? you may make)\b/i;const EXACT_PLACEHOLDERS = /\bplaceholder values?\b[^.\n]{0,160}\b(?:consistent|exact|same|as follows)\b/i;const SECRET = /\b(?:api keys?|access keys?|secret keys?|github tokens?|huggingface tokens?|credentials?)\b/i;const WRITE = /\b(?:perl\s+-p?i|sed\s+-i|python(?:3)?\b[^\n]{0,180}(?:write_text|write_bytes|open\([^\n]{0,80}['"]w))\b/i;const DIFF = /\bgit\s+diff\b|\bcmp\b|\bsha256sum\b|\bdiff\s+(?:-[A-Za-z]+\s+)*\S+/i;const FINAL_CHECK = /\b(?:pytest|py\.test|pdflatex|git\s+diff\s+--check|grep\s+-[A-Za-z]*q|rg\s+)[^\n]*/i;const PATCH_WRITE = /apply_patch|\*\*\*\s+(?:Add|Update|Delete)\s+File:/;
customPolicies.add({ name: "final-replacement-track", match: { events: ["UserPromptSubmit", "PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const prompt = promptOf(ctx); if (prompt && REPLACEMENT.test(prompt)) { if (SECRET.test(prompt) && EXACT_PLACEHOLDERS.test(prompt)) s.finalSecretReplacement = true; else if (PROTECTED.test(prompt)) s.finalRestrictedReplacement = true; } const cmd = commandOf(ctx); if (cmd) { noteCommand(s, cmd); if (WRITE.test(cmd)) s.finalReplacementWrite = s.seq; if (DIFF.test(cmd)) s.finalReplacementDiff = s.seq; if (FINAL_CHECK.test(cmd)) s.finalReplacementCheck = s.seq; } else if (/apply_patch|\*\*\*\s+(?:Add|Update|Delete)\s+File:/.test(JSON.stringify(ctx?.toolInput || {}))) { s.seq = (s.seq || 0) + 1; s.lastWrite = s.seq; s.finalReplacementWrite = s.seq; } save(ctx, s); return allow(); },});
customPolicies.add({ name: "final-replacement-before-first-write", match: { events: ["PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const blob = JSON.stringify(ctx?.toolInput || {}); const cmd = commandOf(ctx); const isWrite = WRITE.test(cmd) || GENERIC_WRITE.test(cmd) || PATCH_WRITE.test(blob); if ((!s.finalSecretReplacement && !s.finalRestrictedReplacement) || !isWrite) return allow(); if (!shouldNudge(s, "final-replacement-before-write", 1)) return allow(); save(ctx, s); return instruct( `Before making the first edit, treat the supplied replacement map as a byte-level allowlist. ` + `Change only listed source tokens to members of their own listed family; never substitute an article, ` + `whitespace, punctuation, quoting, or newline unless it is explicitly listed. Record each source-to-target ` + `pair so the final diff can be checked mechanically, and preserve every file's original EOF-newline state.` ); },});
customPolicies.add({ name: "final-secret-replacements", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.finalSecretReplacement || !s.finalReplacementWrite || !shouldNudge(s, "final-secret-replacements", 1)) return allow(); save(ctx, s); return instruct( `This credential-sanitization task specifies exact placeholder text. Replace each credential token ` + `character-for-character while preserving every surrounding byte; do not add quotes or escapes around ` + `a placeholder. Inspect all working-tree files, including ignored or generated files unless excluded, ` + `but do not rewrite history or delete refs unless explicitly requested. Verify every original value is ` + `absent, every placeholder is exact, and only contaminated files changed. Inspect the full patch and ` + `preserve each file's original end-of-file newline state.` ); },});
customPolicies.add({ name: "final-restricted-replacements", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.finalRestrictedReplacement || !s.finalReplacementWrite) return allow(); if (!shouldNudge(s, "final-restricted-replacements", 1)) return allow(); save(ctx, s); return instruct( `This task supplies a closed replacement or synonym map and protects other content. Inspect the final ` + `diff without editing it. Mechanically parse the replacement map and compare the original and final token ` + `streams: every changed token must map to a member of the same explicit family, while punctuation, ` + `whitespace, token count, protected files, and EOF-newline state remain unchanged. Do not accept a visual ` + `inspection or a clean compiler log as proof. Also identify every source-to-allowed-replacement pair; ` + `reject invented synonyms, approximate placeholders, newline-only changes, and unrelated files. Search ` + `once more for every original value, then run the task's end-to-end check after the final edit. If the ` + `diff and check already pass, stop immediately and do not rewrite anything.` ); },});12345678910111213141516171819202122232425262728293031323334353637// Frozen LaTeX log policy from the focused fired-policy pass.
import { customPolicies, allow, instruct } from "failproofai";import { load, save, commandOf, promptOf, shouldNudge } from "../_lib/state.mjs";
const CONTRACT = /\bno\s+["'`]?overfull\s+(?:\\hbox|hbox)\b/i;const BUILD = /\b(?:pdflatex|xelatex|lualatex|latexmk)\b/i;
customPolicies.add({ name: "final-latex-log-track", match: { events: ["UserPromptSubmit", "PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const prompt = promptOf(ctx); if (prompt && CONTRACT.test(prompt)) s.finalLatexContract = true; const cmd = commandOf(ctx); if (cmd && BUILD.test(cmd)) s.finalLatexBuild = true; save(ctx, s); return allow(); },});
customPolicies.add({ name: "final-latex-log-validation", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.finalLatexContract || !s.finalLatexBuild || !shouldNudge(s, "final-latex-log", 1)) return allow(); save(ctx, s); return instruct( `Inspect the log produced by the final LaTeX compile and search for the literal text ` + `'Overfull \\hbox' with exactly one backslash. Do not infer cleanliness from exit status. ` + `If it is present, make only a replacement explicitly authorized by the task, then rerun both ` + `the compile and literal log check. If it is absent and the allowed-replacement diff is valid, stop.` ); },});123456789101112131415161718192021222324252627282930313233343536// Narrow successor to the generic quantifier policy. It targets tasks that// explicitly require every valid/winning answer as separate output records.
import { customPolicies, allow, instruct } from "failproofai";import { load, save, promptOf, shouldNudge } from "../_lib/state.mjs";
const MULTIPLE = /\b(?:multiple|more than one|all|every)\b[^.\n]{0,100}\b(?:winning|valid|correct|acceptable)\b[^.\n]{0,80}\b(?:moves?|answers?|solutions?|results?)\b/i;const OUTPUT_EACH = /\b(?:one per line|each on (?:a|its own) line|print them all|write them all|output them all)\b/i;
customPolicies.add({ name: "final-multi-answer-track", match: { events: ["UserPromptSubmit"] }, fn: async (ctx) => { const s = load(ctx); const prompt = promptOf(ctx); if (prompt && MULTIPLE.test(prompt) && OUTPUT_EACH.test(prompt)) s.finalMultiAnswer = true; save(ctx, s); return allow(); },});
customPolicies.add({ name: "final-multi-answer-enumeration", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.finalMultiAnswer || !shouldNudge(s, "final-multi-answer", 1)) return allow(); save(ctx, s); return instruct( `The output contract requires every valid answer, not one witness. Enumerate the complete candidate ` + `set, test each candidate against the task's winning or validity condition, remove duplicates, and emit ` + `all surviving answers in the exact requested one-record-per-line format. Before stopping, verify that ` + `no additional candidate satisfies the same condition.` ); },});123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657// Luna v4: prevent destruction of damaged-state evidence before inspection.//// This preserves the narrow, high-consequence half of v3's evidence policy.// The broad prompt-time enumeration instruction is intentionally removed: it// fired on both chess regressions despite not identifying their real failure.
import { customPolicies, allow, deny } from "failproofai";import { load, save, commandOf, promptOf } from "../_lib/state.mjs";
const RECOVERY_TASK = /\b(?:corrupt\w*|damaged|encrypted|recover\w*|repair\w*|forensic\w*|salvage|truncated|deleted|lost)\b/i;const BACKUP = /\b(?:cp|rsync|tar|dd|cpio|zip)\b/;const DATABASE_TASK = /\b(?:database|sqlite|wal)\b/i;// A database backup is complete only if the command preserves the surrounding// directory or explicitly includes sidecars. Copying just `main.db` is not// enough: opening it can replay and delete the only useful `main.db-wal`.const DATABASE_BACKUP = /(?:\b(?:cp|rsync)\b[^\n]*(?:\/app(?:\/\.?)?\s|\.db(?:\*|\{[^}]*-wal)|\.db-wal)|\b(?:tar|zip|cpio)\b[^\n]*\/app\b)/i;const MUTATING_OPEN = /(?:\bsqlite3\s+\S+\.(?:db|sqlite3?)|\b(?:python3?|pypy3?)\b[\s\S]{0,1000}?(?:import\s+sqlite3|sqlite3\.connect)|\bmysql\b|\bpsql\b|\bmongo\b|\bredis-cli\b|\bunzip\s+-o|\bmount\b|\bfsck\b|\bgit\s+(?:checkout|reset|clean|gc)|\btruncate\b)/i;
customPolicies.add({ name: "luna4-preserve-track", match: { events: ["UserPromptSubmit", "PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const prompt = promptOf(ctx); if (prompt && RECOVERY_TASK.test(prompt)) { s.l4RecoveryTask = true; if (DATABASE_TASK.test(prompt)) s.l4DatabaseRecovery = true; } const cmd = commandOf(ctx); if (cmd && BACKUP.test(cmd)) { if (!s.l4DatabaseRecovery || DATABASE_BACKUP.test(cmd)) s.l4BackupMade = true; } save(ctx, s); return allow(); },});
customPolicies.add({ name: "luna4-preserve-before-open", match: { events: ["PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const cmd = commandOf(ctx); if (!cmd || !s.l4RecoveryTask || s.l4BackupMade || !MUTATING_OPEN.test(cmd)) return allow(); // Keep blocking until a sufficient backup exists. Repeating this deny is // intentional: one warning followed by an incomplete single-file copy // must not silently unlock the destructive operation. return deny( `This recovery task has not preserved the original evidence yet, and this command can mutate it ` + `while opening or repairing it. Make a byte-preserving copy of the artifact and its sidecars ` + `first, perform recovery work on the copy, and use a read-only reader or hex dump on the original.` ); },});1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586// Luna v4: durable service lifecycle, with both prompt and command evidence.//// v3's Stop hook fired on 82/178 trials because any Python or Node script was// treated as a service launcher. This version requires an explicit persistent// service contract in the prompt AND a recognizable server/VM launch command.
import { customPolicies, allow, deny, instruct } from "failproofai";import { load, save, commandOf, promptOf, shouldNudge } from "../_lib/state.mjs";
const PERSISTENT_SERVICE = /\b(?:web\s*server|server|service|daemon|listener|endpoint|ssh|telnet|socket|virtual machine|vm)\b[^.\n]{0,180}\b(?:run|running|listen|listening|reachable|available|accessible|connect|background|port|should be able)\b|\b(?:leave|keep|remain|stay)\b[^.\n]{0,80}\b(?:running|listening|reachable|available)\b|\bshould be able to (?:run\s+)?["'`]*(?:ssh|curl|telnet|connect)\b/i;
// Do not classify arbitrary `python foo.py` or `node foo.js` executions as// services. The command must name a conventional server/VM launcher or contain// an explicit listen/serve flag.const SERVICE_LAUNCH = /\b(?:qemu-system-[\w-]+|uvicorn|gunicorn|flask\s+run|python(?:3)?\s+-m\s+http\.server|nginx|redis-server|grpc[_-]?(?:server|serve)|npm\s+(?:run\s+)?start)\b|\b(?:python(?:3)?|node)\b[^;&|\n]{0,160}\S*(?:server|serve|service|daemon|listen)[\w.-]*\.(?:py|js)\b|--(?:host|port|listen)\b/i;
const DETACHED = /\bsetsid\b|\bsystemd-run\b|\bscreen\s+-d|\btmux\s+new-session\s+-d/;const PROBE = /\b(?:curl|wget|grpcurl|ssh|sshpass)\b|\bnc\s+-z|\bss\s+-l|\blsof\s+-i|socket\.create_connection|channel_ready_future|requests\.(?:get|post|put|delete)/i;const DEPLOYMENT_TASK = /\b(?:bare\s+git|git\s+repository|git\s+server)\b[\s\S]{0,500}(?:\b(?:web\s*server|post-receive)\b|\bport\s+8080\b|curl\s+https?:\/\/)/i;const DEPLOYMENT_PROBE = /\bgit\s+push\b|\bcurl\b[^\n]{0,200}\bhello\.html\b/i;const DESTROY_DEPLOYMENT = /\b(?:git\s+--git-dir=\S+\s+)?update-ref\s+-d\b|\brm\s+(?:-[A-Za-z]+\s+)*[^\n;&|]*(?:hello\.html|\/var\/www\/|\/git\/server)|\bgit\s+(?:reset\s+--hard|clean\b)/i;
customPolicies.add({ name: "luna4-service-track", match: { events: ["UserPromptSubmit", "PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const prompt = promptOf(ctx); if (prompt && PERSISTENT_SERVICE.test(prompt)) s.l4PersistentService = true; if (prompt && DEPLOYMENT_TASK.test(prompt)) s.l4DeploymentTask = true;
const cmd = commandOf(ctx); if (cmd) { s.l4Seq = (s.l4Seq || 0) + 1; if (s.l4PersistentService && SERVICE_LAUNCH.test(cmd)) { s.l4Launch = s.l4Seq; if (DETACHED.test(cmd)) s.l4Detached = s.l4Seq; } if (s.l4Launch && PROBE.test(cmd) && s.l4Seq > s.l4Launch) { s.l4ProbeAfter = s.l4Seq; } if (s.l4DeploymentTask && DEPLOYMENT_PROBE.test(cmd)) s.l4DeploymentProbe = s.l4Seq; } save(ctx, s); return allow(); },});
customPolicies.add({ name: "luna4-preserve-verified-deployment", match: { events: ["PreToolUse"] }, fn: async (ctx) => { const s = load(ctx); const cmd = commandOf(ctx); if (!s.l4DeploymentTask || !s.l4DeploymentProbe || !cmd || !DESTROY_DEPLOYMENT.test(cmd)) return allow(); return deny( `Blocked cleanup of the deployment state after an evaluator-facing push or HTTP probe. Leave the tested ` + `branch, commit, deployed file, document root, and running server intact; the verifier consumes that final ` + `state. Narrow the command only if its target is unambiguously unrelated temporary data.` ); },});
customPolicies.add({ name: "luna4-service-persistence", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.l4PersistentService || !s.l4Launch) return allow(); if (s.l4Detached && s.l4ProbeAfter) return allow(); if (!shouldNudge(s, "luna4-service", 1)) return allow(); save(ctx, s); return instruct( `The task explicitly requires a persistent service or VM, and you launched one. ` + `Before finishing, make the evaluator-facing process survive this shell: launch it in a new ` + `session with all standard streams redirected, then issue a separate later command that probes ` + `the required port or endpoint. A live PID or a probe chained into the launch command is not ` + `enough. If the detached process already passes that later probe, stop without changing it.` ); },});1234567891011121314151617181920212223242526272829303132333435363738394041// Narrow successor to the broad requirement ledger. It preserves the exact// field-reconciliation intervention that recovered the token-counting target.
import { customPolicies, allow, instruct } from "failproofai";import { load, save, promptOf, shouldNudge } from "../_lib/state.mjs";
const DATASET = /\b(?:dataset|corpus)\b/i;const TOKEN_COUNT = /\b(?:how many|count|number of|total)\b[^.\n]{0,100}\btokens?\b|\btokens?\b[^.\n]{0,100}\b(?:count|total|number)\b/i;const SELECTION = /\b(?:domain|category|split|label|subset)\b/i;const TOKENIZER = /\btokeni[sz]er\b/i;
customPolicies.add({ name: "final-token-accounting-track", match: { events: ["UserPromptSubmit"] }, fn: async (ctx) => { const s = load(ctx); const prompt = promptOf(ctx); if (prompt && DATASET.test(prompt) && TOKEN_COUNT.test(prompt) && SELECTION.test(prompt) && TOKENIZER.test(prompt)) { s.finalTokenAccounting = true; } save(ctx, s); return allow(); },});
customPolicies.add({ name: "final-token-accounting", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!s.finalTokenAccounting || !shouldNudge(s, "final-token-accounting", 1)) return allow(); save(ctx, s); return instruct( `Before reporting this dataset token count, write a compact reconciliation table. Inspect the source's ` + `actual distinct domain/category/split values. Use the exact requested value if present; otherwise use ` + `only a mapping explicitly documented by the dataset and verify the selection is non-empty. Apply the ` + `named tokenizer. List every text field that contributes to the requested entity, compute each field's ` + `subtotal, and reconcile their sum to the final integer. Do not report one field as the total.` ); },});1234567891011121314151617import { customPolicies, allow, instruct } from "failproofai";import { load, save, shouldNudge } from "../_lib/state.mjs";
customPolicies.add({ name: "terra-control-always-verify", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!shouldNudge(s, "terra-control-always-verify", 1)) return allow(); save(ctx, s); return instruct( `Before finishing, inspect the evaluator-facing final artifact and run the most direct available ` + `end-to-end check. Confirm that the final filesystem and process state match the request, address any ` + `observed discrepancy, and stop without unrelated changes when the check passes.` ); },});12345678910111213141516171819import { customPolicies, allow, instruct } from "failproofai";import { load, save, shouldNudge } from "../_lib/state.mjs";
customPolicies.add({ name: "terra-control-token-matched-reconsideration", match: { events: ["Stop"] }, fn: async (ctx) => { const s = load(ctx); if (!shouldNudge(s, "terra-control-reconsider", 1)) return allow(); save(ctx, s); return instruct( `Take one additional review pass before submitting. Re-read the request, inspect the work you produced, ` + `and reconsider whether the result is complete and correct. Use the remaining effort to check assumptions, ` + `look for omissions or inconsistencies, and repair any issue you can substantiate. Prefer direct evidence ` + `from the environment over confidence or a summary of prior steps. Re-run an appropriate check after any ` + `change. Preserve correct work, avoid speculative rewrites, and finish once the reviewed result is coherent.` ); },});12345678910111213141516171819202122232425262728293031323334353637383940// Triggered attention control for the frozen Terra portfolio. Eligibility and// event timing mirror the real policies, but all mechanism-specific advice is// replaced by generic review text. The two real denial hooks are intentionally// represented as instructions: retaining their denial would retain the tested// mechanism, while repeated generic denial could deadlock a trial.import { customPolicies, allow, instruct } from "failproofai";import { load, save, commandOf, promptOf, shouldNudge, noteCommand, WRITE as GENERIC_WRITE } from "../_lib/state.mjs";
const PERSISTENT_SERVICE = /\b(?:web\s*server|server|service|daemon|listener|endpoint|ssh|telnet|socket|virtual machine|vm)\b[^.\n]{0,180}\b(?:run|running|listen|listening|reachable|available|accessible|connect|background|port|should be able)\b|\b(?:leave|keep|remain|stay)\b[^.\n]{0,80}\b(?:running|listening|reachable|available)\b|\bshould be able to (?:run\s+)?["'`]*(?:ssh|curl|telnet|connect)\b/i;const SERVICE_LAUNCH = /\b(?:qemu-system-[\w-]+|uvicorn|gunicorn|flask\s+run|python(?:3)?\s+-m\s+http\.server|nginx|redis-server|grpc[_-]?(?:server|serve)|npm\s+(?:run\s+)?start)\b|\b(?:python(?:3)?|node)\b[^;&|\n]{0,160}\S*(?:server|serve|service|daemon|listen)[\w.-]*\.(?:py|js)\b|--(?:host|port|listen)\b/i;const PROBE = /\b(?:curl|wget|grpcurl|ssh|sshpass)\b|\bnc\s+-z|\bss\s+-l|\blsof\s+-i|socket\.create_connection|channel_ready_future|requests\.(?:get|post|put|delete)/i;const DEPLOYMENT_TASK = /\b(?:bare\s+git|git\s+repository|git\s+server)\b[\s\S]{0,500}(?:\b(?:web\s*server|post-receive)\b|\bport\s+8080\b|curl\s+https?:\/\/)/i;const DEPLOYMENT_PROBE = /\bgit\s+push\b|\bcurl\b[^\n]{0,200}\bhello\.html\b/i;const DESTROY_DEPLOYMENT = /\b(?:git\s+--git-dir=\S+\s+)?update-ref\s+-d\b|\brm\s+(?:-[A-Za-z]+\s+)*[^\n;&|]*(?:hello\.html|\/var\/www\/|\/git\/server)|\bgit\s+(?:reset\s+--hard|clean\b)/i;const RECOVERY_TASK = /\b(?:corrupt\w*|damaged|encrypted|recover\w*|repair\w*|forensic\w*|salvage|truncated|deleted|lost)\b/i;const BACKUP = /\b(?:cp|rsync|tar|dd|cpio|zip)\b/;const DATABASE_TASK = /\b(?:database|sqlite|wal)\b/i;const DATABASE_BACKUP = /(?:\b(?:cp|rsync)\b[^\n]*(?:\/app(?:\/\.?)?\s|\.db(?:\*|\{[^}]*-wal)|\.db-wal)|\b(?:tar|zip|cpio)\b[^\n]*\/app\b)/i;const MUTATING_OPEN = /(?:\bsqlite3\s+\S+\.(?:db|sqlite3?)|\b(?:python3?|pypy3?)\b[\s\S]{0,1000}?(?:import\s+sqlite3|sqlite3\.connect)|\bmysql\b|\bpsql\b|\bmongo\b|\bredis-cli\b|\bunzip\s+-o|\bmount\b|\bfsck\b|\bgit\s+(?:checkout|reset|clean|gc)|\btruncate\b)/i;const REPLACEMENT = /\b(?:replace\b[^.\n]{0,100}\bwith\b|specified synonyms?|allowed synonyms?|placeholder values?|only edits? you may make)\b/i;const PROTECTED = /\b(?:do not (?:modify|change|edit|touch)|leave [^.\n]{0,80} (?:unchanged|intact)|only (?:modify|change|edit)|only edits? you may make)\b/i;const EXACT_PLACEHOLDERS = /\bplaceholder values?\b[^.\n]{0,160}\b(?:consistent|exact|same|as follows)\b/i;const SECRET = /\b(?:api keys?|access keys?|secret keys?|github tokens?|huggingface tokens?|credentials?)\b/i;const WRITE = /\b(?:perl\s+-p?i|sed\s+-i|python(?:3)?\b[^\n]{0,180}(?:write_text|write_bytes|open\([^\n]{0,80}['"]w))\b/i;const PATCH_WRITE = /apply_patch|\*\*\*\s+(?:Add|Update|Delete)\s+File:/;const LATEX = /\bno\s+["'`]?overfull\s+(?:\\hbox|hbox)\b/i;const BUILD = /\b(?:pdflatex|xelatex|lualatex|latexmk)\b/i;const REIMPLEMENT = /\b(?:compiled|existing)\s+(?:an?\s+|the\s+)?(?:program|binary|executable)\b/i;const EQUIVALENCE = /\b(?:identical|equivalent|same)\s+(?:operation|output|behavio[u]?r)\b/i;const INDEPENDENT = /\b(?:independent|isolation|must not invoke|without (?:calling|running|using))\b/i;const SIZE_BAR = /(?:<|under|at most|no more than)\s*\d+\s*(?:k|kb|bytes?)\b/i;const CANDIDATE_BUILD = /\bgcc\b[^\n]{0,240}\b(?:mystery\.c|reversed)\b|\.\/reversed\b/i;const DATASET = /\b(?:dataset|corpus)\b/i, TOKEN_COUNT = /\b(?:how many|count|number of|total)\b[^.\n]{0,100}\btokens?\b|\btokens?\b[^.\n]{0,100}\b(?:count|total|number)\b/i, SELECTION = /\b(?:domain|category|split|label|subset)\b/i, TOKENIZER = /\btokeni[sz]er\b/i;const MULTIPLE = /\b(?:multiple|more than one|all|every)\b[^.\n]{0,100}\b(?:winning|valid|correct|acceptable)\b[^.\n]{0,80}\b(?:moves?|answers?|solutions?|results?)\b/i;const OUTPUT_EACH = /\b(?:one per line|each on (?:a|its own) line|print them all|write them all|output them all)\b/i;const GENERIC = `Pause and review the current work once more. Re-read the request, inspect the relevant state, and use direct evidence to decide whether any correction is needed. If you find a concrete issue, address it and recheck the result; otherwise continue without unrelated changes.`;
customPolicies.add({name:"terra-sham-track",match:{events:["UserPromptSubmit","PreToolUse"]},fn:async(ctx)=>{const s=load(ctx),p=promptOf(ctx),c=commandOf(ctx);if(p){if(PERSISTENT_SERVICE.test(p))s.shService=true;if(DEPLOYMENT_TASK.test(p))s.shDeploy=true;if(RECOVERY_TASK.test(p)){s.shRecovery=true;if(DATABASE_TASK.test(p))s.shDb=true}if(REPLACEMENT.test(p)){if(SECRET.test(p)&&EXACT_PLACEHOLDERS.test(p))s.shReplace=true;else if(PROTECTED.test(p))s.shReplace=true}if(LATEX.test(p))s.shLatex=true;if(REIMPLEMENT.test(p)&&EQUIVALENCE.test(p)&&INDEPENDENT.test(p)&&SIZE_BAR.test(p))s.shBinary=true;if(DATASET.test(p)&&TOKEN_COUNT.test(p)&&SELECTION.test(p)&&TOKENIZER.test(p))s.shTokens=true;if(MULTIPLE.test(p)&&OUTPUT_EACH.test(p))s.shEnum=true}if(c){noteCommand(s,c);if(s.shService&&SERVICE_LAUNCH.test(c))s.shLaunch=true;if(s.shDeploy&&DEPLOYMENT_PROBE.test(c))s.shDeployProbe=true;if(BACKUP.test(c)&&(!s.shDb||DATABASE_BACKUP.test(c)))s.shBackup=true;if(s.shLatex&&BUILD.test(c))s.shLatexBuild=true}save(ctx,s);return allow();}});customPolicies.add({name:"terra-sham-runtime",match:{events:["PreToolUse"]},fn:async(ctx)=>{const s=load(ctx),c=commandOf(ctx),b=JSON.stringify(ctx?.toolInput||{});const hit=(s.shDeploy&&s.shDeployProbe&&DESTROY_DEPLOYMENT.test(c))||(s.shRecovery&&!s.shBackup&&MUTATING_OPEN.test(c))||(s.shReplace&&(WRITE.test(c)||GENERIC_WRITE.test(c)||PATCH_WRITE.test(b)))||(s.shBinary&&CANDIDATE_BUILD.test(c));if(!hit||!shouldNudge(s,"terra-sham-runtime",1))return allow();save(ctx,s);return instruct(GENERIC);}});customPolicies.add({name:"terra-sham-stop",match:{events:["Stop"]},fn:async(ctx)=>{const s=load(ctx);const hit=(s.shService&&s.shLaunch)||(s.shReplace&&s.lastWrite)||(s.shLatex&&s.shLatexBuild)||s.shBinary||s.shTokens||s.shEnum;if(!hit||!shouldNudge(s,"terra-sham-stop",1))return allow();save(ctx,s);return instruct(GENERIC);}});12345678910111213141516171819202122232425# Final primary analysis
All cells use the frozen 87-task population and two attempts per task.
`attempts.csv` is the trajectory-free source table from which the statisticsbelow are regenerated. The primary outcome is verifier reward, not the harnesstermination label. Three successful Sol verifier outcomes have a later`timeout` lifecycle label: `extract-moves-from-video` in both arms and`make-doom-for-mips` in the policy arm. This accounts for the differencebetween primary pass totals and `passed` termination totals.
| Cell | Pass@1 | Pass@2 | Pass² | 0/2 | 1/2 | 2/2 ||---|---:|---:|---:|---:|---:|---:|| luna_baseline | 59.8% | 69.0% | 50.6% | 27 | 16 | 44 || luna_policy | 63.2% | 72.4% | 54.0% | 24 | 16 | 47 || terra_baseline | 64.4% | 73.6% | 55.2% | 23 | 16 | 48 || terra_policy | 70.7% | 80.5% | 60.9% | 17 | 17 | 53 || sol_baseline | 75.3% | 86.2% | 64.4% | 12 | 19 | 56 || sol_policy | 80.5% | 87.4% | 73.6% | 11 | 12 | 64 |
| Model | Δ pass@1 | 95% task bootstrap CI | Paired permutation p | Improved | Regressed | Unchanged ||---|---:|---:|---:|---:|---:|---:|| Luna | +3.4% | [-3.4%, +10.3%] | 0.4321 | 15 | 10 | 62 || Terra | +6.3% | [-1.7%, +14.4%] | 0.1703 | 21 | 11 | 55 || Sol | +5.2% | [+0.0%, +10.9%] | 0.0945 | 10 | 4 | 73 |1234model,delta_pass_at_1,ci_low,ci_high,paired_permutation_p,improved,regressed,unchanged
luna,0.034482758620689655,-0.034482758620689655,0.10344827586206896,0.43212567874321256,15,10,62
terra,0.06321839080459771,-0.017241379310344827,0.14367816091954022,0.17028829711702884,21,11,55
sol,0.05172413793103448,0.0,0.10919540229885058,0.09446905530944691,10,4,73LICENSEAdded+202
LICENSE-DATAAdded+395
MANIFEST.sha256Added+72
NOTICEAdded+16
POLICY-PROVENANCE.mdAdded+17
README.md+89-3
REPRODUCING.mdAdded+70
SCHEMAS.mdAdded+44
analysis/reproduce.pyAdded+337
analysis/verify_results.pyAdded+77
configs/arms/codex-luna-final.yamlAdded+23
configs/arms/codex-sol-all.yamlAdded+18
configs/arms/codex-terra-control-always-verify.yamlAdded+8
configs/arms/codex-terra-control-reconsider.yamlAdded+8
configs/arms/codex-terra-control-sham.yamlAdded+8
configs/arms/codex-terra-final.yamlAdded+26
configs/arms/harness/codex.baseline.jsonAdded+4
configs/arms/harness/codex.policy.jsonAdded+8
configs/base.yamlAdded+74
configs/final-analysis-run-ledger.yamlAdded+70
configs/policy_profiles.jsonAdded+45
configs/terra-controls-analysis.yamlAdded+54
policies/_lib/profile.mjsAdded+22
policies/_lib/state.mjsAdded+155
policies/codex-final-binary-equivalence/binary-equivalence.mjsAdded+64
policies/codex-final-build/build-provenance.mjsAdded+65
policies/codex-final-enumeration/multi-answer-enumeration.mjsAdded+36
policies/codex-final-latex/latex-log-validation.mjsAdded+37
policies/codex-final-replacements/exact-replacements.mjsAdded+99
policies/codex-final-token-accounting/token-accounting.mjsAdded+41
policies/codex-luna-v4/evidence/preserve-before-open.mjsAdded+57
policies/codex-luna-v4/liveness/service-persistence.mjsAdded+86
policies/codex-sol/criteria/measured-acceptance.mjsAdded+43
policies/codex-sol/liveness/service-survival.mjsAdded+56
policies/codex-sol/requirements/provenance-ledger.mjsAdded+36
policies/codex-sol/runtime/public-contract.mjsAdded+43
policies/codex-sol/scope/exact-diff.mjsAdded+35
policies/paper-appendix-terra/binary-equivalence.mjsAdded+64
policies/paper-appendix-terra/exact-replacements.mjsAdded+99
policies/paper-appendix-terra/latex-log-validation.mjsAdded+37
policies/paper-appendix-terra/multi-answer-enumeration.mjsAdded+36
policies/paper-appendix-terra/preserve-before-open.mjsAdded+57
policies/paper-appendix-terra/service-persistence.mjsAdded+86
policies/paper-appendix-terra/token-accounting.mjsAdded+41
policies/terra-control-always-verify/always-verify.mjsAdded+17
policies/terra-control-reconsider/reconsider.mjsAdded+19
policies/terra-control-sham/triggered-sham.mjsAdded+40
results/complete-suite/README.mdAdded+25
results/complete-suite/attempts.csvAdded
results/complete-suite/comparisons.csvAdded+4