* feat(workflows): add verifier agent surfaces Generate project-scoped read-only verifier agents for Codex, Claude Code, GitHub Copilot, and OpenCode. Wire workflow manifests, generated surfaces, init diagnostics, sync classification, docs, and tests through the new subagent contract. * feat(workflows): add leased truth doc writer agents Add write-capable truth-doc-writer generated surfaces for Codex, Claude, Copilot, and OpenCode, guarded by explicit write leases. Tighten Truth Sync and Truth Document subagent contracts so parents validate leases, changed files, and worker reports before accepting doc updates. * feat(workflows): add Truth Preview and workflow support files Add the explicit read-only Truth Preview workflow across the manifest, generated host surfaces, docs, and tests. Move generated skill hosts to compact SKILL.md entrypoints with support procedure, report, and lease files, and add write-worker report acceptance validation against actual lease diffs.
16 KiB
status, doc_type, truth_kind, last_reviewed, source_of_truth
| status | doc_type | truth_kind | last_reviewed | source_of_truth | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| active | contract | contract | 2026-05-16 |
|
Contracts
Scope
This document defines the current machine-facing contracts exposed by Truthmark: the config file shape, route metadata, repository-intelligence artifacts, and the CLI result envelope.
Contract Surface
- The committed
.truthmark/config.ymlschema and defaults. - Route metadata under
docs/truthmark/areas.mdand delegated child route files. - The JSON result envelope emitted by
truthmark config,truthmark init,truthmark check,truthmark index,truthmark impact, andtruthmark context.
Inputs
- Committed config fields under
.truthmark/config.yml. - Routed truth-document metadata from
docs/truthmark/areas.mdanddocs/truthmark/areas/**/*.md. - CLI options such as
--json,--stdout, and command-specific flags.
Config Contract
Truthmark loads .truthmark/config.yml and validates it against the current schema.
Current fields:
version: must be1platforms: optional list of agent harnesses to initialize; defaults to all supported platformsdocs.layout: currentlyhierarchicaldocs.roots: named canonical doc roots; omitted root names are filled from current defaultsdocs.routing.root_index: root area index pathdocs.routing.area_files_root: child area route directorydocs.routing.default_area: default child route file basename used by scaffolddocs.routing.max_delegation_depth: currently must be1authority: ordered list of canonical doc paths or globsinstruction_targets: files that receive installed instructions; defaults toAGENTS.mdfrontmatter.required: frontmatter fields that produceerrordiagnostics when missingfrontmatter.recommended: frontmatter fields that producereviewdiagnostics when missingignore: glob patterns excluded from relevant checks and routing logic
The default scaffolded authority list includes:
docs/truthmark/areas.mddocs/truthmark/areas/**/*.mddocs/ai/**/*.mddocs/standards/**/*.mddocs/architecture/**/*.mddocs/truth/**/*.md
Route Metadata Contract
Route files may express Truth documents in either of these forms:
- a legacy Markdown list of document paths
- a fenced YAML block with a
truth_documentsarray of{ path, kind }entries
New scaffolded child route files use the fenced YAML form so routed truth kind is explicit from the first generated route. The legacy list form remains a compatibility input for existing repositories.
Markdown list values normalize Prettier-escaped glob stars before route matching, so formatted entries such as src/example/\*\* are treated as src/example/**.
Supported routed truth kinds are:
behaviorcontractarchitectureworkflowoperationstest-behavior
When explicit kind metadata is present, it is the authoritative routed kind and the fenced metadata block owns the Truth documents section. Legacy list lines in the same section are ignored. When route files use the legacy list form, Truthmark falls back to path-based kind inference such as <configured truth root>/** or docs/truth/** -> behavior, docs/contracts/** or docs/api/** -> contract, docs/architecture/** -> architecture, docs/workflows/** -> workflow, docs/operations/** -> operations, and docs/testing/** -> test-behavior.
Canonical truth docs may include optional truth_kind frontmatter. When present, it must match the routed kind.
Supported platforms values are:
codexopencodeclaude-codegithub-copilotgemini-cli
There is no .truthmark/local.yml contract in the current implementation. User preferences that affect generated repository behavior must be expressed through committed config or the generated surfaces cannot be reproduced by another checkout.
Command Result Envelope
truthmark config, truthmark init, and truthmark check return the same JSON envelope when run with --json.
Current shape:
command: string command namesummary: human-readable summary stringdiagnostics: array of diagnostic objectsdata: optional command-specific object
Diagnostic fields:
category: one ofconfig,authority,frontmatter,links,area-index,coverage,truth-sync,realization,doc-structure,generated-surface,repo-index,impact,freshness, orcontext-packseverity: one ofinfo,action,review, orerrormessage: human-readable detailfile: optional repository-relative file patharea: optional area name fromdocs/truthmark/areas.mddata: optional machine-readable extras
Human-rendered output is intended for people. JSON output is the machine-facing contract.
truthmark index --json returns data.repoIndex with schemaVersion: repo-index/v0 and data.routeMap with schemaVersion: route-map/v0.
truthmark impact --base <ref> --json returns data.impactSet with schemaVersion: impact-set/v0.
truthmark context --workflow <workflow> [--base <ref>] --json returns data.contextPack with schemaVersion: context-pack/v0. --workflow accepts truth-sync, truth-document, and truth-realize. --format accepts json or markdown; unsupported formats return a context-pack error diagnostic. --format markdown renders a deterministic Markdown ContextPack for human review, and --json --format markdown includes that Markdown under data.markdown.
RepoIndex, RouteMap, ImpactSet, and ContextPack are derived from the active checkout. They do not override route files, source files, truth docs, or installed workflow write boundaries.
Compatibility Rules
versionremains1in the committed config contract.docs.roots.truthis the configured root for behavior truth docs.- Repositories refresh generated workflow surfaces through
truthmark init; removing a platform from config stops future refreshes but does not delete previously generated files. - Truth Realize has no config switch; selected platforms receive its explicit manual workflow surface.
- There is no
.truthmark/local.ymlcompatibility surface in the current implementation.
Config Result Data
truthmark config --json writes only .truthmark/config.yml unless --stdout is used.
Current config result data fields include:
repositoryRootworktreePathbranchNameisDetachedisUnborn
When --stdout is used, data also includes:
pathcontent
Init Result Data
truthmark init --json currently returns these data fields:
repositoryRootworktreePathbranchNameisDetachedisUnborn
The command emits action diagnostics describing whether each scaffolded file was created, updated, or unchanged. Generated realization skill files use the realization diagnostic category.
truthmark init requires an existing valid .truthmark/config.yml. It does not create config; truthmark config is the required first step in a new repository.
Configured instruction_targets are generated or refreshed independently of platform-specific surfaces, so AGENTS.md remains managed even when claude-code is not in platforms.
Generated Truth Structure, Truth Document, Truth Sync, Truth Preview, Truth Check, Codex, Claude Code, GitHub Copilot, and OpenCode verifier or leased doc-writer agent surfaces, and the managed AGENTS.md block use the truth-sync diagnostic category.
Current agent-native scaffold targets include:
.codex/skills/truthmark-structure/SKILL.md.codex/skills/truthmark-structure/agents/openai.yaml.codex/skills/truthmark-document/SKILL.md.codex/skills/truthmark-document/agents/openai.yaml.codex/skills/truthmark-sync/SKILL.md.codex/skills/truthmark-sync/agents/openai.yaml.codex/skills/truthmark-realize/SKILL.md.codex/skills/truthmark-realize/agents/openai.yaml.codex/skills/truthmark-check/SKILL.md.codex/skills/truthmark-check/agents/openai.yaml.codex/skills/truthmark-preview/SKILL.md.codex/skills/truthmark-preview/agents/openai.yaml.codex/skills/truthmark-*/support/procedure.md.codex/skills/truthmark-*/support/report-template.md.codex/skills/truthmark-*/support/subagents-and-leases.mdwhen the workflow has generated subagent guidance.codex/agents/truth-route-auditor.toml.codex/agents/truth-claim-verifier.toml.codex/agents/truth-doc-reviewer.toml.codex/agents/truth-doc-writer.toml.claude/skills/truthmark-structure/SKILL.md.claude/skills/truthmark-document/SKILL.md.claude/skills/truthmark-sync/SKILL.md.claude/skills/truthmark-realize/SKILL.md.claude/skills/truthmark-check/SKILL.md.claude/skills/truthmark-preview/SKILL.md.claude/skills/truthmark-*/support/procedure.md.claude/skills/truthmark-*/support/report-template.md.claude/skills/truthmark-*/support/subagents-and-leases.mdwhen the workflow has generated subagent guidance.claude/agents/truth-route-auditor.md.claude/agents/truth-claim-verifier.md.claude/agents/truth-doc-reviewer.md.claude/agents/truth-doc-writer.md.opencode/skills/truthmark-structure/SKILL.md.opencode/skills/truthmark-document/SKILL.md.opencode/skills/truthmark-sync/SKILL.md.opencode/skills/truthmark-realize/SKILL.md.opencode/skills/truthmark-check/SKILL.md.opencode/skills/truthmark-preview/SKILL.md.opencode/skills/truthmark-*/support/procedure.md.opencode/skills/truthmark-*/support/report-template.md.opencode/skills/truthmark-*/support/subagents-and-leases.mdwhen the workflow has generated subagent guidance.opencode/agents/truth-route-auditor.md.opencode/agents/truth-claim-verifier.md.opencode/agents/truth-doc-reviewer.md.opencode/agents/truth-doc-writer.mdAGENTS.mdCLAUDE.md.github/copilot-instructions.md.github/prompts/truthmark-structure.prompt.md.github/prompts/truthmark-document.prompt.md.github/prompts/truthmark-sync.prompt.md.github/prompts/truthmark-realize.prompt.md.github/prompts/truthmark-check.prompt.md.github/prompts/truthmark-preview.prompt.md.github/agents/truth-route-auditor.agent.md.github/agents/truth-claim-verifier.agent.md.github/agents/truth-doc-reviewer.agent.md.github/agents/truth-doc-writer.agent.mdGEMINI.md.gemini/commands/truthmark/structure.toml.gemini/commands/truthmark/document.toml.gemini/commands/truthmark/sync.toml.gemini/commands/truthmark/realize.toml.gemini/commands/truthmark/check.toml.gemini/commands/truthmark/preview.toml
Generated SKILL.md files use closed YAML frontmatter with name, description, argument-hint, user-invocable, and truthmark-version fields so Codex-style, Claude Code, and OpenCode-style skill indexers can parse every generated workflow surface. For those skill-package hosts, SKILL.md is the compact routing and quick-procedure entrypoint; detailed procedure text, report templates, and subagent or lease reference material live in generated sibling support/*.md files. Generated Copilot prompt files use .github/prompts/*.prompt.md files with agent and description frontmatter so supported Copilot IDEs can expose /truthmark-* prompts. Generated verifier agents are read-only and context-bounded to parent-assigned shards, while generated truth-doc-writer agents are write-capable only through parent-provided leases and parent diff validation. Generated Codex metadata includes a truthmark.version marker plus truthmark.refresh_command: "truthmark init". Managed instruction blocks also render the Truthmark package version, and package.json is the single maintained version source for those markers. Generated Gemini command files use project-scoped TOML custom commands so truthmark init can install /truthmark:structure, /truthmark:document, /truthmark:sync, /truthmark:preview, /truthmark:realize, and /truthmark:check alongside GEMINI.md. Re-running truthmark init after a package upgrade refreshes configured committed surfaces and exposes staleness through ordinary Git diffs. Removing a platform from config stops future refreshes for that platform; it does not delete previously generated files.
The OpenCode truth-doc-writer edit allow-list is rendered from the active docs.roots.truth, docs.routing.root_index, and docs.routing.area_files_root config paths so valid leases remain writable in non-default documentation layouts.
Check Result Data
truthmark check --json returns:
branchScopetruthVisibility
branchScope contains:
repositoryRootworktreePathbranchNameheadShaidentityrelevantFileHashes
For normal branches, identity is branch name plus HEAD SHA. For detached checkouts, identity is the commit SHA. worktreePath remains separate so callers can distinguish parallel worktrees for the same repository.
relevantFileHashes currently tracks hashes for:
.truthmark/config.yml- the configured root route index
- configured child route files under the configured area-files root
truthVisibility contains:
routePrecision.leafAreaCountroutePrecision.broadAreaCountunmappedSurfaceCountstaleGeneratedSurfaceCountsyncCompletenessIssueCounttopologyPressureCount
Current Diagnostic Emission Notes
- ordinary
truthmark checkemitsconfig,authority,frontmatter,links,area-index,coverage,doc-structure, andgenerated-surfacediagnostics. truth-syncandrealizationcategories exist for init and generated workflow reporting, but ordinarycheckdoes not emit workflow payloads.truthmark checkdoes not support--workflow truth-syncin the current contract.- Missing authority files are
errordiagnostics. - Authority globs and code-surface globs that match nothing are
reviewdiagnostics. - Coverage diagnostics discover unmapped functional code across common code roots with the same path classifier used by Truth Sync. V1 coverage must include Go, Python, C#, Java, JavaScript, TypeScript, frontend roots, monorepo app or package roots, Terraform, Kubernetes manifests, CI workflows, OpenAPI or Swagger, GraphQL, and protobuf surfaces within those roots.
frontmatteremitserrordiagnostics whentruth_kindis invalid or present and disagrees with routed truth-kind metadata.doc-structureemitsreviewdiagnostics when configured architecture or routed truth docs are missingScope, activeProduct Decisions, activeRationale, or the kind-specific required headings for their routed truth kind.
Product Decisions
- The committed config file owns the documentation hierarchy contract, while route files own domain-to-doc mappings.
truthmark configandtruthmark initare separate contracts so repositories can review hierarchy before workflow installation.- Active decisions stay in the canonical doc they govern instead of in separate timestamped decision logs. Date active decisions inline when added or changed.
- The V1 user-facing CLI surface is
config,init,check,index,impact, andcontext; workflow verbs such assync,realize,structure,audit,packet,review,scan,doctor, andbuildare not top-level commands. gemini-cliinstalls both hierarchicalGEMINI.mdcontext and project-scoped.gemini/commands/truthmark/*.tomlcustom commands so Gemini users get the same explicit workflow entrypoints without adding top-level CLI verbs.- Decision (2026-05-14): Truth Realize is manually invoked through installed workflow surfaces and is not controlled by
realization.enabledor any other config key.
Rationale
Separating config from init keeps repository layout reviewable and predictable. Keeping decisions with the owning behavior, contract, or architecture doc prevents agents from having to infer which historical note is still active.
Keeping workflow verbs out of the CLI preserves the agent-native model: installed skills and instruction blocks run the workflows, while the CLI installs and validates repository artifacts.