[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6F9EKGAC3GXY3NCWTQ91WZS":3,"skill-same:01M6F9EKGAC3GXY3NCWTQ91WZS":76},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":53,"commitSha":54,"skillDirectory":55,"forksCount":56,"repositoryHtmlUrl":57,"repositoryHomepageUrl":6,"ownerHtmlUrl":58,"ownerBlogUrl":59,"ownerDescription":60,"updatedAt":61,"install":62,"resources":75},"01M6F9EKGAC3GXY3NCWTQ91WZS","twinmind-cost-tuning",null,"Optimize TwinMind costs across Free, Pro, and Enterprise tiers.\nUse when analyzing usage patterns, reducing costs,\nor choosing the right pricing tier for your needs.\nTrigger with phrases like \"twinmind cost\", \"reduce twinmind spending\",\n\"twinmind pricing optimization\", \"twinmind budget\".","Dicklesworthstone\u002Fpi_agent_rust","Dicklesworthstone","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F35050222?v=4","01M6CG26AR942CSVMN1M5E3DSE","Jeff Emanuel","01M6CG26EPP71PSHW1VDS71121",1992,"MIT","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Ftwinmind-pack\u002Fskills\u002Ftwinmind-cost-tuning\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"tuning","twinmind cost tuning","cost","optimize","when","reduce","for","spending","usage","pro","with","trigger","io","free","across","pricing","patterns","use","edit","write","read","Budget","analyzing","Enterprise","Optimization","2026-11-10 10:12:30",false,"---\nname: twinmind-cost-tuning\ndescription: |\n  Optimize TwinMind costs across Free, Pro, and Enterprise tiers.\n  Use when analyzing usage patterns, reducing costs,\n  or choosing the right pricing tier for your needs.\n  Trigger with phrases like \"twinmind cost\", \"reduce twinmind spending\",\n  \"twinmind pricing optimization\", \"twinmind budget\".\nallowed-tools: Read, Write, Edit\nversion: 1.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\n---\n\n# TwinMind Cost Tuning\n\n## Overview\nOptimize TwinMind costs through usage analysis, tier selection, and efficiency improvements.\n\n## Prerequisites\n- TwinMind account with billing access\n- Understanding of usage patterns\n- Access to usage analytics\n\n## Instructions\n\n### Step 1: Understand Pricing Structure\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fcosts\u002Fpricing.ts\nexport interface TierPricing {\n  name: string;\n  monthlyBase: number;          \u002F\u002F Base subscription cost\n  transcriptionRate: number;    \u002F\u002F Per hour of audio\n  apiRequestRate: number;       \u002F\u002F Per 1000 requests\n  aiTokenRate: number;          \u002F\u002F Per 1M tokens\n  storageRate: number;          \u002F\u002F Per GB per month\n  includedHours: number;        \u002F\u002F Included transcription hours\n  includedTokens: number;       \u002F\u002F Included AI tokens\n}\n\nexport const pricingTiers: Record\u003Cstring, TierPricing> = {\n  free: {\n    name: 'Free',\n    monthlyBase: 0,\n    transcriptionRate: 0,        \u002F\u002F Unlimited but basic quality\n    apiRequestRate: 0,           \u002F\u002F No API access\n    aiTokenRate: 0,\n    storageRate: 0,\n    includedHours: Infinity,     \u002F\u002F Unlimited\n    includedTokens: 500000,\n  },\n  pro: {\n    name: 'Pro',\n    monthlyBase: 10,\n    transcriptionRate: 0.23,     \u002F\u002F $0.23 per hour (Ear-3)\n    apiRequestRate: 0,           \u002F\u002F Included\n    aiTokenRate: 0,              \u002F\u002F Included up to limit\n    storageRate: 0,\n    includedHours: Infinity,     \u002F\u002F Unlimited\n    includedTokens: 2000000,\n  },\n  enterprise: {\n    name: 'Enterprise',\n    monthlyBase: 0,              \u002F\u002F Custom pricing\n    transcriptionRate: 0.15,     \u002F\u002F Volume discount\n    apiRequestRate: 0,\n    aiTokenRate: 0,\n    storageRate: 0,\n    includedHours: Infinity,\n    includedTokens: Infinity,\n  },\n};\n```\n\n### Step 2: Analyze Current Usage\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fcosts\u002Fanalyzer.ts\nexport interface UsageData {\n  period: string;\n  transcriptionHours: number;\n  apiRequests: number;\n  aiTokensUsed: number;\n  storageGB: number;\n  meetings: number;\n}\n\nexport interface CostAnalysis {\n  currentTier: string;\n  currentCost: number;\n  estimatedCostPerTier: Record\u003Cstring, number>;\n  recommendedTier: string;\n  potentialSavings: number;\n  breakdown: CostBreakdown;\n}\n\nexport interface CostBreakdown {\n  base: number;\n  transcription: number;\n  api: number;\n  aiTokens: number;\n  storage: number;\n  total: number;\n}\n\nexport async function analyzeUsage(): Promise\u003CCostAnalysis> {\n  const client = getTwinMindClient();\n\n  \u002F\u002F Get last 30 days usage\n  const usage = await client.get('\u002Fusage', {\n    params: { period: 'last_30_days' },\n  });\n\n  const data: UsageData = usage.data;\n  const currentTier = (await client.get('\u002Faccount')).data.plan;\n\n  \u002F\u002F Calculate cost for each tier\n  const costByTier: Record\u003Cstring, number> = {};\n\n  for (const [tierName, tier] of Object.entries(pricingTiers)) {\n    const cost = calculateTierCost(tier, data);\n    costByTier[tierName] = cost;\n  }\n\n  \u002F\u002F Find recommended tier\n  const validTiers = Object.entries(costByTier)\n    .filter(([tier]) => meetsRequirements(tier, data))\n    .sort(([, a], [, b]) => a - b);\n\n  const recommendedTier = validTiers[0]?.[0] || 'pro';\n  const currentCost = costByTier[currentTier];\n  const recommendedCost = costByTier[recommendedTier];\n\n  return {\n    currentTier,\n    currentCost,\n    estimatedCostPerTier: costByTier,\n    recommendedTier,\n    potentialSavings: currentCost - recommendedCost,\n    breakdown: calculateBreakdown(pricingTiers[currentTier], data),\n  };\n}\n\nfunction calculateTierCost(tier: TierPricing, usage: UsageData): number {\n  let cost = tier.monthlyBase;\n\n  \u002F\u002F Transcription cost (if over included)\n  if (usage.transcriptionHours > tier.includedHours) {\n    cost += (usage.transcriptionHours - tier.includedHours) * tier.transcriptionRate;\n  }\n\n  \u002F\u002F AI tokens (if over included)\n  if (usage.aiTokensUsed > tier.includedTokens) {\n    const overageTokens = usage.aiTokensUsed - tier.includedTokens;\n    cost += (overageTokens \u002F 1000000) * tier.aiTokenRate;\n  }\n\n  return cost;\n}\n\nfunction meetsRequirements(tier: string, usage: UsageData): boolean {\n  \u002F\u002F Free tier doesn't have API access\n  if (tier === 'free' && usage.apiRequests > 0) {\n    return false;\n  }\n  return true;\n}\n```\n\n### Step 3: Implement Cost Monitoring\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fcosts\u002Fmonitor.ts\nexport interface CostAlert {\n  type: 'warning' | 'critical';\n  message: string;\n  currentSpend: number;\n  threshold: number;\n  percentUsed: number;\n}\n\nexport interface BudgetConfig {\n  monthlyBudget: number;\n  warningThreshold: number;  \u002F\u002F e.g., 0.8 for 80%\n  criticalThreshold: number; \u002F\u002F e.g., 0.95 for 95%\n  notifications: {\n    email?: string[];\n    slack?: string;\n    webhook?: string;\n  };\n}\n\nexport class CostMonitor {\n  private config: BudgetConfig;\n\n  constructor(config: BudgetConfig) {\n    this.config = config;\n  }\n\n  async checkBudget(): Promise\u003CCostAlert | null> {\n    const client = getTwinMindClient();\n    const usage = await client.get('\u002Fusage\u002Fcost', {\n      params: { period: 'current_month' },\n    });\n\n    const currentSpend = usage.data.total_cost;\n    const percentUsed = currentSpend \u002F this.config.monthlyBudget;\n\n    if (percentUsed >= this.config.criticalThreshold) {\n      return {\n        type: 'critical',\n        message: `TwinMind spending at ${(percentUsed * 100).toFixed(1)}% of monthly budget`,\n        currentSpend,\n        threshold: this.config.monthlyBudget,\n        percentUsed,\n      };\n    }\n\n    if (percentUsed >= this.config.warningThreshold) {\n      return {\n        type: 'warning',\n        message: `TwinMind spending at ${(percentUsed * 100).toFixed(1)}% of monthly budget`,\n        currentSpend,\n        threshold: this.config.monthlyBudget,\n        percentUsed,\n      };\n    }\n\n    return null;\n  }\n\n  async sendAlert(alert: CostAlert): Promise\u003Cvoid> {\n    const { notifications } = this.config;\n\n    if (notifications.slack) {\n      await sendSlackNotification(notifications.slack, {\n        text: `:${alert.type === 'critical' ? 'rotating_light' : 'warning'}: ${alert.message}`,\n        blocks: [\n          {\n            type: 'section',\n            text: {\n              type: 'mrkdwn',\n              text: `*TwinMind Budget Alert*\\n${alert.message}\\n\\nCurrent: $${alert.currentSpend.toFixed(2)} \u002F $${alert.threshold.toFixed(2)}`,\n            },\n          },\n        ],\n      });\n    }\n\n    if (notifications.email) {\n      await sendEmail({\n        to: notifications.email,\n        subject: `[${alert.type.toUpperCase()}] TwinMind Budget Alert`,\n        body: `${alert.message}\\n\\nCurrent spend: $${alert.currentSpend.toFixed(2)}\\nBudget: $${alert.threshold.toFixed(2)}\\nUsed: ${(alert.percentUsed * 100).toFixed(1)}%`,\n      });\n    }\n  }\n}\n\n\u002F\u002F Schedule budget checks\nexport function startCostMonitoring(config: BudgetConfig): void {\n  const monitor = new CostMonitor(config);\n\n  \u002F\u002F Check every hour\n  setInterval(async () => {\n    const alert = await monitor.checkBudget();\n    if (alert) {\n      await monitor.sendAlert(alert);\n    }\n  }, 60 * 60 * 1000);\n}\n```\n\n### Step 4: Optimize Token Usage\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fcosts\u002Ftoken-optimization.ts\nexport interface TokenUsageReport {\n  totalTokens: number;\n  byFeature: Record\u003Cstring, number>;\n  optimizationPotential: number;\n  recommendations: string[];\n}\n\nexport async function analyzeTokenUsage(): Promise\u003CTokenUsageReport> {\n  const client = getTwinMindClient();\n  const usage = await client.get('\u002Fusage\u002Ftokens', {\n    params: { period: 'last_30_days', breakdown: 'by_feature' },\n  });\n\n  const byFeature = usage.data.breakdown;\n  const totalTokens = Object.values(byFeature).reduce((sum: number, v) => sum + (v as number), 0);\n\n  const recommendations: string[] = [];\n  let optimizationPotential = 0;\n\n  \u002F\u002F Check for optimization opportunities\n  if (byFeature.summary > totalTokens * 0.5) {\n    recommendations.push('High summary token usage - consider using shorter summaries');\n    optimizationPotential += byFeature.summary * 0.3;\n  }\n\n  if (byFeature.chat > totalTokens * 0.3) {\n    recommendations.push('High chat token usage - implement response caching');\n    optimizationPotential += byFeature.chat * 0.2;\n  }\n\n  if (byFeature.memory_search > totalTokens * 0.2) {\n    recommendations.push('Consider indexing optimization for memory searches');\n    optimizationPotential += byFeature.memory_search * 0.1;\n  }\n\n  return {\n    totalTokens,\n    byFeature,\n    optimizationPotential,\n    recommendations,\n  };\n}\n\n\u002F\u002F Token-efficient summary options\nexport const tokenEfficientOptions = {\n  summary: {\n    brief: {\n      maxLength: 150,          \u002F\u002F Short summary\n      includeActionItems: true,\n      includeKeyPoints: false,\n      estimatedTokens: 200,\n    },\n    standard: {\n      maxLength: 300,\n      includeActionItems: true,\n      includeKeyPoints: true,\n      estimatedTokens: 500,\n    },\n    detailed: {\n      maxLength: 500,\n      includeActionItems: true,\n      includeKeyPoints: true,\n      estimatedTokens: 800,\n    },\n  },\n};\n```\n\n### Step 5: Implement Usage Quotas\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fcosts\u002Fquotas.ts\nexport interface QuotaConfig {\n  dailyTranscriptionHours: number;\n  dailyApiRequests: number;\n  dailyAiTokens: number;\n}\n\nexport class QuotaManager {\n  private config: QuotaConfig;\n  private usage = {\n    transcriptionHours: 0,\n    apiRequests: 0,\n    aiTokens: 0,\n    lastReset: new Date(),\n  };\n\n  constructor(config: QuotaConfig) {\n    this.config = config;\n    this.startDailyReset();\n  }\n\n  private startDailyReset(): void {\n    \u002F\u002F Reset at midnight\n    const now = new Date();\n    const midnight = new Date(now);\n    midnight.setHours(24, 0, 0, 0);\n\n    const msUntilMidnight = midnight.getTime() - now.getTime();\n\n    setTimeout(() => {\n      this.resetUsage();\n      setInterval(() => this.resetUsage(), 24 * 60 * 60 * 1000);\n    }, msUntilMidnight);\n  }\n\n  private resetUsage(): void {\n    this.usage = {\n      transcriptionHours: 0,\n      apiRequests: 0,\n      aiTokens: 0,\n      lastReset: new Date(),\n    };\n  }\n\n  canTranscribe(hours: number): boolean {\n    return this.usage.transcriptionHours + hours \u003C= this.config.dailyTranscriptionHours;\n  }\n\n  canMakeApiRequest(): boolean {\n    return this.usage.apiRequests \u003C this.config.dailyApiRequests;\n  }\n\n  canUseTokens(tokens: number): boolean {\n    return this.usage.aiTokens + tokens \u003C= this.config.dailyAiTokens;\n  }\n\n  recordUsage(type: 'transcription' | 'api' | 'tokens', amount: number): void {\n    switch (type) {\n      case 'transcription':\n        this.usage.transcriptionHours += amount;\n        break;\n      case 'api':\n        this.usage.apiRequests += amount;\n        break;\n      case 'tokens':\n        this.usage.aiTokens += amount;\n        break;\n    }\n  }\n\n  getRemainingQuota(): {\n    transcriptionHours: number;\n    apiRequests: number;\n    aiTokens: number;\n  } {\n    return {\n      transcriptionHours: Math.max(0, this.config.dailyTranscriptionHours - this.usage.transcriptionHours),\n      apiRequests: Math.max(0, this.config.dailyApiRequests - this.usage.apiRequests),\n      aiTokens: Math.max(0, this.config.dailyAiTokens - this.usage.aiTokens),\n    };\n  }\n}\n\n\u002F\u002F Usage with middleware\nexport function quotaMiddleware(quotaManager: QuotaManager) {\n  return (req: Request, res: Response, next: NextFunction) => {\n    if (!quotaManager.canMakeApiRequest()) {\n      return res.status(429).json({\n        error: 'Daily API quota exceeded',\n        remaining: quotaManager.getRemainingQuota(),\n      });\n    }\n\n    quotaManager.recordUsage('api', 1);\n    next();\n  };\n}\n```\n\n## Output\n- Pricing structure analysis\n- Usage cost analyzer\n- Budget monitoring system\n- Token optimization strategies\n- Quota management\n\n## Cost Optimization Strategies\n\n| Strategy | Savings | Implementation |\n|----------|---------|----------------|\n| Use brief summaries | 30-50% tokens | Set maxLength: 150 |\n| Cache memory searches | 20-30% | Implement result caching |\n| Batch transcriptions | 10-15% | Group small files |\n| Off-peak processing | 0% (no TwinMind variation) | N\u002FA |\n| Annual billing | 33% | Switch to annual plan |\n\n## Pricing Comparison\n\n| Feature | Free | Pro ($10\u002Fmo) | Enterprise |\n|---------|------|--------------|------------|\n| Transcription | Unlimited | Unlimited | Unlimited |\n| API Access | No | Yes | Yes |\n| Ear-3 Model | No | Yes | Yes |\n| Context Tokens | 500K | 2M | Unlimited |\n| Rate Limits | 30\u002Fmin | 60\u002Fmin | 300\u002Fmin |\n| Support | Community | 24hr | Dedicated |\n| Cost\u002FHour | $0 | $0.23 | Custom |\n\n## Error Handling\n\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| Unexpected charges | Usage spike | Set up budget alerts |\n| Quota exceeded | High usage | Implement rate limiting |\n| Wrong tier | Poor planning | Analyze usage patterns |\n\n## Resources\n- [TwinMind Pricing](https:\u002F\u002Ftwinmind.com\u002Fpricing)\n- [Usage Dashboard](https:\u002F\u002Ftwinmind.com\u002Fsettings\u002Fusage)\n- [Enterprise Plans](https:\u002F\u002Ftwinmind.com\u002Fenterprise)\n\n## Next Steps\nFor reference architecture, see `twinmind-reference-architecture`.\n","# TwinMind Cost Tuning\n\n## Overview\nOptimize TwinMind costs through usage analysis, tier selection, and efficiency improvements.\n\n## Prerequisites\n- TwinMind account with billing access\n- Understanding of usage patterns\n- Access to usage analytics\n\n## Instructions\n\n### Step 1: Understand Pricing Structure\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fcosts\u002Fpricing.ts\nexport interface TierPricing {\n  name: string;\n  monthlyBase: number;          \u002F\u002F Base subscription cost\n  transcriptionRate: number;    \u002F\u002F Per hour of audio\n  apiRequestRate: number;       \u002F\u002F Per 1000 requests\n  aiTokenRate: number;          \u002F\u002F Per 1M tokens\n  storageRate: number;          \u002F\u002F Per GB per month\n  includedHours: number;        \u002F\u002F Included transcription hours\n  includedTokens: number;       \u002F\u002F Included AI tokens\n}\n\nexport const pricingTiers: Record\u003Cstring, TierPricing> = {\n  free: {\n    name: 'Free',\n    monthlyBase: 0,\n    transcriptionRate: 0,        \u002F\u002F Unlimited but basic quality\n    apiRequestRate: 0,           \u002F\u002F No API access\n    aiTokenRate: 0,\n    storageRate: 0,\n    includedHours: Infinity,     \u002F\u002F Unlimited\n    includedTokens: 500000,\n  },\n  pro: {\n    name: 'Pro',\n    monthlyBase: 10,\n    transcriptionRate: 0.23,     \u002F\u002F $0.23 per hour (Ear-3)\n    apiRequestRate: 0,           \u002F\u002F Included\n    aiTokenRate: 0,              \u002F\u002F Included up to limit\n    storageRate: 0,\n    includedHours: Infinity,     \u002F\u002F Unlimited\n    includedTokens: 2000000,\n  },\n  enterprise: {\n    name: 'Enterprise',\n    monthlyBase: 0,              \u002F\u002F Custom pricing\n    transcriptionRate: 0.15,     \u002F\u002F Volume discount\n    apiRequestRate: 0,\n    aiTokenRate: 0,\n    storageRate: 0,\n    includedHours: Infinity,\n    includedTokens: Infinity,\n  },\n};\n```\n\n### Step 2: Analyze Current Usage\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fcosts\u002Fanalyzer.ts\nexport interface UsageData {\n  period: string;\n  transcriptionHours: number;\n  apiRequests: number;\n  aiTokensUsed: number;\n  storageGB: number;\n  meetings: number;\n}\n\nexport interface CostAnalysis {\n  currentTier: string;\n  currentCost: number;\n  estimatedCostPerTier: Record\u003Cstring, number>;\n  recommendedTier: string;\n  potentialSavings: number;\n  breakdown: CostBreakdown;\n}\n\nexport interface CostBreakdown {\n  base: number;\n  transcription: number;\n  api: number;\n  aiTokens: number;\n  storage: number;\n  total: number;\n}\n\nexport async function analyzeUsage(): Promise\u003CCostAnalysis> {\n  const client = getTwinMindClient();\n\n  \u002F\u002F Get last 30 days usage\n  const usage = await client.get('\u002Fusage', {\n    params: { period: 'last_30_days' },\n  });\n\n  const data: UsageData = usage.data;\n  const currentTier = (await client.get('\u002Faccount')).data.plan;\n\n  \u002F\u002F Calculate cost for each tier\n  const costByTier: Record\u003Cstring, number> = {};\n\n  for (const [tierName, tier] of Object.entries(pricingTiers)) {\n    const cost = calculateTierCost(tier, data);\n    costByTier[tierName] = cost;\n  }\n\n  \u002F\u002F Find recommended tier\n  const validTiers = Object.entries(costByTier)\n    .filter(([tier]) => meetsRequirements(tier, data))\n    .sort(([, a], [, b]) => a - b);\n\n  const recommendedTier = validTiers[0]?.[0] || 'pro';\n  const currentCost = costByTier[currentTier];\n  const recommendedCost = costByTier[recommendedTier];\n\n  return {\n    currentTier,\n    currentCost,\n    estimatedCostPerTier: costByTier,\n    recommendedTier,\n    potentialSavings: currentCost - recommendedCost,\n    breakdown: calculateBreakdown(pricingTiers[currentTier], data),\n  };\n}\n\nfunction calculateTierCost(tier: TierPricing, usage: UsageData): number {\n  let cost = tier.monthlyBase;\n\n  \u002F\u002F Transcription cost (if over included)\n  if (usage.transcriptionHours > tier.includedHours) {\n    cost += (usage.transcriptionHours - tier.includedHours) * tier.transcriptionRate;\n  }\n\n  \u002F\u002F AI tokens (if over included)\n  if (usage.aiTokensUsed > tier.includedTokens) {\n    const overageTokens = usage.aiTokensUsed - tier.includedTokens;\n    cost += (overageTokens \u002F 1000000) * tier.aiTokenRate;\n  }\n\n  return cost;\n}\n\nfunction meetsRequirements(tier: string, usage: UsageData): boolean {\n  \u002F\u002F Free tier doesn't have API access\n  if (tier === 'free' && usage.apiRequests > 0) {\n    return false;\n  }\n  return true;\n}\n```\n\n### Step 3: Implement Cost Monitoring\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fcosts\u002Fmonitor.ts\nexport interface CostAlert {\n  type: 'warning' | 'critical';\n  message: string;\n  currentSpend: number;\n  threshold: number;\n  percentUsed: number;\n}\n\nexport interface BudgetConfig {\n  monthlyBudget: number;\n  warningThreshold: number;  \u002F\u002F e.g., 0.8 for 80%\n  criticalThreshold: number; \u002F\u002F e.g., 0.95 for 95%\n  notifications: {\n    email?: string[];\n    slack?: string;\n    webhook?: string;\n  };\n}\n\nexport class CostMonitor {\n  private config: BudgetConfig;\n\n  constructor(config: BudgetConfig) {\n    this.config = config;\n  }\n\n  async checkBudget(): Promise\u003CCostAlert | null> {\n    const client = getTwinMindClient();\n    const usage = await client.get('\u002Fusage\u002Fcost', {\n      params: { period: 'current_month' },\n    });\n\n    const currentSpend = usage.data.total_cost;\n    const percentUsed = currentSpend \u002F this.config.monthlyBudget;\n\n    if (percentUsed >= this.config.criticalThreshold) {\n      return {\n        type: 'critical',\n        message: `TwinMind spending at ${(percentUsed * 100).toFixed(1)}% of monthly budget`,\n        currentSpend,\n        threshold: this.config.monthlyBudget,\n        percentUsed,\n      };\n    }\n\n    if (percentUsed >= this.config.warningThreshold) {\n      return {\n        type: 'warning',\n        message: `TwinMind spending at ${(percentUsed * 100).toFixed(1)}% of monthly budget`,\n        currentSpend,\n        threshold: this.config.monthlyBudget,\n        percentUsed,\n      };\n    }\n\n    return null;\n  }\n\n  async sendAlert(alert: CostAlert): Promise\u003Cvoid> {\n    const { notifications } = this.config;\n\n    if (notifications.slack) {\n      await sendSlackNotification(notifications.slack, {\n        text: `:${alert.type === 'critical' ? 'rotating_light' : 'warning'}: ${alert.message}`,\n        blocks: [\n          {\n            type: 'section',\n            text: {\n              type: 'mrkdwn',\n              text: `*TwinMind Budget Alert*\\n${alert.message}\\n\\nCurrent: $${alert.currentSpend.toFixed(2)} \u002F $${alert.threshold.toFixed(2)}`,\n            },\n          },\n        ],\n      });\n    }\n\n    if (notifications.email) {\n      await sendEmail({\n        to: notifications.email,\n        subject: `[${alert.type.toUpperCase()}] TwinMind Budget Alert`,\n        body: `${alert.message}\\n\\nCurrent spend: $${alert.currentSpend.toFixed(2)}\\nBudget: $${alert.threshold.toFixed(2)}\\nUsed: ${(alert.percentUsed * 100).toFixed(1)}%`,\n      });\n    }\n  }\n}\n\n\u002F\u002F Schedule budget checks\nexport function startCostMonitoring(config: BudgetConfig): void {\n  const monitor = new CostMonitor(config);\n\n  \u002F\u002F Check every hour\n  setInterval(async () => {\n    const alert = await monitor.checkBudget();\n    if (alert) {\n      await monitor.sendAlert(alert);\n    }\n  }, 60 * 60 * 1000);\n}\n```\n\n### Step 4: Optimize Token Usage\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fcosts\u002Ftoken-optimization.ts\nexport interface TokenUsageReport {\n  totalTokens: number;\n  byFeature: Record\u003Cstring, number>;\n  optimizationPotential: number;\n  recommendations: string[];\n}\n\nexport async function analyzeTokenUsage(): Promise\u003CTokenUsageReport> {\n  const client = getTwinMindClient();\n  const usage = await client.get('\u002Fusage\u002Ftokens', {\n    params: { period: 'last_30_days', breakdown: 'by_feature' },\n  });\n\n  const byFeature = usage.data.breakdown;\n  const totalTokens = Object.values(byFeature).reduce((sum: number, v) => sum + (v as number), 0);\n\n  const recommendations: string[] = [];\n  let optimizationPotential = 0;\n\n  \u002F\u002F Check for optimization opportunities\n  if (byFeature.summary > totalTokens * 0.5) {\n    recommendations.push('High summary token usage - consider using shorter summaries');\n    optimizationPotential += byFeature.summary * 0.3;\n  }\n\n  if (byFeature.chat > totalTokens * 0.3) {\n    recommendations.push('High chat token usage - implement response caching');\n    optimizationPotential += byFeature.chat * 0.2;\n  }\n\n  if (byFeature.memory_search > totalTokens * 0.2) {\n    recommendations.push('Consider indexing optimization for memory searches');\n    optimizationPotential += byFeature.memory_search * 0.1;\n  }\n\n  return {\n    totalTokens,\n    byFeature,\n    optimizationPotential,\n    recommendations,\n  };\n}\n\n\u002F\u002F Token-efficient summary options\nexport const tokenEfficientOptions = {\n  summary: {\n    brief: {\n      maxLength: 150,          \u002F\u002F Short summary\n      includeActionItems: true,\n      includeKeyPoints: false,\n      estimatedTokens: 200,\n    },\n    standard: {\n      maxLength: 300,\n      includeActionItems: true,\n      includeKeyPoints: true,\n      estimatedTokens: 500,\n    },\n    detailed: {\n      maxLength: 500,\n      includeActionItems: true,\n      includeKeyPoints: true,\n      estimatedTokens: 800,\n    },\n  },\n};\n```\n\n### Step 5: Implement Usage Quotas\n\n```typescript\n\u002F\u002F src\u002Ftwinmind\u002Fcosts\u002Fquotas.ts\nexport interface QuotaConfig {\n  dailyTranscriptionHours: number;\n  dailyApiRequests: number;\n  dailyAiTokens: number;\n}\n\nexport class QuotaManager {\n  private config: QuotaConfig;\n  private usage = {\n    transcriptionHours: 0,\n    apiRequests: 0,\n    aiTokens: 0,\n    lastReset: new Date(),\n  };\n\n  constructor(config: QuotaConfig) {\n    this.config = config;\n    this.startDailyReset();\n  }\n\n  private startDailyReset(): void {\n    \u002F\u002F Reset at midnight\n    const now = new Date();\n    const midnight = new Date(now);\n    midnight.setHours(24, 0, 0, 0);\n\n    const msUntilMidnight = midnight.getTime() - now.getTime();\n\n    setTimeout(() => {\n      this.resetUsage();\n      setInterval(() => this.resetUsage(), 24 * 60 * 60 * 1000);\n    }, msUntilMidnight);\n  }\n\n  private resetUsage(): void {\n    this.usage = {\n      transcriptionHours: 0,\n      apiRequests: 0,\n      aiTokens: 0,\n      lastReset: new Date(),\n    };\n  }\n\n  canTranscribe(hours: number): boolean {\n    return this.usage.transcriptionHours + hours \u003C= this.config.dailyTranscriptionHours;\n  }\n\n  canMakeApiRequest(): boolean {\n    return this.usage.apiRequests \u003C this.config.dailyApiRequests;\n  }\n\n  canUseTokens(tokens: number): boolean {\n    return this.usage.aiTokens + tokens \u003C= this.config.dailyAiTokens;\n  }\n\n  recordUsage(type: 'transcription' | 'api' | 'tokens', amount: number): void {\n    switch (type) {\n      case 'transcription':\n        this.usage.transcriptionHours += amount;\n        break;\n      case 'api':\n        this.usage.apiRequests += amount;\n        break;\n      case 'tokens':\n        this.usage.aiTokens += amount;\n        break;\n    }\n  }\n\n  getRemainingQuota(): {\n    transcriptionHours: number;\n    apiRequests: number;\n    aiTokens: number;\n  } {\n    return {\n      transcriptionHours: Math.max(0, this.config.dailyTranscriptionHours - this.usage.transcriptionHours),\n      apiRequests: Math.max(0, this.config.dailyApiRequests - this.usage.apiRequests),\n      aiTokens: Math.max(0, this.config.dailyAiTokens - this.usage.aiTokens),\n    };\n  }\n}\n\n\u002F\u002F Usage with middleware\nexport function quotaMiddleware(quotaManager: QuotaManager) {\n  return (req: Request, res: Response, next: NextFunction) => {\n    if (!quotaManager.canMakeApiRequest()) {\n      return res.status(429).json({\n        error: 'Daily API quota exceeded',\n        remaining: quotaManager.getRemainingQuota(),\n      });\n    }\n\n    quotaManager.recordUsage('api', 1);\n    next();\n  };\n}\n```\n\n## Output\n- Pricing structure analysis\n- Usage cost analyzer\n- Budget monitoring system\n- Token optimization strategies\n- Quota management\n\n## Cost Optimization Strategies\n\n| Strategy | Savings | Implementation |\n|----------|---------|----------------|\n| Use brief summaries | 30-50% tokens | Set maxLength: 150 |\n| Cache memory searches | 20-30% | Implement result caching |\n| Batch transcriptions | 10-15% | Group small files |\n| Off-peak processing | 0% (no TwinMind variation) | N\u002FA |\n| Annual billing | 33% | Switch to annual plan |\n\n## Pricing Comparison\n\n| Feature | Free | Pro ($10\u002Fmo) | Enterprise |\n|---------|------|--------------|------------|\n| Transcription | Unlimited | Unlimited | Unlimited |\n| API Access | No | Yes | Yes |\n| Ear-3 Model | No | Yes | Yes |\n| Context Tokens | 500K | 2M | Unlimited |\n| Rate Limits | 30\u002Fmin | 60\u002Fmin | 300\u002Fmin |\n| Support | Community | 24hr | Dedicated |\n| Cost\u002FHour | $0 | $0.23 | Custom |\n\n## Error Handling\n\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| Unexpected charges | Usage spike | Set up budget alerts |\n| Quota exceeded | High usage | Implement rate limiting |\n| Wrong tier | Poor planning | Analyze usage patterns |\n\n## Resources\n- [TwinMind Pricing](https:\u002F\u002Ftwinmind.com\u002Fpricing)\n- [Usage Dashboard](https:\u002F\u002Ftwinmind.com\u002Fsettings\u002Fusage)\n- [Enterprise Plans](https:\u002F\u002Ftwinmind.com\u002Fenterprise)\n\n## Next Steps\nFor reference architecture, see `twinmind-reference-architecture`.\n",{"name":5,"author":49,"license":15,"version":50,"description":51,"allowed-tools":52},"Jeremy Longshore \u003Cjeremy@intentsolutions.io>","1.0.0","Optimize TwinMind costs across Free, Pro, and Enterprise tiers.\nUse when analyzing usage patterns, reducing costs,\nor choosing the right pricing tier for your needs.\nTrigger with phrases like \"twinmind cost\", \"reduce twinmind spending\",\n\"twinmind pricing optimization\", \"twinmind budget\".\n","Read, Write, Edit","main","90b50ed0778745a80fd5bfb13b1843d45b9e82f7","tests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Ftwinmind-pack\u002Fskills\u002Ftwinmind-cost-tuning",233,"https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust","https:\u002F\u002Fgithub.com\u002FDicklesworthstone","https:\u002F\u002Fwww.jeffreyemanuel.com\u002F","Building in NY","2026-11-15 01:54:15",{"source":8,"skillName":5,"commands":63,"prompt":73,"zipAvailable":74},[64,67,70],{"tool":65,"command":66},"npx","npx skills add Dicklesworthstone\u002Fpi_agent_rust --skill twinmind-cost-tuning",{"tool":68,"command":69},"bunx","bunx skills add Dicklesworthstone\u002Fpi_agent_rust --skill twinmind-cost-tuning",{"tool":71,"command":72},"pnpm","pnpm dlx skills add Dicklesworthstone\u002Fpi_agent_rust --skill twinmind-cost-tuning","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Fplugins-community\u002Fplugins\u002Fsaas-packs\u002Ftwinmind-pack\u002Fskills\u002Ftwinmind-cost-tuning\u002FSKILL.md",true,[],[77,110,144,167,193,220],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":82,"sourceHtmlUrl":83,"categories":84,"keywords":90,"publishedAt":109},"01M6FCR7G5A005P364Z6ZWCJDP","theme-factory","Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors\u002Ffonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fcreative-design\u002Ftheme-factory\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fcreative-design\u002Ftheme-factory\u002FSKILL.md",[85],{"categoryNo":86,"categoryName":87,"taxonomyType":88,"taxonomyTypeDesc":89},"01JBSEEDCAT000000000000015","视觉设计","SCENARIO","使用场景",[91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,29,107,108],"theme factory","factory","theme","docs","toolkit","generate","artifacts","SET","fly","slides","landing","html","styling","artifact","pages","themes","you","fonts","2026-11-11 15:11:14",{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":114,"sourceHtmlUrl":115,"categories":116,"keywords":120,"publishedAt":44},"01M6FEGPPK0ZTKCCM0R3E3KS33","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Futilities\u002Fweb-artifacts-builder\u002FSKILL.md",[117],{"categoryNo":118,"categoryName":119,"taxonomyType":88,"taxonomyTypeDesc":89},"01JBSEEDCAT000000000000009","前端开发",[121,122,97,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,36,102,138,139,140,141,25,142,143],"web artifacts builder","web","artifacts builder","builder","frontend","css","components","react","component","routing","state management","state","shadcn","file","ui","Tools","Tailwind","single-file","simple","ui components","multi","jsx","suite",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":148,"sourceHtmlUrl":149,"categories":150,"keywords":155,"publishedAt":44},"01M6FEE9VTK1W4GY21AKREJXRG","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fsecurity\u002Fwebapp-testing\u002FSKILL.md",[151,154],{"categoryNo":152,"categoryName":153,"taxonomyType":88,"taxonomyTypeDesc":89},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":118,"categoryName":119,"taxonomyType":88,"taxonomyTypeDesc":89},[156,157,158,125,159,160,122,161,95,162,135,163,164,165,166,29,25],"testing","webapp testing","webapp","screenshots","playwright","debugging","browser","logs","applications","behavior","local",{"skillNo":168,"name":169,"nameZh":6,"description":170,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":171,"sourceHtmlUrl":172,"categories":173,"keywords":174,"publishedAt":44},"01M6FE20F7ZTQBFWKF4MPJ2SBX","neuropixels-analysis","Neuropixels neural recording analysis. Load SpikeGLX\u002FOpenEphys data, preprocess, motion correction, Kilosort4 spike sorting, quality metrics, Allen\u002FIBL curation, AI-assisted visual analysis, for Neuropixels 1.0\u002F2.0 extracellular electrophysiology. Use when working with neural recordings, spike sorting, extracellular electrophysiology, or when the user mentions Neuropixels, SpikeGLX, Open Ephys, Kilosort, quality metrics, or unit curation.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fneuropixels-analysis\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fscientific\u002Fneuropixels-analysis\u002FSKILL.md",[],[175,176,177,178,179,180,181,182,36,183,184,185,186,187,188,189,29,190,191,192,25,23],"analysis","neuropixels analysis","spike","metrics","data","open","quality","user","recordings","Neural","motion","visual","quality metrics","unit","sorting","curation","recording","load",{"skillNo":194,"name":195,"nameZh":6,"description":196,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":81,"licenseFileUrl":197,"sourceHtmlUrl":198,"categories":199,"keywords":203,"publishedAt":44},"01M6FDP0PDK6F1GGX395C7625Z","skill-creator","Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fskill-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fskill-creator\u002FSKILL.md",[200],{"categoryNo":201,"categoryName":202,"taxonomyType":88,"taxonomyTypeDesc":89},"01JBSEEDCAT000000000000023","Skill与智能体开发",[204,205,206,207,208,209,210,211,212,213,214,215,216,217,29,25,218,23,219],"skill creator","creator","workflows","create","update","capabilities","knowledge","tool","integrations","specialized","guide","new skill","existing skill","users","Existing","new",{"skillNo":221,"name":222,"nameZh":6,"description":223,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":224,"sourceHtmlUrl":225,"categories":226,"keywords":228,"publishedAt":44},"01M6FDM8Y7VK7NYG9SM7QPA3PW","notebooklm","Use this skill to query your Google NotebookLM notebooks directly from Claude Code for source-grounded, citation-backed answers from Gemini. Browser automation, library management, persistent auth. Drastically reduced hallucinations through document-only responses.","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fnotebooklm\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fproductivity\u002Fnotebooklm\u002FSKILL.md",[227],{"categoryNo":201,"categoryName":202,"taxonomyType":88,"taxonomyTypeDesc":89},[222,229,230,231,232,233,234,162,235,236,36,237,238,239,240,25,241],"google","browser automation","gemini","automation","auth","code","library","management","only","document","query","Citation","source"]