Skip to content

Commit 9d0810b

Browse files
authored
Reduce ambient prompt bloat in shared prompt blocks and Daily Code Metrics workflow (#36727)
1 parent bb16f25 commit 9d0810b

4 files changed

Lines changed: 18 additions & 120 deletions

File tree

.github/workflows/daily-code-metrics.lock.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/daily-code-metrics.md

Lines changed: 13 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -120,92 +120,19 @@ Generate **6 high-quality charts** to visualize code metrics and trends using Py
120120

121121
### Required Charts
122122

123-
#### 1. LOC by Language (`loc_by_language.png`)
124-
**Type**: Horizontal bar chart
125-
**Content**: Distribution of lines of code by programming language
126-
- Sort by LOC descending
127-
- Include percentage labels on bars
128-
- Use color-coding by language type (e.g., compiled vs interpreted)
129-
- Show total LOC in title
130-
- Save to: `/tmp/gh-aw/python/charts/loc_by_language.png`
131-
132-
#### 2. Top Directories (`top_directories.png`)
133-
**Type**: Horizontal bar chart
134-
**Content**: Top 10 directories by lines of code
135-
- Show full directory paths
136-
- Display LOC count and percentage of total codebase
137-
- Highlight key directories (cmd, pkg, docs, workflows)
138-
- Use distinct colors for different directory types
139-
- Save to: `/tmp/gh-aw/python/charts/top_directories.png`
140-
141-
#### 3. Quality Score Breakdown (`quality_score_breakdown.png`)
142-
**Type**: Stacked bar or pie chart with breakdown
143-
**Content**: Quality score component breakdown
144-
- Test Coverage: 30%
145-
- Code Organization: 25%
146-
- Documentation: 20%
147-
- Churn Stability: 15%
148-
- Comment Density: 10%
149-
- Show current score vs target (100%) for each component
150-
- Use color gradient from red (poor) to green (excellent)
151-
- Save to: `/tmp/gh-aw/python/charts/quality_score_breakdown.png`
152-
153-
#### 4. Test Coverage (`test_coverage.png`)
154-
**Type**: Grouped bar chart or side-by-side comparison
155-
**Content**: Test vs source code comparison
156-
- Test LOC vs Source LOC by language
157-
- Test-to-source ratio visualization
158-
- Include trend indicator if historical data available
159-
- Highlight recommended ratio (e.g., 0.5-1.0)
160-
- Save to: `/tmp/gh-aw/python/charts/test_coverage.png`
161-
162-
#### 5. Code Churn (`code_churn.png`)
163-
**Type**: Diverging bar chart
164-
**Content**: Top 10 most changed source files in last 7 days
165-
- **EXCLUDE** `*.lock.yml` files (generated workflow files)
166-
- Show lines added (positive) and deleted (negative)
167-
- Net change highlighting
168-
- Color-code by file type
169-
- Include file paths truncated if needed
170-
- Save to: `/tmp/gh-aw/python/charts/code_churn.png`
171-
172-
#### 6. Historical Trends (`historical_trends.png`)
173-
**Type**: Multi-line time series chart
174-
**Content**: Track key metrics over 30 days
175-
- Total LOC trend line
176-
- Test coverage percentage trend line
177-
- Quality score trend line
178-
- Use multiple y-axes if scales differ significantly
179-
- Show 7-day moving averages
180-
- Annotate significant changes (>10%)
181-
- Save to: `/tmp/gh-aw/python/charts/historical_trends.png`
123+
1. **LOC by Language** (`loc_by_language.png`) — horizontal bar chart of LOC by language (sorted descending, percentage labels, language-type colors, total LOC in title). Save to `/tmp/gh-aw/python/charts/loc_by_language.png`.
124+
2. **Top Directories** (`top_directories.png`) — horizontal bar chart of top 10 directories by LOC (full paths, LOC and percent, highlight `cmd`/`pkg`/`docs`/`workflows`, distinct directory-type colors). Save to `/tmp/gh-aw/python/charts/top_directories.png`.
125+
3. **Quality Score Breakdown** (`quality_score_breakdown.png`) — stacked bar or pie breakdown of Test Coverage 30%, Code Organization 25%, Documentation 20%, Churn Stability 15%, Comment Density 10%; show current vs target (100%) with red→green gradient. Save to `/tmp/gh-aw/python/charts/quality_score_breakdown.png`.
126+
4. **Test Coverage** (`test_coverage.png`) — grouped comparison of test vs source LOC by language, ratio visualization, optional trend indicator, and recommended ratio marker (0.5–1.0). Save to `/tmp/gh-aw/python/charts/test_coverage.png`.
127+
5. **Code Churn** (`code_churn.png`) — diverging bars for top 10 most changed source files in 7 days; **exclude** `*.lock.yml`, show added/deleted/net, color by file type, truncate long paths when needed. Save to `/tmp/gh-aw/python/charts/code_churn.png`.
128+
6. **Historical Trends** (`historical_trends.png`) — multi-line 30-day trends for total LOC, test coverage %, and quality score with optional multi-axis scales, 7-day moving averages, and >10% annotations. Save to `/tmp/gh-aw/python/charts/historical_trends.png`.
182129
{{else}}
183130
Generate **2 high-quality charts** focusing on the most actionable signals:
184131

185132
### Required Charts (Executive Summary Mode)
186133

187-
#### 1. Quality Score Breakdown (`quality_score_breakdown.png`)
188-
**Type**: Stacked bar or pie chart with breakdown
189-
**Content**: Quality score component breakdown
190-
- Test Coverage: 30%
191-
- Code Organization: 25%
192-
- Documentation: 20%
193-
- Churn Stability: 15%
194-
- Comment Density: 10%
195-
- Show current score vs target (100%) for each component
196-
- Use color gradient from red (poor) to green (excellent)
197-
- Save to: `/tmp/gh-aw/python/charts/quality_score_breakdown.png`
198-
199-
#### 2. Historical Trends (`historical_trends.png`)
200-
**Type**: Multi-line time series chart
201-
**Content**: Track key metrics over 30 days
202-
- Total LOC trend line
203-
- Test coverage percentage trend line
204-
- Quality score trend line
205-
- Use multiple y-axes if scales differ significantly
206-
- Show 7-day moving averages
207-
- Annotate significant changes (>10%)
208-
- Save to: `/tmp/gh-aw/python/charts/historical_trends.png`
134+
1. **Quality Score Breakdown** (`quality_score_breakdown.png`) — stacked bar or pie breakdown of Test Coverage 30%, Code Organization 25%, Documentation 20%, Churn Stability 15%, Comment Density 10%; show current vs target (100%) with red→green gradient. Save to `/tmp/gh-aw/python/charts/quality_score_breakdown.png`.
135+
2. **Historical Trends** (`historical_trends.png`) — multi-line 30-day trends for total LOC, test coverage %, and quality score with optional multi-axis scales, 7-day moving averages, and >10% annotations. Save to `/tmp/gh-aw/python/charts/historical_trends.png`.
209136
{{/if}}
210137

211138
### Chart Quality Standards
@@ -307,20 +234,17 @@ Use detailed template with embedded visualization charts:
307234

308235
### Discussion Structure
309236

310-
**Title**: `Daily Code Metrics Report - YYYY-MM-DD`
311-
312-
**Body**:
237+
- **Title**: `Daily Code Metrics Report - YYYY-MM-DD`
238+
- **Body template**:
313239

314240
```markdown
315241
{{#if experiments.output_format == 'executive_summary' }}
316242
**Key metrics today**: LOC: X,XXX | Quality score: XX/100 | Test ratio: X.XX | Active files (7d): XXX
317243

318244
### 📊 Key Visualizations
319245

320-
#### Quality Score Breakdown
321246
![Quality Score](URL_FROM_UPLOAD_ASSET)
322247

323-
#### Historical Trends (30 Days)
324248
![Historical Trends](URL_FROM_UPLOAD_ASSET)
325249

326250
### 💡 Top Recommendations
@@ -334,32 +258,26 @@ Brief 2-3 paragraph executive summary highlighting key findings, quality score,
334258

335259
### 📊 Visualizations
336260

337-
#### LOC Distribution by Language
338261
![LOC by Language](URL_FROM_UPLOAD_ASSET)
339262

340263
[Analysis of language distribution and changes]
341264

342-
#### Top Directories by LOC
343265
![Top Directories](URL_FROM_UPLOAD_ASSET)
344266

345267
[Analysis of directory sizes and organization]
346268

347-
#### Quality Score Breakdown
348269
![Quality Score](URL_FROM_UPLOAD_ASSET)
349270

350271
[Current quality score and component analysis]
351272

352-
#### Test Coverage Analysis
353273
![Test Coverage](URL_FROM_UPLOAD_ASSET)
354274

355275
[Test coverage metrics and recommendations]
356276

357-
#### Code Churn (Last 7 Days)
358277
![Code Churn](URL_FROM_UPLOAD_ASSET)
359278

360279
[Most changed source files and activity patterns - excludes generated *.lock.yml files]
361280

362-
#### Historical Trends (30 Days)
363281
![Historical Trends](URL_FROM_UPLOAD_ASSET)
364282

365283
[Trend analysis and significant changes]
@@ -368,15 +286,12 @@ Brief 2-3 paragraph executive summary highlighting key findings, quality score,
368286
<summary>📈 Detailed Metrics</summary>
369287

370288
### Size Metrics
371-
372-
#### Lines of Code by Language
373289
| Language | LOC | % of Total | Change (7d) |
374290
|----------|-----|------------|-------------|
375291
| Go | X,XXX | XX% | ⬆️ +X% |
376292
| JavaScript | X,XXX | XX% | ➡️ 0% |
377293
| ... | ... | ... | ... |
378294

379-
#### Lines of Code by Directory
380295
| Directory | LOC | % of Total | Files |
381296
|-----------|-----|------------|-------|
382297
| pkg/ | X,XXX | XX% | XXX |
@@ -402,20 +317,18 @@ Brief 2-3 paragraph executive summary highlighting key findings, quality score,
402317

403318
### Code Churn (Last 7 Days)
404319

405-
#### Source Code Churn (Excludes *.lock.yml)
406-
407320
- **Files Modified**: XXX files
408321
- **Commits**: XXX commits
409322
- **Lines Added**: +X,XXX lines
410323
- **Lines Deleted**: -X,XXX lines
411324
- **Net Change**: +/-X,XXX lines
412325

413-
#### Most Active Source Files
326+
### Most Active Source Files
414327
1. path/to/file.go: +XXX/-XXX lines
415328
2. path/to/file.js: +XXX/-XXX lines
416329
...
417330

418-
#### Workflow Lock File Churn (*.lock.yml only)
331+
### Workflow Lock File Churn (*.lock.yml only)
419332

420333
- **Lock Files Modified**: XXX files
421334
- **Lines Added**: +X,XXX lines
@@ -440,7 +353,7 @@ Brief 2-3 paragraph executive summary highlighting key findings, quality score,
440353

441354
### Quality Score: XX/100
442355

443-
#### Component Breakdown
356+
### Component Breakdown
444357
- **Test Coverage (30%)**: XX/30 points
445358
- **Code Organization (25%)**: XX/25 points
446359
- **Documentation (20%)**: XX/20 points

actions/setup/md/mcp_cli_tools_prompt.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,11 @@ printf '{"title":"Fix: something","body":"Details here","labels":["bug","priorit
5050
| safeoutputs create_issue .
5151
```
5252

53-
**When pipes are blocked by the bash security policy**, write the payload to a file first and use **file redirection** with the `.` sentinel instead:
54-
55-
```bash
56-
# Step 1 — write the JSON payload to a file using the Write tool or a bash heredoc
57-
# Step 2 — redirect the file into the CLI command using '<'
58-
safeoutputs create_pull_request . < /tmp/payload.json
59-
60-
# This is equivalent to piping but does not require a separate command before '|'
61-
safeoutputs add_comment . < /tmp/comment.json
62-
```
53+
If pipes are blocked by bash policy, write JSON to a file and use redirection with `.` (for example: `safeoutputs create_pull_request . < /tmp/payload.json`).
6354

6455
> **Why prefer JSON payload mode?**
65-
> - Single operation for any number of arguments — no repeated `--key value` flags
66-
> - Native types (integers, booleans, arrays) are preserved exactly as specified
67-
> - No shell quoting or escaping needed for newlines, quotes, or special characters
68-
> - Agents can construct the payload as a structured object before emitting the command
69-
> - File redirection (`< file`) works even when pipes (`|`) are restricted
56+
> - Preserves native types and avoids shell quoting/escaping pitfalls
57+
> - Supports both pipe and file-redirection input with the same `.` sentinel
7058
7159
Notes:
7260

actions/setup/md/safe_outputs_prompt.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ Safe-output calls are write-once declarations for real downstream side effects.
1010

1111
**Do not inspect infrastructure internals.** When a tool or command fails, do not inspect Docker sockets (`/var/run/docker.sock`), mount tables (`/proc/self/mounts`), container networking (`/proc/net`), `/host` paths, git object storage internals, or container-runtime environment internals. These are outside your control; use `report_incomplete` after the retry limit.
1212

13-
When no action is needed, call noop like this:
14-
```json
15-
{"noop": {"message": "No action needed: [brief explanation of what was analyzed and why no action was required]"}}
16-
```
13+
When no action is needed, call `noop` with a short status message explaining what you checked and why no action was required.
1714

1815
temporary_id: optional cross-reference field. Canonical form: '#aw_' followed by 3–12 alphanumeric or underscore characters — e.g., '#aw_abc1', '#aw_pr_fix'. Pattern: /^#?aw_[A-Za-z0-9_]{3,12}$/i (the '#' prefix is optional; bare 'aw_abc1' is accepted and normalised to '#aw_abc1' automatically). Use this form for all field values (temporary_id, item_number, issue_number, parent, etc.). In body/markdown text, '#aw_abc1' references are replaced with the real issue/PR number after creation. Omit entirely when not needed.
1916

0 commit comments

Comments
 (0)