Skip to content

rechedev9/shenronSDD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

348 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SHENRON — Spec-Driven Development

SDD — Spec-Driven Development

Go CLI that turns Claude Code into a structured engineering pipeline.
Deterministic orchestration. Zero-token state management. Cached context assembly.

CI Go 1.25 Phases: 10 MIT License

Why SDD? · Pipeline · Architecture · Commands · Skills · Advanced · Contributing


AI coding agents waste ~65% of their tokens on mechanical bookkeeping — reading SKILL files, tracking state, loading artifacts, running build commands. None of that requires intelligence. sdd is a Go binary that handles all deterministic operations at zero token cost, so Claude only spends tokens on reasoning.

Claude = reasoning (expensive, probabilistic)
Go     = orchestration (free, deterministic)

Install

curl -sSL https://raw.githubusercontent.com/rechedev9/shenronSDD/master/install.sh | bash

Or from source:

git clone https://github.com/rechedev9/shenronSDD
cd shenronSDD && ./install.sh

Requires Claude Code CLI + Go 1.25+.

Quick start

cd your-project
claude
/sdd-init                              # detect stack, create openspec/
/sdd-new my-feature "what to build"    # explore + propose
/sdd-continue                          # repeat until archive

Highlights

  • 65% token reduction — from ~458K to ~161K tokens per pipeline. Go handles all mechanical work.
  • 10-phase pipeline — explore → propose → spec + design (parallel) → tasks → apply → review → verify → clean → archive.
  • Zero-token phases — init, verify, and archive run entirely in Go. No LLM involved.
  • Content-hash cache — SHA256 of input artifacts + SKILL.md. Cache hits served in 0ms. Per-phase TTLs.
  • Context Cascade — cumulative decision summary carried forward across phases at zero cost.
  • Phase registry — pluggable Phase struct with prerequisites, artifacts, cache config, and assembler. Custom phases via Register().
  • Event broker — pub/sub decouples state machine from metrics, caching, and logging. Non-blocking with panic recovery.
  • Concurrent loadingLazySlice loads artifacts in parallel goroutines. Blocks only on consumption.
  • Flexible phase refssdd context foo p (prefix), sdd context foo 3 (index). Abbreviations just work.
  • sdd doctor — validates config, cache integrity, artifact completeness. --json for CI.

How it works

┌─────────────────────────────────────────────────────────────────┐
│                        sdd context                              │
│                                                                 │
│  ┌─────────┐   ┌──────────┐   ┌──────────┐   ┌──────────────┐  │
│  │ SKILL.md│ + │Artifacts │ + │ Cascade  │ + │ Config/Tree  │  │
│  └────┬────┘   └────┬─────┘   └────┬─────┘   └──────┬───────┘  │
│       └─────────────┼──────────────┼────────────────┘           │
│                     ▼                                           │
│              Assembled Context                                  │
│              (cached, 0ms hit)                                  │
└─────────────────────┬───────────────────────────────────────────┘
                      ▼
               Claude reasons
               writes .pending/
                      ▼
┌─────────────────────┴───────────────────────────────────────────┐
│                        sdd write                                │
│                                                                 │
│  Promote artifact  →  Advance state machine  →  Emit events    │
└─────────────────────────────────────────────────────────────────┘

Each phase: Go assembles context (0 tokens) → Claude reasons → Go promotes + advances (0 tokens). Claude does all the thinking. Go does all the bookkeeping.


Everything we built

Pipeline phases

Phase Actor Output
explore Claude (Sonnet) exploration.md — codebase analysis, risk assessment
propose Claude (Opus) proposal.md — intent, scope, approach, risks, rollback
spec Claude (Opus) specs/*.md — RFC 2119 requirements with Given/When/Then
design Claude (Opus) design.md — type definitions, file changes, before/after
tasks Claude (Sonnet) tasks.md — ordered implementation checklist
apply Claude (Opus) source files — implements one task at a time
review Claude (Opus) review-report.md — semantic code review against spec
verify Go verify-report.md — runs build/lint/test (0 tokens)
clean Claude (Sonnet) clean-report.md — dead code removal
archive Go archive/ — moves completed change (0 tokens)

CLI commands

Command What it does
sdd init Detect stack, create openspec/, write config.yaml
sdd new <name> <desc> Create change, capture git HEAD, print explore context
sdd context <name> [phase] Assemble SKILL + artifacts + cascade (cached)
sdd write <name> <phase> Promote .pending/ artifact, advance state machine
sdd verify <name> Run build/lint/test with progress logging
sdd archive <name> Move to archive/, write manifest
sdd status <name> Phase progress + staleness detection
sdd list Active changes with current phase
sdd diff <name> Files changed since sdd new
sdd health <name> Token usage, cache stats, pipeline warnings
sdd doctor Validate config, cache, artifacts
sdd errors Verify failures grouped by fingerprint
sdd dashboard Live ops dashboard on localhost:8811
sdd dump Full workflow state as JSON

Details: CLI Reference

Slash commands

Command What it does
/sdd-init Detect stack, create openspec/
/sdd-new <name> <desc> Explore + propose in one shot
/sdd-continue [name] Run next phase automatically
/sdd-ff <name> Fast-forward: explore → propose → spec+design → tasks
/sdd-apply [name] Implement current task
/sdd-review [name] Semantic code review
/sdd-verify [name] Build/lint/test (zero tokens if green)
/sdd-clean [name] Dead code removal
/sdd-archive [name] Close and archive change

Details: Commands Reference

Flags

--json on all commands for CI/scripting. -q quiet (exit code only). -v verbose (cache, timing). -d debug (full trace).

Skills

Category Count Examples
SDD phases 11 sdd-explore, sdd-propose, sdd-spec, ...
Frameworks 14+ Go, React, TypeScript, Next.js, Python, ...
Analysis 4 Code review, security audit, ...
Knowledge 3 Domain modeling, ...
Workflows 4 CI/CD, deployment, ...

Details: Skills Catalog

Internal architecture

  • Phase Registry — single Phase struct replaces 4 parallel maps. Pluggable custom phases via Register().
  • State Machine — prerequisite-driven transitions, atomic persistence, crash recovery from artifacts.
  • Context Assemblers — per-phase assemblers with content-hash cache and TTL expiration.
  • Event Broker — pub/sub for metrics, cache persistence, stderr output. Panic-safe subscribers.
  • LazySlice — concurrent artifact loading. Start goroutines eagerly, block on consumption.
  • Artifact System.pending/ staging, promotion, listing, reading.
  • Config Detection — auto-detect language, build/test/lint commands, manifests.
  • Telemetry Store — SQLite (WAL mode) for phase tokens, cache stats, verify errors. Fingerprinted error grouping.
  • Dashboard — embedded HTMX server with KPIs, pipeline progress, error log.

Details: Architecture · Go CLI Patterns


Cache architecture

openspec/changes/{name}/.cache/
  spec.hash         # SHA256(v6:SKILL.md + proposal.md + exploration.md) | timestamp
  spec.ctx          # Pre-assembled context (0ms on cache hit)
  metrics.json      # Cumulative: bytes, tokens, cache hits/misses per phase
  • Content-hash — SHA256 of input artifacts + SKILL.md + cacheVersion. Any input change = cache miss.
  • Per-phase TTL — apply=30min, spec/design=2h, propose=4h. Defined in the phase registry.
  • Version guard — bumping cacheVersion invalidates all caches automatically.
  • Smart-skip verify — reuses last PASSED report if no source files changed.

When to use SDD

One-line fix        →  just edit the file
Small change        →  /sdd-explore + manual edit
Medium change       →  /sdd-ff + /sdd-apply + /sdd-verify
Large change        →  full 10-phase pipeline
Architecture        →  full pipeline + extra review cycles

Project structure

shenronSDD/
  sdd-cli/                    # Go CLI source
    cmd/sdd/main.go
    internal/
      phase/                  # Phase struct + Registry (single source of truth)
      cli/                    # 14 subcommands (one per cmd_*.go file)
      state/                  # State machine, atomic persistence
      context/                # Assemblers, cache, metrics, Context Cascade
      artifacts/              # .pending write/promote/read/list
      config/                 # Stack detection, config.yaml
      verify/                 # Build/lint/test runner, archive
      store/                  # SQLite telemetry (WAL mode)
      events/                 # Pub/sub event broker
      csync/                  # Concurrent artifact loading
      dashboard/              # Live ops HTTP server (HTMX)
      errlog/                 # Error log with fingerprinting
      fsutil/                 # Atomic file writes
  skills/                     # SKILL.md files (loaded by sdd context)
  commands/                   # Slash command definitions
  docs/                       # 13 documentation files
  install.sh                  # One-line installer

Docs

Getting started

  • Why SDD? — the problem with AI coding and how SDD solves it
  • Pipeline — deep dive into all 10 phases
  • Configuration — config.yaml, stack detection, setup

Reference

Architecture

  • Pillars — the architectural pillars including Harness Infrastructure
  • Architecture — internal architecture of the Go CLI
  • Go CLI Patterns — 14 Go patterns from production CLIs
  • Token Economics — measured token consumption before/after
  • Advanced — cache, Context Cascade, TTL, metrics

Community


Contributing

  • CLI — new commands, performance, caching improvements
  • Skills — Vue, Svelte, FastAPI, Spring Boot, and more
  • Phases — better prompts, output formats
  • Tests — integration tests, edge case coverage
  • Docs — tutorials, case studies

See Contributing to CLI for the build/test/patterns guide.


License

MIT

About

Spec-Driven Development for Claude Code — structured AI coding that doesn't forget, doesn't hallucinate, and doesn't skip steps.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages