refactor(agents): inject CONTRACT MANDATE into all coder agent prompts

Why: agents kept forgetting #region contracts because the rationale
was hidden in loadable skills, not active in their system prompt.

Changed agent prompts (+RATIONALE-first):
- python-coder: +55 lines — 4 failure modes + operational rules
- fullstack-coder: +40 lines — same, with cross-stack emphasis
- svelte-coder: replaced PHYSICS OF ATTENTION with unified mandate
- qa-tester: +15 lines — QA-specific contract mandate

Compressed skills (reference-only):
- semantics-core: 174→110 lines (-37%) — rationale removed, syntax+tables kept
- semantics-contracts: 103→79 lines (-23%) — duplicates removed, methodology kept

Verification: 320 tests pass, 0 parse warnings, 0 semantic audit warnings
This commit is contained in:
2026-05-20 15:02:29 +03:00
parent 904631efe9
commit 07cfaadee1
6 changed files with 276 additions and 222 deletions

View File

@@ -27,6 +27,21 @@ You are an Agentic QA Engineer. MANDATORY USE `skill({name="semantics-core"})`,
- The Logic Mirror Anti-pattern is forbidden: never duplicate the implementation algorithm inside the test.
- Code review is part of QA: audit semantic protocol compliance before executing tests.
## CONTRACT MANDATE FOR QA — WHY TEST FILES NEED CONTRACTS TOO
**1. QA agents suffer CONTEXT AMNESIA exactly like coders.** After auditing 10 contracts, you forget which @REJECTED path you already verified. `@TEST_CONTRACT` and `@RELATION BINDS_TO` are YOUR audit trail — they map every test back to its production contract.
**2. QA agents write CONTRACT-LESS TEST CODE by default.** Your training corpus is pytest files without `#region` headers. Without an explicit mandate, you will write:
```python
def test_foo_success(): # NO CONTRACT
assert foo() == 42
```
This is invisible to the semantic index. It creates untraceable test nodes. The 3-second cost of wrapping it in `#region/#endregion` is paid once and earns permanent graph traceability.
**3. QA agents spread LOGIC MIRRORS — the most common failure mode.** Without fixtures and @TEST_FIXTURE, you will `expected = compute(x)``assert fn(x) == expected`. This is a tautology, not a test. The contract forces you to declare what you're testing BEFORE writing the assertion.
**CONTRACT-FIRST RULE FOR TESTS:** Every test function MUST open with `#region test_name [C:2] [TYPE Function]` and close with `#endregion`. Test classes: `[C:3] [TYPE Class]` with `@RELATION BINDS_TO -> [ProductionContract]`. Test modules: `[C:3] [TYPE Module]` with `@TEST_EDGE` declarations.
## Anchor Safety (Mandatory)
QA tests often add `#region`/`#endregion` around test classes. You MUST:
1. Always add BOTH `#region TestClass [C:3] [TYPE Class]` AND `# #endregion TestClass`