telo3-ai 5.0.7 → 6.2.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.
Files changed (47) hide show
  1. package/README.md +32 -791
  2. package/SKILL.md +36 -657
  3. package/bootstrap/TELO3.md +17 -0
  4. package/cli.js +223 -42
  5. package/hooks/inject-contract.mjs +23 -0
  6. package/hooks/session-start.example.json +15 -0
  7. package/index.js +48 -14
  8. package/package.json +32 -69
  9. package/references/accessibility-quality.md +92 -272
  10. package/references/ai-behavior.md +70 -332
  11. package/references/anti-slop.md +71 -0
  12. package/references/document-specification.md +110 -419
  13. package/references/legal-compliance.md +90 -395
  14. package/references/performance-quality.md +100 -351
  15. package/references/privacy-compliance.md +88 -464
  16. package/references/project-audit.md +79 -440
  17. package/references/security-quality.md +68 -220
  18. package/references/seo-quality.md +83 -339
  19. package/references/smart-skill-delegation.md +73 -419
  20. package/references/token-optimization.md +83 -450
  21. package/references/ui-quality.md +106 -481
  22. package/references/workflow.md +91 -447
  23. package/scripts/postinstall.mjs +27 -0
  24. package/src/activate.js +159 -0
  25. package/src/context.js +72 -0
  26. package/src/find-context.js +41 -0
  27. package/src/init.js +38 -0
  28. package/src/install.js +128 -0
  29. package/src/paths.js +20 -0
  30. package/src/status.js +30 -0
  31. package/src/tokens.js +10 -0
  32. package/src/validate.js +220 -0
  33. package/src/version.js +12 -0
  34. package/templates/architecture.md +17 -398
  35. package/templates/design.md +22 -631
  36. package/templates/memory.md +13 -351
  37. package/templates/prd.md +15 -295
  38. package/templates/rules.md +20 -600
  39. package/templates/tasks.md +10 -210
  40. package/AI-CONTEXT.md +0 -272
  41. package/ONBOARDING-SKILL.md +0 -738
  42. package/SKILL-METADATA.json +0 -237
  43. package/scripts/init-project-context.sh +0 -139
  44. package/scripts/validate-project-context.sh +0 -164
  45. package/skills/telo3/SKILL.md +0 -315
  46. package/skills/telo3-context/SKILL.md +0 -272
  47. package/skills/telo3-onboarding/SKILL.md +0 -738
@@ -1,481 +1,114 @@
1
- # Token Optimization & Efficiency
1
+ # Token Optimization
2
+ **Load when:** diagnosing context bloat, inefficient reads, or interpreting token-loading estimates.
2
3
 
3
- > Smart AI behavior for minimal token usage and maximum effectiveness.
4
+ Do what's needed. Skip what's not. Communicate concisely. Fewer tokens, same quality — measure, don't assume.
4
5
 
5
- ---
6
+ ## Two-Layer Architecture
6
7
 
7
- ## Core Principle
8
+ | Layer | What | When loaded | Cost |
9
+ |---|---|---|---|
10
+ | Core + host bridges | One compact core in AGENTS.md, tiny pointers in other host files; installed by chat file tools or activate | Host loads at session start/resume | Character-estimated core budget: 320 tokens for tested paths; long paths can add overhead |
11
+ | Skill + references | Full SKILL.md and reference docs | On demand, per task, via the map below | Only what the task needs |
8
12
 
9
- **Do what's needed. Skip what's not. Communicate concisely.**
13
+ `telo3 deactivate` removes the bootstrap block. Keep the bootstrap lean; push detail into on-demand references.
10
14
 
11
- ---
15
+ ## CLI
12
16
 
13
- ## Token-Saving Rules
17
+ | Command | Purpose |
18
+ |---|---|
19
+ | `telo3 install [dir] [--agent <host>]` | Copy a durable, discoverable project skill; no cache dependency |
20
+ | `telo3 init [dir] [--context-dir <name>]` | Scaffold the six context documents |
21
+ | `telo3 validate [dir] [--json] [--strict]` | Check required sections/structure |
22
+ | `telo3 status [dir]` | Show context-system state |
23
+ | `telo3 context <task> [dir] [--measure]` | Select task-relevant docs; `--measure` reports token counts |
24
+ | `telo3 activate [dir]` | Install the bootstrap block into instruction files |
25
+ | `telo3 deactivate [dir]` | Remove the bootstrap block |
26
+ | `telo3 version` | Print CLI version |
14
27
 
15
- ### 1. Read Selectively
28
+ `context <task> --measure` estimates tokens as ceil(characters / 4). Compare selective docs + required refs with ALL six docs + those SAME refs. It measures input length, not actual model/API usage; do not call estimates observed token savings. Missing selected context is reported and detected secrets are redacted.
16
29
 
17
- ❌ **DON'T:**
18
- - Read entire codebase
19
- - Read all context documents every time
20
- - Re-read files already in conversation
30
+ ## Selective Loading Map (memory.md always first)
21
31
 
22
- ✅ **DO:**
23
- - Read only affected files
24
- - Check memory.md first (recent context)
25
- - Use grep to find relevant code
26
- - Read specific line ranges
32
+ | Task | Context docs | Extra references (references/<name>.md) |
33
+ |---|---|---|
34
+ | feature | memory, prd, architecture, rules | — |
35
+ | bugfix | memory, architecture, rules | — |
36
+ | design | memory, design, rules | ui-quality |
37
+ | security | memory, architecture, rules | security-quality, privacy-compliance |
38
+ | privacy | memory, architecture | privacy-compliance, legal-compliance |
39
+ | legal | memory, prd | legal-compliance |
40
+ | accessibility | memory, design | accessibility-quality |
41
+ | seo | memory, design | seo-quality, performance-quality |
42
+ | performance | memory, architecture | performance-quality |
43
+ | docs | memory | document-specification |
44
+ | audit | all six | project-audit |
45
+ | all | all six | — |
46
+ | default/unknown | memory only | — |
27
47
 
28
- **Example:**
29
- ```
30
- Task: Fix login button styling
31
-
32
- ❌ Read: prd.md, architecture.md, rules.md, design.md, all component files
33
- ✅ Read: design.md (button styles), LoginButton.tsx only
34
- ```
35
-
36
- ### 2. Skip Unnecessary Verification
37
-
38
- ❌ **DON'T:**
39
- - Run tests if not requested
40
- - Inspect unrelated code
41
- - Verify unchanged functionality
42
- - Read documentation for known patterns
43
-
44
- ✅ **DO:**
45
- - Trust existing working code
46
- - Only verify what you changed
47
- - Test when explicitly asked or high-risk
48
- - Skip inspection if pattern is clear
49
-
50
- ### 3. Communicate Concisely
51
-
52
- ❌ **VERBOSE:**
53
- ```
54
- I understand that you would like me to update the button color.
55
- After carefully reading the design system documentation and
56
- examining the current implementation, I have determined that
57
- the most appropriate course of action...
58
- ```
59
-
60
- ✅ **CONCISE:**
61
- ```
62
- Updating button color to primary blue (design.md).
63
-
64
- Changed: Button.tsx line 12
65
- ```
66
-
67
- ### 4. Caveman Mode (Ultra-Concise)
68
-
69
- **When enabled: Maximum brevity, no fluff.**
70
-
71
- **Format:**
72
- - Short sentences
73
- - No filler words
74
- - Direct action statements
75
- - Facts only
76
-
77
- **Examples:**
78
-
79
- ❌ **Normal:** "I'll now proceed to create the user profile component following the design system"
80
-
81
- ✅ **Caveman:** "Create UserProfile component. Follow design.md."
82
-
83
- ❌ **Normal:** "After reviewing the code, I've identified that we need to validate the email input"
84
-
85
- ✅ **Caveman:** "Add email validation. Use Zod schema."
86
-
87
- ❌ **Normal:** "The implementation has been completed successfully and I've verified that it works"
88
-
89
- ✅ **Caveman:** "Done. Tested. Works."
90
-
91
- ---
92
-
93
- ## Efficiency Decision Tree
94
-
95
- ```
96
- New Task Received
97
- ↓
98
- Is change tiny? (1 file, obvious)
99
- YES → Read that file → Code → Update memory.md → DONE
100
- NO ↓
101
-
102
- Is change medium? (2-3 files, clear pattern)
103
- YES → Read memory.md + affected files → Code → Update docs → DONE
104
- NO ↓
105
-
106
- Is change large/complex?
107
- YES → Read relevant context → Plan → Confirm with user → Code → Update docs → DONE
108
- ```
109
-
110
- ---
111
-
112
- ## When to Read Project Context
113
-
114
- ### Always Read (30 seconds max):
115
- - **memory.md** — Recent context, current state
116
-
117
- ### Read If Relevant:
118
- - **prd.md** — If changing requirements or scope
119
- - **architecture.md** — If adding features, changing structure
120
- - **rules.md** — If unsure about coding standards
121
- - **design.md** — If building UI
122
- - **tasks.md** — If planning work
123
-
124
- ### Skip:
125
- - Documents unrelated to current task
126
- - Files you've already read this session
127
- - Unchanged documentation
128
-
129
- ---
130
-
131
- ## When to Inspect Code
132
-
133
- ### Must Inspect:
134
- - Files you're about to modify
135
- - Related files (imports, dependencies)
136
-
137
- ### Can Skip:
138
- - Unrelated features
139
- - Test files (unless testing)
140
- - Config files (unless changing config)
141
- - Documentation (unless updating docs)
142
-
143
- ### Quick Inspection Methods:
144
- ```bash
145
- # Find pattern quickly
146
- grep -r "functionName" src/
147
-
148
- # Find files containing text
149
- rg "import.*Component" --files-with-matches
150
-
151
- # See function without reading whole file
152
- # Use code reading tool with selector
153
- ```
154
-
155
- ---
156
-
157
- ## When to Run Tests
158
-
159
- ### Run Tests When:
160
- - Explicitly requested by user
161
- - Changing critical code (auth, payments, security)
162
- - Fixing bugs (verify fix)
163
- - Test failure mentioned
164
-
165
- ### Skip Tests When:
166
- - Trivial changes (typos, comments, styling)
167
- - Non-functional changes (refactoring with same behavior)
168
- - User didn't ask for testing
169
- - Tests don't exist yet
170
-
171
- ---
172
-
173
- ## Smart Context Loading
174
-
175
- ### Minimal Context (Fast Tasks)
176
- ```
177
- Read: memory.md (30 sec)
178
- Code: Direct implementation
179
- Update: memory.md only
180
- ```
181
-
182
- ### Medium Context (Standard Tasks)
183
- ```
184
- Read: memory.md + design.md or rules.md (1 min)
185
- Code: Follow patterns
186
- Update: memory.md + tasks.md
187
- ```
188
-
189
- ### Full Context (Complex Tasks)
190
- ```
191
- Read: Relevant subset of all docs (2-3 min)
192
- Plan: Discuss approach with user
193
- Code: Systematic implementation
194
- Update: All affected docs
195
- ```
196
-
197
- ---
198
-
199
- ## Response Format (Caveman Mode)
200
-
201
- ### Before Coding
202
- ```
203
- Task: Add user search
204
-
205
- Read: architecture.md (API patterns)
206
- Plan:
207
- - Add /api/users/search endpoint
208
- - Use existing auth middleware
209
- - Return filtered user list
210
-
211
- Proceed? [Just start coding if obvious]
212
- ```
213
-
214
- ### After Coding
215
- ```
216
- Done.
48
+ ## Reading Discipline
217
49
 
218
- Changed:
219
- - /api/users/search.ts (new)
220
- - components/UserSearch.tsx (new)
50
+ - Don't re-read unchanged files already in context.
51
+ - Read only affected code: files you will modify + their imports/dependencies.
52
+ - Skip unrelated files: other features, tests (unless testing), config (unless changing it), docs (unless updating them).
53
+ - Locate with grep/file search; read specific line ranges instead of whole files when only one function is needed.
54
+ - Skim structure first; deep-read only relevant sections.
221
55
 
222
- Updated:
223
- - tasks.md (marked complete)
224
- - memory.md (added search feature)
56
+ ## Verification (corrected rule)
225
57
 
226
- Tested: Manual check. Works.
227
- ```
58
+ Verifying changed behavior before claiming done is REQUIRED — run/execute the change, check edge cases and related-feature regressions. What you skip is re-verifying unrelated, unchanged code.
228
59
 
229
- ### Bug Fix
230
- ```
231
- Fixed login redirect.
60
+ | Situation | Verification |
61
+ |---|---|
62
+ | Any behavior change | Verify the change before claiming done |
63
+ | Bug fix | Reproduce → fix → verify fix + no regressions |
64
+ | Critical code (auth, payments, security) | Thorough checks; run relevant tests |
65
+ | User requests tests, or a failure is mentioned | Run the relevant suite |
66
+ | Trivial change (typo, comment, styling) | Quick check of the change itself; no full suite |
67
+ | Unchanged, unrelated code | Skip — trust existing working code |
232
68
 
233
- Issue: Missing return statement
234
- Changed: auth.ts line 45
235
- Verified: Redirect works now
236
- ```
69
+ ## Task Size
237
70
 
238
- ---
71
+ | Size | Read | Plan | Verify | Update | Response |
72
+ |---|---|---|---|---|---|
73
+ | Tiny (1 file, obvious) | Affected file | None | The change | memory.md | 2–3 sentences |
74
+ | Small/medium (few files) | memory + relevant doc + affected files | Brief outline | Change + critical paths | memory + tasks (+ changed docs) | Brief structured summary |
75
+ | Large/complex | Context subset per map + affected code | Scoped plan; clarify missing consequential decisions | Relevant critical paths | Affected docs only | Result + evidence + gap |
239
76
 
240
- ## Intelligent Tool Selection
77
+ ## Communication Contract
241
78
 
242
- ### File Reading
243
- ```
244
- Tiny change → Read exact file
245
- Pattern search → Use grep
246
- Find similar code → Use grep with pattern
247
- Unknown location → Use file search
248
- ```
249
-
250
- ### Code Modification
251
- ```
252
- Single change → Direct string replace
253
- Multiple related changes → Multiple edits
254
- Full rewrite → Write entire file
255
- ```
79
+ Concise by default: result → changes → verification. No filler, no restating the request, no narrating tool calls, no excessive apologies or flowery language, no long explanations of obvious things.
256
80
 
257
- ### Verification
258
- ```
259
- User asked to test → Run tests
260
- Critical change → Quick manual verify
261
- Trivial change → Skip verification
262
- ```
263
-
264
- ---
265
-
266
- ## Communication Patterns
267
-
268
- ### Update Format (Concise)
269
-
270
- **Bad (Verbose):**
271
- ```
272
- I have successfully completed the implementation of the user
273
- authentication feature. The code has been written following
274
- best practices and includes proper error handling. I have
275
- also updated the relevant documentation files.
276
- ```
81
+ Default report:
277
82
 
278
- **Good (Concise):**
279
83
  ```
280
- Auth feature complete.
281
- - Added login/signup
282
- - Error handling included
283
- - Docs updated
84
+ Login redirect fixed.
85
+ Changed: auth.ts (null check).
86
+ Verified: login + redirect executed; works.
87
+ Docs: memory.md, tasks.md updated.
284
88
  ```
285
89
 
286
- **Best (Caveman):**
287
- ```
288
- Auth done.
289
- - Login/signup works
290
- - Errors handled
291
- - Docs current
292
- ```
293
-
294
- ---
295
-
296
- ## Avoid Token Waste
297
-
298
- ### ❌ Don't Waste Tokens On:
299
- - Long explanations of obvious things
300
- - Repeating user's request back to them
301
- - Excessive code comments in responses
302
- - Reading entire files when you need 1 function
303
- - Running full test suites for typo fixes
304
- - Verifying unchanged code still works
305
- - Apologizing excessively
306
- - Flowery language
307
- - Explaining the process (just do it)
308
-
309
- ### ✅ Spend Tokens On:
310
- - Reading relevant code
311
- - Clear, concise updates
312
- - Important decisions/tradeoffs
313
- - Error explanations
314
- - Security/privacy considerations
315
- - Asking for clarification when truly unclear
316
-
317
- ---
318
-
319
- ## Smart Pattern Recognition
320
-
321
- **If you see pattern X, apply solution Y automatically:**
322
-
323
- | Pattern | Action |
324
- |---------|--------|
325
- | "Fix typo in..." | Read file → Fix → Done (no testing) |
326
- | "Update button color..." | Read design.md → Update → Done |
327
- | "Add field to form..." | Read form → Add with validation → Done |
328
- | "Fix bug in..." | Read file → Fix → Verify → Update memory.md |
329
- | "Refactor..." | Read code → Plan → Ask user → Refactor |
330
-
331
- ---
332
-
333
- ## Adaptive Behavior Based on Task Size
334
-
335
- ### Tiny (< 5 min)
336
- - **Read:** 1 file
337
- - **Plan:** No (obvious)
338
- - **Code:** Direct
339
- - **Test:** No
340
- - **Update:** memory.md only
341
- - **Response:** 2-3 sentences
342
-
343
- ### Small (5-15 min)
344
- - **Read:** 2-3 files + memory.md
345
- - **Plan:** Mental (no discussion)
346
- - **Code:** Straightforward
347
- - **Test:** If requested
348
- - **Update:** memory.md + tasks.md
349
- - **Response:** Brief summary
350
-
351
- ### Medium (15-30 min)
352
- - **Read:** Relevant context + affected code
353
- - **Plan:** Brief outline
354
- - **Code:** Systematic
355
- - **Test:** Critical paths
356
- - **Update:** All relevant docs
357
- - **Response:** Structured summary
358
-
359
- ### Large (30+ min)
360
- - **Read:** Full context review
361
- - **Plan:** Detailed, confirm with user
362
- - **Code:** Phased implementation
363
- - **Test:** Comprehensive
364
- - **Update:** All docs + audit if needed
365
- - **Response:** Complete summary
90
+ Spend tokens on: relevant code, clear concise updates, decisions/tradeoffs, error explanations, security/privacy considerations, clarification when truly unclear.
366
91
 
367
- ---
92
+ ### Caveman Mode (opt-in only)
368
93
 
369
- ## Efficiency Metrics (Self-Check)
94
+ Enable only when the user asks for ultra-concise output ("caveman mode", "be concise", "token optimize"). Never force it. Then: short sentences, no filler, facts only, action → result → done ("Done. Tested. Works."). Return to normal when the user asks.
370
95
 
371
- After each task, mentally verify:
96
+ ## Tool Selection
372
97
 
373
- - [ ] Read only necessary files? (not everything)
374
- - [ ] Skipped obvious verifications?
375
- - [ ] Response under 10 sentences? (unless complex)
376
- - [ ] Updated only changed docs?
377
- - [ ] No redundant explanations?
378
- - [ ] Communicated core info only?
98
+ Tiny change → read exact file. Pattern/similar code → grep. Unknown location → file search. Single edit → string replace; related edits → multiple edits; full rewrite → write file.
379
99
 
380
- **Goal: 80% fewer tokens for same quality output**
100
+ ## Pattern Shortcuts
381
101
 
382
- ---
102
+ | Request | Flow |
103
+ |---|---|
104
+ | Fix typo | Read file → fix → check change → done |
105
+ | Update button color | design.md → update → verify rendering |
106
+ | Add form field | Read form → add with validation → verify |
107
+ | Fix bug | Read → fix → verify → memory.md |
108
+ | Refactor | Read → plan → confirm with user → refactor incrementally, verifying |
383
109
 
384
- ## Examples: Before & After
385
-
386
- ### Example 1: Color Change
387
-
388
- **Before (Wasteful):**
389
- ```
390
- I'll start by reading the design system documentation to understand
391
- the color palette, then inspect the current button implementation
392
- to see how colors are applied, verify that the change won't affect
393
- other components, update the button component, test it visually,
394
- and update the documentation.
395
-
396
- [Reads 5 files]
397
- [Makes change]
398
- [Runs tests]
399
- [Long explanation of what was changed]
400
- ```
401
- **Tokens:** ~2000
402
-
403
- **After (Efficient):**
404
- ```
405
- Checking design.md... Primary blue is #2563eb.
406
-
407
- Changed Button.tsx:
408
- - bg-gray-500 → bg-blue-600
409
-
410
- Done.
411
- ```
412
- **Tokens:** ~100
413
-
414
- ### Example 2: Bug Fix
415
-
416
- **Before (Wasteful):**
417
- ```
418
- I understand you're experiencing an issue with the login form.
419
- Let me investigate by reading through the authentication flow,
420
- checking the form validation logic, inspecting the API route,
421
- and examining the error handling. After thorough analysis...
422
-
423
- [Reads 10 files]
424
- [Explains entire auth system]
425
- [Fixes bug]
426
- [Re-explains what was wrong]
427
- ```
428
- **Tokens:** ~3000
429
-
430
- **After (Efficient):**
431
- ```
432
- Found issue: Missing null check in auth.ts line 67.
433
-
434
- Fixed:
435
- if (user) { redirect('/dashboard') }
436
- →
437
- if (user?.id) { redirect('/dashboard') }
438
-
439
- Tested: Login works now.
440
- ```
441
- **Tokens:** ~150
442
-
443
- ---
444
-
445
- ## Summary: The Efficiency Mindset
446
-
447
- **Think:**
448
- - What's the MINIMUM I need to read?
449
- - What's the MINIMUM I need to verify?
450
- - What's the MINIMUM I need to say?
451
-
452
- **Default Mode:**
453
- 1. Read memory.md (quick context)
454
- 2. Read affected files only
455
- 3. Make change
456
- 4. Update memory.md
457
- 5. Brief confirmation
458
-
459
- **Caveman Mode Mantra:**
460
- - Short words
461
- - No fluff
462
- - Just facts
463
- - Action → Result → Done
464
-
465
- **Goal:** 5x faster task completion, 80% fewer tokens, same quality.
466
-
467
- ---
468
-
469
- ## Enable Caveman Mode
470
-
471
- **User says:** "Use caveman mode" or "Be concise" or "Token optimize"
472
-
473
- **You respond:**
474
- ```
475
- Caveman mode ON.
476
- Short responses.
477
- No fluff.
478
- Ready.
479
- ```
110
+ ## Self-Check
480
111
 
481
- **All subsequent responses:** Ultra-brief, action-focused, fact-only.
112
+ - Read only necessary files? Skipped redundant (not required) verification?
113
+ - Response short unless complex? Only changed docs updated? No redundant explanations?
114
+ - Estimate context-loading cost with `telo3 context <task> --measure`; report actual API usage only if the host exposes it.