Skip to content

Commit 0d49bfb

Browse files
Update the agent skill files for work around docker, tests, and tool development []
1 parent b971e94 commit 0d49bfb

5 files changed

Lines changed: 142 additions & 3 deletions

File tree

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
name: edg-agent-temp-files
3+
description: >-
4+
Where agents put temporary files and directories (scratchpad, the project's
5+
.tmp/agent-* directory, or the container's /tmp), how to share them with the
6+
docker container via edg-exec, and how to run edgy ad hoc with --runs-dir
7+
(and a scratch EDG_TEST_HOME) instead of edg-docker-test. Use when creating
8+
scratch inputs or outputs, running throwaway tests or recordings, or cleaning
9+
up temporary state.
10+
---
11+
12+
# Temporary state and the docker boundary
13+
14+
Tools run either on the host or in the docker container (`edg-exec`). The
15+
container sees **only the project root**, mounted at `/edg/workspace`; the host
16+
`/tmp` and your scratchpad are not visible to it. Project root = directory
17+
containing `src/cfe.c` and `dev_tools/`.
18+
19+
## Where to put temporary state
20+
21+
| Need | Put it in | Notes |
22+
| --- | --- | --- |
23+
| Host-only (scripts, outputs of host tools) | your scratchpad directory | no permission prompts |
24+
| Shared with the container | `<root>/.tmp/agent-<purpose>` | seen as `/edg/workspace/.tmp/agent-<purpose>`; `.tmp/` is gitignored |
25+
| Only needed inside the container | the container's `/tmp` | ephemeral, nothing is left on the host |
26+
27+
- Everything you create in `.tmp/` **must** be named `agent-<purpose>` (the
28+
rest of `.tmp/` is the user's host-to-docker bridge; see `.tmp/README.md`).
29+
- Do not use `build/`, `tests/runs/`, or the host `/tmp` for scratch state.
30+
- Files created in the container are owned by the host user, so they are
31+
directly usable from the host.
32+
33+
## edg-exec rules
34+
35+
- Run `edg-exec` from the project root (the current directory is mounted as
36+
`/edg/workspace`).
37+
- `edg-exec` joins its arguments with spaces and **does not preserve
38+
quoting**: `edg-exec -- sh -c '. env.sh; cmd'` runs `sh -c .` and drops the
39+
rest. Pass a compound command as ONE quoted string:
40+
41+
```bash
42+
edg-exec -- "mkdir -p .tmp/agent-foo && echo hi > .tmp/agent-foo/x"
43+
edg-exec --dry-run -- "..." # shows exactly what the container will run
44+
```
45+
46+
- `edgy` and the other `dev_tools/bin` tools are on the container `PATH`.
47+
48+
## Running edgy outside the standard workflow
49+
50+
`edg-docker-test` is for the standard front-end change workflow, where the
51+
user wants results kept in `tests/runs/` (see **edg-cpfe-build-test**). For
52+
anything else (experiments, verification of tooling, comparisons), run `edgy`
53+
with `--runs-dir` so nothing lands in `tests/runs/`:
54+
55+
```bash
56+
# In docker: results appear on the host under .tmp/agent-foo/runs/<timestamp>/
57+
edg-exec -- ". build/gcc/environment.sh && edgy --runs-dir=/edg/workspace/.tmp/agent-foo/runs regressions/foo.sft.cpp"
58+
```
59+
60+
- `. build/<dir>/environment.sh` provides `CPFE`/`CPFE_CP`, which `edgy` uses
61+
to find the front end (use the build directory you are testing). The default
62+
configs need both `cpfe` and `cpfe-cp` built; `-c edg_x86_64` runs the C
63+
config alone.
64+
- Use an **absolute** container path for `--runs-dir`. `edgy` copies the front
65+
end under the runs directory and a relative path breaks tools that change
66+
directory (e.g. `cpfe-cp-gen-be` fails with "No such file or directory").
67+
- Host-side tools that take `--runs-dir` (e.g. `edg-rematerialize-test-run`)
68+
have no docker constraint: point them at the scratchpad.
69+
- If `edg-docker-test` is still used for a throwaway run, pass
70+
`--discard-test-results` (results stay in the container's `/tmp`).
71+
72+
## Scratch test home (for `-W` and other mutating experiments)
73+
74+
`edg-docker-test` does not forward a host `EDG_TEST_HOME`, but setting it
75+
**inside** the container command works. Build a small test home and point at
76+
it; never run `-W` against the real tree:
77+
78+
```bash
79+
H=.tmp/agent-foo/home
80+
mkdir -p $H/tests
81+
cp -r tests/.edgy $H/.edgy
82+
cp -r tests/expectations $H/expectations
83+
cp -r tests/tests/<suite> $H/tests/<suite> # only the suites you need
84+
CMD='. build/gcc/environment.sh && EDG_TEST_HOME=/edg/workspace/.tmp/agent-foo/home edgy --runs-dir=/edg/workspace/.tmp/agent-foo/runs <suite>/<test>'
85+
edg-exec -- "$CMD" # read-only first: logs must land under .tmp/agent-foo
86+
edg-exec -- "${CMD/edgy /edgy -W }" # then record (expectations and .rto files in the scratch home only)
87+
```
88+
89+
Check `git status --short tests` and that `tests/runs/` did not gain an entry.
90+
91+
## Cleanup
92+
93+
- Remove the `.tmp/agent-*` paths **you created** in a batch step as the LAST
94+
step before reporting results to the user (not after each sub-task), in ONE
95+
command that lists them (one approval instead of many):
96+
97+
```bash
98+
rm -rf .tmp/agent-foo .tmp/agent-bar
99+
```
100+
101+
- Never glob other entries, never remove non-`agent-` names in `.tmp/`, and
102+
do not delete `tests/runs/` content (it is gitignored and may be the user's).
103+
- Say in the final summary what you created and removed.

‎.agents/skills/edg-changes-example/SKILL.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ To rebuild the real example bytes (for local reproduction, not for commit):
6464
```bash
6565
edg-changes-example decode utf8-fragment.txt > raw-fragment.txt
6666
edg-changes-example decode -o raw-fragment.txt utf8-fragment.txt
67-
# Whole file:
68-
edg-changes-example decode src/Changes > /tmp/Changes.raw
67+
# Whole file (write host-only output to your scratchpad, see
68+
# edg-agent-temp-files):
69+
edg-changes-example decode src/Changes > <scratchpad>/Changes.raw
6970
```
7071

7172
Decode replaces each `«HHHH…»` (or legacy `«HH»«HH»`) with the corresponding

‎.agents/skills/edg-cpfe-build-test/SKILL.md‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@ edg-docker-test --dry-run rma
4747
- Postures: `day`, `night`, `quick-c-fe`, `extensive`, or `--posture=@file.json`.
4848
- Results: `tests/runs/<timestamp>/<config>/` (e.g. `changes.elog`,
4949
`executed.elist`). Empty / no unexpected diffs means a clean match.
50-
- Optional override: `EDG_TEST_HOME` (must contain `.edgy/config.json`).
50+
- `edg-docker-test` is for the standard front-end change workflow, where the
51+
user wants these results kept. For ad-hoc runs and experiments, use
52+
`edgy --runs-dir` instead (skill **edg-agent-temp-files**); if you still use
53+
`edg-docker-test` for a throwaway run, pass `--discard-test-results`.
54+
- `EDG_TEST_HOME` (must contain `.edgy/config.json`) overrides the test home
55+
but a host value is **not** forwarded into the container by
56+
`edg-docker-test`; set it inside an `edg-exec` command string (see
57+
**edg-agent-temp-files**).
5158

5259
First-test walkthrough: [dev_annex/tutorials/FIRST_TEST.md](../../../dev_annex/tutorials/FIRST_TEST.md).
5360

@@ -65,6 +72,12 @@ First-test walkthrough: [dev_annex/tutorials/FIRST_TEST.md](../../../dev_annex/t
6572
that are gitignored. See edgy helpers in `dev_tools/pylibs/edgtest`.
6673
4. Re-run without `-W` to confirm a clean match before asking to commit.
6774

75+
Expectations inherit like recordings: a non-default config's
76+
`tests/expectations/<config>/<suite>.log` holds only differences from the
77+
default config's (an explicit `...:PASS:` line overrides an inherited
78+
failure). Record the default config first (`edgy -W` does this when both run).
79+
See "Expectation Inheritance" in `doc/source/testing.rst`.
80+
6881
## Finding a regressing or fixing commit
6982

7083
Use skill **edg-cpfe-bisect** (`edg-docker-test-bisect` /

‎.tmp/README.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,20 @@ This allows for the host to pass non-trivial empherial information to Docker
99
for further processing (that if packaged entirely as command line arguments
1010
would exceed the maximum command line argument limit -- primarily a problem
1111
on Windows).
12+
13+
## Notes for Agents
14+
15+
This section is an instruction for AI coding agents that come across this
16+
file; it is not required reading for human users.
17+
18+
Agents may use this directory for temporary files and directories that must be
19+
visible both on the host and inside the docker container (the project root is
20+
mounted at `/edg/workspace`, so `.tmp/agent-foo` on the host is
21+
`/edg/workspace/.tmp/agent-foo` in the container). Everything an agent creates
22+
here must be named `agent-<purpose>` so it can be told apart from (and cleaned
23+
up separately from) anything else in this directory. Agents remove these
24+
temporary files and directories in a batch step as the last step before
25+
reporting results to the user.
26+
27+
See the `edg-agent-temp-files` skill (`.agents/skills/edg-agent-temp-files/`)
28+
for the full rules.

‎AGENTS.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ Agent-friendly defaults:
5959
- `edg-docker-test-bisect` — automatic regression/fix bisect (skill
6060
**edg-cpfe-bisect**;
6161
[TEST_BISECT.md](dev_annex/tutorials/TEST_BISECT.md)).
62+
- Temporary files and directories: scratchpad for host-only state,
63+
`.tmp/agent-<purpose>` for anything the docker container must see, and
64+
`edgy --runs-dir` (not `edg-docker-test`) for ad-hoc runs. See skill
65+
**edg-agent-temp-files**.
6266

6367
## Source overview (`src/`)
6468

@@ -126,6 +130,7 @@ If an agent does not auto-load skills, open the matching
126130
| Skill | Path | Load when |
127131
| --- | --- | --- |
128132
| `edg-cpfe-build-test` | [`.agents/skills/edg-cpfe-build-test/SKILL.md`](.agents/skills/edg-cpfe-build-test/SKILL.md) | Building, `edg-docker-test`, recording |
133+
| `edg-agent-temp-files` | [`.agents/skills/edg-agent-temp-files/SKILL.md`](.agents/skills/edg-agent-temp-files/SKILL.md) | Temporary files/dirs, `.tmp/agent-*`, `edg-exec` quoting, ad-hoc `edgy --runs-dir`, scratch test homes |
129134
| `edg-cmakedef-build-config` | [`.agents/skills/edg-cmakedef-build-config/SKILL.md`](.agents/skills/edg-cmakedef-build-config/SKILL.md) | Macro/build configurations, `.cmakedef` files, `edg-cmakedef`, presets |
130135
| `edg-cpfe-bisect` | [`.agents/skills/edg-cpfe-bisect/SKILL.md`](.agents/skills/edg-cpfe-bisect/SKILL.md) | Good/bad commit bisect for a test regression or fix |
131136
| `edg-cpfe-frontend` | [`.agents/skills/edg-cpfe-frontend/SKILL.md`](.agents/skills/edg-cpfe-frontend/SKILL.md) | Editing `src/`, IL/templates/overload, `Changes` |

0 commit comments

Comments
 (0)