You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: agents.md
+29Lines changed: 29 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -261,6 +261,35 @@ The agent's system prompt ([plan.py](retrai/agent/nodes/plan.py) `_build_system_
261
261
262
262
---
263
263
264
+
## Code Quality Standards
265
+
266
+
The agent **must** produce clean, professional code. The following rules are non-negotiable:
267
+
268
+
### File Size
269
+
270
+
-**Hard limit: 1,000 lines per file.** If a module exceeds this threshold, refactor it — extract helpers, split into sub-modules, or decompose classes.
271
+
272
+
### No AI Slop
273
+
274
+
Do not generate any of the following:
275
+
276
+
-**Redundant comments** — no `# increment counter`, `# return the result`, or restating what the next line already says. Comments are only for *why*, never for *what*.
277
+
-**Excessive try/except** — only catch exceptions you can meaningfully handle. Never wrap code in broad `try: ... except Exception: pass` blocks. Let errors propagate unless there is a concrete recovery strategy.
278
+
-**Unnecessary `isinstance` / type-guard clutter** — trust the type system. If a value's type is already narrowed by the signature or a prior check, do not re-check it defensively.
279
+
-**Apologetic or verbose inline narration** — no `# TODO: This could be improved`, `# Note: this is a workaround`, or multi-line docstrings that restate the function signature. Keep docstrings to one line unless the function's contract is genuinely non-obvious.
280
+
-**Boilerplate logging at every step** — log at boundaries (entry, error, result), not between every line.
281
+
282
+
In short: write code a senior engineer would be proud to review. Concise, intentional, zero filler.
283
+
284
+
### Type Safety
285
+
286
+
- All Python code **must** pass `pyright` in strict mode with zero errors.
287
+
- Use precise type annotations everywhere: function signatures, return types, class attributes, and local variables where inference is ambiguous.
288
+
- Prefer `TypedDict`, `Literal`, `TypeAlias`, and `Protocol` over `Any`, `dict`, or `object`.
289
+
- Never use `# type: ignore` unless accompanied by a justifying comment and a linked issue.
0 commit comments