invar-tools 1.4.0__py3-none-any.whl → 1.6.0__py3-none-any.whl

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.
Files changed (34) hide show
  1. invar/__init__.py +7 -1
  2. invar/core/entry_points.py +12 -10
  3. invar/core/formatter.py +21 -1
  4. invar/core/models.py +98 -0
  5. invar/core/patterns/__init__.py +53 -0
  6. invar/core/patterns/detector.py +249 -0
  7. invar/core/patterns/p0_exhaustive.py +207 -0
  8. invar/core/patterns/p0_literal.py +307 -0
  9. invar/core/patterns/p0_newtype.py +211 -0
  10. invar/core/patterns/p0_nonempty.py +307 -0
  11. invar/core/patterns/p0_validation.py +278 -0
  12. invar/core/patterns/registry.py +234 -0
  13. invar/core/patterns/types.py +167 -0
  14. invar/core/trivial_detection.py +189 -0
  15. invar/mcp/server.py +4 -0
  16. invar/shell/commands/guard.py +100 -8
  17. invar/shell/config.py +46 -0
  18. invar/shell/contract_coverage.py +358 -0
  19. invar/shell/guard_output.py +15 -0
  20. invar/shell/pattern_integration.py +234 -0
  21. invar/shell/testing.py +13 -2
  22. invar/templates/CLAUDE.md.template +18 -10
  23. invar/templates/config/CLAUDE.md.jinja +52 -30
  24. invar/templates/config/context.md.jinja +14 -0
  25. invar/templates/protocol/INVAR.md +1 -0
  26. invar/templates/skills/develop/SKILL.md.jinja +51 -1
  27. invar/templates/skills/review/SKILL.md.jinja +196 -31
  28. {invar_tools-1.4.0.dist-info → invar_tools-1.6.0.dist-info}/METADATA +12 -8
  29. {invar_tools-1.4.0.dist-info → invar_tools-1.6.0.dist-info}/RECORD +34 -22
  30. {invar_tools-1.4.0.dist-info → invar_tools-1.6.0.dist-info}/WHEEL +0 -0
  31. {invar_tools-1.4.0.dist-info → invar_tools-1.6.0.dist-info}/entry_points.txt +0 -0
  32. {invar_tools-1.4.0.dist-info → invar_tools-1.6.0.dist-info}/licenses/LICENSE +0 -0
  33. {invar_tools-1.4.0.dist-info → invar_tools-1.6.0.dist-info}/licenses/LICENSE-GPL +0 -0
  34. {invar_tools-1.4.0.dist-info → invar_tools-1.6.0.dist-info}/licenses/NOTICE +0 -0
@@ -12,6 +12,24 @@
12
12
  | **Shell** | Returns `Result[T, E]` from `returns` library |
13
13
  | **Flow** | USBV: Understand → Specify → Build → Validate |
14
14
 
15
+ ### Contract Rules (CRITICAL)
16
+
17
+ ```python
18
+ # ❌ WRONG: Lambda must include ALL parameters
19
+ @pre(lambda x: x >= 0)
20
+ def calc(x: int, y: int = 0): ...
21
+
22
+ # ✅ CORRECT: Include defaults too
23
+ @pre(lambda x, y=0: x >= 0)
24
+ def calc(x: int, y: int = 0): ...
25
+
26
+ # ❌ WRONG: @post cannot access parameters
27
+ @post(lambda result: result > x) # 'x' not available!
28
+
29
+ # ✅ CORRECT: @post only sees 'result'
30
+ @post(lambda result: result >= 0)
31
+ ```
32
+
15
33
  <!--/invar:critical-->
16
34
 
17
35
  <!--invar:managed version="{{ version }}"-->
@@ -19,28 +37,13 @@
19
37
 
20
38
  > **Protocol:** Follow [INVAR.md](./INVAR.md) — includes Check-In, USBV workflow, and Task Completion requirements.
21
39
 
22
- ## Check-In (DX-54)
40
+ ## Check-In
23
41
 
24
- Your first message MUST display:
42
+ > See [INVAR.md#check-in](./INVAR.md#check-in-required) for full protocol.
25
43
 
26
- ```
27
- ✓ Check-In: [project] | [branch] | [clean/dirty]
28
- ```
44
+ **Your first message MUST display:** `✓ Check-In: [project] | [branch] | [clean/dirty]`
29
45
 
30
- Actions:
31
- 1. Read `.invar/context.md` (Key Rules + Current State + Lessons Learned)
32
- 2. Show one-line status
33
-
34
- Example:
35
- ```
36
- ✓ Check-In: MyProject | main | clean
37
- ```
38
-
39
- **Do NOT execute guard or map at Check-In.**
40
- Guard is for VALIDATE phase and Final only.
41
-
42
- This is your sign-in. The user sees it immediately.
43
- No visible check-in = Session not started.
46
+ **Actions:** Read `.invar/context.md`, then show status. Do NOT run guard at Check-In.
44
47
 
45
48
  ---
46
49
 
@@ -79,6 +82,14 @@ src/{project}/
79
82
  | Core | `@pre`/`@post` + doctests, pure (no I/O) |
80
83
  | Shell | Returns `Result[T, E]` from `returns` library |
81
84
 
85
+ ### Core vs Shell (Edge Cases)
86
+
87
+ - File/network/env vars → **Shell**
88
+ - `datetime.now()`, `random` → **Inject param** OR Shell
89
+ - Pure logic → **Core**
90
+
91
+ > Full decision tree: [INVAR.md#core-shell](./INVAR.md#decision-tree-core-vs-shell)
92
+
82
93
  ## Documentation Structure
83
94
 
84
95
  | File | Owner | Edit? | Purpose |
@@ -86,8 +97,11 @@ src/{project}/
86
97
  | INVAR.md | Invar | No | Protocol (`invar update` to sync) |
87
98
  | CLAUDE.md | User | Yes | Project customization (this file) |
88
99
  | .invar/context.md | User | Yes | Project state, lessons learned |
100
+ | .invar/project-additions.md | User | Yes | Project rules → injected into CLAUDE.md |
89
101
  | .invar/examples/ | Invar | No | **Must read:** Core/Shell patterns, workflow |
90
102
 
103
+ > **Before writing code:** Check Task Router in `.invar/context.md`
104
+
91
105
  ## Visible Workflow (DX-30)
92
106
 
93
107
  For complex tasks (3+ functions), show 3 checkpoints in TodoList:
@@ -158,18 +172,26 @@ Guard triggers `review_suggested` for: security-sensitive files, escape hatches
158
172
 
159
173
  ## Workflow Routing (MANDATORY)
160
174
 
161
- When user message contains these triggers, you MUST invoke the corresponding skill:
175
+ When user message contains these triggers, you MUST use the **Skill tool** to invoke the skill:
176
+
177
+ | Trigger Words | Skill Tool Call | Notes |
178
+ |---------------|-----------------|-------|
179
+ | "review", "review and fix" | `Skill(skill="review")` | Adversarial review with fix loop |
180
+ | "implement", "add", "fix", "update" | `Skill(skill="develop")` | Unless in review context |
181
+ | "why", "explain", "investigate" | `Skill(skill="investigate")` | Research mode, no code changes |
182
+ | "compare", "should we", "design" | `Skill(skill="propose")` | Decision facilitation |
183
+
184
+ **⚠️ CRITICAL: You must call the Skill tool, not just follow the workflow mentally.**
162
185
 
163
- | Trigger Words | Skill | Notes |
164
- |---------------|-------|-------|
165
- | "review", "review and fix" | `/review` | Adversarial review with fix loop |
166
- | "implement", "add", "fix", "update" | `/develop` | Unless in review context |
167
- | "why", "explain", "investigate" | `/investigate` | Research mode, no code changes |
168
- | "compare", "should we", "design" | `/propose` | Decision facilitation |
186
+ The Skill tool reads `.claude/skills/<skill>/SKILL.md` which contains:
187
+ - Detailed phase instructions (USBV breakdown)
188
+ - Error handling rules
189
+ - Timeout policies
190
+ - Incremental development patterns (DX-63)
169
191
 
170
192
  **Violation check (before writing ANY code):**
171
- - "Am I in a workflow?"
172
- - "Did I invoke the correct skill?"
193
+ - "Did I call `Skill(skill="...")`?"
194
+ - "Am I following the SKILL.md instructions?"
173
195
 
174
196
  ---
175
197
 
@@ -204,7 +226,7 @@ enters /review. Say "skip" to bypass.
204
226
  <!--invar:project-->
205
227
  <!-- ========================================================================
206
228
  PROJECT REGION - INVAR PROJECT ONLY
207
- This section is populated by .invar/project-additions.md via sync-self.
229
+ This section is populated by .invar/project-additions.md via `invar dev sync`.
208
230
  For other projects, this region remains empty.
209
231
  ======================================================================== -->
210
232
  <!--/invar:project-->
@@ -213,7 +235,7 @@ enters /review. Say "skip" to bypass.
213
235
  <!-- ========================================================================
214
236
  USER REGION - EDITABLE
215
237
  Add your team conventions and project-specific rules below.
216
- This section is preserved across invar update and sync-self.
238
+ This section is preserved across `invar update` and `invar dev sync`.
217
239
  ======================================================================== -->
218
240
  <!--/invar:user-->
219
241
 
@@ -27,6 +27,20 @@
27
27
  {% endif -%}
28
28
  - Final must show: `✓ Final: guard PASS | ...`
29
29
 
30
+ ## Task Router (DX-62)
31
+
32
+ <!-- Before writing code, check this table -->
33
+
34
+ | If you are about to... | STOP and read first |
35
+ |------------------------|---------------------|
36
+ | Write code in `core/` | `.invar/examples/contracts.py` |
37
+ | Write code in `shell/` | `.invar/examples/core_shell.py` |
38
+ | Add `@pre`/`@post` contracts | `.invar/examples/contracts.py` |
39
+ | Use functional patterns | `.invar/examples/functional.py` |
40
+ | Implement a feature | `.invar/examples/workflow.md` |
41
+
42
+ **Rule:** Match found above? Read the file BEFORE writing code.
43
+
30
44
  ## Self-Reminder
31
45
 
32
46
  <!-- DX-54: AI should re-read this file periodically -->
@@ -267,6 +267,7 @@ invar guard # Full: static + doctests + CrossHair + Hypothesis
267
267
  invar guard --static # Static only (quick debug, ~0.5s)
268
268
  invar guard --changed # Modified files only
269
269
  invar guard --coverage # Collect branch coverage
270
+ invar guard -c # Contract coverage only (DX-63)
270
271
  invar sig <file> # Show contracts + signatures
271
272
  invar map --top 10 # Most-referenced symbols
272
273
  invar rules # List all rules with detection/hints (JSON)
@@ -17,7 +17,8 @@ _invar:
17
17
 
18
18
  Before any workflow action:
19
19
  1. Read `.invar/context.md` (especially Key Rules section)
20
- 2. Display routing announcement
20
+ 2. **Check Task Router** — read examples before coding in `core/` or `shell/`
21
+ 3. Display routing announcement
21
22
 
22
23
  ### Routing Announcement
23
24
 
@@ -71,6 +72,55 @@ def calculate(x: int) -> int:
71
72
  ... # Implementation comes in BUILD
72
73
  ```
73
74
 
75
+ #### Function-Level Gates (DX-63)
76
+
77
+ When creating new modules, use **incremental development**:
78
+
79
+ 1. Create ONE file
80
+ 2. Write contracts for all functions (body = `...`)
81
+ {% if syntax == "mcp" -%}
82
+ 3. Run `invar_guard(contracts_only=true)` to verify coverage
83
+ {% else -%}
84
+ 3. Run `invar guard -c <file>` to verify coverage
85
+ {% endif -%}
86
+ 4. Implement functions
87
+ {% if syntax == "mcp" -%}
88
+ 5. Run `invar_guard(changed=true)`
89
+ {% else -%}
90
+ 5. Run `invar guard --changed`
91
+ {% endif -%}
92
+ 6. Proceed to next file
93
+
94
+ ❌ Do NOT create multiple file skeletons at once
95
+ ❌ Do NOT "structure first, fill later"
96
+
97
+ **TodoList Pattern: Interleaved SPECIFY/BUILD**
98
+
99
+ For each function:
100
+ ```
101
+ □ [SPECIFY] Write contract for validate_input
102
+ □ [BUILD] Implement validate_input
103
+ □ [SPECIFY] Write contract for process_data
104
+ □ [BUILD] Implement process_data
105
+ ```
106
+
107
+ NOT:
108
+ ```
109
+ □ [SPECIFY] Write all contracts
110
+ □ [BUILD] Implement all functions
111
+ ```
112
+
113
+ **Violation Self-Check** — Before writing ANY implementation code:
114
+ 1. "Have I written the contract for THIS function?"
115
+ 2. "Have I shown it in my response?"
116
+ {% if syntax == "mcp" -%}
117
+ 3. "Have I run `invar_guard(contracts_only=true)`?"
118
+ {% else -%}
119
+ 3. "Have I run `invar guard -c`?"
120
+ {% endif -%}
121
+
122
+ If any NO → Stop. Write contract first.
123
+
74
124
  ### 3. BUILD
75
125
 
76
126
  **For complex tasks:** Enter Plan Mode first, get user approval.
@@ -1,29 +1,91 @@
1
1
  ---
2
2
  name: review
3
- description: Adversarial code review with fix loop. Use after development, when Guard reports review_suggested, or user explicitly requests review. Finds issues that automated verification misses. Supports isolated mode (sub-agent) and quick mode (same context).
3
+ description: Fault-finding code review with REJECTION-FIRST mindset and AUTO-LOOP. Code is GUILTY until proven INNOCENT. Automatically cycles Reviewer→Fixer→Reviewer until quality_met or max_rounds. No human confirmation needed between roles.
4
4
  _invar:
5
5
  version: "{{ version }}"
6
6
  managed: skill
7
7
  ---
8
8
  <!--invar:skill-->
9
9
 
10
- # Review Mode
10
+ # Review Mode (Fault-Finding with Auto-Loop)
11
11
 
12
12
  > **Purpose:** Find problems that Guard, doctests, and property tests missed.
13
- > **Mindset:** Adversarial. Your success is measured by problems found, not code approved.
13
+ > **Mindset:** REJECTION-FIRST. Code is GUILTY until proven INNOCENT.
14
+ > **Success Metric:** Issues FOUND, not code approved. Zero issues = you failed to look hard enough.
15
+ > **Workflow:** AUTOMATIC Reviewer↔Fixer loop until quality_met or max_rounds (no human confirmation).
14
16
 
15
- ## Adversarial Reviewer Persona
17
+ ## Auto-Loop Configuration
18
+
19
+ ```
20
+ MAX_ROUNDS = 5 # Maximum review-fix cycles
21
+ AUTO_TRANSITION = true # No human confirmation between roles
22
+ ```
23
+
24
+ ## Prime Directive: Reject Until Proven Correct
25
+
26
+ **You are the PROSECUTOR, not the defense attorney.**
27
+
28
+ | Trap | Reality Check |
29
+ |------|---------------|
30
+ | "Seems fine" | You failed to find the bug |
31
+ | "Makes sense" | You're rationalizing, not reviewing |
32
+ | "Edge case is unlikely" | Edge cases ARE bugs |
33
+ | "Comment explains it" | Comments don't fix code |
34
+ | "Assessed as acceptable" | "Assessed" ≠ "Fixed" |
35
+
36
+ ## Role Separation (CRITICAL)
37
+
38
+ **You play TWO distinct roles that cycle AUTOMATICALLY:**
39
+
40
+ | Role | Allowed Actions | Forbidden |
41
+ |------|-----------------|-----------|
42
+ | **REVIEWER** | Find issues, judge fixes, declare quality_met | Write code, rationalize issues |
43
+ | **FIXER** | Implement fixes only | Declare quality_met, dismiss issues |
44
+
45
+ **Role Transition Markers (REQUIRED):**
46
+
47
+ ```
48
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
49
+ 🔍 REVIEWER [Round N] — Finding issues
50
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
51
+
52
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
53
+ 🔧 FIXER [Round N] — Implementing fixes
54
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
55
+
56
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
57
+ ✅ REVIEWER [Round N] — Verifying fixes
58
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
59
+ ```
60
+
61
+ ## Quality Gate Authority
62
+
63
+ **ONLY the Reviewer role can declare `quality_met`.**
64
+
65
+ Before declaring exit:
66
+ 1. Re-read EVERY issue found
67
+ 2. For each issue, verify: "Is this ACTUALLY fixed, or did I rationalize it?"
68
+ 3. Ask: "Would I accept this excuse from someone else's code?"
69
+
70
+ **Self-Check Questions:**
71
+ - Did I write code AND declare quality_met? → Role confusion detected
72
+ - Did I say "assessed" instead of "fixed"? → Rationalization detected
73
+ - Did any MAJOR become a comment instead of code? → Fix failed
74
+
75
+ ## Fault-Finding Persona
16
76
 
17
77
  Assume:
18
78
  - The code has bugs until proven otherwise
19
79
  - The contracts may be meaningless ceremony
20
80
  - The implementer may have rationalized poor decisions
21
81
  - Escape hatches may be abused
82
+ - **Your own fixes may introduce new bugs**
22
83
 
23
84
  You ARE here to:
24
85
  - Find bugs, logic errors, edge cases
25
86
  - Challenge whether contracts have semantic value
26
87
  - Check if code matches contracts (not if code "seems right")
88
+ - **RE-VERIFY fixes, not trust them**
27
89
 
28
90
  ## Entry Actions
29
91
 
@@ -117,46 +179,149 @@ These are checked by Guard or linters - don't duplicate:
117
179
  - Entry point thickness → Guard (entry_point_too_thick)
118
180
  - Escape hatch count → Guard (review_suggested)
119
181
 
120
- ## Review-Fix Loop
182
+ ## Auto-Loop Workflow (NO HUMAN CONFIRMATION)
183
+
184
+ **The loop runs AUTOMATICALLY until exit condition is met.**
121
185
 
122
186
  ```
123
- Round 1: Review → Find issues
124
-
125
- Fix CRITICAL + MAJOR (MINOR → backlog)
126
-
127
- Round 2: Re-review (if needed)
128
-
129
- Convergence check:
130
- - No CRITICAL/MAJOR Exit ✓
131
- - No improvementExit (warn)
132
- - Round >= 3 Exit (max)
187
+ ┌─────────────────────────────────────────────────────────────────┐
188
+ │ START: round = 1, issues = [] │
189
+ │ │
190
+ │ ┌─────────────────────────────────────────────────────────┐
191
+ │ │ 🔍 REVIEWER [Round N] │ │
192
+ │ │ 1. Find ALL issues (don't stop at first) │ │
193
+ │ │ 2. Classify: CRITICAL / MAJOR / MINOR │ │
194
+ │ │ 3. Add to issues table │ │
195
+ │ │ 4. IF no CRITICAL/MAJOR quality_met, EXIT │ │
196
+ │ │ 5. ELSE AUTO-TRANSITION to FIXER │ │
197
+ │ └─────────────────────────────────────────────────────────┘ │
198
+ │ ↓ (automatic) │
199
+ │ ┌─────────────────────────────────────────────────────────┐ │
200
+ │ │ 🔧 FIXER [Round N] │ │
201
+ │ │ 1. Fix EACH CRITICAL/MAJOR issue with CODE │ │
202
+ │ │ 2. Run invar_guard() after fixes │ │
203
+ │ │ 3. NO declaring quality_met (forbidden) │ │
204
+ │ │ 4. AUTO-TRANSITION back to REVIEWER │ │
205
+ │ └─────────────────────────────────────────────────────────┘ │
206
+ │ ↓ (automatic) │
207
+ │ ┌─────────────────────────────────────────────────────────┐ │
208
+ │ │ ✅ REVIEWER [Round N] — Verification │ │
209
+ │ │ 1. Re-verify EACH fix: │ │
210
+ │ │ - Is fix CODE or just COMMENT? │ │
211
+ │ │ - Does fix actually address issue? │ │
212
+ │ │ - Did fix introduce new issues? │ │
213
+ │ │ 2. Update verification table │ │
214
+ │ │ 3. IF all CRITICAL/MAJOR fixed → quality_met, EXIT │ │
215
+ │ │ 4. IF round >= MAX_ROUNDS → max_rounds, EXIT │ │
216
+ │ │ 5. IF no progress → no_improvement, EXIT │ │
217
+ │ │ 6. ELSE → round++, LOOP to REVIEWER [Round N+1] │ │
218
+ │ └─────────────────────────────────────────────────────────┘ │
219
+ │ │
220
+ │ EXIT: Generate final report │
221
+ └─────────────────────────────────────────────────────────────────┘
133
222
  ```
134
223
 
224
+ ## Loop State Tracking
225
+
226
+ **Maintain this state throughout the loop:**
227
+
228
+ ```markdown
229
+ ## Review State
230
+ - **Round:** N / MAX_ROUNDS
231
+ - **Role:** REVIEWER | FIXER
232
+ - **Issues Found:** [count]
233
+ - **Issues Fixed:** [count]
234
+ - **Guard Status:** PASS | FAIL
235
+ ```
236
+
237
+ ## Verification Table (Updated Each Round)
238
+
239
+ | Issue ID | Severity | Round Found | Status | Evidence |
240
+ |----------|----------|-------------|--------|----------|
241
+ | MAJOR-1 | MAJOR | 1 | ✅ Fixed (R2) | Code change at line X |
242
+ | MAJOR-2 | MAJOR | 1 | ❌ Unfixed | Fix attempted but failed |
243
+ | MAJOR-3 | MAJOR | 2 | 🔄 New | Found during re-verification |
244
+ | ... | ... | ... | ... | ... |
245
+
246
+ **Status Legend:**
247
+ - ✅ Fixed (RN) — Actually fixed with code in round N
248
+ - ❌ Unfixed — Fix failed or was just a comment
249
+ - 🔄 New — Found during re-verification (new issue)
250
+ - ⏭️ Backlog — MINOR, deferred to later
251
+
252
+ If ANY ❌ exists for CRITICAL/MAJOR after MAX_ROUNDS → quality_not_met
253
+
135
254
  ## Severity Definitions
136
255
 
137
- | Level | Meaning | Examples |
138
- |-------|---------|----------|
139
- | CRITICAL | Security, data loss, crash | SQL injection, unhandled null |
140
- | MAJOR | Logic error, missing validation | Wrong calculation, no bounds |
141
- | MINOR | Style, documentation | Naming, missing docstring |
256
+ | Level | Meaning | Examples | Exit Blocker? |
257
+ |-------|---------|----------|---------------|
258
+ | CRITICAL | Security, data loss, crash | SQL injection, unhandled null | **YES** |
259
+ | MAJOR | Logic error, missing validation | Wrong calculation, no bounds | **YES** |
260
+ | MINOR | Style, documentation | Naming, missing docstring | No (backlog) |
261
+
262
+ ## Exit Conditions (Auto-Loop)
142
263
 
143
- ## Exit Report
264
+ **Exit triggers (checked automatically after each REVIEWER phase):**
265
+
266
+ | Condition | Exit Reason | Result |
267
+ |-----------|-------------|--------|
268
+ | All CRITICAL/MAJOR fixed | `quality_met` | ✅ Ready for merge |
269
+ | Round >= MAX_ROUNDS | `max_rounds` | ⚠️ Manual review needed |
270
+ | No progress (same issues 2 rounds) | `no_improvement` | ❌ Architectural issue |
271
+ | Guard fails after fix | Continue loop | 🔄 More fixes needed |
272
+
273
+ **quality_met requires ALL of:**
274
+ 1. Zero CRITICAL issues remaining
275
+ 2. Zero MAJOR issues remaining (not "assessed", actually FIXED)
276
+ 3. Verification table completed with evidence for each fix
277
+ 4. Guard passes after all fixes
278
+
279
+ **Automatic quality_not_met:**
280
+ - Any MAJOR "fixed" with comment instead of code
281
+ - Any issue marked "assessed" or "acceptable"
282
+ - Fixer role declared quality_met (role violation)
283
+ - Infinite loop detected (no progress)
284
+
285
+ ## Exit Report (Generated Automatically)
144
286
 
145
287
  ```markdown
146
- ### Review Complete
288
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
289
+ 📋 REVIEW COMPLETE
290
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
291
+
292
+ **Exit Reason:** quality_met | max_rounds | no_improvement
293
+ **Total Rounds:** N / MAX_ROUNDS
294
+ **Guard Status:** PASS | FAIL
295
+
296
+ ## Verification Table
297
+
298
+ | Issue | Severity | Round | Status | Evidence |
299
+ |-------|----------|-------|--------|----------|
300
+ | MAJOR-1 | MAJOR | 1→2 | ✅ Fixed | Code at file.py:123 |
301
+ | ... | ... | ... | ... | ... |
302
+
303
+ ## Statistics
304
+
305
+ - Issues Found: X
306
+ - Issues Fixed: Y
307
+ - Fix Rate: Y/X (Z%)
308
+ - New Issues from Fixes: N
309
+
310
+ ## Self-Check (Reviewer Final)
147
311
 
148
- **Rounds:** [N]
149
- **Exit reason:** quality_met | max_rounds | no_improvement
312
+ - [x] All fixes are CODE, not comments
313
+ - [x] No "assessed as acceptable" rationalizations
314
+ - [x] Guard passes after all changes
315
+ - [x] Role separation maintained throughout
150
316
 
151
- **Fixed:**
152
- - [list of fixed issues]
317
+ ## Recommendation
153
318
 
154
- **Remaining (MINOR - backlog):**
155
- - [list for later]
319
+ - [x] Ready for merge (quality_met)
320
+ - [ ] Needs manual review (max_rounds)
321
+ - [ ] Architectural refactor needed (no_improvement)
156
322
 
157
- **Recommendation:**
158
- - [ ] Ready for merge
159
- - [ ] Needs more work: [issues]
323
+ **MINOR (Backlog):**
324
+ - [list deferred items]
160
325
  ```
161
326
  <!--/invar:skill-->
162
327
  <!--invar:extensions-->
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: invar-tools
3
- Version: 1.4.0
3
+ Version: 1.6.0
4
4
  Summary: AI-native software engineering tools with design-by-contract verification
5
5
  Project-URL: Homepage, https://github.com/tefx/invar
6
6
  Project-URL: Documentation, https://github.com/tefx/invar#readme
@@ -61,6 +61,10 @@ agents write code that's correct by construction—not by accident.
61
61
  <a href="#license"><img src="https://img.shields.io/badge/License-Apache%202.0%20%2B%20GPL--3.0-blue.svg" alt="License"></a>
62
62
  </p>
63
63
 
64
+ <p align="center">
65
+ <a href="#why-invar"><img src="https://img.shields.io/badge/🤖_Dogfooding-Invar's_code_is_100%25_AI--generated_and_AI--verified_using_itself-8A2BE2?style=for-the-badge" alt="Dogfooding"></a>
66
+ </p>
67
+
64
68
  ### What It Looks Like
65
69
 
66
70
  An AI agent, guided by Invar, writes code with formal contracts and built-in tests:
@@ -111,10 +115,10 @@ Guard passed.
111
115
  ┌───────────────────────────────────────────────────────────────────┐
112
116
  │ Your Project │
113
117
  │ ├── pyproject.toml │
114
- │ │ └── dependencies = ["invar-runtime"] ← Ships with code
118
+ │ │ └── dependencies = ["invar-runtime"] ← Ships with code
115
119
  │ │ │
116
120
  │ └── Development (never enters production) │
117
- │ └── uvx invar-tools guard ← Guides agents
121
+ │ └── uvx invar-tools guard ← Guides agents
118
122
  └───────────────────────────────────────────────────────────────────┘
119
123
  ```
120
124
 
@@ -244,10 +248,10 @@ Guard provides fast feedback. Agent sees errors, fixes immediately:
244
248
  | **Symbolic** | CrossHair | ~30s | Mathematical proof of contracts |
245
249
 
246
250
  ```
247
- ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
251
+ ┌──────────┐ ┌───────────┐ ┌───────────┐ ┌────────────┐
248
252
  │ ⚡ Static │ → │ 🧪 Doctest│ → │ 🎲 Property│ → │ 🔬 Symbolic│
249
- │ ~0.5s │ │ ~2s │ │ ~10s │ │ ~30s
250
- └──────────┘ └──────────┘ └──────────┘ └──────────┘
253
+ │ ~0.5s │ │ ~2s │ │ ~10s │ │ ~30s
254
+ └──────────┘ └───────────┘ └───────────┘ └────────────┘
251
255
  ```
252
256
 
253
257
  ```
@@ -268,8 +272,8 @@ The USBV workflow forces "specify before implement":
268
272
 
269
273
  ```
270
274
  🔍 Understand → 📝 Specify → 🔨 Build → ✓ Validate
271
- │ │ │ │
272
- Context Contracts Code Guard
275
+ │ │ │ │
276
+ Context Contracts Code Guard
273
277
  ```
274
278
 
275
279
  Skill routing ensures agents enter through the correct workflow: