cognigraph 0.4.0__tar.gz

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 (194) hide show
  1. cognigraph-0.4.0/.dockerignore +17 -0
  2. cognigraph-0.4.0/.github/FUNDING.yml +2 -0
  3. cognigraph-0.4.0/.github/workflows/ci.yml +67 -0
  4. cognigraph-0.4.0/.gitignore +48 -0
  5. cognigraph-0.4.0/CONTRIBUTING.md +73 -0
  6. cognigraph-0.4.0/Dockerfile +26 -0
  7. cognigraph-0.4.0/LICENSE +17 -0
  8. cognigraph-0.4.0/NOTICE +48 -0
  9. cognigraph-0.4.0/PKG-INFO +328 -0
  10. cognigraph-0.4.0/README.md +254 -0
  11. cognigraph-0.4.0/benchmarks/results/multigov/multigov_results.json +318 -0
  12. cognigraph-0.4.0/benchmarks/results/multigov/multigov_table.tex +15 -0
  13. cognigraph-0.4.0/benchmarks/results/multigov_bc/multigov_results.json +598 -0
  14. cognigraph-0.4.0/benchmarks/results/multigov_bc/multigov_table.tex +18 -0
  15. cognigraph-0.4.0/benchmarks/results/multigov_v2/ANALYSIS.md +77 -0
  16. cognigraph-0.4.0/benchmarks/results/multigov_v2/multigov_results.json +1188 -0
  17. cognigraph-0.4.0/benchmarks/results/multigov_v2/multigov_table.tex +21 -0
  18. cognigraph-0.4.0/benchmarks/results/multigov_v2_test/multigov_results.json +428 -0
  19. cognigraph-0.4.0/benchmarks/results/multigov_v2_test/multigov_table.tex +15 -0
  20. cognigraph-0.4.0/benchmarks/results/multigov_v3_semantic_sonnet46/cost_report.json +328 -0
  21. cognigraph-0.4.0/benchmarks/results/multigov_v3_semantic_sonnet46/multigov_results.json +1498 -0
  22. cognigraph-0.4.0/benchmarks/results/multigov_v3_semantic_sonnet46/multigov_table.tex +21 -0
  23. cognigraph-0.4.0/benchmarks/results/multigov_v3_sonnet46/cost_report.json +478 -0
  24. cognigraph-0.4.0/benchmarks/results/multigov_v3_sonnet46/multigov_results.json +1188 -0
  25. cognigraph-0.4.0/benchmarks/results/multigov_v3_sonnet46/multigov_table.tex +21 -0
  26. cognigraph-0.4.0/cognigraph/__init__.py +25 -0
  27. cognigraph-0.4.0/cognigraph/__version__.py +1 -0
  28. cognigraph-0.4.0/cognigraph/activation/__init__.py +20 -0
  29. cognigraph-0.4.0/cognigraph/activation/adaptive.py +217 -0
  30. cognigraph-0.4.0/cognigraph/activation/embeddings.py +200 -0
  31. cognigraph-0.4.0/cognigraph/activation/pcst.py +129 -0
  32. cognigraph-0.4.0/cognigraph/activation/relevance.py +125 -0
  33. cognigraph-0.4.0/cognigraph/adapters/__init__.py +14 -0
  34. cognigraph-0.4.0/cognigraph/adapters/auto_select.py +123 -0
  35. cognigraph-0.4.0/cognigraph/adapters/config.py +57 -0
  36. cognigraph-0.4.0/cognigraph/adapters/hub.py +99 -0
  37. cognigraph-0.4.0/cognigraph/adapters/loader.py +110 -0
  38. cognigraph-0.4.0/cognigraph/adapters/registry.py +85 -0
  39. cognigraph-0.4.0/cognigraph/agents/__init__.py +4 -0
  40. cognigraph-0.4.0/cognigraph/agents/base_agent.py +32 -0
  41. cognigraph-0.4.0/cognigraph/agents/slm_agent.py +53 -0
  42. cognigraph-0.4.0/cognigraph/backends/__init__.py +15 -0
  43. cognigraph-0.4.0/cognigraph/backends/api.py +467 -0
  44. cognigraph-0.4.0/cognigraph/backends/base.py +41 -0
  45. cognigraph-0.4.0/cognigraph/backends/fallback.py +98 -0
  46. cognigraph-0.4.0/cognigraph/backends/llamacpp_backend.py +117 -0
  47. cognigraph-0.4.0/cognigraph/backends/local.py +97 -0
  48. cognigraph-0.4.0/cognigraph/backends/mock.py +69 -0
  49. cognigraph-0.4.0/cognigraph/backends/registry.py +98 -0
  50. cognigraph-0.4.0/cognigraph/backends/vllm_backend.py +127 -0
  51. cognigraph-0.4.0/cognigraph/benchmarks/__init__.py +1 -0
  52. cognigraph-0.4.0/cognigraph/benchmarks/benchmark_runner.py +749 -0
  53. cognigraph-0.4.0/cognigraph/benchmarks/eu_regqa.py +256 -0
  54. cognigraph-0.4.0/cognigraph/benchmarks/hotpotqa_loader.py +146 -0
  55. cognigraph-0.4.0/cognigraph/benchmarks/multi_governance_benchmark.py +649 -0
  56. cognigraph-0.4.0/cognigraph/benchmarks/multi_governance_kg.py +1697 -0
  57. cognigraph-0.4.0/cognigraph/benchmarks/run_multigov.py +136 -0
  58. cognigraph-0.4.0/cognigraph/benchmarks/run_multigov_v2.py +422 -0
  59. cognigraph-0.4.0/cognigraph/benchmarks/run_multigov_v3.py +644 -0
  60. cognigraph-0.4.0/cognigraph/cli/__init__.py +0 -0
  61. cognigraph-0.4.0/cognigraph/cli/commands/__init__.py +0 -0
  62. cognigraph-0.4.0/cognigraph/cli/commands/init.py +878 -0
  63. cognigraph-0.4.0/cognigraph/cli/commands/scan.py +992 -0
  64. cognigraph-0.4.0/cognigraph/cli/main.py +420 -0
  65. cognigraph-0.4.0/cognigraph/config/__init__.py +3 -0
  66. cognigraph-0.4.0/cognigraph/config/settings.py +138 -0
  67. cognigraph-0.4.0/cognigraph/connectors/__init__.py +12 -0
  68. cognigraph-0.4.0/cognigraph/connectors/base.py +28 -0
  69. cognigraph-0.4.0/cognigraph/connectors/json_graph.py +45 -0
  70. cognigraph-0.4.0/cognigraph/connectors/neo4j.py +114 -0
  71. cognigraph-0.4.0/cognigraph/connectors/networkx.py +81 -0
  72. cognigraph-0.4.0/cognigraph/connectors/tamr.py +256 -0
  73. cognigraph-0.4.0/cognigraph/core/__init__.py +31 -0
  74. cognigraph-0.4.0/cognigraph/core/edge.py +65 -0
  75. cognigraph-0.4.0/cognigraph/core/graph.py +431 -0
  76. cognigraph-0.4.0/cognigraph/core/message.py +77 -0
  77. cognigraph-0.4.0/cognigraph/core/node.py +375 -0
  78. cognigraph-0.4.0/cognigraph/core/observer_report.py +213 -0
  79. cognigraph-0.4.0/cognigraph/core/state.py +80 -0
  80. cognigraph-0.4.0/cognigraph/core/types.py +135 -0
  81. cognigraph-0.4.0/cognigraph/domains/__init__.py +0 -0
  82. cognigraph-0.4.0/cognigraph/evaluation/__init__.py +0 -0
  83. cognigraph-0.4.0/cognigraph/inference/__init__.py +0 -0
  84. cognigraph-0.4.0/cognigraph/learning/__init__.py +3 -0
  85. cognigraph-0.4.0/cognigraph/learning/graph_learner.py +303 -0
  86. cognigraph-0.4.0/cognigraph/licensing/__init__.py +44 -0
  87. cognigraph-0.4.0/cognigraph/licensing/keygen.py +85 -0
  88. cognigraph-0.4.0/cognigraph/licensing/manager.py +393 -0
  89. cognigraph-0.4.0/cognigraph/ontology/__init__.py +40 -0
  90. cognigraph-0.4.0/cognigraph/ontology/constraint_graph.py +241 -0
  91. cognigraph-0.4.0/cognigraph/ontology/domain_registry.py +178 -0
  92. cognigraph-0.4.0/cognigraph/ontology/domains/__init__.py +1 -0
  93. cognigraph-0.4.0/cognigraph/ontology/domains/governance.py +481 -0
  94. cognigraph-0.4.0/cognigraph/ontology/domains/governance_v3.py +535 -0
  95. cognigraph-0.4.0/cognigraph/ontology/ontology_generator.py +239 -0
  96. cognigraph-0.4.0/cognigraph/ontology/router.py +146 -0
  97. cognigraph-0.4.0/cognigraph/ontology/semantic_shacl_gate.py +522 -0
  98. cognigraph-0.4.0/cognigraph/ontology/shacl_gate.py +210 -0
  99. cognigraph-0.4.0/cognigraph/ontology/skill_resolver.py +118 -0
  100. cognigraph-0.4.0/cognigraph/ontology/upper.py +125 -0
  101. cognigraph-0.4.0/cognigraph/optimization/__init__.py +0 -0
  102. cognigraph-0.4.0/cognigraph/optimization/message_compressor.py +132 -0
  103. cognigraph-0.4.0/cognigraph/optimization/token_optimizer.py +197 -0
  104. cognigraph-0.4.0/cognigraph/orchestration/__init__.py +13 -0
  105. cognigraph-0.4.0/cognigraph/orchestration/aggregation.py +188 -0
  106. cognigraph-0.4.0/cognigraph/orchestration/async_protocol.py +222 -0
  107. cognigraph-0.4.0/cognigraph/orchestration/convergence.py +164 -0
  108. cognigraph-0.4.0/cognigraph/orchestration/debate.py +223 -0
  109. cognigraph-0.4.0/cognigraph/orchestration/explanation.py +167 -0
  110. cognigraph-0.4.0/cognigraph/orchestration/hierarchical.py +164 -0
  111. cognigraph-0.4.0/cognigraph/orchestration/message_passing.py +166 -0
  112. cognigraph-0.4.0/cognigraph/orchestration/observer.py +570 -0
  113. cognigraph-0.4.0/cognigraph/orchestration/orchestrator.py +334 -0
  114. cognigraph-0.4.0/cognigraph/orchestration/streaming.py +137 -0
  115. cognigraph-0.4.0/cognigraph/plugins/__init__.py +4 -0
  116. cognigraph-0.4.0/cognigraph/plugins/mcp_dev_server.py +1214 -0
  117. cognigraph-0.4.0/cognigraph/plugins/mcp_server.py +410 -0
  118. cognigraph-0.4.0/cognigraph/prompts/__init__.py +0 -0
  119. cognigraph-0.4.0/cognigraph/py.typed +0 -0
  120. cognigraph-0.4.0/cognigraph/server/__init__.py +0 -0
  121. cognigraph-0.4.0/cognigraph/server/app.py +255 -0
  122. cognigraph-0.4.0/cognigraph/server/middleware.py +186 -0
  123. cognigraph-0.4.0/cognigraph/server/models.py +66 -0
  124. cognigraph-0.4.0/cognigraph/watchers/__init__.py +0 -0
  125. cognigraph-0.4.0/cognigraph.example.yaml +29 -0
  126. cognigraph-0.4.0/demo_kg.json +291 -0
  127. cognigraph-0.4.0/docker-compose.yml +37 -0
  128. cognigraph-0.4.0/docs/mcp-setup.md +343 -0
  129. cognigraph-0.4.0/docs/website/index.html +888 -0
  130. cognigraph-0.4.0/examples/quickstart.py +115 -0
  131. cognigraph-0.4.0/pyproject.toml +114 -0
  132. cognigraph-0.4.0/tests/__init__.py +0 -0
  133. cognigraph-0.4.0/tests/conftest.py +65 -0
  134. cognigraph-0.4.0/tests/test_activation/__init__.py +0 -0
  135. cognigraph-0.4.0/tests/test_activation/test_adaptive.py +217 -0
  136. cognigraph-0.4.0/tests/test_activation/test_pcst.py +51 -0
  137. cognigraph-0.4.0/tests/test_adapters/__init__.py +0 -0
  138. cognigraph-0.4.0/tests/test_adapters/test_adapter_config.py +87 -0
  139. cognigraph-0.4.0/tests/test_adapters/test_auto_select.py +123 -0
  140. cognigraph-0.4.0/tests/test_agents/__init__.py +0 -0
  141. cognigraph-0.4.0/tests/test_agents/test_slm_agent.py +71 -0
  142. cognigraph-0.4.0/tests/test_backends/__init__.py +0 -0
  143. cognigraph-0.4.0/tests/test_backends/test_error_scenarios.py +367 -0
  144. cognigraph-0.4.0/tests/test_backends/test_mock.py +36 -0
  145. cognigraph-0.4.0/tests/test_backends/test_registry.py +48 -0
  146. cognigraph-0.4.0/tests/test_benchmarks/__init__.py +0 -0
  147. cognigraph-0.4.0/tests/test_benchmarks/test_constrained_f1.py +104 -0
  148. cognigraph-0.4.0/tests/test_benchmarks/test_metrics.py +207 -0
  149. cognigraph-0.4.0/tests/test_cli/__init__.py +0 -0
  150. cognigraph-0.4.0/tests/test_cli/test_init.py +440 -0
  151. cognigraph-0.4.0/tests/test_cli/test_scan.py +511 -0
  152. cognigraph-0.4.0/tests/test_connectors/__init__.py +0 -0
  153. cognigraph-0.4.0/tests/test_connectors/test_json_graph.py +68 -0
  154. cognigraph-0.4.0/tests/test_connectors/test_tamr.py +157 -0
  155. cognigraph-0.4.0/tests/test_core/__init__.py +0 -0
  156. cognigraph-0.4.0/tests/test_core/test_edge.py +50 -0
  157. cognigraph-0.4.0/tests/test_core/test_graph.py +70 -0
  158. cognigraph-0.4.0/tests/test_core/test_message.py +58 -0
  159. cognigraph-0.4.0/tests/test_core/test_node.py +64 -0
  160. cognigraph-0.4.0/tests/test_integration/__init__.py +0 -0
  161. cognigraph-0.4.0/tests/test_integration/test_end_to_end.py +139 -0
  162. cognigraph-0.4.0/tests/test_integration/test_ollama_e2e.py +135 -0
  163. cognigraph-0.4.0/tests/test_integration/test_phase3.py +79 -0
  164. cognigraph-0.4.0/tests/test_learning/__init__.py +0 -0
  165. cognigraph-0.4.0/tests/test_learning/test_graph_learner.py +296 -0
  166. cognigraph-0.4.0/tests/test_licensing/__init__.py +0 -0
  167. cognigraph-0.4.0/tests/test_licensing/test_keygen.py +130 -0
  168. cognigraph-0.4.0/tests/test_licensing/test_manager.py +566 -0
  169. cognigraph-0.4.0/tests/test_ontology/__init__.py +0 -0
  170. cognigraph-0.4.0/tests/test_ontology/test_constraint_graph.py +119 -0
  171. cognigraph-0.4.0/tests/test_ontology/test_governance_v3.py +100 -0
  172. cognigraph-0.4.0/tests/test_ontology/test_ontology_generator.py +169 -0
  173. cognigraph-0.4.0/tests/test_ontology/test_registry.py +163 -0
  174. cognigraph-0.4.0/tests/test_ontology/test_router.py +97 -0
  175. cognigraph-0.4.0/tests/test_ontology/test_semantic_shacl_gate.py +348 -0
  176. cognigraph-0.4.0/tests/test_ontology/test_shacl_gate.py +135 -0
  177. cognigraph-0.4.0/tests/test_ontology/test_skill_resolver.py +99 -0
  178. cognigraph-0.4.0/tests/test_ontology/test_upper.py +87 -0
  179. cognigraph-0.4.0/tests/test_optimization/__init__.py +0 -0
  180. cognigraph-0.4.0/tests/test_optimization/test_token_optimizer.py +122 -0
  181. cognigraph-0.4.0/tests/test_orchestration/__init__.py +0 -0
  182. cognigraph-0.4.0/tests/test_orchestration/test_async_protocol.py +75 -0
  183. cognigraph-0.4.0/tests/test_orchestration/test_convergence.py +51 -0
  184. cognigraph-0.4.0/tests/test_orchestration/test_debate.py +46 -0
  185. cognigraph-0.4.0/tests/test_orchestration/test_explanation.py +103 -0
  186. cognigraph-0.4.0/tests/test_orchestration/test_hierarchical.py +44 -0
  187. cognigraph-0.4.0/tests/test_orchestration/test_message_passing.py +47 -0
  188. cognigraph-0.4.0/tests/test_orchestration/test_observer.py +203 -0
  189. cognigraph-0.4.0/tests/test_orchestration/test_streaming.py +61 -0
  190. cognigraph-0.4.0/tests/test_plugins/__init__.py +0 -0
  191. cognigraph-0.4.0/tests/test_plugins/test_mcp_dev_server.py +499 -0
  192. cognigraph-0.4.0/tests/test_plugins/test_mcp_server.py +323 -0
  193. cognigraph-0.4.0/tests/test_server/__init__.py +0 -0
  194. cognigraph-0.4.0/tests/test_server/test_middleware.py +102 -0
@@ -0,0 +1,17 @@
1
+ __pycache__
2
+ *.pyc
3
+ *.pyo
4
+ .pytest_cache
5
+ .mypy_cache
6
+ .ruff_cache
7
+ *.egg-info
8
+ dist/
9
+ build/
10
+ .git
11
+ .github
12
+ tests/
13
+ docs/
14
+ *.md
15
+ !README.md
16
+ .env
17
+ .env.*
@@ -0,0 +1,2 @@
1
+ github: quantamixsol
2
+ custom: ["https://cognigraph.dev/pricing"]
@@ -0,0 +1,67 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ tags: ["v*"]
7
+ pull_request:
8
+ branches: [master]
9
+
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ python-version: ["3.10", "3.11", "3.12"]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install dependencies
26
+ run: |
27
+ python -m pip install --upgrade pip
28
+ pip install -e ".[dev]"
29
+
30
+ - name: Lint with ruff
31
+ run: ruff check cognigraph/ tests/
32
+
33
+ - name: Run tests with coverage
34
+ run: pytest --cov=cognigraph --cov-report=xml --cov-report=term -q
35
+
36
+ - name: Upload coverage report
37
+ if: matrix.python-version == '3.12'
38
+ uses: actions/upload-artifact@v4
39
+ with:
40
+ name: coverage-report
41
+ path: coverage.xml
42
+
43
+ publish:
44
+ needs: test
45
+ runs-on: ubuntu-latest
46
+ if: startsWith(github.ref, 'refs/tags/v')
47
+ permissions:
48
+ id-token: write
49
+
50
+ steps:
51
+ - uses: actions/checkout@v4
52
+
53
+ - name: Set up Python
54
+ uses: actions/setup-python@v5
55
+ with:
56
+ python-version: "3.12"
57
+
58
+ - name: Install build tools
59
+ run: python -m pip install --upgrade pip build
60
+
61
+ - name: Build package
62
+ run: python -m build
63
+
64
+ - name: Publish to PyPI
65
+ uses: pypa/gh-action-pypi-publish@release/v1
66
+ with:
67
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,48 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ *.egg
9
+
10
+ # Virtual environments
11
+ .venv/
12
+ venv/
13
+ env/
14
+
15
+ # IDE
16
+ .vscode/
17
+ .idea/
18
+ *.swp
19
+ *.swo
20
+
21
+ # Testing
22
+ .pytest_cache/
23
+ .coverage
24
+ htmlcov/
25
+ .mypy_cache/
26
+ .ruff_cache/
27
+
28
+ # OS
29
+ .DS_Store
30
+ Thumbs.db
31
+
32
+ # Environment
33
+ .env
34
+ .env.local
35
+ .env.*.local
36
+
37
+ # Traces
38
+ traces/
39
+
40
+ # Benchmark data (large files)
41
+ cognigraph/benchmarks/data/
42
+ benchmarks/data/
43
+
44
+ # Results (regeneratable)
45
+ cognigraph/benchmarks/results/
46
+
47
+ # Benchmark logs
48
+ *.log
@@ -0,0 +1,73 @@
1
+ # Contributing to CogniGraph
2
+
3
+ Thanks for your interest in contributing. Here's how to get started.
4
+
5
+ ## Development Setup
6
+
7
+ ```bash
8
+ # Clone the repo
9
+ git clone https://github.com/quantamixsol/cognigraph.git
10
+ cd cognigraph
11
+
12
+ # Create a virtual environment
13
+ python -m venv .venv
14
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
15
+
16
+ # Install in development mode
17
+ pip install -e ".[dev]"
18
+ ```
19
+
20
+ ## Running Tests
21
+
22
+ ```bash
23
+ # Full test suite
24
+ pytest tests/ -v
25
+
26
+ # With coverage
27
+ pytest tests/ --cov=cognigraph --cov-report=term-missing
28
+
29
+ # Single test file
30
+ pytest tests/test_activation.py -v
31
+ ```
32
+
33
+ ## Code Style
34
+
35
+ We use **ruff** for linting and formatting:
36
+
37
+ ```bash
38
+ # Check
39
+ ruff check cognigraph/
40
+ ruff format --check cognigraph/
41
+
42
+ # Auto-fix
43
+ ruff check --fix cognigraph/
44
+ ruff format cognigraph/
45
+ ```
46
+
47
+ All PRs must pass `ruff check` and `ruff format --check` with zero errors.
48
+
49
+ ## Pull Request Process
50
+
51
+ 1. **Fork** the repo and create a feature branch from `main`
52
+ 2. **Write tests** for any new functionality
53
+ 3. **Run the full test suite** — all 332 tests must pass
54
+ 4. **Run ruff** — zero lint errors, zero format issues
55
+ 5. **Write a clear PR description** — what changed and why
56
+ 6. Submit the PR and wait for review
57
+
58
+ ## What We're Looking For
59
+
60
+ - Bug fixes with regression tests
61
+ - New backend integrations
62
+ - Performance improvements with benchmarks
63
+ - Documentation improvements
64
+
65
+ ## What We Won't Accept
66
+
67
+ - Changes that break existing tests
68
+ - Features without tests
69
+ - PRs that modify patent-protected innovation modules without prior discussion
70
+
71
+ ## Questions?
72
+
73
+ Open an issue on GitHub. We'll respond within a few days.
@@ -0,0 +1,26 @@
1
+ FROM python:3.11-slim AS base
2
+
3
+ WORKDIR /app
4
+
5
+ # Install system dependencies
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ build-essential \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ # Copy package files
11
+ COPY pyproject.toml README.md LICENSE ./
12
+ COPY cognigraph/ cognigraph/
13
+
14
+ # Install cognigraph with server extras
15
+ RUN pip install --no-cache-dir ".[server,api]"
16
+
17
+ # Default config and graph placeholders
18
+ COPY cognigraph.example.yaml /app/cognigraph.yaml
19
+
20
+ EXPOSE 8000
21
+
22
+ # Health check
23
+ HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
24
+ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
25
+
26
+ CMD ["kogni", "serve", "--host", "0.0.0.0", "--port", "8000"]
@@ -0,0 +1,17 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2026 Quantamix Solutions B.V.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
@@ -0,0 +1,48 @@
1
+ CogniGraph — Governed Intelligence through Graph-of-Agents Reasoning
2
+ Copyright 2026 Quantamix Solutions B.V.
3
+
4
+ INTELLECTUAL PROPERTY NOTICE
5
+ ============================
6
+
7
+ This software implements methods described in:
8
+
9
+ European Patent Application EP26162901.8
10
+ "Method and system for trust-aware multi-signal document retrieval
11
+ with graph-based compliance scoring and gap attribution for
12
+ regulatory AI systems"
13
+ Filed: 6 March 2026
14
+ Applicant: Quantamix Solutions B.V.
15
+ Inventor: Harish Kumar
16
+
17
+ The following components are covered by the patent claims:
18
+
19
+ - Prize-Collecting Steiner Tree (PCST) activation for subgraph selection
20
+ - TRACE score computation (Trust, Relevance, Accuracy, Completeness, Evidence)
21
+ - Gap attribution scoring for regulatory compliance
22
+ - TAMRConnector integration pipeline (TRACE priors -> PCST activation)
23
+
24
+ OPEN SOURCE LICENSE
25
+ ===================
26
+
27
+ The CogniGraph SDK source code is licensed under the Apache License 2.0.
28
+ You may use, modify, and distribute this software in accordance with the
29
+ Apache 2.0 license terms.
30
+
31
+ The patent rights are separately held. Use of the patented methods in
32
+ commercial products or services may require a separate patent license
33
+ from Quantamix Solutions B.V. Contact: harish.kumar@quantamixsolutions.com
34
+
35
+ ACADEMIC AND RESEARCH USE
36
+ =========================
37
+
38
+ Academic and non-commercial research use of all components, including
39
+ patented methods, is permitted without additional licensing.
40
+
41
+ CITATION
42
+ ========
43
+
44
+ If you use CogniGraph in academic work, please cite:
45
+
46
+ H. Kumar, "CogniGraph: Governed Intelligence through Graph-of-Agents
47
+ Reasoning over Knowledge Graph Topologies with Semantic SHACL Validation,"
48
+ arXiv preprint, March 2026. Quantamix Solutions B.V.
@@ -0,0 +1,328 @@
1
+ Metadata-Version: 2.4
2
+ Name: cognigraph
3
+ Version: 0.4.0
4
+ Summary: Self-governing development for Claude Code — graph-of-agents reasoning with 13 innovations, GCC/GSD/Ralph protocols, and MCP integration
5
+ Project-URL: Homepage, https://cognigraph.dev
6
+ Project-URL: Documentation, https://github.com/quantamixsol/cognigraph#readme
7
+ Project-URL: Repository, https://github.com/quantamixsol/cognigraph
8
+ Project-URL: Changelog, https://github.com/quantamixsol/cognigraph/releases
9
+ Project-URL: Bug Tracker, https://github.com/quantamixsol/cognigraph/issues
10
+ Author-email: Harish Kumar <harish.kumar@quantamixsolutions.com>
11
+ License-Expression: Apache-2.0
12
+ License-File: LICENSE
13
+ License-File: NOTICE
14
+ Keywords: adaptive-activation,bayesian-learning,claude-code,development-tools,distributed-reasoning,gcc,governance,graph-of-agents,gsd,knowledge-graph,lora,mcp,multi-agent,ontology,owl,pcst,reasoning,regulatory-ai,self-governing,shacl,slm
15
+ Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: Science/Research
18
+ Classifier: License :: OSI Approved :: Apache Software License
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Requires-Python: >=3.10
25
+ Requires-Dist: networkx>=3.0
26
+ Requires-Dist: numpy>=1.24
27
+ Requires-Dist: pydantic-settings>=2.0
28
+ Requires-Dist: pydantic>=2.0
29
+ Requires-Dist: pyyaml>=6.0
30
+ Requires-Dist: rich>=13.0
31
+ Requires-Dist: typer[all]>=0.9
32
+ Provides-Extra: all
33
+ Requires-Dist: anthropic>=0.18; extra == 'all'
34
+ Requires-Dist: boto3>=1.28; extra == 'all'
35
+ Requires-Dist: fastapi>=0.100; extra == 'all'
36
+ Requires-Dist: httpx>=0.25; extra == 'all'
37
+ Requires-Dist: neo4j>=5.0; extra == 'all'
38
+ Requires-Dist: openai>=1.0; extra == 'all'
39
+ Requires-Dist: peft>=0.7; extra == 'all'
40
+ Requires-Dist: sentence-transformers>=2.2; extra == 'all'
41
+ Requires-Dist: torch>=2.0; extra == 'all'
42
+ Requires-Dist: transformers>=4.35; extra == 'all'
43
+ Requires-Dist: uvicorn[standard]>=0.20; extra == 'all'
44
+ Requires-Dist: vllm>=0.3; extra == 'all'
45
+ Provides-Extra: api
46
+ Requires-Dist: anthropic>=0.18; extra == 'api'
47
+ Requires-Dist: boto3>=1.28; extra == 'api'
48
+ Requires-Dist: httpx>=0.25; extra == 'api'
49
+ Requires-Dist: openai>=1.0; extra == 'api'
50
+ Provides-Extra: cpu
51
+ Requires-Dist: llama-cpp-python>=0.2; extra == 'cpu'
52
+ Requires-Dist: sentence-transformers>=2.2; extra == 'cpu'
53
+ Provides-Extra: dev
54
+ Requires-Dist: coverage>=7.0; extra == 'dev'
55
+ Requires-Dist: mypy>=1.0; extra == 'dev'
56
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
57
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
58
+ Requires-Dist: pytest-env>=1.0; extra == 'dev'
59
+ Requires-Dist: pytest-mock>=3.10; extra == 'dev'
60
+ Requires-Dist: pytest>=7.0; extra == 'dev'
61
+ Requires-Dist: ruff>=0.1; extra == 'dev'
62
+ Provides-Extra: gpu
63
+ Requires-Dist: peft>=0.7; extra == 'gpu'
64
+ Requires-Dist: sentence-transformers>=2.2; extra == 'gpu'
65
+ Requires-Dist: torch>=2.0; extra == 'gpu'
66
+ Requires-Dist: transformers>=4.35; extra == 'gpu'
67
+ Requires-Dist: vllm>=0.3; extra == 'gpu'
68
+ Provides-Extra: neo4j
69
+ Requires-Dist: neo4j>=5.0; extra == 'neo4j'
70
+ Provides-Extra: server
71
+ Requires-Dist: fastapi>=0.100; extra == 'server'
72
+ Requires-Dist: uvicorn[standard]>=0.20; extra == 'server'
73
+ Description-Content-Type: text/markdown
74
+
75
+ <div align="center">
76
+
77
+ # CogniGraph
78
+
79
+ ### Graphs That Think — Self-Governing Development for Claude Code
80
+
81
+ Turn any codebase into a governed, self-improving reasoning network.<br/>
82
+ One command. Full governance. Zero cloud infrastructure.
83
+
84
+ [![PyPI version](https://badge.fury.io/py/cognigraph.svg)](https://pypi.org/project/cognigraph/)
85
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
86
+ [![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
87
+ [![Tests: 332 passing](https://img.shields.io/badge/tests-332%20passing-brightgreen.svg)]()
88
+ [![MCP Compatible](https://img.shields.io/badge/MCP-compatible-8A2BE2.svg)]()
89
+ [![Patent: EP26162901.8](https://img.shields.io/badge/patent-EP26162901.8-orange.svg)](NOTICE)
90
+
91
+ </div>
92
+
93
+ ---
94
+
95
+ > **What if your development environment learned from every mistake and never repeated one?**
96
+ >
97
+ > CogniGraph is the first self-governing development tool. It transforms any knowledge graph into a reasoning network where each node is an autonomous LLM agent — then wraps your Claude Code sessions in structured protocols that enforce spec-before-code, atomic commits, and autonomous fix-test-fix loops. Install it, run `kogni init`, and your dev environment starts getting smarter every session.
98
+
99
+ ---
100
+
101
+ ## Quick Start
102
+
103
+ ```bash
104
+ pip install cognigraph[api]
105
+ cd your-project
106
+ kogni init
107
+ ```
108
+
109
+ That's it. CogniGraph scans your repo, builds a knowledge graph, creates a governed `CLAUDE.md`, and registers an MCP server. Open Claude Code and you're running with:
110
+
111
+ - **GCC** — session continuity, branch management, auto-commits
112
+ - **GSD** — structured DISCUSS → PLAN → EXECUTE → VERIFY workflow
113
+ - **Ralph Loop** — autonomous fix-test-fix iteration with safety guards
114
+ - **MCP tools** — governed graph reasoning inside Claude Code
115
+
116
+ No cloud account. No infrastructure. Your machine, your API keys, your data.
117
+
118
+ ---
119
+
120
+ ## What You Get
121
+
122
+ | Tool | What it does |
123
+ |------|-------------|
124
+ | `kogni init` | Scans repo, builds KG, injects governance protocols into CLAUDE.md |
125
+ | `kogni_context` | 500-token focused context for any entity (replaces 20-60K brute-force loading) |
126
+ | `kogni_reason` | Governed multi-agent reasoning over your knowledge graph |
127
+ | `kogni_inspect` | Graph structure inspection — nodes, edges, hubs, types |
128
+ | `kogni_search` | Semantic search across all KG nodes |
129
+ | `kogni run` | CLI reasoning query against any graph |
130
+ | `kogni serve` | REST API server with API key auth |
131
+
132
+ ---
133
+
134
+ ## How It Works
135
+
136
+ ```
137
+ pip install → kogni init → Claude Code opens → MCP tools available
138
+
139
+ GCC protocols injected
140
+ (session memory, branch management, auto-commits)
141
+
142
+ GSD workflow active
143
+ (spec before code, atomic commits, verification)
144
+
145
+ Ralph Loop ready
146
+ (autonomous iteration with binary criteria)
147
+
148
+ Graph learns from every session
149
+ (Bayesian edge updates, convergence tracking)
150
+ ```
151
+
152
+ ---
153
+
154
+ ## 13 Patent-Protected Innovations
155
+
156
+ | # | Innovation | Module |
157
+ |---|-----------|--------|
158
+ | 1 | **PCST Activation** — sublinear subgraph selection | `cognigraph.activation.pcst` |
159
+ | 2 | **MasterObserver** — zero-cost transparency layer | `cognigraph.orchestration.observer` |
160
+ | 3 | **Convergent Message Passing** — similarity-based termination | `cognigraph.orchestration.convergence` |
161
+ | 4 | **Backend Fallback Chain** — heterogeneous inference with cost budgets | `cognigraph.backends.fallback` |
162
+ | 5 | **Hierarchical Aggregation** — centrality-based topology-aware synthesis | `cognigraph.orchestration.aggregation` |
163
+ | 6 | **SemanticSHACLGate** — 3-layer OWL-aware governance | `cognigraph.ontology.semantic_shacl_gate` |
164
+ | 7 | **Constrained F1** — joint answer quality + governance metric | `cognigraph.benchmarks.constrained_f1` |
165
+ | 8 | **OntologyGenerator** — automated OWL+SHACL from regulation text | `cognigraph.ontology.generator` |
166
+ | 9 | **Adaptive Activation** — dynamic Kmax from query complexity | `cognigraph.activation.adaptive` |
167
+ | 10 | **Online Graph Learning** — Bayesian edge weight updates | `cognigraph.learning.graph_learner` |
168
+ | 11 | **LoRA Auto-Selection** — per-entity adapter matching | `cognigraph.adapters.auto_select` |
169
+ | 12 | **TAMR+ Connector** — retrieval-to-reasoning pipeline | `cognigraph.connectors.tamr` |
170
+ | 13 | **MCP Plugin** — governed context engineering for Claude Code | `cognigraph.plugins.mcp_server` |
171
+
172
+ ---
173
+
174
+ ## The Three Protocols
175
+
176
+ ### GCC — Global Context Controller
177
+
178
+ Your Claude Code sessions have memory now. GCC gives every session structured continuity:
179
+
180
+ ```
181
+ Session starts → reads last commit + branch state (~700 tokens)
182
+ Work happens → auto-commits every 30 minutes
183
+ Session ends → checkpoints progress, clears session log
184
+ Next session → resumes in under 60 seconds from last checkpoint
185
+ ```
186
+
187
+ No more re-explaining your codebase. No more lost context between sessions.
188
+
189
+ ### GSD — Get Shit Done
190
+
191
+ Spec before code. Every significant feature follows a structured workflow:
192
+
193
+ ```
194
+ DISCUSS → What problem? What constraints? What's in scope?
195
+ PLAN → Atomic tasks, dependency graph, verification criteria
196
+ EXECUTE → One task = one commit, tests pass before moving on
197
+ VERIFY → 3-source check: evidence vs plan vs success criteria
198
+ ```
199
+
200
+ Scope creep gets captured in "deferred" — never mid-sprint.
201
+
202
+ ### Ralph Loop — Autonomous Iteration
203
+
204
+ Feed a task with binary completion criteria. Ralph works until done or blocked:
205
+
206
+ ```python
207
+ # Binary criteria: "All tests pass. Build succeeds. No console errors."
208
+ # Ralph iterates: fix → test → check → fix → test → check → DONE
209
+ # Safety: max 20 iterations, no force-push, no deploy to main
210
+ ```
211
+
212
+ Each iteration produces a GCC commit. If blocked after N attempts, Ralph stops and reports what it tried.
213
+
214
+ ---
215
+
216
+ ## Backends
217
+
218
+ | Backend | Models | Install |
219
+ |---------|--------|---------|
220
+ | **Anthropic** | Claude Haiku / Sonnet / Opus | `pip install cognigraph[api]` |
221
+ | **OpenAI** | GPT-4o / GPT-4o-mini | `pip install cognigraph[api]` |
222
+ | **AWS Bedrock** | Any Bedrock model | `pip install cognigraph[api]` |
223
+ | **Ollama** | Any local model | `pip install cognigraph[api]` |
224
+ | **vLLM** | GPU inference + LoRA | `pip install cognigraph[gpu]` |
225
+ | **llama.cpp** | CPU GGUF models | `pip install cognigraph[cpu]` |
226
+
227
+ Smart routing sends complex queries to capable models and simple queries to cheap ones — all within your cost budget.
228
+
229
+ ```python
230
+ from cognigraph.backends.fallback import BackendFallbackChain
231
+
232
+ chain = BackendFallbackChain([
233
+ AnthropicBackend(model="claude-haiku-4-5-20251001"),
234
+ OllamaBackend(model="qwen2.5:0.5b"),
235
+ ])
236
+ # Tries Anthropic first → falls back to local Ollama automatically
237
+ ```
238
+
239
+ ---
240
+
241
+ ## Free vs Pro
242
+
243
+ | Feature | Free | Pro |
244
+ |---------|------|-----|
245
+ | Innovations 1-5 (PCST, Observer, Convergence, Fallback, Aggregation) | Yes | Yes |
246
+ | Innovations 6-13 (SemanticSHACL, Graph Learning, LoRA, TAMR+, MCP) | — | Yes |
247
+ | GCC / GSD / Ralph protocols | Yes | Yes |
248
+ | `kogni init` + CLAUDE.md generation | Yes | Yes |
249
+ | MCP tools (context, reason, inspect, search) | Basic | Full |
250
+ | Online graph learning (Bayesian edge updates) | — | Yes |
251
+ | SemanticSHACLGate governance | — | Yes |
252
+ | LoRA auto-selection | — | Yes |
253
+ | REST API server | Yes | Yes |
254
+ | Commercial use | Yes | Yes |
255
+
256
+ ---
257
+
258
+ ## Governance
259
+
260
+ The **SemanticSHACLGate** enforces 3-layer semantic validation on every reasoning output:
261
+
262
+ 1. **Framework Fidelity** — agents cite correct regulatory frameworks
263
+ 2. **Scope Boundary** — responses stay within assigned domain
264
+ 3. **Cross-Reference Integrity** — proper attribution for cross-framework mentions
265
+
266
+ **MultiGov-30 benchmark: 99.7% governance accuracy** (FF: 100%, SB: 100%, CR: 98.3%).
267
+
268
+ ---
269
+
270
+ ## Benchmarks
271
+
272
+ | Metric | CogniGraph | Single-Agent Baseline | Improvement |
273
+ |--------|-----------|----------------------|-------------|
274
+ | Constrained F1 | **0.757** | 0.328 | **+131%** |
275
+ | Governance Accuracy | **99.7%** | N/A | — |
276
+ | Token Efficiency | **500 tokens/query** | 20-60K tokens | **40-120x** |
277
+
278
+ ---
279
+
280
+ ## Python API
281
+
282
+ ```python
283
+ from cognigraph import CogniGraph
284
+ from cognigraph.backends.api import AnthropicBackend
285
+
286
+ graph = CogniGraph.from_json("knowledge_graph.json")
287
+ graph.set_default_backend(AnthropicBackend(model="claude-haiku-4-5-20251001"))
288
+
289
+ result = graph.reason("How does GDPR conflict with the AI Act?")
290
+ print(result.answer)
291
+ print(f"Confidence: {result.confidence:.2f}")
292
+ print(f"Governance: {result.governance_score:.3f}")
293
+ print(f"Cost: ${result.cost_usd:.4f}")
294
+ ```
295
+
296
+ ---
297
+
298
+ ## Patent & IP Notice
299
+
300
+ CogniGraph implements methods described in **European Patent Application EP26162901.8** (filed 6 March 2026, Quantamix Solutions B.V.). See [NOTICE](NOTICE) for full details.
301
+
302
+ Academic and research use is freely permitted under Apache 2.0.
303
+
304
+ ---
305
+
306
+ ## Citation
307
+
308
+ ```bibtex
309
+ @article{kumar2026cognigraph,
310
+ title = {CogniGraph: Governed Intelligence through Graph-of-Agents Reasoning
311
+ over Knowledge Graph Topologies with Semantic SHACL Validation},
312
+ author = {Kumar, Harish},
313
+ year = {2026},
314
+ institution = {Quantamix Solutions B.V.},
315
+ note = {European Patent Application EP26162901.8},
316
+ url = {https://github.com/quantamixsol/cognigraph}
317
+ }
318
+ ```
319
+
320
+ ---
321
+
322
+ ## Contributing
323
+
324
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, testing, and PR guidelines.
325
+
326
+ ## License
327
+
328
+ [Apache 2.0](LICENSE) — use it commercially, modify it freely, just keep the attribution.