Skip to content

Commit c0fdae3

Browse files
committed
docs: RULE #1 — no automated fallbacks, fail fast/loud (CLAUDE.md + AGENTS.md)
Every op goes through ONE clear path; when it does not work as expected/errors/misbehaves, RAISE IMMEDIATELY with where+what and crash so the bug surfaces and we fix the root cause. Forbidden: silent/automated fallbacks (try/except->degraded path, except:pass, eager-replaces- fused, gated-off-by-default, clamp-instead-of-raise, return zeros/garbage, best-effort). Fail- closed by raising a clear error is correct; silent fallback producing degraded/wrong/zero output is forbidden. Also fixed AGENTS.md tensor rule (was permitting 'fall back to production path').
1 parent 6fbb007 commit c0fdae3

2 files changed

Lines changed: 37 additions & 2 deletions

File tree

AGENTS.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# AGENTS.md — cppmega.mlx agent contract
22

3+
## RULE #1 (HIGHEST PRIORITY) — NO AUTOMATED FALLBACKS. FAIL FAST, FAIL LOUD.
4+
5+
Every op goes through ONE clear path. When the clear path does not work as expected, errors,
6+
or misbehaves, **RAISE IMMEDIATELY** with WHERE + WHAT failed and crash — surface the bug, fix
7+
the root cause. FORBIDDEN: silent/automated fallbacks (try/except→degraded path, except:pass,
8+
eager-replaces-fused, MSL-instead-of-tvm-ffi, gated-off-by-default, clamp-instead-of-raise,
9+
return zeros/garbage, best-effort, silent precision/shape downgrade). Fail-closed by RAISING a
10+
clear error is correct; a silent fallback producing degraded/wrong/zero output is forbidden.
11+
See CLAUDE.md. This overrides every rule below.
12+
313
## Tensor memory rule
414

515
- Wrappers/adapters must not silently allocate or copy large tensors.
@@ -8,8 +18,8 @@
818
design as wrong and keep looking.
919
- Prefer passing references to existing GPU buffers, fusion, views/broadcasts,
1020
or IR-level lowering through the TileLang/TVM/tvm-ffi pipeline.
11-
- If zero-copy/fused lowering is not currently possible, fail explicitly or
12-
fall back to the existing production path without pretending Path C handled it.
21+
- If zero-copy/fused lowering is not currently possible, FAIL EXPLICITLY (raise with
22+
where + what). Do NOT silently fall back to another path (Rule #1).
1323
- Dtype/shape mismatches must be solved at the right level:
1424
- first look higher in the graph and make the producer create the tensor in
1525
the required dtype/shape from the start;

CLAUDE.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# CLAUDE.md — cppmega.mlx
2+
3+
## RULE #1 (HIGHEST PRIORITY — overrides everything else) — NO AUTOMATED FALLBACKS. FAIL FAST, FAIL LOUD.
4+
5+
Every operation goes through ONE clear path. **When the clear path does not work as expected,
6+
errors, or misbehaves, the code MUST RAISE IMMEDIATELY** with a precise message saying **WHERE
7+
and WHAT** failed, and crash — so the bug surfaces and we fix the ROOT CAUSE.
8+
9+
**FORBIDDEN** — automated/silent fallbacks that hide a failure:
10+
- `try/except` → degraded/alternate path; `except: pass`; "best-effort"; silent slow-path.
11+
- eager-replaces-fused, MSL-adapter-instead-of-tvm-ffi, gated-off-by-default, watchdog→fallback.
12+
- clamp-instead-of-raise; return zeros/garbage; silent shape/dtype/precision downgrade.
13+
- any code path that papers over a broken clear path instead of surfacing it.
14+
15+
**REQUIRED on failure:** `raise` with where + what → then we debug and fix the bug.
16+
Fail-closed by **raising with a clear error IS correct** ("падать с сообщением"). A SILENT
17+
fallback that produces a degraded/wrong/zero result is what is forbidden.
18+
19+
This is the first and main rule. Existing automated fallbacks must be found and removed; route
20+
everything through the single clear path that fails loud.
21+
22+
## Tensor memory rule (see AGENTS.md)
23+
- Wrappers/adapters must not silently allocate, cast, or copy large tensors to satisfy a
24+
boundary. If a design seems to require it, the design is wrong — keep looking (this is a
25+
corollary of Rule #1: no silent papering-over).

0 commit comments

Comments
 (0)