sync

v0.1.0

Detect and resolve drift between specs and implementation. AI-assisted resolution with human approval.

šŸ”„ spec-kit-sync

spec-kit-sync logo
Stop lying to your AI agents.

CI spec-kit extension License: MIT Latest Release


Your specs say one thing. Your code does another. Every time an AI reads your specs, it generates code that conflicts with reality. This extension fixes that.

The Problem

You wrote beautiful specs. Then reality happened:

  • šŸ”§ Bug fixes that changed behavior
  • šŸš€ Features added during "vibe coding"
  • šŸ“ Design docs that superseded specs
  • ā° Six months of evolution

Now your specs are documentation fossils. New developers can't trust them. AI agents generate conflicting code. The "regenerate from spec" promise is broken.

The Solution

/speckit.sync.analyze

šŸ“Š Drift Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Specs Analyzed:     12
Requirements:       276
  āœ… Aligned:       193 (70%)
  āš ļø  Drifted:       31 (11%)
  ā“ Unverifiable:   52 (19%)

Unspecced Code:     36 features
Conflicts:           2 (spec vs design doc)

Top Issues:
  • spec-008 says 5 fields, code extracts 4-8 per type
  • spec-011 says one row per doc, code splits receipts
  • ReconcileCommand has no spec coverage

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Quick Start

# Install the extension
specify extension add --from https://github.com/bgervin/spec-kit-sync/archive/refs/heads/master.zip

# Analyze your project
/speckit.sync.analyze

# Fix drift
/speckit.sync.propose --interactive
/speckit.sync.apply

# Backfill missing specs
/speckit.sync.backfill <feature-name> --create

Commands

CommandWhat it does
speckit.sync.analyzeDetect drift between specs and code
speckit.sync.proposeAI suggests fixes (update spec or fix code)
speckit.sync.applyApply approved changes
speckit.sync.conflictsFind inter-spec contradictions
speckit.sync.backfillGenerate spec from unspecced code

How It Works

1. Analyze

Scans specs and code to find:

  • Drifted requirements: Spec says X, code does Y
  • Unspecced features: Code exists, no spec covers it
  • Conflicts: Two specs (or spec vs design doc) contradict
/speckit.sync.analyze --spec 011   # Check one spec
/speckit.sync.analyze --json       # Machine-readable

2. Propose

AI analyzes each drift and suggests a resolution:

StrategyWhenAction
BackfillCode is rightUpdate spec to match code
AlignSpec is rightTask to fix code
SupersedeNewer doc winsMark old spec superseded
HumanCan't tellSurface for review
/speckit.sync.propose --interactive    # Review one-by-one
/speckit.sync.propose --strategy backfill-all

3. Apply

Execute approved proposals with safety checks:

/speckit.sync.apply --dry-run     # Preview changes
/speckit.sync.apply               # Do it
/speckit.sync.apply --auto-commit # Commit after

4. Backfill

Generate complete specs from existing code:

/speckit.sync.backfill reconciliation --create

Creates:

  • spec.md — Requirements extracted from code
  • plan.md — Architecture documentation
  • quickstart.md — User guide (if CLI command)
  • tasks.md — Review checklist

Ralph Loop Integration

Keep specs synced during autonomous coding:

# sync-config.yml
ralph:
  post_iteration_check: true
  on_drift: pause  # backfill | warn | pause

The loop pauses when drift is detected, preventing compound errors.

Real Example

This extension was built to fix fina, a personal finance CLI that drifted during development:

Before:

  • 12 specs, ~70% coverage
  • 3 features with no specs (reconciliation, hints, type-aware extraction)
  • spec-008 contradicted by later design doc
  • AI agents confused by stale specs

After:

/speckit.sync.analyze
/speckit.sync.backfill reconciliation --create
/speckit.sync.backfill hints --create
/speckit.sync.backfill type-aware-extraction --create

Result: 15 specs, documented architecture, AI agents aligned with reality.

Installation

# From URL
specify extension add --from https://github.com/bgervin/spec-kit-sync/archive/refs/heads/master.zip

# Development mode (local clone)
specify extension add --dev /path/to/spec-kit-sync

# From catalog (coming soon)
specify extension add sync

Configuration

mkdir -p .specify/extensions/sync
cp sync-config.template.yml .specify/extensions/sync/sync-config.yml

See sync-config.template.yml for all options.

Why This Matters

AI coding agents are only as good as their context. When specs lie:

  1. Agent reads outdated spec
  2. Agent generates code matching spec
  3. Code conflicts with existing implementation
  4. Human spends time fixing AI's "correct" code
  5. Trust in AI assistance erodes

spec-kit-sync keeps specs honest, so AI agents generate code that actually works.


Built for spec-kit | MIT License

Stats

6 stars

Version

0.1.0
Updated 25 days ago

Install

Using the Specify CLI

specify extension add --from https://github.com/bgervin/spec-kit-sync/archive/refs/tags/v0.1.0.zip

Owners

Categories

syncdriftvalidationbidirectionalbackfill

License

MIT