invar-tools 1.14.0__py3-none-any.whl → 1.15.1__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.
@@ -16,6 +16,46 @@ The `/invar-reflect` skill can be triggered:
16
16
 
17
17
  ## Proposed Hook Schema
18
18
 
19
+
20
+ ### Message Count Trigger (Implemented - DX-79)
21
+
22
+ **Status**: ✅ Implemented in v1.15.0
23
+
24
+ Both Claude Code and Pi now support automatic feedback triggering via **message count threshold**.
25
+
26
+ **Configuration in `.claude/settings.local.json`**:
27
+
28
+ ```json
29
+ {
30
+ "feedback": {
31
+ "enabled": true,
32
+ "min_messages": 30
33
+ }
34
+ }
35
+ ```
36
+
37
+ **Hook Parameters**:
38
+
39
+ | Parameter | Type | Default | Description |
40
+ |-----------|------|---------|-------------|
41
+ | `enabled` | boolean | true | Enable feedback collection |
42
+ | `min_messages` | number | 30 | Minimum messages before trigger |
43
+
44
+ **How it works**:
45
+
46
+ 1. **Message counting**: Both hooks track message count per session
47
+ 2. **Threshold trigger**: At `min_messages`, hook displays reminder
48
+ 3. **User action**: Agent sees reminder and can run `/invar-reflect`
49
+
50
+ **Cross-platform implementation**:
51
+
52
+ | Platform | Hook File | Mechanism |
53
+ |----------|-----------|-----------|
54
+ | **Claude Code** | `.claude/hooks/invar.UserPromptSubmit.sh` | Bash script with jq config parsing |
55
+ | **Pi** | `.pi/hooks/invar.ts` | TypeScript with fs config reading |
56
+
57
+ Both read the same `.claude/settings.local.json` configuration file.
58
+
19
59
  ### PostTaskCompletion Hook (Waiting for Claude Code Support)
20
60
 
21
61
  **Proposed configuration in `.claude/settings.json`**:
@@ -69,24 +109,46 @@ The `/invar-reflect` skill can be triggered:
69
109
 
70
110
  ## Triggering Conditions
71
111
 
72
- The hook triggers when **ALL** conditions are met:
73
112
 
74
- 1. **Task completed** - User finished major work (natural stopping point)
75
- 2. ✅ **Message count >= 30** - Sufficient context for meaningful feedback
76
- 3. ✅ **Duration >= 2 hours** - Non-trivial session (avoids quick fixes)
113
+ The hook triggers when the message count reaches the configured threshold (default: 30).
77
114
 
78
- **No hard frequency cap**: Same-day sessions merge into single file (see SKILL.md for merge logic).
115
+ **Conditions**:
79
116
 
80
- ---
117
+ 1. ✅ **Message count >= min_messages** (default: 30)
118
+ 2. ✅ **Feedback enabled** (`feedback.enabled = true`)
119
+
120
+ **No hard frequency cap**: Users can run `/invar-reflect` manually at any time.
121
+
122
+ **Customizing threshold**:
123
+
124
+ ```json
125
+ {
126
+ "feedback": {
127
+ "enabled": true,
128
+ "min_messages": 50 // Trigger at 50 messages instead of 30
129
+ }
130
+ }
131
+ ```
81
132
 
82
133
  ## Silent Mode
83
134
 
84
- When `mode: "silent"`:
85
- - Feedback generation runs in background
86
- - No interruption to current conversation
87
- - User sees notification only: `✓ Feedback saved to .invar/feedback/feedback-{date}.md`
88
135
 
89
- ---
136
+ The hook displays a **reminder** when the threshold is reached:
137
+
138
+ ```
139
+ <system-reminder>
140
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
141
+ 📊 Invar: Auto-triggering usage feedback (30 messages)
142
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
143
+
144
+ Session has reached 30 messages. Consider running /invar-reflect
145
+ to generate usage feedback.
146
+
147
+ To disable: Set feedback.enabled=false in .claude/settings.local.json
148
+ </system-reminder>
149
+ ```
150
+
151
+ **Note**: The agent sees this reminder and can choose to invoke `/invar-reflect` or continue working.
90
152
 
91
153
  ## User Control
92
154
 
@@ -144,7 +206,68 @@ rm .invar/feedback/feedback-2026-01-03.md
144
206
 
145
207
  ## Workaround: Using Stop Hook (Until PostTaskCompletion is Available)
146
208
 
147
- Since Claude Code doesn't yet support `PostTaskCompletion` hook, you can use the `Stop` hook as a temporary workaround.
209
+
210
+ ### Implementation Details
211
+
212
+ **Claude Code Hook** (`.claude/hooks/invar.UserPromptSubmit.sh`):
213
+
214
+ ```bash
215
+ # DX-79: Feedback trigger at threshold
216
+ FEEDBACK_ENABLED=true
217
+ MIN_MESSAGES=30
218
+
219
+ if [[ -f ".claude/settings.local.json" ]]; then
220
+ if command -v jq &> /dev/null; then
221
+ FEEDBACK_ENABLED=$(jq -r '.feedback.enabled // true' .claude/settings.local.json)
222
+ MIN_MESSAGES=$(jq -r '.feedback.min_messages // 30' .claude/settings.local.json)
223
+ fi
224
+ fi
225
+
226
+ if [[ "$FEEDBACK_ENABLED" == "true" && $COUNT -eq $MIN_MESSAGES ]]; then
227
+ echo "<system-reminder>"
228
+ echo "📊 Invar: Auto-triggering usage feedback ($COUNT messages)"
229
+ echo "Consider running /invar-reflect to generate usage feedback."
230
+ echo "</system-reminder>"
231
+ fi
232
+ ```
233
+
234
+ **Pi Hook** (`.pi/hooks/invar.ts`):
235
+
236
+ ```typescript
237
+ // DX-79: Helper to read feedback configuration
238
+ function readFeedbackConfig() {
239
+ try {
240
+ const fs = require("fs");
241
+ const settingsPath = ".claude/settings.local.json";
242
+ if (fs.existsSync(settingsPath)) {
243
+ const settings = JSON.parse(fs.readFileSync(settingsPath, "utf-8"));
244
+ return {
245
+ enabled: settings.feedback?.enabled ?? true,
246
+ min_messages: settings.feedback?.min_messages ?? 30,
247
+ };
248
+ }
249
+ } catch {
250
+ // Ignore errors, use defaults
251
+ }
252
+ return { enabled: true, min_messages: 30 };
253
+ }
254
+
255
+ pi.on("agent_start", async () => {
256
+ msgCount++;
257
+
258
+ // ... protocol refresh logic ...
259
+
260
+ const feedbackConfig = readFeedbackConfig();
261
+ if (msgCount === feedbackConfig.min_messages && feedbackConfig.enabled) {
262
+ pi.send(`<system-reminder>
263
+ 📊 Invar: Auto-triggering usage feedback (${msgCount} messages)
264
+ Consider running /invar-reflect to generate usage feedback.
265
+ </system-reminder>`);
266
+ }
267
+ });
268
+ ```
269
+
270
+ **Installation**: Hooks are automatically installed via `invar init --claude` or `invar init --pi`.
148
271
 
149
272
  ### Stop Hook Implementation
150
273
 
@@ -332,24 +455,26 @@ Enable automatic feedback collection? [Y/n]:
332
455
 
333
456
  ## Phase B Status
334
457
 
335
- **Completed**:
336
- - ✅ Hook schema designed
337
- - ✅ Configuration structure defined
338
- - ✅ User control mechanism specified
339
- - ✅ Stop hook workaround documented
340
458
 
341
- **Waiting for Claude Code Support**:
342
- - ⏸️ PostTaskCompletion hook type
343
- - ⏸️ Skill invocation from hooks
344
- - ⏸️ Session state tracking (message count, duration)
459
+ **Completed** (v1.15.0):
460
+ - Message Count trigger strategy designed
461
+ - Cross-platform implementation (Claude Code + Pi)
462
+ - Shared configuration structure
463
+ - ✅ Hook templates updated
464
+ - ✅ Installation via `invar init`
345
465
 
346
- **Next Steps**:
347
- - Implement Phase C: Init Integration (can be done independently)
348
- - Submit feature request to Claude Code for PostTaskCompletion hook
349
- - Test manual `/invar-reflect` invocation thoroughly
466
+ **Replaced PostTaskCompletion with Message Count** because:
467
+ - PostTaskCompletion hook not supported by Claude Code or Pi
468
+ - Message count is universally implementable
469
+ - Simpler, more predictable trigger mechanism
470
+ - User has full control via config
350
471
 
351
- ---
472
+ **Testing**:
473
+ - Manual `/invar-reflect` invocation: Works
474
+ - Hook trigger at threshold: Implemented
475
+ - Config disable: Honored by both hooks
476
+ - Multi-agent setup: Both hooks installed
352
477
 
353
- **Version**: 1.0 (Phase B - Proposed)
354
- **Updated**: 2026-01-03
355
- **Related**: DX-79 Invar Usage Feedback Collection
478
+ **Next Steps**:
479
+ - Monitor user feedback on threshold defaults
480
+ - Consider adding reminder messages at other checkpoints (e.g., 60, 90 messages)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: invar-tools
3
- Version: 1.14.0
3
+ Version: 1.15.1
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
@@ -190,8 +190,9 @@ cd your-project
190
190
  uvx invar-tools init
191
191
 
192
192
  # Or quick setup (skip prompts)
193
- uvx invar-tools init --claude # Claude Code
194
- uvx invar-tools init --pi # Pi Coding Agent
193
+ uvx invar-tools init --claude # Claude Code only
194
+ uvx invar-tools init --pi # Pi only
195
+ uvx invar-tools init --claude --pi # Both agents (DX-81)
195
196
  uvx invar-tools init --mcp-only # MCP tools only (legacy projects)
196
197
 
197
198
  # Add runtime contracts to your project
@@ -492,6 +493,7 @@ AlphaCodium · Parsel · Reflexion · Clover
492
493
  |-------|--------|-------|
493
494
  | **Claude Code** | ✅ Full | `invar init --claude` |
494
495
  | **[Pi](https://shittycodingagent.ai/)** | ✅ Full | `invar init --pi` |
496
+ | **Multi-Agent** | ✅ Full | `invar init --claude --pi` (DX-81) |
495
497
  | **Cursor** | ✅ MCP | `invar init` → select Other, add MCP config |
496
498
  | **Other** | 📝 Manual | `invar init` → select Other, include `AGENT.md` in prompt |
497
499
 
@@ -821,6 +823,7 @@ rules = ["missing_contract", "shell_result"]
821
823
  | `invar init` | Initialize or update project (interactive) |
822
824
  | `invar init --claude` | Quick setup for Claude Code |
823
825
  | `invar init --pi` | Quick setup for Pi agent |
826
+ | `invar init --claude --pi` | Setup for both agents (DX-81) |
824
827
  | `invar init --mcp-only` | MCP tools only (no framework files) |
825
828
  | `invar uninstall` | Remove Invar from project (preserves user content) |
826
829
  | `invar sig <file>` | Show signatures and contracts |
@@ -72,6 +72,7 @@ invar/shell/mcp_config.py,sha256=-hC7Y5BGuVs285b6gBARk7ZyzVxHwPgXSyt_GoN0jfs,458
72
72
  invar/shell/mutation.py,sha256=Lfyk2b8j8-hxAq-iwAgQeOhr7Ci6c5tRF1TXe3CxQCs,8914
73
73
  invar/shell/pattern_integration.py,sha256=pRcjfq3NvMW_tvQCnaXZnD1k5AVEWK8CYOE2jN6VTro,7842
74
74
  invar/shell/pi_hooks.py,sha256=ulZc1sP8mTRJTBsjwFHQzUgg-h8ajRIMp7iF1Y4UUtw,6885
75
+ invar/shell/pi_tools.py,sha256=a3ACDDXykFV8fUB5UpBmgMvppwkmLvT1k_BWm0IY47k,4068
75
76
  invar/shell/property_tests.py,sha256=N9JreyH5PqR89oF5yLcX7ZAV-Koyg5BKo-J05-GUPsA,9109
76
77
  invar/shell/py_refs.py,sha256=Vjz50lmt9prDBcBv4nkkODdiJ7_DKu5zO4UPZBjAfmM,4638
77
78
  invar/shell/skill_manager.py,sha256=Mr7Mh9rxPSKSAOTJCAM5ZHiG5nfUf6KQVCuD4LBNHSI,12440
@@ -85,7 +86,7 @@ invar/shell/commands/doc.py,sha256=SOLDoCXXGxx_JU0PKXlAIGEF36PzconHmmAtL-rM6D4,1
85
86
  invar/shell/commands/feedback.py,sha256=lLxEeWW_71US_vlmorFrGXS8IARB9nbV6D0zruLs660,7640
86
87
  invar/shell/commands/guard.py,sha256=xTQ8cPp-x1xMCtufKxmMNUSpIpH31uUjziAB8ifCnC0,24837
87
88
  invar/shell/commands/hooks.py,sha256=W-SOnT4VQyUvXwipozkJwgEYfiOJGz7wksrbcdWegUg,2356
88
- invar/shell/commands/init.py,sha256=bYrQWkDXGKEqncLgCFicSRt6LAmA34XyBFJ31kip-1Q,22564
89
+ invar/shell/commands/init.py,sha256=vaPo0p7xBm3Nfgu9ytcvAjgk4dQBKvyEhrz_Cg1URMQ,23557
89
90
  invar/shell/commands/merge.py,sha256=nuvKo8m32-OL-SCQlS4SLKmOZxQ3qj-1nGCx1Pgzifw,8183
90
91
  invar/shell/commands/mutate.py,sha256=GwemiO6LlbGCBEQsBFnzZuKhF-wIMEl79GAMnKUWc8U,5765
91
92
  invar/shell/commands/perception.py,sha256=HewSv6Kv8Gw2UQqkGY2rP5YKlnwyC3LBrQ2hFVXXw30,19304
@@ -135,13 +136,14 @@ invar/templates/examples/typescript/workflow.md,sha256=5byADjA3WgOgiDbkEtVRKKGvl
135
136
  invar/templates/hooks/PostToolUse.sh.jinja,sha256=JHJGMdF3xp2qEqkPC9GaLp0NCa5gdRzqAmgRy4IldBg,3428
136
137
  invar/templates/hooks/PreToolUse.sh.jinja,sha256=tZb-FGFxOBtTprUfeChau7rZOMPII69_5HSF-i_WD4Q,3558
137
138
  invar/templates/hooks/Stop.sh.jinja,sha256=SD0PhBPeun7DTvn8Erbz11PBGAwGby4tMTd97yOJuTQ,981
138
- invar/templates/hooks/UserPromptSubmit.sh.jinja,sha256=sUsqBiXzIEM3C8NdN4s4C7KqPlamyVhk5_-3zd5TC9Y,2621
139
+ invar/templates/hooks/UserPromptSubmit.sh.jinja,sha256=5xs-ASw8s_tHLvtA30nm5J7PhbpIML-8Hhv-QTTuhKY,3981
139
140
  invar/templates/hooks/__init__.py,sha256=RnnMoQA-8eqbr8Y_1Vu9B8h5vAz4C-vmo8wgdcGYrz0,43
140
- invar/templates/hooks/pi/invar.ts.jinja,sha256=0V7kBxPfXx18wGbZRT4F1CcuaK09oHh2IJll62N4XVM,2620
141
+ invar/templates/hooks/pi/invar.ts.jinja,sha256=WLEYwO8tvdu9RakxFtcVRuBmaE3HgRAUFf9T5OmgP0s,4027
141
142
  invar/templates/onboard/assessment.md.jinja,sha256=EzqF0VUcxJZG2bVJLxTOyQlAERRbh9v9hXKVt6vcbxY,5850
142
143
  invar/templates/onboard/roadmap.md.jinja,sha256=gmvZk4Hdwe0l3qSFV15QGcsr-OPMhsc6-1K9F2SFSIQ,3939
143
144
  invar/templates/onboard/patterns/python.md,sha256=3wwucAcQz0DlggtpqYo-ZCnmrXgBQ0aBgUHN_EZ1VW0,8681
144
145
  invar/templates/onboard/patterns/typescript.md,sha256=yOVfHtdAdjKkWNh66_dR7z2xEA4sggbIcCKthW-fqac,11983
146
+ invar/templates/pi-tools/invar/index.ts,sha256=G3ST0Bd8RWl7LnUGAMJmhIeTvq6L7C18ruVU4bs_S4s,19810
145
147
  invar/templates/protocol/INVAR.md.jinja,sha256=t2ZIQZJvzDTJMrRw_ijUo6ScZmeNK0-nV-H7ztTIyQQ,1464
146
148
  invar/templates/protocol/python/architecture-examples.md,sha256=O96LH9WFpk7G9MrhSbifLS5pyibTIDG-_EGFF7g3V4M,1175
147
149
  invar/templates/protocol/python/contracts-syntax.md,sha256=Q6supTQ3tChVrlN7xhcdb3Q8VGIESxQLA-mQvrNIZmo,1162
@@ -173,16 +175,16 @@ invar/templates/skills/extensions/security/SKILL.md,sha256=5mLwf4JP82Wq1vKkDIJwi
173
175
  invar/templates/skills/extensions/security/patterns/_common.yaml,sha256=75BvSABWUtO1VXFvdsMgqi86J1759T4ROhYYcizSygQ,3680
174
176
  invar/templates/skills/extensions/security/patterns/python.yaml,sha256=osyR8mWiyjW6tWjZA7QZfBIiim7XqgBYnrE45ktDx50,4658
175
177
  invar/templates/skills/extensions/security/patterns/typescript.yaml,sha256=qDEg-sxSE63Bis2IZG1y4L8m8g2ZYkC29o6t-J_LmUo,5508
176
- invar/templates/skills/invar-reflect/CONFIG.md,sha256=xBiKEy0TnoXNxqn55_GpkNGgmXoUg65RXwb_RdF-eGk,9291
178
+ invar/templates/skills/invar-reflect/CONFIG.md,sha256=G8KVNROQIm7CvjrB7cwzOANQOfJg3-1_0zRVZR1sX44,12852
177
179
  invar/templates/skills/invar-reflect/SKILL.md,sha256=z0Nyh9JasZr70XhE9Es7IslxL3C8wH2lf8RewQi4Lbs,11285
178
180
  invar/templates/skills/invar-reflect/template.md,sha256=Rr5hvbllvmd8jSLf_0ZjyKt6KOod0RlNdCtZJ3lYjiM,10470
179
181
  invar/templates/skills/investigate/SKILL.md.jinja,sha256=cp6TBEixBYh1rLeeHOR1yqEnFqv1NZYePORMnavLkQI,3231
180
182
  invar/templates/skills/propose/SKILL.md.jinja,sha256=6BuKiCqO1AEu3VtzMHy1QWGqr_xqG9eJlhbsKT4jev4,3463
181
183
  invar/templates/skills/review/SKILL.md.jinja,sha256=ET5mbdSe_eKgJbi2LbgFC-z1aviKcHOBw7J5Q28fr4U,14105
182
- invar_tools-1.14.0.dist-info/METADATA,sha256=1cKRlX8XrRzgAVc_9EJeCzXWrDBAUFooA8tSIktfclk,28409
183
- invar_tools-1.14.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
184
- invar_tools-1.14.0.dist-info/entry_points.txt,sha256=RwH_EhqgtFPsnO6RcrwrAb70Zyfb8Mh6uUtztWnUxGk,102
185
- invar_tools-1.14.0.dist-info/licenses/LICENSE,sha256=qeFksp4H4kfTgQxPCIu3OdagXyiZcgBlVfsQ6M5oFyk,10767
186
- invar_tools-1.14.0.dist-info/licenses/LICENSE-GPL,sha256=IvZfC6ZbP7CLjytoHVzvpDZpD-Z3R_qa1GdMdWlWQ6Q,35157
187
- invar_tools-1.14.0.dist-info/licenses/NOTICE,sha256=joEyMyFhFY8Vd8tTJ-a3SirI0m2Sd0WjzqYt3sdcglc,2561
188
- invar_tools-1.14.0.dist-info/RECORD,,
184
+ invar_tools-1.15.1.dist-info/METADATA,sha256=2Pgh_tDChmFZRZpdBlLTf4JrjsX4bFFKq8XznWFTuH4,28595
185
+ invar_tools-1.15.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
186
+ invar_tools-1.15.1.dist-info/entry_points.txt,sha256=RwH_EhqgtFPsnO6RcrwrAb70Zyfb8Mh6uUtztWnUxGk,102
187
+ invar_tools-1.15.1.dist-info/licenses/LICENSE,sha256=qeFksp4H4kfTgQxPCIu3OdagXyiZcgBlVfsQ6M5oFyk,10767
188
+ invar_tools-1.15.1.dist-info/licenses/LICENSE-GPL,sha256=IvZfC6ZbP7CLjytoHVzvpDZpD-Z3R_qa1GdMdWlWQ6Q,35157
189
+ invar_tools-1.15.1.dist-info/licenses/NOTICE,sha256=joEyMyFhFY8Vd8tTJ-a3SirI0m2Sd0WjzqYt3sdcglc,2561
190
+ invar_tools-1.15.1.dist-info/RECORD,,