It installs a Git-native, branch-scoped workflow layer that helps AI coding agents update the right docs, respect ownership boundaries, and leave humans with normal diffs they can review.
Use it to configure a repository, install or refresh workflow files, validate truth artifacts, and generate optional review context.
```bash
truthmark config
truthmark init
truthmark check
```
The CLI prepares and validates the repository environment.
It is not the AI workflow runtime.
### 2. AI-facing workflow surfaces
The AI-facing surfaces are for coding agents.
Truthmark installs host-native skills, prompts, commands, managed instruction blocks, and supported subagent surfaces so AI agents can follow repository-specific truth workflows inside their normal coding tools.
Examples:
```text
/truthmark-sync
/truthmark-document
/truthmark-structure
/truthmark-realize
/truthmark-preview
/truthmark-check
```
These look like commands because agent hosts expose workflows through slash commands, prompts, skills, or project commands.
They are not shell commands.
They are AI-facing workflow entrypoints.
The split is the product:
```text
humans own the repository contract
Truthmark installs the contract into the repo
agents operate inside that contract
truth updates appear as Git diffs
humans review the result
```
## Quick start
### Requirements
- Node.js `>=20`
- npm
- a Git repository
### Install Truthmark
Run this inside the repository you want to initialize:
The exact files depend on `.truthmark/config.yml`, but the install always has the same shape: routing, truth scaffolding, compact managed instructions, and host-native workflow surfaces for the enabled platforms.
Truthmark runs locally against the active Git worktree.
The human-facing CLI reads and writes repository files, then exits.
The AI-facing workflow surfaces are committed files that agent hosts can load later. That means agents can follow the installed workflow from repository state instead of depending on a background Truthmark process.
Agents do not talk to a Truthmark daemon, but they can run the installed Truthmark CLI when a workflow asks for validation, indexing, or helper checks.
Truthmark owns the generated workflow surfaces it creates, but the important contract is architectural: repo-local config and routing point agents at canonical truth docs, while host-native workflows give each supported agent a way to run the same Truthmark procedures.
Removing a platform stops future refreshes for that platform. It does not delete previously generated files.
## AI-facing workflows
These workflows are installed into supported AI coding hosts.
They are used by agents or agent hosts during repository work. They are not top-level shell commands.
| Workflow | Direction | Use it when | Write boundary |
| --- | --- | --- | --- |
| Truth Structure | topology-first | The default route is too broad, ownership spans multiple areas, or route files still point at placeholders. | Creates or repairs routing and starter truth docs. |
| Truth Document | implementation-first | Behavior already exists in code, but canonical truth docs are missing or weak. | Writes truth docs and routing only. Functional code must not change. |
| Truth Sync | code-first | Functional code changed and mapped truth docs may need to be updated before handoff. | Updates truth docs. Functional code must not be rewritten by Truth Sync. |
| Truth Preview | read-only | The agent needs to preview likely routing before edits. | Reads only. Does not authorize writes. |
| Truth Realize | doc-first | Product or architecture truth docs lead and code should be updated to match. | Updates code only. The agent must not edit the truth docs it is realizing. |
| Truth Check | audit-first | A reviewer or agent needs to audit repository truth health. | Audits and reports. |
### Important distinction
Do not confuse these two surfaces:
| Surface | Used by | Example | Meaning |
| --- | --- | --- | --- |
| Human CLI | humans, scripts, CI-like checks | `truthmark check` | Validate repository truth artifacts from the terminal. |
| AI-facing workflow | coding agents and agent hosts | `/truthmark-check` | Ask an agent to run the installed audit workflow. |
The names are intentionally related, but the surfaces are different.
## Normal AI-assisted code change
Most users should not need to invoke Truth Sync manually every time.
Truth Sync is the installed finish-time guard for functional code changes.
```text
agent changes functional code
agent runs or asks for relevant tests
installed workflow detects that functional code changed
Truth Sync checks mapped truth docs
agent updates truth docs if needed
human reviews code diff + truth diff
```
Direct invocation is still useful for troubleshooting, forcing an early sync, or making the handoff explicit:
```text
/truthmark-sync sync the repository truth now before handoff
```
## Existing behavior without docs
Use Truth Document when the implementation already exists but the repository truth is incomplete.
```text
/truthmark-document document the implemented session timeout behavior under docs/truth/authentication
```
Truth Document inspects implementation, tests, route files, and existing docs as evidence.
It writes truth docs and routing only.
It must not change functional code.
## Doc-first changes
Use Truth Realize when a product or architecture decision starts in docs and code should be updated to match.
```text
/truthmark-realize realize docs/truth/authentication/session-timeout.md into code
```
Truth Realize is doc-first.
The truth docs lead. The code follows.
The agent must not edit the truth docs it is realizing.
## Read-only routing preview
Use Truth Preview before a change when the agent needs to understand likely routing.
```text
/truthmark-preview preview the likely truth routing for changes to the billing API
```
Truth Preview is read-only.
It is a selector and planning aid, not write authorization and not a replacement for Truth Check.
## Repository truth audit
Use Truth Check when you want an agent-facing audit workflow.
```text
/truthmark-check audit routing and truth coverage before review
```
Use the human-facing CLI when you want terminal validation:
```bash
truthmark check
```
Both are useful. They are not the same surface.
## Human-facing CLI commands
Most maintainers start with three commands.
| Command | Purpose |
| --- | --- |
| `truthmark config` | Create `.truthmark/config.yml`. Writes only that file unless `--stdout` is used. |
| `truthmark init` | Install or refresh configured workflow surfaces from the reviewed config. |
Optional repository-intelligence helpers generate derived review context for the active checkout. Generated workflow skill packages may also expose helper manifests and helper policies that call installed `truthmark validate ... --json` CLI validators; those helpers are accelerators, not bundled repo-local scripts or sources of truth. Standalone Copilot prompts and Gemini commands use the same CLI validator contract when the installed runner is available, and otherwise report a visible skipped helper status with manual validation.
| `truthmark index` | Build RepoIndex and RouteMap JSON for the active checkout. |
| `truthmark impact --base <ref>` | Map changed files to routed truth docs, owning routes, nearby tests, and public symbols. |
| `truthmark context --workflow <workflow> [--base <ref>]` | Generate a bounded ContextPack for Truth Sync, Truth Document, or Truth Realize. Use `--format markdown` for a human-readable pack. |
Structured output is available with `--json` where supported.
## Configuration
Truthmark is config-first.
The main config file is:
```text
.truthmark/config.yml
```
New repositories should run:
```bash
truthmark config
```
Then review the generated config before running:
```bash
truthmark init
```
Important config areas include:
| Config area | Purpose |
| --- | --- |
| `version` | Config contract version. |
| `platforms` | Agent hosts that should receive platform-specific generated surfaces. |
| `docs.layout` | Current docs layout mode. |
| `docs.roots` | Named canonical documentation roots. |
| `docs.routing.root_index` | Root route index path. |
| `docs.routing.area_files_root` | Directory for delegated child route files. |