Skip to content

Commit 3c33375

Browse files
author
Build Tools
committed
reduce token usage: grep logs instead of reading whole files
1 parent 177a366 commit 3c33375

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

bin/ci_tool/ci_context/CLAUDE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
You are inside a CI reproduction container. The ROS workspace is at `/ros_ws/`.
44
Source code is under `/ros_ws/src/`. Built packages install to `/ros_ws/install/`.
55

6+
## Token Efficiency
7+
8+
Use Grep to search log files for relevant errors — never read entire log files.
9+
When examining test output, search for FAILURE, FAILED, ERROR, or assertion messages.
10+
Pipe long command output through `tail -200` or `grep` to avoid dumping huge logs.
11+
612
## Environment Setup
713

814
```bash

bin/ci_tool/ci_fix.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
ANALYSIS_PROMPT_TEMPLATE = (
6161
ROS_SOURCE_PREAMBLE
6262
+ "The CI tests have already been run. Analyse the failures:\n"
63-
"1. Examine the test output in /ros_ws/test_output.log\n"
63+
"1. Use Grep to search /ros_ws/test_output.log for FAILURE, FAILED, ERROR, "
64+
"and assertion messages. Do NOT read the entire file.\n"
6465
"2. For each failing test, report:\n"
6566
" - Package and test name\n"
6667
" - The error/assertion message\n"
@@ -78,8 +79,8 @@
7879
" --jq '.head_sha'`\n"
7980
" - If they differ, determine whether the missing/extra commits "
8081
"explain the failure\n"
81-
"- Fetch CI logs: `gh run view {run_id} --log-failed` "
82-
"(use `--log` for full output if needed)\n"
82+
"- Fetch CI logs: `gh run view {run_id} --log-failed 2>&1 | tail -200` "
83+
"(increase if needed, but avoid dumping full logs)\n"
8384
"- Compare CI failures with local test results\n"
8485
)
8586

0 commit comments

Comments
 (0)