name = "sdd-steering"
description = "Generate or update project memory (steering context)"

[[instructions]]
role = "system"
content = """
You are executing the /sdd-steering command to generate or update the project's steering context.

# What is Steering?

Steering provides **project memory** for all AI agents. It consists of 3 core files that document:
1. **structure.md** - Architecture patterns, directory structure, naming conventions
2. **tech.md** - Technology stack, frameworks, tools
3. **product.md** - Business context, product goals, users

# Mode Detection

Determine which mode to use:

1. **Bootstrap Mode** - No steering files exist
   - Analyze entire codebase
   - Generate initial steering files
   - Create both English (.md) and Korean (.ko.md) versions

2. **Sync Mode** - Steering files exist, codebase has changed
   - Compare current steering with codebase
   - Identify discrepancies
   - Update steering files to match reality
   - Preserve both English and Korean versions

3. **Review Mode** - User wants to review/improve steering
   - Present current steering
   - Suggest improvements
   - Ask user for feedback

# Mode 1: Bootstrap (First Time)

## Detection
- `steering/` directory doesn't exist OR
- `steering/structure.md`, `steering/tech.md`, `steering/product.md` don't exist

## Steps

1. **Analyze Codebase**:
   - Directory structure
   - File organization patterns
   - Technology stack (package.json, requirements.txt, go.mod, etc.)
   - Frameworks detected
   - Database technologies
   - API patterns
   - Testing frameworks
   - Build tools
   - Deployment configurations

2. **Infer Product Context**:
   - README.md analysis
   - Package descriptions
   - Domain concepts from code
   - User types from code

3. **Generate Steering Files** (Bilingual):

   **IMPORTANT**: Create BOTH English and Korean versions for each file.
   **English version is always the reference/source.**

   Create `steering/structure.md` (English) with:
   - Architecture pattern (monolith, microservices, library-first, etc.)
   - Directory organization rules
   - Naming conventions
   - Component boundaries
   - Integration patterns

   Create `steering/structure.ko.md` (Korean) with:
   - Translation of structure.md content
   - All technical terms consistent with English version

   Create `steering/tech.md` (English) with:
   - Primary language(s) and versions
   - Frameworks and versions
   - Database(s) and versions
   - API technologies (REST, GraphQL, gRPC)
   - Testing frameworks
   - Build/deployment tools
   - Development tools

   Create `steering/tech.ko.md` (Korean) with:
   - Translation of tech.md content
   - Technology names kept in English with Korean explanations

   Create `steering/product.md` (English) with:
   - Product vision (inferred from README)
   - Target users (inferred from code)
   - Core capabilities
   - Business domain
   - Success metrics (if available)

   Create `steering/product.ko.md` (Korean) with:
   - Translation of product.md content
   - Product terminology consistent with English version

4. **Bilingual File Generation**:
   - Generate English version (.md) FIRST
   - Then generate Korean translation (.ko.md)
   - English version is the reference for all agents
   - Korean version for Korean-speaking team members

5. **Create Rules Directory**:
   - Copy constitutional governance files
   - Copy workflow guide
   - Copy EARS format guide

## Output

Present summary with created files and key findings.

# Mode 2: Sync (Update Existing)

## Detection
- Steering files exist
- Codebase may have changed since last steering update

## Steps

1. **Read Current Steering**:
   - Read `steering/structure.md`
   - Read `steering/tech.md`
   - Read `steering/product.md`

2. **Analyze Current Codebase**:
   - Same analysis as Bootstrap mode
   - Compare with current steering

3. **Detect Discrepancies**:
   - New technologies added?
   - Architecture changed?
   - New components added?
   - Directory structure evolved?

4. **Update Steering Files** (Bilingual):
   - Update English version (.md) FIRST
   - Update sections that changed
   - Preserve sections that are still accurate
   - Add changelog entries
   - Then update Korean version (.ko.md) to match
   - Ensure both versions stay synchronized

5. **Generate Sync Report**:
   - List changes detected
   - Show updated files
   - Note files with no changes

# Mode 3: Review (User-Initiated Review)

## Steps

1. **Present Current Steering**:
   - Show current structure.md summary
   - Show current tech.md summary
   - Show current product.md summary

2. **Identify Improvement Opportunities**:
   - Missing information
   - Outdated information
   - Unclear sections
   - Inconsistencies

3. **Ask User for Feedback**:
   - Get user confirmation on changes
   - Update based on feedback

# Constitutional Compliance

This command supports **Article VI: Project Memory**:
> All agents SHALL consult project memory (steering files) before making decisions.

By maintaining accurate steering files, all agents can:
- Make context-aware decisions
- Follow established patterns
- Align with product goals
- Use correct technologies

# Validation

After generating/updating steering:

1. **Completeness Check**:
   - All 3 core files present
   - Both English and Korean versions
   - Rules directory populated

2. **Accuracy Check**:
   - Technologies match package.json
   - Architecture matches codebase structure
   - Product context aligns with README

3. **Consistency Check**:
   - English and Korean versions match
   - No contradictions between files
   - Steering aligns with constitutional articles

# Next Steps

Once steering is complete, users can:
1. Review and adjust steering files manually
2. Proceed with requirements analysis: /sdd-requirements [feature]
3. Use any command (they will now have project context)

**Execute steering generation/update now.**
"""
