Markitect boundary and reuse tests

This commit is contained in:
2026-05-05 19:41:32 +02:00
parent 9f1b8da87a
commit ef8391e6a7
15 changed files with 490 additions and 6 deletions

View File

@@ -8,6 +8,25 @@ This note records what `kontextual-engine` should reuse from
`markitect-tool` instead of reimplementing. `markitect-tool` is the syntax
layer; `kontextual-engine` is the system/runtime layer.
## Dependency Contract
`kontextual-engine` should integrate `markitect-tool` through documented public
Python APIs and adapter modules. The preferred import surface is the
top-level `markitect_tool` package or documented subpackages such as
`markitect_tool.query`, `markitect_tool.ops`, `markitect_tool.memory`,
`markitect_tool.policy`, and `markitect_tool.backend`.
The engine must treat returned Markitect objects as adapter payloads. Domain
state should persist serializable envelopes, source references, digests,
lineage, policy decisions, and audit events rather than storing Markitect
runtime objects as canonical engine entities.
Required integration behavior is captured in
`docs/markitect-tool-integration-usecases.md` and exercised by
`tests/test_markitect_tool_contract.py`. These tests are allowed to skip when
the optional `markitect-tool` dependency is not installed, but they become
stability checks for the boundary when the `markdown` extra is installed.
## Reuse As Adapter Dependencies
| Need in kontextual-engine | markitect-tool owner | Reuse posture |
@@ -22,6 +41,21 @@ layer; `kontextual-engine` is the system/runtime layer.
| Document functions, templates, and generation hooks | `markitect_tool.document_function`, `markitect_tool.generation` | Invoke as syntax-layer processors. Keep provider calls behind `llm-connect`. |
| Local label policy and policy adapter protocols | `markitect_tool.policy.*` | Reuse for markdown source/package filtering. Engine should expose policy-aware operations at artifact/service level. |
## Adapter Ownership Rules
- Markdown ingestion adapters may call `parse_markdown`, `parse_markdown_file`,
`query_document`, `extract_document`, and `snapshot_identity_for_file`.
- Markdown transformation adapters may call `transform_markdown`,
`compose_files`, `resolve_includes`, Markitect contract checks, document
functions, templates, and workflow helpers.
- Agent/context adapters may call Markitect context-package and local policy
APIs for markdown-backed context packages.
- Engine domain code must not import Markitect APIs directly.
- Service APIs must not expose the `mkt` CLI as the engine control surface.
- Cross-format query, policy, audit, workflow run, versioning, and export
contracts remain engine-owned even when Markitect produced the markdown
payload.
## Do Not Reimplement Here
- Markdown ASTs, section trees, frontmatter parsing, explode/implode, document
@@ -44,4 +78,3 @@ layer; `kontextual-engine` is the system/runtime layer.
- Agent-operable context continuity and service/programmatic APIs.
- Adapter registry that can call `markitect-tool`, `llm-connect`, and storage
backends without embedding their internals.