Problem
7+ workflows use cache-memory for historical trending analysis, each implementing a similar pattern independently:
- Historical data collection windows (backfill vs. incremental)
- JSONL history file management
- Timestamp-based entry deduplication
- 7-day and 30-day trend calculations
This duplication leads to:
- Inconsistent trending logic across workflows
- Repeated prompt instructions (~40-60 lines each)
- Difficult to evolve the pattern (must update 7+ workflows)
Current State
Workflows using cache-memory for trending:
- api-consumption-report.md - GitHub API quota trending
- daily-cli-performance.md - Compilation benchmark trending
- lockfile-stats.md - Lockfile statistics trending
- chaos-pr-bundle-fuzzer.md - Fuzzing result trending
- constraint-solving-potd.md - Constraint solver trending
- daily-security-red-team.md - Security scan trending
- static-analysis-report.md - Static analysis trending
Each workflow reimplements:
- History file path conventions (
/tmp/gh-aw/cache-memory/trending/<name>/history.jsonl)
- Entry count checking before collection
- Backfill window logic (30-day initial load)
- Incremental collection (last 1-2 days)
- Deduplication by date
Proposed Solution
Create shared/cache-memory-trending.md with:
-
Standard data collection pattern
- Check existing history entry count
- If < 30 entries: run backfill window (30 days)
- If >= 30 entries: incremental collection (1-2 days)
-
History file conventions
- Path:
/tmp/gh-aw/cache-memory/trending/<workflow-name>/history.jsonl
- Format: One JSON object per line, with
date field
- Deduplication: By date (keep latest entry per day)
-
Trend calculation helpers
- 7-day rolling average
- 30-day rolling average
- Percent change from previous period
- Anomaly detection (>2 std dev from mean)
-
Chart generation guidance
- Use
shared/python-dataviz.md for visualization
- Standard chart types for trends (line, bar, scatter)
- Consistent color schemes
Migration Path
- Extract pattern from
api-consumption-report.md (most mature implementation)
- Create shared component with configurable parameters (workflow name, metric names)
- Migrate workflows one-by-one
- Phase 1: api-consumption-report.md (validate extraction)
- Phase 2: daily-cli-performance.md, lockfile-stats.md
- Phase 3: Remaining 4 workflows
Example Usage
imports:
- uses: shared/cache-memory-trending.md
with:
workflow-name: "api-consumption"
metrics: ["core_consumed", "graphql_consumed"]
trend-windows: ["7d", "30d"]
- shared/python-dataviz.md
- shared/otlp.md
Impact
- Workflows affected: 7+ (with room to grow as more workflows adopt trending)
- Line savings: ~40-60 lines × 7 = 280-420 lines
- Maintenance benefit: Single source of truth for trending logic
- Quality benefit: Consistent trend calculations and anomaly detection
- Adoption potential: Makes trending analysis easier for new workflows
References
- Example implementation:
.github/workflows/api-consumption-report.md (lines 56-120)
- Chart integration:
.github/workflows/shared/python-dataviz.md
- Analysis: §26206419572
Generated by 🔍 Workflow Skill Extractor · ● 1.6M · ◷
Problem
7+ workflows use cache-memory for historical trending analysis, each implementing a similar pattern independently:
This duplication leads to:
Current State
Workflows using cache-memory for trending:
Each workflow reimplements:
/tmp/gh-aw/cache-memory/trending/<name>/history.jsonl)Proposed Solution
Create
shared/cache-memory-trending.mdwith:Standard data collection pattern
History file conventions
/tmp/gh-aw/cache-memory/trending/<workflow-name>/history.jsonldatefieldTrend calculation helpers
Chart generation guidance
shared/python-dataviz.mdfor visualizationMigration Path
api-consumption-report.md(most mature implementation)Example Usage
Impact
References
.github/workflows/api-consumption-report.md(lines 56-120).github/workflows/shared/python-dataviz.md