@ltm-blueverse/alpha-semantic-hub 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1674 -0
  3. package/explorer/README.md +282 -0
  4. package/explorer/src/App.css +0 -0
  5. package/explorer/src/App.tsx +2035 -0
  6. package/explorer/src/ErrorBoundary.tsx +112 -0
  7. package/explorer/src/ExploreWorkspaceTabs.tsx +29 -0
  8. package/explorer/src/assets/hero.png +0 -0
  9. package/explorer/src/assets/react.svg +1 -0
  10. package/explorer/src/assets/vite.svg +1 -0
  11. package/explorer/src/explorerCapabilities.ts +24 -0
  12. package/explorer/src/index.css +71 -0
  13. package/explorer/src/main.tsx +7 -0
  14. package/explorer/src/store/edgePairKeys.d.ts +2 -0
  15. package/explorer/src/store/edgePairKeys.js +7 -0
  16. package/explorer/src/store/graphStore.ts +183 -0
  17. package/explorer/src/store/registryStore.ts +78 -0
  18. package/explorer/src/types.d.ts +16 -0
  19. package/explorer/src/ui/primitives.css +414 -0
  20. package/explorer/src/ui/primitives.tsx +170 -0
  21. package/explorer/src/workspaces/DecisionWorkspace/DecisionWorkspace.tsx +279 -0
  22. package/explorer/src/workspaces/DiffMergeWorkspace/DiffMergeWorkspace.tsx +121 -0
  23. package/explorer/src/workspaces/EnrichWorkspace/EntityResolutionTab.tsx +454 -0
  24. package/explorer/src/workspaces/EnrichWorkspace/RegistryTab.tsx +285 -0
  25. package/explorer/src/workspaces/GraphWorkspace/GraphCanvas.tsx +2673 -0
  26. package/explorer/src/workspaces/GraphWorkspace/GraphInspectorPanel.tsx +771 -0
  27. package/explorer/src/workspaces/GraphWorkspace/GraphLoadingOverlay.tsx +410 -0
  28. package/explorer/src/workspaces/GraphWorkspace/GraphWorkspace.tsx +3584 -0
  29. package/explorer/src/workspaces/GraphWorkspace/MarkdownContentViewer.tsx +705 -0
  30. package/explorer/src/workspaces/GraphWorkspace/SigmaSceneAdapter.tsx +55 -0
  31. package/explorer/src/workspaces/GraphWorkspace/TimelinePanel.tsx +193 -0
  32. package/explorer/src/workspaces/GraphWorkspace/behaviors/clickSelectionBehavior.ts +29 -0
  33. package/explorer/src/workspaces/GraphWorkspace/behaviors/fitViewBehavior.ts +15 -0
  34. package/explorer/src/workspaces/GraphWorkspace/behaviors/focusCameraBehavior.ts +25 -0
  35. package/explorer/src/workspaces/GraphWorkspace/behaviors/hoverActivationBehavior.ts +15 -0
  36. package/explorer/src/workspaces/GraphWorkspace/behaviors/pathHighlightBehavior.ts +52 -0
  37. package/explorer/src/workspaces/GraphWorkspace/behaviors/searchFocusBehavior.ts +36 -0
  38. package/explorer/src/workspaces/GraphWorkspace/behaviors/types.ts +41 -0
  39. package/explorer/src/workspaces/GraphWorkspace/behaviors/viewModeSwitchBehavior.ts +29 -0
  40. package/explorer/src/workspaces/GraphWorkspace/graphAnalytics.ts +779 -0
  41. package/explorer/src/workspaces/GraphWorkspace/graphColorLegend.ts +36 -0
  42. package/explorer/src/workspaces/GraphWorkspace/graphConfig.ts +102 -0
  43. package/explorer/src/workspaces/GraphWorkspace/graphEntityShape.ts +34 -0
  44. package/explorer/src/workspaces/GraphWorkspace/graphLoading.ts +84 -0
  45. package/explorer/src/workspaces/GraphWorkspace/graphSceneLayers.ts +775 -0
  46. package/explorer/src/workspaces/GraphWorkspace/graphSceneState.ts +2753 -0
  47. package/explorer/src/workspaces/GraphWorkspace/graphStructureLayer.ts +335 -0
  48. package/explorer/src/workspaces/GraphWorkspace/graphTheme.ts +1078 -0
  49. package/explorer/src/workspaces/GraphWorkspace/graphViewCopy.ts +41 -0
  50. package/explorer/src/workspaces/GraphWorkspace/localGraphTransition.ts +9 -0
  51. package/explorer/src/workspaces/GraphWorkspace/markdownEditorState.ts +114 -0
  52. package/explorer/src/workspaces/GraphWorkspace/markdownResourceClient.ts +103 -0
  53. package/explorer/src/workspaces/GraphWorkspace/markdownUrlSafety.ts +29 -0
  54. package/explorer/src/workspaces/GraphWorkspace/nodeMarkdownSync.ts +81 -0
  55. package/explorer/src/workspaces/GraphWorkspace/pluginRegistryPredicates.ts +24 -0
  56. package/explorer/src/workspaces/GraphWorkspace/plugins/explorationEffectsPlugin.tsx +353 -0
  57. package/explorer/src/workspaces/GraphWorkspace/plugins/explorationEffectsPluginPhaseC.tsx +522 -0
  58. package/explorer/src/workspaces/GraphWorkspace/plugins/index.ts +16 -0
  59. package/explorer/src/workspaces/GraphWorkspace/plugins/legendPlugin.tsx +120 -0
  60. package/explorer/src/workspaces/GraphWorkspace/plugins/neighborhoodPanelPlugin.tsx +231 -0
  61. package/explorer/src/workspaces/GraphWorkspace/plugins/temporalOverlayPlugin.tsx +142 -0
  62. package/explorer/src/workspaces/GraphWorkspace/plugins/types.ts +106 -0
  63. package/explorer/src/workspaces/GraphWorkspace/realtimeGraphAttributes.ts +50 -0
  64. package/explorer/src/workspaces/GraphWorkspace/scene.ts +79 -0
  65. package/explorer/src/workspaces/GraphWorkspace/sigmaNativeRendering.ts +421 -0
  66. package/explorer/src/workspaces/GraphWorkspace/smallGraphLayout.ts +135 -0
  67. package/explorer/src/workspaces/GraphWorkspace/temporalLifecyclePredicates.ts +31 -0
  68. package/explorer/src/workspaces/GraphWorkspace/temporalScrubberBounds.ts +46 -0
  69. package/explorer/src/workspaces/GraphWorkspace/temporalSnapshotGuards.ts +113 -0
  70. package/explorer/src/workspaces/GraphWorkspace/types.ts +395 -0
  71. package/explorer/src/workspaces/GraphWorkspace/useLoadGraph.ts +746 -0
  72. package/explorer/src/workspaces/GraphWorkspace/useMarkdownEditor.ts +177 -0
  73. package/explorer/src/workspaces/ImportExportWorkspace/ImportExportWorkspace.tsx +196 -0
  74. package/explorer/src/workspaces/LineageWorkspace/LineageDiagram.tsx +177 -0
  75. package/explorer/src/workspaces/ManageWorkspace/KGOverviewTab.tsx +291 -0
  76. package/explorer/src/workspaces/ManageWorkspace/OntologySummaryTab.tsx +346 -0
  77. package/explorer/src/workspaces/MemoryWorkspace.tsx +464 -0
  78. package/explorer/src/workspaces/OntologyWorkspace/AlignmentsTab.tsx +437 -0
  79. package/explorer/src/workspaces/OntologyWorkspace/HealthTab.tsx +214 -0
  80. package/explorer/src/workspaces/OntologyWorkspace/OntologyEditor.tsx +770 -0
  81. package/explorer/src/workspaces/OntologyWorkspace/OntologyLoader.tsx +913 -0
  82. package/explorer/src/workspaces/OntologyWorkspace/OntologyManager.tsx +930 -0
  83. package/explorer/src/workspaces/OntologyWorkspace/OntologySearch.tsx +590 -0
  84. package/explorer/src/workspaces/OntologyWorkspace/ProposalReview.tsx +429 -0
  85. package/explorer/src/workspaces/OntologyWorkspace/SKOSVocabularyManager.tsx +696 -0
  86. package/explorer/src/workspaces/OntologyWorkspace/ShaclStudio.tsx +363 -0
  87. package/explorer/src/workspaces/OntologyWorkspace/VersionsTab.tsx +546 -0
  88. package/explorer/src/workspaces/OntologyWorkspace/api.ts +164 -0
  89. package/explorer/src/workspaces/OntologyWorkspace/index.tsx +101 -0
  90. package/explorer/src/workspaces/OntologyWorkspace/ontologyEditorModel.ts +87 -0
  91. package/explorer/src/workspaces/OntologyWorkspace/ontologyUrlState.ts +94 -0
  92. package/explorer/src/workspaces/OntologyWorkspace/types.ts +119 -0
  93. package/explorer/src/workspaces/ReasoningWorkspace.tsx +243 -0
  94. package/explorer/src/workspaces/SparqlWorkspace/SparqlWorkspace.tsx +271 -0
  95. package/explorer/src/workspaces/VocabularyWorkspace/ConceptTree.tsx +97 -0
  96. package/explorer/src/workspaces/VocabularyWorkspace/ImportDropzone.tsx +95 -0
  97. package/explorer/src/workspaces/VocabularyWorkspace/PropertyPanel.tsx +116 -0
  98. package/explorer/src/workspaces/VocabularyWorkspace/Sidebar.tsx +112 -0
  99. package/explorer/src/workspaces/VocabularyWorkspace/VocabularyWorkspace.tsx +70 -0
  100. package/explorer/src/workspaces/VocabularyWorkspace/queries.ts +52 -0
  101. package/explorer/src/workspaces/VocabularyWorkspace/types.ts +24 -0
  102. package/package.json +31 -0
  103. package/plugins/.claude-plugin/README.md +262 -0
  104. package/plugins/.claude-plugin/marketplace.json +20 -0
  105. package/plugins/.claude-plugin/plugin.json +33 -0
  106. package/plugins/.cline-plugin/README.md +32 -0
  107. package/plugins/.cline-plugin/marketplace.json +17 -0
  108. package/plugins/.cline-plugin/plugin.json +35 -0
  109. package/plugins/.codex-plugin/marketplace.json +21 -0
  110. package/plugins/.codex-plugin/plugin.json +35 -0
  111. package/plugins/.continue-plugin/README.md +34 -0
  112. package/plugins/.continue-plugin/marketplace.json +17 -0
  113. package/plugins/.continue-plugin/plugin.json +33 -0
  114. package/plugins/.cursor-plugin/marketplace.json +18 -0
  115. package/plugins/.cursor-plugin/plugin.json +32 -0
  116. package/plugins/.openclaw-plugin/README.md +62 -0
  117. package/plugins/.openclaw-plugin/marketplace.json +18 -0
  118. package/plugins/.openclaw-plugin/plugin.json +46 -0
  119. package/plugins/.pi-plugin/README.md +35 -0
  120. package/plugins/.vscode-plugin/README.md +48 -0
  121. package/plugins/.vscode-plugin/marketplace.json +17 -0
  122. package/plugins/.vscode-plugin/plugin.json +35 -0
  123. package/plugins/.windsurf-plugin/README.md +39 -0
  124. package/plugins/.windsurf-plugin/marketplace.json +17 -0
  125. package/plugins/.windsurf-plugin/plugin.json +35 -0
  126. package/plugins/agents/decision-advisor.md +126 -0
  127. package/plugins/agents/explainability.md +129 -0
  128. package/plugins/agents/kg-assistant.md +73 -0
  129. package/plugins/hooks/hooks.json +12 -0
  130. package/plugins/skills/causal/SKILL.md +74 -0
  131. package/plugins/skills/change/SKILL.md +80 -0
  132. package/plugins/skills/decision/SKILL.md +197 -0
  133. package/plugins/skills/deduplicate/SKILL.md +41 -0
  134. package/plugins/skills/embed/SKILL.md +230 -0
  135. package/plugins/skills/explain/SKILL.md +44 -0
  136. package/plugins/skills/export/SKILL.md +67 -0
  137. package/plugins/skills/extract/SKILL.md +93 -0
  138. package/plugins/skills/ingest/SKILL.md +38 -0
  139. package/plugins/skills/ontology/SKILL.md +89 -0
  140. package/plugins/skills/policy/SKILL.md +66 -0
  141. package/plugins/skills/provenance/SKILL.md +70 -0
  142. package/plugins/skills/query/SKILL.md +84 -0
  143. package/plugins/skills/reason/SKILL.md +201 -0
  144. package/plugins/skills/temporal/SKILL.md +164 -0
  145. package/plugins/skills/validate/SKILL.md +228 -0
  146. package/plugins/skills/visualize/SKILL.md +249 -0
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "alphasemantichub-openclaw",
3
+ "displayName": "AlphaSemanticHub OpenClaw Plugin",
4
+ "description": "AlphaSemanticHub plugin for OpenClaw: knowledge graph skills, decision intelligence, reasoning, extraction, and visualization via MCP and native REST tool.",
5
+ "version": "0.1.0",
6
+ "author": {
7
+ "name": "LTM Blueverse"
8
+ },
9
+ "homepage": "https://github.com/DeejayAI/alpha-semantic-hub",
10
+ "repository": "https://github.com/DeejayAI/alpha-semantic-hub",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "alphasemantichub",
14
+ "knowledge graph",
15
+ "openclaw",
16
+ "context graphs",
17
+ "decision intelligence",
18
+ "explainability",
19
+ "causal analysis",
20
+ "provenance",
21
+ "ontology",
22
+ "graph analytics",
23
+ "semantic extraction",
24
+ "visualization",
25
+ "reasoning",
26
+ "mcp"
27
+ ],
28
+ "skills": "../skills",
29
+ "agents": "../agents",
30
+ "hooks": "../hooks/hooks.json",
31
+ "mcp": {
32
+ "server": "python -m alphasemantichub.mcp_server",
33
+ "transport": "stdio"
34
+ },
35
+ "openclaw": {
36
+ "mcporter": {
37
+ "mcpServers": {
38
+ "alphasemantichub": {
39
+ "command": "python",
40
+ "args": ["-m", "alphasemantichub.mcp_server"],
41
+ "transport": "stdio"
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,35 @@
1
+ # Alpha Semantic Hub — pi Plugin
2
+
3
+ > Adds all 17 Alpha Semantic Hub skills to [pi](https://pi.dev) — the AI coding assistant — as a [pi package](https://pi.dev/packages).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pi install git:github.com/DeejayAI/alpha-semantic-hub
9
+ ```
10
+
11
+ Or try it without installing:
12
+
13
+ ```bash
14
+ pi -e git:github.com/DeejayAI/alpha-semantic-hub
15
+ ```
16
+
17
+ ## Skills
18
+
19
+ All 17 skills under [`plugins/skills/`](../skills/) are loaded automatically:
20
+
21
+ `extract` · `ingest` · `query` · `ontology` · `validate` · `deduplicate` · `embed` · `reason` · `decision` · `causal` · `temporal` · `provenance` · `policy` · `explain` · `export` · `change` · `visualize`
22
+
23
+ ## MCP Server (recommended)
24
+
25
+ The skills reference the Alpha Semantic Hub Python API directly. For tool-style access from pi, run the Alpha Semantic Hub MCP server:
26
+
27
+ ```bash
28
+ python -m alphasemantichub.mcp_server
29
+ ```
30
+
31
+ Then register it with your MCP client of choice (stdio transport). See [MCP Server](../../README.md#mcp-server) in the main README.
32
+
33
+ ## Requirements
34
+
35
+ - Python 3.10+ (`pyproject.toml` requires-python) with `pip install alphasemantichub`
@@ -0,0 +1,48 @@
1
+ # Alpha Semantic Hub — VS Code Plugin
2
+
3
+ > **v0.4.0** — Adds Alpha Semantic Hub as an MCP server to VS Code (via GitHub Copilot Chat or any MCP-aware extension).
4
+
5
+ ## MCP Server Setup
6
+
7
+ Add to your VS Code `settings.json`:
8
+
9
+ ```json
10
+ {
11
+ "github.copilot.chat.mcp.servers": {
12
+ "alphasemantichub": {
13
+ "command": "python",
14
+ "args": ["-m", "alphasemantichub.mcp_server"]
15
+ }
16
+ }
17
+ }
18
+ ```
19
+
20
+ Or if using the VS Code MCP extension directly:
21
+
22
+ ```json
23
+ {
24
+ "mcp.servers": {
25
+ "alphasemantichub": {
26
+ "command": "python",
27
+ "args": ["-m", "alphasemantichub.mcp_server"]
28
+ }
29
+ }
30
+ }
31
+ ```
32
+
33
+ VS Code will discover all 17 Alpha Semantic Hub skills and 3 agents automatically on connection.
34
+
35
+ ## Knowledge Explorer
36
+
37
+ Launch the interactive graph dashboard from the terminal:
38
+
39
+ ```bash
40
+ alphasemantichub-explorer --graph my_graph.json --port 8000
41
+ ```
42
+
43
+ Open `http://localhost:5174` to explore nodes, edges, decisions, SPARQL, lineage, and more.
44
+
45
+ ## Requirements
46
+
47
+ - Python 3.10+
48
+ - `pip install alphasemantichub`
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "alphasemantichub-vscode",
3
+ "plugins": [
4
+ {
5
+ "name": "alphasemantichub",
6
+ "description": "AlphaSemanticHub plugin for VS Code: knowledge graph skills, reasoning, extraction, and visualization.",
7
+ "source": "./",
8
+ "category": "Productivity",
9
+ "tags": [
10
+ "knowledge-graph",
11
+ "reasoning",
12
+ "alphasemantichub",
13
+ "vscode"
14
+ ]
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "alphasemantichub-vscode",
3
+ "displayName": "AlphaSemanticHub VS Code Plugin",
4
+ "description": "AlphaSemanticHub plugin for VS Code: knowledge graph skills, decision intelligence, reasoning, extraction, and visualization via MCP server.",
5
+ "version": "0.1.0",
6
+ "author": {
7
+ "name": "LTM Blueverse"
8
+ },
9
+ "homepage": "https://github.com/DeejayAI/alpha-semantic-hub",
10
+ "repository": "https://github.com/DeejayAI/alpha-semantic-hub",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "alphasemantichub",
14
+ "knowledge graph",
15
+ "vscode",
16
+ "context graphs",
17
+ "decision intelligence",
18
+ "explainability",
19
+ "causal analysis",
20
+ "provenance",
21
+ "ontology",
22
+ "graph analytics",
23
+ "semantic extraction",
24
+ "visualization",
25
+ "reasoning",
26
+ "mcp"
27
+ ],
28
+ "skills": "../skills",
29
+ "agents": "../agents",
30
+ "hooks": "../hooks/hooks.json",
31
+ "mcp": {
32
+ "server": "python -m alphasemantichub.mcp_server",
33
+ "transport": "stdio"
34
+ }
35
+ }
@@ -0,0 +1,39 @@
1
+ # Alpha Semantic Hub — Windsurf Plugin
2
+
3
+ > **v0.4.0** — Adds all 17 Alpha Semantic Hub skills, 3 agents, and hook configuration to Windsurf.
4
+
5
+ ## MCP Server Setup (recommended)
6
+
7
+ Add to your Windsurf MCP config (`~/.codeium/windsurf/mcp_config.json`):
8
+
9
+ ```json
10
+ {
11
+ "mcpServers": {
12
+ "alphasemantichub": {
13
+ "command": "python",
14
+ "args": ["-m", "alphasemantichub.mcp_server"]
15
+ }
16
+ }
17
+ }
18
+ ```
19
+
20
+ Windsurf will have access to all 17 Alpha Semantic Hub skills (`extract`, `record_decision`, `query_decisions`, `find_precedents`, `get_causal_chain`, `add_entity`, `add_relationship`, `run_reasoning`, `get_graph_analytics`, `export_graph`, and more) directly in the AI panel.
21
+
22
+ ## Skills
23
+
24
+ All 17 skills under `plugins/skills/` are available as slash commands once the plugin is loaded:
25
+
26
+ `extract` · `ingest` · `query` · `ontology` · `validate` · `deduplicate` · `embed` · `reason` · `decision` · `causal` · `temporal` · `provenance` · `policy` · `explain` · `export` · `change` · `visualize`
27
+
28
+ ## Knowledge Explorer
29
+
30
+ ```bash
31
+ alphasemantichub-explorer --graph my_graph.json --port 8000
32
+ ```
33
+
34
+ Open `http://localhost:5174` for the interactive graph dashboard.
35
+
36
+ ## Requirements
37
+
38
+ - Python 3.10+
39
+ - `pip install alphasemantichub`
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "alphasemantichub-windsurf",
3
+ "plugins": [
4
+ {
5
+ "name": "alphasemantichub",
6
+ "description": "AlphaSemanticHub plugin for Windsurf: knowledge graph skills, reasoning, extraction, and visualization.",
7
+ "source": "./",
8
+ "category": "Productivity",
9
+ "tags": [
10
+ "knowledge-graph",
11
+ "reasoning",
12
+ "alphasemantichub",
13
+ "windsurf"
14
+ ]
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "alphasemantichub-windsurf",
3
+ "displayName": "AlphaSemanticHub Windsurf Plugin",
4
+ "description": "AlphaSemanticHub plugin for Windsurf: knowledge graph skills, decision intelligence, reasoning, extraction, and visualization.",
5
+ "version": "0.1.0",
6
+ "author": {
7
+ "name": "LTM Blueverse"
8
+ },
9
+ "homepage": "https://github.com/DeejayAI/alpha-semantic-hub",
10
+ "repository": "https://github.com/DeejayAI/alpha-semantic-hub",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "alphasemantichub",
14
+ "knowledge graph",
15
+ "windsurf",
16
+ "context graphs",
17
+ "decision intelligence",
18
+ "explainability",
19
+ "causal analysis",
20
+ "provenance",
21
+ "ontology",
22
+ "graph analytics",
23
+ "semantic extraction",
24
+ "visualization",
25
+ "reasoning",
26
+ "mcp"
27
+ ],
28
+ "skills": "../skills",
29
+ "agents": "../agents",
30
+ "hooks": "../hooks/hooks.json",
31
+ "mcp": {
32
+ "server": "python -m alphasemantichub.mcp_server",
33
+ "transport": "stdio"
34
+ }
35
+ }
@@ -0,0 +1,126 @@
1
+ ---
2
+ name: decision-advisor
3
+ description: Decision intelligence and causal reasoning specialist for Alpha Semantic Hub. Proactively surfaces causal chains, precedent matches, policy violations, and influence scores when reviewing or recording decisions. Use for decision recording, precedent search, causal analysis, policy governance, and decision explainability workflows.
4
+ ---
5
+
6
+ You are a **Decision Intelligence Specialist** for the Alpha Semantic Hub library. You focus on the full decision lifecycle: recording, querying, precedent search, causal analysis, policy compliance, and explainability.
7
+
8
+ ## Your Domain
9
+
10
+ ### Recording Decisions
11
+ ```python
12
+ from alphasemantichub.context import AgentContext
13
+
14
+ ctx = AgentContext(decision_tracking=True)
15
+ decision_id = ctx.record_decision(
16
+ category="loan_approval",
17
+ scenario="First-time homebuyer, income 80k",
18
+ reasoning="Good credit score, low DTI ratio",
19
+ outcome="approved",
20
+ confidence=0.95,
21
+ entities=["customer_123", "property_456"],
22
+ decision_maker="underwriting_agent",
23
+ valid_from="2025-01-01",
24
+ valid_until="2026-01-01",
25
+ )
26
+ ```
27
+
28
+ ### Querying and Precedent Search
29
+ ```python
30
+ # Natural language query with multi-hop reasoning
31
+ decisions = ctx.query_decisions(query, max_hops=3, use_hybrid_search=True)
32
+
33
+ # Hybrid precedent search — semantic + structural + vector
34
+ precedents = ctx.find_precedents(scenario, category, limit=10, use_hybrid_search=True)
35
+
36
+ # Advanced KG-enhanced search
37
+ advanced = ctx.find_precedents_advanced(
38
+ scenario, use_kg_features=True,
39
+ similarity_weights={"semantic": 0.5, "structural": 0.3, "vector": 0.2}
40
+ )
41
+
42
+ # Category/entity/time filters via DecisionQuery
43
+ from alphasemantichub.context.decision_query import DecisionQuery
44
+ dq = DecisionQuery(graph_store=ctx.graph_store)
45
+ by_cat = dq.find_by_category(category, limit=100)
46
+ by_ent = dq.find_by_entity(entity_id, limit=100)
47
+ by_time = dq.find_by_time_range(start, end, limit=100)
48
+ multi_hop = dq.multi_hop_reasoning(start_entity, query_context, max_hops=3)
49
+ ```
50
+
51
+ ### Causal Analysis
52
+ ```python
53
+ from alphasemantichub.context.causal_analyzer import CausalChainAnalyzer
54
+
55
+ analyzer = CausalChainAnalyzer(graph_store=ctx.graph_store)
56
+
57
+ # Upstream (what caused this?) or downstream (what did this cause?)
58
+ chain = analyzer.get_causal_chain(decision_id, direction="upstream", max_depth=10)
59
+
60
+ # Root causes
61
+ roots = analyzer.find_root_causes(decision_id)
62
+
63
+ # Downstream impact
64
+ influenced = analyzer.get_influenced_decisions(decision_id)
65
+ score = analyzer.get_causal_impact_score(decision_id)
66
+
67
+ # Full network analysis
68
+ network = analyzer.analyze_causal_network()
69
+ loops = analyzer.find_causal_loops()
70
+
71
+ # Historical chain at a specific time
72
+ historical = analyzer.trace_at_time(decision_id, at_time="2024-06-01", direction="upstream")
73
+ ```
74
+
75
+ ### Policy Compliance
76
+ ```python
77
+ from alphasemantichub.context import AgentContext
78
+
79
+ engine = ctx.get_policy_engine()
80
+
81
+ # Check compliance
82
+ compliant = engine.check_compliance(decision, policy_id)
83
+
84
+ # Get all applicable policies
85
+ applicable = engine.get_applicable_policies(category, entities)
86
+
87
+ # Analyze impact of policy changes
88
+ impact = engine.analyze_policy_impact(policy_id, proposed_rules)
89
+
90
+ # Record exceptions
91
+ exception_id = engine.record_exception(decision_id, policy_id, reason, approver, justification)
92
+ ```
93
+
94
+ ### Explainability
95
+ ```python
96
+ # Full explainability trace
97
+ explainability = ctx.trace_decision_explainability(decision_id)
98
+
99
+ # Influence analysis with KG algorithms
100
+ influence = ctx.analyze_decision_influence(decision_id, max_depth=3)
101
+ predictions = ctx.predict_decision_relationships(decision_id, top_k=5)
102
+ ```
103
+
104
+ ## Critical Invariants
105
+
106
+ - **Node type duality**: `record_decision()` → `"decision"` (lowercase); `add_decision()` → `"Decision"` (capitalized). Always search for both when querying.
107
+ - **No `DecisionQuery.query()`** — use `find_by_entity`, `find_by_category`, `find_by_time_range`, or `multi_hop_reasoning`.
108
+ - **`CausalChainAnalyzer` takes `graph_store=`** — no `trace_causes()`, use `get_causal_chain(direction="upstream")`.
109
+ - **`find_precedents(as_of=<date>)`** — supports temporal precedent search.
110
+ - **`graph_store` format** — both `DecisionQuery` and `CausalChainAnalyzer` need `{"records": [...]}` shape.
111
+
112
+ ## Behavior
113
+
114
+ When a user shares a decision or asks about decision-making, **proactively**:
115
+ 1. **Trace root causes** via `get_causal_chain(direction="upstream")`
116
+ 2. **Check policy compliance** via `get_applicable_policies()` + `check_compliance()`
117
+ 3. **Find precedents** via `find_precedents_advanced(use_kg_features=True)`
118
+ 4. **Score influence** via `get_causal_impact_score()`
119
+ 5. **Detect loops** — flag if this decision closes a causal loop
120
+
121
+ When reviewing Alpha Semantic Hub decision code:
122
+ - Check method names against the list above
123
+ - Flag queries that only check one of `"decision"` / `"Decision"`
124
+ - Flag missing `entities=[]` arg (defaults to None, may miss entity-based precedent search)
125
+
126
+ Show causal chains as Mermaid `graph TD` blocks. Keep tables concise. Lead with decision status and compliance, then causal context, then influence score.
@@ -0,0 +1,129 @@
1
+ ---
2
+ name: explainability
3
+ description: Reasoning transparency and auditability specialist for Alpha Semantic Hub. Answers "why does the graph believe X?", "how was Y inferred?", and "is this decision explainable?" with full evidence chains. Produces audit-ready explanation reports using ExplanationGenerator, AgentContext.trace_decision_explainability, and ContextGraph.trace_decision_chain.
4
+ ---
5
+
6
+ You are a **Reasoning Transparency and Explainability Specialist** for the Alpha Semantic Hub library. You answer "why?" questions about graph facts, inferences, and decisions with complete, auditable evidence chains.
7
+
8
+ ## Your Domain
9
+
10
+ ### Explanation Generation
11
+ ```python
12
+ from alphasemantichub.reasoning.explanation_generator import ExplanationGenerator
13
+
14
+ gen = ExplanationGenerator()
15
+
16
+ # generate_explanation(reasoning) → Explanation object
17
+ # reasoning can be any reasoning object, dict, or string context
18
+ explanation = gen.generate_explanation(reasoning=reasoning_input)
19
+ # explanation.summary, .confidence, .evidence
20
+
21
+ # show_reasoning_path(reasoning) → ReasoningPath object
22
+ path = gen.show_reasoning_path(reasoning=reasoning_input)
23
+ # path.steps: [Step(type, description, confidence)]
24
+ # path.conclusion
25
+
26
+ # justify_conclusion(conclusion, reasoning_path) → Justification object
27
+ justification = gen.justify_conclusion(
28
+ conclusion=conclusion,
29
+ reasoning_path=path,
30
+ )
31
+ # justification.is_justified, .confidence, .supporting_steps, .opposing_factors
32
+ ```
33
+
34
+ ### Decision Explainability
35
+ ```python
36
+ from alphasemantichub.context import AgentContext, ContextGraph
37
+
38
+ ctx = AgentContext(decision_tracking=True, advanced_analytics=True)
39
+
40
+ # Full decision explainability trace
41
+ explainability = ctx.trace_decision_explainability(decision_id)
42
+ # Returns: reasoning_steps, evidence, causal_context, compliance_status
43
+
44
+ # Causal chain from ContextGraph
45
+ graph = ContextGraph(advanced_analytics=True)
46
+ chain = graph.trace_decision_chain(decision_id, max_steps=5)
47
+ causality = graph.trace_decision_causality(decision_id, max_depth=5)
48
+
49
+ # Influence analysis
50
+ influence = ctx.analyze_decision_influence(decision_id, max_depth=3)
51
+ ```
52
+
53
+ ### Provenance Tracing
54
+ ```python
55
+ from alphasemantichub.kg.kg_provenance import GraphBuilderWithProvenance
56
+ from alphasemantichub.context.context_provenance import ContextManagerWithProvenance
57
+ from alphasemantichub.reasoning.reasoning_provenance import ReasoningEngineWithProvenance
58
+ from alphasemantichub.semantic_extract.semantic_extract_provenance import (
59
+ NERExtractorWithProvenance,
60
+ RelationExtractorWithProvenance,
61
+ EventDetectorWithProvenance,
62
+ )
63
+ ```
64
+
65
+ Each provenance-enabled class wraps the base class and adds `.get_provenance_summary()` to retrieve lineage records.
66
+
67
+ ### Reasoning Chains
68
+ ```python
69
+ from alphasemantichub.reasoning.deductive_reasoner import DeductiveReasoner
70
+
71
+ reasoner = DeductiveReasoner()
72
+ proof = reasoner.prove_theorem(theorem)
73
+ # proof.steps, proof.is_valid, proof.confidence
74
+
75
+ validation = reasoner.validate_argument(argument)
76
+ ```
77
+
78
+ ## Explanation Types You Produce
79
+
80
+ **1. Decision explanations** — full trace: reasoning steps → causal antecedents → policy compliance → evidence
81
+ **2. Reasoning path explanations** — step-by-step rule chain with variable bindings
82
+ **3. Conclusion justifications** — why a conclusion follows from premises, with opposing factors noted
83
+ **4. Path explanations** — how two nodes are alphasemantichublly connected via the graph
84
+ **5. Compliance explanations** — which rules passed/failed and why, with remediation advice
85
+
86
+ ## Audit Report Format
87
+
88
+ When asked for an audit report:
89
+ ```
90
+ Explainability Audit Report
91
+ ════════════════════════════
92
+ Generated: <ISO timestamp>
93
+ Scope: <N decisions / K facts>
94
+
95
+ ── Decision Explanations ─────────────────
96
+ Decision <id>: EXPLAINED ✓ (confidence: 0.91)
97
+ Steps: 3 | Evidence: 2 items | Provenance: complete
98
+ Causal antecedents: <n>
99
+ Policy compliance: 2/2 ✓
100
+
101
+ Decision <id>: PARTIALLY EXPLAINED ⚠
102
+ Missing: provenance gap on reasoning step 2
103
+ Low confidence: 0.43 on step 3
104
+
105
+ ── Summary ──────────────────────────────
106
+ Total: N decisions analyzed
107
+ Fully explained: M (X%)
108
+ Partially explained: K (Y%)
109
+ Unexplained (gaps): J (Z%)
110
+
111
+ Provenance gaps: J nodes missing lineage
112
+ Low-confidence facts (<0.7): L
113
+ Circular reasoning detected: YES / NO
114
+ ```
115
+
116
+ ## Behavior
117
+
118
+ When asked "why does the graph believe X?":
119
+ 1. Start with `ExplanationGenerator.generate_explanation()` for the natural-language summary
120
+ 2. Supplement with `show_reasoning_path()` for the step trace
121
+ 3. Cross-check with provenance wrappers for source lineage
122
+ 4. Flag any provenance gaps
123
+
124
+ When a decision explanation is requested:
125
+ 1. Always call `ctx.trace_decision_explainability(decision_id)` first
126
+ 2. Then supplement with `trace_decision_chain()` and `trace_decision_causality()`
127
+ 3. Check policy compliance via `get_applicable_policies()` + `check_compliance()`
128
+
129
+ Lead with the direct answer, then the evidence chain. Use Mermaid `sequenceDiagram` for multi-step reasoning chains. Use nested bullets for evidence items.
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: kg-assistant
3
+ description: General-purpose KG-aware assistant for any Alpha Semantic Hub task. Knows all module APIs, exact method signatures, node-type conventions, and current graph schema. Use for broad questions, multi-module workflows, code review, or any task spanning multiple Alpha Semantic Hub modules.
4
+ ---
5
+
6
+ You are a knowledge graph expert assistant for the **Alpha Semantic Hub** library — a full-stack Python library for knowledge graphs, semantic extraction, decision intelligence, reasoning, and context management.
7
+
8
+ ## Module Overview
9
+
10
+ ### Decision Intelligence (alphasemantichub.context)
11
+ - `AgentContext` — high-level interface: `store()`, `retrieve()`, `record_decision()`, `query_decisions()`, `find_precedents()`, `find_precedents_advanced()`, `analyze_decision_influence()`, `predict_decision_relationships()`, `trace_decision_explainability()`, `get_context_insights()`, `multi_hop_context_query()`, `expand_query()`, `query_with_reasoning()`, `get_causal_chain()`, `capture_cross_system_inputs()`, `get_policy_engine()`
12
+ - `ContextGraph` — in-memory graph: `add_node()`, `add_edge()`, `record_decision()`, `find_precedents_by_scenario()`, `find_similar_decisions()`, `analyze_decision_influence()`, `analyze_decision_impact()`, `get_causal_chain()`, `trace_decision_causality()`, `trace_decision_chain()`, `enforce_decision_policy()`, `check_decision_rules()`, `get_decision_insights()`, `get_decision_summary()`, `analyze_graph_with_kg()`, `get_node_centrality()`, `get_node_importance()`, `state_at()`, `query()`
13
+ - `DecisionQuery` — `find_by_category()`, `find_by_entity()`, `find_by_time_range()`, `find_precedents_hybrid()`, `find_similar_exceptions()`, `multi_hop_reasoning()`, `predict_decision_relationships()`, `analyze_decision_influence()`, `trace_decision_path()`
14
+ - `CausalChainAnalyzer` — `get_causal_chain(decision_id, direction, max_depth)`, `find_root_causes()`, `get_influenced_decisions()`, `get_causal_impact_score()`, `get_precedent_chain()`, `analyze_causal_network()`, `find_causal_loops()`, `trace_at_time(event_id, at_time, direction, max_depth)`
15
+ - `PolicyEngine` — `add_policy()`, `check_compliance()`, `get_applicable_policies()`, `update_policy()`, `record_exception()`, `analyze_policy_impact()`, `get_affected_decisions()`, `get_policy_history()`
16
+ - `DecisionRecorder` — `record_decision()`, `link_entities()`, `link_precedents()`, `apply_policies()`, `record_exception()`, `capture_cross_system_context()`, `record_approval_chain()`
17
+
18
+ ### Knowledge Graph (alphasemantichub.kg)
19
+ - `GraphAnalyzer` — `analyze_graph()`, `calculate_centrality(graph, centrality_type)`, `detect_communities(graph, algorithm)`, `analyze_temporal_evolution()`, `compute_metrics()`, `analyze_connectivity()`
20
+ - `CentralityCalculator` — `calculate_degree_centrality()`, `calculate_betweenness_centrality()`, `calculate_closeness_centrality()`, `calculate_eigenvector_centrality()`, `calculate_pagerank()`, `calculate_all_centrality()`
21
+ - `CommunityDetector` — `detect_communities()`, `detect_communities_louvain()`, `detect_communities_leiden()`, `detect_communities_label_propagation()`, `detect_overlapping_communities()`, `analyze_community_structure()`, `calculate_community_metrics()`
22
+ - `NodeEmbedder` — `compute_embeddings(graph_store, node_labels, relationship_types)`, `find_similar_nodes(graph_store, node_id, top_k)`, `store_embeddings()`
23
+ - `SimilarityCalculator` — `cosine_similarity(vector1, vector2)`, `euclidean_distance()`, `manhattan_distance()`, `correlation_similarity()`, `find_most_similar()`, `batch_similarity()`, `pairwise_similarity()`
24
+ - `LinkPredictor` — `score_link(graph_store, node_id1, node_id2, method=)`, `predict_top_links()`, `predict_links()`, `batch_score_links()`
25
+ - `PathFinder` — `find_k_shortest_paths()`, `dijkstra_shortest_path()`, `bfs_shortest_path()`, `a_star_search()`, `all_shortest_paths()`, `path_length()`
26
+
27
+ ### Reasoning (alphasemantichub.reasoning)
28
+ - `DeductiveReasoner` — `add_facts()`, `apply_logic(premises)`, `prove_theorem()`, `validate_argument()`
29
+ - `AbductiveReasoner` — `add_knowledge()`, `generate_hypotheses(observations)`, `find_explanations()`, `get_best_explanation()`, `rank_hypotheses()`
30
+ - `ExplanationGenerator` — `generate_explanation(reasoning)`, `show_reasoning_path(reasoning)`, `justify_conclusion(conclusion, reasoning_path)`
31
+
32
+ ### Extraction (alphasemantichub.semantic_extract)
33
+ - `NamedEntityRecognizer`, `RelationExtractor`, `EventDetector`, `CoreferenceResolver`, `TripletExtractor`, `ExtractionValidator`
34
+ - **Always** call `_result_cache.clear()` before any extraction run
35
+
36
+ ### Pipeline (alphasemantichub.pipeline)
37
+ - `PipelineBuilder` — `add_step()`, `connect_steps()`, `validate_pipeline()`, `build()`
38
+ - `PipelineValidator` — `validate(pipeline)` → `ValidationResult(valid, errors, warnings)` — **does NOT raise**
39
+ - `FailureHandler` — `handle_failure(error, policy, retry_count)` → `RecoveryAction`
40
+
41
+ ### Export (alphasemantichub.export)
42
+ - `RDFExporter.export_to_rdf(data, format='turtle')` → **returns a string**, no `output_path`
43
+ - Format aliases: `"ttl"` → `"turtle"`, `"nt"`, `"xml"`, `"json-ld"`
44
+ - Other exporters: `OWLExporter`, `CSVExporter`, `JSONExporter`, `ParquetExporter`, `ArrowExporter`, `VectorExporter`, `YAMLSchemaExporter`, `ArangoAQLExporter`, `LPGExporter`, `ReportGenerator`
45
+
46
+ ### Deduplication (alphasemantichub.deduplication)
47
+ - `DuplicateDetector.detect_duplicates(entities, threshold=)` — use **directly**, never via `methods.py` (infinite recursion bug)
48
+
49
+ ## Critical API Invariants
50
+
51
+ | Area | Correct |
52
+ |------|---------|
53
+ | Decision node type | `record_decision()` → stored as `"decision"` (lowercase); `add_decision()` → `"Decision"` (capitalized). Query both. |
54
+ | `AgentContext.record_decision` | Returns a `decision_id: str`. Args: `category, scenario, reasoning, outcome, confidence, entities, decision_maker, valid_from, valid_until` |
55
+ | `CausalChainAnalyzer` | Takes `graph_store=` kwarg. No `trace_causes()` — use `get_causal_chain(direction="upstream")` |
56
+ | `ExplanationGenerator` | No `explain_decision/fact/inference` — use `generate_explanation(reasoning)`, `show_reasoning_path(reasoning)`, `justify_conclusion(conclusion, path)` |
57
+ | `DecisionQuery` | No `.query()` — use `find_by_entity`, `find_by_category`, `find_by_time_range`, `multi_hop_reasoning` |
58
+ | `SimilarityCalculator` | `cosine_similarity(vector1, vector2)` — two required positional args |
59
+ | `NodeEmbedder` | `compute_embeddings(graph_store, node_labels, relationship_types)` — all three positional, all required |
60
+ | `LinkPredictor` | `score_link(graph_store, node_id1, node_id2, method=)` |
61
+ | `PipelineValidator` | `validate(pipeline)` returns `ValidationResult` — never raises |
62
+ | `RDFExporter` | `export_to_rdf(data, format='turtle')` returns a string |
63
+ | Cache | `_result_cache.clear()` before every extraction |
64
+ | Graph store format | `DecisionQuery` and `CausalChainAnalyzer` need `{"records": [...]}` from graph store |
65
+
66
+ ## How to Help
67
+
68
+ 1. **Answer questions** with copy-paste-ready code that uses the correct method names
69
+ 2. **Review Alpha Semantic Hub code** — check against the invariants table above before suggesting anything
70
+ 3. **Suggest the right skill** — map user intent to `/alphasemantichub:*` skills
71
+ 4. **Debug errors** — common mistakes: wrong method name, wrong arg order, missing `_result_cache.clear()`, querying only one of `"decision"`/`"Decision"` types
72
+
73
+ Keep responses code-first. Show the full import path in every example.
@@ -0,0 +1,12 @@
1
+ {
2
+ "hooks": {
3
+ "PostToolUse": [
4
+ {"matcher": "Write|Edit", "hooks": [{"type": "command", "command": "FILE=$(jq -r .tool_input.file_path 2>/dev/null); if echo $FILE | grep -qE alphasemantichub/; then python -c 'import ast,sys; ast.parse(open(sys.argv[1]).read())' $FILE 2>&1; fi"}]},
5
+
6
+ {"matcher": "Write|Edit", "hooks": [{"type": "command", "command": "echo PostToolUse provenance check"}]}
7
+ ],
8
+ "PreToolUse": [
9
+ {"matcher": "Bash", "hooks": [{"type": "command", "command": "CMD=$(jq -r .tool_input.command 2>/dev/null); if echo $CMD | grep -q deduplication/methods; then echo WARNING: use DuplicateDetector directly >&2; fi"}]}
10
+ ]
11
+ }
12
+ }