@sublang/spex 0.2.3 → 1.0.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.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -1,5 +1,13 @@
1
1
  ## Specs (Source of Truth)
2
2
 
3
- - Canonical specs live in `specs/`. Start with `specs/map.md` for a quick-reference index of all spec files.
3
+ - Canonical specs live in @specs/.
4
+ Start with @specs/map.md for a quick-reference index of all spec files and @specs/meta.md for the spec format.
4
5
  - Before making changes or suggestions in an area that has a spec, read the relevant spec file(s) first and follow them.
5
- - If unsure which spec applies, search `specs/` and propose the most relevant file(s) before proceeding.
6
+ - Whenever your changes involve any spec, or you make a decision worth recording, keep the specs in sync — don't let them drift.
7
+ - Keep specs:
8
+ - Complete & coherent: sufficient for you to reimplement code.
9
+ - Right level: each package file in @specs/packages holds its shared intent (## Intent), behavior its users may rely on (## External Behavior), optional implementation hidden from them (## Internal Behavior), and tests of its own claims (## Verification); behavior that emerges from several packages working together is itself a spec package citing the peers' External Behavior — there is no @specs/compositions. Specify integration/system testing, not unit testing, and prefer tests that execute the real behavior of cited packages over substitutes.
10
+ - Minimal: essential and concise; also check against other spec items to avoid overlap.
11
+ - Well organized: spec packages are finely scoped, with high cohesion and low coupling.
12
+ - Single-source: item citations are enclosed relative links like `[[pack-3](pack.md#pack-3)]`, written inline at the phrase that relies on them; items carry no metadata lines (`Verifies:`, `Binds:`, `Composes:`, `Clients:`, `Suppliers:`, `Scope:`).
13
+ - Run `spex lint` to check structure, item IDs, and citations after editing specs; never add trace lines to satisfy an older checker.
@@ -0,0 +1,44 @@
1
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
2
+ <!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
3
+
4
+ # 规约地图
5
+
6
+ 用于快速定位规约文件的索引。
7
+ 规约条目是事实来源。
8
+ 开发过程中,代码可能与规约暂时不一致。
9
+
10
+ ## 编写和审阅规约
11
+
12
+ 在编写、修改或审阅 DR、IR 或条目前,先了解 [`meta.md`](meta.md) 中的规则。
13
+
14
+ - DR 和 IR:见 [Overall](meta.md#overall)、[Record format](meta.md#record-format) 和 [Citation](meta.md#citation)。
15
+ - 条目:见 [Overall](meta.md#overall)、[Item syntax](meta.md#item-syntax)、[Spec packages](meta.md#spec-packages)、[Testing](meta.md#testing) 和 [Citation](meta.md#citation)。
16
+
17
+ ## 目录结构
18
+
19
+ ```text
20
+ decisions/ 决策记录(DRs)
21
+ intents/ 意图记录(IRs)
22
+ packages/ 规约包(每包一个文件)
23
+ map.md 本索引
24
+ meta.md 规约的规约
25
+ ```
26
+
27
+ ## 决策
28
+
29
+ | ID | 文件 | 摘要 |
30
+ | --- | --- | --- |
31
+ | DR-000 | [000-spec-structure-format.md](decisions/000-spec-structure-format.md) | 规约结构、格式和命名约定 |
32
+
33
+ ## 意图
34
+
35
+ | ID | 文件 | 意图 |
36
+ | --- | --- | --- |
37
+ | IR-000 | [000-spdx-headers.md](intents/000-spdx-headers.md) | 为适用文件添加 SPDX 头 |
38
+
39
+ ## 包
40
+
41
+ | 文件 | 摘要 |
42
+ | --- | --- |
43
+ | [git.md](packages/git.md) | 提交信息格式和 AI 共同作者 trailers |
44
+ | [licensing.md](packages/licensing.md) | SPDX 头要求与验证检查 |
@@ -0,0 +1,208 @@
1
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
2
+ <!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
3
+ <!-- AI agents: do not edit this file without human approval. -->
4
+
5
+ # meta: 规约定义
6
+
7
+ ## 意图
8
+
9
+ 本规约定义 specifications(specs)的结构和组织方式,遵循 [DR-000](decisions/000-spec-structure-format.md)。
10
+
11
+ ## Overall
12
+
13
+ ### meta-1
14
+
15
+ The `specs/` directory shall contain the following subdirectories and files:
16
+
17
+ | Path | Content | File Naming |
18
+ | --------- | ------- | ------ |
19
+ | `decisions/` | decision records (DRs) | \<NNN\>-\<kebab-case\>.md |
20
+ | `intents/` | intent records (IRs) | \<NNN\>-\<kebab-case\>.md |
21
+ | `packages/` | spec packages | \<kebab-case\>.md |
22
+ | `map.md` | spec index — start here for context search | - |
23
+ | `meta.md` | the spec of specs | - |
24
+
25
+ ### meta-23
26
+
27
+ A spec in any form shall contain the minimal information, concisely expressed, to act on it or audit it, preferring bullets, tables, or (renderable) diagrams to prose.
28
+
29
+ ### meta-25
30
+
31
+ A spec file shall keep one sentence per line — with lists, tables, and diagrams exempt.
32
+
33
+ ## Record format
34
+
35
+ <!-- spex-i18n-source: meta-4 sha256-5ea8737b4d744c55c6c564672f86199e62a0caad95bbba2fb498b6c9407226c8 -->
36
+ ### meta-4
37
+
38
+ 每个决策记录(DR)应遵循 ADR 格式 [[2]],并包含以下章节:状态、背景、决策、影响与参考资料。
39
+
40
+ <!-- spex-i18n-source: meta-5 sha256-6847734892ace98018676f3430e0a848b0a83541b23f1b4f69aa9b12a1c0aeda -->
41
+ ### meta-5
42
+
43
+ 每个意图记录(IR)应包含以下章节:状态、意图、交付项(带复选框)、任务(编号且每项为一次提交大小)和验证。
44
+
45
+ ### meta-22
46
+
47
+ A record's ID shall join its kind prefix to its filename's leading number — `DR-<NNN>` under `decisions/`, `IR-<NNN>` under `intents/` — with the leading number unique within each record kind.
48
+
49
+ ### meta-24
50
+
51
+ A DR shall record design decisions and constraints, not implementation details, sufficient to provide context for or to audit the corresponding spec items.
52
+
53
+ ### meta-28
54
+
55
+ An IR shall be disposable: it contains nothing a DR or a spec item should cover, and its deletion loses no design or behavior record.
56
+
57
+ ## Item syntax
58
+
59
+ <!-- spex-i18n-source: meta-6 sha256-c6c53324be46702a10d6ca65a71842222518a1a2e32b8ccd334e361b70fbab75 -->
60
+ ### meta-6
61
+
62
+ 每个规约条目应使用 GEARS 模式 [[1]],其子句和标点遵循自然的中文习惯:
63
+
64
+ ```text
65
+ [给定 <静态前置条件>] [如果 <状态前置条件>] [当 <触发>] <主体>应<行为>。
66
+ ```
67
+
68
+ | 子句 | 用途 | 示例 |
69
+ | ------ | ------- | ------- |
70
+ | 给定/Where | 静态前置条件(特性、配置) | 给定调试模式已启用 |
71
+ | 如果/While | 状态前置条件(运行时状态) | 如果连接处于活动状态 |
72
+ | 当/When | 触发事件——最多一个 | 当用户点击提交 |
73
+ | 应/shall | 所要求的行为 | 表单应校验输入并标示每处违规 |
74
+
75
+ <!-- spex-i18n-source: meta-7 sha256-19317e57aa3b772b0baaa6fc119532ee806d70acb1c0b700403eb3d9e9ed7419 -->
76
+ ### meta-7
77
+
78
+ 给定测试用例可以用 Given-When-Then(GWT)表达,其规约条目应按以下方式将 GWT 映射到 GEARS [[1]]:
79
+
80
+ | GWT | 子句 |
81
+ | --- | ------ |
82
+ | Given | 给定/Where + 如果/While |
83
+ | When | 当/When |
84
+ | Then | 应/shall |
85
+
86
+ ### meta-8
87
+
88
+ Each spec item shall be self-contained: every reliance on another item is an explicit citation [[meta-16](#meta-16)].
89
+
90
+ ### meta-29
91
+
92
+ Each spec item shall be exactly one GEARS statement [[meta-6](#meta-6)], elaborated only by its attachments — such as a note, a list, a table, a (renderable) diagram, or an example.
93
+
94
+ | Item kind | Example attachment |
95
+ | --- | --- |
96
+ | Behavior | ordered steps or the cases and outcomes of one operation or decision |
97
+ | Test | the assertions of one execution flow or one explicit case matrix |
98
+
99
+ - A condition inside an attachment is a case label.
100
+ - Differing stateful preconditions or triggers are evidence of additional spec items.
101
+
102
+ ## Spec packages
103
+
104
+ ### meta-13
105
+
106
+ A spec package shall define a closed set of subjects and their behaviors for a shared intent.
107
+
108
+ ### meta-9
109
+
110
+ A spec package shall be one item file under `specs/packages/` or its subdirectory.
111
+
112
+ <!-- spex-i18n-source: meta-30 sha256-7a8f0909efcbffc412450f64f749f822d0412490e067a2310300f434a9162693 -->
113
+ ### meta-30
114
+
115
+ 每个包文件应只包含下列章节,并按此顺序排列:
116
+
117
+ | 章节 | 是否必需 | 内容 |
118
+ | ------- | -------- | ------- |
119
+ | `意图` | 必需 | 包内条目共享的意图 |
120
+ | `外部行为` | 必需 | 包的使用者可以依赖的结果与保证 |
121
+ | `内部行为` | 可选 | 对包的使用者隐藏的实现 |
122
+ | `验证` | 除非无关,否则必需 [[meta-33](#meta-33)] | 仅限验证本包条目的测试条目 |
123
+ | `参考资料` | 可选 | 外部来源 [[meta-19](#meta-19)] |
124
+
125
+ - 包的使用者是使用其契约的任何人或系统组件;外部与内部相对于包而言。
126
+ - 主题小节与条目标题位于行为章节和验证章节内部。
127
+
128
+ ### meta-10
129
+
130
+ A spec package shall use a unique lowercase kebab-case basename \<pack\>.md, with \<pack\> serving as its package identifier.
131
+
132
+ ### meta-11
133
+
134
+ Each spec item shall use \<pack\>-\<N\> as its lowercase heading, anchor, and citation text:
135
+
136
+ - \<pack\> is its containing package's identifier [[meta-10](#meta-10)];
137
+ - \<N\> is a positive integer unique within that package;
138
+ - a new item takes the lowest positive \<N\> neither assigned nor reserved by a public release [[meta-12](#meta-12)].
139
+
140
+ ### meta-12
141
+
142
+ A publicly released item ID shall remain permanently bound to the concern its item names:
143
+
144
+ - the ID is never renumbered or reassigned;
145
+ - the item's content may evolve only with that concern preserved;
146
+ - an unreleased ID can be reassigned.
147
+
148
+ ### meta-14
149
+
150
+ A citation shall be the only relationship between packages: any general phrase of a behavior binds to a specific External Behavior of another package by citing it [[meta-16](#meta-16)].
151
+
152
+ - An uncited phrase stays general as it is sufficient for code generation and audit.
153
+ - One phrase may cite several packages if it composes their behaviors.
154
+
155
+ ### meta-15
156
+
157
+ A spec package shall stand alone: readable in full without following any link — a citation never carries its meaning.
158
+
159
+ ### meta-31
160
+
161
+ A subdirectory under `specs/packages/` shall be an organizational collection only: a file's identity is its basename [[meta-10](#meta-10)]; moving a file between collections changes relative citation paths but no item ID or anchor.
162
+
163
+ ## Testing
164
+
165
+ ### meta-21
166
+
167
+ Spec test items shall specify integration and system tests only: unit tests belong to the implementation, and no spec item specifies one.
168
+
169
+ ### meta-32
170
+
171
+ A test shall prefer executing the real behavior of a cited package [[meta-14](#meta-14)] to supplying a substitute for it.
172
+
173
+ ### meta-33
174
+
175
+ Each stated behavior shall be verified unless verification is irrelevant to it, white-box or black-box: External and Internal govern use, not verification.
176
+
177
+ ## Citation
178
+
179
+ ### meta-16
180
+
181
+ A citation of a spec item shall be a relative link with an anchor, enclosed in square brackets (e.g., `[[meta-1](meta.md#meta-1)]`), written inline at the phrase that relies on it.
182
+
183
+ ### meta-18
184
+
185
+ No DR or spec item shall cite an IR or name it in prose.
186
+
187
+ <!-- spex-i18n-source: meta-19 sha256-e6137c80fab048cd6d69bf5a9b202b27cc14d97f67f51bcf8a5e915514039aa2 -->
188
+ ### meta-19
189
+
190
+ 外部引用应通过带编号的标记(例如 `[[1]]`)引用权威来源(例如官方文档),标记指向 `参考资料` 章节中的具体 URL,且该章节不应包含未被引用的条目。
191
+
192
+ ### meta-20
193
+
194
+ A test item shall cite every behavior item it verifies, inline at the assertion that verifies the behavior.
195
+
196
+ ## Authoring language
197
+
198
+ <!-- spex-i18n-source: meta-27 sha256-31c8c10f1bcf6836b757e4b7cbe21be3854843c9cef548759a36e4c460fda5c1 -->
199
+ ### meta-27
200
+
201
+ Authoring language: zh
202
+
203
+ 在规约树声明编写语言时——以本条目的机器可读标记行声明,采用精确格式 `Authoring language: <code>`,其中 `<code>` 只包含 ASCII 字母、数字和连字符——规约应使用该语言编写。
204
+
205
+ ## 参考资料
206
+
207
+ [1]: https://sublang.ai/zh/ref/gears-ai-ready-spec-syntax "GEARS:面向 AI 的规约语法(中文)"
208
+ [2]: https://github.com/npryce/adr-tools "ADR Tools"
@@ -1,5 +1,6 @@
1
1
  <!-- SPDX-License-Identifier: Apache-2.0 -->
2
2
  <!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
3
+ <!-- AI agents: do not edit this file without human approval. -->
3
4
 
4
5
  # DR-000: Spec Structure and Format
5
6
 
@@ -9,7 +10,8 @@ Accepted
9
10
 
10
11
  ## Context
11
12
 
12
- Specifications (specs) need a standardized format and structure to support iterative development and collaboration between AI and humans.
13
+ Specifications (specs) need a normative format and structure to support iterative development and collaboration between AI and humans.
14
+ AI-native software development is a series of human intent realizations.
13
15
 
14
16
  ## Decision
15
17
 
@@ -18,19 +20,19 @@ Specifications (specs) need a standardized format and structure to support itera
18
20
  Spex organizes specs around three essential elements of software development:
19
21
 
20
22
  - **Decisions**. The choices made in product and system *design*.
21
- - **Iterations**. The incremental plans for *implementation*.
22
- - **Requirements**. The *behaviors* and *constraints* of the product and system.
23
+ - **Intents**. The development intents and their *implementation*.
24
+ - **Requirements**. The required *behaviors* of the product and system.
23
25
 
24
26
  ### Forms
25
27
 
26
- Spex uses two forms of specs to balance unification and flexibility.
28
+ Spex uses two forms of specs to balance normalization and flexibility.
27
29
 
28
30
  - **Records** must follow specified formats and may use free-form content within those formats.
29
- Decisions and iterations are stored as records.
31
+ Decisions and intents are stored as records.
30
32
  - Decision records (DRs) follow the ADR (Architectural Decision Record) format [[1]].
31
- - Iteration records (IRs) contain four sections: Goal, Deliverables, Tasks, and Acceptance criteria.
32
- - **Items** must follow the GEARS pattern [[2]] to specify behaviors and constraints.
33
- Each item file must include an intent statement.
33
+ - Intent records (IRs) plan an intent's implementation and track its progress [[meta-5](../meta.md#meta-5)].
34
+ - **Items** must follow the GEARS pattern [[2]] to specify behaviors.
35
+ Each item file is a spec package, stating the intent its items share [[meta-30](../meta.md#meta-30)].
34
36
 
35
37
  ### Organization
36
38
 
@@ -39,59 +41,55 @@ Spex creates the default `specs/` directory under the repo root, with the follow
39
41
  | Path | Content | File Naming |
40
42
  | --------- | ------- | ------ |
41
43
  | `decisions/` | DRs. Design decisions and rationale. | \<NNN\>-\<kebab-case\>.md |
42
- | `iterations/` | IRs. Implementation plans. | \<NNN\>-\<kebab-case\>.md |
43
- | `user/` | item files for user-visible behavior. What the system does. | [\<path\>/]\<kebab-case\>.md |
44
- | `dev/` | item files for system internal behavior. How the system is built. | [\<path\>/]\<kebab-case\>.md |
45
- | `test/` | item files for acceptance testing. Quality guard for user and dev items. | [\<path\>/]\<kebab-case\>.md |
44
+ | `intents/` | IRs. Intent implementation plans and states. | \<NNN\>-\<kebab-case\>.md |
45
+ | `packages/` | Spec packages: collections of behaviors and their tests. | \<kebab-case\>.md |
46
46
  | `map.md` | spec index for navigation | - |
47
47
  | `meta.md` | the spec of specs | - |
48
48
 
49
- ### Item syntax
50
-
51
- A spec item must follow the GEARS syntax:
52
-
53
- ```text
54
- [Where <static precondition(s)>] [While <stateful precondition(s)>] [When <trigger>] The <subject> shall <behavior>.
55
- ```
56
-
57
- | Keyword | Purpose |
58
- | ------ | ------- |
59
- | Where | Static preconditions (features, config) |
60
- | While | Stateful preconditions (runtime state) |
61
- | When | Trigger event (at most one) |
62
- | shall | Required behavior |
49
+ ### Spec packages
63
50
 
64
- For test specs, Given-When-Then maps to: Given → Where+While, When → When, Then → shall.
51
+ A spec package is a collection of behaviors for a shared intent.
52
+ It is the unit of spec authoring, reuse, extension, and composition.
65
53
 
66
- ### Spec packages
54
+ A spec package is one file under `packages/` or its subdirectory.
55
+ For example, a spec package for generating short URLs may be `specs/packages/signing/gen-url.md`, where `signing/` is a local collection of related packages for development convenience.
67
56
 
68
- A spec package is a coherent set of spec items for a *single* intent.
69
- It is the basic unit for spec composition, reuse, and extension.
57
+ Each package file carries the same sections in the following order [[meta-30](../meta.md#meta-30)]:
70
58
 
71
- A spec package consists of one to three coordinated item files sharing the same relative path and basename.
72
- The item files are located in `user/`, `dev/`, or `test/` according to their category.
59
+ - `External Behavior` for outcomes and guarantees the package's users rely on.
60
+ A package's user may be a human or a system component.
61
+ - `Internal Behavior` for implementation hidden from the package's users.
62
+ - `Verification` for test items that check the package's own claims.
73
63
 
74
- For example, a spec package for generating short URLs may be named `gen-url` and consist of:
64
+ A behavior phrase can bind to another package's External Behavior by citing it [[meta-14](../meta.md#meta-14)].
65
+ But a spec package remains meaningfully self-contained.
66
+ It reads in full without following any link.
75
67
 
76
- - `specs/user/signing/gen-url.md` for user-facing behaviors (e.g., basic operations, URL format)
77
- - `specs/dev/signing/gen-url.md` for internal-implementation behaviors (e.g., algorithms)
78
- - `specs/test/signing/gen-url.md` for tests covering the corresponding user and dev items
68
+ ### Package relationships
79
69
 
80
- Here, `signing/` is a local collection of related spec packages for development convenience.
70
+ Packages relate through one mechanism: a citation binding a general behavior to a specific External Behavior of another package.
71
+ Three patterns cover most cases:
81
72
 
82
- `map.md` organizes item files by package.
73
+ - **Use**. A package relies on another's behavior and cites it where the reliance is.
74
+ - **Extension**. A new package adds behavior for an existing area, with the extended package untouched.
75
+ - **Composition**. A package states behavior that emerges only when several packages work together.
83
76
 
84
77
  ### Citations
85
78
 
86
79
  DRs and items are persistent and may cite each other.
87
- IRs may be temporary and must not be cited by DRs or items.
88
- `map.md` may cite IRs, as it indexes all spec files and is kept in sync as files change.
80
+ A DR references a spec item only to support what the DR itself states, never to carry content it leaves unsaid.
81
+
82
+ IRs may cite, but must not be cited by, DRs or items.
83
+ `map.md` may cite all spec files and is kept in sync as files change.
89
84
 
90
85
  ## Consequences
91
86
 
92
87
  - Consistent structure and format across development cycles
93
- - Clear positions of directories and files
94
- - Flexible expression of design and implementation
88
+ - One file per package: a single read covers a package's external behavior, internal behavior, and verification
89
+ - One package kind and one relationship mechanism cover use, extension, and composition
90
+ - Every relationship is visible as a citation at the phrase that relies on it
91
+ - A package stands alone once its citations are stripped
92
+ - Flexible expression of interface, design, and implementation
95
93
 
96
94
  ## References
97
95
 
@@ -0,0 +1,39 @@
1
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
2
+ <!-- SPDX-FileCopyrightText: 2026 SubLang International <https://sublang.ai> -->
3
+
4
+ # IR-000: SPDX Headers
5
+
6
+ ## Status
7
+
8
+ Pending
9
+
10
+ ## Intent
11
+
12
+ Apply [[licensing-1](../packages/licensing.md#licensing-1)], [[licensing-2](../packages/licensing.md#licensing-2)], [[licensing-5](../packages/licensing.md#licensing-5)] to in-scope files and pin the project's header format.
13
+
14
+ ## Deliverables
15
+
16
+ - [ ] Add SPDX headers to in-scope files missing them
17
+ - [ ] Add `licensing-9` to the External Behavior of [`packages/licensing.md`](../packages/licensing.md) with the project's actual header format, license, and copyright
18
+
19
+ ## Tasks
20
+
21
+ 1. Resolve scope: detect a project-root license file per [[licensing-7](../packages/licensing.md#licensing-7)]; enumerate in-scope files per [[licensing-6](../packages/licensing.md#licensing-6)].
22
+
23
+ 2. Insert SPDX lines in each file's first comment block (after any shebang), using the file's native comment syntax.
24
+
25
+ 3. Add `licensing-9` to the `## External Behavior` section of [`packages/licensing.md`](../packages/licensing.md), showing the concrete header per comment style. Example for a single Apache-2.0 `LICENSE`:
26
+
27
+ ```markdown
28
+ <!-- SPDX-License-Identifier: Apache-2.0 -->
29
+ <!-- SPDX-FileCopyrightText: <year> <holder> -->
30
+ ```
31
+
32
+ ```typescript
33
+ // SPDX-License-Identifier: Apache-2.0
34
+ // SPDX-FileCopyrightText: <year> <holder>
35
+ ```
36
+
37
+ ## Verification
38
+
39
+ - [[licensing-3](../packages/licensing.md#licensing-3)], [[licensing-4](../packages/licensing.md#licensing-4)] pass on all in-scope files.