Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Optimize Glean costs by managing indexed content volume, datasource efficiency, and connector resource usage. Trigger: "glean costs", "glean optimization", "reduce glean indexing".
.claude/skills/jeremylongshore-glean-cost-tuning/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -17% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 7% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 19% | 0% |
| case-06 | ✗→✓ | ▲ Improved | -10% | 0% |
| case-07 | ✗→✓ | ▲ Improved | -9% | 0% |
Glean pricing scales with indexed content volume and per-seat user count, making document indexing volume and search query frequency the primary cost drivers. Enterprise deployments typically connect dozens of datasources, each pushing thousands of documents into the index. Without active content governance, stale drafts, archived pages, and near-empty documents inflate the index by 30-50%, driving up costs with zero search value. Pruning irrelevant content and using incremental indexing are the highest-leverage optimizations.
| Component | Cost Driver | Optimization | |-----------|------------|--------------| | Document indexing | Volume of indexed content across all sources | Filter drafts, templates, and archived content pre-index | | User seats | Per-seat licensing | Audit active users quarterly; deprovision inactive accounts | | Search queries | Query volume across the organization | Cache frequent queries; use search analytics to identify redundant patterns | | Datasource connectors | Number of active connectors to maintain | Consolidate overlapping sources; remove unused connectors | | Content storage | Size of indexed documents | Truncate body to 50KB; skip attachments over 10MB |
typescriptclass GleanIndexFilter { private staleThreshold = 365 * 24 * 60 * 60 * 1000; // 12 months shouldIndex(doc: { status: string; updatedAt: number; title: string; content: string }): boolean { if (doc.status === 'draft' || doc.status === 'archived') return false; if (Date.now() - doc.updatedAt > this.staleThreshold) return false; if (doc.title.startsWith('[Template]')) return false; if (doc.content.length < 50) return false; return true; } async incrementalIndex(docs: any[], lastSyncTimestamp: number): Promise<any[]> { // Only process documents modified since last sync — reduces indexing calls by 80-90% const modified = docs.filter(d => d.updatedAt > lastSyncTimestamp); const eligible = modified.filter(d => this.shouldIndex(d)); return eligible.map(d => ({ ...d, content: d.content.slice(0, 50_000) // Truncate to 50KB })); } }
typescriptclass GleanCostMonitor { private indexedDocs = 0; private queriesThisHour = 0; private budgetDocs = 100_000; recordIndexed(count: number): void { this.indexedDocs += count; const utilization = (this.indexedDocs / this.budgetDocs) * 100; if (utilization > 80) { console.warn(`Glean index at ${utilization.toFixed(0)}% capacity: ${this.indexedDocs}/${this.budgetDocs} docs`); } } getUtilization(): string { return `${((this.indexedDocs / this.budgetDocs) * 100).toFixed(1)}% index capacity used`; } }
| Issue | Cause | Fix | |-------|-------|-----| | Index bloat exceeding budget | No content filtering on connectors | Apply shouldIndex filter to all datasource pipelines | | Stale search results | Deleted docs still in index | Run nightly reconciliation to remove orphaned entries | | Connector timeouts | Source system rate limiting | Implement backoff and schedule syncs during off-peak | | Duplicate documents indexed | Same content in multiple datasources | Deduplicate by content hash before indexing | | Query costs spiking | Bot or automated search traffic | Rate-limit API search consumers; whitelist known clients |
See glean-performance-tuning.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 34,419 | 23,382 | -32% | 1 | 1 | 0% | 6,261 | 5,208 | -17% | 0 | 0 | — |
case-02 | fail→pass | 26,488 | 23,539 | -11% | 1 | 1 | 0% | 4,327 | 4,619 | +7% | 0 | 0 | — |
case-03 | fail→pass | 26,504 | 25,588 | -3% | 1 | 1 | 0% | 3,963 | 4,714 | +19% | 0 | 0 | — |
case-04 | pass→fail | 18,664 | 27,035 | +45% | 1 | 1 | 0% | 3,442 | 5,480 | +59% | 0 | 0 | — |
case-05 | pass→pass | 20,774 | 19,367 | -7% | 1 | 1 | 0% | 2,942 | 4,466 | +52% | 0 | 0 | — |
case-06 | fail→pass | 18,310 | 5,907 | -68% | 1 | 1 | 0% | 2,452 | 2,217 | -10% | 0 | 0 | — |
case-07 | fail→pass | 17,847 | 11,727 | -34% | 1 | 1 | 0% | 2,536 | 2,304 | -9% | 0 | 0 | — |
case-08 | pass→pass | 11,672 | 3,241 | -72% | 1 | 1 | 0% | 2,153 | 1,669 | -22% | 0 | 0 | — |
case-09 | fail→pass | 10,683 | 5,607 | -48% | 1 | 1 | 0% | 1,935 | 2,102 | +9% | 0 | 0 | — |
case-10 | fail→pass | 14,289 | 7,765 | -46% | 1 | 1 | 0% | 1,836 | 1,645 | -10% | 0 | 0 | — |
case-11 | fail→pass | 9,115 | 7,351 | -19% | 1 | 1 | 0% | 1,652 | 1,500 | -9% | 0 | 0 | — |
case-12 | pass→pass | 8,087 | 2,425 | -70% | 1 | 1 | 0% | 1,446 | 1,534 | +6% | 0 | 0 | — |
case-13 | pass→pass | 14,819 | 3,858 | -74% | 1 | 1 | 0% | 1,589 | 1,766 | +11% | 0 | 0 | — |
case-14 | pass→pass | 13,511 | 13,583 | +1% | 1 | 1 | 0% | 1,277 | 2,442 | +91% | 0 | 0 | — |
case-15 | pass→pass | 10,595 | 17,828 | +68% | 1 | 1 | 0% | 1,630 | 3,140 | +93% | 0 | 0 | — |
case-16 | pass→pass | 19,104 | 13,460 | -30% | 1 | 1 | 0% | 2,893 | 3,258 | +13% | 0 | 0 | — |
case-17 | pass→pass | 8,525 | 6,808 | -20% | 1 | 1 | 0% | 1,374 | 1,513 | +10% | 0 | 0 | — |
case-18 | pass→pass | 18,639 | 11,769 | -37% | 1 | 1 | 0% | 3,212 | 3,046 | -5% | 0 | 0 | — |
case-19 | pass→pass | 13,511 | 15,322 | +13% | 1 | 1 | 0% | 2,204 | 2,650 | +20% | 0 | 0 | — |
case-20 | pass→pass | 10,621 | 10,080 | -5% | 1 | 1 | 0% | 1,545 | 2,057 | +33% | 0 | 0 | — |
case-21 | fail→pass | 26,614 | 6,907 | -74% | 1 | 1 | 0% | 1,702 | 1,362 | -20% | 0 | 0 | — |
case-22 | pass→pass | 10,082 | 3,249 | -68% | 1 | 1 | 0% | 1,586 | 1,543 | -3% | 0 | 0 | — |
case-23 | fail→pass | 12,694 | 1,568 | -88% | 1 | 1 | 0% | 1,205 | 1,254 | +4% | 0 | 0 | — |
case-24 | fail→pass | 17,607 | 6,585 | -63% | 1 | 1 | 0% | 2,041 | 1,270 | -38% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted, and 23 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +42 percentage points is the difference between those two pass rates over the 23 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.