qed-standard 0.0.0-stage → 1.0.0
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 +21 -0
- package/QED.lite.md +45 -0
- package/README.md +340 -2
- package/adapters/aider/.aider.conf.yml +30 -0
- package/adapters/aider/.aider.conventions.lite.md +16 -0
- package/adapters/aider/.aider.conventions.md +75 -0
- package/adapters/antigravity/.antigravity-plugin/plugin.json +28 -0
- package/adapters/antigravity/GEMINI.lite.md +36 -0
- package/adapters/antigravity/GEMINI.md +56 -0
- package/adapters/claude-code/.claude/commands/boost.md +19 -0
- package/adapters/claude-code/.claude/commands/qed-blast-radius.md +20 -0
- package/adapters/claude-code/.claude/commands/qed-boost.md +19 -0
- package/adapters/claude-code/.claude/commands/qed-review.md +20 -0
- package/adapters/claude-code/.claude/commands/qed-verify.md +14 -0
- package/adapters/claude-code/.claude/skills/qed-blast-radius/SKILL.md +30 -0
- package/adapters/claude-code/.claude/skills/qed-boost/SKILL.md +25 -0
- package/adapters/claude-code/.claude/skills/qed-review/SKILL.md +39 -0
- package/adapters/claude-code/.claude/skills/qed-verify/SKILL.md +38 -0
- package/adapters/claude-code/.claude-plugin/marketplace.json +20 -0
- package/adapters/claude-code/.claude-plugin/plugin.json +26 -0
- package/adapters/claude-code/CLAUDE.lite.md +39 -0
- package/adapters/claude-code/CLAUDE.md +114 -0
- package/adapters/claude-code/skills/qed-blast-radius/SKILL.md +30 -0
- package/adapters/claude-code/skills/qed-boost/SKILL.md +25 -0
- package/adapters/claude-code/skills/qed-review/SKILL.md +39 -0
- package/adapters/claude-code/skills/qed-verify/SKILL.md +38 -0
- package/adapters/cline/.clinerules +55 -0
- package/adapters/cline/.clinerules.lite +15 -0
- package/adapters/codex/.codex-plugin/plugin.json +41 -0
- package/adapters/codex/AGENTS.lite.md +16 -0
- package/adapters/codex/AGENTS.md +39 -0
- package/adapters/codex/CODEX.lite.md +28 -0
- package/adapters/codex/CODEX.md +56 -0
- package/adapters/copilot/.github/copilot-instructions.lite.md +32 -0
- package/adapters/copilot/.github/copilot-instructions.md +70 -0
- package/adapters/copilot/.github/prompts/qed-boost.prompt.md +12 -0
- package/adapters/copilot/.github/prompts/qed-spec.prompt.md +27 -0
- package/adapters/copilot/.github/prompts/qed-tdd.prompt.md +25 -0
- package/adapters/copilot/.github/prompts/qed-verify.prompt.md +26 -0
- package/adapters/copilot/copilot-instructions.lite.md +32 -0
- package/adapters/copilot/copilot-instructions.md +70 -0
- package/adapters/cursor/.cursor/rules/00-constitution.lite.mdc +16 -0
- package/adapters/cursor/.cursor/rules/00-constitution.mdc +22 -0
- package/adapters/cursor/.cursor/rules/01-blast-radius.mdc +27 -0
- package/adapters/cursor/.cursor/rules/02-anti-duplication.mdc +19 -0
- package/adapters/cursor/.cursor/rules/03-tdd-discipline.mdc +34 -0
- package/adapters/cursor/.cursor/rules/04-three-am-readability.mdc +35 -0
- package/adapters/cursor/.cursor/rules/05-verification-gate.mdc +28 -0
- package/adapters/cursor/.cursor/rules/06-documentation-and-visuals.mdc +25 -0
- package/adapters/cursor/.cursor/rules/07-context-economics.mdc +21 -0
- package/adapters/cursor/.cursor-plugin/plugin.json +22 -0
- package/adapters/cursor/.cursorrules +91 -0
- package/adapters/cursor/.cursorrules.lite +37 -0
- package/adapters/deepseek/.continue/config.json +19 -0
- package/adapters/deepseek/.continue/prompts/qed-boost.prompt +12 -0
- package/adapters/deepseek/.continue/prompts/qed-spec.prompt +12 -0
- package/adapters/deepseek/.continue/prompts/qed-verify.prompt +12 -0
- package/adapters/deepseek/.deepseekrules +13 -0
- package/adapters/deepseek/.deepseekrules.lite +11 -0
- package/adapters/deepseek/.dsh/config.json +20 -0
- package/adapters/deepseek/DEEPSEEK.lite.md +34 -0
- package/adapters/deepseek/DEEPSEEK.md +60 -0
- package/adapters/devin/.devin/config.json +12 -0
- package/adapters/devin/.devin-plugin/plugin.json +21 -0
- package/adapters/devin/DEVIN.lite.md +20 -0
- package/adapters/devin/DEVIN.md +29 -0
- package/adapters/droid/.agents/plugins/marketplace.json +20 -0
- package/adapters/droid/.droid/config.json +10 -0
- package/adapters/droid/DROID.lite.md +20 -0
- package/adapters/droid/DROID.md +28 -0
- package/adapters/gemini/GEMINI.lite.md +21 -0
- package/adapters/gemini/GEMINI.md +59 -0
- package/adapters/gemini/gemini-extension.json +6 -0
- package/adapters/grok/.grok/config.json +6 -0
- package/adapters/grok/.grok-plugin/plugin.json +24 -0
- package/adapters/grok/GROK.lite.md +20 -0
- package/adapters/grok/GROK.md +29 -0
- package/adapters/hermes/.hermes-plugin/__init__.py +41 -0
- package/adapters/hermes/.hermes-plugin/plugin.yaml +6 -0
- package/adapters/hermes/HERMES.lite.md +21 -0
- package/adapters/hermes/HERMES.md +31 -0
- package/adapters/kimi/.kimi-plugin/plugin.json +24 -0
- package/adapters/kimi/KIMI.lite.md +21 -0
- package/adapters/kimi/KIMI.md +49 -0
- package/adapters/muse/.muse-plugin/marketplace.json +20 -0
- package/adapters/muse/.muse-plugin/plugin.json +24 -0
- package/adapters/muse/MUSE.lite.md +20 -0
- package/adapters/muse/MUSE.md +27 -0
- package/adapters/opencode/.opencode/plugins/qed.js +81 -0
- package/adapters/opencode/.opencoderules +16 -0
- package/adapters/opencode/.opencoderules.lite +12 -0
- package/adapters/opencode/OPENCODE.lite.md +29 -0
- package/adapters/opencode/OPENCODE.md +47 -0
- package/adapters/opencode/index.js +2 -0
- package/adapters/opencode/opencode.json +62 -0
- package/adapters/pi/.pi/extensions/qed.ts +66 -0
- package/adapters/pi/PI.lite.md +21 -0
- package/adapters/pi/PI.md +40 -0
- package/adapters/pi/package.json +18 -0
- package/adapters/qwen/.qwen/config.json +9 -0
- package/adapters/qwen/.qwenrules +11 -0
- package/adapters/qwen/.qwenrules.lite +10 -0
- package/adapters/qwen/QWEN.lite.md +20 -0
- package/adapters/qwen/QWEN.md +29 -0
- package/adapters/roo-code/.clinerules +55 -0
- package/adapters/roo-code/.clinerules.lite +19 -0
- package/adapters/roo-code/.roomodes +40 -0
- package/adapters/roo-code/.roomodes.lite +25 -0
- package/adapters/windsurf/.windsurf/workflows/qed-boost.md +23 -0
- package/adapters/windsurf/.windsurf/workflows/qed-spec-and-blast-radius.md +28 -0
- package/adapters/windsurf/.windsurf/workflows/qed-tdd-cycle.md +29 -0
- package/adapters/windsurf/.windsurf/workflows/qed-verification-gate.md +33 -0
- package/adapters/windsurf/.windsurfrules +87 -0
- package/adapters/windsurf/.windsurfrules.lite +33 -0
- package/bin/qed +110 -0
- package/bin/qed-engine.js +1739 -0
- package/bin/qed.ps1 +165 -0
- package/core/CONSTITUTION.lite.md +69 -0
- package/core/CONSTITUTION.md +287 -0
- package/core/adaptive-architecture.md +116 -0
- package/core/anti-duplication.md +35 -0
- package/core/blast-radius.md +39 -0
- package/core/cache-memory-and-file-hygiene.md +172 -0
- package/core/chaos-monkey.md +39 -0
- package/core/comment-philosophy.md +164 -0
- package/core/context-economics.md +108 -0
- package/core/data-fetching-philosophy.md +357 -0
- package/core/database-evolution-and-migrations.md +181 -0
- package/core/dependency-philosophy.md +109 -0
- package/core/documentation-and-visuals.md +79 -0
- package/core/error-handling-philosophy.md +241 -0
- package/core/git-and-versioning.md +142 -0
- package/core/hygiene-and-cleanup.md +112 -0
- package/core/naming-philosophy.md +195 -0
- package/core/observability-and-rca.md +193 -0
- package/core/regionality-and-i18n.md +203 -0
- package/core/security-philosophy.md +192 -0
- package/core/testing-philosophy.md +164 -0
- package/core/three-am-test.md +68 -0
- package/core/visual-anti-slop-standard.md +217 -0
- package/core/workflow-ergonomics-and-affordances.md +223 -0
- package/docs/evals.md +64 -0
- package/docs/harnesses.md +97 -0
- package/docs/protocols.md +85 -0
- package/evals/benchmark-results.json +83 -0
- package/evals/run-benchmark.js +130 -0
- package/evals/scenarios.json +56 -0
- package/install.ps1 +571 -0
- package/install.sh +592 -0
- package/llms.txt +29 -0
- package/package.json +56 -4
- package/schema/qedrc.schema.json +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 KeelBismarck
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/QED.lite.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Q.E.D. Lite — Machine Instruction Set
|
|
2
|
+
*Token-optimized (~450 tokens) engineering standard for AI coding agents.*
|
|
3
|
+
|
|
4
|
+
You are bound by the **Q.E.D. High-Assurance Engineering Standard**.
|
|
5
|
+
|
|
6
|
+
## 0. Hard Invariants
|
|
7
|
+
1. **Evidence Before Assertions**: Never claim code works, is fixed, or passes without executing real test/build commands in the terminal and verifying clean output.
|
|
8
|
+
2. **Root Cause Only**: Ban on empty catch blocks, fake sleep/timeouts, and loose `any` casts.
|
|
9
|
+
3. **Pristine Root**: Zero scratch files, test dumps, or temporary scripts in project root.
|
|
10
|
+
4. **Dual Modes**: Mode A (Default: Quality > Speed — full TDD, verification gate); Mode B (Speed > Quality — only on explicit prompt: "quick", "draft", "prototype", "быстро" — requires debt disclosure).
|
|
11
|
+
|
|
12
|
+
## 1. Specification, Anti-Duplication & Blast Radius
|
|
13
|
+
- **Search Before Create**: Grep the repository before creating any helper, hook, or type. Always reuse existing code.
|
|
14
|
+
- **Blast Radius**: Map direct callers and transitive impact (API contracts, DB schemas, caches) before modifying shared code.
|
|
15
|
+
- **Zero Secret Leaks**: No hardcoded secrets. Maintain `.env.example`. Parameterized queries only.
|
|
16
|
+
- **Resource Hygiene**: Bounded LRU cache (`maxSize` + `ttlMs`). Scoped temp file cleanup in `try...finally`. Atomic file writes (`file.tmp` -> `file`). Streams for >10MB.
|
|
17
|
+
- **Data Fetching**: Mandatory `AbortSignal.timeout(ms)`. Ban on `as TargetType` casts (runtime schema validation). Keyset pagination for >1k rows. Safe retries with jitter (`Idempotency-Key` for POST). Scope queries by tenant (IDOR defense). Singleflight deduplication.
|
|
18
|
+
|
|
19
|
+
## 2. Adversarial QA, 4 States & Visual Anti-Slop
|
|
20
|
+
Every UI flow and data route must handle:
|
|
21
|
+
1. **Empty State**: Clear UI/payload when 0 items exist + next steps.
|
|
22
|
+
2. **Loading State**: Predictable indicator preventing layout shift (CLS).
|
|
23
|
+
3. **Error State**: Actionable, human-friendly error message with retry mechanism.
|
|
24
|
+
4. **Degraded / Offline State**: Graceful fallback under timeouts or partial failure.
|
|
25
|
+
5. **Visual Anti-Slop & Signature Spark**: The Archaeologist Invariant: preserve unique interactive mechanics while stripping card bloat (unboxed by default); ban Type 2 sterile brutalism; form follows data topology; zero UI emojis; 100% human-domain utility.
|
|
26
|
+
6. **Workflow Ergonomics**: State-in-URL (filters/tabs); auto-save form drafts; semantic links (`<a>`) for navigation; never block paste; 1-click copy with feedback; undo toasts over modal popups; validate on blur.
|
|
27
|
+
7. **Errors, Telemetry & DB**: Zero empty catches (chain `cause`); structured JSON logs with traceId & PII scrub; Expand/Contract for DB migrations (never drop columns in same release; `CREATE INDEX CONCURRENTLY`; `lock_timeout = '2s'`).
|
|
28
|
+
|
|
29
|
+
## 3. Ironclad TDD & The 3 AM Test
|
|
30
|
+
- **Reproduction First**: For bugs, write failing reproduction test (Red) -> minimal fix (Green) -> refactor. Features: tests before code.
|
|
31
|
+
- **Testing Rules**: Zero placebo mocks; zero flaky `sleep()`; cover boundary matrix (0, 1, N, Max, null, hostile Unicode `👨👩👧👦`, double-clicks in 50ms).
|
|
32
|
+
- **The 3 AM Test**: Flat guard clauses, early returns, clear intermediate variables.
|
|
33
|
+
- **Semantic Rigor**: Positive booleans (`isActive`), units in numbers (`timeoutMs`), contract verbs (`get`, `create`). Comment WHY, not WHAT. Actionable `TODO(#issueId)` only.
|
|
34
|
+
|
|
35
|
+
## 4. Verification Gate
|
|
36
|
+
Before declaring completion:
|
|
37
|
+
1. Pre-commit purge: remove debug prints (`console.log`, `print`, `debugger`), temp files, dead imports.
|
|
38
|
+
2. Run typecheck (`tsc`, `mypy`), linter (`eslint`, `ruff`), and full test suite.
|
|
39
|
+
3. Verify 100% pass and clean `git diff`.
|
|
40
|
+
|
|
41
|
+
## 5. Context Economics (Token Hygiene)
|
|
42
|
+
- **Surgical Edits**: Targeted diffs only; ban full-file rewrites when modifying <20% lines.
|
|
43
|
+
- **Progressive Inspection**: Grep & read bounded line intervals; never dump 1000L files into context.
|
|
44
|
+
- **Log Pruning**: Run tests with `qed exec <cmd>` or `--only-failures`; ban flooding context with green dots.
|
|
45
|
+
- **Zero Filler**: No conversational padding in responses. Evidence before assertions.
|
package/README.md
CHANGED
|
@@ -1,3 +1,341 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/banner.svg" alt="Q.E.D. Banner" width="100%">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://github.com/keelbismark/qed/actions/workflows/ci.yml"><img src="https://github.com/keelbismark/qed/actions/workflows/ci.yml/badge.svg" alt="CI Status"></a>
|
|
7
|
+
<a href="https://github.com/keelbismark/qed/releases/tag/v1.0.0"><img src="https://img.shields.io/badge/release-v1.0.0-blue.svg?style=flat-square" alt="Release: v1.0.0"></a>
|
|
8
|
+
<a href="package.json"><img src="https://img.shields.io/badge/pkg-qed--standard-cb3837.svg?style=flat-square&logo=npm" alt="Package: qed-standard"></a>
|
|
9
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-3b82f6.svg?style=flat-square" alt="License: MIT"></a>
|
|
10
|
+
<a href="docs/harnesses.md"><img src="https://img.shields.io/badge/harnesses-20%20platforms-8b5cf6.svg?style=flat-square" alt="Harnesses: 20 Platforms"></a>
|
|
11
|
+
<a href="core/CONSTITUTION.md"><img src="https://img.shields.io/badge/standards-16%20core%20specs-10b981.svg?style=flat-square" alt="Standards: 16 Core Specs"></a>
|
|
12
|
+
<a href="core/CONSTITUTION.lite.md"><img src="https://img.shields.io/badge/edition-Q.E.D.%20Lite%20(<500%20tokens)-ec4899.svg?style=flat-square" alt="Edition: Q.E.D. Lite"></a>
|
|
13
|
+
<a href="tests/verify-adapters.ps1"><img src="https://img.shields.io/badge/tests-36%2F36%20passing-38bdf8.svg?style=flat-square" alt="Verification: 100% Passing"></a>
|
|
14
|
+
<a href="llms.txt"><img src="https://img.shields.io/badge/agent-llms.txt-f59e0b.svg?style=flat-square" alt="LLM Entrypoint: llms.txt"></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<a href="#quickstart">Quickstart</a> •
|
|
19
|
+
<a href="#the-problem-codebase-erosion">The Problem</a> •
|
|
20
|
+
<a href="#framework-architecture">Architecture</a> •
|
|
21
|
+
<a href="#the-16-pillars-of-qed">The 16 Pillars</a> •
|
|
22
|
+
<a href="#mechanical-verification-gate-qed-check">Mechanical Gate</a> •
|
|
23
|
+
<a href="#how-it-works">Lifecycle</a> •
|
|
24
|
+
<a href="#20-supported-platforms">20 Platforms</a> •
|
|
25
|
+
<a href="llms.txt">llms.txt</a>
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## The Problem: Codebase Erosion
|
|
31
|
+
|
|
32
|
+
AI pair-programming promised a 10x engineer. In practice, it frequently feels like reviewing PRs from an overcaffeinated junior developer:
|
|
33
|
+
|
|
34
|
+
> *"I've resolved the issue!"* — the agent announces.
|
|
35
|
+
> You pull the branch. It never ran the tests. It broke three database queries. It hallucinated a deprecated library version. It created a second `formatDateHelper.ts` in another directory. And it silenced a fatal defect with `catch (e) {}`.
|
|
36
|
+
|
|
37
|
+
Code generated without physical boundaries is technical debt accumulating compound interest. We call it **codebase erosion**.
|
|
38
|
+
|
|
39
|
+
**Q.E.D.** (*Latin: "quod erat demonstrandum" — which was to be demonstrated*) is an open-source, high-assurance engineering standard and configuration layer for AI coding environments. It replaces vibes, guesses, and unverified assertions with deterministic engineering discipline.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Framework Architecture
|
|
44
|
+
|
|
45
|
+
Q.E.D. organizes engineering discipline across three coordinated tiers: **Universal Invariants**, the **4-Phase Verification Engine**, and the **External Trust Contract**.
|
|
46
|
+
|
|
47
|
+
<p align="center">
|
|
48
|
+
<img src="assets/framework.svg" alt="Q.E.D. Architectural Framework" width="100%">
|
|
49
|
+
</p>
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Before & After: Real-World Evidence
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
// [WITHOUT Q.E.D.] Standard AI Generative Output
|
|
57
|
+
// Silent error swallowing, loose typing, happy-path assumption, zero tests executed
|
|
58
|
+
async function checkout(cart: any) {
|
|
59
|
+
try {
|
|
60
|
+
if (cart.items) {
|
|
61
|
+
const total = cart.items.reduce((a: any, b: any) => a + b.price, 0);
|
|
62
|
+
return await api.charge(total); // Floating point bug: 0.1 + 0.2 !== 0.3! No idempotency!
|
|
63
|
+
}
|
|
64
|
+
} catch (e) {
|
|
65
|
+
console.log("error"); // Swallowed failure. UI hangs indefinitely.
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// [WITH Q.E.D.] High-Assurance Output
|
|
72
|
+
// Guard clauses, integer minor units, 4 states handled, reproduction test verified RED first
|
|
73
|
+
async function checkout(cart: Cart): Promise<CheckoutResult> {
|
|
74
|
+
if (!cart.items || cart.items.length === 0) {
|
|
75
|
+
return { status: "empty", message: "Cart is empty" };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Reused existing helper (Anti-Duplication) & Integer Minor Units (No floating-point currency)
|
|
79
|
+
const totalMinorUnits = calculateCartTotalMinorUnits(cart.items);
|
|
80
|
+
if (totalMinorUnits <= 0) {
|
|
81
|
+
throw new InvalidOrderError("Total amount must be greater than zero");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Idempotent charge with explicit timeout and retry boundary (Chaos Monkey verified)
|
|
85
|
+
return await paymentGateway.chargeWithIdempotency({
|
|
86
|
+
amountMinorUnits: totalMinorUnits,
|
|
87
|
+
currency: cart.currency, // ISO 4217 Invariant
|
|
88
|
+
idempotencyKey: cart.idempotencyKey,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## How It Works: The 4-Phase Verification Loop
|
|
96
|
+
|
|
97
|
+
Every task executed under Q.E.D. traverses an ironclad, evidence-backed lifecycle:
|
|
98
|
+
|
|
99
|
+
<p align="center">
|
|
100
|
+
<img src="assets/pipeline.svg" alt="Q.E.D. Verification Pipeline" width="100%">
|
|
101
|
+
</p>
|
|
102
|
+
|
|
103
|
+
### Execution Trace Example
|
|
104
|
+
|
|
105
|
+
```text
|
|
106
|
+
$ qed "Add idempotent debit to wallet API"
|
|
107
|
+
|
|
108
|
+
[1/4] SPECIFICATION, ANTI-DUPLICATION & BLAST RADIUS
|
|
109
|
+
-> Grepping codebase for existing wallet balance helpers...
|
|
110
|
+
-> Found 'db.wallets.updateBalance()' in src/services/wallet.ts (reused).
|
|
111
|
+
-> Callers: CheckoutController, SubscriptionCron (Blast Risk: Medium).
|
|
112
|
+
|
|
113
|
+
[2/4] ADVERSARIAL QA & 4 MANDATORY STATES
|
|
114
|
+
-> Mapping edge cases: double-click in 50ms, expired JWT, zero balance, timeout.
|
|
115
|
+
-> Implementing: Empty, Loading, Error (retryable), Degraded states.
|
|
116
|
+
|
|
117
|
+
[3/4] IRONCLAD TDD (REPRODUCTION FIRST)
|
|
118
|
+
-> Authoring reproduction test: test/wallet.test.ts:42
|
|
119
|
+
$ npm test -- test/wallet.test.ts
|
|
120
|
+
FAIL: Concurrent duplicate debit executed twice. Expected 1 charge.
|
|
121
|
+
-> Red state verified.
|
|
122
|
+
-> Implementing minimal fix (row lock + unique idempotency constraint)...
|
|
123
|
+
$ npm test -- test/wallet.test.ts
|
|
124
|
+
PASS: 2 concurrent calls -> 1 debit, 1 cached response (Green verified).
|
|
125
|
+
|
|
126
|
+
[4/4] THE 3 AM AUDIT, SANITIZATION & VERIFICATION GATE
|
|
127
|
+
-> Refactored nested if/else pyramids into early return guard clauses.
|
|
128
|
+
-> Sanitization sweep: 0 console.log, 0 throwaway scripts, 0 dead imports.
|
|
129
|
+
-> Static Typecheck: OK (0 errors).
|
|
130
|
+
-> Linter: OK (0 warnings).
|
|
131
|
+
-> Full Regression Suite: 64/64 passed (100% green).
|
|
132
|
+
-> Commit: feat(wallet): implement idempotent debit with distributed lock
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## The 16 Pillars of Q.E.D.
|
|
138
|
+
|
|
139
|
+
The standard is codified in 16 formal specification documents under [`core/`](core/):
|
|
140
|
+
|
|
141
|
+
| # | Pillar & Specification | Core Invariant | Risk Eliminated |
|
|
142
|
+
| :-: | :--- | :--- | :--- |
|
|
143
|
+
| **0** | **[Universal Constitution](core/CONSTITUTION.md)** | Quality > Speed by default; evidence before assertions; root cause only. | Speculative coding, cosmetic hacks, placebo fixes. |
|
|
144
|
+
| **1** | **[Testing Philosophy](core/testing-philosophy.md)** | Zero placebo mocks; mandatory boundary matrix; reproduction RED $\rightarrow$ GREEN. | Testing mocks instead of real software; flaky tests. |
|
|
145
|
+
| **2** | **[Adaptive Architecture](core/adaptive-architecture.md)** | Earned complexity; form follows data flow; pristine root; 10-second entrypoint. | Enterprise boilerplate on small tools; cluttered project roots. |
|
|
146
|
+
| **3** | **[Dependency Philosophy](core/dependency-philosophy.md)** | Build vs. Buy matrix; 4-pillar package health audit; The Wrapper Invariant. | Supply chain trojans, bloatware, unmaintained micro-packages. |
|
|
147
|
+
| **4** | **[Threat-Adaptive Security](core/security-philosophy.md)** | 4 Security Tiers; tenant-isolated IDOR checks; anti-security-theater UX (NIST 800). | IDOR leaks, mass assignment, user-hostile login barriers. |
|
|
148
|
+
| **5** | **[Earned Regionality & I18n](core/regionality-and-i18n.md)** | Level 0 baseline (UTF-8, UTC, integer money); native `Intl`; sovereign data residency. | Timezone shift bugs, float money bugs, GDPR fines. |
|
|
149
|
+
| **6** | **[Cache & Resource Hygiene](core/cache-memory-and-file-hygiene.md)** | Bounded LRU cache + TTL; tenant cache isolation; streams for >10MB; scoped temp cleanup. | Out-of-memory (OOM) crashes, 100% disk exhaustion, ghost data. |
|
|
150
|
+
| **7** | **[Data Fetching Philosophy](core/data-fetching-philosophy.md)** | Mandatory `AbortSignal` timeout; anti-`as` boundary parsing; Keyset pagination; Singleflight. | Hanging socket leaks, contract drift crashes, waterfall lag, IDOR. |
|
|
151
|
+
| **8** | **[Visual Anti-Slop Standard](core/visual-anti-slop-standard.md)** | The Archaeologist Invariant (preserve the Signature Spark); unboxed by default; anti-Bento; zero emojis. | Type 1 synthetic plastic carnival, Type 2 sterile hospital sheet brutalism. |
|
|
152
|
+
| **9** | **[Workflow Ergonomics](core/workflow-ergonomics-and-affordances.md)** | State-in-URL; auto-save drafts; native links; never block paste; 1-click copy; Undo toasts. | Lost form inputs, modal blindness, broken back-buttons, copy-paste friction. |
|
|
153
|
+
| **10** | **[Error Handling Philosophy](core/error-handling-philosophy.md)** | 4 Operational Tiers; Result<T,E>; error cause chaining; boundary masking with Correlation ID. | Silent catch rot, unmasked stack trace leaks, double logging. |
|
|
154
|
+
| **11** | **[Observability, Telemetry & RCA](core/observability-and-rca.md)** | Structured JSON logging; traceId propagation; automated PII redaction; blameless 5 Whys RCA. | Unsearchable text logs, PII credential leaks, repeat production outages. |
|
|
155
|
+
| **12** | **[Database Evolution & Migrations](core/database-evolution-and-migrations.md)** | Expand/Contract pattern; non-blocking DDL (`CREATE INDEX CONCURRENTLY`, `lock_timeout = '2s'`). | Locked production tables, failed deployments, corrupted data. |
|
|
156
|
+
| **13** | **[Git & Pragmatic Versioning](core/git-and-versioning.md)** | Git change ledger $\neq$ Versioning trust contract; Bisect Invariant; changelog split. | Broken git bisect, unearned deprecation, leaked security flaws. |
|
|
157
|
+
| **14** | **[Naming & Semantics](core/naming-philosophy.md)** | Scope-proportional length; positive predicates; contract verbs (`get` vs `fetch`). | Ambiguous names (`data`, `temp`, `res`), misleading predicates. |
|
|
158
|
+
| **15** | **[Hygiene & Pre-Commit Sweep](core/hygiene-and-cleanup.md)** | Zero debug prints; throwaway script purge; clean git status before commit. | Production debug logs, leaked tokens, commit pollution. |
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Quickstart
|
|
163
|
+
|
|
164
|
+
Install Q.E.D. into your project in seconds:
|
|
165
|
+
|
|
166
|
+
### Windows (PowerShell)
|
|
167
|
+
```powershell
|
|
168
|
+
irm https://raw.githubusercontent.com/keelbismark/qed/main/install.ps1 | iex
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Linux / macOS (Bash)
|
|
172
|
+
```bash
|
|
173
|
+
curl -fsSL https://raw.githubusercontent.com/keelbismark/qed/main/install.sh | bash
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Targeted Platform Setup
|
|
177
|
+
Install configurations for a specific AI harness only:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
./install.sh cursor # Cursor AI (.cursorrules & modern .cursor/rules/*.mdc)
|
|
181
|
+
./install.sh claude # Claude Code (CLAUDE.md, slash commands, skills)
|
|
182
|
+
./install.sh deepseek # DeepSeek Harness (dsh) & Continue.dev
|
|
183
|
+
./install.sh roo # Roo Code custom modes (Architect, TDD, Reviewer)
|
|
184
|
+
./install.sh global all # Machine-wide installation across user profile
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Q.E.D. Lite (Token-Optimized Edition)
|
|
188
|
+
For fast or token-constrained models (**Claude 3.5 Haiku, Gemini Flash, GPT-4o-mini, local LLMs via Ollama/Llama 3/Qwen**), install the ultra-dense Lite edition (<500 tokens, ~80% token reduction) without sacrificing any core engineering invariants:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Linux / macOS
|
|
192
|
+
./install.sh --lite # Install Lite for all harnesses
|
|
193
|
+
./install.sh --lite claude # Install Lite for Claude Code (CLAUDE.md)
|
|
194
|
+
./install.sh --lite cursor # Install Lite for Cursor (.cursorrules)
|
|
195
|
+
|
|
196
|
+
# Windows (PowerShell)
|
|
197
|
+
.\install.ps1 -Lite # Install Lite for all harnesses
|
|
198
|
+
.\install.ps1 -Lite -Harness claude
|
|
199
|
+
.\install.ps1 cursor -Lite
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
*Distinct Lite manifests are also directly available in the repository root and harness folders (`QED.lite.md`, `core/CONSTITUTION.lite.md`, `adapters/*/GEMINI.lite.md`, `CLAUDE.lite.md`, `.cursorrules.lite`).*
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Mechanical Verification Gate (`qed check` & Pre-Commit Hook)
|
|
207
|
+
|
|
208
|
+
To eliminate reliance on an AI agent's "honor system", Q.E.D. includes a standalone mechanical linter and Git pre-commit gate that automatically blocks commits containing standard violations:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# Run mechanical compliance check across the repository
|
|
212
|
+
./bin/qed check # Linux / macOS
|
|
213
|
+
.\bin\qed.ps1 check # Windows (PowerShell)
|
|
214
|
+
node bin/qed-engine.js check # Node.js (cross-platform, zero dependencies)
|
|
215
|
+
|
|
216
|
+
# Run full health & invariant audit (git cleanliness, hooks, remote CI, AST)
|
|
217
|
+
node bin/qed-engine.js doctor
|
|
218
|
+
|
|
219
|
+
# Install automated Git pre-commit & pre-push hooks
|
|
220
|
+
./bin/qed hook # Linux / macOS
|
|
221
|
+
.\bin\qed.ps1 hook # Windows (PowerShell)
|
|
222
|
+
|
|
223
|
+
# Run cross-platform multi-OS test matrix (PowerShell + POSIX Bash)
|
|
224
|
+
npm test # or node bin/qed-engine.js test
|
|
225
|
+
|
|
226
|
+
# Run empirical LLM slop eradication benchmark
|
|
227
|
+
npm run evals # or node evals/run-benchmark.js
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
The mechanical gate automatically scans and enforces:
|
|
231
|
+
1. **Pristine Root Invariant**: Zero temporary scratch files (`temp_*`, `scratch.*`, `*.tmp`, `*.log`, `test_dump*`).
|
|
232
|
+
2. **Zero-Debug Print Invariant**: Zero leftover `console.log(`, `debugger;`, `print(`, or `fmt.Println(`.
|
|
233
|
+
3. **Environment Synchronization**: Every environment variable referenced in code must be documented in `.env.example`.
|
|
234
|
+
4. **Type Safety & AST Analysis**: Zero loose `as any` casts in TypeScript/JavaScript (lexically masked and TypeScript AST verified).
|
|
235
|
+
5. **Network Deadlines**: Mandatory `AbortSignal.timeout` on all `fetch()` operations.
|
|
236
|
+
6. **Bounded Caches**: Zero unbounded module-level `new Map()` exports.
|
|
237
|
+
7. **Zero Table-Locking DDL**: Enforces `CREATE INDEX CONCURRENTLY` in SQL migrations.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Empirical Benchmark & Proof Matrix
|
|
242
|
+
|
|
243
|
+
We don't guess whether Q.E.D. makes AI code better — we measure it scientifically. The included automated benchmark suite (`evals/run-benchmark.js`) executes 6 standardized engineering challenges against unconstrained LLMs versus Q.E.D.:
|
|
244
|
+
|
|
245
|
+
| Scenario ID | Engineering Domain | Vanilla Baseline | Under Q.E.D. Standard | Result |
|
|
246
|
+
| :--- | :--- | :---: | :---: | :---: |
|
|
247
|
+
| **SCN-01-CACHE** | Bounded Memory / LRU | 1 defect (`new Map()`) | **0 defects** | **PASSED** |
|
|
248
|
+
| **SCN-02-FETCH** | Network Resilience / Deadlines | 1 defect (naked `fetch`) | **0 defects** | **PASSED** |
|
|
249
|
+
| **SCN-03-ERROR** | Error Chaining & Fallbacks | 1 defect (swallowed `catch`) | **0 defects** | **PASSED** |
|
|
250
|
+
| **SCN-04-TYPES** | Runtime Type Invariants | 1 defect (`as any` cast) | **0 defects** | **PASSED** |
|
|
251
|
+
| **SCN-05-DDL** | Database Zero-Downtime | 1 defect (table-lock DDL) | **0 defects** | **PASSED** |
|
|
252
|
+
| **SCN-06-UI** | Human Affordances / Anti-Slop | 1 defect (emoji button salad) | **0 defects** | **PASSED** |
|
|
253
|
+
|
|
254
|
+
- **Slop Eradication Rate**: **100.0%** of mechanical flaws eliminated.
|
|
255
|
+
- **Vanilla Gate Pass Rate**: **0.0%** (all unconstrained code failed mechanical verification).
|
|
256
|
+
- **Q.E.D. Gate Pass Rate**: **100.0%** (high-assurance compliance).
|
|
257
|
+
|
|
258
|
+
[View Full Empirical Methodology & Telemetry Data →](docs/evals.md)
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## 20 Supported Platforms
|
|
263
|
+
|
|
264
|
+
Q.E.D. provides native drop-in adapters and configuration manifests tailored to each tool's architecture:
|
|
265
|
+
|
|
266
|
+
| Environment | Primary Manifest | Key Capabilities |
|
|
267
|
+
| :--- | :--- | :--- |
|
|
268
|
+
| **Cursor AI** | `.cursorrules`, `.cursor/rules/*.mdc` | Modern MDC rules with YAML frontmatter for TDD and Blast Radius |
|
|
269
|
+
| **Claude Code** | `CLAUDE.md`, `.claude/commands/` | Slash commands (`/boost`, `/qed-verify`, `/qed-review`), skills |
|
|
270
|
+
| **Google Antigravity** | `GEMINI.md`, `.antigravity-plugin/` | Multi-agent orchestration, Evidence Before Assertions |
|
|
271
|
+
| **DeepSeek (dsh & Continue)**| `DEEPSEEK.md`, `.dsh/`, `.continue/` | R1 Chain-of-Thought directives, safety presets, slash commands |
|
|
272
|
+
| **Roo Code & Cline** | `.roomodes`, `.clinerules` | 3 custom roles: `Architect`, `TDD Engineer`, and `Reviewer` |
|
|
273
|
+
| **Windsurf Cascade** | `.windsurfrules`, workflows | Interactive workflows (`qed-boost`, `qed-tdd-cycle`) |
|
|
274
|
+
| **Aider** | `.aider.conventions.md` | Auto-test on commit (`auto-test: true`), Conventional Commits |
|
|
275
|
+
| **GitHub Copilot** | `copilot-instructions.md`, prompts | Instructions and prompt templates (`qed-boost`, `qed-spec`) |
|
|
276
|
+
| **OpenCode** | `opencode.json`, `plugins/qed.js` | In-process V1/V2 lifecycle plugin, sandbox constraints |
|
|
277
|
+
| **Codex, Grok, Kimi, Pi, Devin...** | Native manifests & configs | Full parity across 20 environments |
|
|
278
|
+
|
|
279
|
+
[View Full Harness Details & Manual Configurations →](docs/harnesses.md)
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Dual Execution Modes
|
|
284
|
+
|
|
285
|
+
Q.E.D. adapts to your velocity requirements:
|
|
286
|
+
|
|
287
|
+
* **Mode A (Production Mode — Default: `Quality > Speed`)**
|
|
288
|
+
Full engineering rigor. Red-Green-Refactor TDD cycles, blast radius calculation, adversarial testing, and verification gate before declaring work complete.
|
|
289
|
+
* **Mode B (Speed Mode — On-Demand: `Speed > Quality`)**
|
|
290
|
+
Triggered when you explicitly ask for speed (*"quick"*, *"prototype"*, *"draft"*, *"быстро"*, *"набросок"*). Delivers a working proof-of-concept immediately, accompanied by an explicit report detailing shortcuts taken and required hardening steps.
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Comparison Matrix
|
|
295
|
+
|
|
296
|
+
| Capability | Q.E.D. | GitHub Spec-Kit | obra/superpowers | BMad Method | Default AI |
|
|
297
|
+
| :--- | :---: | :---: | :---: | :---: | :---: |
|
|
298
|
+
| **Evidence Before Assertions** | **Enforced** | Partial | Enforced | Partial | None |
|
|
299
|
+
| **Blast Radius Analysis** | **Yes** | No | No | No | No |
|
|
300
|
+
| **Anti-Duplication Radar** | **Mandatory** | No | No | No | No |
|
|
301
|
+
| **Threat-Adaptive Security (4 Tiers)**| **Enforced** | No | No | No | None |
|
|
302
|
+
| **Earned Regionality & I18n** | **Enforced** | No | No | No | None |
|
|
303
|
+
| **Bounded Caches & Resource Hygiene**| **Enforced** | No | No | No | None |
|
|
304
|
+
| **4 Mandatory States** | **Enforced** | Partial | No | Partial | None |
|
|
305
|
+
| **3 AM Readability Test** | **Enforced** | No | Partial | No | None |
|
|
306
|
+
| **Chaos Monkey Edge Cases** | **Standard** | No | Partial | No | None |
|
|
307
|
+
| **Supported Platforms** | **20** | 1 | 20 | 2 | None |
|
|
308
|
+
| **Context Overhead** | **Minimal** | Minimal | Minimal | Heavy | Uncontrolled |
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Specification & Standards Library
|
|
313
|
+
|
|
314
|
+
* **[Universal Constitution](core/CONSTITUTION.md)** — Foundational articles governing agent behavior.
|
|
315
|
+
* **[Testing Philosophy](core/testing-philosophy.md)** — Zero placebo mocks, boundary matrix, mutation testing.
|
|
316
|
+
* **[Adaptive Architecture](core/adaptive-architecture.md)** — Anti-template dogmatism, earned complexity.
|
|
317
|
+
* **[Dependency Philosophy](core/dependency-philosophy.md)** — Build vs. Buy, 4-pillar audit, Wrapper Invariant.
|
|
318
|
+
* **[Threat-Adaptive Security](core/security-philosophy.md)** — 4 Security Tiers, NIST 800-63B, Tenant Isolation.
|
|
319
|
+
* **[Earned Regionality & I18n](core/regionality-and-i18n.md)** — Level 0-3 ladder, UTC wire, minor integer money.
|
|
320
|
+
* **[Cache, Memory & Resource Hygiene](core/cache-memory-and-file-hygiene.md)** — Bounded LRU, leak-free streams, temp cleanup.
|
|
321
|
+
* **[Data Fetching Philosophy](core/data-fetching-philosophy.md)** — Transport deadlines, boundary schema validation, Keyset pagination.
|
|
322
|
+
* **[Visual Anti-Slop & Human Interface](core/visual-anti-slop-standard.md)** — Unboxed by default, form follows data, zero UI emojis, anti-cyber slop.
|
|
323
|
+
* **[Workflow Ergonomics & Human Affordances](core/workflow-ergonomics-and-affordances.md)** — State-in-URL, draft auto-save, focus return, Undo toasts.
|
|
324
|
+
* **[Error Handling Philosophy](core/error-handling-philosophy.md)** — 4 operational tiers, Result<T,E>, cause chaining, boundary masking.
|
|
325
|
+
* **[Observability & Incident RCA](core/observability-and-rca.md)** — Structured JSON logging, trace context, PII scrubbing, 5 Whys.
|
|
326
|
+
* **[Database Evolution & Migrations](core/database-evolution-and-migrations.md)** — Expand/Contract, non-blocking DDL, batched backfills.
|
|
327
|
+
* **[Git & Pragmatic Versioning](core/git-and-versioning.md)** — Change ledger vs. trust contract, Bisect Invariant.
|
|
328
|
+
* **[Naming & Semantics](core/naming-philosophy.md)** — Scope-proportional names, positive predicates, contract verbs.
|
|
329
|
+
* **[Hygiene & Pre-Commit Sweep](core/hygiene-and-cleanup.md)** — Zero-debug print invariant, dead code elimination.
|
|
330
|
+
* **[Comment Philosophy & Anti-Noise](core/comment-philosophy.md)** — Ban on syntax echo noise, Why-over-What rules.
|
|
331
|
+
* **[Documentation & Visual Standards](core/documentation-and-visuals.md)** — Human vs. AI separation, responsive SVG graphics.
|
|
332
|
+
* **[AI Agent Guide (llms.txt)](llms.txt)** — High-density machine entrypoint for LLMs.
|
|
333
|
+
* **[Harness Guide](docs/harnesses.md)** — Setup reference for all 20 platforms.
|
|
334
|
+
* **[Templates](templates/)** — Templates for Specs, Architecture Decision Records (ADRs), and Plans.
|
|
335
|
+
* **[End-to-End Walkthrough](examples/full-lifecycle-walkthrough.md)** — Real-world example building a feature under Q.E.D.
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## License
|
|
340
|
+
|
|
341
|
+
MIT License. Copyright (c) 2026 KeelBismarck.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Q.E.D. High-Assurance Configuration for Aider
|
|
2
|
+
# Place this file as .aider.conf.yml in your repository root
|
|
3
|
+
|
|
4
|
+
# Automatically load the Q.E.D. engineering conventions into context
|
|
5
|
+
read: .aider.conventions.md
|
|
6
|
+
|
|
7
|
+
# Enforce automatic execution of verification tests after code edits
|
|
8
|
+
auto-test: true
|
|
9
|
+
|
|
10
|
+
# Enable automatic git commits adhering to Conventional Commits
|
|
11
|
+
auto-commits: true
|
|
12
|
+
|
|
13
|
+
# Clean git commit metadata (do not inject promotional commit author tags)
|
|
14
|
+
attribute-author: false
|
|
15
|
+
attribute-committer: false
|
|
16
|
+
|
|
17
|
+
# Example test commands (uncomment and adjust for your tech stack):
|
|
18
|
+
# test-cmd: npm test
|
|
19
|
+
# test-cmd: pytest
|
|
20
|
+
# test-cmd: cargo test
|
|
21
|
+
# test-cmd: go test ./...
|
|
22
|
+
|
|
23
|
+
# Example lint commands:
|
|
24
|
+
# lint-cmd: npm run lint
|
|
25
|
+
# lint-cmd: ruff check .
|
|
26
|
+
# lint-cmd: cargo clippy
|
|
27
|
+
|
|
28
|
+
# Formatting and diff options
|
|
29
|
+
stream: true
|
|
30
|
+
pretty: true
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Q.E.D. Lite Conventions for Aider
|
|
2
|
+
# Drop as .aider.conventions.md or .aider.conventions.lite.md in repo root
|
|
3
|
+
|
|
4
|
+
Directives:
|
|
5
|
+
- Prime Directive: Evidence Before Assertions. Never state code works without executing terminal tests.
|
|
6
|
+
- Mode A (Default: Quality > Speed): TDD, Blast Radius, 4 States, Verification Gate. Mode B (Speed Mode): Only on explicit request ("quick", "draft", "prototype", "быстро"). Disclose technical debt.
|
|
7
|
+
- Root Cause Only: Ban on empty catch blocks, fake timeouts, and loose `any` casts.
|
|
8
|
+
- Pristine Root: Zero scratch files or temporary dumps in root.
|
|
9
|
+
- Anti-Duplication: Search repo before introducing any new function, hook, or type. Always reuse existing code.
|
|
10
|
+
- Blast Radius: Map direct callers and transitive API/DB/cache impact before modifying shared code.
|
|
11
|
+
- Security & Hygiene: Never commit secrets; update `.env.example`; bounded LRU caches (`maxSize` + `ttlMs`); cleanup temp files in `try...finally`.
|
|
12
|
+
- 4 Mandatory States: Implement Empty (0 items + CTA), Loading (no CLS), Error (actionable + retry), Degraded/Offline (timeout fallback).
|
|
13
|
+
- Ironclad TDD: Reproduction test first for bugs (Red -> Green -> Refactor). Zero placebo mocks; zero flaky `sleep()`; cover boundary matrix (0, 1, N, Max, null, hostile Unicode `👨👩👧👦`, double-clicks in 50ms).
|
|
14
|
+
- The 3 AM Test: Early returns, flat guard clauses, descriptive variables, positive predicates (`isActive`), units in numbers (`timeoutMs`), contract verbs (`get`, `create`). Comment WHY, not WHAT. Actionable `TODO(#issueId)`.
|
|
15
|
+
- Commits: Use Conventional Commits (`feat:`, `fix:`, `test:`, `refactor:`, `docs:`, `chore:`). Keep commits atomic.
|
|
16
|
+
- Verification Gate: Purge debug prints and scratch files; run typecheck, linter, and full test suite before completion.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Q.E.D. Engineering Conventions for Aider
|
|
2
|
+
# Place this file as .aider.conventions.md in your repository root
|
|
3
|
+
|
|
4
|
+
You are an expert pair-programmer operating under the **Q.E.D. (Quod Erat Demonstrandum)** High-Assurance Engineering Standard.
|
|
5
|
+
Your prime directive is: **Evidence Before Assertions**.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 0. Fundamental Directive: Quality > Speed
|
|
10
|
+
|
|
11
|
+
1. **Evidence Before Assertions**:
|
|
12
|
+
- Never claim code is working, tested, or complete without running the tests (via `/test` or configured `test-cmd`) and inspecting output.
|
|
13
|
+
2. **Root Cause Only**:
|
|
14
|
+
- Never suppress errors with empty catch blocks, fake timeouts, or type casts (`any`). Resolve the actual underlying defect.
|
|
15
|
+
3. **Zero Secret Leaks**:
|
|
16
|
+
- Never hardcode credentials, tokens, or API keys. Update `.env.example` when adding environment variables.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 1. Conventional Commits Discipline
|
|
21
|
+
|
|
22
|
+
All git commit messages MUST adhere to the Conventional Commits specification:
|
|
23
|
+
- `feat: <description>` for new user-facing functionality
|
|
24
|
+
- `fix: <description>` for bug fixes
|
|
25
|
+
- `test: <description>` for adding or correcting tests
|
|
26
|
+
- `refactor: <description>` for internal restructuring without behavioral change
|
|
27
|
+
- `docs: <description>` for documentation and ADR updates
|
|
28
|
+
- `chore: <description>` for dependency updates and build maintenance
|
|
29
|
+
|
|
30
|
+
Rules:
|
|
31
|
+
- Keep commits atomic and self-contained.
|
|
32
|
+
- Use imperative mood ("add", "fix", "refactor", not "added", "fixed").
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 2. Anti-Duplication, Dependencies & Blast Radius
|
|
37
|
+
|
|
38
|
+
- **Dependency Discipline & The Wrapper Invariant**:
|
|
39
|
+
- Battle-tested standards for crypto/auth/protocols (never DIY). Standard library for trivial helpers (no micro-packages for clamps/slugs).
|
|
40
|
+
- 4-Pillar audit: transitive dependency tree, maintenance vitality, native types, permissive license (MIT/Apache 2.0).
|
|
41
|
+
- Wrap external dependencies behind internal facades. Never leak 3rd-party types across call sites.
|
|
42
|
+
- **Context-Driven Security & Anti-Security-Theater**:
|
|
43
|
+
- Match security to runtime tier (Tier 1 CLI path/exec safety, Tier 2 web bundle/XSS, Tier 3 multi-tenant IDOR/error masking, Tier 4 FinTech timing/audit).
|
|
44
|
+
- Never block paste (support password managers); silent refresh & draft preservation; ban captive captchas on initial logins.
|
|
45
|
+
- **Earned Regionality & Temporal Integrity**:
|
|
46
|
+
- Level 0: UTF-8, UTC in DB/wire, integer minor units + ISO 4217 for money, flexible names. Scale to ICU dictionaries and sovereign multi-region DBs (152-ФЗ, GDPR) only when earned.
|
|
47
|
+
- **Cache, Memory & Resource Hygiene**:
|
|
48
|
+
- Mandatory bounded LRU caches (`maxSize`) and TTL (`ttlMs`); tenant-scoped cache keys; invalidate on DB mutation.
|
|
49
|
+
- Guaranteed temp file cleanup (`try...finally`); atomic file writes (`file.tmp` -> `file`); streams with backpressure for payloads > 10MB.
|
|
50
|
+
- **Search Before You Create**: Grep the existing files in the repo before adding a new utility, helper function, hook, or model. Always reuse or extend existing code.
|
|
51
|
+
- **Blast Radius Analysis**: Inspect all files referencing a symbol before modifying shared signatures. Keep changes backward-compatible whenever possible.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 3. The 4 Mandatory States & The 3 AM Test
|
|
56
|
+
|
|
57
|
+
- **The 4 States**: Every user flow and API route must handle:
|
|
58
|
+
1. Empty State (clear CTA when 0 items exist)
|
|
59
|
+
2. Loading State (predictable skeleton/spinner)
|
|
60
|
+
3. Error State (actionable error message with retry)
|
|
61
|
+
4. Degraded / Offline State (graceful fallback)
|
|
62
|
+
- **The 3 AM Test**:
|
|
63
|
+
- Prefer early returns and flat guard clauses over nested `if/else` ladders.
|
|
64
|
+
- Use descriptive intermediate variables instead of opaque multi-level chained expressions.
|
|
65
|
+
- Eradicate AI generative slop: do not write gratuitous helper classes or bloated factory patterns.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 4. Test-Driven Development (TDD) & Chaos Monkey
|
|
70
|
+
|
|
71
|
+
- When fixing bugs: write a reproduction test first -> observe failure -> fix -> observe pass.
|
|
72
|
+
- When writing tests, include Chaos Monkey edge cases:
|
|
73
|
+
- Empty and boundary inputs
|
|
74
|
+
- Hostile Unicode strings and special characters
|
|
75
|
+
- Rapid repeated invocations (debouncing/idempotency)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "qed",
|
|
3
|
+
"displayName": "Q.E.D. Engineering Standard",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "High-Assurance Engineering Standard: Evidence Before Assertions, Blast Radius Analysis, Anti-Duplication, and Ironclad TDD.",
|
|
6
|
+
"logo": "https://www.gstatic.com/antigravity/logos/antigravity-icon__full-color.png",
|
|
7
|
+
"suggestedPrompts": [
|
|
8
|
+
"Check the blast radius before implementing this change",
|
|
9
|
+
"Run the Q.E.D. verification gate and show evidence"
|
|
10
|
+
],
|
|
11
|
+
"category": "Developer Tools",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"antigravity",
|
|
14
|
+
"qed",
|
|
15
|
+
"tdd",
|
|
16
|
+
"blast-radius",
|
|
17
|
+
"anti-duplication",
|
|
18
|
+
"verification-gate",
|
|
19
|
+
"quality-over-speed"
|
|
20
|
+
],
|
|
21
|
+
"author": {
|
|
22
|
+
"name": "Q.E.D. Engineering Team",
|
|
23
|
+
"url": "https://github.com/keelbismark/qed"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/keelbismark/qed",
|
|
26
|
+
"repository": "https://github.com/keelbismark/qed",
|
|
27
|
+
"license": "MIT"
|
|
28
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Q.E.D. Lite for Google Antigravity
|
|
2
|
+
# Drop as GEMINI.md or GEMINI.lite.md in repo root or ~/.gemini/
|
|
3
|
+
|
|
4
|
+
This agent operates strictly under the Q.E.D. High-Assurance Engineering Standard:
|
|
5
|
+
|
|
6
|
+
## 0. Prime Directive: Evidence Before Assertions
|
|
7
|
+
- Never declare a task complete without executing verification tests and verifying clean output via tool commands.
|
|
8
|
+
- Root Cause Only: Zero empty catch blocks, zero arbitrary timeouts, zero loose `any` casts.
|
|
9
|
+
- Pristine Root Invariant: Zero scratch files or temporary dumps in root directory.
|
|
10
|
+
- Dual Modes: Mode A (Default: Quality > Speed — full TDD & verification); Mode B (Speed > Quality — only on explicit request: "quick", "prototype", "draft", "быстро" — requires debt disclosure).
|
|
11
|
+
|
|
12
|
+
## 1. Specification, Anti-Duplication & Blast Radius
|
|
13
|
+
- Search Before Create: Grep codebase before introducing any new helper, utility, or type. Always reuse existing abstractions.
|
|
14
|
+
- Blast Radius: Map direct callers and transitive API/DB/cache impact before modifying shared code.
|
|
15
|
+
- Zero Secret Leaks: Never hardcode credentials. Keep `.env.example` updated. Parameterized queries only.
|
|
16
|
+
- Resource Hygiene: Bounded LRU cache (`maxSize` + `ttlMs`). Scoped temp file deletion in `try...finally`. Atomic file writes (`file.tmp` -> `file`). Streams for >10MB.
|
|
17
|
+
|
|
18
|
+
## 2. Adversarial QA & The 4 Mandatory States
|
|
19
|
+
Every UI view and API route must implement:
|
|
20
|
+
1. Empty State (0 items + clear next step)
|
|
21
|
+
2. Loading State (predictable indicator, zero CLS)
|
|
22
|
+
3. Error State (actionable message + retry button)
|
|
23
|
+
4. Degraded / Offline State (graceful fallback under network timeout/partition)
|
|
24
|
+
|
|
25
|
+
## 3. Ironclad TDD & The 3 AM Test
|
|
26
|
+
- Bugs: Write reproduction test first -> verify Red -> minimal fix -> verify Green -> refactor.
|
|
27
|
+
- Features: Unit/integration tests reflecting acceptance criteria before code.
|
|
28
|
+
- Testing Rules: Zero placebo mocks; zero flaky `sleep()`; cover boundary matrix (0, 1, N, Max, null, hostile Unicode `👨👩👧👦`, double-clicks in 50ms).
|
|
29
|
+
- The 3 AM Test: Early returns, flat guard clauses, descriptive intermediate variables.
|
|
30
|
+
- Semantic Naming & Clean Comments: Positive booleans (`isActive`), units in numbers (`timeoutMs`), contract verbs (`get`, `create`). Comment WHY, never WHAT. Actionable `TODO(#issueId)` only.
|
|
31
|
+
|
|
32
|
+
## 4. Verification Gate
|
|
33
|
+
Before declaring completion:
|
|
34
|
+
1. Pre-commit sweep: purge debug prints (`console.log`, `print`, `debugger`), temp files, dead imports.
|
|
35
|
+
2. Run typecheck, linter, and full test suite.
|
|
36
|
+
3. Verify 100% pass and clean git diff matching acceptance criteria.
|