This commit is contained in:
2026-06-08 15:08:02 +03:00
parent 3c84161606
commit 73e809e189
7 changed files with 289 additions and 565 deletions

View File

@@ -1,6 +1,8 @@
# #region AxiomConfig [C:5] [TYPE Block] [SEMANTICS config,axiom,indexing]
# @BRIEF Axiom engine configuration — anchor format, indexing rules, tag schema.
# @RATIONALE Single source of truth for the semantic indexing engine. All descriptions in English per MLA token efficiency. Complexity rules use a global tag catalog rather than per-tier duplication (all tags allowed at all tiers per SSOT protocol).
# #region AnchorConfig [C:3] [TYPE Block] [SEMANTICS config,anchor] # #region AnchorConfig [C:3] [TYPE Block] [SEMANTICS config,anchor]
# @BRIEF Якорный синтаксис — глобальный формат и переопределения по директориям.
# @RELATION BINDS_TO -> [Std.Semantics.Core]
anchor: anchor:
format: region format: region
overrides: overrides:
@@ -9,7 +11,7 @@ anchor:
syntax: {} syntax: {}
# #endregion AnchorConfig # #endregion AnchorConfig
# #region IndexingConfig [C:2] [TYPE Block] [SEMANTICS config,indexing] # #region IndexingConfig [C:3] [TYPE Block] [SEMANTICS config,indexing]
indexing: indexing:
include: [] include: []
exclude: exclude:
@@ -26,712 +28,354 @@ indexing:
- '*.yml' - '*.yml'
- '*.json' - '*.json'
- '*.toml' - '*.toml'
- '*.md'
source_dirs: source_dirs:
- src - src
- tests - tests
- routes
doc_dirs: doc_dirs:
- docs - docs
- specs - specs
- .opencode
- .specify
- .opencode/agents
- .opencode/skills
- .opencode/command
- .specify/memory
- .specify/templates
# #endregion IndexingConfig # #endregion IndexingConfig
# #region ComplexityRules [C:5] [TYPE Block] [SEMANTICS config,rules,validation] # #region GlobalTagCatalog [C:5] [TYPE Block] [SEMANTICS config,tags,global]
# @BRIEF Уровни сложности C1-C5 — описательные сигналы, не gatekeeper-правила. # @BRIEF All recognized @-tags — informational, allowed at any tier (C1-C5) per SSOT protocol.
# @RELATION BINDS_TO -> [Std.Semantics.Core] # @INVARIANT Every tag in this catalog has a definition. No tag is forbidden at any tier.
# @INVARIANT Каждый тэг в required/suggested списках обязан иметь определение в TagSchema. # @RATIONALE Per-tier duplication eliminated — tiers are descriptive, not gatekeeping.
# @RATIONALE Tiers are descriptive signals, not gatekeepers. Any tag is welcomed at any tier. # A single global catalog enforces the rule: all tags allowed everywhere.
# @PRE/@POST on a C2 utility is informative, not a violation. global_tags:
# @RATIONALE/@REJECTED are universally welcomed — decision memory at all levels. allowed:
# @REJECTED Old forbidden lists per tier caused agents to remove useful documentation tags. - ACTION
# No tag is forbidden at any tier. Let agents document what needs documenting. - ATOM
complexity_rules: - BRIEF
'1': - STATE
required: [] - PURPOSE
suggested: - EXAMPLE
- ACTION - ERROR
- ATOM - RAISES
- BRIEF - THROWS
- STATE - PRE
- PURPOSE - POST
- C - RATIONALE
- COMPLEXITY - REJECTED
- EXAMPLE - INVARIANT
- ERROR - DATA_CONTRACT
- RAISES - SIDE_EFFECT
- THROWS - RELATION
- PRE - LAYER
- POST - PUBLIC_API
- RATIONALE - SEMANTICS
- REJECTED - STATUS
- INVARIANT - DEPRECATED
- DATA_CONTRACT - REPLACED_BY
- SIDE_EFFECT - TEST_CONTRACT
- RELATION - TEST_EDGE
- LAYER - TEST_INVARIANT
- PUBLIC_API - TEST_FIXTURE
- SEMANTICS - TEST_SCENARIO
- STATUS - UX_STATE
- DEPRECATED - UX_FEEDBACK
- REPLACED_BY - UX_RECOVERY
- TEST_CONTRACT - UX_REACTIVITY
- TEST_EDGE - UX_TEST
- TEST_INVARIANT - RESTRICTION
- TEST_FIXTURE - PARAM
- TEST_SCENARIO - RETURN
- UX_STATE - YIELDS
- UX_FEEDBACK - TEST
- UX_RECOVERY - DEBT
- UX_REACTIVITY - NOTE
- RESTRICTION - PROPERTY
'2': - TYPEDEF
required: [] - CONSTRAINT
suggested: - CONTRACT
- ACTION - CRITICAL_TRACE
- ATOM - FRAGILE
- BRIEF - INVARIANT_VIOLATION
- STATE - VALIDATION
- PURPOSE - TEST_DATA
- C # #endregion GlobalTagCatalog
- COMPLEXITY
- EXAMPLE
- ERROR
- RAISES
- THROWS
- PRE
- POST
- RATIONALE
- REJECTED
- INVARIANT
- DATA_CONTRACT
- SIDE_EFFECT
- RELATION
- LAYER
- PUBLIC_API
- SEMANTICS
- STATUS
- DEPRECATED
- REPLACED_BY
- TEST_CONTRACT
- TEST_EDGE
- TEST_INVARIANT
- TEST_FIXTURE
- TEST_SCENARIO
- UX_STATE
- UX_FEEDBACK
- UX_RECOVERY
- UX_REACTIVITY
- RESTRICTION
'3':
required: []
suggested:
- ACTION
- ATOM
- BRIEF
- STATE
- PURPOSE
- C
- COMPLEXITY
- EXAMPLE
- ERROR
- RAISES
- THROWS
- PRE
- POST
- RATIONALE
- REJECTED
- INVARIANT
- DATA_CONTRACT
- SIDE_EFFECT
- RELATION
- LAYER
- PUBLIC_API
- SEMANTICS
- STATUS
- DEPRECATED
- REPLACED_BY
- TEST_CONTRACT
- TEST_EDGE
- TEST_INVARIANT
- TEST_FIXTURE
- TEST_SCENARIO
- UX_STATE
- UX_FEEDBACK
- UX_RECOVERY
- UX_REACTIVITY
- RESTRICTION
'4':
required: []
suggested:
- ACTION
- ATOM
- BRIEF
- STATE
- PURPOSE
- C
- COMPLEXITY
- EXAMPLE
- ERROR
- RAISES
- THROWS
- PRE
- POST
- RATIONALE
- REJECTED
- INVARIANT
- DATA_CONTRACT
- SIDE_EFFECT
- RELATION
- LAYER
- PUBLIC_API
- SEMANTICS
- STATUS
- DEPRECATED
- REPLACED_BY
- TEST_CONTRACT
- TEST_EDGE
- TEST_INVARIANT
- TEST_FIXTURE
- TEST_SCENARIO
- UX_STATE
- UX_FEEDBACK
- UX_RECOVERY
- UX_REACTIVITY
- RESTRICTION
'5':
required: []
suggested:
- ACTION
- ATOM
- BRIEF
- STATE
- PURPOSE
- C
- COMPLEXITY
- EXAMPLE
- ERROR
- RAISES
- THROWS
- PRE
- POST
- RATIONALE
- REJECTED
- INVARIANT
- DATA_CONTRACT
- SIDE_EFFECT
- RELATION
- LAYER
- PUBLIC_API
- SEMANTICS
- STATUS
- DEPRECATED
- REPLACED_BY
- TEST_CONTRACT
- TEST_EDGE
- TEST_INVARIANT
- TEST_FIXTURE
- TEST_SCENARIO
- UX_STATE
- UX_FEEDBACK
- UX_RECOVERY
- UX_REACTIVITY
- RESTRICTION
# #endregion ComplexityRules
# #region ComplexityRules [C:3] [TYPE Block] [SEMANTICS config,adr,override]
# @BRIEF Типоспецифичные подсказки — не переопределяют базовые complexity_rules, а дополняют их (union).
# @RELATION BINDS_TO -> [Std.Semantics.Core]
# @RATIONALE Per-type suggestions are additive — they don't restrict base complexity_rules.
# All tags remain informational at any type/level per SSOT protocol.
# @REJECTED Restrictive contract_type_overrides caused schema_tag_not_for_contract_type warnings.
# Removed; base complexity_rules already cover all tags.
# @REJECTED Keeping this section empty as placeholder — type-specific suggestions are
# unnecessary since all tags are informational per protocol.
contract_type_overrides: {}
# #endregion ComplexityRules
# #region TagSchema [C:5] [TYPE Block] [SEMANTICS config,tags,schema] # #region TagSchema [C:5] [TYPE Block] [SEMANTICS config,tags,schema]
tags: tags:
C: C:
type: string type: string
multiline: false multiline: false
description: 'DEPRECATED. Канонический формат сложности — [C:N] в заголовке #region. @C больше не использовать.'
alias_for: COMPLEXITY
deprecated: true deprecated: true
deprecated_since: '2026-05-19' deprecated_since: '2026-05-19'
contract_types: alias_for: COMPLEXITY
- Module description: 'DEPRECATED. Use [C:N] in #region header line. @C no longer used.'
- Function
- Class
- Component
- Block
- Skill
- Agent
protected: true protected: true
orthogonal: false orthogonal: false
decision_memory: false decision_memory: false
COMPLEXITY: COMPLEXITY:
type: string type: string
multiline: false multiline: false
description: 'Уровень сложности (1-5). Канонический формат — [C:N] в заголовке анкора #region. @COMPLEXITY как тэг допускается для обратной совместимости, но [C:N] предпочтителен.'
enum: ['1','2','3','4','5'] enum: ['1','2','3','4','5']
contract_types: description: 'Complexity tier (1-5). Canonical format is [C:N] in the #region anchor header. @COMPLEXITY as a tag is accepted for backward compatibility, but [C:N] is preferred.'
- Module
- Function
- Class
- Component
- Block
- Skill
- Agent
protected: true protected: true
orthogonal: false orthogonal: false
decision_memory: false decision_memory: false
ACTION: ACTION:
type: string type: string
multiline: true multiline: true
description: 'Действие модели (model action). Документирует публичный метод модели, изменяющий состояние. Svelte 5 Model тег.' description: 'Model action. Documents a public model method that mutates state. Svelte 5 Model tag.'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
ATOM: ATOM:
type: string type: string
multiline: false multiline: false
description: 'Атом состояния модели. Документирует атомарное поле $state. Svelte 5 Model тег.' description: 'Model state atom. Documents an atomic $state field. Svelte 5 Model tag.'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
BRIEF: BRIEF:
type: string type: string
multiline: true multiline: true
description: 'Назначение контракта. Канонический формат для описания PURPOSE. Универсально опциональный. Хороший тон — иметь @BRIEF на любой функции.' description: 'Contract purpose. Canonical format for describing what the contract does. Recommended on every function. Preferred over legacy @PURPOSE.'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
PURPOSE: PURPOSE:
type: string type: string
multiline: true multiline: true
alias_for: BRIEF alias_for: BRIEF
description: 'Алиас для BRIEF (legacy). Используй @BRIEF в новом коде.' description: 'Alias for BRIEF (legacy). Use @BRIEF in new code.'
contract_types: [] STATE:
type: string
multiline: true
description: 'UX FSM state. Documents possible screen states. Svelte 5 Model tag.'
EXAMPLE: EXAMPLE:
type: string type: string
multiline: true multiline: true
description: 'Пример использования. Универсально опциональный.' description: 'Usage example.'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
ERROR: ERROR:
type: string type: string
multiline: true multiline: true
description: 'Исключение. @ERROR ValueError. Алиасы: RAISES, THROWS. Универсально опциональный.' description: 'Exception. @ERROR ValueError. Aliases: RAISES, THROWS.'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
RAISES: RAISES:
type: string type: string
multiline: true multiline: true
alias_for: ERROR alias_for: ERROR
description: 'Алиас для ERROR.' description: 'Alias for ERROR.'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
THROWS: THROWS:
type: string type: string
multiline: true multiline: true
description: 'Исключение. @THROWS ValueError. Алиас для ERROR. Универсально опциональный.'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
alias_for: ERROR alias_for: ERROR
description: 'Alias for ERROR.'
DEPRECATED: DEPRECATED:
type: string type: string
multiline: true multiline: true
description: 'Метка устаревания. @DEPRECATED v2.5. Универсально опциональный.' description: 'Deprecation marker. @DEPRECATED v2.5.'
contract_types: []
protected: false
orthogonal: false
decision_memory: true decision_memory: true
REPLACED_BY: REPLACED_BY:
type: string type: string
multiline: false multiline: false
description: 'Ссылка на замену. @REPLACED_BY NewService.run.'
is_reference: true is_reference: true
contract_types: [] description: 'Replacement pointer. @REPLACED_BY NewService.run.'
protected: false
orthogonal: false
decision_memory: true decision_memory: true
SEMANTICS: SEMANTICS:
type: array type: array
multiline: false multiline: false
separator: ',' separator: ','
description: 'Семантические маркеры для поиска. Ортогональный.' description: 'Semantic keywords for DSA Indexer search. Orthogonal. Survivability-critical: same-domain contracts must share primary keyword.'
contract_types: []
protected: false
orthogonal: true orthogonal: true
decision_memory: false
SIDE_EFFECT: SIDE_EFFECT:
type: string type: string
multiline: false multiline: false
description: 'Побочные эффекты (I/O, DB, API, сеть). Рекомендуется на функциях с side effects.' description: 'Side effects (I/O, DB, API, network). Recommended on functions with mutations.'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
STATE:
type: string
multiline: true
description: 'Состояние конечного автомата UX. Документирует возможные состояния экрана. Svelte 5 Model тег.'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
STATUS: STATUS:
type: string type: string
multiline: false multiline: false
description: 'Статус: ACTIVE, DEPRECATED, EXPERIMENTAL.' description: 'Status: ACTIVE, DEPRECATED, EXPERIMENTAL.'
contract_types: []
protected: false
orthogonal: true orthogonal: true
decision_memory: false
TEST_CONTRACT: TEST_CONTRACT:
type: string type: string
multiline: false multiline: false
description: Что проверяет тест. Ортогональный. description: 'What the test verifies. Orthogonal.'
contract_types: [Function, Block]
protected: false
orthogonal: true orthogonal: true
decision_memory: false
TEST_EDGE: TEST_EDGE:
type: string type: string
multiline: false multiline: false
description: Краевой случай. Ортогональный. description: 'Edge case scenario. Orthogonal. Minimum 3 per production contract: missing_field, invalid_type, external_fail.'
contract_types: [Function, Block]
protected: false
orthogonal: true orthogonal: true
decision_memory: false
TEST_FIXTURE: TEST_FIXTURE:
type: string type: string
multiline: false multiline: false
description: Тестовая фикстура. Ортогональный. description: 'Test fixture. Orthogonal. Use hardcoded values — never algorithmic computation that mirrors implementation.'
contract_types: [Block]
protected: false
orthogonal: true orthogonal: true
decision_memory: false
TEST_INVARIANT: TEST_INVARIANT:
type: string type: string
multiline: false multiline: false
description: Инвариант теста. Ортогональный. description: 'Test invariant mapping. @TEST_INVARIANT: name -> VERIFIED_BY: [test_name]. Orthogonal.'
contract_types: [Module, Function]
protected: false
orthogonal: true orthogonal: true
decision_memory: false
TEST_SCENARIO: TEST_SCENARIO:
type: string type: string
multiline: false multiline: false
description: Сценарий теста. Ортогональный. description: 'Test scenario. Orthogonal.'
contract_types: [Function, Block]
protected: false
orthogonal: true orthogonal: true
decision_memory: false
UX_FEEDBACK: UX_FEEDBACK:
type: string type: string
multiline: false multiline: false
description: Формат обратной связи. Component. description: 'UX feedback format (Toast, Shake, RedBorder, Modal). Component only.'
contract_types: [Component]
protected: false
orthogonal: true orthogonal: true
decision_memory: false
UX_REACTIVITY: UX_REACTIVITY:
type: string type: string
multiline: false multiline: false
description: Реактивная модель. Component. description: 'Reactive model declaration. Component only.'
contract_types: [Component]
protected: false
orthogonal: true orthogonal: true
decision_memory: false
UX_RECOVERY: UX_RECOVERY:
type: string type: string
multiline: false multiline: false
description: Стратегия восстановления. Component. description: 'Recovery strategy after error/degraded state. Component only.'
contract_types: [Component]
protected: false
orthogonal: true orthogonal: true
decision_memory: false
UX_STATE: UX_STATE:
type: string type: string
multiline: false multiline: false
description: Конечный автомат UX. Рекомендуется для компонентов с множественными состояниями. description: 'UX FSM state mapping. Recommended for multi-state components. Example: @UX_STATE Loading -> Spinner visible, btn disabled.'
contract_types: [Component]
protected: false
orthogonal: false
decision_memory: false
RELATION: RELATION:
type: string type: string
multiline: false multiline: false
description: 'Графовая зависимость. Описывает связь между контрактами. Рекомендуется на любой функции/модуле с внешними зависимостями.'
is_reference: true is_reference: true
description: 'Graph dependency edge. Links contracts. Recommended on any function/module with external dependencies.'
allowed_predicates: [DEPENDS_ON, CALLS, INHERITS, IMPLEMENTS, DISPATCHES, BINDS_TO, CALLED_BY, VERIFIES, USES, CONTAINS, BELONGS_TO, ASSOCIATED_WITH] allowed_predicates: [DEPENDS_ON, CALLS, INHERITS, IMPLEMENTS, DISPATCHES, BINDS_TO, CALLED_BY, VERIFIES, USES, CONTAINS, BELONGS_TO, ASSOCIATED_WITH]
contract_types: []
protected: false
orthogonal: false
decision_memory: false
PRE: PRE:
type: string type: string
multiline: true multiline: true
description: 'Предусловия. Рекомендуется на функциях с нетривиальными входными требованиями.' description: 'Preconditions. Enforce via explicit if/raise guards — NEVER use assert. Recommended on functions with non-trivial input requirements.'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
POST: POST:
type: string type: string
multiline: true multiline: true
description: 'Гарантии результата. Рекомендуется на функциях с нетривиальными постусловиями.' description: 'Output guarantees. Cascading protection: do NOT alter @POST without verifying upstream @RELATION CALLS consumers.'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
PUBLIC_API:
type: string
multiline: false
description: 'Публичный API контракта: какие классы/функции являются точками входа. Универсально опциональный.'
contract_types: []
protected: false
orthogonal: true
decision_memory: false
RATIONALE: RATIONALE:
type: string type: string
multiline: true multiline: true
description: 'Обоснование архитектурного решения. Универсально опциональный (C1+). Decision Memory. Хлебные крошки для следующего разработчика — объясни ПОЧЕМУ сделан этот выбор.' description: 'Architectural decision rationale. WHY this implementation was chosen. Decision Memory — prevents regression loops.'
contract_types: []
protected: false
orthogonal: false
decision_memory: true decision_memory: true
REJECTED: REJECTED:
type: string type: string
multiline: true multiline: true
description: 'Отвергнутая альтернатива и причина отказа. Универсально опциональный (C1+). Decision Memory. Предотвращает повторение ошибок — задокументируй ЧТО пробовали и ПОЧЕМУ не сработало.' description: 'Rejected alternative and disqualification reason. WHAT was tried and WHY it failed. Decision Memory — active guardrail against re-implementation.'
contract_types: []
protected: false
orthogonal: false
decision_memory: true decision_memory: true
DATA_CONTRACT: DATA_CONTRACT:
type: string type: string
multiline: false multiline: false
description: 'DTO-маппинг (InputOutput). Универсально опциональный. Полезен на любом контракте с чёткими типами входа/выхода.' description: 'DTO mapping: Input -> Output. Recommended on any contract with clear input/output types. Critical for cross-stack alignment (backend Pydantic <-> frontend TypeScript).'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
INVARIANT: INVARIANT:
type: string type: string
multiline: true multiline: true
description: 'Инвариант — условие, истинное всегда. Универсально опциональный (C1+). Документируй неуничтожимые гарантии на любом уровне.' description: 'Invariant — condition always true. Documents unbreakable guarantees at any level.'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
UX_TEST: UX_TEST:
type: string type: string
multiline: false multiline: false
description: 'Тестовый сценарий для browser-валидации UX. Component.' description: 'Browser-verifiable UX test scenario. Component only.'
contract_types: [Component]
protected: false
orthogonal: true orthogonal: true
decision_memory: false
TYPE:
type: string
multiline: false
description: 'Тип контракта или компонента. Универсально опциональный.'
contract_types: []
protected: false
orthogonal: true
decision_memory: false
LAYER: LAYER:
type: string type: string
multiline: false multiline: false
description: 'Слой архитектуры: Core, Domain, API, UI, Service, Infrastructure, Plugin, Tests. Универсально опциональный.' description: 'Architecture layer: Core, Domain, API, UI, Service, Infrastructure, Plugin, Tests.'
enum: [Core, Domain, API, UI, Service, Infrastructure, Plugin, Tests, Infra, UI (Tests), Frontend, Atom, Feature, Page, Component, Application, App, Widget, Panel, Store, Layout] enum: [Core, Domain, API, UI, Service, Infrastructure, Plugin, Tests, Infra, Frontend, Feature, Page, Component, Widget, Panel, Store, Layout]
contract_types:
- Module
- Skill
- Agent
protected: false
orthogonal: true orthogonal: true
decision_memory: false
RESTRICTION: RESTRICTION:
type: string type: string
multiline: true multiline: true
description: 'Ограничение контракта (например, EXAMPLES ONLY — не переопределять правила из SSOT). Универсально опциональный.' description: 'Contract restriction (e.g., EXAMPLES ONLY — do not redefine rules from SSOT).'
contract_types: []
protected: false
orthogonal: true orthogonal: true
decision_memory: false
PARAM: PARAM:
type: string type: string
multiline: true multiline: true
description: 'Параметр функции. Документирует ожидаемый аргумент. Универсально опциональный.' description: 'Function parameter documentation.'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
RETURN: RETURN:
type: string type: string
multiline: true multiline: true
description: 'Возвращаемое значение. Документирует тип и условия возврата. Универсально опциональный.' description: 'Return value documentation.'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
YIELDS: YIELDS:
type: string type: string
multiline: true multiline: true
description: 'Генерируемое значение генератора. Универсально опциональный.' description: 'Generator yield value documentation.'
contract_types: []
protected: false
orthogonal: false
decision_memory: false
TEST:
type: string
multiline: true
description: 'Описание тестового сценария. Используется в тестовых контрактах. Универсально опциональный.'
contract_types: []
protected: false
orthogonal: true
decision_memory: false
DEBT:
type: string
multiline: true
description: 'Задокументированный технический долг. Универсально опциональный.'
contract_types: []
protected: false
orthogonal: true
decision_memory: false
NOTE:
type: string
multiline: true
description: 'Примечание для разработчиков. Универсально опциональный.'
contract_types: []
protected: false
orthogonal: true
decision_memory: false
PROPERTY:
type: string
multiline: true
description: 'Свойство/поле объекта. JSDoc-style. Универсально опциональный.'
contract_types: []
protected: false
orthogonal: true
decision_memory: false
TYPEDEF:
type: string
multiline: true
description: 'Определение типа. JSDoc-style. Универсально опциональный.'
contract_types: []
protected: false
orthogonal: true
decision_memory: false
RETURNS: RETURNS:
type: string type: string
multiline: true multiline: true
alias_for: RETURN alias_for: RETURN
description: 'Алиас для RETURN. JSDoc-style. Универсально опциональный.' description: 'Alias for RETURN (JSDoc-style).'
contract_types: [] TEST:
protected: false type: string
multiline: true
description: 'Test scenario description.'
orthogonal: true
DEBT:
type: string
multiline: true
description: 'Documented technical debt.'
orthogonal: true
NOTE:
type: string
multiline: true
description: 'Developer note.'
orthogonal: true
PROPERTY:
type: string
multiline: true
description: 'Object property/field (JSDoc-style).'
orthogonal: true
TYPEDEF:
type: string
multiline: true
description: 'Type definition (JSDoc-style).'
orthogonal: true orthogonal: true
decision_memory: false
UI_STATE: UI_STATE:
type: string type: string
multiline: false multiline: false
alias_for: UX_STATE alias_for: UX_STATE
description: 'Алиас для UX_STATE (legacy). Используй @UX_STATE в новом коде. Универсально опциональный.' description: 'Alias for UX_STATE (legacy). Use @UX_STATE in new code.'
contract_types: []
protected: false
orthogonal: true
decision_memory: false
TEST_DATA:
type: string
multiline: true
description: 'Тестовые данные или фикстура. Универсально опциональный.'
contract_types: []
protected: false
orthogonal: true
decision_memory: false
CONSTRAINT:
type: string
multiline: true
alias_for: INVARIANT
description: 'Алиас для INVARIANT. Универсально опциональный.'
contract_types: []
protected: false
orthogonal: true
decision_memory: false
CONTRACT:
type: string
multiline: true
description: 'Описание контракта или соглашения. Универсально опциональный.'
contract_types: []
protected: false
orthogonal: true
decision_memory: false
CRITICAL_TRACE:
type: string
multiline: true
description: 'Критический trace-маркер для отладки. Универсально опциональный.'
contract_types: []
protected: false
orthogonal: true
decision_memory: false
FRAGILE:
type: string
multiline: true
description: 'Хрупкий код/тест — может сломаться от изменений. Универсально опциональный.'
contract_types: []
protected: false
orthogonal: true
decision_memory: false
INVARIANT_VIOLATION:
type: string
multiline: true
description: 'Задокументированное нарушение инварианта. Универсально опциональный.'
contract_types: []
protected: false
orthogonal: true
decision_memory: false
THROW:
type: string
multiline: true
alias_for: ERROR
description: 'Алиас для ERROR (JSDoc-style). Универсально опциональный.'
contract_types: []
protected: false
orthogonal: true
decision_memory: false
UX_REATIVITY: UX_REATIVITY:
type: string type: string
multiline: false multiline: false
alias_for: UX_REACTIVITY alias_for: UX_REACTIVITY
description: 'Опечатка для UX_REACTIVITY (legacy). Используй @UX_REACTIVITY. Универсально опциональный.' description: 'Typo alias for UX_REACTIVITY (legacy). Use @UX_REACTIVITY.'
contract_types: [] TEST_DATA:
protected: false type: string
multiline: true
description: 'Test data or fixture.'
orthogonal: true orthogonal: true
decision_memory: false CONSTRAINT:
type: string
multiline: true
alias_for: INVARIANT
description: 'Alias for INVARIANT.'
CONTRACT:
type: string
multiline: true
description: 'Contract or agreement description.'
orthogonal: true
CRITICAL_TRACE:
type: string
multiline: true
description: 'Critical trace marker for debugging.'
orthogonal: true
FRAGILE:
type: string
multiline: true
description: 'Fragile code/test — may break from changes.'
orthogonal: true
INVARIANT_VIOLATION:
type: string
multiline: true
description: 'Documented invariant violation.'
orthogonal: true
THROW:
type: string
multiline: true
alias_for: ERROR
description: 'Alias for ERROR (JSDoc-style).'
VALIDATION: VALIDATION:
type: string type: string
multiline: false multiline: false
description: 'Правило валидации. Универсально опциональный.' description: 'Validation rule.'
contract_types: [] orthogonal: true
protected: false PUBLIC_API:
type: string
multiline: false
description: 'Public API surface — which classes/functions are entry points.'
orthogonal: true orthogonal: true
decision_memory: false
# #endregion TagSchema # #endregion TagSchema
# #region InfrastructureConfig [C:2] [TYPE Block] [SEMANTICS config,embedding,http] # #region InfrastructureConfig [C:2] [TYPE Block] [SEMANTICS config,embedding,http]
@@ -747,3 +391,5 @@ doc_stripped_output: null
doc_symbol_types: null doc_symbol_types: null
tier_thresholds: {} tier_thresholds: {}
# #endregion InfrastructureConfig # #endregion InfrastructureConfig
# #endregion AxiomConfig

View File

@@ -34,7 +34,7 @@ Your attention mechanism compresses context in a hybrid pipeline (see `semantics
4. **Copypaste regression.** You see similar code → copy it. If the original had `@REJECTED fallback to SQLite` but HCA 128× erased those tokens from your attention, you silently reimplement the forbidden path. `@REJECTED` in the anchor header is a dense token that survives all compression layers. 4. **Copypaste regression.** You see similar code → copy it. If the original had `@REJECTED fallback to SQLite` but HCA 128× erased those tokens from your attention, you silently reimplement the forbidden path. `@REJECTED` in the anchor header is a dense token that survives all compression layers.
**This project now:** 3658 contracts, 1627 orphans (44%), 206 unresolved edges. Every orphan contract is invisible to the DSA Indexer — the attention pipeline literally cannot route queries to it. **Pre-training note:** `#region`, `@brief`, `@see` appear millions of times in training — you recognize them natively. `@RATIONALE`, `@REJECTED`, `@DATA_CONTRACT`, `@RELATION` are **custom tags learned only through in-context examples in this prompt and loaded skills.** Every `@RATIONALE` you read in a code contract is in-context fine-tuning. Consistency is paramount: planner-generated format must match implementation format.
## Protocol Reference ## Protocol Reference
Load and follow these skills (MANDATORY): Load and follow these skills (MANDATORY):

View File

@@ -184,28 +184,27 @@ Generate its full `#region` header in `contracts/modules.md` under its parent mo
**Minimal header for C3 API endpoints:** **Minimal header for C3 API endpoints:**
``` ```
#region Domain.Resource.Action [C:3] [TYPE Function] [SEMANTICS domain,action] #region Domain.Resource.Action [C:3] [TYPE Function] [SEMANTICS domain,action]
@BRIEF One-line purpose. # @ingroup Domain
@RELATION DEPENDS_ON -> [DependencyService] # @BRIEF One-line purpose.
@RELATION DEPENDS_ON -> [DTO:RequestSchema] # @RELATION DEPENDS_ON -> [DependencyService]
# @RELATION DEPENDS_ON -> [DTO:RequestSchema]
``` ```
**Full header for C4/C5 orchestration & cross-stack functions:** **Full header for C4/C5 orchestration & cross-stack functions:**
``` ```
#region Domain.Resource.Action [C:4] [TYPE Function] [SEMANTICS domain,action] #region Domain.Resource.Action [C:4] [TYPE Function] [SEMANTICS domain,action]
@BRIEF One-line purpose. # @ingroup Domain
@PRE Precondition 1 (verifiable by guard clause). # @BRIEF One-line purpose.
@PRE Precondition 2. # @PRE Precondition 1 (verifiable by guard clause).
@POST Output guarantee 1 (testable assertion). # @POST Output guarantee 1 (testable assertion).
@POST Output guarantee 2. # @SIDE_EFFECT State mutation, I/O, or external call.
@SIDE_EFFECT State mutation, I/O, or external call. # @SIDE_EFFECT Logging (REASON/REFLECT/EXPLORE markers required).
@SIDE_EFFECT Logging (REASON/REFLECT/EXPLORE markers required). # @RELATION DEPENDS_ON -> [ServiceDependency]
@RELATION DEPENDS_ON -> [ServiceDependency] # @RELATION DEPENDS_ON -> [DTO:InputSchema]
@RELATION DEPENDS_ON -> [DTO:InputSchema] # @DATA_CONTRACT InputDTO -> OutputDTO
@DATA_CONTRACT InputDTO -> OutputDTO # @RATIONALE Why this implementation approach.
@RATIONALE Why this implementation approach. # @REJECTED What alternative was considered and forbidden.
@REJECTED What alternative was considered and forbidden. # @TEST_EDGE: scenario_name -> Expected failure behavior.
@TEST_EDGE: scenario_name -> Expected failure behavior.
@TEST_EDGE: scenario_name -> Expected failure behavior.
``` ```
**Screen Model actions (Svelte `.svelte.ts`):** **Screen Model actions (Svelte `.svelte.ts`):**

View File

@@ -18,6 +18,52 @@ description: Reference manual for GRACE-Poly v2.6 — syntax formats, complexity
**Agent prompts are thin shims:** they describe the agent's role, cognitive frame (specific failure modes for their stack), verification commands, and escalation format. They do NOT redefine tiers, tags, or syntax. Agent-specific cognitive framing lives in each agent's prompt and is not duplicated here. **Agent prompts are thin shims:** they describe the agent's role, cognitive frame (specific failure modes for their stack), verification commands, and escalation format. They do NOT redefine tiers, tags, or syntax. Agent-specific cognitive framing lives in each agent's prompt and is not duplicated here.
### 0.1 Pre-Training Frequency & Tag Familiarity
Not all GRACE tags are equal in the model's training data. Understanding which tags the model has seen millions of times vs. which it learns only through in-context examples is critical for protocol design.
#### Pre-training native (Doxygen/JSDoc — millions of examples)
| Tag | Doxygen/JSDoc equivalent | Training context |
|-----|-------------------------|-----------------|
| `@BRIEF` | `@brief` | All C/C++/Python/Rust Doxygen projects, all JS/TS JSDoc projects |
| `@defgroup` | `@defgroup GroupName Description` | Module-level grouping in Doxygen (LLVM, OpenCV, ROS) |
| `@ingroup` | `@ingroup GroupName` | Child membership in Doxygen groups |
| `@see` | `@see`, `@sa` | Cross-references — the model's native link mechanism |
| `@deprecated` | `@deprecated` | Deprecation markers in Doxygen and JSDoc |
| `@note`, `@warning` | `@note`, `@warning` | Advisory annotations |
**Rule:** These tags trigger pre-trained recognition. Use them as structural anchors. `@defgroup` on modules + `@ingroup` on children is the strongest domain-grouping signal the model natively understands.
#### Pre-training weak (formal verification — thousands of examples)
| Tag | Context | Model recognition |
|-----|---------|-------------------|
| `@PRE` | Eiffel, Ada 2012, JML, ACSL | Understands "precondition" but not in documentation context |
| `@POST` | Eiffel, Ada 2012, JML, ACSL | Understands "postcondition" — weaker signal than `@brief` |
| `@INVARIANT` | Eiffel, Dafny, formal methods | Understands the word — but Doxygen `@invariant` is for formal verification, not general docs |
**Rule:** These have semantic recognition from the word itself, but weak pre-training. Examples in agent prompts accelerate learning.
#### Pure in-context learning (zero pre-training examples)
| Tag | Closest pre-training analog | Why it's custom |
|-----|---------------------------|-----------------|
| `@RATIONALE` | `@note` | No documentation system has "architectural decision rationale" as a tag |
| `@REJECTED` | `@deprecated` (for removed), `@warning` | No system records "considered and rejected alternative" |
| `@SIDE_EFFECT` | None | No documentation system tags side effects explicitly |
| `@DATA_CONTRACT` | `@param` / `@returns` | No system has "DTO mapping Input→Output" as a tag |
| `@RELATION` | `@see` (link only) | No system has typed edges with predicates (DEPENDS_ON, CALLS...) |
| `@UX_STATE` | None | UX state machines exist in no documentation system |
| `@UX_FEEDBACK` | None | — |
| `@UX_RECOVERY` | None | — |
| `@UX_REACTIVITY` | None | — |
| `@UX_TEST` | `@test` (Doxygen) | Doxygen's `@test` is for test cases, not UX interaction scenarios |
| `@TEST_EDGE` | None | Edge case documentation exists nowhere |
| `@TEST_INVARIANT` | None | — |
**Rule:** Every appearance of these tags in agent prompts and skill examples is **critical training material.** The model has zero pre-trained knowledge of their format. Consistency across planner → coder → QA examples is paramount — deviation in one agent creates confusion in all others. In-context examples MUST be canonical and unchanging.
## I. GLOBAL INVARIANTS (specification) ## I. GLOBAL INVARIANTS (specification)
- **[INV_1]:** Every function, class, and module MUST have a `#region`/`#endregion` contract. Naked code is unreviewable. - **[INV_1]:** Every function, class, and module MUST have a `#region`/`#endregion` contract. Naked code is unreviewable.
@@ -33,13 +79,22 @@ description: Reference manual for GRACE-Poly v2.6 — syntax formats, complexity
### Primary — Region (recommended for Python, JS/TS, Rust) ### Primary — Region (recommended for Python, JS/TS, Rust)
```python ```python
# #region ContractId [C:N] [TYPE TypeName] [SEMANTICS tag1,tag2] # #region Domain.Name [C:N] [TYPE Module] [SEMANTICS tag1,tag2]
# @defgroup Domain One-line description of this domain. # ← groups children + serves as @BRIEF
# @RELATION ...
# #region Domain.Name.Action [C:N] [TYPE Function] [SEMANTICS domain,action]
# @ingroup Domain
# @BRIEF One-line description # @BRIEF One-line description
# @RELATION PREDICATE -> [TargetId] # @RELATION PREDICATE -> [TargetId]
<code this is what the contract wraps> <code>
# #endregion ContractId # #endregion Domain.Name.Action
# #endregion Domain.Name
``` ```
**Module contracts:** `@defgroup` replaces `@BRIEF` it declares the group AND describes what the domain does. Child contracts: `@ingroup` on line 2 joins the group; `@BRIEF` on line 3 describes the specific contract.
### Legacy — DEF (permanently recognized) ### Legacy — DEF (permanently recognized)
```python ```python
// [DEF:ContractId:Type] // [DEF:ContractId:Type]
@@ -200,13 +255,26 @@ Contract IDs MUST use dot-separated domain prefixes with 2-3 levels of hierarchy
### ATTN_3 — SEMANTIC GROUPING (DSA Lightning Indexer) ### ATTN_3 — SEMANTIC GROUPING (DSA Lightning Indexer)
The DSA Indexer scores compressed records by keyword match against the query. `@SEMANTICS` keywords are your index keys: The DSA Indexer scores compressed records by keyword match against the query. Two complementary mechanisms:
**`[SEMANTICS ...]` in anchor (CSA 4× density):**
- All contracts in the `auth` domain MUST share `[SEMANTICS auth, ...]`. - All contracts in the `auth` domain MUST share `[SEMANTICS auth, ...]`.
- `grep "@SEMANTICS.*auth"` → Indexer scores all auth records high. - `grep "@SEMANTICS.*auth"` → Indexer scores all auth records high.
- If one auth contract uses `@SEMANTICS login` and another `@SEMANTICS authentication`, the Indexer may fail to group them. - If one auth contract uses `[SEMANTICS login]` and another `[SEMANTICS authentication]`, the Indexer may fail to group them.
**Rule:** Identical domain = identical primary keyword in `@SEMANTICS`. Secondary keywords can vary. **`@ingroup Domain` on line 2 (HCA 128× pre-training):**
- The model has seen `@ingroup` in Doxygen millions of times as a grouping mechanism.
- Adding `@ingroup Auth` on line 2 (after the anchor) provides pre-training-recognized DSA grouping.
- **Recommended for all new C3+ contracts.** Not required for C1/C2 inside a parent module with `@ingroup`.
Example — both mechanisms reinforce each other:
```
#region Core.Auth.Login [C:4] [TYPE Function] [SEMANTICS auth,login,token]
# @ingroup Auth
# @BRIEF Authenticate user by credentials.
```
**Rule:** Identical domain = identical primary keyword in `[SEMANTICS ...]` AND identical `@ingroup Domain`. They target different compression layers (CSA vs HCA) and don't conflict — the keyword repetition amplifies the DSA score.
### ATTN_4 — FRACTAL BOUNDARIES (Sliding Window) ### ATTN_4 — FRACTAL BOUNDARIES (Sliding Window)
@@ -224,6 +292,9 @@ When Axiom MCP is down, these grep patterns exploit the DSA Indexer's keyword se
# Find all contracts in a domain (Indexer matches @SEMANTICS keywords) # Find all contracts in a domain (Indexer matches @SEMANTICS keywords)
grep -r "@SEMANTICS.*<domain>" src/ grep -r "@SEMANTICS.*<domain>" src/
# Find all contracts in a @defgroup (pre-training-recognized Doxygen pattern)
grep -r "@ingroup.*<group>" src/
# Find API type binding (cross-stack traceability) # Find API type binding (cross-stack traceability)
grep -r "@DATA_CONTRACT.*<ModelName>" src/ grep -r "@DATA_CONTRACT.*<ModelName>" src/
@@ -232,6 +303,9 @@ awk '/#region <ContractID>/,/#endregion <ContractID>/' file.py
# Find all contracts BIND_TO a store # Find all contracts BIND_TO a store
grep -r "BINDS_TO.*\[<StoreId>\]" src/ grep -r "BINDS_TO.*\[<StoreId>\]" src/
# Find cross-references by @see (pre-training-recognized — alternative to @RELATION for simple links)
grep -r "@see.*<ContractID>" src/
``` ```
#endregion Std.Semantics.Core #endregion Std.Semantics.Core

View File

@@ -81,10 +81,11 @@ def format_timestamp(ts: datetime) -> str:
### C3 (Flow) — Module with nested functions, service layer ### C3 (Flow) — Module with nested functions, service layer
```python ```python
# #region Migration.Dashboard [C:3] [TYPE Module] [SEMANTICS migration,dashboard] # #region Migration.Dashboard [C:3] [TYPE Module] [SEMANTICS migration,dashboard]
# @BRIEF Dashboard migration service — export/import dashboards with validation. # @defgroup Migration Dashboard export/import with validation.
# @LAYER Service # @LAYER Service
# #region Migration.Dashboard.Migrate [C:3] [TYPE Function] [SEMANTICS migration,dashboard] # #region Migration.Dashboard.Migrate [C:3] [TYPE Function] [SEMANTICS migration,dashboard]
# @ingroup Migration
# @BRIEF Migrate a single dashboard from source to target Superset instance. # @BRIEF Migrate a single dashboard from source to target Superset instance.
# @RELATION DEPENDS_ON -> [SupersetClient] # @RELATION DEPENDS_ON -> [SupersetClient]
# @RELATION DEPENDS_ON -> [DashboardValidator] # @RELATION DEPENDS_ON -> [DashboardValidator]
@@ -102,6 +103,7 @@ def migrate_dashboard(source_client, target_client, dashboard_id: str, db_mappin
### C4 (Orchestration) — Stateful operations with belief runtime ### C4 (Orchestration) — Stateful operations with belief runtime
```python ```python
# #region Migration.RunTask [C:4] [TYPE Function] [SEMANTICS migration,task,state] # #region Migration.RunTask [C:4] [TYPE Function] [SEMANTICS migration,task,state]
# @ingroup Migration
# @BRIEF Execute a full migration task with rollback capability and progress reporting. # @BRIEF Execute a full migration task with rollback capability and progress reporting.
# @PRE Database connection is established. Task record exists with valid migration plan. # @PRE Database connection is established. Task record exists with valid migration plan.
# @POST Task status updated to COMPLETED or FAILED. Migration audit log written. # @POST Task status updated to COMPLETED or FAILED. Migration audit log written.
@@ -139,6 +141,7 @@ async def run_migration_task(task_id: str, db_session) -> dict:
### C5 (Critical) — With decision memory ### C5 (Critical) — With decision memory
```python ```python
# #region Index.Rebuild [C:5] [TYPE Function] [SEMANTICS indexing,recovery,semantic] # #region Index.Rebuild [C:5] [TYPE Function] [SEMANTICS indexing,recovery,semantic]
# @ingroup Index
# @BRIEF Rebuild the full semantic index from source with atomic swap and rollback. # @BRIEF Rebuild the full semantic index from source with atomic swap and rollback.
# @PRE Workspace root is accessible. Source files exist. # @PRE Workspace root is accessible. Source files exist.
# @POST New index atomically swapped; old preserved for rollback. # @POST New index atomically swapped; old preserved for rollback.

View File

@@ -91,6 +91,7 @@ Models use the **`.svelte.ts`** extension (not plain `.ts`) because they rely on
```typescript ```typescript
// frontend/src/lib/models/UsersListModel.svelte.ts // frontend/src/lib/models/UsersListModel.svelte.ts
// #region Users.ListModel [C:4] [TYPE Model] [SEMANTICS users,list,screen-model] // #region Users.ListModel [C:4] [TYPE Model] [SEMANTICS users,list,screen-model]
// @ingroup Users
// @BRIEF State model for the user list screen — declares atoms, invariants, and actions. // @BRIEF State model for the user list screen — declares atoms, invariants, and actions.
// @INVARIANT Changing filter (search, role, status) resets pagination to page 1. // @INVARIANT Changing filter (search, role, status) resets pagination to page 1.
// @INVARIANT Deleting a user removes it from the list and decrements total count atomically. // @INVARIANT Deleting a user removes it from the list and decrements total count atomically.

View File

@@ -96,10 +96,11 @@ Every contract generated in Phase 1 MUST pass these checks (from `semantics-core
### Anchor Syntax (canonical) ### Anchor Syntax (canonical)
- Python: `# #region ContractId [C:N] [TYPE TypeName] [SEMANTICS tags]` / `# #endregion ContractId` - Python: `# #region Domain.Name [C:N] [TYPE TypeName] [SEMANTICS tags]` / `# #endregion Domain.Name`
- Svelte markup: `<!-- #region ContractId [C:N] [TYPE Component] [SEMANTICS tags] -->` / `<!-- #endregion ContractId -->` - Svelte markup: `<!-- #region Domain.Name [C:N] [TYPE Component] [SEMANTICS tags] -->` / `<!-- #endregion Domain.Name -->`
- Svelte/TypeScript model: `// #region ModelName [C:N] [TYPE Model] [SEMANTICS tags]` / `// #endregion ModelName` - Svelte/TypeScript model: `// #region Domain.Name [C:N] [TYPE Model] [SEMANTICS tags]` / `// #endregion Domain.Name`
- Markdown/ADR: `## @{ ContractId [C:N] [TYPE TypeName]` / `## @} ContractId` - Markdown/ADR: `## @{ Domain.Name [C:N] [TYPE TypeName]` / `## @} Domain.Name`
- **For modules: `@defgroup Domain Description` on line 2 declares the group.** Child contracts use `@ingroup Domain` to join.
- **Legacy `[DEF:id:Type]` syntax is deprecated** use `#region` format exclusively. - **Legacy `[DEF:id:Type]` syntax is deprecated** use `#region` format exclusively.
- **Model files use `.svelte.ts` extension** canonical format for contracts with Svelte reactive primitives. - **Model files use `.svelte.ts` extension** canonical format for contracts with Svelte reactive primitives.