groundworkers 0.12.0__tar.gz → 0.13.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 (349) hide show
  1. {groundworkers-0.12.0 → groundworkers-0.13.0}/PKG-INFO +2 -1
  2. {groundworkers-0.12.0 → groundworkers-0.13.0}/README.md +1 -0
  3. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/concepts.md +1 -1
  4. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/development/plugins.md +21 -2
  5. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/tools/embedding.md +3 -1
  6. groundworkers-0.13.0/docs/tools/knowledge.md +102 -0
  7. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/tools/mapping.md +7 -2
  8. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/tools/overview.md +1 -1
  9. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/tools/search.md +2 -0
  10. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/tools/system.md +15 -5
  11. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/usage/configuration.md +29 -12
  12. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/app.py +11 -3
  13. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/base/results.py +20 -1
  14. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/base/server.py +44 -7
  15. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/bootstrap.py +5 -7
  16. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/config.py +9 -4
  17. groundworkers-0.13.0/src/groundworkers/knowledge/packs/core/criteria-gate-yesno/guidance.md +16 -0
  18. groundworkers-0.13.0/src/groundworkers/knowledge/packs/core/criteria-gate-yesno/manifest.yaml +21 -0
  19. groundworkers-0.13.0/src/groundworkers/knowledge/packs/core/diagnosis-role-modifier/guidance.md +15 -0
  20. groundworkers-0.13.0/src/groundworkers/knowledge/packs/core/diagnosis-role-modifier/manifest.yaml +22 -0
  21. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/plugins.py +44 -21
  22. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/server.py +8 -6
  23. groundworkers-0.13.0/src/groundworkers/services/knowledge/__init__.py +33 -0
  24. groundworkers-0.13.0/src/groundworkers/services/knowledge/catalogue.py +293 -0
  25. groundworkers-0.13.0/src/groundworkers/services/knowledge/models.py +189 -0
  26. groundworkers-0.13.0/src/groundworkers/services/knowledge/slots.py +151 -0
  27. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/mapping.py +12 -1
  28. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/service.py +1 -1
  29. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/vocab.py +27 -14
  30. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tools/embedding_tools.py +38 -25
  31. groundworkers-0.13.0/src/groundworkers/tools/knowledge_tools.py +181 -0
  32. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tools/mapping_tools.py +20 -9
  33. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tools/system_tools.py +25 -17
  34. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/transports/rest/api.py +8 -4
  35. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/transports/rest/models.py +6 -1
  36. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/app.py +2 -1
  37. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/conftest.py +8 -0
  38. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/integration/test_omop_duckdb_runtime.py +14 -1
  39. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/integration/test_omop_postgres_runtime.py +14 -1
  40. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/support/agent_surface.py +1 -1
  41. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/support/agent_surface_reference.json +62 -36
  42. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/test_bootstrap_config.py +23 -1
  43. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/test_rest_api.py +124 -38
  44. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/test_server_registry.py +22 -0
  45. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_embedding_tools.py +25 -5
  46. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_knowledge_catalogue.py +14 -18
  47. groundworkers-0.13.0/tests/unit/test_knowledge_slots.py +325 -0
  48. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_mapping_context.py +1 -1
  49. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_mapping_service.py +6 -0
  50. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_mapping_tools.py +6 -1
  51. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_plugin_lint_cli.py +3 -3
  52. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_plugins.py +76 -39
  53. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_server_instructions.py +2 -9
  54. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_source_planning_classifier.py +17 -17
  55. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_source_planning_document_formats.py +7 -6
  56. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_source_planning_router.py +14 -14
  57. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_source_planning_service.py +9 -9
  58. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_system_tools.py +41 -8
  59. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_toolsets.py +21 -11
  60. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_tui_app.py +4 -4
  61. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_vocab_service.py +36 -0
  62. groundworkers-0.12.0/docs/tools/knowledge.md +0 -46
  63. groundworkers-0.12.0/src/groundworkers/knowledge/packs/core/criteria-gate-yesno/guidance.md +0 -57
  64. groundworkers-0.12.0/src/groundworkers/knowledge/packs/core/criteria-gate-yesno/manifest.yaml +0 -22
  65. groundworkers-0.12.0/src/groundworkers/knowledge/packs/core/diagnosis-role-modifier/guidance.md +0 -90
  66. groundworkers-0.12.0/src/groundworkers/knowledge/packs/core/diagnosis-role-modifier/manifest.yaml +0 -28
  67. groundworkers-0.12.0/src/groundworkers/services/knowledge/__init__.py +0 -15
  68. groundworkers-0.12.0/src/groundworkers/services/knowledge/catalogue.py +0 -177
  69. groundworkers-0.12.0/src/groundworkers/services/knowledge/models.py +0 -99
  70. groundworkers-0.12.0/src/groundworkers/tools/knowledge_tools.py +0 -203
  71. {groundworkers-0.12.0 → groundworkers-0.13.0}/.githooks/pre-commit +0 -0
  72. {groundworkers-0.12.0 → groundworkers-0.13.0}/.github/CONTRIBUTING.md +0 -0
  73. {groundworkers-0.12.0 → groundworkers-0.13.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  74. {groundworkers-0.12.0 → groundworkers-0.13.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  75. {groundworkers-0.12.0 → groundworkers-0.13.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  76. {groundworkers-0.12.0 → groundworkers-0.13.0}/.github/ISSUE_TEMPLATE/not_working.yml +0 -0
  77. {groundworkers-0.12.0 → groundworkers-0.13.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  78. {groundworkers-0.12.0 → groundworkers-0.13.0}/.github/release-drafter.yml +0 -0
  79. {groundworkers-0.12.0 → groundworkers-0.13.0}/.github/workflows/ci.yml +0 -0
  80. {groundworkers-0.12.0 → groundworkers-0.13.0}/.github/workflows/docs.yml +0 -0
  81. {groundworkers-0.12.0 → groundworkers-0.13.0}/.github/workflows/merge.yml +0 -0
  82. {groundworkers-0.12.0 → groundworkers-0.13.0}/.github/workflows/publish.yml +0 -0
  83. {groundworkers-0.12.0 → groundworkers-0.13.0}/.gitignore +0 -0
  84. {groundworkers-0.12.0 → groundworkers-0.13.0}/.python-version +0 -0
  85. {groundworkers-0.12.0 → groundworkers-0.13.0}/CHANGELOG.md +0 -0
  86. {groundworkers-0.12.0 → groundworkers-0.13.0}/Makefile +0 -0
  87. {groundworkers-0.12.0 → groundworkers-0.13.0}/config/docker-compose.yaml +0 -0
  88. {groundworkers-0.12.0 → groundworkers-0.13.0}/config/groundworkers.duckdb.example.toml +0 -0
  89. {groundworkers-0.12.0 → groundworkers-0.13.0}/config/groundworkers.example.toml +0 -0
  90. {groundworkers-0.12.0 → groundworkers-0.13.0}/config/groundworkers_db.env +0 -0
  91. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/adapters/ancestry.md +0 -0
  92. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/adapters/cdm.md +0 -0
  93. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/adapters/omop_emb.md +0 -0
  94. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/adapters/omop_graph.md +0 -0
  95. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/architecture.md +0 -0
  96. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/demo.md +0 -0
  97. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/development/extending.md +0 -0
  98. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/development/integration.md +0 -0
  99. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/from-scratch.md +0 -0
  100. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/index.md +0 -0
  101. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/js/asciinema-init.js +0 -0
  102. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/js/mermaid-init.js +0 -0
  103. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/plugins.md +0 -0
  104. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/reference/ref_adapters.md +0 -0
  105. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/reference/ref_base.md +0 -0
  106. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/reference/ref_config.md +0 -0
  107. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/reference/ref_services.md +0 -0
  108. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/reference/ref_tools.md +0 -0
  109. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/services/domain.md +0 -0
  110. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/services/graph.md +0 -0
  111. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/services/grounding.md +0 -0
  112. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/services/mapping.md +0 -0
  113. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/services/source_planning.md +0 -0
  114. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/services/text.md +0 -0
  115. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/services/vocab.md +0 -0
  116. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/static/01_create_config.png +0 -0
  117. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/static/02_empty_config.png +0 -0
  118. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/static/03_config_wizard.png +0 -0
  119. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/static/04_test_cnx.png +0 -0
  120. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/static/04_warnings.png +0 -0
  121. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/static/05_graph_setup.png +0 -0
  122. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/static/06_load_predicates.png +0 -0
  123. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/static/07_vector_store.png +0 -0
  124. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/static/08_register_embedding.png +0 -0
  125. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/static/10_setup_complete.png +0 -0
  126. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/static/demo.cast +0 -0
  127. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/static/demo.short.cast +0 -0
  128. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/tools/concept.md +0 -0
  129. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/tools/domain.md +0 -0
  130. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/tools/resolver.md +0 -0
  131. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/tools/source_planning.md +0 -0
  132. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/tools/text.md +0 -0
  133. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/usage/installation.md +0 -0
  134. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/usage/integrations.md +0 -0
  135. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/usage/prompt-handling.md +0 -0
  136. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/usage/setup_journey.md +0 -0
  137. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/usage/testing.md +0 -0
  138. {groundworkers-0.12.0 → groundworkers-0.13.0}/docs/usage/upgrading-from-0.6.md +0 -0
  139. {groundworkers-0.12.0 → groundworkers-0.13.0}/mkdocs.yaml +0 -0
  140. {groundworkers-0.12.0 → groundworkers-0.13.0}/pyproject.toml +0 -0
  141. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/__init__.py +0 -0
  142. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/_env.py +0 -0
  143. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/adapters/__init__.py +0 -0
  144. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/adapters/_omop_graph_ancestry.py +0 -0
  145. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/adapters/cdm.py +0 -0
  146. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/adapters/llm.py +0 -0
  147. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/adapters/omop_emb.py +0 -0
  148. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/adapters/omop_graph.py +0 -0
  149. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/__init__.py +0 -0
  150. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/__init__.py +0 -0
  151. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/configuration.py +0 -0
  152. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/configuration_provider.py +0 -0
  153. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/databases.py +0 -0
  154. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/embedding_artifacts.py +0 -0
  155. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/embedding_capability.py +0 -0
  156. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/embedding_coverage.py +0 -0
  157. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/embedding_population.py +0 -0
  158. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/embedding_reconciliation.py +0 -0
  159. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/embedding_registry.py +0 -0
  160. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/embedding_setup.py +0 -0
  161. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/graph_maintenance.py +0 -0
  162. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/integration.py +0 -0
  163. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/maintenance_runs.py +0 -0
  164. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/model_inventory.py +0 -0
  165. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/models.py +0 -0
  166. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/performance_maintenance.py +0 -0
  167. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/plugin_configuration.py +0 -0
  168. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/application/setup/runtime_setup.py +0 -0
  169. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/base/__init__.py +0 -0
  170. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/base/ancestry.py +0 -0
  171. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/base/concept_ids.py +0 -0
  172. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/base/concept_payload.py +0 -0
  173. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/base/database.py +0 -0
  174. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/base/domain_names.py +0 -0
  175. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/base/errors.py +0 -0
  176. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/base/sql.py +0 -0
  177. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/knowledge/packs/core/domain-routing/guidance.md +0 -0
  178. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/knowledge/packs/core/domain-routing/manifest.yaml +0 -0
  179. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/knowledge/packs/core/domain-routing/rules.yaml +0 -0
  180. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/knowledge/packs/core/drug-concept-granularity/guidance.md +0 -0
  181. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/knowledge/packs/core/drug-concept-granularity/manifest.yaml +0 -0
  182. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/knowledge/packs/core/drug-concept-granularity/rules.yaml +0 -0
  183. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/knowledge/packs/core/history-of-event/guidance.md +0 -0
  184. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/knowledge/packs/core/history-of-event/manifest.yaml +0 -0
  185. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/knowledge/packs/core/measurement-concept-granularity/guidance.md +0 -0
  186. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/knowledge/packs/core/measurement-concept-granularity/manifest.yaml +0 -0
  187. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/knowledge/packs/core/measurement-concept-granularity/rules.yaml +0 -0
  188. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/knowledge/packs/core/standard-concept-preference/guidance.md +0 -0
  189. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/knowledge/packs/core/standard-concept-preference/manifest.yaml +0 -0
  190. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/knowledge/packs/core/standard-concept-preference/rules.yaml +0 -0
  191. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/omop_domains.py +0 -0
  192. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/prompt_packs/__init__.py +0 -0
  193. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/prompt_packs/groundcrew-source-column-classification/classification-request.schema.json +0 -0
  194. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/prompt_packs/groundcrew-source-column-classification/classification-result.schema.json +0 -0
  195. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/prompt_packs/groundcrew-source-column-classification/examples.yaml +0 -0
  196. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/prompt_packs/groundcrew-source-column-classification/instructions.md +0 -0
  197. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/prompt_packs/groundcrew-source-column-classification/manifest.yaml +0 -0
  198. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/prompt_packs/groundcrew-source-column-classification/role-catalogue.yaml +0 -0
  199. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/server_instructions.py +0 -0
  200. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/__init__.py +0 -0
  201. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/ancestry.py +0 -0
  202. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/answer_grounding.py +0 -0
  203. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/domain.py +0 -0
  204. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/graph.py +0 -0
  205. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/grounding.py +0 -0
  206. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/relationship_neighborhood.py +0 -0
  207. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/__init__.py +0 -0
  208. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/assisted.py +0 -0
  209. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/canonical_headers.py +0 -0
  210. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/classifier.py +0 -0
  211. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/decomposer.py +0 -0
  212. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/decomposers/__init__.py +0 -0
  213. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/decomposers/csv_.py +0 -0
  214. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/decomposers/ddl_.py +0 -0
  215. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/decomposers/docx_.py +0 -0
  216. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/decomposers/json_.py +0 -0
  217. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/decomposers/pdf_.py +0 -0
  218. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/decomposers/xlsx_.py +0 -0
  219. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/decomposers/xml_.py +0 -0
  220. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/detector.py +0 -0
  221. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/models.py +0 -0
  222. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/normalisation.py +0 -0
  223. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/provenance.py +0 -0
  224. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/router.py +0 -0
  225. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/serialisation.py +0 -0
  226. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/source_profiles/__init__.py +0 -0
  227. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/source_profiles/base.py +0 -0
  228. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/source_profiles/redcap.py +0 -0
  229. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/source_profiles/registry.py +0 -0
  230. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/source_planning/warnings.py +0 -0
  231. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/text/__init__.py +0 -0
  232. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/text/models.py +0 -0
  233. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/text/prompts.py +0 -0
  234. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/services/text/service.py +0 -0
  235. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tools/__init__.py +0 -0
  236. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tools/concept_tools.py +0 -0
  237. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tools/domain_tools.py +0 -0
  238. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tools/resolver_tools.py +0 -0
  239. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tools/search_tools.py +0 -0
  240. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tools/source_planning_tools.py +0 -0
  241. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tools/text_tools.py +0 -0
  242. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/toolsets.py +0 -0
  243. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/transports/__init__.py +0 -0
  244. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/transports/rest/__init__.py +0 -0
  245. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/__init__.py +0 -0
  246. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/pages/__init__.py +0 -0
  247. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/pages/base.py +0 -0
  248. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/pages/plugin_config.py +0 -0
  249. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/pages/plugin_setup.py +0 -0
  250. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/pages/setup.py +0 -0
  251. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/presenters/__init__.py +0 -0
  252. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/presenters/base.py +0 -0
  253. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/presenters/chat.py +0 -0
  254. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/presenters/configuration.py +0 -0
  255. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/presenters/database.py +0 -0
  256. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/presenters/embeddings.py +0 -0
  257. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/presenters/graph.py +0 -0
  258. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/presenters/llm_provider.py +0 -0
  259. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/presenters/overview.py +0 -0
  260. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/presenters/performance.py +0 -0
  261. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/presenters/runs.py +0 -0
  262. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/routes.py +0 -0
  263. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/state.py +0 -0
  264. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/wizards/__init__.py +0 -0
  265. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/wizards/config_location.py +0 -0
  266. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/wizards/embedding_store.py +0 -0
  267. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/wizards/embeddings.py +0 -0
  268. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/wizards/graph_maintenance.py +0 -0
  269. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/wizards/performance_maintenance.py +0 -0
  270. {groundworkers-0.12.0 → groundworkers-0.13.0}/src/groundworkers/tui/wizards/plugin_setup.py +0 -0
  271. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/__init__.py +0 -0
  272. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/integration/__init__.py +0 -0
  273. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/integration/test_omop_emb_adapter.py +0 -0
  274. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/integration/test_omop_emb_contract.py +0 -0
  275. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/integration/test_omop_graph_adapter.py +0 -0
  276. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/support/__init__.py +0 -0
  277. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/support/agent_surface_budget.json +0 -0
  278. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/support/embedding_contract_fixture.py +0 -0
  279. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/support/omop.py +0 -0
  280. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/support/postgres_ci_config.toml +0 -0
  281. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/support/seed_postgres_fixture.py +0 -0
  282. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/support/stack_config.py +0 -0
  283. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/support/toolset_profiles.json +0 -0
  284. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/support/toolsets.json +0 -0
  285. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/support/wheel_smoke.py +0 -0
  286. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/test_agent_surface.py +0 -0
  287. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/__init__.py +0 -0
  288. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_ancestry_mcp_contract.py +0 -0
  289. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_answer_grounding.py +0 -0
  290. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_concept_payload.py +0 -0
  291. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_concept_tools.py +0 -0
  292. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_config_location_wizard.py +0 -0
  293. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_configuration_provider.py +0 -0
  294. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_domain_names.py +0 -0
  295. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_domain_tools.py +0 -0
  296. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_embedding_population_scope.py +0 -0
  297. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_embedding_reconciliation.py +0 -0
  298. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_embedding_registry_step.py +0 -0
  299. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_env_bootstrap.py +0 -0
  300. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_error_boundary.py +0 -0
  301. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_graph_maintenance.py +0 -0
  302. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_graph_maintenance_wizard.py +0 -0
  303. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_graph_service.py +0 -0
  304. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_graph_status.py +0 -0
  305. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_grounding_constraints.py +0 -0
  306. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_grounding_service.py +0 -0
  307. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_llm_adapter.py +0 -0
  308. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_maintenance_runs_phase2.py +0 -0
  309. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_migration_boundaries.py +0 -0
  310. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_normalized_index.py +0 -0
  311. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_omop_domains.py +0 -0
  312. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_omop_emb_adapter.py +0 -0
  313. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_omop_emb_setup_config.py +0 -0
  314. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_omop_graph_adapter.py +0 -0
  315. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_performance.py +0 -0
  316. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_performance_maintenance_wizard.py +0 -0
  317. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_phase3_overview.py +0 -0
  318. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_plugin_configuration.py +0 -0
  319. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_predicate_mapping_classification.py +0 -0
  320. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_prompt_packs.py +0 -0
  321. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_provider_fields.py +0 -0
  322. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_relationship_edges.py +0 -0
  323. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_required_integration_preflight.py +0 -0
  324. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_required_test_gate.py +0 -0
  325. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_schema_resolution.py +0 -0
  326. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_setup_artifacts_and_coverage.py +0 -0
  327. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_setup_configuration.py +0 -0
  328. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_setup_configuration_section.py +0 -0
  329. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_setup_databases.py +0 -0
  330. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_setup_embeddings.py +0 -0
  331. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_setup_provider_conformance.py +0 -0
  332. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_setup_runtime.py +0 -0
  333. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_setup_truth.py +0 -0
  334. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_setup_write_flows.py +0 -0
  335. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_source_planning_assisted_classifier.py +0 -0
  336. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_source_planning_decomposer.py +0 -0
  337. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_source_planning_detector.py +0 -0
  338. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_source_planning_models.py +0 -0
  339. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_source_planning_normalisation.py +0 -0
  340. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_source_planning_tools.py +0 -0
  341. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_split_classified_edges.py +0 -0
  342. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_stack_config_fixtures.py +0 -0
  343. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_stored_ancestry.py +0 -0
  344. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_text_service.py +0 -0
  345. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_text_tools.py +0 -0
  346. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_tui_state.py +0 -0
  347. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_vector_store_setup.py +0 -0
  348. {groundworkers-0.12.0 → groundworkers-0.13.0}/tests/unit/test_vocabulary_facts.py +0 -0
  349. {groundworkers-0.12.0 → groundworkers-0.13.0}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: groundworkers
3
- Version: 0.12.0
3
+ Version: 0.13.0
4
4
  Summary: Groundworkers MCP server — read-only agentive access to OMOP vocabularies, concept graphs, and embeddings.
5
5
  Requires-Python: >=3.12
6
6
  Requires-Dist: fastapi<1.0,>=0.110
@@ -148,6 +148,7 @@ Owned here
148
148
  | Source-planning roles and column review pack | [Models](src/groundworkers/services/source_planning/models.py); [pack manifest](src/groundworkers/prompt_packs/groundcrew-source-column-classification/manifest.yaml) | Groundcrew and source-planning clients |
149
149
  | Domain routing and classifier outputs | [omop_domains.py](src/groundworkers/omop_domains.py) | Groundcrew's domain review pack and the domain-routing knowledge pack |
150
150
  | Mapping conventions | [Standard-concept guidance](src/groundworkers/knowledge/packs/core/standard-concept-preference/guidance.md), [drug guidance](src/groundworkers/knowledge/packs/core/drug-concept-granularity/guidance.md), [history-of guidance](src/groundworkers/knowledge/packs/core/history-of-event/guidance.md), [measurement guidance](src/groundworkers/knowledge/packs/core/measurement-concept-granularity/guidance.md) | Agents reading knowledge packs; guidance is advisory |
151
+ | Knowledge pack discovery and structured slots | [Knowledge tools](docs/tools/knowledge.md) | Mapping agents and plugins |
151
152
  | Plugin interfaces | [plugins.py](src/groundworkers/plugins.py) | Registry and other Groundworkers plugins |
152
153
 
153
154
  Consumed from elsewhere
@@ -86,6 +86,7 @@ Owned here
86
86
  | Source-planning roles and column review pack | [Models](src/groundworkers/services/source_planning/models.py); [pack manifest](src/groundworkers/prompt_packs/groundcrew-source-column-classification/manifest.yaml) | Groundcrew and source-planning clients |
87
87
  | Domain routing and classifier outputs | [omop_domains.py](src/groundworkers/omop_domains.py) | Groundcrew's domain review pack and the domain-routing knowledge pack |
88
88
  | Mapping conventions | [Standard-concept guidance](src/groundworkers/knowledge/packs/core/standard-concept-preference/guidance.md), [drug guidance](src/groundworkers/knowledge/packs/core/drug-concept-granularity/guidance.md), [history-of guidance](src/groundworkers/knowledge/packs/core/history-of-event/guidance.md), [measurement guidance](src/groundworkers/knowledge/packs/core/measurement-concept-granularity/guidance.md) | Agents reading knowledge packs; guidance is advisory |
89
+ | Knowledge pack discovery and structured slots | [Knowledge tools](docs/tools/knowledge.md) | Mapping agents and plugins |
89
90
  | Plugin interfaces | [plugins.py](src/groundworkers/plugins.py) | Registry and other Groundworkers plugins |
90
91
 
91
92
  Consumed from elsewhere
@@ -79,7 +79,7 @@ Source planning analyses an input before ingestion. It decomposes the input, nor
79
79
 
80
80
  The deterministic `source_plan` path uses format and header evidence. Call `source_plan_assisted` as a separate step when that evidence is insufficient; it can use the configured chat model. The result records whether the assisted tier was used.
81
81
 
82
- Knowledge packs are a separate discovery mechanism. Bundled baseline packs and optional site or localisation packs contain reusable guidance and rules. `knowledge_catalogue` finds packs applicable to a source system, domain, or section; `knowledge_pack` loads the selected pack. Discovery can happen before or after source planning.
82
+ Source planning describes the structure of an input. Knowledge packs supply conventions you can use to interpret it or review a mapping. For example, source planning can identify a column of answer codes. A pack for the instrument can tell you which of those codes mean an answer is missing. Use `knowledge_catalogue` with the context you know, such as a domain or an exact instrument version, then read the selected pack with `knowledge_pack`. You can do this before or after source planning. [Work with knowledge packs](tools/knowledge.md)
83
83
 
84
84
  ## Prompt guidance and user decisions
85
85
 
@@ -96,7 +96,7 @@ own toolsets. When omitted or empty during plugin registration, the server uses
96
96
  `register()` adds MCP tools, prompts, or resources against the state returned by `build()`. The shared MCP registration wrapper supplies the same safe error translation used by core tools. Code-defined prompts can continue to derive their arguments from the callable signature. A plugin publishing data-defined prompts can pass explicit string metadata with `PromptArgument`; this keeps dynamic pack fields out of Python closure signatures:
97
97
 
98
98
  ```python
99
- from groundworkers.base import PromptArgument
99
+ from groundworkers.plugins import PromptArgument
100
100
 
101
101
  server.prompt(
102
102
  "my_pack_workflow",
@@ -139,6 +139,23 @@ sequenceDiagram
139
139
  2. Groundworkers' code never imports `my_package` by name. It only expects four things on the object (`name`, optional `PackageConfigBase` class, plus `build` and `register` methods, described above).
140
140
  3. The plugin's tools are now callable through the one Groundworkers server.
141
141
 
142
+ ### Use knowledge packs in a plugin
143
+
144
+ Suppose your plugin needs a code map and a set of shape files to prepare a projection runtime. Decide which pack to use from the deployment’s configuration or the job context. Read that pack with `context.knowledge_packs.get_pack(name, layer=...)` so the plugin uses the same selected copy as the MCP tools. A standalone context may omit the reader.
145
+
146
+ Use `PackContent.slots` for the pack’s typed data. For a named map, pass its `entries` to the runtime and keep `sha256` with any provenance you record. Pass the resolved `path` of each shape preset in the order supplied. Your consumer validates the assets for its use. For example, the projection runtime checks that a shape’s registry references and map lookups resolve.
147
+
148
+ Handle a missing pack as `None`. A declared file that fails to load raises `PackSlotError`. See the [slot format and tool responses](../tools/knowledge.md#author-a-pack).
149
+
150
+ ## Supported plugin API
151
+
152
+ Import the plugin contract and these host helpers from `groundworkers.plugins`:
153
+
154
+ - `build_app_config` resolves the shared stack configuration for a plugin command.
155
+ - `GroundworkersError` and `embedding_store_error` provide the host's tool error format and embedding store error translation.
156
+ - `PromptArgument` declares named string arguments for an MCP prompt.
157
+ - `Command`, `CommandPlan`, and `CommandStep` describe setup and maintenance work. They require the `groundworkers[tui]` extra.
158
+
142
159
  ## Package configuration
143
160
 
144
161
  A plugin with scalar and `RefTo` fields receives a setup-console page without any Groundskeeping-aware plugin code:
@@ -232,4 +249,6 @@ The command prints a JSON report and exits with status 1 if any linter reports a
232
249
 
233
250
  ## Lifecycle and diagnostics
234
251
 
235
- Groundworkers discovers the plugin set once per application build, validates its identities, resolves each package configuration, and builds state. MCP registration uses those same discovered objects. `groundworkers --describe` lists active plugins and safe `plugin_issues` for plugins skipped because their configuration, prerequisites, build, or registration failed.
252
+ Groundworkers discovers plugins once per application build, validates their identities, resolves their configuration, and builds their state. If multiple plugins use the same name, Groundworkers skips all of them. If MCP registration fails, Groundworkers discards the tools, prompts, and resources added during that registration.
253
+
254
+ `system_status` and `groundworkers --describe` list active plugins and short reasons for skipped plugins. Use the host logs for details.
@@ -70,6 +70,8 @@ Encodes a text query on the fly and returns the nearest concepts by vector simil
70
70
 
71
71
  All parameters except `query` are optional.
72
72
 
73
+ Compare `returned` with `requested` before treating a short list as evidence that nothing fits. `requested` is the effective limit (1–50), and `returned` counts the results after filtering. A short list adds a warning. It can mean fewer concepts match, the index scan stopped early, or standard-only filtering removed results.
74
+
73
75
  With `standard_only=true`, search can retrieve non-standard concepts and then replace them with standard OMOP `Maps to` targets in the requested domain. Mapped candidates identify their source and embedding similarity in `reached_via`. A warning names up to three targets outside the requested domain. A standard-only lookup adds candidates if the wider search found fewer distinct in-domain standard hits than the requested `limit`.
74
76
 
75
77
  !!! warning "Requires a configured embedding model"
@@ -96,7 +98,7 @@ Encodes and searches multiple query strings in one provider/index operation. The
96
98
 
97
99
  All queries in a call share the same domain, vocabulary, model, and concept filters. Partition queries before calling when those constraints differ. The MCP wrapper accepts at most 256 queries; `batch_size` is the provider batch size and is bounded to 1–128.
98
100
 
99
- With `standard_only=true`, each query uses the same post-filter as `embedding_search`. The batch returns a flat `warnings` list, even when empty. Each warning begins with the query's one-based position and text.
101
+ With `standard_only=true`, each query uses the same post-filter as `embedding_search`. `result_counts[i]` gives `requested` and `returned` for `results[i]`. The batch returns a flat `warnings` list, even when empty. Each warning begins with the query's one-based position and text.
100
102
 
101
103
  ## `embedding_encode`
102
104
 
@@ -0,0 +1,102 @@
1
+ # Work with knowledge packs
2
+
3
+ Suppose you are mapping a lab test. The source gives the analyte and specimen, and the vocabulary offers several candidates. One candidate also names a test method. How do you decide whether that extra detail is supported? The bundled measurement guidance says to keep the details the source gives and leave an unstated method out of the mapping.
4
+
5
+ A knowledge pack gives you a convention you can consult while making a decision. Groundworkers ships general OMOP and vocabulary guidance. Your team can add packs for particular instruments or deployments. You or your agent choose the applicable guidance and use it to review the candidate evidence.
6
+
7
+ ## Use a pack to review a mapping
8
+
9
+ 1. **Find the relevant guidance.** Pass the domain you are working in to `knowledge_catalogue`. The catalogue gives you each pack’s name, scope, and origin. For a lab test, look for the bundled `measurement-concept-granularity` pack.
10
+ 2. **Read the selected pack.** Pass its name and layer to `knowledge_pack`. Check the guidance against the details you have from the source and the candidate concepts.
11
+ 3. **Explain the decision.** In this example, you can record that you kept the analyte and specimen and avoided assuming a method. If the candidates still leave a question open, carry it forward for review.
12
+
13
+ You can ask an agent to do this in ordinary language.
14
+
15
+ > Help me review this lab-test mapping. Find the relevant measurement guidance, show
16
+ > which details each candidate adds or drops, and explain which choice the source supports.
17
+
18
+ If you call the tools directly, start with `knowledge_catalogue`.
19
+
20
+ ```json
21
+ {"domains": ["Measurement"]}
22
+ ```
23
+
24
+ Then read the selected pack with `knowledge_pack`.
25
+
26
+ ```json
27
+ {"name": "measurement-concept-granularity", "layer": "core"}
28
+ ```
29
+
30
+ ## Find the conventions for your source
31
+
32
+ A source system identifies a platform or format. Many different instruments can use the same platform, and each instrument version can assign its own meaning to the answers. If you know the instrument, pass its exact versioned ID with the rest of the context.
33
+
34
+ ```json
35
+ {
36
+ "source_system": "redcap",
37
+ "instrument": "publisher/form@2"
38
+ }
39
+ ```
40
+
41
+ A pack with `applicability.instrument` needs the matching ID in a job query, alongside any other filters you supply. If you have only a source system, domain, or section, the result still includes general guidance that matches that context. Omit the job filters to browse every pack, or read the `knowledge://catalogue` resource for the full index. Use `include_local: false` to omit the localisation layer.
42
+
43
+ Check `origin` when you want to know whose copy you are reading. It identifies the bundled or configured root and gives the pack’s directory relative to that root. Configured roots are numbered from zero in load order after duplicate directories have been removed. A bundled pack has a null root index. [Configure knowledge pack roots](../usage/configuration.md#knowledge-packs-knowledge_)
44
+
45
+ ## Choose how to record a convention
46
+
47
+ Use `guidance.md` for advice a reviewer can read, and keep any existing rules or examples with it. A structured slot gives a consumer data it can look up by name.
48
+
49
+ | The question you need to answer | Slot |
50
+ | --- | --- |
51
+ | Does this source code represent a missing answer, and why? | `null_codes` gives mapping agents the source meaning and a terminology reason. |
52
+ | Which concept ID or numeric value does this source code map to? | `code_maps` gives consumers the named lookup table and a digest that identifies its exact entries. |
53
+ | How should the mapped fields be shaped into OMOP rows? | `shape_presets` points a projection runtime to the catalogue files to compile. |
54
+
55
+ Groundworkers loads and serves the files. The mapping agent uses the null-code list when
56
+ interpreting a field, and the projection runtime checks and applies the shapes and maps selected
57
+ by its caller.
58
+
59
+ ## Author a pack
60
+
61
+ Declare the files the pack provides in the `slots` block of `manifest.yaml`. Each path is relative to the pack directory and must resolve to a file inside it.
62
+
63
+ ```yaml
64
+ slots:
65
+ null_codes: null-codes.yaml
66
+ code_maps:
67
+ score: maps/score.json
68
+ shape_presets:
69
+ - shapes/base.yaml
70
+ - shapes/overrides.yaml
71
+ ```
72
+
73
+ | Slot | File format | `knowledge_pack` response |
74
+ | --- | --- | --- |
75
+ | `null_codes` | A YAML mapping from list names to arrays of entries. Each entry has a string `code`, a nonblank `meaning`, and a `reason` with a terminology `system` URI and `code`. Quote codes to preserve leading zeros or an empty string. Codes are unique within each list. | Named lists and their entries. |
76
+ | `code_maps` | One JSON object per map, with unique source-code strings as keys and finite numbers as values. | Each map’s `entries` and `sha256`. The digest comes from compact JSON with sorted keys and ASCII escaping. |
77
+ | `shape_presets` | An ordered list of YAML catalogue files. Each file contains a top-level `shapes` list of mappings. The projection runtime validates the shape definitions when it compiles those files. | Pack-relative filenames in the order declared. |
78
+
79
+ Once the root is configured, use `knowledge_catalogue` to check the pack’s origin and declared
80
+ slots. Read it with `knowledge_pack` to check the null-code lists, map entries, and preset filenames
81
+ it serves.
82
+
83
+ ## When a pack is unavailable
84
+
85
+ | What you see | What to check |
86
+ | --- | --- |
87
+ | `NOT_FOUND` | Check the name and layer against the catalogue. If you expected a configured override, check the server log for a malformed or duplicate definition. |
88
+ | `INVALID_INPUT` for a name that appears in multiple layers | Pass the layer listed for the pack you want. |
89
+ | `BACKEND_UNAVAIL` with a slot name | Check the server log for the declared file that is missing or malformed. |
90
+
91
+ A successful read includes the manifest, `guidance`, `rules`, `examples`, and `slots`.
92
+
93
+ ## Direct Python use
94
+
95
+ ```python
96
+ from groundworkers.services.knowledge import KnowledgeCatalogue
97
+
98
+ catalogue = KnowledgeCatalogue.with_bundled()
99
+ selected = catalogue.get_pack("measurement-concept-granularity", layer="core")
100
+ ```
101
+
102
+ Hosted plugins can read the same catalogue as the MCP tools. See [how to read a pack from a plugin](../development/plugins.md#use-knowledge-packs-in-a-plugin).
@@ -90,12 +90,17 @@ The default source-term search builds one evidence packet by combining:
90
90
 
91
91
  Representative response sections:
92
92
 
93
- - `channels`: each MCP channel contains only `available` and `count`
93
+ - `channels` reports which searches ran and how many candidates they found
94
94
  - `standardized_candidates`
95
95
  - `candidate_union`
96
96
  - `warnings`
97
97
 
98
- In MCP, `channels` has the shape `{"exact": {"available": true, "count": 2}}`. Each count describes the returned rows for that channel before the merged-list limit. With `standard_only=true`, the count reflects post-filtering, deduplication within the channel, and its `per_channel_limit`. The direct Python service and REST endpoint return the channel result lists.
98
+ In MCP, a lexical channel looks like `{"available": true, "count": 2}`. The embedding channel
99
+ looks like `{"available": true, "requested": 5, "returned": 2}` when it finds two of five requested candidates. An available embedding channel adds a warning when it returns fewer candidates than requested. A short list can mean fewer concepts match, the index scan stopped early, or standard-only filtering removed results. An unavailable channel reports zero returned candidates and a warning with the reason it could not run.
100
+
101
+ Channel counts apply before the merged-list limit. With `standard_only=true`, they reflect
102
+ post-filtering, deduplication within each channel, and `per_channel_limit`. The direct Python
103
+ service and REST endpoint also return each channel's result list.
99
104
 
100
105
  With `standard_only=true`, retrieval can find non-standard sources. Groundworkers replaces those hits with their standard OMOP `Maps to` targets in the requested domain and deduplicates the results. For each mapped candidate, `retrieved_by` includes the source retrieval channels and `maps_to`. Each `reached_via` entry identifies the source concept, its vocabulary and the channel that found it. Embedding entries also include similarity when available. When a mapping leads outside the requested domain, `warnings` names up to three such targets with their source names.
101
106
 
@@ -18,7 +18,7 @@ The MCP surface is organized by the job a caller is trying to do. Core vocabular
18
18
  | Prepare noisy clinical text | Text tools | Normalized, decomposed, cleaned, or disambiguated search phrases |
19
19
  | Classify structured fields | `domain_classify` | Best-effort OMOP domain hints for later retrieval |
20
20
  | Analyze a source artifact before ingest | Source planning tools | Neutral tables, column roles, route decisions, warnings, and provenance |
21
- | Find reusable operational guidance | Knowledge tools | Applicable knowledge-pack manifests and pack content |
21
+ | Find the conventions that apply to a mapping job | [Knowledge tools](knowledge.md) | General mapping guidance and configured instrument or deployment conventions |
22
22
  | Check what this deployment can do | System tools and `--describe` | Backend availability, vocabulary catalogue, and registered MCP surfaces |
23
23
 
24
24
  ## Tool groups
@@ -32,6 +32,8 @@ Embeddings can order tied answers or eligible members returned for review. They
32
32
  ## `concept_search_exact`
33
33
 
34
34
  Case-insensitive exact match of a query string against `concept_name` and (optionally) `concept_synonym_name`.
35
+ Name matches come first, followed by synonym matches. Each group is ordered by ascending concept
36
+ ID before the result limit is applied. A concept appears once.
35
37
 
36
38
  ```json
37
39
  {
@@ -4,7 +4,7 @@ Two tools report on overall availability and the OMOP vocabulary catalogue for a
4
4
 
5
5
  ## `system_status`
6
6
 
7
- Returns availability and health details for each configured backend. Takes no arguments.
7
+ Returns the health of each configured backend, the names of loaded plugins, and short reasons for plugin failures. Takes no arguments.
8
8
 
9
9
  **Response**:
10
10
 
@@ -15,6 +15,8 @@ Returns availability and health details for each configured backend. Takes no ar
15
15
  "omop_graph": {
16
16
  "available": true,
17
17
  "db_connected": true,
18
+ "fulltext_available": true,
19
+ "fulltext_detail": null,
18
20
  "embedding_resolver_active": true,
19
21
  "detail": null
20
22
  },
@@ -24,6 +26,10 @@ Returns availability and health details for each configured backend. Takes no ar
24
26
  "model_count": 1,
25
27
  "model_backend_configured": true,
26
28
  "detail": null
29
+ },
30
+ "plugins": {
31
+ "loaded": [],
32
+ "issues": {}
27
33
  }
28
34
  }
29
35
  }
@@ -31,11 +37,15 @@ Returns availability and health details for each configured backend. Takes no ar
31
37
 
32
38
  `overall` is one of:
33
39
 
34
- - `healthy`: all configured components are available
35
- - `degraded`: at least one configured component is unavailable
36
- - `unavailable`: no configured components are available, or none are configured
40
+ - `healthy` when all configured backends are available
41
+ - `degraded` when some configured backends are available
42
+ - `unavailable` when no configured backend is available
43
+
44
+ `components` lists configured backends and a `plugins` entry. Backend availability determines `overall`. `plugins.loaded` lists plugin names, and `plugins.issues` maps names to short reasons why those plugins were skipped.
45
+
46
+ For `omop_graph`, `fulltext_available` reports the optional full-text capability independently of graph health. On DuckDB, a healthy graph reports `fulltext_available: false`. `fulltext_detail` explains why this capability is unavailable, when known.
37
47
 
38
- `components` only includes backends that are configured for the current runtime. For `omop_emb`, `available` means the vector store can be inspected and contains at least one registered model. `model_backend_configured` tells you whether live text search and encoding can call the configured embedding model. Stored-neighbour lookup can still work when this is `false`.
48
+ For `omop_emb`, `available` means the vector store can be inspected and contains at least one registered model. `model_backend_configured` tells you whether live text search and encoding can call the configured embedding model. Stored-neighbour lookup can still work when this is `false`.
39
49
 
40
50
  Use this tool when you want to confirm:
41
51
 
@@ -299,29 +299,46 @@ When enabled and a chat model is configured, assisted source planning can use th
299
299
 
300
300
  ### Knowledge packs (`knowledge_*`)
301
301
 
302
- | Field | Type | Default |
303
- |---|---|---|
304
- | `knowledge_packs_root` | `str \| null` | `null` |
305
-
306
- `groundworkers` includes bundled baseline knowledge packs as part of the package. Set `knowledge_packs_root` when you want to add site-specific or localisation packs on top of that baseline.
307
-
308
- Point `knowledge_packs_root` directly to the directory containing the layer directories:
302
+ Add a pack directory when your team needs conventions for its instruments or deployment
303
+ alongside the general guidance bundled with Groundworkers. A *root* is the directory that
304
+ contains the layer directories. You can start with a shared directory and put your deployment's
305
+ overrides in a second one.
309
306
 
310
307
  ```toml
311
308
  [tools.groundworkers]
312
- knowledge_packs_root = "./my-knowledge/packs"
309
+ knowledge_packs_roots = ["./shared/packs", "./local/packs"]
313
310
  ```
314
311
 
315
312
  ```text
316
- my-knowledge/
317
- packs/ # knowledge_packs_root points here
313
+ shared/
314
+ packs/
318
315
  localisation/
319
- nacc-uds-v4/
316
+ example-conventions/
320
317
  manifest.yaml
321
318
  guidance.md
322
319
  ```
323
320
 
324
- Relative paths resolve against the TOML file's directory; `~` is expanded. A configured pack with the same `layer` and `name` replaces the bundled copy. Other bundled packs remain available. These knowledge packs are separate from prompt workflows supplied by plugins; see [Working with prompts](prompt-handling.md).
321
+ Paths start at the directory containing the stack TOML when written relative to it. `~` expands
322
+ to the user's home directory. Repeated directories are used once.
323
+
324
+ When a pack appears in several roots, their order decides which copy you use. Groundworkers
325
+ starts with the bundled packs, then reads `knowledge_packs_root` if set, followed by `knowledge_packs_roots` in
326
+ the order shown. If both configured directories in this example contain the same `localisation`
327
+ pack name, the copy in `./local/packs` supplies the entire pack, including which files are
328
+ present. Check `origin` in `knowledge_catalogue` to see which copy the server is using.
329
+
330
+ If a pack disappears after you add an override, check the server log. A malformed manifest or
331
+ conflicting definitions in one root remove that layer and name from the catalogue, including an
332
+ earlier copy. Groundworkers uses the directory names when the manifest does not provide a valid
333
+ layer or name. The log identifies the failing and any shadowed locations. A valid definition in
334
+ a higher-priority root can restore the pack.
335
+
336
+ | Field | Type | Default |
337
+ |---|---|---|
338
+ | `knowledge_packs_root` | `str \| null` | `null` |
339
+ | `knowledge_packs_roots` | `list[str]` | `[]` |
340
+
341
+ To find and read the packs available to a job, see [Work with knowledge packs](../tools/knowledge.md).
325
342
 
326
343
  ## What becomes available at runtime
327
344
 
@@ -32,6 +32,7 @@ from groundworkers.services import (
32
32
  VocabService,
33
33
  )
34
34
  from groundworkers.services.answer_grounding import AnswerGrounding
35
+ from groundworkers.services.knowledge import KnowledgeCatalogue, KnowledgePackReader
35
36
  from groundworkers.services.source_planning import (
36
37
  AssistedColumnRoleClassifier,
37
38
  SourcePlanningService,
@@ -73,6 +74,7 @@ class Services:
73
74
  text: TextService | None = None
74
75
  source_planning: SourcePlanningService | None = None
75
76
  domain: DomainService | None = None
77
+ knowledge: KnowledgeCatalogue | None = None
76
78
 
77
79
 
78
80
  @dataclass
@@ -195,7 +197,7 @@ def build_adapters(
195
197
 
196
198
 
197
199
  def build_services(config: AppConfig, adapters: Adapters) -> Services:
198
- services = Services()
200
+ services = Services(knowledge=KnowledgeCatalogue.with_bundled(config.knowledge_roots))
199
201
  assisted_classifier = None
200
202
  if (
201
203
  adapters.llm is not None
@@ -278,6 +280,11 @@ def _build_plugin_context(
278
280
  if services is not None
279
281
  else None
280
282
  ),
283
+ knowledge_packs=(
284
+ KnowledgePackReader(services.knowledge)
285
+ if services is not None and services.knowledge is not None
286
+ else None
287
+ ),
281
288
  )
282
289
 
283
290
 
@@ -408,7 +415,8 @@ def build_application(config: AppConfig) -> GroundworkersApp:
408
415
  adapters = build_adapters(config)
409
416
  services = build_services(config, adapters)
410
417
  context = _build_plugin_context(config, adapters, services)
411
- plugin_definitions = tuple(discover_plugins())
418
+ discovered, discovery_issues = discover_plugins()
419
+ plugin_definitions = tuple(discovered)
412
420
  plugins, plugin_issues = _build_plugins(config, context, plugin_definitions)
413
421
  return GroundworkersApp(
414
422
  config=config,
@@ -416,5 +424,5 @@ def build_application(config: AppConfig) -> GroundworkersApp:
416
424
  services=services,
417
425
  plugins=plugins,
418
426
  plugin_definitions=plugin_definitions,
419
- plugin_issues=plugin_issues,
427
+ plugin_issues={**discovery_issues, **plugin_issues},
420
428
  )
@@ -1,6 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import Any
3
+ from typing import Any, TypedDict
4
4
 
5
5
  from pydantic import BaseModel, Field
6
6
 
@@ -38,6 +38,25 @@ class DatasetStatus(BaseModel):
38
38
  issues: list[str] = Field(default_factory=list)
39
39
 
40
40
 
41
+ class EmbeddingResultCount(TypedDict):
42
+ requested: int
43
+ returned: int
44
+
45
+
46
+ def embedding_result_count(
47
+ requested: int,
48
+ returned: int,
49
+ warnings: list[str] | None,
50
+ *,
51
+ label: str = "Embedding search",
52
+ ) -> EmbeddingResultCount:
53
+ if returned < requested and warnings is not None:
54
+ warnings.append(
55
+ f"{label} returned {returned} of {requested} requested results."
56
+ )
57
+ return {"requested": requested, "returned": returned}
58
+
59
+
41
60
  def enum_value(value: object) -> str | None:
42
61
  """Render an enum (or a plain value) as the string a result payload carries.
43
62
 
@@ -4,12 +4,15 @@ import asyncio
4
4
  import inspect
5
5
  import json
6
6
  import logging
7
- from collections.abc import Callable, Collection, Iterator
7
+ from collections.abc import Awaitable, Callable, Collection, Iterator
8
8
  from contextlib import contextmanager
9
+ from contextvars import copy_context
9
10
  from dataclasses import dataclass
10
11
  from difflib import get_close_matches
11
12
  from functools import wraps
13
+ from threading import Lock, Thread
12
14
  from typing import Annotated, Any, Literal, get_origin, get_type_hints
15
+ from weakref import finalize
13
16
 
14
17
  from mcp.types import CallToolResult, TextContent, ToolAnnotations
15
18
  from pydantic import BaseModel
@@ -117,6 +120,19 @@ def _callable_name(func: Callable[..., Any]) -> str:
117
120
  return getattr(func, "__name__", None) or repr(func)
118
121
 
119
122
 
123
+ def _close_call_runner(runner: asyncio.Runner) -> None:
124
+ try:
125
+ asyncio.get_running_loop()
126
+ except RuntimeError:
127
+ runner.close()
128
+ else:
129
+ Thread(target=runner.close, daemon=True).start()
130
+
131
+
132
+ async def _await_result(result: Awaitable[Any]) -> Any:
133
+ return await result
134
+
135
+
120
136
  class GroundworkersMCPServer:
121
137
  def __init__(self, name: str) -> None:
122
138
  self.name = name
@@ -126,6 +142,9 @@ class GroundworkersMCPServer:
126
142
  self._registration_toolsets: frozenset[str] = frozenset()
127
143
  self._prompts: dict[str, _RegisteredPrompt] = {}
128
144
  self._resources: dict[str, tuple[Callable[..., Any], str | None]] = {}
145
+ self._call_runner = asyncio.Runner(loop_factory=asyncio.new_event_loop)
146
+ self._call_lock = Lock()
147
+ finalize(self, _close_call_runner, self._call_runner)
129
148
 
130
149
  def tool(
131
150
  self,
@@ -193,11 +212,27 @@ class GroundworkersMCPServer:
193
212
 
194
213
  @contextmanager
195
214
  def plugin_registration(self, plugin_name: str) -> Iterator[None]:
196
- """Default untagged tools to their plugin during its registration."""
215
+ """Tag untagged tools and restore the registry if registration fails."""
197
216
  previous = self._registration_toolsets
217
+ registrations = (
218
+ self._tools.copy(),
219
+ self._tool_annotations.copy(),
220
+ self._tool_metadata.copy(),
221
+ self._prompts.copy(),
222
+ self._resources.copy(),
223
+ )
198
224
  self._registration_toolsets = frozenset({f"plugin:{plugin_name}"})
199
225
  try:
200
226
  yield
227
+ except BaseException:
228
+ (
229
+ self._tools,
230
+ self._tool_annotations,
231
+ self._tool_metadata,
232
+ self._prompts,
233
+ self._resources,
234
+ ) = registrations
235
+ raise
201
236
  finally:
202
237
  self._registration_toolsets = previous
203
238
 
@@ -250,20 +285,22 @@ class GroundworkersMCPServer:
250
285
  def list_resources(self) -> list[str]:
251
286
  return sorted(self._resources.keys())
252
287
 
253
- def call(self, name: str, *args: Any, **kwargs: Any) -> Any:
254
- result = self._tools[name](*args, **kwargs)
288
+ def call(self, tool_name: str, /, *args: Any, **kwargs: Any) -> Any:
289
+ """Invoke a tool, reusing a loop for synchronous calls to async tools."""
290
+ result = self._tools[tool_name](*args, **kwargs)
255
291
  if not inspect.isawaitable(result):
256
292
  return result
257
293
  try:
258
294
  asyncio.get_running_loop()
259
295
  except RuntimeError:
260
- return asyncio.run(result)
296
+ with self._call_lock:
297
+ return self._call_runner.run(_await_result(result), context=copy_context())
261
298
  return result
262
299
 
263
- async def call_async(self, name: str, *args: Any, **kwargs: Any) -> Any:
300
+ async def call_async(self, tool_name: str, /, *args: Any, **kwargs: Any) -> Any:
264
301
  """Call a registered tool from an existing async runtime."""
265
302
 
266
- result = self._tools[name](*args, **kwargs)
303
+ result = self._tools[tool_name](*args, **kwargs)
267
304
  return await result if inspect.isawaitable(result) else result
268
305
 
269
306
  def call_prompt(self, name: str, **kwargs: Any) -> Any:
@@ -61,12 +61,10 @@ def build_app_config_from_stack(stack: StackConfig) -> AppConfig:
61
61
  if vector_store is not None:
62
62
  validate_duckdb_embedding_file(vector_store, cdm=cdm_database)
63
63
 
64
- knowledge_root = None
65
- if groundworkers.knowledge_packs_root is not None:
66
- knowledge_root = _resolve_path(
67
- groundworkers.knowledge_packs_root,
68
- stack.loaded_path,
69
- )
64
+ knowledge_paths = (groundworkers.knowledge_packs_root, *groundworkers.knowledge_packs_roots)
65
+ knowledge_roots = tuple(dict.fromkeys(
66
+ _resolve_path(path, stack.loaded_path) for path in knowledge_paths if path is not None
67
+ ))
70
68
 
71
69
  try:
72
70
  cdm_engine, cdm_vocab_engine = create_runtime_cdm_engines(cdm_database)
@@ -103,7 +101,7 @@ def build_app_config_from_stack(stack: StackConfig) -> AppConfig:
103
101
  embedding_model=embedding_model,
104
102
  llm_model=llm_model,
105
103
  vector_store=vector_store,
106
- knowledge_root=knowledge_root,
104
+ knowledge_roots=knowledge_roots,
107
105
  )
108
106
 
109
107
 
@@ -166,6 +166,13 @@ class GroundworkersConfig(PackageConfigBase):
166
166
  "installed package."
167
167
  ),
168
168
  )
169
+ knowledge_packs_roots: list[str] = Field(
170
+ default_factory=list,
171
+ description=(
172
+ "Ordered directories of knowledge packs, loaded after bundled packs "
173
+ "and knowledge_packs_root. Relative paths resolve from the stack config."
174
+ ),
175
+ )
169
176
 
170
177
  @field_validator("rest_base_path")
171
178
  @classmethod
@@ -198,7 +205,7 @@ class AppConfig:
198
205
  embedding_model: ResolvedModel | None
199
206
  llm_model: ResolvedModel | None
200
207
  vector_store: ResolvedVectorStore | None
201
- knowledge_root: Path | None
208
+ knowledge_roots: tuple[Path, ...] = ()
202
209
 
203
210
  def describe(self) -> dict[str, Any]:
204
211
  """Return an operator-safe description without credentials or raw URLs."""
@@ -230,9 +237,7 @@ class AppConfig:
230
237
  },
231
238
  "groundworkers": {
232
239
  **self.groundworkers.model_dump(),
233
- "knowledge_resolved_root": str(self.knowledge_root)
234
- if self.knowledge_root is not None
235
- else None,
240
+ "knowledge_resolved_roots": [str(root) for root in self.knowledge_roots],
236
241
  },
237
242
  "database": {
238
243
  "name": database.name,
@@ -0,0 +1,16 @@
1
+ # Criteria Gates
2
+
3
+ A criteria gate asks whether the evidence supports asserting a specific clinical
4
+ concept. Look for labels phrased “meets criteria for …” or an equivalent question
5
+ about whether the criteria are met. Ordinary Yes/No items whose answers are
6
+ independently informative are outside this pattern. Use the source's declared
7
+ codes for confirming, non-confirming and unanswered responses.
8
+
9
+ An answer that confirms the criteria supports a record for the underlying
10
+ concept. Use its domain to choose the target table as described in
11
+ `domain-routing`.
12
+
13
+ For a non-confirming answer, first check whether a distinct standard concept
14
+ represents the negative finding documented by the source. If one applies, use
15
+ that concept. Otherwise emit no record. Never write a row with a generic “No”
16
+ in `value_as_concept_id` for a criteria gate. An unanswered item emits no record.