Skip to content

[refactoring] Extract repo-memory configuration into shared component #15951

@github-actions

Description

@github-actions

Skill Overview

Extract common repo-memory configuration patterns into a reusable shared component. Currently, 21 workflows use repo-memory for persistent storage with similar configuration patterns, creating duplication and inconsistency in memory branch naming, file size limits, and file patterns.

Current Usage

This configuration pattern appears in the following workflows:

  • pr-triage-agent.md (memory/pr-triage) - PR triage state
  • copilot-agent-analysis.md (memory/copilot-agent-analysis) - Agent metrics
  • audit-workflows.md (memory/audit-workflows) - Audit history
  • copilot-cli-deep-research.md (memory/copilot-cli-research) - Research notes (200KB)
  • copilot-pr-nlp-analysis.md (memory/nlp-analysis) - NLP results
  • copilot-pr-prompt-analysis.md (memory/prompt-analysis) - Prompt patterns
  • daily-code-metrics.md (branch-prefix: daily) - Metrics history
  • agent-performance-analyzer.md (memory/meta-orchestrators) - Performance data
  • metrics-collector.md (likely uses memory/) - Metrics collection
  • portfolio-analyst.md (likely uses memory/) - Portfolio state
  • prompt-clustering-analysis.md (likely uses memory/) - Clustering results
  • + 10 more workflows with repo-memory

Common Configuration Pattern

Standard Pattern (15-25 lines per workflow):

tools:
  repo-memory:
    branch-name: memory/[workflow-name]
    description: "Historical [workflow type] data"
    file-glob: ["*.json", "*.jsonl", "*.csv", "*.md"]
    max-file-size: 102400  # 100KB

Variations Found:

  • Large files: Some use max-file-size: 204800 (200KB) for research workflows
  • Branch patterns: Most use memory/[name], one uses branch-prefix: daily
  • File patterns: Most use ["*.json", "*.jsonl", "*.csv", "*.md"]
  • Descriptions: Vary but follow "Historical [type] data" pattern

Proposed Shared Component

File: .github/workflows/shared/repo-memory-standard.md

Configuration:

---
# Standard Repo-Memory Configuration
# Provides consistent persistent storage for workflow state and history

tools:
  repo-memory:
    branch-name: memory/\$\{WORKFLOW_ID}
    description: "Historical workflow data and state"
    file-glob: ["*.json", "*.jsonl", "*.csv", "*.md"]
    max-file-size: 102400  # 100KB
---

# Standard Repo-Memory Configuration

This shared component provides standardized configuration for workflows that need persistent storage across runs.

### Features

- **Consistent branch naming**: `memory/[workflow-name]` pattern
- **Standard file types**: JSON, JSONL, CSV, Markdown
- **Safe file size**: 100KB limit (prevents memory bloat)
- **Organized storage**: All memory in `memory/*` branches

### Usage

Import this component in workflows that need persistent state:

````yaml
imports:
  - shared/repo-memory-standard.md

Memory will be available at: /tmp/gh-aw/repo-memory/default/

Customization Options

For larger files (research, analysis):

imports:
  - shared/repo-memory-standard.md

tools:
  repo-memory:
    max-file-size: 204800  # Override to 200KB

For specific file patterns:

imports:
  - shared/repo-memory-standard.md

tools:
  repo-memory:
    file-glob: ["*.json", "*.jsonl"]  # Only JSON files

For custom branch naming:

imports:
  - shared/repo-memory-standard.md

tools:
  repo-memory:
    branch-name: memory/custom-name  # Override branch

Memory Access

Memory is mounted at /tmp/gh-aw/repo-memory/default/:

# Read historical data
cat /tmp/gh-aw/repo-memory/default/history.jsonl

# Write new data
echo '{"date": "2024-01-15", "metrics": {...}}' >> /tmp/gh-aw/repo-memory/default/history.jsonl

# List available files
ls -lh /tmp/gh-aw/repo-memory/default/

Best Practices

  1. Use JSONL for append-only logs: Efficient for historical data
  2. Clean up old data: Delete files older than 30 days in memory branches
  3. Version your data format: Include schema version in JSON files
  4. Document memory structure: Add README.md in memory branches

**Usage Example**:
````yaml
# pr-triage-agent.md (BEFORE)
---
description: PR triage automation
tools:
  github:
    lockdown: true
    toolsets: [pull_requests, repos, issues, labels]
  repo-memory:
    branch-name: memory/pr-triage
    file-glob: "**"
    max-file-size: 102400  # 100KB
imports:
  - shared/mood.md
---

# AFTER (saves 18 lines)
---
description: PR triage automation
tools:
  github:
    lockdown: true
    toolsets: [pull_requests, repos, issues, labels]
imports:
  - shared/repo-memory-standard.md
  - shared/mood.md
---

Impact

  • Workflows affected: 21 workflows
  • Lines saved: ~20 lines per workflow × 21 = ~420 lines
  • Consistency benefit: Standardizes memory branch naming across repository
  • Maintenance benefit: Update file size limits or patterns in one place
  • Discoverability: Makes it easier to find where workflows store persistent data
  • Documentation benefit: Centralized memory usage documentation

Implementation Plan

  1. Create shared component at .github/workflows/shared/repo-memory-standard.md
  2. Document memory branch naming convention in component
  3. Test with 3 sample workflows (pr-triage-agent, copilot-agent-analysis, audit-workflows)
  4. Validate memory persistence across workflow runs
  5. Create variants if needed (e.g., repo-memory-large.md for 200KB limit)
  6. Update remaining 18 workflows to use shared component
  7. Add memory branch discovery documentation to AGENTS.md
  8. Consider adding memory branch cleanup workflow

Memory Branch Organization

After implementation, all workflow memory will follow consistent pattern:

memory/
├── pr-triage/           # PR triage agent state
├── copilot-agent-analysis/  # Agent performance data
├── audit-workflows/     # Audit history
├── copilot-cli-research/    # Research notes (200KB limit)
├── nlp-analysis/        # NLP analysis results
└── [workflow-name]/     # Future workflows

Related Analysis

This recommendation comes from the Workflow Skill Extractor analysis run on 2026-02-15.

Analysis findings:

  • 154 total workflows analyzed
  • 21 workflows use repo-memory (14%)
  • Inconsistent branch naming makes discovery difficult
  • File size limits vary (100KB, 200KB)
  • Potential to save ~420 lines of configuration
  • Improves memory organization and discoverability

Generated by Workflow Skill Extractor

  • expires on Feb 17, 2026, 4:20 PM UTC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions