# Validate

Check tasks, docs, and templates for quality and reference integrity

# [Validate](https://knowns.sh/docs/validate#validate)

The `knowns validate` command checks your project for broken references, missing fields, and quality issues before AI starts coding.

## [What It Checks](https://knowns.sh/docs/validate#what-it-checks)

- **Reference integrity** — do task and doc references resolve?
- **Task quality** — has title? Valid status/priority? Unchecked AC on done tasks?
- **Doc health** — has title? Has description? Stale references?
- **Template validity** — do `.hbs` files exist? Do they parse correctly?

## [Usage](https://knowns.sh/docs/validate#usage)

```
# Validate everything
knowns validate

# Validate specific scope
knowns validate --scope tasks
knowns validate --scope docs
knowns validate --scope templates

# Validate a single entity
knowns validate --entity abc123        # single task
knowns validate --entity specs/auth    # single doc

# Strict mode (warnings become errors)
knowns validate --strict

# Auto-fix supported issues
knowns validate --fix

# JSON output for CI/CD
knowns validate --json
```

## [Flags](https://knowns.sh/docs/validate#flags)

| Flag | Description |
| --- | --- |
| `--scope` | `all` (default), `tasks`, `docs`, `templates`, `sdd` |
| `--entity` | Validate a single entity by task ID or doc path |
| `--strict` | Treat warnings as errors |
| `--fix` | Auto-fix supported issues |
| `--json` | Output as JSON |
| `--plain` | Plain text output (for AI agents) |

## [SDD Validation](https://knowns.sh/docs/validate#sdd-validation)

Use `--scope sdd` to check Spec-Driven Development coverage — verifies that tasks linked to specs have acceptance criteria and proper fulfills mappings.

```
knowns validate --scope sdd
```

## [Output Example](https://knowns.sh/docs/validate#output-example)

```
ERROR   [abc123] Parent task "xyz789" not found
WARN    [def456] Task is done but AC #1 is not checked: Add tests
INFO    [readme] Doc has no description

Summary: 1 error(s), 1 warning(s), 1 info
```

## [CI/CD Integration](https://knowns.sh/docs/validate#cicd-integration)

```
# GitHub Actions
- name: Validate project
  run: knowns validate --strict
```

The exit code reflects validity — non-zero when errors are found.

## [MCP Tool](https://knowns.sh/docs/validate#mcp-tool)

The same validation engine is available via MCP (v0.20 consolidated format):

```
validate({
  scope: "all",
  entity: "abc123",
  strict: false,
  fix: false
})
```
