Skip to content

Configuration: spec-sync docs

Reference

SpecSync 5.0 separates canonical validation settings from the verified SDD policy:

  • .specsync/config.toml configures specs, source discovery, rules, maturity guards, and integrations.
  • .specsync/sdd.json enables and protects the change lifecycle, meaningful paths, verification commands, and custom artifacts.

Neither file accepts provider credentials or model commands.

Initialize

specsync init

New projects receive the current layout. Existing projects can migrate configuration with specsync migrate and explicitly enable the 5.0 lifecycle with specsync change adopt.

Configuration resolution is:

.specsync/config.toml
.specsync/config.json      legacy fallback
.specsync.toml             legacy fallback
specsync.json              legacy fallback
defaults

Canonical TOML

specs_dir = "specs"
source_dirs = ["src"]
schema_dir = "db/migrations"
schema_pattern = "CREATE (?:VIRTUAL )?TABLE(?:\\s+IF NOT EXISTS)?\\s+(\\w+)"
exclude_dirs = ["__tests__"]
exclude_patterns = ["**/__tests__/**", "**/*.test.ts"]
source_extensions = ["rs", "ts"]
required_sections = ["Purpose", "Public API", "Invariants", "Behavioral Examples", "Error Cases", "Dependencies", "Change Log"]
export_level = "member"
parse_mode = "ast"
enforcement = "strict"
task_archive_days = 30

[rules]
max_changelog_entries = 20
require_behavioral_examples = true
min_invariants = 1
max_spec_size_kb = 50
require_depends_on = false

[github]
repo = "owner/repo"
drift_labels = ["spec-drift"]
verify_issues = true

[companions]
design = true

All keys use snake_case. specsync migrate preserves explicit empty arrays and refuses lossy conversion when legacy custom rules cannot be represented safely.

Core options

OptionTypeDefaultPurpose
specs_dirstring"specs"Recursive canonical spec directory
source_dirsstring[]auto-detected or srcSource roots used for coverage and generation
schema_dirstringunsetSQL migration directory
schema_patternstringbuilt-in CREATE TABLE patternTable-name capture regex
required_sectionsstring[]seven contract sectionsRequired ## headings
exclude_dirsstring[]common test directoriesDirectory exclusions
exclude_patternsstring[]common test globsAdditive source exclusions
source_extensionsstring[]all supportedRestrict source discovery
export_levelmember or typememberPublic-symbol validation depth
parse_moderegex or astregexExtraction strategy where AST support exists
enforcementwarn, enforce-new, or strictwarnDefault failure policy
task_archive_daysintegerunsetAge threshold used by task archival

Validation rules

The [rules] table controls spec-quality constraints:

KeyPurpose
max_changelog_entriesWarn when a Change Log needs compaction
require_behavioral_examplesRequire a populated Behavioral Examples section
min_invariantsSet the minimum invariant count
max_spec_size_kbWarn on oversized specs
require_depends_onRequire explicit dependencies

Maturity lifecycle guards

Module maturity (draft, review, active, stable, deprecated, archived) is separate from the SDD delivery lifecycle. Configure allowed states, age guidance, and transition guards in TOML:

[lifecycle]
track_history = true
allowed_statuses = ["draft", "review", "active", "stable", "deprecated", "archived"]

[lifecycle.max_age]
draft = 30
review = 14

[lifecycle.guards."review->active"]
min_score = 80
require_sections = ["Behavioral Examples", "Error Cases"]
no_stale = true
stale_threshold = 5
message = "Resolve drift before activation"

Use specsync lifecycle, specsync stale, and specsync score to inspect these policies. They do not replace the verified SDD states described below.

Verified SDD policy

.specsync/sdd.json is versioned independently so upgrading cannot silently introduce new CI gates:

{
  "version": 1,
  "enabled": true,
  "require_change_for_meaningful_files": true,
  "meaningful_paths": ["src/", "tests/", "site/", ".github/", "Cargo.toml"],
  "ignored_paths": [".specsync/", "specs/"],
  "verification_commands": ["fledge run test"],
  "custom_artifacts": {},
  "principles_file": null
}

Verification commands are parsed as explicit argument lists and run without a shell. Pipes, substitutions, redirections, and other shell operators are rejected. Committed policy/configuration files remain meaningful even if a broad ignored path would otherwise cover them.

custom_artifacts maps an artifact name to a project-owned Markdown template. principles_file optionally adds project governance to interviews and agent context.

Custom modules

Override automatic source ownership when a module spans unusual paths:

[modules."auth"]
files = ["src/auth/service.ts", "src/auth/middleware.ts"]
depends_on = ["database"]

[modules."api"]
files = ["src/routes/"]
depends_on = ["auth", "database"]

GitHub integration

[github]
repo = "CorvidLabs/spec-sync"
drift_labels = ["spec-drift", "needs-update"]
verify_issues = true

The repository is auto-detected from Git when repo is omitted.

Agent-native enrichment

specsync generate is deterministic and local. Use specsync agents install or specsync mcp to let an existing coding agent enrich artifacts under that agent's own credentials and permissions. Legacy AI configuration keys are ignored with migration guidance; their values are never printed or executed.

See AI and coding agents and the workflow guide for the surrounding lifecycle.