Contract framework with markdown-native contracts utilizing fenced YAML blocks

This commit is contained in:
2026-05-03 22:51:13 +02:00
parent 3cfda33bc9
commit e3e13ee45a
36 changed files with 2877 additions and 13 deletions

View File

@@ -3,7 +3,7 @@ id: MKTT-WP-0001
type: workplan
title: "markitect-tool Repository Foundation"
domain: markitect
status: active
status: done
owner: markitect-tool
topic_slug: markitect
created: "2026-05-03"

View File

@@ -3,7 +3,7 @@ id: MKTT-WP-0002
type: workplan
title: "markitect-main Scope Extraction"
domain: markitect
status: active
status: done
owner: markitect-tool
topic_slug: markitect
created: "2026-05-03"

View File

@@ -3,11 +3,12 @@ id: MKTT-WP-0004
type: workplan
title: "Practical Document Contract Framework"
domain: markitect
status: proposed
status: done
owner: markitect-tool
topic_slug: markitect
created: "2026-05-03"
updated: "2026-05-03"
state_hub_workstream_id: "558787e1-d287-46a5-9214-634e8b90a858"
---
# MKTT-WP-0004: Practical Document Contract Framework
@@ -19,6 +20,24 @@ heading-count schema validation toward document contracts with section
specifications, fields/forms, context-aware rules, metric bands, optional LLM
assessments, and unified diagnostics.
## Implementation Result
Initial deterministic contract framework implemented:
- Markdown contract files with fenced `yaml contract` blocks.
- Shared diagnostic model with severity, code, source, contract location,
rule id, details, and repair guidance.
- Contract validation, document contract checking, and metrics CLI commands.
- Required/recommended/optional/discouraged/forbidden section specs.
- Field specs for frontmatter values.
- Document-level and section-level metric bands.
- Deterministic content assertions.
- Design documentation for form/context and provider-neutral LLM rubric
adapters.
- Example contracts, valid documents, invalid documents, and expected
diagnostic notes for ADR, PRD/FRS, workplan, business letter, and concept
note use cases.
## Background
Research and legacy comparison are captured in:
@@ -31,8 +50,9 @@ Research and legacy comparison are captured in:
```task
id: MKTT-WP-0004-T001
status: todo
status: done
priority: high
state_hub_task_id: "2065d56a-9371-4fd0-9a3d-7a69c718e851"
```
Define the first `DocumentContract` format in markdown/YAML:
@@ -51,8 +71,9 @@ Keep it provider-neutral and readable by humans.
```task
id: MKTT-WP-0004-T002
status: todo
status: done
priority: high
state_hub_task_id: "3ed3af1b-c747-492c-acda-ecb4ee564a38"
```
Create diagnostics with severity, code, message, source location, contract
@@ -63,8 +84,9 @@ violations and all new contract checks.
```task
id: MKTT-WP-0004-T003
status: todo
status: done
priority: high
state_hub_task_id: "c4166e5a-53a5-4207-a3fb-b4ddf388cd5e"
```
Support required, recommended, optional, discouraged, and forbidden sections.
@@ -75,8 +97,9 @@ and clear diagnostics.
```task
id: MKTT-WP-0004-T004
status: todo
status: done
priority: medium
state_hub_task_id: "304af70e-1a33-4ee2-bcbd-7b966436cf37"
```
Support document-level and section-level bands for words, characters,
@@ -87,32 +110,42 @@ Allow soft warnings and hard errors.
```task
id: MKTT-WP-0004-T005
status: todo
status: done
priority: medium
state_hub_task_id: "1bcc82fe-b578-446c-86a7-938f732b24fa"
```
Specify fields, defaults, prefill sources, dynamic requiredness, conditional
visibility, calculations, and validation against external context. This task is
design-first; implementation can follow in a later workplan.
Design captured in `docs/contract-framework.md`. Runtime form rendering,
dynamic visibility, calculations, and context resolvers remain later adapter
work.
## P4.6 - Design LLM assessment adapter contract
```task
id: MKTT-WP-0004-T006
status: todo
status: done
priority: medium
state_hub_task_id: "bef295ba-fbc0-4df6-9cc4-040ed9b5f346"
```
Define provider-neutral request/response models for section-level rubrics:
criteria, inputs, context, score, pass/fail, reason, model metadata, and cache
keys. Do not bind core logic to any provider.
Provider-neutral adapter shape captured in `docs/contract-framework.md`.
Execution, caching, and provider integration remain later work.
## P4.7 - Add practical CLI surface
```task
id: MKTT-WP-0004-T007
status: todo
status: done
priority: high
state_hub_task_id: "9f61a5af-0b65-460a-8231-ec50279c5c6a"
```
Add:
@@ -129,8 +162,9 @@ Ensure output is useful to humans and machines.
```task
id: MKTT-WP-0004-T008
status: todo
status: done
priority: medium
state_hub_task_id: "7ec8c0f2-c598-4095-aefe-f6f97e84a470"
```
Create examples for: