invar-tools 1.11.0__py3-none-any.whl → 1.14.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.
- invar/core/feedback.py +110 -0
- invar/mcp/handlers.py +28 -0
- invar/mcp/server.py +64 -14
- invar/node_tools/ts-query.js +396 -0
- invar/shell/claude_hooks.py +49 -0
- invar/shell/commands/feedback.py +258 -0
- invar/shell/commands/guard.py +33 -1
- invar/shell/commands/init.py +51 -1
- invar/shell/commands/perception.py +302 -6
- invar/shell/py_refs.py +156 -0
- invar/shell/ts_compiler.py +238 -0
- invar/templates/claude-md/universal/tool-selection.md +110 -0
- invar/templates/config/CLAUDE.md.jinja +2 -0
- invar/templates/examples/typescript/patterns.md +193 -0
- invar/templates/manifest.toml +8 -0
- invar/templates/protocol/python/tools.md +5 -2
- invar/templates/protocol/typescript/tools.md +5 -2
- invar/templates/skills/invar-reflect/CONFIG.md +355 -0
- invar/templates/skills/invar-reflect/SKILL.md +466 -0
- invar/templates/skills/invar-reflect/template.md +343 -0
- {invar_tools-1.11.0.dist-info → invar_tools-1.14.0.dist-info}/METADATA +25 -7
- {invar_tools-1.11.0.dist-info → invar_tools-1.14.0.dist-info}/RECORD +27 -17
- {invar_tools-1.11.0.dist-info → invar_tools-1.14.0.dist-info}/WHEEL +0 -0
- {invar_tools-1.11.0.dist-info → invar_tools-1.14.0.dist-info}/entry_points.txt +0 -0
- {invar_tools-1.11.0.dist-info → invar_tools-1.14.0.dist-info}/licenses/LICENSE +0 -0
- {invar_tools-1.11.0.dist-info → invar_tools-1.14.0.dist-info}/licenses/LICENSE-GPL +0 -0
- {invar_tools-1.11.0.dist-info → invar_tools-1.14.0.dist-info}/licenses/NOTICE +0 -0
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: invar-reflect
|
|
3
|
+
description: Reflect on Invar tool usage experience and generate structured feedback for framework improvement.
|
|
4
|
+
_invar:
|
|
5
|
+
version: "1.0"
|
|
6
|
+
managed: skill
|
|
7
|
+
---
|
|
8
|
+
<!--invar:skill-->
|
|
9
|
+
# /invar-reflect — Invar Usage Feedback
|
|
10
|
+
|
|
11
|
+
> Extension Skill | Tier: T1 | Isolation: None (accesses session history)
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
Generate structured feedback on Invar tool usage to help improve the framework. Analyzes tool usage patterns, identifies pain points, tracks learning curves, and produces detailed feedback documents stored locally.
|
|
16
|
+
|
|
17
|
+
**Key Features**:
|
|
18
|
+
- **Intelligent aggregation**: Same-day sessions merge into single file
|
|
19
|
+
- **Semantic understanding**: Recognizes duplicate issues across sessions
|
|
20
|
+
- **Evolution tracking**: Monitors learning progress and problem resolution
|
|
21
|
+
- **Privacy-first**: All data stays local in `.invar/feedback/`
|
|
22
|
+
|
|
23
|
+
## Triggers
|
|
24
|
+
|
|
25
|
+
**Manual invocation**: User calls `/invar-reflect`
|
|
26
|
+
|
|
27
|
+
**Future (Phase B)**: Auto-trigger after task completion (30+ messages, 2+ hours)
|
|
28
|
+
|
|
29
|
+
## Relationship to Other Skills
|
|
30
|
+
|
|
31
|
+
- This skill is **meta**: It reflects on your usage of Invar, not on user's code
|
|
32
|
+
- Runs independently, doesn't interfere with other workflows
|
|
33
|
+
- Generates feedback for Invar maintainers, not for current task
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Workflow
|
|
38
|
+
|
|
39
|
+
### Step 1: Check for Today's Feedback File
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
today = 2026-01-03
|
|
43
|
+
filepath = .invar/feedback/feedback-{today}.md
|
|
44
|
+
|
|
45
|
+
if filepath exists:
|
|
46
|
+
mode = "APPEND"
|
|
47
|
+
existing_content = read(filepath)
|
|
48
|
+
else:
|
|
49
|
+
mode = "CREATE"
|
|
50
|
+
existing_content = None
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Step 2: Analyze Current Session
|
|
54
|
+
|
|
55
|
+
Gather information about:
|
|
56
|
+
|
|
57
|
+
1. **Tool usage statistics**:
|
|
58
|
+
- Count of `invar_guard`, `invar_sig`, `invar_map`, `invar_refs` calls
|
|
59
|
+
- Success/failure rates
|
|
60
|
+
- Error types encountered
|
|
61
|
+
|
|
62
|
+
2. **Pain points**:
|
|
63
|
+
- Repeated errors (same issue multiple times)
|
|
64
|
+
- Workarounds used (patterns of avoiding certain features)
|
|
65
|
+
- Confusion points (frequent doc/example lookups)
|
|
66
|
+
|
|
67
|
+
3. **Learning curve**:
|
|
68
|
+
- Compare early session vs late session error rates
|
|
69
|
+
- Identify resolved vs ongoing issues
|
|
70
|
+
- Note improvements in workflow
|
|
71
|
+
|
|
72
|
+
4. **Subjective experience**:
|
|
73
|
+
- What worked well (tools you relied on)
|
|
74
|
+
- What was frustrating (blocking issues)
|
|
75
|
+
- What was confusing (unclear documentation)
|
|
76
|
+
|
|
77
|
+
### Step 3: Generate or Merge Feedback
|
|
78
|
+
|
|
79
|
+
**If mode == CREATE** (new file):
|
|
80
|
+
- Generate fresh feedback document
|
|
81
|
+
- Use full template structure (see below)
|
|
82
|
+
|
|
83
|
+
**If mode == APPEND** (existing file):
|
|
84
|
+
- Read and understand existing content
|
|
85
|
+
- Identify duplicate issues using **semantic understanding**:
|
|
86
|
+
- "Guard slow" ≈ "Guard timeout" → Same issue, update count
|
|
87
|
+
- "Missing @pre" ≠ "Missing @post" → Different issues
|
|
88
|
+
- Track evolution:
|
|
89
|
+
- Session 1: "5 contract errors"
|
|
90
|
+
- Session 3: "0 contract errors" → Learned!
|
|
91
|
+
- Add new issues not previously recorded
|
|
92
|
+
- Regenerate daily summary with updated stats
|
|
93
|
+
|
|
94
|
+
### Step 4: Save Feedback
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
Write to: .invar/feedback/feedback-{today}.md
|
|
98
|
+
Output: "✓ Feedback saved to .invar/feedback/feedback-{today}.md"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Agent Instructions
|
|
104
|
+
|
|
105
|
+
### Intelligence Guidelines
|
|
106
|
+
|
|
107
|
+
**Use your judgment, not mechanical rules**:
|
|
108
|
+
|
|
109
|
+
1. **Semantic matching**:
|
|
110
|
+
- Recognize synonyms: "Guard performance issue" ≈ "Guard timeout"
|
|
111
|
+
- Differentiate by context: "Core confusion" ≠ "Shell confusion"
|
|
112
|
+
- Consider severity: "Blocking" ≠ "Annoying but manageable"
|
|
113
|
+
|
|
114
|
+
2. **Evolution tracking**:
|
|
115
|
+
- Compare same issue across sessions
|
|
116
|
+
- Note improvement: "5 errors → 2 errors → 0 errors"
|
|
117
|
+
- Identify resolved issues: "Session 1: confused, Session 3: confident"
|
|
118
|
+
|
|
119
|
+
3. **Impact assessment**:
|
|
120
|
+
- Blocking: Stopped progress, needed workaround
|
|
121
|
+
- Major: Slowed down significantly (10+ minutes lost)
|
|
122
|
+
- Minor: Slight friction, manageable
|
|
123
|
+
|
|
124
|
+
4. **Evidence-based reporting**:
|
|
125
|
+
- Provide specific examples: file:line, command used, error message
|
|
126
|
+
- Quote user experience: "I felt..." statements
|
|
127
|
+
- Show workarounds: actual commands or code snippets
|
|
128
|
+
|
|
129
|
+
### When Appending to Existing File
|
|
130
|
+
|
|
131
|
+
**Your task**:
|
|
132
|
+
1. Read existing feedback carefully
|
|
133
|
+
2. Identify which issues from current session are duplicates
|
|
134
|
+
3. Update occurrence counts for duplicate issues
|
|
135
|
+
4. Add evolution notes: "Still occurring" or "Now resolved"
|
|
136
|
+
5. Add genuinely new issues
|
|
137
|
+
6. Regenerate the Daily Summary section
|
|
138
|
+
|
|
139
|
+
**Example merge logic**:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
Existing (Session 1):
|
|
143
|
+
P1: Guard timeout - 4 occurrences
|
|
144
|
+
|
|
145
|
+
Current (Session 3):
|
|
146
|
+
Found: Guard slow (5 minutes)
|
|
147
|
+
|
|
148
|
+
Agent reasoning:
|
|
149
|
+
"Guard slow" and "Guard timeout" are the same issue (performance)
|
|
150
|
+
|
|
151
|
+
Updated output:
|
|
152
|
+
P1: Guard Performance Issues
|
|
153
|
+
First seen: Session 1 (08:30)
|
|
154
|
+
Last seen: Session 3 (16:45)
|
|
155
|
+
Total occurrences: 9 times across 2 sessions
|
|
156
|
+
|
|
157
|
+
Session breakdown:
|
|
158
|
+
- Session 1: 4 times → "Timeout on CrossHair"
|
|
159
|
+
- Session 3: 5 times → "Takes 5 minutes even with --changed"
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Feedback Document Structure
|
|
163
|
+
|
|
164
|
+
Generate detailed markdown following this structure:
|
|
165
|
+
|
|
166
|
+
```markdown
|
|
167
|
+
# Invar Usage Feedback - {date}
|
|
168
|
+
|
|
169
|
+
**Sessions**: {N} sessions today
|
|
170
|
+
**Total Duration**: {X} hours
|
|
171
|
+
**Total Messages**: {Y}
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Session Timeline
|
|
176
|
+
|
|
177
|
+
### Session 1: {time} ({task description})
|
|
178
|
+
**Messages**: {N} | **Duration**: {X}h
|
|
179
|
+
|
|
180
|
+
[Brief summary of what was accomplished and main challenges]
|
|
181
|
+
|
|
182
|
+
### Session 2: {time} ({task description})
|
|
183
|
+
**Messages**: {N} | **Duration**: {X}h
|
|
184
|
+
|
|
185
|
+
[Brief summary...]
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## 📊 Tool Usage Statistics
|
|
190
|
+
|
|
191
|
+
| Tool | Calls | Success | Failure | Success Rate |
|
|
192
|
+
|------|-------|---------|---------|--------------|
|
|
193
|
+
| invar_guard | {N} | {N} | {N} | {X}% |
|
|
194
|
+
| invar_sig | {N} | {N} | {N} | {X}% |
|
|
195
|
+
| invar_map | {N} | {N} | {N} | {X}% |
|
|
196
|
+
| invar_refs | {N} | {N} | {N} | {X}% |
|
|
197
|
+
|
|
198
|
+
**Total**: {N} tool calls, {N} successful ({X}% success rate)
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## 😫 Aggregated Pain Points
|
|
203
|
+
|
|
204
|
+
### P1: [Critical] {Issue Title}
|
|
205
|
+
|
|
206
|
+
**First seen**: Session {N} ({time})
|
|
207
|
+
**Last seen**: Session {N} ({time})
|
|
208
|
+
**Total occurrences**: {N} times across {M} sessions
|
|
209
|
+
|
|
210
|
+
**Session breakdown**:
|
|
211
|
+
- Session 1: {N} times → "{specific observation}"
|
|
212
|
+
- Session 3: {N} times → "{specific observation}"
|
|
213
|
+
|
|
214
|
+
**Context**:
|
|
215
|
+
{Detailed description of when/why this issue occurs}
|
|
216
|
+
|
|
217
|
+
**Evolution**:
|
|
218
|
+
> Session 1: "{user sentiment/observation}"
|
|
219
|
+
> Session 3: "{user sentiment/observation}"
|
|
220
|
+
|
|
221
|
+
**Current status**: {Resolved / Unresolved / Workaround found}
|
|
222
|
+
|
|
223
|
+
**Workaround** (if applicable):
|
|
224
|
+
```bash
|
|
225
|
+
{actual command or code}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Suggested Improvement**:
|
|
229
|
+
- {Concrete suggestion 1}
|
|
230
|
+
- {Concrete suggestion 2}
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
### P2: [High] {Issue Title}
|
|
235
|
+
|
|
236
|
+
[Same structure...]
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## ✅ What Worked Well
|
|
241
|
+
|
|
242
|
+
### 1. {Tool or Feature}
|
|
243
|
+
|
|
244
|
+
**Usage**: {N} times
|
|
245
|
+
**Success rate**: {X}%
|
|
246
|
+
|
|
247
|
+
**Why it worked**:
|
|
248
|
+
{Explanation}
|
|
249
|
+
|
|
250
|
+
**Typical workflow**:
|
|
251
|
+
```bash
|
|
252
|
+
{Example commands}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**User experience**:
|
|
256
|
+
> "{Quote about positive experience}"
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## 🤔 Confusion Points
|
|
261
|
+
|
|
262
|
+
### 1. {Topic}
|
|
263
|
+
|
|
264
|
+
**What I tried** (wrong):
|
|
265
|
+
```python
|
|
266
|
+
{Code example}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
**What worked** (after reading docs/examples):
|
|
270
|
+
```python
|
|
271
|
+
{Code example}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**Gap**: {What documentation is missing or unclear}
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## 🔄 Workarounds Used
|
|
279
|
+
|
|
280
|
+
| Issue | Workaround | Frequency |
|
|
281
|
+
|-------|------------|-----------|
|
|
282
|
+
| {Issue} | {Workaround description} | {N} times |
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## 💡 Improvement Suggestions
|
|
287
|
+
|
|
288
|
+
### High Priority
|
|
289
|
+
1. **{Suggestion title}**
|
|
290
|
+
- Problem: {What's wrong}
|
|
291
|
+
- Solution: {Proposed fix}
|
|
292
|
+
- Benefit: {Expected improvement}
|
|
293
|
+
|
|
294
|
+
### Medium Priority
|
|
295
|
+
{Same structure...}
|
|
296
|
+
|
|
297
|
+
### Low Priority
|
|
298
|
+
{Same structure...}
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## 📈 Daily Summary
|
|
303
|
+
|
|
304
|
+
### High-Frequency Issues (Top 3)
|
|
305
|
+
1. **{Issue}** - {N} occurrences, {status}
|
|
306
|
+
2. **{Issue}** - {N} occurrences, {status}
|
|
307
|
+
3. **{Issue}** - {N} occurrences, {status}
|
|
308
|
+
|
|
309
|
+
### Learning Progress
|
|
310
|
+
| Issue | Session 1 | Session 2 | Session 3 | Trend |
|
|
311
|
+
|-------|-----------|-----------|-----------|-------|
|
|
312
|
+
| {Issue} | {N} errors | {N} errors | {N} errors | {✅/📈/⚠️} |
|
|
313
|
+
|
|
314
|
+
### Sentiment Evolution
|
|
315
|
+
- **Morning**: {Sentiment description}
|
|
316
|
+
- **Afternoon**: {Sentiment description}
|
|
317
|
+
- **Evening**: {Sentiment description}
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## 🎯 Session Success Metrics
|
|
322
|
+
|
|
323
|
+
| Metric | Value | Assessment |
|
|
324
|
+
|--------|-------|------------|
|
|
325
|
+
| Task completed | {Yes/No} | {Success/Blocked} |
|
|
326
|
+
| Guard final pass | {Pass/Fail} | {Result} |
|
|
327
|
+
| Time to first Guard pass | {X} hours | {Assessment} |
|
|
328
|
+
| Stuck on Invar issues | {X} min | {Acceptable/Too long} |
|
|
329
|
+
| Would recommend Invar | {Yes/No} | {Positive/Negative} |
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## 📝 Additional Notes
|
|
334
|
+
|
|
335
|
+
{Any other observations, context, or insights}
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## 🔒 Privacy Notice
|
|
340
|
+
|
|
341
|
+
This feedback document is stored locally in `.invar/feedback/`.
|
|
342
|
+
You control what (if anything) to share with Invar maintainers.
|
|
343
|
+
|
|
344
|
+
**To share feedback**:
|
|
345
|
+
1. Review this document
|
|
346
|
+
2. Remove any sensitive project details
|
|
347
|
+
3. Submit via GitHub issue or email
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
*Generated by `/invar-reflect` v1.0*
|
|
352
|
+
*Last updated: {timestamp}*
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Quality Checklist
|
|
356
|
+
|
|
357
|
+
Before saving, verify:
|
|
358
|
+
- [ ] Specific examples provided (not generic statements)
|
|
359
|
+
- [ ] User experience quotes included (subjective perspective)
|
|
360
|
+
- [ ] Workarounds documented (actual commands/code)
|
|
361
|
+
- [ ] Learning progression tracked (improvement noted)
|
|
362
|
+
- [ ] Suggestions are actionable (concrete, not vague)
|
|
363
|
+
- [ ] No sensitive information (code snippets, project names)
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
## Output
|
|
368
|
+
|
|
369
|
+
After generating/updating feedback:
|
|
370
|
+
|
|
371
|
+
```
|
|
372
|
+
✓ Feedback saved to .invar/feedback/feedback-2026-01-03.md
|
|
373
|
+
|
|
374
|
+
Summary:
|
|
375
|
+
- Sessions today: 3
|
|
376
|
+
- New issues identified: 2
|
|
377
|
+
- Updated issues: 5
|
|
378
|
+
- Resolved issues: 1
|
|
379
|
+
|
|
380
|
+
High-priority issues:
|
|
381
|
+
1. Guard performance (still blocking)
|
|
382
|
+
2. Error message clarity (ongoing confusion)
|
|
383
|
+
|
|
384
|
+
Review the feedback file before sharing with Invar maintainers.
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## Privacy & Ethics
|
|
390
|
+
|
|
391
|
+
**What's collected**:
|
|
392
|
+
- Tool usage counts (no actual code)
|
|
393
|
+
- Error types (no error details/messages)
|
|
394
|
+
- User's subjective experience
|
|
395
|
+
- Time/duration statistics
|
|
396
|
+
|
|
397
|
+
**NOT collected**:
|
|
398
|
+
- Source code
|
|
399
|
+
- File paths
|
|
400
|
+
- Project-specific details
|
|
401
|
+
- Error messages (might leak code)
|
|
402
|
+
|
|
403
|
+
**User control**:
|
|
404
|
+
- All data stays in `.invar/feedback/` (local)
|
|
405
|
+
- User reviews before sharing
|
|
406
|
+
- Easy to disable: Delete `.invar/feedback/` or skip skill
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## Examples
|
|
411
|
+
|
|
412
|
+
### Example 1: First Session of the Day
|
|
413
|
+
|
|
414
|
+
**Input**: Manual call `/invar-reflect` after 3-hour session
|
|
415
|
+
|
|
416
|
+
**Output**:
|
|
417
|
+
```
|
|
418
|
+
✓ Feedback saved to .invar/feedback/feedback-2026-01-03.md
|
|
419
|
+
|
|
420
|
+
Summary:
|
|
421
|
+
- Sessions today: 1
|
|
422
|
+
- Issues identified: 4 (2 critical, 2 medium)
|
|
423
|
+
- Tools used: guard (5), sig (8), map (2)
|
|
424
|
+
|
|
425
|
+
High-priority issues:
|
|
426
|
+
1. Guard timeout on large codebase
|
|
427
|
+
2. Unclear error: missing_contract
|
|
428
|
+
|
|
429
|
+
Review the feedback file for full details.
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### Example 2: Third Session of the Day
|
|
433
|
+
|
|
434
|
+
**Input**: Manual call `/invar-reflect` after another 2-hour session
|
|
435
|
+
|
|
436
|
+
**Agent reasoning**:
|
|
437
|
+
- Reads existing feedback-2026-01-03.md
|
|
438
|
+
- Sees "Guard timeout" was reported in Session 1
|
|
439
|
+
- Current session also encountered "Guard slow" (5 occurrences)
|
|
440
|
+
- Recognizes these are the same issue
|
|
441
|
+
- Updates count: 5 → 10 occurrences
|
|
442
|
+
- Adds evolution note: "Still unresolved, user found workaround"
|
|
443
|
+
|
|
444
|
+
**Output**:
|
|
445
|
+
```
|
|
446
|
+
✓ Feedback updated: .invar/feedback/feedback-2026-01-03.md
|
|
447
|
+
|
|
448
|
+
Summary:
|
|
449
|
+
- Sessions today: 3 (updated)
|
|
450
|
+
- New issues: 1
|
|
451
|
+
- Updated issues: 3
|
|
452
|
+
- Learning progress: Contract syntax errors (5 → 0) ✅
|
|
453
|
+
|
|
454
|
+
High-priority issues:
|
|
455
|
+
1. Guard performance (10 occurrences, still blocking)
|
|
456
|
+
2. Contract syntax (RESOLVED - no errors in Session 3)
|
|
457
|
+
|
|
458
|
+
Daily summary regenerated with latest statistics.
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
<!--/invar:skill-->
|
|
464
|
+
<!--invar:extensions-->
|
|
465
|
+
<!-- User extensions preserved on update -->
|
|
466
|
+
<!--/invar:extensions-->
|