log refactor

This commit is contained in:
2026-05-12 19:30:15 +03:00
parent 1d59df2233
commit b17b5333c7
84 changed files with 5827 additions and 3908 deletions

View File

@@ -26,7 +26,7 @@ Contracts (`@PRE`, `@POST`) force you to form a strict Belief State BEFORE gener
- **[INV_1: SEMANTICS > SYNTAX]:** Naked code without a contract is classified as garbage. You must define the contract before writing the implementation.
- **[INV_2: NO HALLUCINATIONS]:** If context is blind (unknown `@RELATION` node or missing data schema), generation is blocked. Emit `[NEED_CONTEXT: target]`.
- **[INV_3: ANCHOR INVIOLABILITY]:** Contract blocks (`#region...`/`#endregion`, `[DEF]...[/DEF]`, `## @{...`/`## @}`) are AST accumulators. The closing tag carrying the exact ID is strictly mandatory. All three syntaxes are valid; choose the one matching your file's comment style.
- **[INV_3: ANCHOR INVIOLABILITY]:** Contract blocks (`#region...`/`#endregion`, `[DEF]...[/DEF]`, `## @{...`/`## @}`) are AST accumulators. The closing tag carrying the exact ID is strictly mandatory (i.e., the `#endregion` anchor). All three syntaxes are valid; choose the one matching your file's comment style.
- **[INV_4: TOPOLOGICAL STRICTNESS]:** All metadata tags (`@PURPOSE`, `@PRE`, etc.) MUST be placed contiguously immediately after the opening anchor — either inline on the same line (`#region Id [C:3] [TYPE Fn]`) or as body lines (each prefixed with the comment character). Keep metadata visually compact. Code syntax comes AFTER all metadata.
- **[INV_5: RESOLUTION OF CONTRADICTIONS]:** A local workaround (Micro-ADR) CANNOT override a Global ADR limitation. If reality requires breaking a Global ADR, stop and emit `<ESCALATION>` to the Architect.
- **[INV_6: TOMBSTONES FOR DELETION]:** Never delete a contract node if it has incoming `@RELATION` edges. Instead, change its type to `Tombstone`, remove the code body, and add `@STATUS DEPRECATED -> REPLACED_BY: [New_ID]`.
@@ -81,16 +81,16 @@ For region/brace formats, type is expressed as `[TYPE TypeName]`. For DEF format
The level of control is defined via `@COMPLEXITY` or inline `[C:N]`. Default is 1 if omitted.
- **C1 (Atomic):** DTOs, simple utils. Requires only the anchor pair. No `@PURPOSE`, no `@RELATION`.
- **C2 (Simple):** Requires anchor + `@PURPOSE`.
- **C3 (Flow):** Requires anchor + `@PURPOSE` + `@RELATION`.
- **C1 (Atomic):** DTOs, simple utils. Requires only the anchor pair. No `@BRIEF`, no `@RELATION`.
- **C2 (Simple):** Requires anchor + `@BRIEF`.
- **C3 (Flow):** Requires anchor + `@BRIEF` + `@RELATION`.
- **C4 (Orchestration):** Adds `@PRE`, `@POST`, `@SIDE_EFFECT`. Requires Belief State runtime logging.
- **C5 (Critical):** Adds `@DATA_CONTRACT`, `@INVARIANT`, and mandatory Decision Memory tracking.
## IV. DOMAIN SUB-PROTOCOLS (ROUTING)
Depending on your active task and target language, you MUST request the appropriate domain skills:
- For Backend Logic & Architecture: `skill({name="semantics-contracts"})` and `skill({name="semantics-belief"})`.
- For Backend Logic & Architecture: `skill({name="semantics-contracts"})` and `skill({name="molecular-cot-logging"})` (replaces legacy semantics-belief wire format).
- For Python backend implementation: `skill({name="semantics-python"})`.
- For Svelte frontend implementation: `skill({name="semantics-svelte"})`.
- For QA & Testing: `skill({name="semantics-testing"})`.
@@ -122,7 +122,7 @@ Do NOT add tags from higher levels. Apply these rules regardless of target langu
### C1 (Atomic) — DTOs, simple constants, trivial wrappers
- Requires ONLY the anchor pair.
- Forbidden: `@BRIEF`, `@PURPOSE`, `@RELATION`, `@PRE`, `@POST`, `@SIDE_EFFECT`, `@RATIONALE`, `@REJECTED`, `@DATA_CONTRACT`, `@INVARIANT`.
- Forbidden: `@BRIEF`, `@RELATION`, `@PRE`, `@POST`, `@SIDE_EFFECT`, `@RATIONALE`, `@REJECTED`, `@DATA_CONTRACT`, `@INVARIANT`.
### C2 (Simple) — Utility functions, pure computations
- Requires anchor + `@BRIEF`.
@@ -152,7 +152,7 @@ Do NOT add tags from higher levels. Apply these rules regardless of target langu
| C4 | +PRE, POST, SIDE_EFFECT | DATA_CONTRACT, INVARIANT, RATIONALE, REJECTED |
| C5 | +DATA_CONTRACT, INVARIANT, RATIONALE, REJECTED | |
**Key rule:** `@RATIONALE`/`@REJECTED` are C5-only. Adding them to C1-C4 violates INV_7.
**Key rule:** `@RATIONALE`/`@REJECTED` are C5-only. Adding them to C1-C4 violates Complexity Tier Rules (Section VII).
**Language-specific examples:** See `semantics-python` (Python/FastAPI), `semantics-svelte` (Svelte 5/Tailwind), or load the appropriate domain skill.
**Multi-syntax note:** Legacy `[DEF:id:Type]` is permanently recognized. Region and brace syntaxes are alternatives choose the one matching your file's comment style. New code uses `#region`/`#endregion` by default.