semantics
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
# @COMPLEXITY: 5
|
||||
# @SEMANTICS: persona, tone_of_voice, interaction_rules, architect
|
||||
# @PURPOSE: Defines how the AI Agent MUST interact with the user and the codebase.
|
||||
# @RELATION: DEPENDS_ON -> [Std:Semantics:Standard]
|
||||
# @LAST_UPDATE: 2026-03-26
|
||||
|
||||
@ROLE: Chief Semantic Architect & AI-Engineering Lead.
|
||||
@PHILOSOPHY: "Смысл первичен. Код вторичен. ИИ — это семантический процессор, а не собеседник."
|
||||
@@ -39,4 +41,4 @@
|
||||
|
||||
**Я ожидаю от тебя уровня Senior Staff Engineer, который понимает устройство LLM, KV Cache и графов знаний.**
|
||||
|
||||
# [/DEF:Std:UserPersona:Standard]
|
||||
# [/DEF:Std:UserPersona:Standard]
|
||||
|
||||
44
.ai/PROJECT_MAP.md
Normal file
44
.ai/PROJECT_MAP.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# [DEF:Project_Map:Root]
|
||||
# @COMPLEXITY: 3
|
||||
# @PURPOSE: Canonical ownership record for repository structure navigation and generated project-map artifacts.
|
||||
# @RELATION: DEPENDS_ON -> [Project_Knowledge_Map:Root]
|
||||
# @RELATION: DEPENDS_ON -> [Std:Constitution:Standard]
|
||||
# @RELATION: DEPENDS_ON -> [Std:UserPersona:Standard]
|
||||
# @RELATION: BINDS_TO -> [MCP_Config:Block]
|
||||
# @LAST_UPDATE: 2026-03-26
|
||||
|
||||
## Canonical ownership
|
||||
- Canonical owner for `Project_Map` is this file: `.ai/PROJECT_MAP.md`.
|
||||
- Generated structural snapshot lives at `.ai/structure/PROJECT_MAP.md` and is a backing artifact, not the canonical ownership document.
|
||||
- References that previously pointed directly to `.ai/structure/PROJECT_MAP.md` for `Project_Map` should normalize to this file.
|
||||
|
||||
## Canonical relations
|
||||
- Root knowledge entry: `.ai/ROOT.md` -> `[DEF:Project_Knowledge_Map:Root]`
|
||||
- Normalized project MCP configuration: `.kilo/mcp.json` -> `[DEF:MCP_Config:Block]`
|
||||
- Repository constitution: `.ai/standards/constitution.md` -> `[DEF:Std:Constitution:Standard]`
|
||||
- Repository persona: `.ai/PERSONA.md` -> `[DEF:Std:UserPersona:Standard]`
|
||||
|
||||
## Generated snapshot handoff
|
||||
- Use `.ai/structure/PROJECT_MAP.md` for the expanded generated module/file inventory.
|
||||
- Regeneration may replace snapshot contents without changing canonical ownership of `Project_Map`.
|
||||
|
||||
# [DEF:MCP_Config:Block]
|
||||
# @COMPLEXITY: 3
|
||||
# @PURPOSE: Canonical ownership record for normalized project MCP configuration consumed by semantic workflows.
|
||||
# @RELATION: DEPENDS_ON -> [Project_Map:Root]
|
||||
# @RELATION: DEPENDS_ON -> [Std:Constitution:Standard]
|
||||
# @RELATION: DEPENDS_ON -> [Std:UserPersona:Standard]
|
||||
# @LAST_UPDATE: 2026-03-26
|
||||
|
||||
## Normalized config path
|
||||
- Canonical project MCP config path is `.kilo/mcp.json`.
|
||||
- For this repository, new docs and workflows must reference `.kilo/mcp.json` as the normalized MCP config.
|
||||
- Do not introduce new canonical references to deprecated project MCP doc paths for ownership or workflow wiring.
|
||||
|
||||
## Current semantic workflow binding
|
||||
- AXIOM semantic workflows in `.kilocode/workflows/` bind to tools exposed through `.kilo/mcp.json`.
|
||||
- The `axiom-core` server definition in `.kilo/mcp.json` is the normalized semantic-audit integration point for this repository.
|
||||
|
||||
# [/DEF:MCP_Config:Block]
|
||||
|
||||
# [/DEF:Project_Map:Root]
|
||||
23
.ai/ROOT.md
23
.ai/ROOT.md
@@ -1,14 +1,19 @@
|
||||
# [DEF:Project_Knowledge_Map:Root]
|
||||
# @COMPLEXITY: 5
|
||||
# @PURPOSE: Global navigation map for AI-Agent (GRACE Knowledge Graph).
|
||||
# @LAST_UPDATE: 2026-02-20
|
||||
# @PURPOSE: Canonical GRACE navigation map for repository standards and semantic context.
|
||||
# @RELATION: DEPENDS_ON -> [Std:Semantics:Standard]
|
||||
# @RELATION: DEPENDS_ON -> [Std:Constitution:Standard]
|
||||
# @RELATION: DEPENDS_ON -> [Std:UserPersona:Standard]
|
||||
# @RELATION: DEPENDS_ON -> [Project_Map:Root]
|
||||
# @RELATION: DEPENDS_ON -> [MCP_Config:Block]
|
||||
# @LAST_UPDATE: 2026-03-26
|
||||
|
||||
## 1. SYSTEM STANDARDS (Rules of the Game)
|
||||
Strict policies and formatting rules.
|
||||
* **User Persona (Interaction Protocol):** The Architect's expectations, tone of voice, and strict interaction boundaries.
|
||||
* Ref: `.ai/standards/persona.md` -> `[DEF:Std:UserPersona]`
|
||||
* Ref: `.ai/PERSONA.md` -> `[DEF:Std:UserPersona:Standard]`
|
||||
* **Constitution:** High-level architectural and business invariants.
|
||||
* Ref: `.ai/standards/constitution.md` -> `[DEF:Std:Constitution]`
|
||||
* Ref: `.ai/standards/constitution.md` -> `[DEF:Std:Constitution:Standard]`
|
||||
* **Architecture:** Service boundaries and tech stack decisions.
|
||||
* Ref: `.ai/standards/architecture.md` -> `[DEF:Std:Architecture]`
|
||||
* **Plugin Design:** Rules for building and integrating Plugins.
|
||||
@@ -18,7 +23,7 @@ Strict policies and formatting rules.
|
||||
* **UI Design:** SvelteKit and Tailwind CSS component standards.
|
||||
* Ref: `.ai/standards/ui_design.md` -> `[DEF:Std:UI_Svelte]`
|
||||
* **Semantic Mapping:** Using `[DEF:]` and belief scopes.
|
||||
* Ref: `.ai/standards/semantics.md` -> `[DEF:Std:Semantics]`
|
||||
* Ref: `.ai/standards/semantics.md` -> `[DEF:Std:Semantics:Standard]`
|
||||
|
||||
## 2. FEW-SHOT EXAMPLES (Patterns)
|
||||
Use these for code generation (Style Transfer).
|
||||
@@ -32,8 +37,10 @@ Use these for code generation (Style Transfer).
|
||||
* Ref: `.ai/shots/critical_module.py` -> `[DEF:Shot:Critical_Module]`
|
||||
|
||||
## 3. DOMAIN MAP (Modules)
|
||||
* **High-level Module Map:** `.ai/structure/MODULE_MAP.md` -> `[DEF:Module_Map]`
|
||||
* **Low-level Project Map:** `.ai/structure/PROJECT_MAP.md` -> `[DEF:Project_Map]`
|
||||
* **High-level Module Map:** `.ai/MODULE_MAP.md` -> `[DEF:Module_Map]`
|
||||
* **Canonical Project Map Ownership:** `.ai/PROJECT_MAP.md` -> `[DEF:Project_Map:Root]`
|
||||
* **Generated Project Map Snapshot:** `.ai/structure/PROJECT_MAP.md` (backing generated artifact)
|
||||
* **Normalized MCP Configuration:** `.kilo/mcp.json` -> `[DEF:MCP_Config:Block]`
|
||||
* **Apache Superset OpenAPI Source:** `.ai/openapi/superset_openapi.json` -> `[DEF:Doc:Superset_OpenAPI]`
|
||||
* **Apache Superset OpenAPI Split Index:** `.ai/openapi/superset/README.md` -> `[DEF:Doc:Superset_OpenAPI]`
|
||||
* **Superset OpenAPI Sections:**
|
||||
@@ -47,4 +54,4 @@ Use these for code generation (Style Transfer).
|
||||
* **Frontend Lib:** `frontend/src/lib` -> `[DEF:Module:Frontend_Lib]`
|
||||
* **Specifications:** `specs/` -> `[DEF:Module:Specs]`
|
||||
|
||||
# [/DEF:Project_Knowledge_Map]
|
||||
# [/DEF:Project_Knowledge_Map:Root]
|
||||
|
||||
@@ -44,4 +44,4 @@ async def function_name(...):
|
||||
* Use `try-except` blocks within `belief_scope` to ensure proper error logging and classification.
|
||||
* Do not leak internal implementation details in error responses.
|
||||
|
||||
# [/DEF:Std:API_FastAPI]
|
||||
# [/DEF:Std:API_FastAPI:Standard]
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
* **Superset API:** Communication via REST API.
|
||||
* **Filesystem:** Local storage for backups and git repositories.
|
||||
|
||||
# [/DEF:Std:Architecture]
|
||||
# [/DEF:Std:Architecture:Standard]
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
# [DEF:Std:Constitution:Standard]
|
||||
# @COMPLEXITY: 5
|
||||
# @PURPOSE: Supreme Law of the Repository. High-level architectural and business invariants.
|
||||
# @RELATION: DEPENDS_ON -> [Std:Semantics:Standard]
|
||||
# @VERSION: 2.3.0
|
||||
# @LAST_UPDATE: 2026-02-19
|
||||
# @LAST_UPDATE: 2026-03-26
|
||||
# @INVARIANT: Any deviation from this Constitution constitutes a build failure.
|
||||
|
||||
## 1. CORE PRINCIPLES
|
||||
|
||||
### I. Semantic Protocol Compliance
|
||||
* **Ref:** `[DEF:Std:Semantics]` (`ai/standards/semantic.md`)
|
||||
* **Ref:** `[DEF:Std:Semantics:Standard]` (`.ai/standards/semantics.md`)
|
||||
* **Law:** All code must adhere to the Axioms (Meaning First, Contract First, etc.).
|
||||
* **Compliance:** Strict matching of Anchors (`[DEF]`), Tags (`@KEY`), and structures is mandatory.
|
||||
|
||||
@@ -32,4 +33,4 @@
|
||||
* **Non-Blocking:** API endpoints return Task ID immediately.
|
||||
* **Observability:** Real-time updates via WebSocket.
|
||||
|
||||
# [/DEF:Std:Constitution]
|
||||
# [/DEF:Std:Constitution:Standard]
|
||||
|
||||
@@ -29,4 +29,4 @@ Plugins MUST use `TaskContext` for logging to ensure proper source attribution:
|
||||
2. **Schema Validation:** Ensure the `get_schema()` precisely matches the `execute()` input expectations.
|
||||
3. **Isolation:** Plugins should be self-contained and not depend on other plugins directly. Use core services (`ConfigManager`, `TaskManager`) via dependency injection or the provided `context`.
|
||||
|
||||
# [/DEF:Std:Plugin]
|
||||
# [/DEF:Std:Plugin:Standard]
|
||||
|
||||
@@ -1,25 +1,65 @@
|
||||
# SYSTEM DIRECTIVE: GRACE-Poly (UX Edition) v2.2
|
||||
> OPERATION MODE: WENYUAN (Maximum Semantic Density, Strict Determinism, Zero Fluff).
|
||||
> ROLE: AI Software Architect & Implementation Engine (Python/Svelte).
|
||||
# [DEF:Std:Semantics:Standard]
|
||||
# @COMPLEXITY: 5
|
||||
# @PURPOSE: Canonical GRACE protocol for semantic anchors, metadata, relations, and compliance levels.
|
||||
# @RELATION: DEPENDS_ON -> [Project_Knowledge_Map:Root]
|
||||
# @RELATION: DEPENDS_ON -> [Std:Constitution:Standard]
|
||||
# @RELATION: DEPENDS_ON -> [MCP_Config:Block]
|
||||
# @INVARIANT: Canonical semantic documents must use matching [DEF] and [/DEF] anchors with valid repository paths.
|
||||
# @LAST_UPDATE: 2026-03-26
|
||||
|
||||
## 0.[ZERO-STATE RATIONALE: ФИЗИКА LLM (ПОЧЕМУ ЭТОТ ПРОТОКОЛ НЕОБХОДИМ)]
|
||||
## 0. CANONICAL KNOWLEDGE SOURCES
|
||||
- Root map: `.ai/ROOT.md` -> `[DEF:Project_Knowledge_Map:Root]`
|
||||
- Persona: `.ai/PERSONA.md` -> `[DEF:Std:UserPersona:Standard]`
|
||||
- Constitution: `.ai/standards/constitution.md` -> `[DEF:Std:Constitution:Standard]`
|
||||
- Semantics standard: `.ai/standards/semantics.md` -> `[DEF:Std:Semantics:Standard]`
|
||||
- Module map: `.ai/MODULE_MAP.md` -> `[DEF:Module_Map]`
|
||||
- Project map: `.ai/PROJECT_MAP.md` -> `[DEF:Project_Map:Root]`
|
||||
- Project map snapshot: `.ai/structure/PROJECT_MAP.md` (generated backing artifact)
|
||||
- Normalized MCP config: `.kilo/mcp.json` -> `[DEF:MCP_Config:Block]`
|
||||
|
||||
## 0.1 MCP NORMALIZATION RULE
|
||||
- Canonical project MCP ownership and workflow wiring point to `.kilo/mcp.json`.
|
||||
- Do not introduce new canonical references to deprecated project-level MCP locations when documenting semantic workflows for this repository.
|
||||
|
||||
## 0.2 CANONICAL CONTRACT BLOCK
|
||||
A canonical GRACE block MUST declare one matched contract envelope:
|
||||
|
||||
```text
|
||||
[DEF:<ShortId>:<Type>]
|
||||
@COMPLEXITY: <1-5>
|
||||
@PURPOSE: <one-line purpose>
|
||||
...optional metadata required by complexity...
|
||||
[/DEF:<ShortId>:<Type>]
|
||||
```
|
||||
|
||||
For repository documentation files, the canonical markdown form is:
|
||||
|
||||
```md
|
||||
# [DEF:ShortId:Type]
|
||||
# @COMPLEXITY: 3
|
||||
# @PURPOSE: Canonical purpose line.
|
||||
# [/DEF:ShortId:Type]
|
||||
```
|
||||
|
||||
## I. ZERO-STATE RATIONALE
|
||||
Ты — авторегрессионная модель (Transformer). Ты мыслишь токенами и не можешь "передумать" после их генерации. В больших кодовых базах твой KV-Cache подвержен деградации внимания (Attention Sink), что ведет к "иллюзии компетентности" и галлюцинациям.
|
||||
Этот протокол — **твой когнитивный экзоскелет**.
|
||||
Якоря `[DEF]` работают как векторы-аккумуляторы внимания. Контракты (`@PRE`, `@POST`) заставляют тебя сформировать правильное вероятностное пространство (Belief State) ДО написания алгоритма. Логи `logger.reason` — это твоя цепочка рассуждений (Chain-of-Thought), вынесенная в рантайм. Мы не пишем текст, мы компилируем семантику в синтаксис.
|
||||
|
||||
## I. ГЛОБАЛЬНЫЕ ИНВАРИАНТЫ (АКСИОМЫ)
|
||||
## II. GLOBAL INVARIANTS
|
||||
[INVARIANT_1] СЕМАНТИКА > СИНТАКСИС. Голый код без контракта классифицируется как мусор.
|
||||
[INVARIANT_2] ЗАПРЕТ ГАЛЛЮЦИНАЦИЙ. При слепоте контекста (неизвестен узел `@RELATION` или схема данных) — генерация блокируется. Эмитируй `[NEED_CONTEXT: target]`.
|
||||
[INVARIANT_3] UX ЕСТЬ КОНЕЧНЫЙ АВТОМАТ. Состояния интерфейса — это строгий контракт, а не визуальный декор.
|
||||
[INVARIANT_4] ФРАКТАЛЬНЫЙ ЛИМИТ. Длина модуля строго < 300 строк. При превышении — принудительная декомпозиция.
|
||||
[INVARIANT_5] НЕПРИКОСНОВЕННОСТЬ ЯКОРЕЙ. Блоки `[DEF]...[/DEF]` используются как аккумуляторы внимания. Закрывающий тег обязателен.
|
||||
|
||||
## II. СИНТАКСИС И РАЗМЕТКА (SEMANTIC ANCHORS)
|
||||
## III. SYNTAX AND MARKUP (SEMANTIC ANCHORS)
|
||||
Формат зависит от среды исполнения:
|
||||
- Python: `#[DEF:id:Type] ... # [/DEF:id:Type]`
|
||||
- Svelte (HTML/Markup): `<!--[DEF:id:Type] --> ... <!-- [/DEF:id:Type] -->`
|
||||
- Svelte (Script/JS): `// [DEF:id:Type] ... //[/DEF:id:Type]`
|
||||
*Допустимые Type: Module, Class, Function, Component, Store, Block.*
|
||||
- Markdown / docs: `# [DEF:Id:Type] ... # [/DEF:Id:Type]`
|
||||
- Python: `# [DEF:Id:Type] ... # [/DEF:Id:Type]`
|
||||
- Svelte (HTML/Markup): `<!-- [DEF:Id:Type] --> ... <!-- [/DEF:Id:Type] -->`
|
||||
- Svelte (Script/JS/TS): `// [DEF:Id:Type] ... // [/DEF:Id:Type]`
|
||||
*Допустимые Type: Root, Standard, Module, Class, Function, Component, Store, Block.*
|
||||
|
||||
**Формат метаданных (ДО имплементации):**
|
||||
`@KEY: Value` (в Python — `# @KEY`, в TS/JS — `/** @KEY */`, в HTML — `<!-- @KEY -->`).
|
||||
@@ -28,7 +68,7 @@
|
||||
`@RELATION: [PREDICATE] ->[TARGET_ID]`
|
||||
*Допустимые предикаты:* DEPENDS_ON, CALLS, INHERITS, IMPLEMENTS, DISPATCHES, BINDS_TO.
|
||||
|
||||
## III. ТОПОЛОГИЯ ФАЙЛА (СТРОГИЙ ПОРЯДОК)
|
||||
## IV. FILE TOPOLOGY (STRICT ORDER)
|
||||
1. **HEADER (Заголовок):**[DEF:filename:Module]
|
||||
@COMPLEXITY: [1|2|3|4|5] *(алиас: `@C:`)*
|
||||
@SEMANTICS: [keywords]
|
||||
@@ -39,7 +79,7 @@
|
||||
2. **BODY (Тело):** Импорты -> Реализация логики внутри вложенных `[DEF]`.
|
||||
3. **FOOTER (Подвал):** [/DEF:filename:Module]
|
||||
|
||||
## IV. КОНТРАКТЫ (DESIGN BY CONTRACT & UX)
|
||||
## V. CONTRACTS (DESIGN BY CONTRACT & UX)
|
||||
Контракты требуются адаптивно по уровню сложности, а не по жесткому tier.
|
||||
|
||||
**[CORE CONTRACTS]:**
|
||||
@@ -62,7 +102,7 @@
|
||||
- `@TEST_EDGE: [Название] ->[Сбой]` (Минимум 3: missing_field, invalid_type, external_fail).
|
||||
- `@TEST_INVARIANT: [Имя] -> VERIFIED_BY: [scenario_1, ...]`
|
||||
|
||||
## V. ШКАЛА СЛОЖНОСТИ (COMPLEXITY 1-5)
|
||||
## VI. COMPLEXITY SCALE (1-5)
|
||||
Степень контроля задается в Header через `@COMPLEXITY` или сокращение `@C`.
|
||||
Если тег отсутствует, сущность по умолчанию считается **Complexity 1**. Это сделано специально для экономии токенов и снижения шума на очевидных утилитах.
|
||||
|
||||
@@ -93,7 +133,7 @@
|
||||
- Использование `belief_scope` строго обязательно.
|
||||
|
||||
|
||||
## VI. ПРОТОКОЛ ЛОГИРОВАНИЯ (THREAD-LOCAL BELIEF STATE)
|
||||
## VII. LOGGING PROTOCOL (THREAD-LOCAL BELIEF STATE)
|
||||
Логирование — это механизм трассировки рассуждений ИИ (CoT) и управления Attention Energy. Архитектура использует Thread-local storage (`_belief_state`), поэтому `ID` прокидывается автоматически.
|
||||
|
||||
**[PYTHON CORE TOOLS]:**
|
||||
@@ -113,7 +153,7 @@
|
||||
|
||||
*(Для Frontend/Svelte использовать ручной префикс: `console.info("[ID][REFLECT] Text", {data})`)*
|
||||
|
||||
## VII. АЛГОРИТМ ИСПОЛНЕНИЯ И САМОКОРРЕКЦИИ
|
||||
## VIII. EXECUTION AND SELF-CORRECTION FLOW
|
||||
**[PHASE_1: ANALYSIS]**
|
||||
Оцени Complexity, Layer и UX-требования. При слепоте контекста -> `yield [NEED_CONTEXT: id]`.
|
||||
**[PHASE_2: SYNTHESIS]**
|
||||
@@ -129,11 +169,13 @@
|
||||
2. ГИПОТЕЗА: Сгенерируй вызов `logger.explore("Ошибка в I/O / Состоянии / Зависимости -> Описание")`.
|
||||
3. ЗАПРОС: Запроси разрешение на изменение контракта.
|
||||
|
||||
## VIII. ТЕСТЫ: ПРАВИЛА РАЗМЕТКИ
|
||||
## IX. TEST MARKUP RULES
|
||||
Для предотвращения перегрузки тестовых файлов семантическим шумом и снижения "orphan count" применяются упрощенные правила:
|
||||
|
||||
1. **Короткие ID:** Тестовые модули ОБЯЗАНЫ иметь короткие семантические ID (например, `AssistantApiTests`), а не полные пути импорта.
|
||||
2. **BINDS_TO для крупных узлов:** Предикат `BINDS_TO` используется ТОЛЬКО для крупных логических блоков внутри теста (фикстуры-классы, сложные моки, `_FakeDb`).
|
||||
3. **Complexity 1 для хелперов:** Мелкие вспомогательные функции внутри теста (`_run_async`, `_setup_mock`) остаются на уровне Complexity 1. Для них `@RELATION` и `@PURPOSE` не требуются — достаточно якорей `[DEF]...[/DEF]`.
|
||||
4. **Тестовые сценарии:** Сами функции тестов (`test_...`) по умолчанию считаются Complexity 2 (требуется только `@PURPOSE`). Использование `BINDS_TO` для них опционально.
|
||||
5. **Запрет на цепочки:** Не нужно описывать граф вызовов внутри теста. Достаточно "заземлить" 1-2 главных хелпера на ID модуля через `BINDS_TO`, чтобы файл перестал считаться набором сирот.
|
||||
5. **Запрет на цепочки:** Не нужно описывать граф вызовов внутри теста. Достаточно "заземлить" 1-2 главных хелпера на ID модуля через `BINDS_TO`, чтобы файл перестал считаться набором сирот.
|
||||
|
||||
# [/DEF:Std:Semantics:Standard]
|
||||
|
||||
@@ -41,8 +41,8 @@ Each Svelte file must follow this structure:
|
||||
*/
|
||||
import { ... } from "...";
|
||||
|
||||
// Exports (Props)
|
||||
export let prop_name = "...";
|
||||
// Props
|
||||
const { prop_name = "..." } = $props();
|
||||
|
||||
// Logic
|
||||
</script>
|
||||
@@ -72,4 +72,4 @@ Each Svelte file must follow this structure:
|
||||
* Ensure proper ARIA roles and keyboard navigation for interactive elements.
|
||||
* Use semantic HTML tags (`<nav>`, `<header>`, `<main>`, `<footer>`).
|
||||
|
||||
# [/DEF:Std:UI_Svelte]
|
||||
# [/DEF:Std:UI_Svelte:Standard]
|
||||
|
||||
5726
.ai/structure/MODULE_MAP.md
Normal file
5726
.ai/structure/MODULE_MAP.md
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user