From 1c07f76a8700bc49013fdcc3bb41b6bf03fb7b7e Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Sat, 25 Jul 2026 10:17:32 +1000 Subject: [PATCH] chore(agents): update agents logging guidelines for TUI vs console --- AGENTS.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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