@flydocs/cli 0.5.0-beta.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 (134) hide show
  1. package/README.md +96 -0
  2. package/dist/cli.js +2666 -0
  3. package/package.json +32 -0
  4. package/template/.claude/CLAUDE.md +90 -0
  5. package/template/.claude/agents/README.md +19 -0
  6. package/template/.claude/agents/implementation-agent.md +29 -0
  7. package/template/.claude/agents/pm-agent.md +29 -0
  8. package/template/.claude/agents/research-agent.md +25 -0
  9. package/template/.claude/agents/review-agent.md +29 -0
  10. package/template/.claude/commands/activate.md +10 -0
  11. package/template/.claude/commands/attach.md +9 -0
  12. package/template/.claude/commands/block.md +10 -0
  13. package/template/.claude/commands/capture.md +10 -0
  14. package/template/.claude/commands/close.md +10 -0
  15. package/template/.claude/commands/flydocs-setup.md +598 -0
  16. package/template/.claude/commands/flydocs-update.md +27 -0
  17. package/template/.claude/commands/implement.md +10 -0
  18. package/template/.claude/commands/new-project.md +11 -0
  19. package/template/.claude/commands/project-update.md +10 -0
  20. package/template/.claude/commands/refine.md +10 -0
  21. package/template/.claude/commands/review.md +10 -0
  22. package/template/.claude/commands/start-session.md +10 -0
  23. package/template/.claude/commands/status.md +10 -0
  24. package/template/.claude/commands/validate.md +10 -0
  25. package/template/.claude/commands/wrap-session.md +10 -0
  26. package/template/.claude/settings.json +49 -0
  27. package/template/.claude/skills/README.md +293 -0
  28. package/template/.claude/skills/flydocs-cloud/SKILL.md +96 -0
  29. package/template/.claude/skills/flydocs-cloud/cursor-rule.mdc +50 -0
  30. package/template/.claude/skills/flydocs-cloud/scripts/assign.py +38 -0
  31. package/template/.claude/skills/flydocs-cloud/scripts/assign_cycle.py +44 -0
  32. package/template/.claude/skills/flydocs-cloud/scripts/assign_milestone.py +44 -0
  33. package/template/.claude/skills/flydocs-cloud/scripts/comment.py +39 -0
  34. package/template/.claude/skills/flydocs-cloud/scripts/create_issue.py +100 -0
  35. package/template/.claude/skills/flydocs-cloud/scripts/create_milestone.py +46 -0
  36. package/template/.claude/skills/flydocs-cloud/scripts/create_project.py +40 -0
  37. package/template/.claude/skills/flydocs-cloud/scripts/estimate.py +38 -0
  38. package/template/.claude/skills/flydocs-cloud/scripts/flydocs_api.py +277 -0
  39. package/template/.claude/skills/flydocs-cloud/scripts/get_issue.py +77 -0
  40. package/template/.claude/skills/flydocs-cloud/scripts/link.py +47 -0
  41. package/template/.claude/skills/flydocs-cloud/scripts/list_cycles.py +35 -0
  42. package/template/.claude/skills/flydocs-cloud/scripts/list_issues.py +105 -0
  43. package/template/.claude/skills/flydocs-cloud/scripts/list_milestones.py +40 -0
  44. package/template/.claude/skills/flydocs-cloud/scripts/list_projects.py +45 -0
  45. package/template/.claude/skills/flydocs-cloud/scripts/priority.py +38 -0
  46. package/template/.claude/skills/flydocs-cloud/scripts/project_update.py +59 -0
  47. package/template/.claude/skills/flydocs-cloud/scripts/transition.py +67 -0
  48. package/template/.claude/skills/flydocs-cloud/scripts/update_description.py +47 -0
  49. package/template/.claude/skills/flydocs-cloud/scripts/update_issue.py +111 -0
  50. package/template/.claude/skills/flydocs-context-graph/SKILL.md +87 -0
  51. package/template/.claude/skills/flydocs-context-graph/schema.md +78 -0
  52. package/template/.claude/skills/flydocs-context-graph/scripts/graph_build.py +299 -0
  53. package/template/.claude/skills/flydocs-context-graph/scripts/graph_context.py +338 -0
  54. package/template/.claude/skills/flydocs-context-graph/scripts/graph_query.py +191 -0
  55. package/template/.claude/skills/flydocs-context-graph/scripts/graph_session.py +161 -0
  56. package/template/.claude/skills/flydocs-context-graph/scripts/graph_update.py +194 -0
  57. package/template/.claude/skills/flydocs-context-graph/scripts/graph_utils.py +118 -0
  58. package/template/.claude/skills/flydocs-estimates/SKILL.md +384 -0
  59. package/template/.claude/skills/flydocs-estimates/references/provider-costs.md +152 -0
  60. package/template/.claude/skills/flydocs-figma/SKILL.md +377 -0
  61. package/template/.claude/skills/flydocs-figma/references/PROMPTING.md +108 -0
  62. package/template/.claude/skills/flydocs-figma/references/TROUBLESHOOTING.md +112 -0
  63. package/template/.claude/skills/flydocs-local/SKILL.md +103 -0
  64. package/template/.claude/skills/flydocs-local/cursor-rule.mdc +43 -0
  65. package/template/.claude/skills/flydocs-local/scripts/assign.py +20 -0
  66. package/template/.claude/skills/flydocs-local/scripts/comment.py +27 -0
  67. package/template/.claude/skills/flydocs-local/scripts/create_issue.py +44 -0
  68. package/template/.claude/skills/flydocs-local/scripts/estimate.py +37 -0
  69. package/template/.claude/skills/flydocs-local/scripts/flydocs_api.py +272 -0
  70. package/template/.claude/skills/flydocs-local/scripts/get_issue.py +20 -0
  71. package/template/.claude/skills/flydocs-local/scripts/link.py +41 -0
  72. package/template/.claude/skills/flydocs-local/scripts/list_issues.py +34 -0
  73. package/template/.claude/skills/flydocs-local/scripts/priority.py +37 -0
  74. package/template/.claude/skills/flydocs-local/scripts/project_update.py +67 -0
  75. package/template/.claude/skills/flydocs-local/scripts/status_summary.py +16 -0
  76. package/template/.claude/skills/flydocs-local/scripts/transition.py +24 -0
  77. package/template/.claude/skills/flydocs-local/scripts/update_description.py +35 -0
  78. package/template/.claude/skills/flydocs-local/scripts/update_issue.py +84 -0
  79. package/template/.claude/skills/flydocs-workflow/SKILL.md +85 -0
  80. package/template/.claude/skills/flydocs-workflow/cursor-rule.mdc +53 -0
  81. package/template/.claude/skills/flydocs-workflow/reference/comment-templates.md +131 -0
  82. package/template/.claude/skills/flydocs-workflow/reference/golden-rules.md +76 -0
  83. package/template/.claude/skills/flydocs-workflow/reference/priority-estimates.md +28 -0
  84. package/template/.claude/skills/flydocs-workflow/reference/status-workflow.md +50 -0
  85. package/template/.claude/skills/flydocs-workflow/session.md +128 -0
  86. package/template/.claude/skills/flydocs-workflow/stages/activate.md +46 -0
  87. package/template/.claude/skills/flydocs-workflow/stages/capture.md +50 -0
  88. package/template/.claude/skills/flydocs-workflow/stages/close.md +32 -0
  89. package/template/.claude/skills/flydocs-workflow/stages/implement.md +124 -0
  90. package/template/.claude/skills/flydocs-workflow/stages/refine.md +51 -0
  91. package/template/.claude/skills/flydocs-workflow/stages/review.md +86 -0
  92. package/template/.claude/skills/flydocs-workflow/stages/validate.md +90 -0
  93. package/template/.claude/skills/flydocs-workflow/templates/bug.md +95 -0
  94. package/template/.claude/skills/flydocs-workflow/templates/chore.md +75 -0
  95. package/template/.claude/skills/flydocs-workflow/templates/feature.md +93 -0
  96. package/template/.claude/skills/flydocs-workflow/templates/idea.md +84 -0
  97. package/template/.cursor/agents/implementation-agent.md +28 -0
  98. package/template/.cursor/agents/pm-agent.md +27 -0
  99. package/template/.cursor/agents/research-agent.md +23 -0
  100. package/template/.cursor/agents/review-agent.md +27 -0
  101. package/template/.cursor/hooks.json +29 -0
  102. package/template/.cursor/mcp.json +16 -0
  103. package/template/.env.example +44 -0
  104. package/template/.flydocs/config.json +104 -0
  105. package/template/.flydocs/hooks/auto-approve.py +71 -0
  106. package/template/.flydocs/hooks/post-edit.py +72 -0
  107. package/template/.flydocs/hooks/prefer-scripts.py +89 -0
  108. package/template/.flydocs/hooks/prompt-submit.py +277 -0
  109. package/template/.flydocs/scripts/generate_manifest.py +287 -0
  110. package/template/.flydocs/scripts/skill_manager.py +541 -0
  111. package/template/.flydocs/templates/README.md +46 -0
  112. package/template/.flydocs/templates/bug.md +166 -0
  113. package/template/.flydocs/templates/chore.md +110 -0
  114. package/template/.flydocs/templates/design-system/README.md +27 -0
  115. package/template/.flydocs/templates/design-system/component-patterns.md +92 -0
  116. package/template/.flydocs/templates/design-system/token-mapping.md +168 -0
  117. package/template/.flydocs/templates/feature.md +173 -0
  118. package/template/.flydocs/templates/idea.md +122 -0
  119. package/template/.flydocs/templates/instructions.md +228 -0
  120. package/template/.flydocs/templates/quick-capture.md +35 -0
  121. package/template/.flydocs/templates/scripts/check-design-system.template.mjs +179 -0
  122. package/template/.flydocs/version +1 -0
  123. package/template/AGENTS.md +95 -0
  124. package/template/CHANGELOG.md +271 -0
  125. package/template/flydocs/README.md +186 -0
  126. package/template/flydocs/context/project.md +51 -0
  127. package/template/flydocs/design-system/README.md +126 -0
  128. package/template/flydocs/design-system/component-patterns.md +173 -0
  129. package/template/flydocs/design-system/token-mapping.md +114 -0
  130. package/template/flydocs/knowledge/INDEX.md +100 -0
  131. package/template/flydocs/knowledge/README.md +62 -0
  132. package/template/flydocs/knowledge/product/personas.md +79 -0
  133. package/template/flydocs/knowledge/product/user-flows.md +88 -0
  134. package/template/manifest.json +221 -0
@@ -0,0 +1,384 @@
1
+ ---
2
+ name: flydocs-estimates
3
+ description: "FlyDocs premium: Estimates token usage and API costs for AI development tasks. Apply when refining issues, activating work, or when user asks about costs. v1.0: Guidance-only. Future: Scripts via API relay for premium functionality."
4
+ triggers:
5
+ - estimate
6
+ - cost
7
+ - token usage
8
+ - API cost
9
+ - labor estimate
10
+ - sizing
11
+ - effort
12
+ ---
13
+
14
+ # FlyDocs Estimates
15
+
16
+ > **Purpose**: Estimate token usage and API costs for AI-driven development tasks before implementation begins.
17
+
18
+ ---
19
+
20
+ ## Opt-In Feature
21
+
22
+ **This skill is disabled by default.** To enable, set in `.flydocs/config.json`:
23
+
24
+ ```json
25
+ {
26
+ "aiLabor": {
27
+ "enabled": true
28
+ }
29
+ }
30
+ ```
31
+
32
+ ### Before Using This Skill
33
+
34
+ ```
35
+ □ 1. CHECK config: Read .flydocs/config.json
36
+ □ 2. IF aiLabor.enabled !== true:
37
+ → DO NOT apply any rules from this skill
38
+ → DO NOT warn about missing estimates
39
+ → DO NOT add estimate sections to issues
40
+ → Proceed with standard workflow
41
+ □ 3. IF aiLabor.enabled === true:
42
+ → Apply all rules below
43
+ ```
44
+
45
+ **When disabled**: This skill is completely silent. No warnings, no prompts, no estimate tracking.
46
+
47
+ ---
48
+
49
+ ## Overview
50
+
51
+ This skill enables agents to:
52
+ 1. **Analyze specs** to predict token consumption
53
+ 2. **Calculate cost ranges** based on provider pricing
54
+ 3. **Track actuals** for calibration over time
55
+ 4. **Compare** Human vs AI vs Hybrid cost projections
56
+
57
+ ---
58
+
59
+ ## When to Use (Only if enabled)
60
+
61
+ | Trigger | Action |
62
+ |---------|--------|
63
+ | `/refine [spec]` | Calculate estimate, add to issue |
64
+ | `/activate [spec]` | Validate estimate exists; if missing, offer to calculate; warn on high estimates |
65
+ | `/implement [spec]` | Show estimate in checklist if present |
66
+ | `/close [spec]` | Record actuals, calculate variance |
67
+ | Implementation complete | Estimate tokens used, update actuals in issue |
68
+ | User asks "how much will this cost?" | Run estimation |
69
+
70
+ ### Validation Flow (for /activate and /implement) — Only When Enabled
71
+
72
+ ```
73
+ 1. Read issue description
74
+ 2. Search for "## AI Effort Estimate" section
75
+ 3. IF missing:
76
+ → OFFER: "Would you like me to calculate an AI Effort Estimate?"
77
+ → IF yes: Run estimation, update description
78
+ → IF no: Proceed normally
79
+ 4. IF present but has placeholders ([X]k):
80
+ → OFFER: "Estimate exists but incomplete. Fill it now?"
81
+ 5. IF estimate exceeds thresholds:
82
+ → tokens > 200k OR cost > $5: Show warning
83
+ → cost > $10: Require explicit approval
84
+ 6. Continue with activation/implementation
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Estimation Formula
90
+
91
+ ```
92
+ estimated_tokens = base_tokens × scope_mult × novelty_mult × clarity_mult × codebase_mult
93
+
94
+ Where:
95
+ base_tokens = task type baseline (see table below)
96
+ scope_mult = 0.5 (S) / 1.0 (M) / 2.0 (L) / 4.0 (XL)
97
+ novelty_mult = 0.7 (existing pattern) / 1.2 (partial new) / 2.0 (greenfield)
98
+ clarity_mult = 0.8 (well-defined) / 1.5 (needs discovery) / 2.5 (exploratory)
99
+ codebase_mult = 0.8 (simple) / 1.0 (moderate) / 1.5 (complex)
100
+
101
+ Confidence Range:
102
+ low_estimate = estimated_tokens × 0.6
103
+ high_estimate = estimated_tokens × 2.5
104
+ ```
105
+
106
+ ### Base Tokens by Task Type
107
+
108
+ | Task Type | Base Tokens | Rationale |
109
+ |-----------|-------------|-----------|
110
+ | **feature** | 40,000 | Full cycle: plan, implement, iterate, review |
111
+ | **bug** | 20,000 | Investigation + targeted fix |
112
+ | **chore** | 10,000 | Usually straightforward |
113
+ | **idea** | 5,000 | Quick exploration only |
114
+
115
+ ---
116
+
117
+ ## Scoring Multipliers
118
+
119
+ ### Scope (from Complexity field)
120
+
121
+ | Complexity | Multiplier | Indicators |
122
+ |------------|------------|------------|
123
+ | **S** | 0.5 | 1-3 acceptance criteria, single file |
124
+ | **M** | 1.0 | 4-6 acceptance criteria, 2-5 files |
125
+ | **L** | 2.0 | 7-10 acceptance criteria, multiple modules |
126
+ | **XL** | 4.0 | 10+ criteria, cross-cutting changes |
127
+
128
+ ### Novelty (from Technical Notes)
129
+
130
+ | Level | Multiplier | Indicators |
131
+ |-------|------------|------------|
132
+ | **existing-pattern** | 0.7 | "Follow existing X pattern", references similar code |
133
+ | **partial-new** | 1.2 | Mix of new + existing, some exploration needed |
134
+ | **greenfield** | 2.0 | New patterns, no precedent in codebase |
135
+
136
+ ### Clarity (from Acceptance Criteria quality)
137
+
138
+ | Level | Multiplier | Indicators |
139
+ |-------|------------|------------|
140
+ | **well-defined** | 0.8 | All criteria specific & testable |
141
+ | **needs-discovery** | 1.5 | Some vague criteria, needs investigation |
142
+ | **exploratory** | 2.5 | Research-heavy, unclear solution |
143
+
144
+ ### Codebase Complexity (from `stack.md`)
145
+
146
+ | Level | Multiplier | Indicators |
147
+ |-------|------------|------------|
148
+ | **simple** | 0.8 | Small codebase, clear patterns |
149
+ | **moderate** | 1.0 | Standard project, documented patterns |
150
+ | **complex** | 1.5 | Large codebase, multiple integrations |
151
+
152
+ ---
153
+
154
+ ## Cost Calculation
155
+
156
+ ```
157
+ cost = tokens × (input_rate × input_ratio + output_rate × output_ratio)
158
+
159
+ Where:
160
+ input_rate = provider cost per 1M input tokens
161
+ output_rate = provider cost per 1M output tokens
162
+ input_ratio = 0.70 (typical for development)
163
+ output_ratio = 0.30 (typical for development)
164
+ ```
165
+
166
+ See `references/provider-costs.md` for current pricing.
167
+
168
+ ---
169
+
170
+ ## Issue Template Section
171
+
172
+ Add this to Linear issue description during `/refine`:
173
+
174
+ ```markdown
175
+ ---
176
+
177
+ ## AI Effort Estimate
178
+
179
+ ### Sizing Factors
180
+
181
+ | Factor | Value | Multiplier |
182
+ |--------|-------|------------|
183
+ | **Task Type** | [feature/bug/chore] | base: [X]k |
184
+ | **Scope** | [S/M/L/XL] | ×[0.5/1.0/2.0/4.0] |
185
+ | **Novelty** | [existing/partial/greenfield] | ×[0.7/1.2/2.0] |
186
+ | **Clarity** | [defined/discovery/exploratory] | ×[0.8/1.5/2.5] |
187
+ | **Codebase** | [simple/moderate/complex] | ×[0.8/1.0/1.5] |
188
+
189
+ ### Estimate
190
+
191
+ **Provider**: [Claude Sonnet 4 / GPT-4o / etc.]
192
+ **Calculated Tokens**: ~[X]k
193
+ **Confidence**: ±[40-60]%
194
+ **Token Range**: [low]k - [high]k
195
+ **Cost Range**: $[low] - $[high]
196
+
197
+ ### Comparison
198
+
199
+ | Approach | Est. Cost | Est. Time | Best For |
200
+ |----------|-----------|-----------|----------|
201
+ | **Full AI** | $[X] | [X] hrs | Well-defined, pattern-matching |
202
+ | **AI-Assisted** | $[X] + [X]hrs human | [X] hrs | Complex decisions |
203
+ | **Human-Led** | $[X] (review) + [X]hrs | [X] hrs | Novel architecture |
204
+
205
+ ---
206
+ ```
207
+
208
+ ---
209
+
210
+ ## Recording Actuals (on /close)
211
+
212
+ Add to issue comment on completion:
213
+
214
+ ```markdown
215
+ ## AI Effort Actuals
216
+
217
+ **Estimated Tokens**: [X]k
218
+ **Actual Tokens**: [X]k (from session/API logs if available)
219
+ **Variance**: [+/-X]% [under/over]
220
+ **Actual Cost**: $[X]
221
+
222
+ ### Variance Notes
223
+ - [What drove the variance - blockers, scope change, retries, etc.]
224
+ - [Lessons for future estimation]
225
+
226
+ ### Calibration Data
227
+ - Task Type: [feature]
228
+ - Final Complexity: [M]
229
+ - Novelty Actual: [partial-new]
230
+ - Clarity Actual: [well-defined]
231
+ ```
232
+
233
+ ---
234
+
235
+ ## Agent Instructions
236
+
237
+ ### During /refine (PM Agent)
238
+
239
+ 1. **Read the spec** completely
240
+ 2. **Identify task type** from labels (feature, bug, chore, idea)
241
+ 3. **Score each factor**:
242
+ - Count acceptance criteria → scope
243
+ - Check Technical Notes for patterns → novelty
244
+ - Assess criteria specificity → clarity
245
+ - Reference `stack.md` → codebase complexity
246
+ 4. **Calculate estimate** using formula
247
+ 5. **Look up provider costs** from `references/provider-costs.md` or `.flydocs/config.json`
248
+ 6. **Add estimate section** to issue description (replace placeholders with values)
249
+ 7. **If estimate exceeds threshold**, flag for human review:
250
+ - \> 200k tokens → Consider breaking down the issue
251
+ - \> $5 estimated → Confirm before proceeding
252
+ 8. **Include estimate in refine comment**: `AI Estimate: ~Xk tokens ($X-$X)`
253
+
254
+ ### During /activate (PM Agent)
255
+
256
+ 1. **Search issue description** for "## AI Effort Estimate"
257
+ 2. **If missing**:
258
+ - WARN: "⚠️ This issue is missing an AI Effort Estimate."
259
+ - ASK: "Would you like me to calculate one now before activation?"
260
+ - If yes → Calculate and add to description
261
+ - If no → Proceed but note: "No baseline for actuals comparison"
262
+ 3. **If present but incomplete** (still has `[X]k` placeholders):
263
+ - OFFER: "AI Effort Estimate exists but has placeholder values. Complete it now?"
264
+ 4. **If present and exceeds thresholds**:
265
+ - \> 200k tokens or \> $5 → Show warning, ask for confirmation
266
+ - \> $10 → Require explicit "yes proceed" before continuing
267
+ 5. **Include in activation comment**: `AI Effort: ~Xk tokens ($X-$X)`
268
+
269
+ ### During /implement (Implementation Agent)
270
+
271
+ 1. **Search issue description** for "## AI Effort Estimate"
272
+ 2. **If missing**:
273
+ - WARN: "⚠️ Missing AI Effort Estimate - tracking actuals won't have comparison baseline."
274
+ - OFFER: "Calculate estimate before starting implementation?"
275
+ - If yes → Calculate estimate, update description
276
+ - If no → Proceed with warning
277
+ 3. **If present**:
278
+ - Show estimate in implementation checklist
279
+ - Note: "Tracking against estimate of ~Xk tokens"
280
+ 4. **During implementation**:
281
+ - Keep rough mental model of token usage
282
+ - Note if work is going significantly over estimate (scope discovery, retries)
283
+
284
+ ### On Implementation Complete (Implementation Agent)
285
+
286
+ 1. **Estimate actual tokens used**:
287
+ - Rough method: conversation turns × ~2k tokens/turn
288
+ - Or estimate based on files changed, complexity of work
289
+ 2. **Update AI Effort Estimate section** in issue description:
290
+ - Fill "Actual Tokens" field
291
+ - Calculate variance percentage
292
+ - Add notes on variance drivers
293
+ 3. **Include in completion comment**: `AI Effort: ~Xk actual (estimated Xk, +/-X% variance)`
294
+
295
+ ### During /close (PM Agent)
296
+
297
+ 1. **Verify actuals were recorded** (from implementation completion)
298
+ 2. **If actuals missing**: Estimate based on issue activity/comments
299
+ 3. **Calculate final variance** from estimate
300
+ 4. **Add final actuals to issue** if not already present
301
+ 5. **Log patterns for calibration**:
302
+ - Which factor assessments were off?
303
+ - What should be adjusted for similar future work?
304
+ 6. **Include in close comment**: `Final AI Effort: ~Xk tokens (+/-X% from estimate)`
305
+
306
+ ---
307
+
308
+ ## Configuration
309
+
310
+ In `.flydocs/config.json`:
311
+
312
+ ```json
313
+ {
314
+ "aiLabor": {
315
+ "enabled": false,
316
+ "defaultProvider": "claude-sonnet-4",
317
+ "thresholds": {
318
+ "warnTokens": 200000,
319
+ "warnCost": 5.00,
320
+ "requireApproval": 10.00
321
+ },
322
+ "tracking": {
323
+ "recordActuals": true,
324
+ "calibrationEnabled": true
325
+ }
326
+ }
327
+ }
328
+ ```
329
+
330
+ **To enable**, change `"enabled": false` to `"enabled": true`.
331
+
332
+ When enabled, the skill will:
333
+ - Add AI Effort Estimate sections during `/refine`
334
+ - Offer to calculate estimates during `/activate` and `/implement`
335
+ - Track actuals on completion
336
+ - Warn on high-cost estimates based on thresholds
337
+
338
+ ---
339
+
340
+ ## Example Calculation
341
+
342
+ **Spec**: "Add user profile photo upload"
343
+
344
+ | Factor | Assessment | Value |
345
+ |--------|------------|-------|
346
+ | Type | Feature | 40k base |
347
+ | Scope | M (5 criteria, ~4 files) | ×1.0 |
348
+ | Novelty | Existing pattern (similar to doc upload) | ×0.7 |
349
+ | Clarity | Well-defined (clear criteria) | ×0.8 |
350
+ | Codebase | Moderate | ×1.0 |
351
+
352
+ **Calculation**:
353
+ ```
354
+ 40,000 × 1.0 × 0.7 × 0.8 × 1.0 = 22,400 tokens
355
+
356
+ Range: 13,440 - 56,000 tokens (±60% confidence)
357
+
358
+ Cost (Claude Sonnet 4 @ $3/$15 per 1M):
359
+ Low: 13.4k × (0.7×$3 + 0.3×$15)/1M = $0.09
360
+ High: 56k × (0.7×$3 + 0.3×$15)/1M = $0.37
361
+ ```
362
+
363
+ **Result**: ~22k tokens, $0.09 - $0.37 estimated cost
364
+
365
+ ---
366
+
367
+ ## Related Skills
368
+
369
+ - `flydocs-workflow` - For workflow lifecycle and issue operations
370
+ - `spec-templates` - Template structure reference
371
+
372
+ ---
373
+
374
+ ## Calibration Over Time
375
+
376
+ Track estimates vs actuals to improve accuracy:
377
+
378
+ 1. **Log all estimates and actuals** in issue comments
379
+ 2. **Review monthly** for patterns:
380
+ - Which task types are consistently over/under?
381
+ - Which factors need adjustment?
382
+ 3. **Adjust multipliers** based on your codebase patterns
383
+ 4. **Document adjustments** in `.flydocs/knowledge/notes/`
384
+
@@ -0,0 +1,152 @@
1
+ # AI Provider Costs
2
+
3
+ > **Last Updated**: 2025-01
4
+ > **Note**: Prices change frequently. Verify current rates at provider websites.
5
+
6
+ ---
7
+
8
+ ## Quick Reference
9
+
10
+ | Provider | Model | Input (per 1M) | Output (per 1M) | Blended* |
11
+ |----------|-------|----------------|-----------------|----------|
12
+ | **Anthropic** | Claude Sonnet 4 | $3.00 | $15.00 | $6.60 |
13
+ | **Anthropic** | Claude Opus 4 | $15.00 | $75.00 | $33.00 |
14
+ | **Anthropic** | Claude Haiku 3.5 | $0.80 | $4.00 | $1.76 |
15
+ | **OpenAI** | GPT-4o | $2.50 | $10.00 | $4.75 |
16
+ | **OpenAI** | GPT-4o-mini | $0.15 | $0.60 | $0.29 |
17
+ | **OpenAI** | o1 | $15.00 | $60.00 | $28.50 |
18
+ | **OpenAI** | o3-mini | $1.10 | $4.40 | $2.09 |
19
+ | **Google** | Gemini 2.0 Flash | $0.10 | $0.40 | $0.19 |
20
+ | **Google** | Gemini 1.5 Pro | $1.25 | $5.00 | $2.38 |
21
+
22
+ *Blended assumes 70% input / 30% output ratio typical for development tasks.
23
+
24
+ ---
25
+
26
+ ## Detailed Pricing
27
+
28
+ ### Anthropic (Claude)
29
+
30
+ | Model | Input | Output | Context | Best For |
31
+ |-------|-------|--------|---------|----------|
32
+ | **Claude Opus 4** | $15.00/1M | $75.00/1M | 200K | Complex reasoning, architecture |
33
+ | **Claude Sonnet 4** | $3.00/1M | $15.00/1M | 200K | Balanced: code + reasoning |
34
+ | **Claude Haiku 3.5** | $0.80/1M | $4.00/1M | 200K | Fast tasks, simple edits |
35
+
36
+ **Recommended for FlyDocs**: Claude Sonnet 4 (best balance for development)
37
+
38
+ ### OpenAI
39
+
40
+ | Model | Input | Output | Context | Best For |
41
+ |-------|-------|--------|---------|----------|
42
+ | **o1** | $15.00/1M | $60.00/1M | 200K | Complex reasoning |
43
+ | **o3-mini** | $1.10/1M | $4.40/1M | 200K | Fast reasoning |
44
+ | **GPT-4o** | $2.50/1M | $10.00/1M | 128K | General development |
45
+ | **GPT-4o-mini** | $0.15/1M | $0.60/1M | 128K | Simple tasks |
46
+
47
+ ### Google (Gemini)
48
+
49
+ | Model | Input | Output | Context | Best For |
50
+ |-------|-------|--------|---------|----------|
51
+ | **Gemini 2.0 Flash** | $0.10/1M | $0.40/1M | 1M | Large context, speed |
52
+ | **Gemini 1.5 Pro** | $1.25/1M | $5.00/1M | 2M | Very large context |
53
+
54
+ ---
55
+
56
+ ## Cost Calculation Examples
57
+
58
+ ### Example 1: Small Feature (22k tokens)
59
+
60
+ | Provider | Model | Cost |
61
+ |----------|-------|------|
62
+ | Anthropic | Claude Sonnet 4 | $0.15 |
63
+ | OpenAI | GPT-4o | $0.10 |
64
+ | Google | Gemini 2.0 Flash | $0.004 |
65
+
66
+ ### Example 2: Medium Feature (75k tokens)
67
+
68
+ | Provider | Model | Cost |
69
+ |----------|-------|------|
70
+ | Anthropic | Claude Sonnet 4 | $0.50 |
71
+ | OpenAI | GPT-4o | $0.36 |
72
+ | Google | Gemini 2.0 Flash | $0.01 |
73
+
74
+ ### Example 3: Large Feature (200k tokens)
75
+
76
+ | Provider | Model | Cost |
77
+ |----------|-------|------|
78
+ | Anthropic | Claude Sonnet 4 | $1.32 |
79
+ | OpenAI | GPT-4o | $0.95 |
80
+ | Google | Gemini 2.0 Flash | $0.04 |
81
+
82
+ ---
83
+
84
+ ## Human Labor Comparison
85
+
86
+ For ROI calculations, compare AI costs to equivalent human rates:
87
+
88
+ | Role | Hourly Rate | Task Equivalent |
89
+ |------|-------------|-----------------|
90
+ | Junior Developer | $50-75/hr | Simple bugs, chores |
91
+ | Mid Developer | $100-150/hr | Features, complex bugs |
92
+ | Senior Developer | $150-250/hr | Architecture, complex features |
93
+ | Contractor | $75-200/hr | Variable scope work |
94
+
95
+ ### Breakeven Analysis
96
+
97
+ ```
98
+ AI Cost = estimated_tokens × blended_rate
99
+ Human Cost = estimated_hours × hourly_rate
100
+
101
+ If AI_cost < Human_cost × confidence_factor:
102
+ → Prefer AI approach
103
+ ```
104
+
105
+ **Confidence Factors**:
106
+ - Well-defined task: 1.0x (AI likely accurate)
107
+ - Some ambiguity: 1.5x (buffer for retries)
108
+ - High uncertainty: 2.5x (expect iterations)
109
+
110
+ ---
111
+
112
+ ## Configuration
113
+
114
+ Set default provider in `.flydocs/config.json`:
115
+
116
+ ```json
117
+ {
118
+ "aiLabor": {
119
+ "defaultProvider": "claude-sonnet-4",
120
+ "providerRates": {
121
+ "claude-sonnet-4": {
122
+ "input": 3.00,
123
+ "output": 15.00,
124
+ "inputRatio": 0.70,
125
+ "outputRatio": 0.30
126
+ },
127
+ "gpt-4o": {
128
+ "input": 2.50,
129
+ "output": 10.00,
130
+ "inputRatio": 0.70,
131
+ "outputRatio": 0.30
132
+ }
133
+ }
134
+ }
135
+ }
136
+ ```
137
+
138
+ ---
139
+
140
+ ## Updating Prices
141
+
142
+ 1. Check provider pricing pages quarterly
143
+ 2. Update this file with new rates
144
+ 3. Bump version in `.flydocs/version`
145
+ 4. Run `/flydocs-update` in projects to sync
146
+
147
+ **Provider Links**:
148
+ - [Anthropic Pricing](https://www.anthropic.com/pricing)
149
+ - [OpenAI Pricing](https://openai.com/pricing)
150
+ - [Google AI Pricing](https://cloud.google.com/vertex-ai/generative-ai/pricing)
151
+
152
+