Initialize SDD for a project by detecting local conventions, creating the
minimal OpenSpec structure when needed, and persisting startup context.
-
Read the shared conventions before initializing.
-
Detect project stack and conventions from repository files:
- Stack indicators:
package.json, go.mod, pyproject.toml,
requirements.txt, Cargo.toml, pom.xml, build.gradle,
composer.json.
- Testing indicators:
vitest.config.*, jest.config.*,
playwright.config.*, pytest.ini, tox.ini, go test conventions,
Cargo.toml test crates.
- Style indicators:
biome.json, .eslintrc*, eslint.config.*,
.prettierrc*, ruff.toml, .golangci.*, rustfmt.toml.
- CI indicators:
.github/workflows/*, .gitlab-ci.yml,
azure-pipelines.yml, .circleci/config.yml.
- Architecture hints: common layout markers such as
apps/, packages/,
services/, src/, cmd/, internal/.
-
Build concise config context (max 10 lines) using detected values. Use
unknown for missing signals.
-
If the selected mode includes OpenSpec (openspec or hybrid), check
whether these already exist:
openspec/config.yaml
openspec/specs/
openspec/changes/
-
If all required OpenSpec paths already exist, report what exists and ask the
orchestrator whether config.yaml should be updated. Do not overwrite by
default.
-
If any required OpenSpec path is missing and mode includes OpenSpec, create
only the minimum structure:
openspec/
├── config.yaml
├── specs/
└── changes/
└── archive/
-
Generate openspec/config.yaml dynamically with this shape:
schema: spec-driven
context: |
Tech stack: {detected}
Architecture: {detected}
Testing: {detected}
Style: {detected}
rules:
proposal:
- Include rollback plan for risky changes
- Identify affected modules/packages
specs:
- Use Given/When/Then format for scenarios
- Use RFC 2119 keywords (MUST, SHALL, SHOULD, MAY)
design:
- Include sequence diagrams for complex flows
- Document architecture decisions with rationale
tasks:
- Group tasks by phase (infrastructure, implementation, testing)
- Use hierarchical numbering (1.1, 1.2, etc.)
- Keep tasks small enough to complete in one session
apply:
- Follow existing code patterns and conventions
tdd: false
test_command: ''
verify:
test_command: ''
build_command: ''
coverage_threshold: 0
archive:
- Warn before merging destructive deltas
-
Never create placeholder SDD artifacts (proposal.md, design.md,
tasks.md, or spec files) during initialization.
-
If the selected mode includes thoth-mem (thoth-mem or hybrid), persist
the detected context and initialization status with:
thoth_mem_mem_save(
title: "sdd-init/{project-name}",
topic_key: "sdd-init/{project-name}",
type: "config",
project: "{project-name}",
scope: "project",
content: "What: ...\nWhy: ...\nWhere: ...\nLearned: ..."
)
-
In hybrid mode, initialization is complete only when both OpenSpec setup
and thoth-mem persistence succeed.