From 6b6d7c1ec0f6cbb435f6740fc903e1f32303f891 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 2 May 2026 23:48:13 +0000 Subject: [PATCH 1/2] Initial plan From 727e10737f826b37af0afd0af15868f44c710b6b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 2 May 2026 23:58:03 +0000 Subject: [PATCH 2/2] optimize agent-performance-analyzer with inline sub-agents - Add `inline-agents: true` to features frontmatter - Add `metrics-extractor` sub-agent (claude-haiku-4.5) for Phase 1 memory reads - Add `pattern-detector` sub-agent (claude-haiku-4.5) for Phase 3 pattern classification - Recompile lock file Closes #" Agent-Logs-Url: https://github.com/github/gh-aw/sessions/99053b03-badd-47aa-a744-52e42876615a Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .../agent-performance-analyzer.lock.yml | 32 +++++---- .../workflows/agent-performance-analyzer.md | 67 ++++++++++++++++--- 2 files changed, 75 insertions(+), 24 deletions(-) diff --git a/.github/workflows/agent-performance-analyzer.lock.yml b/.github/workflows/agent-performance-analyzer.lock.yml index 56a2ecb4756..aa7bea4ebb7 100644 --- a/.github/workflows/agent-performance-analyzer.lock.yml +++ b/.github/workflows/agent-performance-analyzer.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"215d28d49fb80204f55fb58a420c7154365c290811e8c9100fbe5b677fe26ba4","strict":true,"agent_id":"copilot"} +# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"81702e7d6f45864dfd3320bc2482152085a4854380a6a4ea0704320b1defb856","strict":true,"agent_id":"copilot"} # gh-aw-manifest: {"version":1,"secrets":["GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/checkout","sha":"de0fac2e4500dabe0009e67214ff5f5447ce83dd","version":"v6.0.2"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9"},{"repo":"actions/setup-go","sha":"4a3601121dd01d1626a1e23e37211e3254c1c06c","version":"v6.4.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"docker/build-push-action","sha":"bcafcacb16a39f128d818304e6c9c0c18556b85f","version":"v7.1.0"},{"repo":"docker/setup-buildx-action","sha":"4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd","version":"v4.0.0"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.25.35"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.25.35"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.25.35"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.25.35"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.3"},{"image":"ghcr.io/github/github-mcp-server:v1.0.3","digest":"sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959","pinned_image":"ghcr.io/github/github-mcp-server:v1.0.3@sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959"},{"image":"node:lts-alpine","digest":"sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f","pinned_image":"node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f"}]} # ___ _ _ # / _ \ | | (_) @@ -177,22 +177,22 @@ jobs: run: | bash "${RUNNER_TEMP}/gh-aw/actions/create_prompt_first.sh" { - cat << 'GH_AW_PROMPT_68522bbb3bf72afd_EOF' + cat << 'GH_AW_PROMPT_864b98ea687e1d3e_EOF' - GH_AW_PROMPT_68522bbb3bf72afd_EOF + GH_AW_PROMPT_864b98ea687e1d3e_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/xpia.md" cat "${RUNNER_TEMP}/gh-aw/prompts/temp_folder_prompt.md" cat "${RUNNER_TEMP}/gh-aw/prompts/markdown.md" cat "${RUNNER_TEMP}/gh-aw/prompts/agentic_workflows_guide.md" cat "${RUNNER_TEMP}/gh-aw/prompts/repo_memory_prompt.md" cat "${RUNNER_TEMP}/gh-aw/prompts/safe_outputs_prompt.md" - cat << 'GH_AW_PROMPT_68522bbb3bf72afd_EOF' + cat << 'GH_AW_PROMPT_864b98ea687e1d3e_EOF' Tools: add_comment(max:10), create_issue(max:5), create_discussion(max:2), missing_tool, missing_data, noop - GH_AW_PROMPT_68522bbb3bf72afd_EOF + GH_AW_PROMPT_864b98ea687e1d3e_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/mcp_cli_tools_prompt.md" - cat << 'GH_AW_PROMPT_68522bbb3bf72afd_EOF' + cat << 'GH_AW_PROMPT_864b98ea687e1d3e_EOF' The following GitHub context information is available for this workflow: {{#if __GH_AW_GITHUB_ACTOR__ }} @@ -221,14 +221,14 @@ jobs: {{/if}} - GH_AW_PROMPT_68522bbb3bf72afd_EOF + GH_AW_PROMPT_864b98ea687e1d3e_EOF cat "${RUNNER_TEMP}/gh-aw/prompts/cli_proxy_with_safeoutputs_prompt.md" - cat << 'GH_AW_PROMPT_68522bbb3bf72afd_EOF' + cat << 'GH_AW_PROMPT_864b98ea687e1d3e_EOF' {{#runtime-import .github/workflows/shared/reporting.md}} {{#runtime-import .github/workflows/shared/noop-reminder.md}} {{#runtime-import .github/workflows/agent-performance-analyzer.md}} - GH_AW_PROMPT_68522bbb3bf72afd_EOF + GH_AW_PROMPT_864b98ea687e1d3e_EOF } > "$GH_AW_PROMPT" - name: Interpolate variables and render templates uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 @@ -309,6 +309,7 @@ jobs: /tmp/gh-aw/aw-prompts/prompt.txt /tmp/gh-aw/github_rate_limits.jsonl /tmp/gh-aw/base + /tmp/gh-aw/.agents/agents if-no-files-found: ignore retention-days: 1 @@ -470,6 +471,11 @@ jobs: GH_AW_AGENT_FOLDERS: ".agents .claude .codex .crush .gemini .github .opencode .pi" GH_AW_AGENT_FILES: ".crush.json AGENTS.md CLAUDE.md GEMINI.md PI.md opencode.jsonc" run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_base_github_folders.sh" + - name: Restore inline sub-agents from activation artifact + env: + GH_AW_SUB_AGENT_DIR: ".agents/agents" + GH_AW_SUB_AGENT_EXT: ".agent.md" + run: bash "${RUNNER_TEMP}/gh-aw/actions/restore_inline_sub_agents.sh" - name: Download container images run: bash "${RUNNER_TEMP}/gh-aw/actions/download_docker_images.sh" ghcr.io/github/gh-aw-firewall/agent:0.25.35 ghcr.io/github/gh-aw-firewall/api-proxy:0.25.35 ghcr.io/github/gh-aw-firewall/cli-proxy:0.25.35 ghcr.io/github/gh-aw-firewall/squid:0.25.35 ghcr.io/github/gh-aw-mcpg:v0.3.3 ghcr.io/github/github-mcp-server:v1.0.3@sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959 node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f - name: Install gh-aw extension @@ -505,9 +511,9 @@ jobs: mkdir -p "${RUNNER_TEMP}/gh-aw/safeoutputs" mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs - cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_c6e4112fd5ae5c5c_EOF' + cat > "${RUNNER_TEMP}/gh-aw/safeoutputs/config.json" << 'GH_AW_SAFE_OUTPUTS_CONFIG_477767443955ee26_EOF' {"add_comment":{"max":10},"create_discussion":{"expires":24,"fallback_to_issue":true,"max":2},"create_issue":{"expires":48,"group":true,"labels":["cookie"],"max":5},"create_report_incomplete_issue":{},"missing_data":{},"missing_tool":{},"noop":{"max":1,"report-as-issue":"true"},"push_repo_memory":{"memories":[{"dir":"/tmp/gh-aw/repo-memory/default","id":"default","max_file_count":100,"max_file_size":102400,"max_patch_size":10240}]},"report_incomplete":{}} - GH_AW_SAFE_OUTPUTS_CONFIG_c6e4112fd5ae5c5c_EOF + GH_AW_SAFE_OUTPUTS_CONFIG_477767443955ee26_EOF - name: Write Safe Outputs Tools env: GH_AW_TOOLS_META_JSON: | @@ -757,7 +763,7 @@ jobs: mkdir -p /home/runner/.copilot GH_AW_NODE=$(which node 2>/dev/null || command -v node 2>/dev/null || echo node) - cat << GH_AW_MCP_CONFIG_87f0335ec72d6307_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" + cat << GH_AW_MCP_CONFIG_8087e7d0abfa2ac3_EOF | "$GH_AW_NODE" "${RUNNER_TEMP}/gh-aw/actions/start_mcp_gateway.cjs" { "mcpServers": { "agenticworkflows": { @@ -801,7 +807,7 @@ jobs: "payloadDir": "${MCP_GATEWAY_PAYLOAD_DIR}" } } - GH_AW_MCP_CONFIG_87f0335ec72d6307_EOF + GH_AW_MCP_CONFIG_8087e7d0abfa2ac3_EOF - name: Mount MCP servers as CLIs id: mount-mcp-clis continue-on-error: true diff --git a/.github/workflows/agent-performance-analyzer.md b/.github/workflows/agent-performance-analyzer.md index f639f28b808..fdd46f8372f 100644 --- a/.github/workflows/agent-performance-analyzer.md +++ b/.github/workflows/agent-performance-analyzer.md @@ -34,6 +34,7 @@ safe-outputs: timeout-minutes: 30 features: copilot-requests: true + inline-agents: true --- {{#runtime-import? .github/shared-instructions.md}} @@ -239,13 +240,18 @@ The Metrics Collector workflow runs daily and stores performance metrics in a st ### Phase 1: Data Collection (10 minutes) 1. **Load historical metrics from shared storage:** - - Read latest metrics from: `/tmp/gh-aw/repo-memory/default/metrics/latest.json` - - Load daily metrics for trend analysis from: `/tmp/gh-aw/repo-memory/default/metrics/daily/` - - Extract per-workflow metrics: - - Safe output counts (issues, PRs, comments, discussions) - - Workflow run statistics (total, successful, failed, success_rate) - - Engagement metrics (reactions, comments, replies) - - Quality indicators (merge rates, close times) + + Use the `metrics-extractor` sub-agent to read all shared repo-memory files and return structured JSON. Invoke it with the following newline-separated list of paths: + ``` + /tmp/gh-aw/repo-memory/default/metrics/latest.json + /tmp/gh-aw/repo-memory/default/metrics/daily/ + /tmp/gh-aw/repo-memory/default/agent-performance-latest.md + /tmp/gh-aw/repo-memory/default/campaign-manager-latest.md + /tmp/gh-aw/repo-memory/default/workflow-health-latest.md + /tmp/gh-aw/repo-memory/default/shared-alerts.md + ``` + + The sub-agent returns a single JSON object; use it as your source of truth for all metrics data in subsequent phases. 2. **Gather agent outputs:** - Query recent issues/PRs/comments with agent attribution @@ -297,10 +303,12 @@ The Metrics Collector workflow runs daily and stores performance metrics in a st ### Phase 3: Pattern Detection (5 minutes) 7. **Identify behavioral patterns:** - - Detect over/under-creation patterns - - Find repetition or duplication - - Identify scope creep instances - - Flag inconsistent behavior + + Use the `pattern-detector` sub-agent to classify agent behavioral patterns from the profiles you built in Phase 1. Pass the agent profiles as an inline JSON object. It will return a structured classification of: + - Over/under-creation patterns + - Repetition or duplication + - Scope creep instances + - Inconsistent behavior flags 8. **Analyze collaboration:** - Map agent interactions @@ -578,3 +586,40 @@ Your effectiveness is measured by: Execute all phases systematically and maintain an objective, data-driven approach to agent performance analysis. {{#runtime-import shared/noop-reminder.md}} + +## agent: `metrics-extractor` +--- +model: claude-haiku-4.5 +description: Reads shared repo-memory metric files and returns structured JSON with all relevant performance data +--- +You are a metrics extraction assistant. When given a newline-separated list of file paths (one path per line), read each file using bash and return a single JSON object containing all data found. + +For JSON files, parse and include the full content under a key matching the file's basename (without extension). For a directory path, list and read all files within it, using their basenames as keys. For markdown files, include the raw text under a key matching the filename. + +If a file does not exist or cannot be read, include `null` for that key. + +Return the result as a single valid JSON object with no additional commentary. + +## agent: `pattern-detector` +--- +model: claude-haiku-4.5 +description: Classifies agent behavioral patterns from profiles and returns a structured categorization of issues found +--- +You are an agent behavior classification assistant. When given a JSON object containing agent profiles (with fields such as output counts, types, success rates, and resource usage), classify each agent's behavioral patterns. + +For each agent, identify which of the following patterns apply: +- **over-creation**: Output count significantly above expected baseline +- **under-creation**: Output count significantly below expected baseline or zero +- **repetition**: Duplicate or near-duplicate outputs detected +- **scope-creep**: Outputs outside the agent's defined responsibility area +- **inconsistency**: High variance in output counts or quality across runs + +Return a JSON object where each key is the agent name and the value is an array of detected pattern strings (empty array if none detected). Example: + +```json +{ + "agent-a": ["over-creation", "inconsistency"], + "agent-b": [], + "agent-c": ["under-creation"] +} +```