finitemonkey 0.0.0-stage → 0.1.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ Finite Monkey
2
+ Copyright 2026 Gabriel Vieira
3
+
4
+ This product includes software developed by Gabriel Vieira (https://github.com/gabrielvieiraf/finitemonkey).
package/README.es.md ADDED
@@ -0,0 +1,105 @@
1
+ # Finite Monkey
2
+
3
+ <p align="center">
4
+ <img src="assets/finitemonkey.gif" width="720" alt="Animación: un mono con sudadera aporrea el teclado de una portátil mientras una terminal ejecuta finitemonkey gate. Las verificaciones que fallan se vuelven verdes y quedan fijadas una a una hasta que aparece actually done, y el mono celebra con un plátano.">
5
+ </p>
6
+
7
+ **No hacen falta infinitos monos. Basta con uno: tú.**
8
+
9
+ [English](README.md) | [Português (Brasil)](README.pt-BR.md) | Español
10
+
11
+ > **Estado: prelanzamiento.** Nada de esto funciona todavía. El nombre `finitemonkey` en npm está reservado y el código se construye en público. Todo lo que sigue describe lo que Finite Monkey está planeado para hacer, no lo que hace hoy.
12
+
13
+ ## La idea
14
+
15
+ Ya conoces la rutina. Aporreas el teclado, pegas algo sacado de quién sabe dónde, compila, a producción. Después resulta que no hay pruebas, que un `.env` se coló en el diff y que "listo" era "casi listo". No es un defecto de carácter. Es el ritmo del trabajo, con o sin un agente de código tecleando por ti.
16
+
17
+ Finite Monkey está diseñado para ser la compuerta entre ese mono y `main`. Teclea como quieras. Cada verificación que pasa queda fijada, el resto sigue fallando a la vista, y nada se da por listo hasta que cada verificación tenga prueba. Un mono, tiempo finito, trabajo que de verdad sale.
18
+
19
+ ### Por qué funciona
20
+
21
+ El teorema del mono infinito dice que suficientes monos, tecleando durante suficiente tiempo, terminan escribiendo Hamlet. En *El relojero ciego* (1986), Richard Dawkins mostró un atajo con su "programa de la comadreja": conserva cada letra que ya es correcta, vuelve a sortear solo el resto, y `METHINKS IT IS LIKE A WEASEL` aparece en decenas de generaciones en lugar de una eternidad. La selección acumulativa conserva lo que pasó. Finite Monkey aplica el mismo truco a tu trabajo y al de tu agente: lo verificado sigue verificado, y solo lo que todavía falla vuelve a intentarse.
22
+
23
+ ## El problema
24
+
25
+ Los agentes de código ya son lo bastante capaces para construir sistemas grandes en horas. Lo que falla es el entorno:
26
+
27
+ - El agente dice "listo" y no está listo.
28
+ - Las pruebas pasan porque se debilitaron o se saltaron.
29
+ - Las reglas escritas en `CLAUDE.md` o `AGENTS.md` se olvidan, sobre todo después de la compactación del contexto, porque la prosa es contexto, no imposición.
30
+ - Se pierde trabajo con un `git reset --hard`, un push forzado o un worktree borrado.
31
+ - Un secreto termina en un commit, un log o un pull request.
32
+
33
+ Son fallas de verificación y de control, no de inteligencia. Más Markdown, más fases y más personas no las resuelven. El mecanismo sí.
34
+
35
+ ## Lo que va a hacer (planeado)
36
+
37
+ ### Tú tecleas; la compuerta lleva la cuenta
38
+
39
+ Finite Monkey está diseñado para que **no haya ningún comando que recordar**. Ejecutas `npx finitemonkey init` una vez. Después actúa por su cuenta, según el contexto, dentro de Claude Code:
40
+
41
+ - **Hooks** hacen la imposición: `SessionStart` restaura el estado de la tarea, `UserPromptSubmit` detecta lo que pediste, `PreToolUse` bloquea acciones peligrosas antes de que ocurran, `Stop` se niega a cerrar la sesión mientras la definición de listo falle, y `SubagentStop` revisa lo que reportan los subagentes.
42
+ - **Skills** que Claude invoca automáticamente, según su descripción, cuando la situación lo pide.
43
+ - **Slash commands** existen solo como atajos opcionales. Ningún flujo depende de ellos.
44
+
45
+ ### Una definición de listo verificada por máquina
46
+
47
+ Cada tarea recibe un contrato de lo que significa "listo": comandos que deben tener éxito, pruebas que deben existir y pasar, un diff que se mantiene dentro del alcance, y más. El hook `Stop` ejecuta la compuerta y bloquea el fin de la sesión con la lista de lo que aún falta. La evidencia se registra solo a partir de comandos que el propio Finite Monkey ejecutó, atada al hash del árbol de trabajo, así que "corrí las pruebas antes de la última edición" no cuenta. El informe final se genera a partir de esa evidencia, no de lo que dice el agente.
48
+
49
+ ### Los cuatro daños que previene primero
50
+
51
+ La primera etapa de la hoja de ruta cubre solo lo que es irreversible o corrompe la prueba:
52
+
53
+ 1. **Filtrar secretos.** Una regla de detección aplicada al escribir archivos, en el prompt, al hacer commit, en el historial y en CI. Un secreto encontrado es un incidente que hay que rotar, no un aviso para ignorar. Los secretos se citan por archivo y línea, nunca por su valor.
54
+ 2. **Editar producción a mano.** Se bloquean los comandos con efecto en un host de producción. Producción solo cambia por el camino de despliegue declarado.
55
+ 3. **Perder trabajo en git.** Una instantánea antes de cada operación git riesgosa, un `undo` que la restaura, nunca `--force`, worktrees sucios archivados en lugar de borrados, y una verificación de "no se perdió nada" en cada merge.
56
+ 4. **Un "listo" falso.** La compuerta de arriba, más protecciones contra pruebas eliminadas, `skip` u `only` nuevos, aserciones eliminadas y ediciones a la configuración de la propia compuerta.
57
+
58
+ ### Principios
59
+
60
+ - **Ceremonia proporcional.** Una tarea pequeña no tiene fases, solo la compuerta. Las tareas grandes reciben un plan corto y una revisión independiente.
61
+ - **Las reglas se vuelven mecanismo.** Una regla que debe cumplirse siempre se convierte en hook, permiso, git hook o paso de CI, no en un párrafo. Finite Monkey muestra, por regla, dónde sigue siendo solo texto.
62
+ - **Cada regla demuestra su valor o se va.** Un banco de pruebas compara Claude Code solo, con Finite Monkey y con Finite Monkey menos una pieza a la vez. Una regla sin efecto medido sale del núcleo.
63
+ - **Nunca romper lo que existe.** Instalación con respaldo, fusión estructural, archivo de lock, reejecución idempotente, `doctor`, `update` y un `uninstall` limpio.
64
+ - **Nada sale de tu máquina por defecto.** Sin telemetría.
65
+ - **La salida para agentes es un contrato.** Todo comando aceptará `--json` y devolverá `schemaVersion`; los campos solo se agregan.
66
+ - **Tres idiomas.** Inglés, portugués de Brasil y español.
67
+
68
+ ## Hoja de ruta
69
+
70
+ Ordenada por dependencia, no por fecha. Cada etapa termina en una compuerta de salida medida.
71
+
72
+ | Etapa | Contenido | Estado |
73
+ |---|---|---|
74
+ | 0. Fundación | Ejecutable con `init`, `doctor`, `update`, `uninstall`; contratos JSON; i18n; versiones automáticas | En construcción |
75
+ | 1. Los cuatro daños | Secretos, producción, git, "listo" falso; la compuerta en `Stop` | Planeado |
76
+ | 2. Decidir bien y no perderse | Inventario antes de cambiar, registros de decisión, controles de costo y de paridad, frentes de trabajo en paralelo, protocolo completo de merge, reglas compiladas por superficie | Planeado |
77
+ | 3. Generadores | Generadores de lint, arquitectura, CI y despliegue para proyectos nuevos y existentes | Planeado |
78
+ | 4. Demostrar valor | Banco de pruebas con ablación; se recortan las piezas sin efecto medido | Planeado |
79
+
80
+ La versión 1.0 es el conjunto de las etapas 0 a 4.
81
+
82
+ ## Instalación (planeada)
83
+
84
+ Todavía no está disponible. Cuando salga la primera versión, el camino principal será:
85
+
86
+ ```sh
87
+ npx finitemonkey@latest init
88
+ ```
89
+
90
+ Es el único comando que deberías necesitar. Los requisitos serán Node.js 20 o superior, en Linux, macOS, Windows o WSL. Se planean ejecutables independientes para quien no tenga Node. También podrás pedirle a Claude Code que lo instale por ti; el agente sigue [docs/AGENT-SETUP.md](docs/AGENT-SETUP.md).
91
+
92
+ ## Cómo salen las versiones
93
+
94
+ - La versión la deciden los mensajes de commit. El repositorio usa [Conventional Commits](https://www.conventionalcommits.org/es/), verificados por commitlint en cada commit.
95
+ - En cada push a `main`, CI ejecuta los controles y [semantic-release](https://semantic-release.gitbook.io/) calcula la versión, escribe el changelog, publica en npm y crea la release en GitHub. Nadie edita la versión a mano.
96
+ - Los paquetes se publican solo desde CI, con [procedencia de npm](https://docs.npmjs.com/generating-provenance-statements), para que puedas verificar que una versión se construyó desde este repositorio.
97
+ - Se planean dos canales: `latest` para versiones estables y `next` para prelanzamientos. El estable es el predeterminado; `next` es opcional.
98
+
99
+ ## Contribuir
100
+
101
+ Consulta [CONTRIBUTING.md](CONTRIBUTING.md) (en inglés). Los agentes y las personas que cambian este repositorio siguen [AGENTS.md](AGENTS.md). Los reportes de seguridad van por [SECURITY.md](SECURITY.md).
102
+
103
+ ## Licencia
104
+
105
+ [Apache-2.0](LICENSE), por Gabriel Vieira. La licencia no otorga derechos sobre el nombre ni el logo "Finite Monkey".
package/README.md CHANGED
@@ -1,3 +1,105 @@
1
- # Temporary Holding Version
1
+ # Finite Monkey
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <p align="center">
4
+ <img src="assets/finitemonkey.gif" width="720" alt="Animation: a monkey in a hoodie mashes the keyboard of a laptop while a terminal runs finitemonkey gate. Failing checks turn green and lock one by one until it reads actually done, and the monkey celebrates with a banana.">
5
+ </p>
6
+
7
+ **Infinite monkeys not required. One is enough: you.**
8
+
9
+ English | [Português (Brasil)](README.pt-BR.md) | [Español](README.es.md)
10
+
11
+ > **Status: pre-release.** Nothing here works yet. The npm name `finitemonkey` is reserved and the code is being built in the open. Everything below describes what Finite Monkey is planned to do, not what it does today.
12
+
13
+ ## The idea
14
+
15
+ You know the routine. You mash keys, paste something from somewhere, it compiles, ship it. Then it turns out the tests are missing, a `.env` slipped into the diff and "done" meant "done-ish". That is not a character flaw. It is the pace of the work, with or without a coding agent typing for you.
16
+
17
+ Finite Monkey is designed to be the gate between that monkey and `main`. Type however you like. Every check that passes gets locked in, the rest keeps failing out loud, and nothing is called done until every check has proof. One monkey, finite time, work that actually ships.
18
+
19
+ ### Why it works
20
+
21
+ The infinite monkey theorem says that enough monkeys typing for long enough will eventually produce Hamlet. In *The Blind Watchmaker* (1986), Richard Dawkins showed a shortcut with his "weasel program": keep every letter that is already right, re-roll only the rest, and `METHINKS IT IS LIKE A WEASEL` shows up in dozens of generations instead of an eternity. Cumulative selection keeps what passed. Finite Monkey applies the same trick to your work and to your agent's: what was verified stays verified, and only what still fails goes back for another try.
22
+
23
+ ## The problem
24
+
25
+ Coding agents are strong enough to build large systems in hours. What fails is everything around them:
26
+
27
+ - The agent says "done" and it is not done.
28
+ - Tests pass because they were weakened or skipped.
29
+ - Rules written in `CLAUDE.md` or `AGENTS.md` are forgotten, especially after context compaction, because prose is context, not enforcement.
30
+ - Work is lost to `git reset --hard`, a forced push or a deleted worktree.
31
+ - A secret ends up in a commit, a log or a pull request.
32
+
33
+ These are failures of verification and control, not of intelligence. More Markdown, more phases and more personas do not fix them. Mechanism does.
34
+
35
+ ## What it will do (planned)
36
+
37
+ ### You keep typing; the gate keeps score
38
+
39
+ Finite Monkey is designed to need **zero commands to remember**. You run `npx finitemonkey init` once. After that it acts on its own, from context, inside Claude Code:
40
+
41
+ - **Hooks** do the enforcing: `SessionStart` restores the task state, `UserPromptSubmit` notices what you asked for, `PreToolUse` blocks dangerous actions before they happen, `Stop` refuses to end the session while the definition of done fails, and `SubagentStop` checks what subagents report.
42
+ - **Skills** are invoked by Claude automatically, based on their description, when the situation calls for them.
43
+ - **Slash commands** exist only as optional shortcuts. No workflow requires them.
44
+
45
+ ### A definition of done verified by machine
46
+
47
+ Each task gets a contract of what "done" means: commands that must succeed, tests that must exist and pass, a diff that stays in scope, and more. The `Stop` hook runs the gate and blocks the end of the session with the list of what is still missing. Evidence is recorded only from commands Finite Monkey ran itself, tied to the hash of the working tree, so "I ran the tests before my last edit" does not count. The final report is generated from that evidence, not from what the agent says.
48
+
49
+ ### The four damages it prevents first
50
+
51
+ The first stage of the roadmap covers only what is irreversible or corrupts the proof:
52
+
53
+ 1. **Leaking secrets.** One detection rule applied when files are written, in prompts, at commit time, in history and in CI. A secret found is an incident to rotate, not a warning to ignore. Secrets are cited by file and line, never by value.
54
+ 2. **Editing production by hand.** Commands with effects on a production host are blocked. Production changes only through the declared deploy path.
55
+ 3. **Losing work in git.** A snapshot before every risky git operation, an `undo` that restores it, no `--force` ever, dirty worktrees archived instead of deleted, and a "nothing was lost" check on every merge.
56
+ 4. **False "done".** The gate above, plus guards against removed tests, new `skip` or `only`, removed assertions and edits to the gate's own configuration.
57
+
58
+ ### Principles
59
+
60
+ - **Proportional ceremony.** A small task has no phases, only the gate. Larger tasks get a short plan and an independent review.
61
+ - **Rules become mechanism.** A rule that must always hold becomes a hook, a permission, a git hook or a CI step, not a paragraph. Finite Monkey shows, per rule, where it is only text.
62
+ - **Every rule proves its value or goes.** A benchmark compares Claude Code alone, with Finite Monkey and with Finite Monkey minus one piece at a time. A rule with no measured effect leaves the core.
63
+ - **Never break what exists.** Install with backup, structural merge, a lock file, idempotent re-runs, `doctor`, `update` and a clean `uninstall`.
64
+ - **Nothing leaves your machine by default.** No telemetry.
65
+ - **Output for agents is a contract.** Every command will accept `--json` and return a `schemaVersion`; fields are only ever added.
66
+ - **Three languages.** English, Brazilian Portuguese and Spanish.
67
+
68
+ ## Roadmap
69
+
70
+ Ordered by dependency, not by date. Each stage ends at a measured exit gate.
71
+
72
+ | Stage | Content | Status |
73
+ |---|---|---|
74
+ | 0. Foundation | Executable with `init`, `doctor`, `update`, `uninstall`; JSON contracts; i18n; automated releases | In progress |
75
+ | 1. The four damages | Secrets, production, git, false "done"; the gate on `Stop` | Planned |
76
+ | 2. Deciding well and not getting lost | Inventory before change, decision records, cost and parity checks, parallel work fronts, full merge protocol, rules compiled per surface | Planned |
77
+ | 3. Generators | Lint, architecture, CI and deploy generators for new and existing projects | Planned |
78
+ | 4. Proving value | Benchmark with ablation; pieces without measured effect are cut | Planned |
79
+
80
+ Version 1.0 is the whole of stages 0 to 4.
81
+
82
+ ## Install (planned)
83
+
84
+ Not available yet. When the first release is out, the main path will be:
85
+
86
+ ```sh
87
+ npx finitemonkey@latest init
88
+ ```
89
+
90
+ That is the only command you are meant to need. Requirements will be Node.js 20 or later, on Linux, macOS, Windows or WSL. Standalone executables for people without Node are planned. You will also be able to ask Claude Code to install it for you; the agent follows [docs/AGENT-SETUP.md](docs/AGENT-SETUP.md).
91
+
92
+ ## How releases work
93
+
94
+ - Versions are decided by commit messages. The repository uses [Conventional Commits](https://www.conventionalcommits.org/), checked by commitlint on every commit.
95
+ - On every push to `main`, CI runs the checks and [semantic-release](https://semantic-release.gitbook.io/) computes the version, writes the changelog, publishes to npm and creates the GitHub release. Nobody edits the version by hand.
96
+ - Packages are published only from CI, with [npm provenance](https://docs.npmjs.com/generating-provenance-statements), so you can verify that a version was built from this repository.
97
+ - Two channels are planned: `latest` for stable releases and `next` for pre-releases. Stable is the default; `next` is opt-in.
98
+
99
+ ## Contributing
100
+
101
+ See [CONTRIBUTING.md](CONTRIBUTING.md). Agents and humans changing this repository must follow [AGENTS.md](AGENTS.md). Security reports go through [SECURITY.md](SECURITY.md).
102
+
103
+ ## License
104
+
105
+ [Apache-2.0](LICENSE), by Gabriel Vieira. The license does not grant rights to the "Finite Monkey" name or logo.
@@ -0,0 +1,105 @@
1
+ # Finite Monkey
2
+
3
+ <p align="center">
4
+ <img src="assets/finitemonkey.gif" width="720" alt="Animação: um macaco de moletom bate no teclado de um notebook enquanto um terminal roda finitemonkey gate. As verificações que falham ficam verdes e travam uma a uma até aparecer actually done, e o macaco comemora com uma banana.">
5
+ </p>
6
+
7
+ **Não precisa de infinitos macacos. Um basta: você.**
8
+
9
+ [English](README.md) | Português (Brasil) | [Español](README.es.md)
10
+
11
+ > **Status: pré-lançamento.** Nada aqui funciona ainda. O nome `finitemonkey` no npm está reservado e o código está sendo construído em público. Tudo abaixo descreve o que o Finite Monkey está planejado para fazer, não o que ele faz hoje.
12
+
13
+ ## A ideia
14
+
15
+ Você conhece o roteiro. Bate no teclado, cola alguma coisa de algum lugar, compilou, manda. Depois descobre que os testes não existem, que um `.env` entrou no diff e que "pronto" era "mais ou menos pronto". Não é defeito de caráter. É o ritmo do trabalho, com ou sem um agente de código digitando por você.
16
+
17
+ O Finite Monkey foi desenhado para ser o portão entre esse macaco e a `main`. Digite do jeito que quiser. Cada verificação que passa fica travada, o resto continua falhando em voz alta, e nada é chamado de pronto até cada verificação ter prova. Um macaco, tempo finito, trabalho que sai de verdade.
18
+
19
+ ### Por que funciona
20
+
21
+ O teorema do macaco infinito diz que macacos suficientes, batendo à máquina por tempo suficiente, acabam escrevendo Hamlet. Em *O Relojoeiro Cego* (1986), Richard Dawkins mostrou um atalho com o "programa da doninha": guarde cada letra que já está certa, sorteie de novo só o resto, e `METHINKS IT IS LIKE A WEASEL` aparece em dezenas de gerações em vez de uma eternidade. A seleção cumulativa guarda o que passou. O Finite Monkey usa o mesmo truque no seu trabalho e no do seu agente: o que foi verificado continua verificado, e só o que ainda falha volta para outra tentativa.
22
+
23
+ ## O problema
24
+
25
+ Agentes de código já são fortes o bastante para construir sistemas grandes em horas. O que falha é o entorno:
26
+
27
+ - O agente diz "pronto" e não está pronto.
28
+ - Os testes passam porque foram afrouxados ou pulados.
29
+ - Regras escritas no `CLAUDE.md` ou no `AGENTS.md` são esquecidas, principalmente depois da compactação do contexto, porque prosa é contexto, não imposição.
30
+ - Trabalho se perde num `git reset --hard`, num push forçado ou num worktree apagado.
31
+ - Um segredo vai parar num commit, num log ou num pull request.
32
+
33
+ São falhas de verificação e de controle, não de inteligência. Mais Markdown, mais fases e mais personas não resolvem. Mecanismo resolve.
34
+
35
+ ## O que ele vai fazer (planejado)
36
+
37
+ ### Você só digita; o portão confere
38
+
39
+ O Finite Monkey foi desenhado para **não ter nenhum comando para decorar**. Você roda `npx finitemonkey init` uma vez. Depois disso ele age sozinho, pelo contexto, dentro do Claude Code:
40
+
41
+ - **Hooks** fazem a imposição: `SessionStart` restaura o estado da tarefa, `UserPromptSubmit` percebe o que você pediu, `PreToolUse` barra ações perigosas antes que aconteçam, `Stop` se recusa a encerrar a sessão enquanto a definição de pronto falha, e `SubagentStop` confere o que os subagentes relatam.
42
+ - **Skills** são acionadas pelo Claude automaticamente, pela descrição, quando a situação pede.
43
+ - **Slash commands** existem só como atalhos opcionais. Nenhum fluxo depende deles.
44
+
45
+ ### Uma definição de pronto verificada por máquina
46
+
47
+ Cada tarefa ganha um contrato do que "pronto" significa: comandos que precisam dar certo, testes que precisam existir e passar, um diff que fica dentro do escopo, e mais. O hook `Stop` roda o portão e bloqueia o fim da sessão com a lista do que ainda falta. A evidência é registrada só a partir de comandos que o próprio Finite Monkey executou, presa ao hash da árvore de trabalho, então "rodei os testes antes da última edição" não conta. O relatório final é gerado dessa evidência, não do que o agente diz.
48
+
49
+ ### Os quatro danos que ele impede primeiro
50
+
51
+ A primeira etapa do roteiro cobre só o que é irreversível ou corrompe a prova:
52
+
53
+ 1. **Vazar segredo.** Uma regra de detecção aplicada na escrita de arquivos, no prompt, no commit, no histórico e na CI. Segredo encontrado é incidente para rotacionar, não aviso para ignorar. Segredos são citados por arquivo e linha, nunca pelo valor.
54
+ 2. **Editar produção na mão.** Comandos com efeito num host de produção são barrados. Produção só muda pelo caminho de deploy declarado.
55
+ 3. **Perder trabalho no git.** Uma fotografia antes de toda operação git de risco, um `undo` que a devolve, `--force` nunca, worktree sujo arquivado em vez de apagado, e uma verificação de "nada se perdeu" em toda mescla.
56
+ 4. **"Pronto" falso.** O portão acima, mais travas contra teste removido, `skip` ou `only` novo, asserção removida e edição da configuração do próprio portão.
57
+
58
+ ### Princípios
59
+
60
+ - **Cerimônia proporcional.** Tarefa pequena não tem fase, só o portão. Tarefa maior ganha um plano curto e uma revisão independente.
61
+ - **Regra vira mecanismo.** Regra que precisa valer sempre vira hook, permissão, git hook ou passo de CI, não um parágrafo. O Finite Monkey mostra, por regra, onde ela ainda é só texto.
62
+ - **Toda regra prova valor ou sai.** Uma bancada compara o Claude Code puro, com o Finite Monkey e com o Finite Monkey menos uma peça de cada vez. Regra sem efeito medido sai do núcleo.
63
+ - **Nunca quebrar o que existe.** Instalação com backup, mescla estrutural, arquivo de lock, reexecução idempotente, `doctor`, `update` e `uninstall` limpo.
64
+ - **Nada sai da sua máquina por padrão.** Sem telemetria.
65
+ - **Saída para agente é contrato.** Todo comando vai aceitar `--json` e devolver `schemaVersion`; campos só são acrescentados.
66
+ - **Três idiomas.** Inglês, português do Brasil e espanhol.
67
+
68
+ ## Roteiro
69
+
70
+ Ordenado por dependência, não por data. Cada etapa termina num portão de saída medido.
71
+
72
+ | Etapa | Conteúdo | Status |
73
+ |---|---|---|
74
+ | 0. Fundação | Executável com `init`, `doctor`, `update`, `uninstall`; contratos JSON; i18n; releases automáticas | Em construção |
75
+ | 1. Os quatro danos | Segredo, produção, git, "pronto" falso; o portão no `Stop` | Planejado |
76
+ | 2. Decidir bem e não se perder | Inventário antes de mudar, registro de decisão, checagens de custo e de paridade, frentes de trabalho em paralelo, protocolo completo de mescla, regras compiladas por superfície | Planejado |
77
+ | 3. Geradores | Geradores de lint, arquitetura, CI e deploy para projetos novos e existentes | Planejado |
78
+ | 4. Provar valor | Bancada com ablação; peças sem efeito medido são cortadas | Planejado |
79
+
80
+ A versão 1.0 é o conjunto das etapas 0 a 4.
81
+
82
+ ## Instalação (planejada)
83
+
84
+ Ainda não disponível. Quando a primeira versão sair, o caminho principal será:
85
+
86
+ ```sh
87
+ npx finitemonkey@latest init
88
+ ```
89
+
90
+ É o único comando que você deve precisar. Os requisitos serão Node.js 20 ou mais novo, em Linux, macOS, Windows ou WSL. Executáveis avulsos para quem não tem Node estão planejados. Você também vai poder pedir ao Claude Code que instale por você; o agente segue o [docs/AGENT-SETUP.md](docs/AGENT-SETUP.md).
91
+
92
+ ## Como saem as versões
93
+
94
+ - A versão é decidida pelas mensagens de commit. O repositório usa [Conventional Commits](https://www.conventionalcommits.org/pt-br/), conferidos pelo commitlint em todo commit.
95
+ - A cada push na `main`, a CI roda as checagens e o [semantic-release](https://semantic-release.gitbook.io/) calcula a versão, escreve o changelog, publica no npm e cria a release no GitHub. Ninguém edita a versão na mão.
96
+ - Os pacotes são publicados só pela CI, com [proveniência do npm](https://docs.npmjs.com/generating-provenance-statements), para você conferir que uma versão foi construída a partir deste repositório.
97
+ - Dois canais estão planejados: `latest` para versões estáveis e `next` para pré-lançamentos. O estável é o padrão; o `next` é opcional.
98
+
99
+ ## Contribuir
100
+
101
+ Veja o [CONTRIBUTING.md](CONTRIBUTING.md) (em inglês). Agentes e pessoas que mexem neste repositório seguem o [AGENTS.md](AGENTS.md). Relatos de segurança vão pelo [SECURITY.md](SECURITY.md).
102
+
103
+ ## Licença
104
+
105
+ [Apache-2.0](LICENSE), por Gabriel Vieira. A licença não dá direito de usar o nome nem o logo "Finite Monkey".