@chongyan/autospec 1.0.1

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.
Files changed (243) hide show
  1. package/LICENSE +21 -0
  2. package/README.en.md +472 -0
  3. package/README.md +476 -0
  4. package/bin/autospec.js +3 -0
  5. package/knowledge/README.md +144 -0
  6. package/knowledge/checklists/code.md +182 -0
  7. package/knowledge/checklists/design.md +196 -0
  8. package/knowledge/checklists/release.md +70 -0
  9. package/knowledge/checklists/requirement.md +169 -0
  10. package/knowledge/checklists/test.md +46 -0
  11. package/knowledge/config/README.en.md +44 -0
  12. package/knowledge/config/README.md +44 -0
  13. package/knowledge/config/role-composition.yaml +98 -0
  14. package/knowledge/config/role-extensions.yaml +140 -0
  15. package/knowledge/config/skill-compositions.yaml +142 -0
  16. package/knowledge/config/team-stage.yaml +95 -0
  17. package/knowledge/config/team-tasks.yaml +139 -0
  18. package/knowledge/config/team-triggers.yaml +198 -0
  19. package/knowledge/config/validation-patterns.yaml +137 -0
  20. package/knowledge/domain/README.md +115 -0
  21. package/knowledge/domain/flows/README.md +194 -0
  22. package/knowledge/domain/glossary.md +143 -0
  23. package/knowledge/domain/rules.md +138 -0
  24. package/knowledge/environment/README.en.md +36 -0
  25. package/knowledge/environment/README.md +87 -0
  26. package/knowledge/environment/component-knowledge.md +316 -0
  27. package/knowledge/environment/detection-patterns.yaml +502 -0
  28. package/knowledge/environment/middleware-knowledge.md +237 -0
  29. package/knowledge/environment/template-registry.md +321 -0
  30. package/knowledge/guides/domain-driven-design.md +345 -0
  31. package/knowledge/guides/knowledge-management.md +369 -0
  32. package/knowledge/guides/requirement-engineering.md +329 -0
  33. package/knowledge/guides/stages/ai-effect-evaluator.md +93 -0
  34. package/knowledge/guides/stages/code-implementer.md +205 -0
  35. package/knowledge/guides/stages/code-reviewer.md +111 -0
  36. package/knowledge/guides/stages/consistency-checker.md +177 -0
  37. package/knowledge/guides/stages/design-planner.md +401 -0
  38. package/knowledge/guides/stages/design-reviewer.md +83 -0
  39. package/knowledge/guides/stages/integration-test-runner.md +105 -0
  40. package/knowledge/guides/stages/release-checker.md +205 -0
  41. package/knowledge/guides/stages/requirement-analyzer.md +195 -0
  42. package/knowledge/guides/stages/requirement-reviewer.md +83 -0
  43. package/knowledge/guides/stages/security-reviewer.md +89 -0
  44. package/knowledge/guides/stages/test-context-analyzer.md +250 -0
  45. package/knowledge/guides/stages/test-generator.md +241 -0
  46. package/knowledge/guides/stages/test-planner.md +183 -0
  47. package/knowledge/guides/stages/test-reviewer.md +76 -0
  48. package/knowledge/guides/stages/unit-test-runner.md +83 -0
  49. package/knowledge/guides/support/ai-agent-analyzer.md +362 -0
  50. package/knowledge/guides/support/ai-anomaly-analyzer.md +213 -0
  51. package/knowledge/guides/support/ai-artifact-evaluator.md +192 -0
  52. package/knowledge/guides/support/ai-capability-analyzer.md +193 -0
  53. package/knowledge/guides/support/ai-component-analyzer.md +169 -0
  54. package/knowledge/guides/support/ai-data-validator.md +276 -0
  55. package/knowledge/guides/support/ai-evaluation-planner.md +374 -0
  56. package/knowledge/guides/support/ai-path-evaluator.md +274 -0
  57. package/knowledge/guides/support/ai-pipeline-evaluator.md +219 -0
  58. package/knowledge/guides/support/ai-rag-analyzer.md +339 -0
  59. package/knowledge/guides/support/ai-task-assessor.md +418 -0
  60. package/knowledge/guides/support/ai-test-diagnostics.md +133 -0
  61. package/knowledge/guides/support/complexity-assessor.md +268 -0
  62. package/knowledge/guides/support/component-discovery.md +183 -0
  63. package/knowledge/guides/support/environment-scanner.md +207 -0
  64. package/knowledge/guides/support/environment-validator.md +207 -0
  65. package/knowledge/guides/support/knowledge-generator.md +234 -0
  66. package/knowledge/guides/support/methodology-extractor.md +55 -0
  67. package/knowledge/guides/support/pipeline-protocol.md +438 -0
  68. package/knowledge/guides/support/practice-logger.md +359 -0
  69. package/knowledge/guides/support/scope-inference.md +174 -0
  70. package/knowledge/guides/support/skill-distiller.md +91 -0
  71. package/knowledge/guides/support/skill-updater.md +45 -0
  72. package/knowledge/guides/support/skill-validator.md +72 -0
  73. package/knowledge/guides/support/team-orchestrator.md +323 -0
  74. package/knowledge/guides/support/tech-stack-analyzer.md +139 -0
  75. package/knowledge/guides/support/test-runner.md +254 -0
  76. package/knowledge/guides/system-design.md +352 -0
  77. package/knowledge/organization/ai-native-team.md +318 -0
  78. package/knowledge/organization/team-metrics.md +228 -0
  79. package/knowledge/principles/constitution.md +134 -0
  80. package/knowledge/principles/core-principles.md +368 -0
  81. package/knowledge/principles/design-philosophy.md +877 -0
  82. package/knowledge/principles/evolution.md +553 -0
  83. package/knowledge/process/01-requirement.md +113 -0
  84. package/knowledge/process/02-design.md +123 -0
  85. package/knowledge/process/03-implementation.md +90 -0
  86. package/knowledge/process/04-review.md +80 -0
  87. package/knowledge/process/05-testing.md +90 -0
  88. package/knowledge/process/06-delivery.md +88 -0
  89. package/knowledge/process/README.en.md +38 -0
  90. package/knowledge/process/README.md +48 -0
  91. package/knowledge/process/ai-sdlc.md +475 -0
  92. package/knowledge/process/overview.md +319 -0
  93. package/knowledge/standards/code-review.md +876 -0
  94. package/knowledge/standards/coding-style.md +940 -0
  95. package/knowledge/standards/data-consistency.md +1085 -0
  96. package/knowledge/standards/document-versioning.md +210 -0
  97. package/knowledge/standards/risk-detection.md +186 -0
  98. package/knowledge/templates/ai-evaluation.md +150 -0
  99. package/knowledge/templates/api-design.md +117 -0
  100. package/knowledge/templates/database-design.md +132 -0
  101. package/knowledge/templates/domain-driven-design.md +321 -0
  102. package/knowledge/templates/product-proposal.md +201 -0
  103. package/knowledge/templates/system-design.md +227 -0
  104. package/knowledge/templates/task-breakdown.md +107 -0
  105. package/knowledge/templates/test-case.md +170 -0
  106. package/package.json +53 -0
  107. package/plugins/.claude-plugin/plugin.json +134 -0
  108. package/plugins/agents/roles/ai-engineer.md +129 -0
  109. package/plugins/agents/roles/backend-engineer.md +165 -0
  110. package/plugins/agents/roles/ceo.md +94 -0
  111. package/plugins/agents/roles/data-engineer.md +135 -0
  112. package/plugins/agents/roles/devops-engineer.md +181 -0
  113. package/plugins/agents/roles/frontend-engineer.md +129 -0
  114. package/plugins/agents/roles/product-owner.md +98 -0
  115. package/plugins/agents/roles/quality-engineer.md +129 -0
  116. package/plugins/agents/roles/security-engineer.md +180 -0
  117. package/plugins/agents/roles/tech-lead.md +97 -0
  118. package/plugins/agents/support/blind-comparator.md +88 -0
  119. package/plugins/agents/support/consistency-checker.md +103 -0
  120. package/plugins/agents/support/failure-diagnostician.md +141 -0
  121. package/plugins/agents/support/independent-reviewer.md +80 -0
  122. package/plugins/agents/support/safety-auditor.md +121 -0
  123. package/plugins/agents/support/skill-benchmarker.md +86 -0
  124. package/plugins/agents/support/skill-forger.md +105 -0
  125. package/plugins/agents/support/stage-gate-evaluator.md +121 -0
  126. package/plugins/agents/support/test-coverage-reviewer.md +73 -0
  127. package/plugins/benchmarks/templates/README.md +44 -0
  128. package/plugins/benchmarks/templates/commands/explore-template.yaml +48 -0
  129. package/plugins/benchmarks/templates/pipeline/agile-template.yaml +84 -0
  130. package/plugins/benchmarks/templates/pipeline/waterfall-template.yaml +106 -0
  131. package/plugins/benchmarks/templates/skills/requirement-analyzer-template.yaml +48 -0
  132. package/plugins/commands/README.en.md +96 -0
  133. package/plugins/commands/README.md +96 -0
  134. package/plugins/commands/apply.md +191 -0
  135. package/plugins/commands/archive.md +76 -0
  136. package/plugins/commands/env-export.md +79 -0
  137. package/plugins/commands/env-sync.md +640 -0
  138. package/plugins/commands/env-template.md +223 -0
  139. package/plugins/commands/env-update.md +264 -0
  140. package/plugins/commands/env-validate.md +176 -0
  141. package/plugins/commands/env.md +79 -0
  142. package/plugins/commands/explore.md +76 -0
  143. package/plugins/commands/field-evolve.md +536 -0
  144. package/plugins/commands/memory.md +249 -0
  145. package/plugins/commands/project-evolve.md +821 -0
  146. package/plugins/commands/propose.md +93 -0
  147. package/plugins/commands/review.md +140 -0
  148. package/plugins/commands/run.md +224 -0
  149. package/plugins/commands/status.md +62 -0
  150. package/plugins/commands/validate.md +108 -0
  151. package/plugins/hooks/README.en.md +56 -0
  152. package/plugins/hooks/README.md +56 -0
  153. package/plugins/hooks/ai-project-guard.js +329 -0
  154. package/plugins/hooks/artifact-evaluation-hook.js +237 -0
  155. package/plugins/hooks/constitution-guard.js +211 -0
  156. package/plugins/hooks/environment-autocommit.js +264 -0
  157. package/plugins/hooks/environment-manager.js +778 -0
  158. package/plugins/hooks/execution-tracker.js +354 -0
  159. package/plugins/hooks/frozen-zone-guard.js +140 -0
  160. package/plugins/hooks/layer1-validator.js +423 -0
  161. package/plugins/hooks/lib/artifact-evaluator.js +414 -0
  162. package/plugins/hooks/lib/benchmarks/change-detector.js +390 -0
  163. package/plugins/hooks/lib/benchmarks/evaluator.js +605 -0
  164. package/plugins/hooks/lib/benchmarks/integration-example.js +169 -0
  165. package/plugins/hooks/lib/data-and-ai-detector.js +275 -0
  166. package/plugins/hooks/lib/detection-pattern-loader.js +865 -0
  167. package/plugins/hooks/lib/directory-discovery.js +395 -0
  168. package/plugins/hooks/lib/environment-config-loader.js +341 -0
  169. package/plugins/hooks/lib/environment-detector.js +553 -0
  170. package/plugins/hooks/lib/environment-evolver.js +564 -0
  171. package/plugins/hooks/lib/environment-registry.js +813 -0
  172. package/plugins/hooks/lib/execution-path.js +427 -0
  173. package/plugins/hooks/lib/hook-error-recorder.js +245 -0
  174. package/plugins/hooks/lib/hook-logger.js +538 -0
  175. package/plugins/hooks/lib/hook-runner.js +97 -0
  176. package/plugins/hooks/lib/hook-runner.sh +44 -0
  177. package/plugins/hooks/lib/hook-state-manager.js +480 -0
  178. package/plugins/hooks/lib/memory-extractor.js +377 -0
  179. package/plugins/hooks/lib/memory-manager.js +673 -0
  180. package/plugins/hooks/lib/metrics-analyzer.js +489 -0
  181. package/plugins/hooks/lib/project-evolution/auto-fixer.js +511 -0
  182. package/plugins/hooks/lib/project-evolution/memory-manager.js +346 -0
  183. package/plugins/hooks/lib/project-evolution/pattern-detector.js +476 -0
  184. package/plugins/hooks/lib/project-evolution/semantic-indexer.js +480 -0
  185. package/plugins/hooks/lib/project-structure-detector.js +326 -0
  186. package/plugins/hooks/lib/rollback-tracker.js +346 -0
  187. package/plugins/hooks/lib/source-code-scanner.js +596 -0
  188. package/plugins/hooks/lib/technology-stack-detector.js +374 -0
  189. package/plugins/hooks/lib/test-failure-analyzer.js +375 -0
  190. package/plugins/hooks/lib/test-failure-fixer.js +268 -0
  191. package/plugins/hooks/lib/trace-context.js +277 -0
  192. package/plugins/hooks/lib/validation-patterns.js +415 -0
  193. package/plugins/hooks/memory-sync.js +171 -0
  194. package/plugins/hooks/pipeline-observer.js +413 -0
  195. package/plugins/hooks/scope-sentinel.js +204 -0
  196. package/plugins/hooks/trace-initialization.js +169 -0
  197. package/plugins/memory/templates/code-quality.yaml +149 -0
  198. package/plugins/memory/templates/multi-system.yaml +155 -0
  199. package/plugins/memory/templates/team-habits.yaml +119 -0
  200. package/plugins/memory/templates/testing.yaml +121 -0
  201. package/plugins/skills/README.en.md +47 -0
  202. package/plugins/skills/README.md +104 -0
  203. package/plugins/skills/benchmark-executor/README.md +93 -0
  204. package/plugins/skills/benchmark-executor/SKILL.md +647 -0
  205. package/plugins/skills/benchmark-generator/SKILL.md +349 -0
  206. package/plugins/skills/delivery-stage/SKILL.md +203 -0
  207. package/plugins/skills/design-stage/SKILL.md +216 -0
  208. package/plugins/skills/evolution-process/SKILL.md +291 -0
  209. package/plugins/skills/exploration-phase/SKILL.md +133 -0
  210. package/plugins/skills/implementation-stage/SKILL.md +179 -0
  211. package/plugins/skills/layer1-validation/SKILL.md +79 -0
  212. package/plugins/skills/pending-dashboard/SKILL.md +109 -0
  213. package/plugins/skills/project-evolution/SKILL.md +847 -0
  214. package/plugins/skills/requirement-stage/SKILL.md +183 -0
  215. package/plugins/skills/skill-forge/SKILL.md +223 -0
  216. package/plugins/skills/skill-forge/references/description-guide.md +92 -0
  217. package/plugins/skills/skill-forge/references/quality-rubric.md +104 -0
  218. package/plugins/skills/skill-forge/references/skill-template.md +106 -0
  219. package/plugins/skills/startup-guard/SKILL.md +38 -0
  220. package/plugins/skills/testing-stage/SKILL.md +195 -0
  221. package/scripts/cli/global-init.js +288 -0
  222. package/scripts/cli/global.js +324 -0
  223. package/scripts/cli/index.js +55 -0
  224. package/scripts/cli/init.js +382 -0
  225. package/scripts/cli/list.js +69 -0
  226. package/scripts/cli/org.js +340 -0
  227. package/scripts/cli/update.js +44 -0
  228. package/scripts/config/commands.config.js +145 -0
  229. package/scripts/config/hooks.config.js +197 -0
  230. package/scripts/evolution/evolution-router.js +273 -0
  231. package/scripts/evolution/evolution-signal-collector.js +307 -0
  232. package/scripts/evolution/knowledge-loader.js +346 -0
  233. package/scripts/evolution/marketplace.js +317 -0
  234. package/scripts/evolution/version-manager.js +371 -0
  235. package/scripts/install/agents.js +106 -0
  236. package/scripts/install/commands.js +133 -0
  237. package/scripts/install/constants.js +424 -0
  238. package/scripts/install/hook-logger.js +536 -0
  239. package/scripts/install/hooks.js +110 -0
  240. package/scripts/install/index.js +39 -0
  241. package/scripts/install/skills.js +95 -0
  242. package/scripts/postinstall.js +25 -0
  243. package/scripts/state.js +376 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AutoSpec Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,472 @@
1
+ <div align="center">
2
+
3
+ # AutoSpec
4
+
5
+ **Autonomous Software Development Pipeline — AI drives the full cycle, humans stay on the loop.**
6
+
7
+ [中文文档](./README.md) · [Quick Start](#quick-start) · [How It Works](#how-it-works) · [Contributing](./CONTRIBUTING.md)
8
+
9
+ </div>
10
+
11
+ ---
12
+
13
+ AutoSpec is an AI-driven development pipeline that automates the entire software delivery process — from requirement analysis to deployment. Instead of replacing developers, it structures the AI's work through a rigorous, verifiable pipeline with constitutional safety guards.
14
+
15
+ **Not "AI writes code faster" — but "AI autonomously completes the full SDLC with human oversight at key decision points."**
16
+
17
+ ## Key Principles
18
+
19
+ - **Verification over trust** — Deterministic validation (build/test/lint) before AI review. Never skip, never fake.
20
+ - **Do-review separation** — Producer and reviewer are different AI instances with information isolation.
21
+ - **Constitutional safety** — 13 inviolable red lines. Irreversible actions always require human confirmation.
22
+ - **Progressive autonomy** — Start with interactive mode, earn trust, scale to autonomous mode.
23
+
24
+ ## Quick Start
25
+
26
+ ```bash
27
+ # Install globally
28
+ npm install -g @chongyan/autospec
29
+
30
+ # Initialize in your project
31
+ cd your-project
32
+ autospec init
33
+
34
+ # Start full pipeline in Claude Code
35
+ /autospec:run
36
+ /autospec:run Build a user favorites feature with category filtering
37
+ ```
38
+
39
+ That's it. AutoSpec copies the knowledge to `.autospec/knowledge/`, generates Claude Code slash commands (8), Skills (9, auto-triggered), Agents (8, do-review separation + CEO debate + autonomous gates), and Hooks (8, deterministic guards + quality monitoring + scope sentinel + AI validation) — ready to use.
40
+
41
+ ## How It Works
42
+
43
+ ### Pipeline
44
+
45
+ ```
46
+ [Stage 0] → Requirement → Design → Implementation → Review → Testing → Delivery
47
+ Env Check Analysis Planning (+ quick test) (isolated) QA Deploy
48
+ ↓ ↓ ↓ ↓ ↓ ↓
49
+ [Layer 1] [Layer 1] [Layer 1] [Layer 1] [Layer 1] [Layer 1]
50
+ [Layer 2] [Layer 2] [Layer 2] [Layer 2] [Layer 2] [Layer 2]
51
+ ```
52
+
53
+ **Every stage** passes through double-layer validation:
54
+ - **Layer 1** (Deterministic): Build, test, lint, type-check — machine judgment, non-negotiable
55
+ - **Layer 2** (AI Review): Independent AI instance evaluates with structured evidence
56
+
57
+ Layer 1 fails → Layer 2 never runs.
58
+
59
+ ### Testing Stage Enhancement
60
+
61
+ AutoSpec's testing is divided into two phases with clear responsibilities:
62
+
63
+ **Implementation Stage (Stage 03) - Self-testing**:
64
+ - Unit tests: Core logic paths + boundary conditions
65
+ - Module-level integration tests: Inter-module interactions
66
+ - Learns existing test styles, reuses test infrastructure
67
+ - Generates test report
68
+
69
+ **QA Testing Stage (Stage 05)**:
70
+ - Cross-system integration tests
71
+ - E2E tests
72
+ - Acceptance tests
73
+ - Learns existing test styles + loads environment knowledge best practices
74
+
75
+ **Test Style Learning**:
76
+ 1. Detects test frameworks (Jest, pytest, JUnit, etc.)
77
+ 2. Analyzes assertion styles and organization
78
+ 3. Extracts test infrastructure (setup/teardown, fixtures, mocks)
79
+ 4. Loads integration test best practices from environment knowledge
80
+
81
+ **Environment Knowledge for Testing**:
82
+ - Test knowledge stored in `knowledge/environment/overview.md`
83
+ - Free Markdown format (not structured YAML) for flexibility
84
+ - Self-evolution via skill-distiller: learns from test execution patterns
85
+ - Import organization knowledge via `autospec env:import`
86
+
87
+ ### CEO Exploration (Requirement Analysis Pre-step)
88
+
89
+ Before requirement analysis, AutoSpec uses dual-agent debate to clarify requirements:
90
+
91
+ - **ceo**: Explores from CEO/strategy perspective (business value, strategic alignment)
92
+ - **product-owner**: Challenges from product feasibility angle (UX, scope, data-driven decisions)
93
+
94
+ **Autonomous mode**: Agents debate automatically → consensus becomes requirement, disagreements marked for clarification
95
+
96
+ **Interactive mode**: AI asks 5 strategic questions with recommended answers → user confirms
97
+
98
+ ### Iteration Modes
99
+
100
+ | Mode | Stages | Description | Use Case |
101
+ |------|--------|-------------|----------|
102
+ | **Waterfall** | 01→02→03→04→05→06 | Full 6-stage pipeline | New features, major changes |
103
+ | **Agile** | 01 + [02→03→04]×N + 05→06 | Story-driven cycles | Iterative development |
104
+ | **Experiment** | 01→02→03 + Evaluation | Prototype + AI/ML evaluation | Technical exploration |
105
+ | **Hotfix** | 01→03→04→06 | Fast track with basic tests | Emergency fixes |
106
+
107
+ ## Slash Commands
108
+
109
+ All commands accept optional text arguments: `/autospec:run Build user favorites` — the text becomes context for that stage.
110
+
111
+ ### Main Entry (Autonomous Mode)
112
+
113
+ | Command | Description |
114
+ |---------|-------------|
115
+ | `/autospec:run` | Full pipeline autonomous execution (recommended) |
116
+
117
+ Run with parameters:
118
+ ```
119
+ /autospec:run Build user favorites --workflow=agile
120
+ ```
121
+
122
+ **Parameters:**
123
+ | Parameter | Shorthand | Description |
124
+ |-----------|-----------|-------------|
125
+ | `--workflow` | `-w` | Iteration mode: waterfall/agile/experiment/hotfix |
126
+ | `--roles` | `-r` | Roles (comma-separated): backend,frontend,data,ai,quality |
127
+ | `--domain` | `-d` | Business domain (free text): e.g., "fintech payment system" |
128
+ | `--skip-workflow` | `-s` | Skip workflow selection, use default |
129
+ | `--help` | `-h` | Show help |
130
+
131
+ ### Interactive Mode (Stage-by-Stage Commands)
132
+
133
+ | Command | Description |
134
+ |---------|-------------|
135
+ | `/autospec:explore` | Requirement exploration |
136
+ | `/autospec:propose` | Design planning |
137
+ | `/autospec:apply` | Implementation (code + review + testing) |
138
+ | `/autospec:archive` | Delivery + archival |
139
+
140
+ ### Recommended Workflow
141
+
142
+ For better results, explore requirements first, then run:
143
+
144
+ 1. `/autospec:explore` → Clarify and explore requirements
145
+ 2. Feed exploration results → `/autospec:run <exploration context>`
146
+
147
+ This ensures the AI understands the requirements accurately before autonomous execution.
148
+
149
+ **Direct run is also supported**: Running `/autospec:run` directly — the AI will use internal agent debate to clarify requirements automatically, though results may be less precise than exploring first.
150
+
151
+ ### Command Output Examples
152
+
153
+ #### `/autospec:run` Output Flow
154
+ ```
155
+ ┌─────────────────────────────────────────────────────────────┐
156
+ │ AutoSpec Pipeline │
157
+ ├─────────────────────────────────────────────────────────────┤
158
+ │ ✓ Stage 01: Requirement Analysis [Layer 1 ✓] [Layer 2 ✓] │
159
+ │ ✓ Stage 02: Design Planning [Layer 1 ✓] [Layer 2 ✓] │
160
+ │ ✓ Stage 03: Implementation [Layer 1 ✓] [Layer 2 ✓] │
161
+ │ ✓ Stage 04: Code Review [Layer 1 ✓] [Layer 2 ✓] │
162
+ │ ✓ Stage 05: QA Testing [Layer 1 ✓] [Layer 2 ✓] │
163
+ │ ✓ Stage 06: Delivery [Layer 1 ✓] [Layer 2 ✓] │
164
+ ├─────────────────────────────────────────────────────────────┤
165
+ │ Pipeline completed successfully! │
166
+ │ Output: .autospec/specs/{feature}/ │
167
+ └─────────────────────────────────────────────────────────────┘
168
+ ```
169
+
170
+ #### `/autospec:status` Output
171
+ ```
172
+ ┌─────────────────────────────────────────────────────────────┐
173
+ │ AutoSpec Status │
174
+ ├─────────────────────────────────────────────────────────────┤
175
+ │ Current Stage: Stage 03 (Implementation) │
176
+ │ Progress: 3/6 stages completed │
177
+ │ Workflow: waterfall │
178
+ │ Last updated: 2024-01-15 10:30:00 │
179
+ └─────────────────────────────────────────────────────────────┘
180
+ ```
181
+
182
+ #### Layer 1 Failure Example
183
+ ```
184
+ ┌─────────────────────────────────────────────────────────────┐
185
+ │ Layer 1 Validation FAILED │
186
+ ├─────────────────────────────────────────────────────────────┤
187
+ │ ✗ npm run build → Exit code 1 │
188
+ │ ✗ npm test → 3 tests failed │
189
+ │ │
190
+ │ BLOCKED: Fix above issues before proceeding to Layer 2 │
191
+ └─────────────────────────────────────────────────────────────┘
192
+ ```
193
+
194
+ ### Utilities
195
+
196
+ | Command | Description |
197
+ |---------|-------------|
198
+ | `/autospec:status` | Pipeline progress and state |
199
+ | `/autospec:validate` | Run Layer 1 validation (build/test/lint) |
200
+ | `/evolve` | Trigger self-evolution cycle |
201
+
202
+ ## CLI Commands
203
+
204
+ ```bash
205
+ autospec init [options] # Initialize framework + slash commands
206
+ autospec status # Check pipeline state
207
+ autospec update # Update framework (preserve state)
208
+ ```
209
+
210
+ **Init options:**
211
+ ```bash
212
+ # Default: waterfall mode + generic domain
213
+ autospec init
214
+
215
+ # Specify iteration mode and roles
216
+ autospec init -w hotfix -r backend # Hotfix mode, backend role
217
+ autospec init -w agile -r backend,frontend # Agile mode, multi-role
218
+
219
+ # Specify domain
220
+ autospec init -d fintech -r backend,data # Fintech domain, backend + data roles
221
+
222
+ # Full options
223
+ autospec init -w experiment -d ai -r backend,ai # AI project
224
+ ```
225
+
226
+ **Options:**
227
+ | Option | Shorthand | Description | Values |
228
+ |--------|-----------|-------------|--------|
229
+ | `--workflow` | `-w` | Iteration mode | `waterfall`, `agile`, `experiment`, `hotfix` |
230
+ | `--domain` | `-d` | Business domain (free text) | e.g., "fintech", "ecommerce", "healthcare" |
231
+ | `--roles` | `-r` | Project roles | Comma-separated: `backend`, `frontend`, `data`, `ai`, `quality` |
232
+
233
+ ### Environment Integration Commands
234
+
235
+ AutoSpec automatically detects middleware and components during `init`. Manage environment knowledge with:
236
+
237
+ ```bash
238
+ autospec env # Show environment configuration
239
+ autospec env:sync # Sync from code + auto-activate
240
+ autospec env:validate # Validate configuration
241
+ autospec env:import --git <url> # Import org knowledge from Git
242
+ autospec env:import --npm <pkg> # Import org knowledge from npm
243
+ autospec env:export <dir> # Export project knowledge
244
+ autospec component # List available components
245
+ autospec component:add <name> # Add component knowledge
246
+ ```
247
+
248
+ **Auto-detection**: `autospec init` automatically scans code for MySQL, Redis, Kafka, MongoDB, Elasticsearch, RabbitMQ, PostgreSQL usage and generates knowledge configs. See [Environment Integration](knowledge/environment/overview.md) for details.
249
+
250
+ ## Self-Evolution
251
+
252
+ AutoSpec improves itself through a controlled evolution loop.
253
+
254
+ ### Two-Layer Evolution
255
+
256
+ AutoSpec's self-evolution happens on two levels simultaneously:
257
+
258
+ #### Outward Evolution (Project Evolution)
259
+
260
+ When using AutoSpec to drive **other projects**, practical experience automatically feeds back:
261
+
262
+ ```
263
+ Project A development → practice-log → distiller extracts new skill → framework improves
264
+ Project B development → practice-log → extractor extracts methodology → framework improves
265
+ Project C development → domain skill accumulation → skills/domain/ expands
266
+
267
+ Every project's experience makes the next project smoother
268
+ ```
269
+
270
+ - Each project's practice-log can optionally contribute back to AutoSpec main repo (via PR)
271
+ - Domain-specific skills stay in enterprise overlay (not upstreamed)
272
+ - General improvements (pipeline optimization, skill improvements) contribute back to core framework
273
+
274
+ #### Inward Evolution (Framework Evolution)
275
+
276
+ When iterating on AutoSpec **itself**, the framework uses its own process to improve (dogfooding):
277
+
278
+ ```
279
+ AutoSpec improvement需求 → Run AutoSpec pipeline → practice-log → framework evolves
280
+
281
+ Same iteration is both output and evolution signal
282
+ ```
283
+
284
+ - AutoSpec's own development follows startup gate and double-layer validation
285
+ - Framework file changes must be validated through the framework's own review process
286
+ - The framework gets better with use, forming a flywheel effect
287
+
288
+ ### Evolution Zones
289
+
290
+ | Zone | Contents | Rule |
291
+ |------|----------|------|
292
+ | **Frozen** | Constitution, evolution rules, core principles | Human-only changes. Never auto-modified. |
293
+ | **Controlled** | Pipeline stages, universal skills, role profiles | Auto-proposed, human-approved. |
294
+ | **Free** | Domain skills, decision trees, benchmarks | Auto-evolved, validator-verified. |
295
+
296
+ **Test knowledge evolution**: Test knowledge in `environment/integration/testing/` evolves via skill-distiller — learns from test execution patterns, generates proposals for human approval.
297
+
298
+ **Key safety principle**: The evolution system cannot modify its own evaluation criteria (immutable harness).
299
+
300
+ ### Evolution Loop
301
+
302
+ ```
303
+ Execute Pipeline → Collect Signals → Analyze Patterns → Propose Changes → Validate → Accept/Reject
304
+
305
+ Regression? → Auto-rollback
306
+ ```
307
+
308
+ **Fitness function**: Layer 1+2 pass rate, retry count, human intervention rate, delivery success rate. Any safety metric regression → change rejected even if other metrics improve.
309
+
310
+ ### Enterprise Adaptation
311
+
312
+ ```
313
+ ┌─────────────────────────────────┐
314
+ │ Enterprise Overlay │ ← Org-specific (not upstreamed)
315
+ │ org-constitution.md │ Additional red lines
316
+ │ org-skills/ │ Domain-specific skills
317
+ │ domain-knowledge/ │ Industry knowledge
318
+ ├─────────────────────────────────┤
319
+ │ AutoSpec Core Framework │ ← npm install (upgradeable)
320
+ │ constitution.md │
321
+ │ pipeline/ skills/ roles/ ... │
322
+ └─────────────────────────────────┘
323
+ ```
324
+
325
+ Customize via `autospec init --domain <domain>`. The overlay adds domain-specific rules, checklists, and skills **without forking** the core framework.
326
+
327
+ ## Project Structure
328
+
329
+ ```
330
+ your-project/
331
+ ├── .autospec/
332
+ │ ├── knowledge/ # Core knowledge (copied from npm)
333
+ │ ├── runtime/ # Current pipeline state
334
+ │ │ ├── config.json # Project configuration
335
+ │ │ ├── state.json # Pipeline state tracking
336
+ │ │ └── metrics.json # Quality metrics (auto-collected)
337
+ │ ├── environment/ # Environment integration layer
338
+ │ │ ├── env-knowledge/ # Middleware knowledge (mysql.yaml, redis.yaml)
339
+ │ │ ├── component-lib/ # Organization components
340
+ │ │ ├── integration/ # CI/CD, testing, deployment configs
341
+ │ │ └── registry.json # Knowledge registry
342
+ │ ├── specs/ # Pipeline artifacts (persistent)
343
+ │ │ └── {feature}/ # Per-feature outputs
344
+ │ │ ├── requirement.md
345
+ │ │ ├── design.md
346
+ │ │ ├── contracts/
347
+ │ │ ├── reviews/
348
+ │ │ └── tests/
349
+ │ ├── archives/ # Archived pipeline runs
350
+ │ └── evolution/ # Self-evolution data
351
+ │ ├── proposals/ # Evolution proposals (human-approved)
352
+ │ ├── practice-log/ # Practice logs
353
+ │ └── evolution-log.json # Evolution audit trail
354
+ └── .claude/
355
+ ├── commands/
356
+ │ └── autospec/ # 8 slash commands (auto-generated)
357
+ │ ├── run.md # Main entry with mode picker
358
+ │ ├── explore.md # Big-phase: exploration
359
+ │ ├── propose.md # Big-phase: design
360
+ │ ├── apply.md # Big-phase: implementation
361
+ │ ├── archive.md # Big-phase: delivery
362
+ │ ├── status.md # Utility: state view
363
+ │ ├── validate.md # Utility: Layer 1 validation
364
+ │ └── evolve.md # Utility: self-evolution
365
+ ├── skills/ # Auto-triggered skills
366
+ ├── agents/ # Isolated agents (reviewer/test-reviewer/...)
367
+ └── settings.json # Hooks configuration
368
+ ```
369
+
370
+ **AutoSpec source:**
371
+ ```
372
+ autospec/
373
+ ├── knowledge/ # The core knowledge
374
+ │ ├── constitution.md # 13 constitutional red lines
375
+ │ ├── evolution.md # Self-evolution mechanism
376
+ │ ├── pipeline/ # 6-stage process definitions
377
+ │ ├── methodology/ # Design principles + checklists + cognitive enhancement
378
+ │ ├── skills/ # Executable AI skills (do + review)
379
+ │ ├── roles/ # Role profiles (backend/frontend/data/ai/quality)
380
+ │ ├── environment/ # Environment integration protocol
381
+ │ ├── config/ # Configuration files (validation patterns, team triggers)
382
+ │ └── hooks/ # Hook scripts (deterministic guards)
383
+ ├── src/ # CLI tool source
384
+ │ └── core/
385
+ │ ├── environment/ # Environment detection & knowledge management
386
+ │ ├── generators/ # Code generators (commands, skills, agents, hooks)
387
+ │ ├── templates/ # Template files (moved from root templates/)
388
+ │ └── test/ # Test infrastructure
389
+ ├── bin/ # CLI entry point
390
+ └── docs/ # Package documentation
391
+ ```
392
+
393
+ ## Safety Model
394
+
395
+ AutoSpec enforces safety through four layers:
396
+
397
+ 1. **Constitutional Gate** — 13 red lines that cannot be violated (see `knowledge/principles/constitution.md`)
398
+ 2. **Permission Control** — Each agent only accesses its authorized tools
399
+ 3. **Stop-the-Line** — Security vulnerability, data loss risk, or 3 failed retries → immediate halt
400
+ - **Precision Retry**: Level 1 (inline retry) → Level 2 (fix loop, max 3 times) → Level 3 (escalate to human)
401
+ 4. **Irreversible Action Guard** — DB migrations, deployments, external API calls → require human confirmation
402
+
403
+ Evolution adds a fifth layer:
404
+
405
+ 5. **Immutable Harness** — The evolution system cannot modify its own evaluation criteria, constitution, or evolution rules
406
+
407
+ ## Quality Monitoring
408
+
409
+ AutoSpec automatically tracks quality metrics during pipeline execution via deterministic hooks:
410
+
411
+ | Metric | Source | Purpose |
412
+ |--------|--------|---------|
413
+ | Layer 1 pass/fail rate | `layer1-validator` hook | Code quality baseline |
414
+ | Retry count per stage | `layer1-validator` hook | Process smoothness |
415
+ | Human intervention count | `layer1-validator` hook | Autonomy capability |
416
+ | Scope deviation events | `scope-sentinel` hook | Implementation discipline |
417
+ | Error patterns | `layer1-validator` hook | Evolution priority |
418
+
419
+ Metrics are stored in `.autospec/runtime/metrics.json` and automatically fed into practice-log at delivery.
420
+
421
+ ## Cognitive Enhancement
422
+
423
+ AutoSpec injects 10 cognitive enhancement principles ([`knowledge/principles/principles.md`](knowledge/principles/principles.md)) into each pipeline stage:
424
+
425
+ | Principle | Stage Application |
426
+ |-----------|------------------|
427
+ | **CP1** Partner mode — challenge assumptions, flag blind spots | Requirement, Review, Test |
428
+ | **CP3** Ask before act — structured uncertainty management | Requirement, Design |
429
+ | **CP4** Complete logic chain — no conclusion without derivation | Design, Review |
430
+ | **CP5** Confidence labeling — mark uncertain judgments | All stages |
431
+ | **CP6** Error as signal — every retry/correction drives evolution | Test, Evolve |
432
+ | **CP8** Deviation detection — graduated 3-level alerts | Implementation, Delivery |
433
+ | **CP9** Just enough — resist overengineering | Design, Implementation |
434
+ | **CP10** Self-check before output | Implementation, Test, Delivery |
435
+
436
+ ## Documentation
437
+
438
+ | Document | Description |
439
+ |----------|-------------|
440
+ | [Design Philosophy](docs/design-philosophy.md) | Why AutoSpec exists, core principles, design decisions |
441
+ | [Architecture](docs/architecture.md) | How it works — pipeline, validation, integration, evolution |
442
+ | [Getting Started](docs/getting-started.md) | Practical guide from install to first full pipeline run |
443
+ | [Comparisons](docs/comparisons.md) | Detailed comparison with OpenSpec, Spec Kit, autoresearch, Claude Code |
444
+ | [Environment Integration](knowledge/environment/overview.md) | Middleware detection, knowledge management, org knowledge import |
445
+
446
+ ## Design Philosophy
447
+
448
+ See [`knowledge/principles/design-philosophy.md`](knowledge/principles/design-philosophy.md) for the complete 18 design principles (DP1–DP18), including:
449
+
450
+ - **DP1** Double-layer verification
451
+ - **DP2** Do-review separation
452
+ - **DP6** Precision retry (not full redo)
453
+ - **DP7** Anti-pattern inoculation
454
+ - **DP8** CSO principle (force full skill loading)
455
+ - **DP10** Safety & emergency stop
456
+ - **DP12** Taming non-determinism
457
+ - **DP16** Template-as-Constraint (shift-left quality)
458
+ - **DP17** Structured clarification protocol
459
+ - **DP18** Cross-artifact consistency analysis
460
+
461
+ ## Contributing
462
+
463
+ See [CONTRIBUTING.md](./CONTRIBUTING.md). We welcome contributions to:
464
+ - Framework pipeline and skill definitions
465
+ - Role profiles for new domains
466
+ - CLI tooling improvements
467
+ - Practice log entries from real usage
468
+ - Documentation and translations
469
+
470
+ ## License
471
+
472
+ [MIT](./LICENSE)