Skip to content

Commit 80d63b1

Browse files
agent-skills: add chronos documentation and add helper copy script (#15201)
Signed-off-by: David Korczynski <david@adalogics.com>
1 parent 1b9899b commit 80d63b1

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash -eu
2+
# Copyright 2026 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
################################################################################
17+
18+
# Copy the skills folder into the global skills directory
19+
20+
# Accept user input. Should by default be "gemini" but can be overridden by the user.
21+
SKILLS_DIR=${1:-"gemini"}
22+
23+
24+
# Gemini skills dir = ~/.gemini/skills
25+
# Claude skills dir = ~/.claude/skills
26+
if [ "$SKILLS_DIR" == "gemini" ]; then
27+
GLOBAL_SKILLS_DIR="$HOME/.gemini/skills"
28+
elif [ "$SKILLS_DIR" == "claude" ]; then
29+
GLOBAL_SKILLS_DIR="$HOME/.claude/skills"
30+
else
31+
echo "Invalid skills directory specified. Use 'gemini' or 'claude'."
32+
exit 1
33+
fi
34+
35+
# Log target skill directory
36+
echo "Copying skills to global skills directory: $GLOBAL_SKILLS_DIR"
37+
38+
39+
# Now copy each of the skills from the local "skills" directory to the global skills directory
40+
# Overwrite existing skills with the same name.
41+
# Check if the global skills directory exists, if not create it
42+
if [ ! -d "$GLOBAL_SKILLS_DIR" ]; then
43+
mkdir -p "$GLOBAL_SKILLS_DIR"
44+
fi
45+
46+
# Copy each skill from the local "skills" directory to the global skills directory
47+
# Make sure we work from this scripts base folder and copy each of the skills
48+
# fuzzing-memory-unsafe-expert
49+
# oss-fuzz-engineer
50+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
51+
for skill in "fuzzing-memory-unsafe-expert" "oss-fuzz-engineer"; do
52+
abs_skill="$SCRIPT_DIR/$skill"
53+
# Copy over the skill and replace any existing skill with the same name in the global skills directory
54+
if [ -d "$GLOBAL_SKILLS_DIR/$skill" ]; then
55+
rm -rf "$GLOBAL_SKILLS_DIR/$skill"
56+
fi
57+
58+
echo "Copying $abs_skill to $GLOBAL_SKILLS_DIR/"
59+
cp -r "$abs_skill" "$GLOBAL_SKILLS_DIR/"
60+
done

infra/experimental/agent-skills/oss-fuzz-engineer/SKILL.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,34 @@ python3 infra/helper.py check_build PROJECT_NAME
6262
```
6363

6464
The agent should never make any commits or push anything to GitHub, but should conclude on the work for the security engineer to review. The agent should never submit any changes to OSS-Fuzz's Github.
65+
66+
67+
### Chronos integration
68+
69+
A common task for an OSS-Fuzz engineer is to add Chronos support for a given OSS-Fuzz project.
70+
71+
Chronos is a feature of OSS-Fuzz that makes it possible to quickly rebuild OSS-Fuzz projects and run unit tests of a given OSS-Fuzz project. This is used to efficiently validate e.g. patches of a project without having to rebuild the entire target project image.
72+
73+
To add Chronos support a project needs to have two key scripts:
74+
75+
- replay_build.sh: used to quickly rebuild the project without network access.
76+
- run_tests.sh: used to run unit tests of the project without network access.
77+
78+
There are several constraints on these scripts, e.g. no network access, and it's important to always check the infra/chronos/README.md file to understand the specifics.
79+
80+
A given Chronos integration must succeed with:
81+
82+
```sh
83+
python3 infra/experimental/chronos/manager.py check-replay PROJECT_NAME
84+
python3 infra/experimental/chronos/manager.py check-tests PROJECT_NAME
85+
```
86+
87+
The above two commands must succeed without error, and when integrating a new project these commands must be run before concluding on the work for the security engineer to review.
88+
89+
90+
# Guidelines for working locally on OSS-Fuzz projects
91+
92+
1. Always work from the base folder of the current OSS-Fuzz project unless otherwise specified.
93+
2. Make a local checkout of the target source code to make working with the target project easy. This involves e.g. studying the `Dockerfile` of the target project, finding the e.g. `git clone` of the target project, and then cloning this repository locally and using e.g. `COPY` instead of `RUN git clone` in the Dockerfile to get the source code into the container.
94+
3. Use the `python3 infra/helper.py` tool to build and test fuzz targets locally.
95+
4. Analyse if build scripts can be optimized to improve local building efficiency.

0 commit comments

Comments
 (0)