diff --git a/docs/AGENTS.md b/docs/AGENTS.md index d5147e4e3..8d74d8ace 100644 --- a/docs/AGENTS.md +++ b/docs/AGENTS.md @@ -1,5 +1,7 @@ # AGENT INSTRUCTIONS +**Edits to this file must be minimal and token-efficient.** Think carefully about how to represent information concisely. Avoid redundant examples or verbose explanations when the knowledge can be conveyed in a sentence or two. + ## Project Context - Project is named `mux` @@ -365,6 +367,27 @@ If IPC is hard to test, fix the test infrastructure or IPC layer, don't work aro **For per-operation state tied to async workflows, parent components should own all localStorage operations.** Child components should notify parents of user intent without manipulating storage directly, preventing bugs from stale or orphaned state across component lifecycles. +**Always use persistedState helpers (`usePersistedState`, `readPersistedState`, `updatePersistedState`) instead of direct `localStorage` calls** - provides cross-component sync and consistent error handling. + +**Avoid destructuring props in function signatures** - Use `props.fieldName` instead of destructuring in the parameter list. Destructuring duplicates field names and makes refactoring more cumbersome. + +```typescript +// ❌ BAD - Duplicates field names, harder to refactor +export function MyComponent({ + field1, + field2, + field3, + onAction, +}: MyComponentProps) { + return
Creating workspace...
++ Describe what you want to build. A new workspace will be created with an automatically + generated branch name. Configure runtime and model options below. +
+/model opus - Claude Opus 4.1
- /model sonnet - Claude Sonnet 4.5
- /model provider:model-name
- /model anthropic:claude-sonnet-4-5)
- /model opus - Claude Opus 4.1
+ /model sonnet - Claude Sonnet 4.5
+ /model provider:model-name
+ /model anthropic:claude-sonnet-4-5)
+ Creating workspace...
-- Describe what you want to build. A new workspace will be created with an automatically - generated branch name. Configure runtime and model options below. -
-