Skip to content

Commit 3fd1267

Browse files
authored
GH#932: docs(agents): add non-existent file table, bash:other guidance, and strengthen read/webfetch rules (#933)
- Add table of commonly-attempted paths that do not exist in this repo (wp-config.php, WordPress core dirs, CHANGELOG.md, non-.dist configs, vendor/**, node_modules/**) to prevent read:file_not_found errors - Add 'NEVER construct or guess URLs' rule to No External URL Fetching section to directly address the top webfetch:other failure cause - Strengthen Read Before Edit to clarify 'current conversation session' means reads from prior conversations do not count; add multi-file note - Add new 'Common bash:other Failures' section covering: tool not installed, wp command missing, wrong working directory, PHP binary not found, and syntax errors in one-liners Fixes #932
1 parent b11673b commit 3fd1267

1 file changed

Lines changed: 49 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,30 @@ composer install && npm install
210210

211211
The `docs/` directory exists but is not described in the Project Structure section above — it contains developer documentation markdown files. The `todo/` directory contains task briefs.
212212

213+
The following paths are commonly attempted but **do not exist** in this repo — attempting to
214+
read them will produce `read:file_not_found`:
215+
216+
| Path attempted | Reality |
217+
|---|---|
218+
| `wp-config.php` | Lives at `../wordpress/wp-config.php` (outside this repo) |
219+
| `wp-load.php`, `wp-settings.php` | WordPress core lives in `../wordpress/` |
220+
| `wp-admin/**`, `wp-includes/**` | WordPress core — not in this repo |
221+
| `CHANGELOG.md` | Does not exist; see git log for change history |
222+
| `.phpcs.xml` | Gitignored override; use `.phpcs.xml.dist` |
223+
| `phpunit.xml` | Gitignored override; use `phpunit.xml.dist` |
224+
| `phpstan.neon` | Gitignored override; use `phpstan.neon.dist` |
225+
| `vendor/**` | Gitignored; run `composer install` first |
226+
| `node_modules/**` | Gitignored; run `npm install` first |
227+
228+
Always verify a file is tracked before reading it with `git ls-files '<path>'`. An empty result means the file does not exist in the repo.
229+
213230
### No External URL Fetching
214231

232+
**NEVER construct or guess a URL for webfetch.** Only fetch URLs explicitly present in user
233+
messages or tool output. Constructed URLs (e.g. building a GitHub raw URL from a file path,
234+
guessing a docs URL from a package name) account for the majority of `webfetch:other` failures
235+
in this codebase.
236+
215237
Do **not** use webfetch for WordPress documentation, PHP manual pages, Stripe/PayPal API docs,
216238
BerlinDB documentation, npm package docs, or any other developer documentation URLs — these
217239
requests consistently fail.
@@ -235,7 +257,9 @@ Use the codebase itself for API/hook research:
235257

236258
### Read Before Edit (Mandatory)
237259

238-
The Edit tool **requires** a prior Read call on the same file in the current session. If you attempt to edit without reading first, the tool will fail. Always read the complete target file before editing — even for small changes.
260+
The Edit tool **requires** a prior Read call on the same file in the **current conversation session**. A prior read from a previous conversation does not count — if the session restarts or the context is cleared, re-read every file before editing it. If you attempt to edit without reading first, the tool will fail. Always read the complete target file before editing — even for small changes.
261+
262+
When working on multiple files in the same session: read each file immediately before editing it, not at the start of the session. Reading file A, then file B, then editing file A will fail if A's content changed between your read and your edit.
239263

240264
### WP-CLI and Bash Prerequisites
241265

@@ -260,3 +284,27 @@ ls node_modules/.bin/eslint 2>/dev/null || npm install
260284
Coverage reports (`--coverage-*` flags) require the xdebug PHP extension (`php -d zend_extension=xdebug`). If xdebug is not installed, omit the coverage flags — tests still run without them.
261285

262286
For file discovery, use `git ls-files '<pattern>'` rather than `find` or glob patterns — only tracked files exist reliably, and gitignored paths (vendor, node_modules, *.xml without .dist) will cause `No such file` errors if accessed directly.
287+
288+
### Common bash:other Failures
289+
290+
Most `bash:other` errors in this codebase fall into one of these categories:
291+
292+
**Tool not installed** — run the prerequisite checks above before any lint, test, or analysis command.
293+
294+
**`wp` command not found or fails**`wp` requires WP-CLI in PATH and the dev WordPress install
295+
at `../wordpress`. If `../wordpress/wp-config.php` is absent, all WP-CLI commands fail. Check:
296+
297+
```bash
298+
command -v wp || echo "wp-cli not in PATH"
299+
ls ../wordpress/wp-config.php 2>/dev/null || echo "WordPress dev env missing"
300+
```
301+
302+
**Wrong working directory** — all build/lint/test commands must be run from the repo root
303+
(`ultimate-multisite/`). Commands like `vendor/bin/phpunit` resolve paths relative to CWD.
304+
305+
**PHP binary not found** — commands like `php -d zend_extension=xdebug` require PHP in PATH.
306+
If `php` is not available, omit the `php -d ...` prefix and call `vendor/bin/phpunit` directly.
307+
308+
**Syntax error in one-liner** — when constructing a PHP or bash one-liner, test with `bash -n`
309+
(syntax check) or `php -l` before running. A typo in a bash heredoc or PHP string will cause
310+
`bash:other`.

0 commit comments

Comments
 (0)