# markitect-tool Reuse Boundary Date: 2026-05-05 ## Purpose 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. ## Reuse As Adapter Dependencies | Need in kontextual-engine | markitect-tool owner | Reuse posture | | --- | --- | --- | | Markdown parsing and structured document snapshots | `markitect_tool.core.parser`, `markitect_tool.core.document`, `markitect_tool.backend.engine.DocumentSnapshot` | Call through a markdown ingestion adapter. Persist normalized artifacts here, but do not parse markdown here. | | Document-level selectors and extraction | `markitect_tool.query`, `docs/query-extraction.md` | Use for markdown source extraction and context package creation. Engine query should operate over persisted artifacts and relationships. | | Deterministic transforms, composition, and includes | `markitect_tool.ops.engine`, `docs/transform-compose-include.md` | Treat as external operations invoked by workflows. Store operation provenance and derived artifacts in the engine. | | Contract checks, runtime context, forms, and assessments | `markitect_tool.contract.*`, `markitect_tool.runtime.*`, `docs/runtime-context-forms-assessments.md` | Use as validation/assessment step adapters. Engine owns run state and audit trail. | | Backend manifests, local snapshots, FTS, and query adapters | `markitect_tool.backend.*`, `docs/backend-fabric.md` | Reuse snapshot identity and local index concepts. Engine storage remains separate and cross-format. | | Agent working memory context packages | `markitect_tool.memory.engine`, `docs/agent-working-memory.md` | Reuse as a portable context-package format for markdown-backed context. Engine should provide durable context registries across formats. | | Workflow definition syntax and markdown-centered step kinds | `markitect_tool.workflow.*`, `docs/workflow-definition-standard.md` | Reuse where workflows consume markdown inputs. Engine workflows should generalize to artifact collections, external tools, and service operations. | | 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. | ## Do Not Reimplement Here - Markdown ASTs, section trees, frontmatter parsing, explode/implode, document transforms, includes, contract files, and selector syntax. - Local markdown FTS/index refresh internals unless a durable engine backend explicitly wraps them. - CLI-first command behavior from `mkt`. - Provider-specific LLM adapters or prompt adapter internals. ## Engine-Owned Responsibilities `kontextual-engine` should own the durable runtime concepts that sit above `markitect-tool`: - Artifact and collection identity across formats. - Persistent artifact metadata, content digests, lineage, and lifecycle state. - Relationship graphs between artifacts and collections. - Workflow runs, step state, input/output bundles, errors, and provenance. - Cross-artifact dependency graph, recomputation, and impact debt. - Agent-operable context continuity and service/programmatic APIs. - Adapter registry that can call `markitect-tool`, `llm-connect`, and storage backends without embedding their internals.