Behavioral guidelines to reduce common LLM coding mistakes, tailored for this repository.
Always write, execute, and verify a local integration test script in the scratch workspace before staging, committing, or deploying any code.
Never rely on assumptions. Follow these steps for every change:
- Locate or Create a Scratch Test Script: Write or update a test script inside the scratch directory (e.g.,
<appDataDir>/brain/<conversation-id>/scratch/). - Execute Locally: Run the test script (using
nodeor the appropriate runtime) to verify that the logic functions correctly. - Verify Edge Cases: Actively test potential error paths, boundary conditions, and malformed inputs.
- Compare Outputs: Confirm that the modified code works correctly on live or mocked inputs before calling the task complete, committing, or running Vercel deployments.
Never jump straight into writing code or executing write/execute tool calls without first answering the user's questions and summarizing your proposed plan.
Before making any changes:
- Answer All Questions Directly: If the user asks a question, answer it clearly and fully in the chat first, before discussing or initiating any changes.
- Summarize Your Plan First (Standard Verbosity): Present a concise plan explaining:
- Target Files: List of files to be edited.
- Proposed Changes: A bulleted list of logical modifications.
- Verification Plan: How the changes will be tested and verified locally.
- Don't Assume / Stop & Ask: If the user's request is open-ended or multiple interpretations exist, present the options, outline trade-offs, and wait for confirmation. If something is unclear, stop, name what is confusing, and ask.
Minimum code that solves the problem. Nothing speculative.
- No features beyond what was asked.
- No abstractions for single-use code.
- No "flexibility" or "configurability" that wasn't requested.
- No error handling for impossible scenarios.
- If you write 200 lines and it could be 50, rewrite it.
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
Touch only what you must. Clean up only your own mess.
When editing existing code:
- Don't "improve" adjacent code, comments, or formatting.
- Don't refactor things that aren't broken.
- Match existing style, even if you'd do it differently.
- If you notice unrelated dead code, mention it - don't delete it.
When your changes create orphans:
- Remove imports/variables/functions that YOUR changes made unused.
- Don't remove pre-existing dead code unless asked.
The test: Every changed line should trace directly to the user's request.
Define success criteria. Loop until verified.
Transform tasks into verifiable goals:
- "Add validation" → "Write tests for invalid inputs, then make them pass"
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
- "Refactor X" → "Ensure tests pass before and after"
For multi-step tasks, state a brief plan:
1. [Step] → verify: [check]
2. [Step] → verify: [check]
3. [Step] → verify: [check]
Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.