diff --git a/AGENTS.md b/AGENTS.md index 2e960e85c..c67bf4193 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -174,9 +174,9 @@ To change an entry, fix the source: Regenerate with `bun run gen:models` and commit `models.json` alongside the source change. Add a regression test against the **resolver/descriptor**, not the bundled JSON, so it survives upstream metadata shifts. -## Logging +## Logging and CLI Output -**NEVER use `console.log`/`error`/`warn`** in the coding-agent package — it corrupts TUI rendering. Use the centralized logger: +Code that may run while the TUI, RPC, SDK, workers, or background runtimes are active MUST NOT use `console.log`/`error`/`warn`; it corrupts rendering or protocols. Use the centralized logger: ```typescript import { logger } from "@oh-my-pi/pi-utils"; @@ -186,7 +186,7 @@ logger.warn("Theme file invalid, using fallback", { path }); logger.debug("LSP fallback triggered", { reason }); ``` -Logs go to `~/.omp/logs/omp.YYYY-MM-DD.log` with automatic rotation. +Logs go to `~/.omp/logs/omp.YYYY-MM-DD.log` with automatic rotation. Standalone CLI commands that exit without entering the TUI MAY use `console.*` or process streams for intentional user-facing output. Keep structured stdout clean. This exception is semantic, not filename-based; shared code must use `logger` or an explicit output sink. ## TUI Sanitization