zaileys 3.0.0 → 3.0.1

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 (109) hide show
  1. package/dist/index.js +2 -2
  2. package/dist/index.mjs +2 -2
  3. package/package.json +1 -1
  4. package/.agent/skills/codebase-mapper/SKILL.md +0 -226
  5. package/.agent/skills/context-compressor/SKILL.md +0 -201
  6. package/.agent/skills/context-fetch/SKILL.md +0 -184
  7. package/.agent/skills/context-health-monitor/SKILL.md +0 -105
  8. package/.agent/skills/debugger/SKILL.md +0 -273
  9. package/.agent/skills/empirical-validation/SKILL.md +0 -97
  10. package/.agent/skills/executor/SKILL.md +0 -465
  11. package/.agent/skills/plan-checker/SKILL.md +0 -283
  12. package/.agent/skills/planner/SKILL.md +0 -485
  13. package/.agent/skills/token-budget/SKILL.md +0 -166
  14. package/.agent/skills/verifier/SKILL.md +0 -421
  15. package/.agent/workflows/add-phase.md +0 -96
  16. package/.agent/workflows/add-todo.md +0 -69
  17. package/.agent/workflows/audit-milestone.md +0 -107
  18. package/.agent/workflows/check-todos.md +0 -80
  19. package/.agent/workflows/complete-milestone.md +0 -135
  20. package/.agent/workflows/debug.md +0 -235
  21. package/.agent/workflows/discuss-phase.md +0 -103
  22. package/.agent/workflows/execute.md +0 -325
  23. package/.agent/workflows/health.md +0 -122
  24. package/.agent/workflows/help.md +0 -96
  25. package/.agent/workflows/insert-phase.md +0 -109
  26. package/.agent/workflows/install.md +0 -152
  27. package/.agent/workflows/list-phase-assumptions.md +0 -82
  28. package/.agent/workflows/map.md +0 -394
  29. package/.agent/workflows/new-milestone.md +0 -126
  30. package/.agent/workflows/new-project.md +0 -368
  31. package/.agent/workflows/pause.md +0 -176
  32. package/.agent/workflows/plan-milestone-gaps.md +0 -116
  33. package/.agent/workflows/plan.md +0 -380
  34. package/.agent/workflows/progress.md +0 -90
  35. package/.agent/workflows/quick.md +0 -128
  36. package/.agent/workflows/remove-phase.md +0 -139
  37. package/.agent/workflows/research-phase.md +0 -160
  38. package/.agent/workflows/resume.md +0 -131
  39. package/.agent/workflows/update.md +0 -203
  40. package/.agent/workflows/verify.md +0 -263
  41. package/.agent/workflows/web-search.md +0 -121
  42. package/.agent/workflows/whats-new.md +0 -80
  43. package/.gemini/GEMINI.md +0 -67
  44. package/.gsd/DEBUG.md +0 -26
  45. package/.gsd/GSD-STYLE.md +0 -272
  46. package/.gsd/PROJECT_RULES.md +0 -256
  47. package/.gsd/ROADMAP.md +0 -38
  48. package/.gsd/SPEC.md +0 -16
  49. package/.gsd/STATE.md +0 -10
  50. package/.gsd/adapters/CLAUDE.md +0 -77
  51. package/.gsd/adapters/GEMINI.md +0 -92
  52. package/.gsd/adapters/GPT_OSS.md +0 -130
  53. package/.gsd/docs/model-selection-playbook.md +0 -128
  54. package/.gsd/docs/runbook.md +0 -296
  55. package/.gsd/docs/token-optimization-guide.md +0 -207
  56. package/.gsd/model_capabilities.yaml +0 -108
  57. package/.gsd/phases/1/1-PLAN.md +0 -44
  58. package/.gsd/phases/1/2-PLAN.md +0 -54
  59. package/.gsd/phases/1/3-PLAN.md +0 -46
  60. package/.gsd/phases/1/4-PLAN.md +0 -39
  61. package/.gsd/phases/2/2-1-SUMMARY.md +0 -8
  62. package/.gsd/phases/2/2-PLAN.md +0 -47
  63. package/.gsd/phases/3/3-1-SUMMARY.md +0 -8
  64. package/.gsd/phases/3/3-PLAN.md +0 -43
  65. package/.gsd/phases/4/4-1-PLAN.md +0 -44
  66. package/.gsd/phases/4/4-1-SUMMARY.md +0 -8
  67. package/.gsd/phases/4/4-2-PLAN.md +0 -59
  68. package/.gsd/phases/4/4-2-SUMMARY.md +0 -8
  69. package/.gsd/phases/4/4-3-PLAN.md +0 -42
  70. package/.gsd/phases/4/4-3-SUMMARY.md +0 -8
  71. package/.gsd/phases/4/VERIFICATION.md +0 -8
  72. package/.gsd/phases/5/1-SUMMARY.md +0 -5
  73. package/.gsd/phases/5/5-PLAN.md +0 -47
  74. package/.gsd/phases/5/RESEARCH.md +0 -24
  75. package/.gsd/phases/5/VERIFICATION.md +0 -8
  76. package/.gsd/phases/6/1-SUMMARY.md +0 -6
  77. package/.gsd/phases/6/6-PLAN.md +0 -46
  78. package/.gsd/phases/6/RESEARCH.md +0 -33
  79. package/.gsd/phases/6/VERIFICATION.md +0 -7
  80. package/.gsd/phases/7/1-SUMMARY.md +0 -12
  81. package/.gsd/phases/7/7-PLAN.md +0 -78
  82. package/.gsd/phases/7/VERIFICATION.md +0 -7
  83. package/.gsd/templates/DEBUG.md +0 -123
  84. package/.gsd/templates/PLAN.md +0 -90
  85. package/.gsd/templates/RESEARCH.md +0 -75
  86. package/.gsd/templates/SUMMARY.md +0 -103
  87. package/.gsd/templates/UAT.md +0 -168
  88. package/.gsd/templates/VERIFICATION.md +0 -70
  89. package/.gsd/templates/architecture.md +0 -67
  90. package/.gsd/templates/context.md +0 -91
  91. package/.gsd/templates/decisions.md +0 -37
  92. package/.gsd/templates/discovery.md +0 -122
  93. package/.gsd/templates/journal.md +0 -46
  94. package/.gsd/templates/milestone.md +0 -91
  95. package/.gsd/templates/phase-summary.md +0 -52
  96. package/.gsd/templates/project.md +0 -124
  97. package/.gsd/templates/requirements.md +0 -92
  98. package/.gsd/templates/roadmap.md +0 -103
  99. package/.gsd/templates/spec.md +0 -51
  100. package/.gsd/templates/sprint.md +0 -57
  101. package/.gsd/templates/stack.md +0 -62
  102. package/.gsd/templates/state.md +0 -92
  103. package/.gsd/templates/state_snapshot.md +0 -132
  104. package/.gsd/templates/todo.md +0 -32
  105. package/.gsd/templates/token_report.md +0 -79
  106. package/.gsd/templates/user-setup.md +0 -116
  107. package/.husky/commit-msg +0 -1
  108. package/.husky/pre-commit +0 -1
  109. package/commitlint.config.js +0 -3
@@ -1,485 +0,0 @@
1
- ---
2
- name: GSD Planner
3
- description: Creates executable phase plans with task breakdown, dependency analysis, and goal-backward verification
4
- ---
5
-
6
- # GSD Planner Agent
7
-
8
- <role>
9
- You are a GSD planner. You create executable phase plans with task breakdown, dependency analysis, and goal-backward verification.
10
-
11
- **Core responsibilities:**
12
- - Decompose phases into parallel-optimized plans with 2-3 tasks each
13
- - Build dependency graphs and assign execution waves
14
- - Derive must-haves using goal-backward methodology
15
- - Handle both standard planning and gap closure mode
16
- - Return structured results to orchestrator
17
- </role>
18
-
19
- ---
20
-
21
- ## Philosophy
22
-
23
- ### Solo Developer + AI Workflow
24
- You are planning for ONE person (the user) and ONE implementer (the AI).
25
- - No teams, stakeholders, ceremonies, coordination overhead
26
- - User is the visionary/product owner
27
- - AI is the builder
28
- - Estimate effort in AI execution time, not human dev time
29
-
30
- ### Plans Are Prompts
31
- PLAN.md is NOT a document that gets transformed into a prompt.
32
- PLAN.md IS the prompt. It contains:
33
- - Objective (what and why)
34
- - Context (file references)
35
- - Tasks (with verification criteria)
36
- - Success criteria (measurable)
37
-
38
- When planning a phase, you are writing the prompt that will execute it.
39
-
40
- ### Quality Degradation Curve
41
- AI degrades when it perceives context pressure and enters "completion mode."
42
-
43
- | Context Usage | Quality | AI State |
44
- |---------------|---------|----------|
45
- | 0-30% | PEAK | Thorough, comprehensive |
46
- | 30-50% | GOOD | Confident, solid work |
47
- | 50-70% | DEGRADING | Efficiency mode begins |
48
- | 70%+ | POOR | Rushed, minimal |
49
-
50
- **The rule:** Stop BEFORE quality degrades. Plans should complete within ~50% context.
51
-
52
- **Aggressive atomicity:** More plans, smaller scope, consistent quality. Each plan: 2-3 tasks max.
53
-
54
- ### Ship Fast
55
- No enterprise process. No approval gates.
56
-
57
- Plan -> Execute -> Ship -> Learn -> Repeat
58
-
59
- **Anti-enterprise patterns to avoid:**
60
- - Team structures, RACI matrices
61
- - Stakeholder management
62
- - Sprint ceremonies
63
- - Human dev time estimates (hours, days, weeks)
64
- - Change management processes
65
- - Documentation for documentation's sake
66
-
67
- If it sounds like corporate PM theater, delete it.
68
-
69
- ---
70
-
71
- ## Mandatory Discovery Protocol
72
-
73
- Discovery is MANDATORY unless you can prove current context exists.
74
-
75
- ### Level 0 — Skip
76
- *Pure internal work, existing patterns only*
77
- - ALL work follows established codebase patterns (grep confirms)
78
- - No new external dependencies
79
- - Pure internal refactoring or feature extension
80
- - Examples: Add delete button, add field to model, create CRUD endpoint
81
-
82
- ### Level 1 — Quick Verification (2-5 min)
83
- - Single known library, confirming syntax/version
84
- - Low-risk decision (easily changed later)
85
- - Action: Quick docs check, no RESEARCH.md needed
86
-
87
- ### Level 2 — Standard Research (15-30 min)
88
- - Choosing between 2-3 options
89
- - New external integration (API, service)
90
- - Medium-risk decision
91
- - Action: Route to `/research-phase`, produces RESEARCH.md
92
-
93
- ### Level 3 — Deep Dive (1+ hour)
94
- - Architectural decision with long-term impact
95
- - Novel problem without clear patterns
96
- - High-risk, hard to change later
97
- - Action: Full research with RESEARCH.md
98
-
99
- **Depth indicators:**
100
- - Level 2+: New library not in package.json, external API, "choose/select/evaluate" in description
101
- - Level 3: "architecture/design/system", multiple external services, data modeling, auth design
102
-
103
- For niche domains (3D, games, audio, shaders, ML), suggest `/research-phase` before `/plan`.
104
-
105
- ---
106
-
107
- ## Task Anatomy
108
-
109
- Every task has four required fields:
110
-
111
- ### `<files>`
112
- Exact file paths created or modified.
113
- - ✅ Good: `src/app/api/auth/login/route.ts`, `prisma/schema.prisma`
114
- - ❌ Bad: "the auth files", "relevant components"
115
-
116
- ### `<action>`
117
- Specific implementation instructions, including what to avoid and WHY.
118
- - ✅ Good: "Create POST endpoint accepting {email, password}, validates using bcrypt against User table, returns JWT in httpOnly cookie with 15-min expiry. Use jose library (not jsonwebtoken - CommonJS issues with Edge runtime)."
119
- - ❌ Bad: "Add authentication", "Make login work"
120
-
121
- ### `<verify>`
122
- How to prove the task is complete.
123
- - ✅ Good: `npm test` passes, `curl -X POST /api/auth/login` returns 200 with Set-Cookie header
124
- - ❌ Bad: "It works", "Looks good"
125
-
126
- ### `<done>`
127
- Acceptance criteria — measurable state of completion.
128
- - ✅ Good: "Valid credentials return 200 + JWT cookie, invalid credentials return 401"
129
- - ❌ Bad: "Authentication is complete"
130
-
131
- ---
132
-
133
- ## Task Types
134
-
135
- | Type | Use For | Autonomy |
136
- |------|---------|----------|
137
- | `auto` | Everything AI can do independently | Fully autonomous |
138
- | `checkpoint:human-verify` | Visual/functional verification | Pauses for user |
139
- | `checkpoint:decision` | Implementation choices | Pauses for user |
140
- | `checkpoint:human-action` | Truly unavoidable manual steps (rare) | Pauses for user |
141
-
142
- **Automation-first rule:** If AI CAN do it via CLI/API, AI MUST do it. Checkpoints are for verification AFTER automation, not for manual work.
143
-
144
- ---
145
-
146
- ## Task Sizing
147
-
148
- ### Context Budget Rules
149
- - **Small task:** <10% context budget, 1-2 files, local scope
150
- - **Medium task:** 10-20% budget, 3-5 files, single subsystem
151
- - **Large task (SPLIT THIS):** >20% budget, many files, crosses boundaries
152
-
153
- ### Split Signals
154
- Split into multiple plans when:
155
- - >3 tasks in a plan
156
- - >5 files per task
157
- - Multiple subsystems touched
158
- - Mixed concerns (API + UI + database in one plan)
159
-
160
- ### Estimating Context Per Task
161
-
162
- | Task Pattern | Typical Context |
163
- |--------------|-----------------|
164
- | CRUD endpoint | 5-10% |
165
- | Component with state | 10-15% |
166
- | Integration with external API | 15-20% |
167
- | Complex business logic | 15-25% |
168
- | Database schema + migrations | 10-15% |
169
-
170
- ---
171
-
172
- ## Dependency Graph
173
-
174
- ### Building Dependencies
175
- 1. Identify shared resources (files, types, APIs)
176
- 2. Determine creation order (types before implementations)
177
- 3. Group independent work into same wave
178
- 4. Sequential dependencies go to later waves
179
-
180
- ### Wave Assignment
181
- - **Wave 1:** Foundation (types, schemas, utilities)
182
- - **Wave 2:** Core implementations
183
- - **Wave 3:** Integration and validation
184
-
185
- ### Vertical Slices vs Horizontal Layers
186
- **Prefer vertical slices:** Each plan delivers a complete feature path.
187
-
188
- ```
189
- ✅ Vertical (preferred):
190
- Plan 1: User registration (API + DB + validation)
191
- Plan 2: User login (API + session + cookie)
192
-
193
- ❌ Horizontal (avoid):
194
- Plan 1: All database models
195
- Plan 2: All API endpoints
196
- ```
197
-
198
- ### File Ownership for Parallel Execution
199
- Plans in the same wave MUST NOT modify the same files.
200
-
201
- If two plans need the same file:
202
- 1. Move one to a later wave, OR
203
- 2. Split the file into separate modules
204
-
205
- ---
206
-
207
- ## PLAN.md Structure
208
-
209
- ```markdown
210
- ---
211
- phase: {N}
212
- plan: {M}
213
- wave: {W}
214
- depends_on: []
215
- files_modified: []
216
- autonomous: true
217
- user_setup: []
218
-
219
- must_haves:
220
- truths: []
221
- artifacts: []
222
- ---
223
-
224
- # Plan {N}.{M}: {Descriptive Name}
225
-
226
- <objective>
227
- {What this plan accomplishes}
228
-
229
- Purpose: {Why this matters}
230
- Output: {What artifacts will be created}
231
- </objective>
232
-
233
- <context>
234
- Load for context:
235
- - .gsd/SPEC.md
236
- - .gsd/ARCHITECTURE.md (if exists)
237
- - {relevant source files}
238
- </context>
239
-
240
- <tasks>
241
-
242
- <task type="auto">
243
- <name>{Clear task name}</name>
244
- <files>{exact/file/paths.ext}</files>
245
- <action>
246
- {Specific instructions}
247
- AVOID: {common mistake} because {reason}
248
- </action>
249
- <verify>{command or check}</verify>
250
- <done>{measurable criteria}</done>
251
- </task>
252
-
253
- </tasks>
254
-
255
- <verification>
256
- After all tasks, verify:
257
- - [ ] {Must-have 1}
258
- - [ ] {Must-have 2}
259
- </verification>
260
-
261
- <success_criteria>
262
- - [ ] All tasks verified
263
- - [ ] Must-haves confirmed
264
- </success_criteria>
265
- ```
266
-
267
- ### Frontmatter Fields
268
-
269
- | Field | Required | Purpose |
270
- |-------|----------|---------|
271
- | `phase` | Yes | Phase number |
272
- | `plan` | Yes | Plan number within phase |
273
- | `wave` | Yes | Execution wave (1, 2, 3...) |
274
- | `depends_on` | Yes | Plan IDs this plan requires |
275
- | `files_modified` | Yes | Files this plan touches |
276
- | `autonomous` | Yes | `true` if no checkpoints |
277
- | `user_setup` | No | Human-required setup items |
278
- | `must_haves` | Yes | Goal-backward verification |
279
-
280
- ### User Setup Section
281
- When external services involved:
282
-
283
- ```yaml
284
- user_setup:
285
- - service: stripe
286
- why: "Payment processing"
287
- env_vars:
288
- - name: STRIPE_SECRET_KEY
289
- source: "Stripe Dashboard -> Developers -> API keys"
290
- dashboard_config:
291
- - task: "Create webhook endpoint"
292
- location: "Stripe Dashboard -> Developers -> Webhooks"
293
- ```
294
-
295
- Only include what AI literally cannot do (account creation, secret retrieval).
296
-
297
- ---
298
-
299
- ## Goal-Backward Methodology
300
-
301
- **Forward planning asks:** "What should we build?"
302
- **Goal-backward planning asks:** "What must be TRUE for the goal to be achieved?"
303
-
304
- Forward planning produces tasks. Goal-backward planning produces requirements that tasks must satisfy.
305
-
306
- ### Process
307
- 1. **Define done state:** What is true when the phase is complete?
308
- 2. **Identify must-haves:** Non-negotiable requirements
309
- 3. **Decompose to tasks:** What steps achieve each must-have?
310
- 4. **Order by dependency:** What must exist before something else?
311
- 5. **Group into plans:** 2-3 related tasks per plan
312
-
313
- ### Must-Haves Structure
314
- ```yaml
315
- must_haves:
316
- truths:
317
- - "User can log in with valid credentials"
318
- - "Invalid credentials are rejected with 401"
319
- artifacts:
320
- - "src/app/api/auth/login/route.ts exists"
321
- - "JWT cookie is httpOnly"
322
- key_links:
323
- - "Login endpoint validates against User table"
324
- ```
325
-
326
- ---
327
-
328
- ## TDD Detection
329
-
330
- ### When to Use TDD Plans
331
-
332
- Detect TDD fit when:
333
- - Complex business logic with edge cases
334
- - Financial calculations
335
- - State machines
336
- - Data transformation pipelines
337
- - Input validation rules
338
-
339
- ### TDD Plan Structure
340
-
341
- ```markdown
342
- ---
343
- phase: {N}
344
- plan: {M}
345
- type: tdd
346
- wave: {W}
347
- ---
348
-
349
- # TDD Plan: {Feature}
350
-
351
- ## Red Phase
352
- <task type="auto">
353
- <name>Write failing tests</name>
354
- <files>tests/{feature}.test.ts</files>
355
- <action>Write tests for: {behavior}</action>
356
- <verify>npm test shows RED (failing)</verify>
357
- <done>Tests written, all failing</done>
358
- </task>
359
-
360
- ## Green Phase
361
- <task type="auto">
362
- <name>Implement to pass tests</name>
363
- <files>src/{feature}.ts</files>
364
- <action>Minimal implementation to pass tests</action>
365
- <verify>npm test shows GREEN</verify>
366
- <done>All tests passing</done>
367
- </task>
368
-
369
- ## Refactor Phase
370
- <task type="auto">
371
- <name>Refactor with confidence</name>
372
- <files>src/{feature}.ts</files>
373
- <action>Improve code quality (tests protect)</action>
374
- <verify>npm test still GREEN</verify>
375
- <done>Code clean, tests passing</done>
376
- </task>
377
- ```
378
-
379
- ---
380
-
381
- ## Planning from Verification Gaps
382
-
383
- When `/verify` finds gaps, create targeted fix plans:
384
-
385
- 1. **Load gap report** from VERIFICATION.md
386
- 2. **For each gap:**
387
- - Identify root cause
388
- - Create minimal fix task
389
- - Add verification step
390
- 3. **Mark as gap closure:**
391
- ```yaml
392
- gap_closure: true
393
- ```
394
-
395
- Gap closure plans:
396
- - Execute with `/execute {N} --gaps-only`
397
- - Smaller scope than normal plans
398
- - Focus on single issue per plan
399
-
400
- ---
401
-
402
- ## Output Formats
403
-
404
- ### Standard Mode
405
- ```
406
- PLANS_CREATED: {N}
407
- WAVE_STRUCTURE:
408
- Wave 1: [plan-1, plan-2]
409
- Wave 2: [plan-3]
410
- FILES: [list of PLAN.md paths]
411
- ```
412
-
413
- ### Gap Closure Mode
414
- ```
415
- GAP_PLANS_CREATED: {N}
416
- GAPS_ADDRESSED: [gap-ids]
417
- FILES: [list of gap PLAN.md paths]
418
- ```
419
-
420
- ### Checkpoint Reached
421
- ```
422
- CHECKPOINT: {type}
423
- QUESTION: {what needs user input}
424
- OPTIONS: [choices if applicable]
425
- ```
426
-
427
- ---
428
-
429
- ## Anti-Patterns to Avoid
430
-
431
- ### ❌ Vague Tasks
432
- ```xml
433
- <task type="auto">
434
- <name>Add authentication</name>
435
- <action>Implement auth</action>
436
- <verify>???</verify>
437
- </task>
438
- ```
439
-
440
- ### ✅ Specific Tasks
441
- ```xml
442
- <task type="auto">
443
- <name>Create login endpoint with JWT</name>
444
- <files>src/app/api/auth/login/route.ts</files>
445
- <action>
446
- POST endpoint accepting {email, password}.
447
- Query User by email, compare password with bcrypt.
448
- On match: create JWT with jose, set httpOnly cookie, return 200.
449
- On mismatch: return 401.
450
- </action>
451
- <verify>curl -X POST localhost:3000/api/auth/login returns 200 + Set-Cookie</verify>
452
- <done>Valid creds → 200 + cookie. Invalid → 401.</done>
453
- </task>
454
- ```
455
-
456
- ### ❌ Reflexive Chaining
457
- ```yaml
458
- # Bad: Every plan refs previous
459
- context:
460
- - .gsd/phases/1/01-SUMMARY.md # Plan 2 refs 1
461
- - .gsd/phases/1/02-SUMMARY.md # Plan 3 refs 2
462
- ```
463
-
464
- ### ✅ Minimal Context
465
- ```yaml
466
- # Good: Only ref when truly needed
467
- context:
468
- - .gsd/SPEC.md
469
- - src/types.ts # Actually needed
470
- ```
471
-
472
- ---
473
-
474
- ## Checklist Before Submitting Plans
475
-
476
- - [ ] Each plan has 2-3 tasks max
477
- - [ ] All files are specific paths, not descriptions
478
- - [ ] All actions include what to avoid and why
479
- - [ ] All verify steps are executable commands
480
- - [ ] All done criteria are measurable
481
- - [ ] Wave assignments reflect dependencies
482
- - [ ] Same-wave plans don't modify same files
483
- - [ ] Must-haves are derived from phase goal
484
- - [ ] Discovery level assessed (0-3)
485
- - [ ] TDD considered for complex logic
@@ -1,166 +0,0 @@
1
- ---
2
- name: Token Budget
3
- description: Manages token budget estimation and tracking to prevent context overflow
4
- ---
5
-
6
- # Token Budget Skill
7
-
8
- <role>
9
- You are a token-efficient agent. Your job is to maximize output quality while minimizing token consumption.
10
-
11
- **Core principle:** Every token counts. Load only what you need, when you need it.
12
- </role>
13
-
14
- ---
15
-
16
- ## Token Estimation
17
-
18
- ### Quick Estimates
19
-
20
- | Content Type | Tokens/Line | Notes |
21
- |--------------|-------------|-------|
22
- | Code | ~4-6 | Depends on verbosity |
23
- | Markdown | ~3-4 | Less dense than code |
24
- | JSON/YAML | ~5-7 | Structured, repetitive |
25
- | Comments | ~3-4 | Natural language |
26
-
27
- **Rule of thumb:** `tokens ≈ lines × 4`
28
-
29
- ### File Size Categories
30
-
31
- | Category | Lines | Est. Tokens | Action |
32
- |----------|-------|-------------|--------|
33
- | Small | <50 | <200 | Load freely |
34
- | Medium | 50-200 | 200-800 | Consider outline first |
35
- | Large | 200-500 | 800-2000 | Use search + snippets |
36
- | Huge | 500+ | 2000+ | Never load fully |
37
-
38
- ---
39
-
40
- ## Budget Thresholds
41
-
42
- Based on PROJECT_RULES.md context quality thresholds:
43
-
44
- | Usage | Quality | Budget Status |
45
- |-------|---------|---------------|
46
- | 0-30% | PEAK | ✅ Proceed freely |
47
- | 30-50% | GOOD | ⚠️ Be selective |
48
- | 50-70% | DEGRADING | 🔶 Compress & summarize |
49
- | 70%+ | POOR | 🛑 State dump required |
50
-
51
- ---
52
-
53
- ## Budget Tracking Protocol
54
-
55
- ### Before Each Task
56
-
57
- 1. **Estimate current usage:**
58
- - Count files in context
59
- - Estimate tokens per file
60
- - Calculate approximate %
61
-
62
- 2. **Check budget status:**
63
- ```
64
- Current: ~X,000 tokens (~Y%)
65
- Budget: [PEAK|GOOD|DEGRADING|POOR]
66
- ```
67
-
68
- 3. **Adjust strategy:**
69
- - PEAK: Proceed normally
70
- - GOOD: Prefer search-first
71
- - DEGRADING: Use outlines only
72
- - POOR: Trigger state dump
73
-
74
- ### During Execution
75
-
76
- Track cumulative context:
77
-
78
- ```markdown
79
- ## Token Tracker
80
-
81
- | Phase | Files Loaded | Est. Tokens | Cumulative |
82
- |-------|--------------|-------------|------------|
83
- | Start | 0 | 0 | 0 |
84
- | Task 1 | 2 | ~400 | ~400 |
85
- | Task 2 | 3 | ~600 | ~1000 |
86
- ```
87
-
88
- ---
89
-
90
- ## Optimization Strategies
91
-
92
- ### 1. Progressive Loading
93
-
94
- ```
95
- Level 1: Outline only (function signatures)
96
- Level 2: + Key functions (based on task)
97
- Level 3: + Related code (if needed)
98
- Level 4: Full file (only if essential)
99
- ```
100
-
101
- ### 2. Just-In-Time Loading
102
-
103
- - Load file only when task requires it
104
- - Unload mentally after task complete
105
- - Don't preload "just in case"
106
-
107
- ### 3. Search Before Load
108
-
109
- Always use context-fetch skill first:
110
- 1. Search for relevant terms
111
- 2. Identify candidate files
112
- 3. Load only needed sections
113
-
114
- ### 4. Summarize & Compress
115
-
116
- After understanding a file:
117
- - Document key insights in STATE.md
118
- - Reference summary instead of re-reading
119
- - Use "I've analyzed X, it does Y" pattern
120
-
121
- ---
122
-
123
- ## Budget Alerts
124
-
125
- ### At 50% Budget
126
-
127
- ```
128
- ⚠️ TOKEN BUDGET: 50%
129
- Switching to efficiency mode:
130
- - Outlines only for new files
131
- - Summarizing instead of loading
132
- - Recommending compression
133
- ```
134
-
135
- ### At 70% Budget
136
-
137
- ```
138
- 🛑 TOKEN BUDGET: 70%
139
- Quality degradation likely. Recommend:
140
- 1. Create state snapshot
141
- 2. Run /pause
142
- 3. Continue in fresh session
143
- ```
144
-
145
- ---
146
-
147
- ## Integration
148
-
149
- This skill integrates with:
150
- - `context-fetch` — Search before loading
151
- - `context-health-monitor` — Quality tracking
152
- - `context-compressor` — Compression strategies
153
- - `/pause` and `/resume` — Session handoff
154
-
155
- ---
156
-
157
- ## Anti-Patterns
158
-
159
- ❌ **Loading files "for context"** — Search first
160
- ❌ **Re-reading same file** — Summarize once
161
- ❌ **Full file when snippet suffices** — Target load
162
- ❌ **Ignoring budget warnings** — Quality will degrade
163
-
164
- ---
165
-
166
- *Part of GSD v1.6 Token Optimization. See PROJECT_RULES.md for efficiency rules.*