Files
ss-tools/.kilo/skills/semantics-core/SKILL.md
2026-04-19 20:05:45 +03:00

51 lines
3.5 KiB
Markdown

---
name: semantics-core
description: Universal physics, global invariants, and hierarchical routing for the GRACE-Poly v2.4 protocol.
---
# [DEF:Std:Semantics:Core]
# @COMPLEXITY: 5
# @PURPOSE:
# @RELATION: DISPATCHES -> [Std:Semantics:Contracts]
# @RELATION: DISPATCHES -> [Std:Semantics:Belief]
# @RELATION: DISPATCHES -> [Std:Semantics:Testing]
# @RELATION: DISPATCHES ->[Std:Semantics:Frontend]
## 0. ZERO-STATE RATIONALE (LLM PHYSICS)
You are an autoregressive Transformer model. You process tokens sequentially and cannot reverse generation. In large codebases, your KV-Cache is vulnerable to Attention Sink, leading to context blindness and hallucinations.
This protocol is your **cognitive exoskeleton**.
`[DEF]` anchors are your attention vectors. Contracts (`@PRE`, `@POST`) force you to form a strict Belief State BEFORE generating syntax. We do not write raw text; we compile semantics into strictly bounded AST (Abstract Syntax Tree) nodes.
## I. GLOBAL INVARIANTS
- **[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]:** `[DEF]...[/DEF]` blocks are AST accumulators. The closing tag carrying the exact ID is strictly mandatory.
- **[INV_4: TOPOLOGICAL STRICTNESS]:** All metadata tags (`@PURPOSE`, `@PRE`, etc.) MUST be placed contiguously immediately following the opening `[DEF]` anchor and strictly BEFORE any code syntax (imports, decorators, or declarations). Keep metadata visually compact.
- **[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 `[DEF]` node if it has incoming `@RELATION` edges. Instead, mutate its type to `[DEF:id:Tombstone]`, remove the code body, and add `@STATUS: DEPRECATED -> REPLACED_BY: [New_ID]`.
## II. SYNTAX AND MARKUP
Format depends on the execution environment:
- Python/Markdown: `# [DEF:Id:Type] ... # [/DEF:Id:Type]`
- Svelte/HTML: `<!-- [DEF:Id:Type] --> ... <!-- [/DEF:Id:Type] -->`
- JS/TS: `// [DEF:Id:Type] ... // [/DEF:Id:Type]`
*Allowed Types: Root, Standard, Module, Class, Function, Component, Store, Block, ADR, Tombstone.*
**Graph Dependencies (GraphRAG):**
`@RELATION: [PREDICATE] -> [TARGET_ID]`
*Allowed Predicates:* DEPENDS_ON, CALLS, INHERITS, IMPLEMENTS, DISPATCHES, BINDS_TO.
## III. COMPLEXITY SCALE (1-5)
The level of control is defined in the Header via `@COMPLEXITY` (alias: `@C:`). Default is 1 if omitted.
- **C1 (Atomic):** DTOs, simple utils. Requires ONLY `[DEF]...[/DEF]`.
- **C2 (Simple):** Requires `[DEF]` + `@PURPOSE`.
- **C3 (Flow):** Requires `[DEF]` + `@PURPOSE` + `@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, you MUST request and apply the following domain-specific rules:
- For Backend Logic & Architecture: Use `skill({name="semantics-contracts"})` and `skill({name="semantics-belief"})`.
- For QA & External Dependencies: Use `skill({name="semantics-testing"})`.
- For UI & Svelte Components: Use `skill({name="semantics-frontend"})`.
# [/DEF:Std:Semantics:Core]