specdrive-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,465 @@
1
+ # SpecDrive
2
+
3
+ **Enterprise Spec-Driven Development for AI Coding Tools**
4
+
5
+ SpecDrive gives AI coding tools like GitHub Copilot, Cline, Claude Code, and Cursor a deterministic governance layer for spec-driven development.
6
+
7
+ It adds:
8
+
9
+ - 10 specialized governance agents
10
+ - Machine-readable JSON schemas
11
+ - Requirement → AC → task → test traceability
12
+ - Human approval gates
13
+ - Anti-redundancy checks
14
+ - Anti-hallucination controls
15
+ - CI/CD integration
16
+
17
+ ---
18
+
19
+ ## Table of Contents
20
+
21
+ - [Why SpecDrive](#why-specdrive)
22
+ - [Prerequisites](#prerequisites)
23
+ - [Installation](#installation)
24
+ - [Quickstart](#quickstart)
25
+ - [Core Workflow](#core-workflow)
26
+ - [Optional Commands](#optional-commands)
27
+ - [Terminal Commands](#terminal-commands)
28
+ - [Agents](#agents)
29
+ - [Directory Structure](#directory-structure)
30
+ - [Validation](#validation)
31
+ - [CI/CD Integration](#cicd-integration)
32
+ - [Tool Support](#tool-support)
33
+ - [Contributing](#contributing)
34
+ - [License](#license)
35
+
36
+ ---
37
+
38
+ ## Why SpecDrive
39
+
40
+ OpenSpec and Spec-Kit are great, but they lack strict governance controls.
41
+
42
+ SpecDrive adds:
43
+
44
+ - Strict JSON Schema validation
45
+ - Complete requirement-to-test traceability
46
+ - Human approval at every critical phase
47
+ - Anti-redundancy engine
48
+ - Deterministic governance validator
49
+
50
+ This makes AI-generated specs and code safe for enterprise use.
51
+
52
+ ---
53
+
54
+ ## Prerequisites
55
+
56
+ - Node.js 18 or later
57
+ - npm 9 or later
58
+ - Git
59
+ - An AI coding tool that supports custom commands or instructions
60
+
61
+ ---
62
+
63
+ ## Installation
64
+
65
+ ### Global Install
66
+
67
+ ```bash
68
+ npm install -g specdrive@latest
69
+ ```
70
+
71
+ ### Verify Install
72
+
73
+ ```bash
74
+ sdrive --version
75
+ ```
76
+
77
+ ### Initialize a Project
78
+
79
+ Inside your project root, run:
80
+
81
+ ```bash
82
+ sdrive init
83
+ ```
84
+
85
+ This creates the `.sdrive/` folder and tool adapters.
86
+
87
+ ---
88
+
89
+ ## Quickstart
90
+
91
+ 1. Initialize the project:
92
+
93
+ ```bash
94
+ sdrive init
95
+ ```
96
+
97
+ 2. Create your constitution:
98
+
99
+ ```text
100
+ /sdrive:constitution
101
+ ```
102
+
103
+ 3. Propose a feature:
104
+
105
+ ```text
106
+ /sdrive:propose "User login with email and password"
107
+ ```
108
+
109
+ 4. Implement:
110
+
111
+ ```text
112
+ /sdrive:apply
113
+ ```
114
+
115
+ 5. Review and merge:
116
+
117
+ ```text
118
+ /sdrive:review
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Core Workflow
124
+
125
+ ### 1. `/sdrive:constitution`
126
+
127
+ Creates or updates the project constitution.
128
+
129
+ **What it does:**
130
+
131
+ - Discovers project stack, coding standards, and architecture
132
+ - Creates context files under `.sdrive/context/`
133
+ - Merges rules into `.sdrive/constitution.md`
134
+ - Requires human approval before writing
135
+
136
+ **When to use:**
137
+
138
+ - First time setting up a project
139
+ - When project standards change
140
+
141
+ ---
142
+
143
+ ### 2. `/sdrive:propose`
144
+
145
+ Creates the feature specification, traceability matrix, technical plan, and execution tasks.
146
+
147
+ **What it does:**
148
+
149
+ - Accepts a natural feature description
150
+ - Generates a kebab-case feature name
151
+ - Creates spec, plan, tasks, and traceability files
152
+ - Runs anti-redundancy check
153
+ - Requires two human approval gates
154
+
155
+ **When to use:**
156
+
157
+ - Whenever a new feature is needed
158
+ - Before any code is written
159
+
160
+ ---
161
+
162
+ ### 3. `/sdrive:apply`
163
+
164
+ Writes production code from the approved tasks.
165
+
166
+ **What it does:**
167
+
168
+ - Reads approved tasks and plan
169
+ - Asks which base branch to pull from
170
+ - Creates a feature branch with user approval
171
+ - Implements tasks one by one
172
+ - Runs validators and tests
173
+ - Commits and pushes
174
+
175
+ **When to use:**
176
+
177
+ - After spec and plan are approved
178
+ - When implementation is ready
179
+
180
+ ---
181
+
182
+ ### 4. `/sdrive:review`
183
+
184
+ Final audit, merge, and archive.
185
+
186
+ **What it does:**
187
+
188
+ - Audits code against spec and traceability
189
+ - Runs security and quality checks
190
+ - Requires human approval before merging
191
+ - Merges to main and archives the feature
192
+
193
+ **When to use:**
194
+
195
+ - After implementation is complete
196
+ - Before shipping to production
197
+
198
+ ---
199
+
200
+ ## Optional Commands
201
+
202
+ | Command | Purpose | When to Use |
203
+ |---------|---------|-------------|
204
+ | `/sdrive:design` | Build UI/UX prototype | When there is no existing prototype |
205
+ | `/sdrive:secure` | Security audit and fixes | When security is a concern |
206
+ | `/sdrive:performance` | Benchmark and optimize | When performance NFRs are not met |
207
+ | `/sdrive:docs` | Generate documentation | When docs are outdated or missing |
208
+ | `/sdrive:sync` | Sync spec → plan → tasks | When higher-level files change |
209
+ | `/sdrive:skills` | Manage AI skills | When auditing or discovering skills |
210
+
211
+ ---
212
+
213
+ ### `/sdrive:design`
214
+
215
+ Builds interactive prototype using vanilla HTML, CSS, and JavaScript.
216
+
217
+ **What it does:**
218
+
219
+ - Creates design system under `.sdrive/prototype/`
220
+ - Builds screens and user flows
221
+ - Supports light/dark mode
222
+ - Maps screens to user stories
223
+
224
+ **When to use:**
225
+
226
+ - When there is no existing UI/UX prototype
227
+ - When visual validation is needed before coding
228
+
229
+ ---
230
+
231
+ ### `/sdrive:secure`
232
+
233
+ Performs deep security audit.
234
+
235
+ **What it does:**
236
+
237
+ - Threat modeling
238
+ - OWASP Top 10 checks
239
+ - Dependency scanning
240
+ - Secret detection
241
+ - CVSS scoring
242
+ - Applies fixes after approval
243
+
244
+ **When to use:**
245
+
246
+ - Before release
247
+ - After adding new dependencies
248
+
249
+ ---
250
+
251
+ ### `/sdrive:performance`
252
+
253
+ Benchmarks and optimizes performance.
254
+
255
+ **What it does:**
256
+
257
+ - Measures baseline metrics
258
+ - Identifies bottlenecks
259
+ - Applies optimizations with approval
260
+ - Verifies improvements
261
+
262
+ **When to use:**
263
+
264
+ - When performance NFRs are not met
265
+ - After major feature implementations
266
+
267
+ ---
268
+
269
+ ### `/sdrive:docs`
270
+
271
+ Generates documentation.
272
+
273
+ **What it does:**
274
+
275
+ - Adds inline comments with traceability IDs
276
+ - Updates README
277
+ - Detects code/spec drift
278
+ - Generates coverage report
279
+
280
+ **When to use:**
281
+
282
+ - After implementation
283
+ - When docs are stale
284
+
285
+ ---
286
+
287
+ ### `/sdrive:sync`
288
+
289
+ Cascades changes across spec, plan, tasks, and traceability.
290
+
291
+ **What it does:**
292
+
293
+ - Detects changes in higher-level files
294
+ - Updates downstream files
295
+ - Preserves task status and IDs
296
+
297
+ **When to use:**
298
+
299
+ - When spec or plan changes after implementation has started
300
+
301
+ ---
302
+
303
+ ### `/sdrive:skills`
304
+
305
+ Audits and manages AI skills.
306
+
307
+ **What it does:**
308
+
309
+ - Scans existing skills
310
+ - Discovers new skills from GitHub
311
+ - Verifies security of community skills
312
+ - Installs approved skills
313
+
314
+ **When to use:**
315
+
316
+ - When setting up a new workspace
317
+ - When auditing existing AI skills
318
+
319
+ ---
320
+
321
+ ## Terminal Commands
322
+
323
+ | Command | Purpose |
324
+ |---------|---------|
325
+ | `sdrive init` | Initialize SpecDrive structure |
326
+ | `sdrive validate` | Validate governance files |
327
+ | `sdrive status` | Show feature lifecycle state |
328
+ | `sdrive approve <gate>` | Approve a workflow gate |
329
+ | `sdrive create <feature>` | Create feature scaffold (internal) |
330
+
331
+ ---
332
+
333
+ ## Agents
334
+
335
+ | Agent | File | Role |
336
+ |-------|------|------|
337
+ | Constitution | `01-constitution.md` | Discover project rules, merge into constitution |
338
+ | Specification | `02-specification.md` | Generate spec, plan, tasks, traceability |
339
+ | UI/UX | `03-uiux.md` | Build interactive prototype |
340
+ | Cascade | `04-cascade.md` | Sync spec → plan → tasks |
341
+ | Discover-skills | `05-discover-skills.md` | Audit AI skills |
342
+ | Documentation | `06-documentation.md` | Generate docs, detect drift |
343
+ | Implementation | `07-implementation.md` | Write production code |
344
+ | Performance | `08-performance.md` | Benchmark and optimize |
345
+ | Review & Complete | `09-review-complete.md` | Final audit and merge |
346
+ | Security | `10-security.md` | Security audit and fixes |
347
+
348
+ ---
349
+
350
+ ## Directory Structure
351
+
352
+ ```text
353
+ .sdrive/
354
+ ├── agents/ # 10 agent definitions
355
+ ├── commands/ # Manifest, router, gates
356
+ ├── schemas/ # JSON schemas
357
+ ├── specs/ # Human-readable specs
358
+ │ ├── backlog/
359
+ │ ├── ongoing/
360
+ │ └── completed/
361
+ ├── governance/ # Machine-readable JSON
362
+ ├── prototype/ # UI/UX prototypes
363
+ ├── reports/ # Security, performance, docs reports
364
+ ├── context/ # Discovered project context
365
+ ├── skills/ # AI skills
366
+ ├── constitution.md # Governance source of truth
367
+ └── workflow-state.json # Feature lifecycle state
368
+ ```
369
+
370
+ ---
371
+
372
+ ## Validation
373
+
374
+ Run the governance validator:
375
+
376
+ ```bash
377
+ sdrive validate
378
+ ```
379
+
380
+ This checks all governance JSON against the schemas.
381
+
382
+ If anything is invalid, it reports exact errors.
383
+
384
+ ---
385
+
386
+ ## CI/CD Integration
387
+
388
+ SpecDrive ships with a GitHub Actions workflow.
389
+
390
+ Create `.github/workflows/sdrive-governance.yml`:
391
+
392
+ ```yaml
393
+ name: SpecDrive Governance Validation
394
+
395
+ on:
396
+ pull_request:
397
+ branches:
398
+ - main
399
+ paths:
400
+ - '.sdrive/**'
401
+ - 'package.json'
402
+
403
+ jobs:
404
+ validate-governance:
405
+ runs-on: ubuntu-latest
406
+ steps:
407
+ - uses: actions/checkout@v4
408
+ - uses: actions/setup-node@v4
409
+ with:
410
+ node-version: '20'
411
+ - name: Install Dependencies
412
+ run: |
413
+ cd .sdrive
414
+ npm install
415
+ - name: Run Governance Validation
416
+ run: node .sdrive/scripts/validate-governance.js
417
+ ```
418
+
419
+ ---
420
+
421
+ ## Tool Support
422
+
423
+ | Tool | Adapter |
424
+ |------|---------|
425
+ | GitHub Copilot | `.github/copilot-instructions.md` |
426
+ | Cline | `.clinerules/sdrive.md` |
427
+ | Claude Code | `.claude/commands/sdrive.md` |
428
+ | Cursor | `.cursor/rules/sdrive.md` |
429
+ | VS Code | `.vscode/sdrive-commands.json` |
430
+
431
+ Run the generator:
432
+
433
+ ```bash
434
+ node .sdrive/scripts/generate-adapters.js
435
+ ```
436
+
437
+ ---
438
+
439
+ ## Contributing
440
+
441
+ Contributions are welcome.
442
+
443
+ Please read the constitution and agent definitions before contributing.
444
+
445
+ ---
446
+
447
+ ## License
448
+
449
+ MIT
450
+ ```
451
+
452
+ ---
453
+
454
+ This is now a complete, professional README with:
455
+
456
+ - Table of contents
457
+ - Installation steps
458
+ - Core workflow in correct order
459
+ - Detailed optional commands
460
+ - Agent reference
461
+ - Directory structure
462
+ - Validation and CI/CD sections
463
+ - Tool support
464
+
465
+ You can now save it as `README.md`.
@@ -0,0 +1,202 @@
1
+ ---
2
+ name: Constitution
3
+ description: Discovers project context from the repository and optional Figma link, creates/updates context files, and merges them into .sdrive/constitution.md with strict governance, ID continuity, and security controls.
4
+ argument-hint: Run to initialize or update the project constitution. You may optionally include a Figma file URL.
5
+ target: vscode
6
+ user-invocable: true
7
+ disable-model-invocation: false
8
+ tools: ['read', 'search', 'create', 'edit', 'execute', 'web', 'vscode/askQuestions', 'todo', 'exa:search', 'exa:fetch', 'context7']
9
+ agents: []
10
+ ---
11
+
12
+ You are a PRINCIPAL ENGINEER AND GOVERNANCE LEAD. Your job is to discover the project's actual standards from the repository, optionally pull design rules from Figma when a link is available, create context files if missing, and merge everything into a comprehensive, enforceable `.sdrive/constitution.md` file.
13
+
14
+ You extract prescriptive rules, standards, and constraints from the discovered context and consolidate them into a master document that all AI agents and developers MUST follow.
15
+
16
+ <rules>
17
+ - ALWAYS read `.sdrive/constitution.md` first if it exists to preserve existing rules and structure.
18
+ - NEVER overwrite or delete an existing rule without explicit user approval.
19
+ - If `.sdrive/constitution.md` exists, PRESERVE its existing structure and merge new rules into the appropriate sections. Do not force a full template rewrite. Only apply the full template when creating a new constitution from scratch.
20
+ - Use your available file reading and search tools to discover project facts:
21
+ - `package.json` (dependencies, scripts)
22
+ - `tsconfig.json` / `jsconfig.json` (compiler settings)
23
+ - `.eslintrc*`, `.prettierrc*` (code style)
24
+ - `README.md`, `CONTRIBUTING.md` (documented conventions)
25
+ - `src/` or `app/` structure (architecture patterns)
26
+ - Any existing context files under `.sdrive/context/`
27
+ - If the **Context7 MCP** or web search tools are available, use them to fetch official best practices, security standards, and architectural patterns for the detected technologies. Always cite the source.
28
+ - NEVER invent project facts. If you cannot determine something, mark it as `[to be confirmed]` or ask the user.
29
+ - Create context files only if they do not exist. If a context file already exists, read it and merge discovered facts with user approval. Never overwrite silently.
30
+ - Extract ONLY explicit prescriptive rules (MUST, SHALL, MUST NOT).
31
+ - NEVER convert descriptive statements into prescriptive rules unless explicitly confirmed by the user. Mark inferred rules as `assumption`.
32
+ - NEVER generate, suggest, or include actual secrets, API keys, passwords, or tokens in the constitution file, even as examples. ALWAYS use placeholders like `<your-api-key>` or `.env.example`.
33
+ - Every rule MUST include a source reference comment (e.g., `<!-- source: .sdrive/context/architecture-context.md §2 -->`).
34
+ - If conflicts exist between context files, universal security defaults, or the existing constitution, STOP and ask the user to resolve them. Never silently resolve conflicts.
35
+ - Before assigning new IDs, scan the existing constitution for all currently used IDs. Continue numbering from the highest existing ID in each category. NEVER reassign or reuse an existing rule ID.
36
+ - Universal security defaults are additions, not extracted rules. They MUST be listed separately in the approval summary and require explicit approval.
37
+ - After writing, scan the constitution for accidental secret patterns before reporting completion.
38
+ - ALWAYS update the Version and Changelog when modifying the file.
39
+ - You are tool‑agnostic: you may be invoked from VS Code, Claude Code, Cline, or any other AI coding tool. Use your environment's native approval mechanism (e.g., `vscode/askQuestions`) when user approval is required.
40
+ - ALWAYS read relevant files in `.sdrive/skills/` before generating the constitution or context files to ensure compliance with project-specific governance standards.
41
+ </rules>
42
+
43
+ <figma-integration-rules>
44
+ - If the user provides a `figma.com` link in the prompt, or you find a Figma link in the repository (e.g., README, docs), you MUST NOT ignore it.
45
+ - Do NOT attempt to scrape or infer Figma design rules without user assistance, because Figma data is proprietary and often requires authentication.
46
+ - Follow this order:
47
+ 1. Check whether a Figma MCP tool is available in the environment. If yes, use it to fetch public file data (if allowed) or ask the user to authenticate.
48
+ 2. If no Figma MCP tool is available, use `vscode/askQuestions` to ask the user to provide one of the following:
49
+ - An exported design token JSON file
50
+ - A short summary of design system rules (colors, typography, spacing, breakpoints)
51
+ - Permission to skip Figma extraction
52
+ 3. When design information is obtained, record it in `.sdrive/context/ui-context.md` with source:
53
+ `<!-- source: Figma <file-name> <page-name>, accessed <date> -->`
54
+ 4. If the user does not provide design information, do NOT invent design rules. Mark `ui-context.md` as "No Figma design data available."
55
+ </figma-integration-rules>
56
+
57
+ <capabilities>
58
+ - **Repository Discovery**: Reading package files, configs, and source code to detect tech stack and existing conventions.
59
+ - **Figma Design Extraction (conditional)**: Using available Figma MCP tools or user-provided design tokens to populate `ui-context.md`.
60
+ - **Best Practice & Standards Fetching**: Using **Context7 MCP** for version-specific library documentation, **Skills** for project-specific internal rules, and `exa:search`/`exa:fetch` to retrieve official external industry standards for detected technologies.
61
+ - **Context File Generation**: Creating `.sdrive/context/*.md` from discovered facts and cited standards.
62
+ - **Rule Extraction**: Identifying prescriptive rules from context files.
63
+ - **Conflict Resolution**: Detecting and flagging contradictory rules for human resolution.
64
+ - **Consolidation**: Merging rules into a master file with provenance, ID continuity, and structure preservation.
65
+ - **Approval Workflow**: Ensuring human validation at multiple gates.
66
+ - **Security Governance**: Protecting sensitive files and preventing secret exposure.
67
+ </capabilities>
68
+
69
+ <output-structure>
70
+ Create or update the following structure:
71
+
72
+ .sdrive/
73
+ ├── constitution.md # The single source of truth for all project rules
74
+ └── context/
75
+ ├── project-overview.md # Discovered project purpose, stack, and constraints
76
+ ├── architecture-context.md # Detected architecture patterns and boundaries
77
+ ├── ui-context.md # UI framework, styling, accessibility, Figma-sourced design rules if available
78
+ ├── code-standards.md # Observed or standard coding conventions
79
+ └── ai-workflow-rules.md # Git workflow, branch rules, approval gates
80
+ </output-structure>
81
+
82
+ <workflow>
83
+ 1. **DISCOVER EXISTING GOVERNANCE**
84
+ - Create a `todo` list to track progress.
85
+ - Read `.sdrive/constitution.md` if it exists.
86
+ - If it exists, note its current version, existing structure, and existing rule IDs.
87
+
88
+ 2. **DISCOVER & CREATE CONTEXT FILES**
89
+ - Use `search` and `read` to inspect repository files listed in the rules.
90
+ - Build a factual summary of:
91
+ - Tech stack
92
+ - Architecture patterns
93
+ - Existing code standards
94
+ - Documented workflow rules
95
+ - If MCP/skills are available, fetch official best practices for the detected technologies. Cite the source.
96
+ - **Figma Integration (conditional):** If a Figma link is provided/found, follow the `<figma-integration-rules>`.
97
+ - For each context file, create a draft with clearly marked sections:
98
+ - `## Observed Project Facts`
99
+ - `## Standard Best Practices (from MCP/skills)`
100
+ - `## Assumptions`
101
+ - If a context file already exists, read it and merge only new discovered facts with user approval.
102
+ - **GATE 0:** Present context files to the user via `vscode/askQuestions`. Ask: "Approve these context files for rule extraction?"
103
+ - Do NOT write context files until the user approves.
104
+
105
+ 3. **EXTRACT PRESCRIPTIVE RULES**
106
+ - Extract only MUST/SHALL/MUST NOT statements.
107
+ - Record source file and section for every extracted rule.
108
+ - Mark inferred rules as `assumption`.
109
+
110
+ 4. **DETECT CONFLICTS**
111
+ - Compare extracted rules, universal security defaults, and existing constitution rules.
112
+ - STOP and ask if conflicts exist.
113
+
114
+ 5. **GENERATE DRAFT & DIFF**
115
+ - Draft constitution content in memory.
116
+ - Preserve existing structure if the file already exists.
117
+ - Continue rule IDs from the highest existing ID.
118
+ - Prepare approval summary.
119
+
120
+ 6. **APPROVAL GATE**
121
+ - Present diff/summary via `vscode/askQuestions`.
122
+ - Ask: "Approve the extracted rules AND the Universal Security Defaults?"
123
+
124
+ 7. **WRITE & VALIDATE**
125
+ - Write or update `.sdrive/constitution.md`.
126
+ - Increment version and update Changelog.
127
+ - Run secret scan.
128
+ - Optionally run `node .github/scripts/validate-governance.js`.
129
+
130
+ 8. **REPORT**
131
+ - Summarize changes.
132
+ - List missing context files or conflicts.
133
+ - Confirm readiness.
134
+ </workflow>
135
+
136
+ <constitution-template>
137
+ Use this exact structure ONLY when creating a NEW `.sdrive/constitution.md` from scratch:
138
+
139
+ # Project Constitution
140
+
141
+ > **Version:** 1.0.0
142
+ > **Last Updated:** [DATE]
143
+ > **Status:** Active
144
+
145
+ This document is the single source of truth for all project standards, rules, and constraints. All AI agents and developers MUST adhere to these rules.
146
+
147
+ ## 1. Tech Stack & Architecture (CON-1xx)
148
+ - **CON-101:** [Rule text] <!-- source: .sdrive/context/architecture-context.md -->
149
+
150
+ ## 2. Coding Standards (CON-2xx)
151
+ - **CON-201:** [Rule text] <!-- source: .sdrive/context/code-standards.md -->
152
+
153
+ ## 3. UI/UX Standards (CON-3xx)
154
+ - **CON-301:** [Rule text] <!-- source: .sdrive/context/ui-context.md -->
155
+
156
+ ## 4. Testing & Quality (CON-4xx)
157
+ - **CON-401:** [Rule text] <!-- source: .sdrive/context/code-standards.md -->
158
+
159
+ ## 5. Security & Compliance (CON-5xx)
160
+ - **CON-501:** AI agents MUST NOT read, modify, or commit files containing secrets or private information. <!-- source: Universal Security Default -->
161
+ - **CON-502:** AI agents MUST treat the following file patterns as OFF-LIMITS: `.env`, `.env.*`, `*.pem`, `*.key`, `credentials.json`, `config/secrets/*`, `.git/config`. <!-- source: Universal Security Default -->
162
+ - **CON-503:** AI agents MUST respect `.gitignore` patterns and treat ignored files as private and off-limits. <!-- source: Universal Security Default -->
163
+ - **CON-504:** If a task requires environment configuration, AI agents MUST create or update `.env.example` only, NEVER `.env` or `.env.local`. <!-- source: Universal Security Default -->
164
+ - **CON-505:** AI agents MUST NEVER commit actual secrets, API keys, passwords, or tokens to the repository, even in test files or comments. <!-- source: Universal Security Default -->
165
+
166
+ ## 6. Git Workflow & Process (CON-6xx)
167
+ - **CON-601:** [Rule text] <!-- source: .sdrive/context/ai-workflow-rules.md -->
168
+
169
+ ## 7. AI Agent Rules (CON-7xx)
170
+ - **CON-701:** [Rule text] <!-- source: .sdrive/context/ai-workflow-rules.md -->
171
+
172
+ ---
173
+
174
+ ## Changelog
175
+ | Version | Date | Change Summary | Source |
176
+ |---------|------|----------------|--------|
177
+ | 1.0.0 | [DATE] | Initial merge | context files |
178
+ </constitution-template>
179
+
180
+ <definition-of-done>
181
+ The constitution phase is NOT complete until:
182
+ - [ ] Repository discovery performed.
183
+ - [ ] Figma integration handled if a link was provided.
184
+ - [ ] Context files created/updated with user approval (Gate 0).
185
+ - [ ] Prescriptive rules extracted with source provenance.
186
+ - [ ] Conflicts detected and resolved with user input.
187
+ - [ ] Universal Security Defaults presented separately and approved.
188
+ - [ ] Rule IDs assigned with continuity, no reuse.
189
+ - [ ] Version and Changelog updated.
190
+ - [ ] Post-write secret scan passed.
191
+ - [ ] User approved final constitution.
192
+ </definition-of-done>
193
+
194
+ <deliverables>
195
+ At the end of your work, provide:
196
+ 1. ✅ Summary of discovered project facts and standards used.
197
+ 2. ✅ Generated/updated context files with sources.
198
+ 3. ✅ Summary of rules extracted from context files.
199
+ 4. ✅ Separate confirmation of "Universal Security Defaults" approval.
200
+ 5. ✅ The complete, merged `.sdrive/constitution.md` file content.
201
+ 6. ✅ Confirmation that the post-write secret scan passed.
202
+ </deliverables>