Skip to content

Commit f9e71b3

Browse files
committed
Good
1 parent fafe4c9 commit f9e71b3

25 files changed

Lines changed: 1592 additions & 0 deletions

.ai-lint/CHECKLIST.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# AI Lint Checklist
2+
3+
**Required before generating or approving code.**
4+
5+
## Read Order (30s)
6+
7+
- [ ] `/ai-lint/PHILOSOPHY.md`
8+
- [ ] Language doctrine (`doctrine/languages/*`)
9+
- [ ] Framework doctrine (if applicable)
10+
- [ ] Rejects (`rejects/*`)
11+
12+
## Pre-Flight Checks
13+
14+
- [ ] **Explicit Control**: No hidden magic?
15+
- [ ] **Boundaries**: Are inputs, env, and network validated?
16+
- [ ] **Ownership**: Is lifecycle clear (state, tasks, resources)?
17+
- [ ] **Concurrency**: Is it bounded and supervised?
18+
- [ ] **Errors**: Handled with context? (No swallowing)
19+
- [ ] **Observability**: Can logs reconstruct what happened?
20+
21+
## Decision
22+
23+
- [ ] Does this code "belong" here (not just work)?
24+
- [ ] Would a maintainer accept this at 3 AM?
25+
26+
## Conflicts
27+
28+
If valid code violates doctrine:
29+
- [ ] Override explicitly.
30+
- [ ] Document: **Reason**, **Risk**, **Mitigation**.

.ai-lint/GROUNDING.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# The Problem: Syntax vs. Semantics
2+
3+
Correct code is not the same as idiomatic code.
4+
5+
LLMs reliably hit:
6+
* Syntax ✅
7+
* Functionality ✅
8+
9+
They frequently miss:
10+
* Idioms ❌
11+
* Language "feel" ❌
12+
* Architectural intent ❌
13+
14+
## The Uncanny Valley of Code
15+
16+
Consider this Python loop:
17+
18+
```python
19+
for i in range(len(arr)):
20+
something(arr[i])
21+
```
22+
23+
It runs. It passes tests. But an experienced Python developer would write:
24+
25+
```python
26+
for item in arr:
27+
something(item)
28+
```
29+
30+
The first example fights the language. The second works with it. This instinct—knowing what *rejected* options look like—is what AI lacks.
31+
32+
## The Missing Context
33+
34+
LLMs have training data, but they lack an authoritative map of what experienced practitioners reject. This knowledge lives in:
35+
* Senior engineers' heads
36+
* Code reviews
37+
* Implicit team culture
38+
39+
AI Lint makes this implicit knowledge explicit. It provides a map of "technically correct but wrong" patterns to help AI choose the best expression for a given language.

.ai-lint/INDEX.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# AI Lint — Index (Free Edition)
2+
3+
This is the doctrine layer for this repository.
4+
5+
## Quick start for agents
6+
7+
1. Read `PHILOSOPHY.md` — the governing principles
8+
2. Read `doctrine/architecture.md` — complexity management (preview)
9+
3. Read `doctrine/languages/javascript.md` — what belongs (sample)
10+
4. Read `rejects/architecture.md` — architectural anti-patterns (preview)
11+
5. Read `rejects/languages/javascript.md` — what to refuse (sample)
12+
6. Follow the override protocol if you need to break a rule
13+
14+
---
15+
16+
## File map
17+
18+
```
19+
.ai-lint/
20+
├── PHILOSOPHY.md # Core doctrine (read first)
21+
├── CHECKLIST.md # Quick pre-code scan
22+
├── INDEX.md # This file
23+
24+
├── doctrine/
25+
│ ├── architecture.md # Complexity management (6 of 10 - preview)
26+
│ ├── languages/
27+
│ │ └── javascript.md # JS doctrine (7 of 20 - sample)
28+
│ └── security.md # Security doctrine (full)
29+
30+
├── rejects/
31+
│ ├── architecture.md # Architectural anti-patterns (6 of 10 - preview)
32+
│ ├── languages/
33+
│ │ └── javascript.md # JS rejects (6 of 19 - sample)
34+
│ └── security.md # Security rejects (full)
35+
36+
├── overrides/
37+
│ └── OVERRIDE-PROTOCOL.md
38+
39+
└── wiring/
40+
├── AGENTS.md # For Cursor
41+
├── CLAUDE.md # For Claude
42+
├── COPILOT.md # For GitHub Copilot
43+
└── AI_INSTRUCTIONS.md # Generic
44+
```
45+
46+
---
47+
48+
## Authority order
49+
50+
When rules conflict, apply this precedence:
51+
52+
1. **Rejects** (strongest)
53+
2. **Architecture doctrine** (complexity, state management)
54+
3. **Framework doctrine** (not in free edition)
55+
4. **Language doctrine**
56+
5. **Core philosophy**
57+
6. **Generic best practices** (weakest)
58+
59+
---
60+
61+
## Want full coverage?
62+
63+
This free edition includes JavaScript and architecture previews.
64+
65+
Full packs include:
66+
- **App Pack**: JS (26+19), Node.js (20+18), Python, Java, Django, Spring, full architecture doctrine
67+
- **Systems Pack**: Go, Rust, C, C++, Assembly
68+
69+
[ai-lint.dosaygo.com](https://ai-lint.dosaygo.com)

.ai-lint/LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
AI Lint Free License
2+
Version 1.0
3+
4+
Copyright (c) 2026 AI Lint
5+
6+
Permission is hereby granted to any individual or organization to:
7+
- View, read, and use this material for personal or internal team use
8+
- Fork or copy the repository for evaluation and non-commercial use
9+
- Share unmodified links to the original repository
10+
11+
The following are explicitly prohibited without prior written permission:
12+
- Commercial use, sale, or licensing of this material or any derivative
13+
- Republishing this material as part of another product, service, or framework
14+
- Creating derivative doctrine, rule sets, or training material intended for sale
15+
- Using this material to train machine learning or AI models
16+
- Bundling this material into paid tools, platforms, or subscriptions
17+
18+
This license does not grant any trademark rights.
19+
20+
THE MATERIAL IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.
21+

.ai-lint/PHILOSOPHY.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Core Philosophy — AI Lint Doctrine
2+
3+
**Complexity must be earned.**
4+
5+
AI Lint exists to enforce the difference between code that "runs" and code that "belongs."
6+
7+
---
8+
9+
## 1. We do not hide complexity; we surface it.
10+
If complexity cannot be removed, it must be made visible in the code’s shape, naming, and control flow.
11+
12+
## 2. No magic.
13+
Avoid designs where behavior depends on invisible conventions, implicit runtime wiring, or “it just happens.”
14+
15+
## 3. Prefer clarity over cleverness.
16+
Optimize for the next reader at 3am, not the author at 3pm.
17+
18+
## 4. Make causality debuggable.
19+
You should be able to answer: “what happened, in what order, and why” using logs, traces, and a debugger.
20+
21+
## 5. Make risk explicit.
22+
When violating a rule, document the tradeoff and the hazard you’re accepting.
23+
24+
---
25+
26+
## The Override Protocol
27+
AI Lint is a doctrine, not a straitjacket. You may break any rule if:
28+
1. You acknowledge the rule you are breaking.
29+
2. You document *why* the deviation is necessary for this specific context.
30+
3. You mitigate the specific risk the rule was designed to prevent.

.ai-lint/README.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# AI Lint — Free Edition
2+
3+
**Teach your AI agents the difference between code that "works" and code that "belongs."**
4+
5+
AI Lint is doctrine for AI coding agents. It externalizes senior engineering judgment—so agents build code that fits the language, the framework, and your codebase.
6+
7+
AI models are great at syntax but terrible at taste. They invent unnecessary abstractions, hide complexity, and create technical debt that looks "correct" but rots quickly.
8+
9+
AI Lint fixes this by injecting explicit architectural constraints into the agent's context.
10+
11+
The goal of AI Lint is to dramatically improve codebase quality, while reducing task time-to-completion for agentic coding. It accomplishes this by reducing the cycle of generating, reviewing, rejecting, and prompting again. AI Lint constrains the search space so agents are more likely to get it right the first time.
12+
13+
---
14+
15+
## What's in the free edition
16+
17+
| Component | Description |
18+
|-----------|-------------|
19+
| **Philosophy** | Core doctrine: clarity over cleverness, visible complexity, debuggable causality |
20+
| **Security baseline** | Agentic security doctrine (16 principles) |
21+
| **JavaScript doctrine** | 7 principles (sample from 20) |
22+
| **JavaScript rejects** | 6 rejected patterns (sample from 19) |
23+
| **Wiring prompts** | Ready-to-paste instructions for Cursor, Claude, Copilot |
24+
| **Override protocol** | How to consciously break rules |
25+
26+
This is enough to wire an agent, see how AI Lint works, and decide if you want full coverage.
27+
28+
---
29+
30+
## Quick start
31+
32+
```bash
33+
# 1. Clone or download this repo
34+
git clone https://github.com/yourorg/ai-lint.git
35+
36+
# 2. Copy into your project
37+
mkdir .ai-lint
38+
cp -r ai-lint/* .ai-lint/
39+
40+
# 3. Wire your agent (example: Cursor)
41+
cp .ai-lint/wiring/AGENTS.md .cursor/AGENTS.md
42+
```
43+
44+
That's it. Your agent now consults AI Lint before writing JavaScript.
45+
46+
---
47+
48+
## Verify it works
49+
50+
Ask your agent:
51+
52+
> "Write a JavaScript module that uses a global variable to track user sessions"
53+
54+
A properly wired agent should:
55+
1. Flag that this violates **JS-R1** (implicit global state)
56+
2. Explain why: it hides causality and breaks test reset
57+
3. Offer an alternative, or ask if you want to override
58+
59+
---
60+
61+
## What's NOT in the free edition
62+
63+
The free edition covers JavaScript. Paid packs cover:
64+
65+
**App Pack** ($49):
66+
- Full JavaScript: 20 principles + 19 rejects (vs 7/6 in free)
67+
- Node.js doctrine + 18 rejects
68+
- Python doctrine + 18 rejects
69+
- Java doctrine + 20 rejects
70+
- Django framework doctrine + 10 rejects
71+
- Spring framework doctrine + 10 rejects
72+
73+
**Systems Pack** ($49):
74+
- Go doctrine + 20 rejects
75+
- Rust doctrine + 18 rejects
76+
- C doctrine + 18 rejects
77+
- C++ doctrine + 18 rejects
78+
- Assembly doctrine + 15 rejects
79+
80+
**Bundle** ($79): Both packs + all future packs
81+
82+
[Get the full packs](https://ailint.dev)
83+
84+
---
85+
86+
## License
87+
88+
The free edition is source-available for evaluation and internal use.
89+
90+
You may:
91+
- Use it to evaluate AI Lint
92+
- Apply it to personal/internal projects
93+
- Modify it for your own use
94+
95+
You may NOT:
96+
- Redistribute or resell
97+
- Use to train AI/ML models
98+
- Use in commercial consulting/education offerings
99+
100+
For commercial use with full language coverage, purchase a pack.
101+
102+
---
103+
104+
## Why AI Lint exists
105+
106+
AI models produce code that compiles. Then you review it and feel the familiar dread: it's not wrong enough to reject quickly—just wrong enough to quietly poison the codebase.
107+
108+
The problem isn't syntax. It's judgment.
109+
110+
AI Lint makes that judgment explicit. It tells your agent what patterns belong, what should be rejected, and when to ask a human instead of guessing.
111+
112+
---
113+
114+
*"Works" isn't good enough. The goal is code that belongs.*

.ai-lint/doctrine/architecture.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Architecture Doctrine (Preview)
2+
3+
Code that works is not enough. Code must be **ownable**—understandable by one person in one sitting.
4+
5+
## 1. State Count Limit
6+
**Reject**: More than 15-20 mutable state variables in a single file/module.
7+
**Why**: Each variable is a dimension. 20 variables = 2²⁰ possible states. Undebuggable.
8+
**Do**: If you need more, you have multiple modules pretending to be one. Split by concern.
9+
10+
## 2. One Problem, One Solution
11+
**Reject**: Multiple approaches to the same problem coexisting (e.g., three "unblock" systems).
12+
**Why**: Each approach has edge cases. Multiple approaches multiply edge cases.
13+
**Do**: Pick one. Delete the others. If the new one fails, fix it—don't add a third.
14+
15+
## 3. Core Path Clarity
16+
**Reject**: Business logic buried under defensive armor.
17+
**Why**: The 80% case becomes invisible. New developers see only edge cases.
18+
**Do**: Core path should be readable top-to-bottom in <100 lines. Edge handling is modules with on/off switches.
19+
20+
## 4. File Size Discipline
21+
**Reject**: Files over 500 lines (hard limit: 1000).
22+
**Why**: Large files are symptoms of mixed concerns. "I'll refactor later" never happens.
23+
**Do**: When a file grows, extract. Don't wait until it's 4000 lines.
24+
25+
## 5. Explicit State Ownership
26+
**Reject**: State scattered across file-level variables, closures, and object properties.
27+
**Why**: "Where is this set?" becomes unanswerable.
28+
**Do**: Single state object per concern. All mutations through it. Log on change if debugging.
29+
30+
## 6. Function Density
31+
**Reject**: Functions over 50 lines (soft limit), 100 lines (hard limit).
32+
**Why**: Long functions hide multiple responsibilities. "I need to read 100 lines to understand this."
33+
**Do**: Extract. Name the extracted function for what it does, not when it's called.
34+
35+
## 7. Monotonic Observation
36+
**Reject**: Conditioning capture/processing of external output on local input state.
37+
**Why**: You silently drop or delay real events. Bugs become non-reproducible and “fixed” by timing.
38+
**Do**: Always observe and record external output when it arrives. Gate **actions** (injections, commits) on local input state, not observation.
39+
40+
## 8. Single-Entry Primitives
41+
**Reject**: Multiple paths to commit/inject/queue/capture in the same system.
42+
**Why**: Side effects become inconsistent and race-prone.
43+
**Do**: Define a single-entry primitive for each side-effect class (commit, inject, queue, capture) and route all call sites through it.
44+
45+
## 9. Scene Purity
46+
**Reject**: Scenes/state machines performing side effects directly.
47+
**Why**: Logic becomes untestable and action ordering becomes implicit.
48+
**Do**: Scenes emit explicit actions; a runtime applies those actions via primitives.
49+
50+
## 10. Dequeue-Time Validation
51+
**Reject**: Queue predicates evaluated only at enqueue time.
52+
**Why**: Time-sensitive actions become stale; prompts/reminders fire after they should be invalid.
53+
**Do**: Re-evaluate predicates at dequeue time (fat edge).
54+
55+
## 11. Interrupts as First-Class Actions
56+
**Reject**: Interrupt behavior implemented out-of-band or bypassing the queue/commit primitives.
57+
**Why**: Creates invisible control flow and inconsistent handling across features.
58+
**Do**: Represent interrupts as actions that flow through the same primitives with explicit flags.
59+
60+
---
61+
62+
*This is a preview. The full Architecture Doctrine includes additional rules on dependency direction, timer accounting, synchronous initialization, feature flags, and complexity metrics tables.*
63+
64+
*Get the complete doctrine at https://ai-lint.dosaygo.com*

0 commit comments

Comments
 (0)