feat: attention-optimized semantic protocol v2.7
Core changes: - Add @defgroup/@ingroup to 1791 C2+ contracts (555 files) for HCA 128× pre-training DSA grouping - Add §0.1 Pre-Training Frequency matrix to semantics-core - Add §VIII Attention Architecture rules (ATTN_1-4) with MLA/CSA/HCA/DSA mechanics - Add @defgroup/@ingroup to canonical syntax (§II) and all contract examples Agent prompts (5 files): - Add ZERO-STATE RATIONALE with MLA/CSA/HCA/DSA compression mechanics - Add pre-training note: @RATIONALE/@REJECTED are in-context learned tags - svelte-coder: add missing #region contract, fix Svelte rule violations - python-coder/fullstack-coder: honor function contracts from speckit plan - qa-tester: add attention compliance audit (P3 ATTN_1-4 checks) Skills (6 files): - Translate all axiom_config descriptions to English - Fix doc_dirs to index .opencode/ and .specify/ - Deduplicate 5× complexity_rules → single global_tags catalog - Reduce semantics-svelte 591→485 lines (remove duplicate code blocks) - Fix semantics-testing: 'Short IDs' → 'Short hierarchical IDs' - Fix all examples: flat IDs → hierarchical Domain.Name format - Fix Svelte examples: replace raw Tailwind + <button> with semantic tokens + /ui Speckit workflow (commands + templates): - speckit.plan: add Function-Level Contracts for C3+ with @PRE/@POST/@TEST_EDGE - speckit.plan: add Attention Compliance Gate (ATTN_1-4 before contract generation) - speckit.tasks: add function contract inlining format (constraints in task description) - speckit.specify: load semantics-core for spec density rules - spec-template: add #region contract, @SEMANTICS grouping, hierarchical IDs - ux-reference-template: add #region wrapper - plan-template: add attention gate, @defgroup/@ingroup guidance - tasks-template: add attention audit + rebuild + orphan check tasks - constitution.md: translate to English, add Principle VIII (attention-optimized contracts) Reference modules rewritten (hierarchical IDs + full contracts): - Auth.Jwt: 6 child contracts with @RATIONALE/@REJECTED/@TEST_EDGE - Api.Auth: 5 endpoints with @TEST_EDGE + molecular CoT markers - Migration.Model: @defgroup Migration with 18 @ACTION + 6 @INVARIANT Scripts: - add_defgroup_ingroup.py: zero-risk additive @ingroup migration (1791 insertions) - migrate_hierarchical.py: flat→hierarchical ID dry-run analysis (792 contracts) - merge_prompts.py: merge all prompts/skills/commands into one review file Config: - axiom_config.yaml: 749→395 lines (-47%), English, doc_dirs include prompts - Fix test_datasets.py import collision (rename → test_datasets_routes.py) - Fix test_preview.py: SupersetClient→get_superset_client, AsyncMock, logger f-string
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# #region LLMAnalysisPackage [TYPE Module] [SEMANTICS llm, analysis, plugin, package, export]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
|
||||
"""
|
||||
LLM Analysis Plugin for automated dashboard validation and dataset documentation.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# #region DashboardTopology [C:3] [TYPE Module] [SEMANTICS superset, topology, dashboard, layout, parsing]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Dashboard topology extraction — parses Superset position_json into human-readable
|
||||
# text descriptions of Tab → Row → Chart hierarchy for LLM prompt context.
|
||||
# @LAYER Plugin
|
||||
@@ -227,6 +228,7 @@ def _extract_topology_children(
|
||||
|
||||
|
||||
# #region build_dashboard_topology [C:2] [TYPE Function]
|
||||
# @ingroup LLMAnalysis
|
||||
# @BRIEF Build a structured text description of dashboard layout from position_json.
|
||||
# @PARAM dashboard (dict) - Dashboard metadata dict with position_json, dashboard_title.
|
||||
# @PARAM charts (list[dict]) - List of fetched chart detail dicts for name/viz lookup.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# #region V1ToV2Migration [C:3] [TYPE Module] [SEMANTICS migration,validation,data,idempotent]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Migration script: v1 → v2 ValidationPolicy data. Converts existing dashboard_ids
|
||||
# JSON arrays to ValidationSource relational rows.
|
||||
# @PRE Database has both validation_policies and validation_sources tables.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# #region LLMAnalysisModels [C:3] [TYPE Module] [SEMANTICS pydantic, llm, plugin, model, provider-type]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Define Pydantic models for LLM Analysis plugin.
|
||||
# @LAYER Domain
|
||||
# @RELATION DEPENDS_ON -> [EXT:Library:pydantic]
|
||||
@@ -10,6 +11,7 @@ from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
# #region LLMProviderType [TYPE Class]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Enum for supported LLM providers.
|
||||
class LLMProviderType(str, Enum):
|
||||
OPENAI = "openai"
|
||||
@@ -19,6 +21,7 @@ class LLMProviderType(str, Enum):
|
||||
# #endregion LLMProviderType
|
||||
|
||||
# #region LLMProviderConfig [TYPE Class]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Configuration for an LLM provider.
|
||||
class LLMProviderConfig(BaseModel):
|
||||
id: str | None = None
|
||||
@@ -41,6 +44,7 @@ class LLMProviderConfig(BaseModel):
|
||||
# #endregion LLMProviderConfig
|
||||
|
||||
# #region ValidationStatus [TYPE Class]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Enum for dashboard validation status.
|
||||
class ValidationStatus(str, Enum):
|
||||
PASS = "PASS"
|
||||
@@ -50,6 +54,7 @@ class ValidationStatus(str, Enum):
|
||||
# #endregion ValidationStatus
|
||||
|
||||
# #region DetectedIssue [TYPE Class]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Model for a single issue detected during validation.
|
||||
class DetectedIssue(BaseModel):
|
||||
severity: ValidationStatus
|
||||
@@ -58,6 +63,7 @@ class DetectedIssue(BaseModel):
|
||||
# #endregion DetectedIssue
|
||||
|
||||
# #region ValidationResult [TYPE Class]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Model for dashboard validation result.
|
||||
class ValidationResult(BaseModel):
|
||||
id: str | None = None
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# #region LLMAnalysisPlugin [C:5] [TYPE Module] [SEMANTICS llm, analysis, dashboard, validation, documentation]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Implements DashboardValidationPlugin and DocumentationPlugin.
|
||||
# @LAYER Plugin
|
||||
# @RELATION INHERITS -> [PluginBase]
|
||||
@@ -159,6 +160,7 @@ def _update_run_status(db, run_id: str | None) -> None:
|
||||
|
||||
|
||||
# #region DashboardValidationPlugin [TYPE Class]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Plugin for automated dashboard health analysis using LLMs.
|
||||
# @RELATION IMPLEMENTS -> [PluginBase]
|
||||
class DashboardValidationPlugin(PluginBase):
|
||||
@@ -846,6 +848,7 @@ class DashboardValidationPlugin(PluginBase):
|
||||
|
||||
|
||||
# #region DocumentationPlugin [TYPE Class]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Plugin for automated dataset documentation using LLMs.
|
||||
# @RELATION IMPLEMENTS -> [PluginBase]
|
||||
class DocumentationPlugin(PluginBase):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# #region LLMAnalysisScheduler [C:3] [TYPE Module] [SEMANTICS scheduler, llm, validation, task, cron]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Provides helper functions to schedule LLM-based validation tasks.
|
||||
# @LAYER Domain
|
||||
# @RELATION DEPENDS_ON -> [SchedulerService]
|
||||
@@ -10,6 +11,7 @@ from ...dependencies import get_scheduler_service, get_task_manager
|
||||
|
||||
|
||||
# #region schedule_dashboard_validation [TYPE Function]
|
||||
# @ingroup LLMAnalysis
|
||||
# @BRIEF Schedules a recurring dashboard validation task.
|
||||
# @SIDE_EFFECT Adds a job to the scheduler service.
|
||||
def schedule_dashboard_validation(dashboard_id: str, cron_expression: str, params: dict[str, Any]):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# #region LLMAnalysisService [C:5] [TYPE Module] [SEMANTICS llm, screenshot, playwright, openai, tenacity]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Services for LLM interaction and dashboard screenshots.
|
||||
# @LAYER Plugin
|
||||
# @RELATION DEPENDS_ON -> [EXT:Library:tenacity]
|
||||
@@ -37,6 +38,7 @@ LLM_HTTP_TIMEOUT_S = 120 # seconds (httpx client timeout)
|
||||
DEFAULT_USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36"
|
||||
|
||||
# #region ScreenshotService [TYPE Class]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Handles capturing screenshots of Superset dashboards.
|
||||
class ScreenshotService:
|
||||
# region ScreenshotService.__init__ [TYPE Function]
|
||||
@@ -837,6 +839,7 @@ class ScreenshotService:
|
||||
# #endregion ScreenshotService
|
||||
|
||||
# #region LLMClient [TYPE Class]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Wrapper for LLM provider APIs.
|
||||
class LLMClient:
|
||||
# region LLMClient.__init__ [TYPE Function]
|
||||
@@ -1441,6 +1444,7 @@ class LLMClient:
|
||||
# #endregion LLMClient
|
||||
|
||||
# #region DatasetHealthChecker [C:3] [TYPE Class]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Checks dataset accessibility and KXD connectivity via Superset API.
|
||||
# @LAYER Service
|
||||
# @RELATION CALLS -> [SupersetClient]
|
||||
@@ -1641,6 +1645,7 @@ class DatasetHealthChecker:
|
||||
# #endregion DatasetHealthChecker
|
||||
|
||||
# #region RedactionService [C:2] [TYPE Module]
|
||||
# @defgroup LLMAnalysis Module group.
|
||||
# @BRIEF Redacts PII, credentials, and sensitive data from logs and LLM responses.
|
||||
# @LAYER Service
|
||||
# @RATIONALE FR-029: sensitive data must be filtered BEFORE external LLM send and BEFORE persistence.
|
||||
|
||||
Reference in New Issue
Block a user