necronomicon 0.1.0__tar.gz

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.
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ## 0.1.0 - 2026-10-30
6
+
7
+ - Rules are commands that print `path[:line[:col[-endcol]]][:label]`, with `message`, `why`, `fix` and optional `details` and `examples`; `include:` splits them across files.
8
+ - `necro grep`, the first bundled finder: Rust regex, code-point columns, `--skip-comments`.
9
+ - Allows (`necro-allow <rule>: <reason>`).
10
+ - `full` and `terse` output, `--explain`, `--rule`; the `necro` binary packaged as a wheel.
11
+ - Wheels on PyPI for Linux (x86_64, aarch64), macOS (arm64, x86_64) and Windows (x64), and the crate on crates.io.
@@ -0,0 +1,169 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "aho-corasick"
7
+ version = "1.1.5"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"
10
+ dependencies = [
11
+ "memchr",
12
+ ]
13
+
14
+ [[package]]
15
+ name = "arraydeque"
16
+ version = "0.5.1"
17
+ source = "registry+https://github.com/rust-lang/crates.io-index"
18
+ checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236"
19
+
20
+ [[package]]
21
+ name = "bstr"
22
+ version = "1.13.1"
23
+ source = "registry+https://github.com/rust-lang/crates.io-index"
24
+ checksum = "6bb31b46c14244e20ee9984b11bf5c992b91fb6939fea616e3512c8baecdbe5f"
25
+ dependencies = [
26
+ "memchr",
27
+ "serde_core",
28
+ ]
29
+
30
+ [[package]]
31
+ name = "globset"
32
+ version = "0.4.21"
33
+ source = "registry+https://github.com/rust-lang/crates.io-index"
34
+ checksum = "f98b0d85522dc0a824cfebbc9594ff4a9b289c568bea0370319dfbdf20ccdd2d"
35
+ dependencies = [
36
+ "aho-corasick",
37
+ "bstr",
38
+ "log",
39
+ "regex-automata",
40
+ "regex-syntax",
41
+ ]
42
+
43
+ [[package]]
44
+ name = "granit-parser"
45
+ version = "2.0.0"
46
+ source = "registry+https://github.com/rust-lang/crates.io-index"
47
+ checksum = "da55feca5d1625466bae068f9fd4b87892caeae70c3fe671ddb0f50d41aebf37"
48
+ dependencies = [
49
+ "arraydeque",
50
+ "smallvec",
51
+ ]
52
+
53
+ [[package]]
54
+ name = "libc"
55
+ version = "0.2.191"
56
+ source = "registry+https://github.com/rust-lang/crates.io-index"
57
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
58
+
59
+ [[package]]
60
+ name = "log"
61
+ version = "0.4.34"
62
+ source = "registry+https://github.com/rust-lang/crates.io-index"
63
+ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
64
+
65
+ [[package]]
66
+ name = "memchr"
67
+ version = "2.8.3"
68
+ source = "registry+https://github.com/rust-lang/crates.io-index"
69
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
70
+
71
+ [[package]]
72
+ name = "necronomicon"
73
+ version = "0.1.0"
74
+ dependencies = [
75
+ "globset",
76
+ "granit-parser",
77
+ "libc",
78
+ "regex",
79
+ ]
80
+
81
+ [[package]]
82
+ name = "proc-macro2"
83
+ version = "1.0.107"
84
+ source = "registry+https://github.com/rust-lang/crates.io-index"
85
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
86
+ dependencies = [
87
+ "unicode-ident",
88
+ ]
89
+
90
+ [[package]]
91
+ name = "quote"
92
+ version = "1.0.47"
93
+ source = "registry+https://github.com/rust-lang/crates.io-index"
94
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
95
+ dependencies = [
96
+ "proc-macro2",
97
+ ]
98
+
99
+ [[package]]
100
+ name = "regex"
101
+ version = "1.13.1"
102
+ source = "registry+https://github.com/rust-lang/crates.io-index"
103
+ checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"
104
+ dependencies = [
105
+ "aho-corasick",
106
+ "memchr",
107
+ "regex-automata",
108
+ "regex-syntax",
109
+ ]
110
+
111
+ [[package]]
112
+ name = "regex-automata"
113
+ version = "0.4.18"
114
+ source = "registry+https://github.com/rust-lang/crates.io-index"
115
+ checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
116
+ dependencies = [
117
+ "aho-corasick",
118
+ "memchr",
119
+ "regex-syntax",
120
+ ]
121
+
122
+ [[package]]
123
+ name = "regex-syntax"
124
+ version = "0.8.11"
125
+ source = "registry+https://github.com/rust-lang/crates.io-index"
126
+ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
127
+
128
+ [[package]]
129
+ name = "serde_core"
130
+ version = "1.0.229"
131
+ source = "registry+https://github.com/rust-lang/crates.io-index"
132
+ checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
133
+ dependencies = [
134
+ "serde_derive",
135
+ ]
136
+
137
+ [[package]]
138
+ name = "serde_derive"
139
+ version = "1.0.229"
140
+ source = "registry+https://github.com/rust-lang/crates.io-index"
141
+ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
142
+ dependencies = [
143
+ "proc-macro2",
144
+ "quote",
145
+ "syn",
146
+ ]
147
+
148
+ [[package]]
149
+ name = "smallvec"
150
+ version = "1.16.4"
151
+ source = "registry+https://github.com/rust-lang/crates.io-index"
152
+ checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8"
153
+
154
+ [[package]]
155
+ name = "syn"
156
+ version = "3.0.9"
157
+ source = "registry+https://github.com/rust-lang/crates.io-index"
158
+ checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
159
+ dependencies = [
160
+ "proc-macro2",
161
+ "quote",
162
+ "unicode-ident",
163
+ ]
164
+
165
+ [[package]]
166
+ name = "unicode-ident"
167
+ version = "1.0.27"
168
+ source = "registry+https://github.com/rust-lang/crates.io-index"
169
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
@@ -0,0 +1,27 @@
1
+ [package]
2
+ name = "necronomicon"
3
+ version = "0.1.0"
4
+ edition = "2024"
5
+ description = "Agent mind control for your codebase: house rules that teach. Pre-commit checks tell coding agents what's wrong, why, and what to do instead."
6
+ license = "Apache-2.0"
7
+ repository = "https://github.com/WahahaYes/necronomicon"
8
+ readme = "README.md"
9
+ # The crate (and the sdist maturin builds from it) is what builds `necro`; the
10
+ # conformance suite, examples and docs stay in the repo.
11
+ include = ["/src/**/*.rs", "/Cargo.toml", "/Cargo.lock", "/pyproject.toml", "/README.md", "/LICENSE", "/CHANGELOG.md"]
12
+
13
+ [[bin]]
14
+ name = "necro"
15
+ path = "src/main.rs"
16
+
17
+ [dependencies]
18
+ # serde-saphyr's own parser: YAML events with positions for config errors.
19
+ granit-parser = { version = "=2.0.0", default-features = false, features = ["std", "error_messages"] }
20
+ globset = "0.4.16"
21
+ regex = "1.12"
22
+
23
+ [target.'cfg(unix)'.dependencies]
24
+ libc = "0.2.174"
25
+
26
+ [profile.release]
27
+ strip = true
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,118 @@
1
+ Metadata-Version: 2.4
2
+ Name: necronomicon
3
+ Version: 0.1.0
4
+ License-File: LICENSE
5
+ Summary: Agent mind control for your codebase: house rules that teach. Pre-commit checks tell coding agents what's wrong, why, and what to do instead.
6
+ License-Expression: Apache-2.0
7
+ Requires-Python: >=3.9
8
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
9
+ Project-URL: Repository, https://github.com/WahahaYes/necronomicon
10
+
11
+ # necronomicon
12
+
13
+ A simple way to organize a repo's pre-commit hooks for progressive disclosure, steering coding agents toward the repo's conventions and intended architecture. Each rule pairs a command that finds violations with what to say about them: what's wrong, why the rule exists, and what to do instead. An agent sees a rule only when its commit breaks it, at the line it broke, with the long form one `necro --explain` away.
14
+
15
+ ![You write a rule; an agent's commit breaks it; pre-commit blocks it and pushes the why; the agent pulls the rest and commits the fix](https://raw.githubusercontent.com/WahahaYes/necronomicon/main/docs/mind-control.svg)
16
+
17
+ ## Why not AGENTS.md
18
+
19
+ An instruction file is read every session, whether or not today's work touches it, and followed when the agent remembers to. A rule costs nothing until it's broken, and then it blocks the commit. Keep AGENTS.md for orientation and move its "never do X" lines into rules.
20
+
21
+ ## Agent mind control
22
+
23
+ When an agent trips a rule, necro tells it just enough, and the rest is one command away. From [examples/layers](https://github.com/WahahaYes/necronomicon/tree/main/examples/layers):
24
+
25
+ ```yaml
26
+ core-isolated:
27
+ command: necro grep '^\s*(from|import)\s+app\b' -- 'src/core/*.py'
28
+ message: core imports the app layer
29
+ why: Core runs in tests without a database; importing app/ drags one in.
30
+ fix: Take a port from core/ports.py as an argument; app/ passes the real one in.
31
+ details: … # the long form, and bad and good examples, for necro --explain
32
+ ```
33
+
34
+ <details>
35
+ <summary><b>An agent that never read the rule commits <code>from app.db import session</code> in core.</b> The commit fails, and 11 lines land in its context.</summary>
36
+
37
+ ```text
38
+ error[core-isolated]: core imports the app layer
39
+ --> src/core/pricing.py:2:1
40
+ |
41
+ 2 | from app.db import session
42
+ | ^^^^^^^^
43
+ |
44
+ = why: Core runs in tests without a database; importing app/ drags one in.
45
+ = fix: Take a port from core/ports.py as an argument; app/ passes the real one in.
46
+ = more: necro --explain core-isolated
47
+
48
+ necro: 1 error (core-isolated ×1)
49
+ ```
50
+
51
+ <details>
52
+ <summary><b>It wants the bigger picture</b>, so it runs the command it was handed and pulls 22 more.</summary>
53
+
54
+ ```text
55
+ $ necro --explain core-isolated
56
+ core-isolated: core imports the app layer
57
+
58
+ Why: Core runs in tests without a database; importing app/ drags one in.
59
+
60
+ Fix: Take a port from core/ports.py as an argument; app/ passes the real one in.
61
+
62
+ Core is the inner layer: app/ may import core, never the reverse.
63
+ Exceptions: none. Shared types move into core.
64
+
65
+ Bad:
66
+ from app.db import session
67
+
68
+ def price(order):
69
+ return session.rates(order.region) * order.total
70
+
71
+ Good:
72
+ from core.ports import Rates
73
+
74
+ def price(order, rates: Rates):
75
+ return rates.for_region(order.region) * order.total
76
+
77
+ Command: necro grep '^\s*(from|import)\s+app\b' -- 'src/core/*.py'
78
+ ```
79
+
80
+ </details>
81
+ </details>
82
+
83
+ **Re-steered,** it takes `rates: Rates` as an argument, and the commit passes.
84
+
85
+ ## What necro is, and isn't
86
+
87
+ - **An organizer, not a parser.** A rule's `command` is anything that prints one `path[:line[:col]]` per violation: `necro grep` for a pattern, a short script for more, or a tool you already run. necro owns the wording, allows and output, so rules work in any language.
88
+ - **A replacement for the lint script you'd write anyway.** Repos that work with agents tend to grow a `lint_style.py` that greps for house rules and prints one-line errors. necro keeps those rules as config and adds the why, the fix and `--explain`.
89
+ - **Exceptions with reasons.** `necro-allow <rule>: <reason>` in a comment on the line or the one above. An allow without a reason, or one that suppresses nothing, fails the run.
90
+
91
+ ## Install
92
+
93
+ From PyPI, a wheel around the `necro` binary (no Rust needed): `uv tool install necronomicon` or `pipx install necronomicon`. From crates.io: `cargo install necronomicon`.
94
+
95
+ As a pre-commit hook, which installs the wheel into pre-commit's own environment:
96
+
97
+ ```yaml
98
+ - repo: local
99
+ hooks:
100
+ - id: necro
101
+ name: necro
102
+ entry: necro
103
+ language: python
104
+ additional_dependencies: ['necronomicon>=0.1,<0.2']
105
+ pass_filenames: false
106
+ always_run: true
107
+ ```
108
+
109
+ Pin below the next 0.x: any 0.x may break the format.
110
+
111
+ ## More
112
+
113
+ - [docs/writing-rules.md](https://github.com/WahahaYes/necronomicon/blob/main/docs/writing-rules.md): writing rules and allows, and the pre-commit hook.
114
+ - [examples/](https://github.com/WahahaYes/necronomicon/tree/main/examples): small repos, each checked by CI.
115
+ - [spec/v0.md](https://github.com/WahahaYes/necronomicon/blob/main/spec/v0.md): the contract; [tests/conformance/](https://github.com/WahahaYes/necronomicon/tree/main/tests/conformance) makes it executable.
116
+
117
+ Pre-release (version 0): any 0.x may break the format. Licensed under [Apache-2.0](https://github.com/WahahaYes/necronomicon/blob/main/LICENSE).
118
+
@@ -0,0 +1,107 @@
1
+ # necronomicon
2
+
3
+ A simple way to organize a repo's pre-commit hooks for progressive disclosure, steering coding agents toward the repo's conventions and intended architecture. Each rule pairs a command that finds violations with what to say about them: what's wrong, why the rule exists, and what to do instead. An agent sees a rule only when its commit breaks it, at the line it broke, with the long form one `necro --explain` away.
4
+
5
+ ![You write a rule; an agent's commit breaks it; pre-commit blocks it and pushes the why; the agent pulls the rest and commits the fix](https://raw.githubusercontent.com/WahahaYes/necronomicon/main/docs/mind-control.svg)
6
+
7
+ ## Why not AGENTS.md
8
+
9
+ An instruction file is read every session, whether or not today's work touches it, and followed when the agent remembers to. A rule costs nothing until it's broken, and then it blocks the commit. Keep AGENTS.md for orientation and move its "never do X" lines into rules.
10
+
11
+ ## Agent mind control
12
+
13
+ When an agent trips a rule, necro tells it just enough, and the rest is one command away. From [examples/layers](https://github.com/WahahaYes/necronomicon/tree/main/examples/layers):
14
+
15
+ ```yaml
16
+ core-isolated:
17
+ command: necro grep '^\s*(from|import)\s+app\b' -- 'src/core/*.py'
18
+ message: core imports the app layer
19
+ why: Core runs in tests without a database; importing app/ drags one in.
20
+ fix: Take a port from core/ports.py as an argument; app/ passes the real one in.
21
+ details: … # the long form, and bad and good examples, for necro --explain
22
+ ```
23
+
24
+ <details>
25
+ <summary><b>An agent that never read the rule commits <code>from app.db import session</code> in core.</b> The commit fails, and 11 lines land in its context.</summary>
26
+
27
+ ```text
28
+ error[core-isolated]: core imports the app layer
29
+ --> src/core/pricing.py:2:1
30
+ |
31
+ 2 | from app.db import session
32
+ | ^^^^^^^^
33
+ |
34
+ = why: Core runs in tests without a database; importing app/ drags one in.
35
+ = fix: Take a port from core/ports.py as an argument; app/ passes the real one in.
36
+ = more: necro --explain core-isolated
37
+
38
+ necro: 1 error (core-isolated ×1)
39
+ ```
40
+
41
+ <details>
42
+ <summary><b>It wants the bigger picture</b>, so it runs the command it was handed and pulls 22 more.</summary>
43
+
44
+ ```text
45
+ $ necro --explain core-isolated
46
+ core-isolated: core imports the app layer
47
+
48
+ Why: Core runs in tests without a database; importing app/ drags one in.
49
+
50
+ Fix: Take a port from core/ports.py as an argument; app/ passes the real one in.
51
+
52
+ Core is the inner layer: app/ may import core, never the reverse.
53
+ Exceptions: none. Shared types move into core.
54
+
55
+ Bad:
56
+ from app.db import session
57
+
58
+ def price(order):
59
+ return session.rates(order.region) * order.total
60
+
61
+ Good:
62
+ from core.ports import Rates
63
+
64
+ def price(order, rates: Rates):
65
+ return rates.for_region(order.region) * order.total
66
+
67
+ Command: necro grep '^\s*(from|import)\s+app\b' -- 'src/core/*.py'
68
+ ```
69
+
70
+ </details>
71
+ </details>
72
+
73
+ **Re-steered,** it takes `rates: Rates` as an argument, and the commit passes.
74
+
75
+ ## What necro is, and isn't
76
+
77
+ - **An organizer, not a parser.** A rule's `command` is anything that prints one `path[:line[:col]]` per violation: `necro grep` for a pattern, a short script for more, or a tool you already run. necro owns the wording, allows and output, so rules work in any language.
78
+ - **A replacement for the lint script you'd write anyway.** Repos that work with agents tend to grow a `lint_style.py` that greps for house rules and prints one-line errors. necro keeps those rules as config and adds the why, the fix and `--explain`.
79
+ - **Exceptions with reasons.** `necro-allow <rule>: <reason>` in a comment on the line or the one above. An allow without a reason, or one that suppresses nothing, fails the run.
80
+
81
+ ## Install
82
+
83
+ From PyPI, a wheel around the `necro` binary (no Rust needed): `uv tool install necronomicon` or `pipx install necronomicon`. From crates.io: `cargo install necronomicon`.
84
+
85
+ As a pre-commit hook, which installs the wheel into pre-commit's own environment:
86
+
87
+ ```yaml
88
+ - repo: local
89
+ hooks:
90
+ - id: necro
91
+ name: necro
92
+ entry: necro
93
+ language: python
94
+ additional_dependencies: ['necronomicon>=0.1,<0.2']
95
+ pass_filenames: false
96
+ always_run: true
97
+ ```
98
+
99
+ Pin below the next 0.x: any 0.x may break the format.
100
+
101
+ ## More
102
+
103
+ - [docs/writing-rules.md](https://github.com/WahahaYes/necronomicon/blob/main/docs/writing-rules.md): writing rules and allows, and the pre-commit hook.
104
+ - [examples/](https://github.com/WahahaYes/necronomicon/tree/main/examples): small repos, each checked by CI.
105
+ - [spec/v0.md](https://github.com/WahahaYes/necronomicon/blob/main/spec/v0.md): the contract; [tests/conformance/](https://github.com/WahahaYes/necronomicon/tree/main/tests/conformance) makes it executable.
106
+
107
+ Pre-release (version 0): any 0.x may break the format. Licensed under [Apache-2.0](https://github.com/WahahaYes/necronomicon/blob/main/LICENSE).
@@ -0,0 +1,20 @@
1
+ # The PyPI package is only a wheel around the `necro` binary (as ruff ships), so
2
+ # pre-commit installs it without a Rust toolchain. The version comes from Cargo.toml.
3
+ [build-system]
4
+ requires = ["maturin>=1.15,<2"]
5
+ build-backend = "maturin"
6
+
7
+ [project]
8
+ name = "necronomicon"
9
+ dynamic = ["version"]
10
+ description = "Agent mind control for your codebase: house rules that teach. Pre-commit checks tell coding agents what's wrong, why, and what to do instead."
11
+ license = "Apache-2.0"
12
+ readme = "README.md"
13
+ requires-python = ">=3.9"
14
+
15
+ [project.urls]
16
+ Repository = "https://github.com/WahahaYes/necronomicon"
17
+
18
+ [tool.maturin]
19
+ bindings = "bin"
20
+ strip = true