special-agents 0.3.6 → 0.4.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.
Files changed (36) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +2 -2
  3. package/content/docs/features.md +1 -2
  4. package/content/rules/domain/ai-cost.md +3 -3
  5. package/content/rules/domain/ai-evals.md +2 -2
  6. package/content/rules/domain/ai-governance.md +2 -2
  7. package/content/rules/domain/ai-safety.md +2 -2
  8. package/content/rules/domain/data-governance.md +2 -2
  9. package/content/rules/domain/observability.md +2 -2
  10. package/content/rules/domain/scalability.md +2 -2
  11. package/content/rules/packs.index.yaml +12 -12
  12. package/content/rules/process/architecture.md +4 -4
  13. package/content/rules/process/business-docs.md +2 -2
  14. package/content/rules/process/project-docs.md +19 -19
  15. package/content/rules/process/release.md +2 -2
  16. package/content/rules/process/tickets.md +2 -2
  17. package/content/rules/templated/database.md +1 -1
  18. package/content/rules/templated/infra.md +1 -1
  19. package/dist/compile.d.ts +1 -1
  20. package/dist/compile.js +9 -5
  21. package/dist/content.d.ts +1 -0
  22. package/dist/content.js +2 -1
  23. package/package.json +21 -13
  24. package/node_modules/rafi-spec/dist/index.d.ts +0 -4
  25. package/node_modules/rafi-spec/dist/index.js +0 -4
  26. package/node_modules/rafi-spec/dist/schemas.d.ts +0 -245
  27. package/node_modules/rafi-spec/dist/schemas.js +0 -121
  28. package/node_modules/rafi-spec/dist/types.d.ts +0 -129
  29. package/node_modules/rafi-spec/dist/types.js +0 -6
  30. package/node_modules/rafi-spec/dist/validate.d.ts +0 -16
  31. package/node_modules/rafi-spec/dist/validate.js +0 -40
  32. package/node_modules/rafi-spec/package.json +0 -35
  33. package/node_modules/rafi-spec/src/index.ts +0 -19
  34. package/node_modules/rafi-spec/src/schemas.ts +0 -130
  35. package/node_modules/rafi-spec/src/types.ts +0 -156
  36. package/node_modules/rafi-spec/src/validate.ts +0 -60
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  29 composable best-practice rule packs, 6 skills, and 4 agent roles for Claude Code and Codex.
4
4
 
5
- The content layer of [Rafi](https://github.com/ttante/foreman). Ships both the authoring source (`content/`) and prebuilt composition logic so it can be used as a library, consumed by `rafi compile`, or extended directly.
5
+ The content layer of [Rafi](https://github.com/ttante/rafi). Ships both the authoring source (`content/`) and prebuilt composition logic so it can be used as a library, consumed by `rafi compile`, or extended directly.
6
6
 
7
7
  ## Install
8
8
 
@@ -40,7 +40,7 @@ emitCompiledBundles("./my-repo", {
40
40
 
41
41
  ## Rule packs
42
42
 
43
- 29 packs across four categories. Conditional packs are only included when the matching flag is on.
43
+ 30 packs across four categories. Conditional packs are only included when the matching flag is on.
44
44
 
45
45
  | Category | Packs | Condition |
46
46
  |---|---|---|
@@ -35,7 +35,6 @@ Use this document to track what the app does, who can use each feature, and what
35
35
 
36
36
  ## Future Ideas
37
37
 
38
- Add future ideas to `docs/tickets.md`; summarize only major themes here.
38
+ Add future ideas to `{{docsRoot}}/tickets.md`; summarize only major themes here.
39
39
 
40
40
  - `<idea/theme>`
41
-
@@ -3,19 +3,19 @@ name: ai-cost
3
3
  category: domain
4
4
  description: "AI cost tracking and the correction/learning loop."
5
5
  condition: ai
6
- template: false
6
+ template: true
7
7
  ---
8
8
  ## AI Cost Tracking And Learning Loop
9
9
 
10
10
  - Include cost tracking throughout AI usage.
11
11
  - Track cost per task for AI generations, including tokens, model/provider, retries, tool calls, retrieval, latency, and final success/failure status where available.
12
12
  - Track other app operations that may create significant cost early or at scale, including cloud resources, queues, storage, external APIs, email/SMS, analytics, and heavy database workloads.
13
- - Keep AI cost tracking and optimization notes updated in `docs/ai-costs.md`.
13
+ - Keep AI cost tracking and optimization notes updated in `{{docsRoot}}/ai-costs.md`.
14
14
  - Record results of AI generation steps when appropriate so the project can learn from successes and failures.
15
15
  - Plan a correction workflow for failed generations: generate suggested corrections, run QA on corrections, and record approved corrections with the failed generation.
16
16
  - Auto-approve corrections only when correction and QA confidence are both very high and the risk level allows it.
17
17
  - Require admin approval for lower-confidence, high-risk, or ambiguous corrections.
18
18
  - Preserve approved corrections and failed generations in a structured format that could support future fine-tuning, evals, or custom model training.
19
- - Document the journey toward custom model training in `docs/ai.md`, including data requirements, quality thresholds, privacy constraints, retention rules, estimated cost, and when training is worth it.
19
+ - Document the journey toward custom model training in `{{docsRoot}}/ai.md`, including data requirements, quality thresholds, privacy constraints, retention rules, estimated cost, and when training is worth it.
20
20
  - During planning, consult the user about the AI learning-loop and custom-training approach. If the full setup would be too cumbersome or data-heavy, recommend a lighter approach.
21
21
 
@@ -3,7 +3,7 @@ name: ai-evals
3
3
  category: domain
4
4
  description: "Quality gates, confidence, evals, and examples for AI."
5
5
  condition: ai
6
- template: false
6
+ template: true
7
7
  ---
8
8
  ## AI Quality, Confidence, And Evals
9
9
 
@@ -28,7 +28,7 @@ template: false
28
28
 
29
29
  ### Eval Suites
30
30
 
31
- - Keep AI eval suites, golden examples, adversarial cases, and regression results updated in `docs/ai-evals.md`.
31
+ - Keep AI eval suites, golden examples, adversarial cases, and regression results updated in `{{docsRoot}}/ai-evals.md`.
32
32
  - Maintain eval sets that cover: correct common cases, edge cases, known failure modes, adversarial inputs, and cases drawn from corrected production failures.
33
33
  - Track AI failures, correction rates, confidence levels, approval outcomes, and quality trends.
34
34
  - Promote prompt, parameter, or model changes only when required eval suites meet documented thresholds, or document the explicit user-approved reason for accepting the risk.
@@ -3,7 +3,7 @@ name: ai-governance
3
3
  category: domain
4
4
  description: "Model/provider and dataset governance."
5
5
  condition: ai
6
- template: false
6
+ template: true
7
7
  ---
8
8
  ## AI Model And Dataset Governance
9
9
 
@@ -12,5 +12,5 @@ template: false
12
12
  - Document dataset sources, consent, labeling process, quality thresholds, retention, access controls, and whether data may be used for evals, fine-tuning, or custom model training.
13
13
  - Keep training/eval datasets versioned where practical.
14
14
  - Do not use customer/user data for model training unless the data policy, consent, retention, security, and approval requirements are documented.
15
- - Document model and dataset governance in `docs/ai.md` and `docs/data-governance.md`.
15
+ - Document model and dataset governance in `{{docsRoot}}/ai.md` and `{{docsRoot}}/data-governance.md`.
16
16
 
@@ -3,7 +3,7 @@ name: ai-safety
3
3
  category: domain
4
4
  description: "Adversarial safety and abuse protection for AI features."
5
5
  condition: ai
6
- template: false
6
+ template: true
7
7
  ---
8
8
  ## AI And LLM Safety
9
9
 
@@ -15,5 +15,5 @@ template: false
15
15
  - Add AI abuse monitoring for suspicious prompts, repeated failures, high-cost usage, policy violations, and unusual generation patterns.
16
16
  - Red-team AI features with prompt injection, jailbreak, data leakage, unsafe action, tool misuse, and cost-abuse cases before high-risk releases.
17
17
  - Maintain an AI incident plan for harmful, wrong, private, expensive, abusive, or policy-violating outputs.
18
- - Document AI safety controls, known risks, and escalation paths in `docs/ai.md` and `docs/operations.md`.
18
+ - Document AI safety controls, known risks, and escalation paths in `{{docsRoot}}/ai.md` and `{{docsRoot}}/operations.md`.
19
19
 
@@ -3,7 +3,7 @@ name: data-governance
3
3
  category: domain
4
4
  description: "Data classification, retention, consent, and PII handling."
5
5
  condition: always
6
- template: false
6
+ template: true
7
7
  ---
8
8
  ## Data Governance
9
9
 
@@ -13,5 +13,5 @@ template: false
13
13
  - Document consent requirements for user data, analytics, AI replay logs, eval datasets, and future model training.
14
14
  - Use access controls for sensitive data and audit access where risk warrants it.
15
15
  - Redact or tokenize PII and secrets before storing prompts, outputs, logs, traces, eval cases, or replay data unless explicitly approved and protected.
16
- - Keep data-governance rules current in `docs/data-governance.md`.
16
+ - Keep data-governance rules current in `{{docsRoot}}/data-governance.md`.
17
17
 
@@ -3,7 +3,7 @@ name: observability
3
3
  category: domain
4
4
  description: "Logging, metrics, dashboards, runbooks, and AI observability."
5
5
  condition: always
6
- template: false
6
+ template: true
7
7
  ---
8
8
  ## Observability And Operations
9
9
 
@@ -12,7 +12,7 @@ template: false
12
12
  - Build visible status tracking for key workflows so users, admins, and operators can understand progress, failures, retries, and completion state.
13
13
  - Add detailed observability for AI generation flows, including generation stages, model calls, retries, validation results, confidence, cost, latency, and approval status.
14
14
  - Avoid logging secrets or sensitive user data.
15
- - Document operational risks, runbooks, cost drivers, and monitoring expectations in `docs/operations.md`, `docs/business.md`, or `docs/architecture.md` as appropriate.
15
+ - Document operational risks, runbooks, cost drivers, and monitoring expectations in `{{docsRoot}}/operations.md`, `{{docsRoot}}/business.md`, or `{{docsRoot}}/architecture.md` as appropriate.
16
16
  - Maintain runbooks for common production failures and manual recovery steps.
17
17
  - For new background jobs, queues, cron tasks, or integrations, document retry behavior, failure modes, and manual recovery steps.
18
18
 
@@ -3,7 +3,7 @@ name: scalability
3
3
  category: domain
4
4
  description: "Scaling strategy across server, cloud, AI, frontend, and data."
5
5
  condition: always
6
- template: false
6
+ template: true
7
7
  ---
8
8
  ## Scalability And Performance
9
9
 
@@ -14,5 +14,5 @@ template: false
14
14
  - For frontend work, watch bundle size, rendering cost, loading states, network waterfalls, and mobile performance.
15
15
  - For cloud infrastructure, document scaling assumptions, capacity limits, deployment topology, regions, managed services, and expected bottlenecks.
16
16
  - For AI/model usage, plan for provider limits, latency, concurrency, queueing, fallback behavior, cost controls, and model upgrade paths.
17
- - Document meaningful scalability assumptions and known limits in `docs/scalability.md`.
17
+ - Document meaningful scalability assumptions and known limits in `{{docsRoot}}/scalability.md`.
18
18
 
@@ -22,13 +22,13 @@ packs:
22
22
  category: process
23
23
  path: process/project-docs.md
24
24
  condition: always
25
- template: false
25
+ template: true
26
26
  order: 4000
27
27
  - name: tickets
28
28
  category: process
29
29
  path: process/tickets.md
30
30
  condition: always
31
- template: false
31
+ template: true
32
32
  supersededByForeman: true
33
33
  order: 5000
34
34
  - name: tdd
@@ -71,7 +71,7 @@ packs:
71
71
  category: domain
72
72
  path: domain/scalability.md
73
73
  condition: always
74
- template: false
74
+ template: true
75
75
  order: 12000
76
76
  - name: infra
77
77
  category: templated
@@ -89,7 +89,7 @@ packs:
89
89
  category: domain
90
90
  path: domain/data-governance.md
91
91
  condition: always
92
- template: false
92
+ template: true
93
93
  order: 15000
94
94
  - name: security
95
95
  category: domain
@@ -101,13 +101,13 @@ packs:
101
101
  category: domain
102
102
  path: domain/ai-safety.md
103
103
  condition: ai
104
- template: false
104
+ template: true
105
105
  order: 17000
106
106
  - name: ai-governance
107
107
  category: domain
108
108
  path: domain/ai-governance.md
109
109
  condition: ai
110
- template: false
110
+ template: true
111
111
  order: 18000
112
112
  - name: robustness
113
113
  category: domain
@@ -119,7 +119,7 @@ packs:
119
119
  category: domain
120
120
  path: domain/ai-evals.md
121
121
  condition: ai
122
- template: false
122
+ template: true
123
123
  order: 20000
124
124
  - name: ai-reproducibility
125
125
  category: domain
@@ -131,7 +131,7 @@ packs:
131
131
  category: domain
132
132
  path: domain/ai-cost.md
133
133
  condition: ai
134
- template: false
134
+ template: true
135
135
  order: 22000
136
136
  - name: ai-batch-testing
137
137
  category: domain
@@ -143,7 +143,7 @@ packs:
143
143
  category: process
144
144
  path: process/release.md
145
145
  condition: always
146
- template: false
146
+ template: true
147
147
  order: 24000
148
148
  - name: accessibility
149
149
  category: domain
@@ -155,19 +155,19 @@ packs:
155
155
  category: domain
156
156
  path: domain/observability.md
157
157
  condition: always
158
- template: false
158
+ template: true
159
159
  order: 26000
160
160
  - name: business-docs
161
161
  category: process
162
162
  path: process/business-docs.md
163
163
  condition: always
164
- template: false
164
+ template: true
165
165
  order: 27000
166
166
  - name: architecture
167
167
  category: process
168
168
  path: process/architecture.md
169
169
  condition: always
170
- template: false
170
+ template: true
171
171
  order: 28000
172
172
  - name: definition-of-done
173
173
  category: base
@@ -3,12 +3,12 @@ name: architecture
3
3
  category: process
4
4
  description: "Architecture digest and ADR/decision-history discipline."
5
5
  condition: always
6
- template: false
6
+ template: true
7
7
  ---
8
8
  ## Architecture And Decisions
9
9
 
10
- - Keep `docs/architecture.md` as a digest of how the app works now.
11
- - Add ADRs in `docs/decisions/` for choices that will matter later, including stack changes, major dependencies, database design, auth model, billing model, hosting, integrations, and AI/provider choices.
12
- - Keep `docs/decisions/README.md` updated as the decision-making history index.
10
+ - Keep `{{docsRoot}}/architecture.md` as a digest of how the app works now.
11
+ - Add ADRs in `{{docsRoot}}/decisions/` for choices that will matter later, including stack changes, major dependencies, database design, auth model, billing model, hosting, integrations, and AI/provider choices.
12
+ - Keep `{{docsRoot}}/decisions/README.md` updated as the decision-making history index.
13
13
  - ADRs should be short: context, decision, alternatives considered, consequences, date.
14
14
 
@@ -3,11 +3,11 @@ name: business-docs
3
3
  category: process
4
4
  description: "Keep business assumptions, costs, and risks current."
5
5
  condition: always
6
- template: false
6
+ template: true
7
7
  ---
8
8
  ## Business Documentation
9
9
 
10
- - Keep `docs/business.md` current with product assumptions, cost drivers, vendor/service pricing notes, revenue/pricing ideas, operational risks, and open business questions.
10
+ - Keep `{{docsRoot}}/business.md` current with product assumptions, cost drivers, vendor/service pricing notes, revenue/pricing ideas, operational risks, and open business questions.
11
11
  - When a change affects cost, pricing, packaging, user roles, admin effort, compliance, support load, AI/model usage, or operational complexity, update the business docs.
12
12
  - If exact pricing or costs require current external information, verify them before documenting.
13
13
 
@@ -3,31 +3,31 @@ name: project-docs
3
3
  category: process
4
4
  description: "The standard set of project documents to create and maintain."
5
5
  condition: always
6
- template: false
6
+ template: true
7
7
  ---
8
8
  ## Standard Project Documents
9
9
 
10
10
  Create and maintain these documents unless the repository has equivalent files:
11
11
 
12
12
  - `README.md`: developer install, setup, environment variables, run, test, build, and deploy basics.
13
- - `docs/architecture.md`: architecture digest, major modules, data flow, integrations, infrastructure, and tradeoffs.
14
- - `docs/features.md`: feature digest, user-facing capabilities, roles, permissions, and important workflows.
15
- - `docs/api.md` or generated API docs: API overview and links to OpenAPI, Swagger, JSDoc, Typedoc, or equivalent generated references.
16
- - `docs/users.md`: normal user documentation.
17
- - `docs/admins.md`: admin/operator documentation.
18
- - `docs/business.md`: business-level notes, feature rationale, pricing/costs, vendor costs, risk areas, operational concerns, and things to watch.
19
- - `docs/operations.md`: deployment notes, monitoring, runbooks, incident response, backups, and recovery steps.
20
- - `docs/security.md`: security model, threat model, auth, permissions, secrets, abuse controls, and incident response.
21
- - `docs/data-governance.md`: data classification, PII handling, retention, deletion/export, consent, and training-data rules.
22
- - `docs/local-cloud.md`: local runtime, cloud runtime, parity expectations, environment differences, and deployment notes.
23
- - `docs/scalability.md`: scaling strategy for server, cloud, AI/model usage, frontend, databases, and overall architecture.
24
- - `docs/ai.md`: AI workflows, model/provider choices, prompts, evals, safety controls, cost tracking, replayability, and training-data strategy when the app uses AI.
25
- - `docs/ai-evals.md`: AI eval suites, golden examples, adversarial cases, quality gates, and prompt/model regression results.
26
- - `docs/ai-costs.md`: AI cost tracking, cost per task, provider/model costs, high-cost workflows, and optimization notes.
27
- - `docs/tickets.md`: ticket log, roadmap, backlog, status, acceptance criteria, and future ideas.
28
- - `docs/decisions/`: ADRs and decision history for meaningful architecture, product, data, vendor, AI, or cost decisions.
29
- - `docs/decisions/README.md`: decision-making history index with links to ADRs and a short status summary.
30
- - `docs/release-checklist.md`: release readiness, versioning, migrations, rollback, smoke tests, and post-release checks.
13
+ - `{{docsRoot}}/architecture.md`: architecture digest, major modules, data flow, integrations, infrastructure, and tradeoffs.
14
+ - `{{docsRoot}}/features.md`: feature digest, user-facing capabilities, roles, permissions, and important workflows.
15
+ - `{{docsRoot}}/api.md` or generated API docs: API overview and links to OpenAPI, Swagger, JSDoc, Typedoc, or equivalent generated references.
16
+ - `{{docsRoot}}/users.md`: normal user documentation.
17
+ - `{{docsRoot}}/admins.md`: admin/operator documentation.
18
+ - `{{docsRoot}}/business.md`: business-level notes, feature rationale, pricing/costs, vendor costs, risk areas, operational concerns, and things to watch.
19
+ - `{{docsRoot}}/operations.md`: deployment notes, monitoring, runbooks, incident response, backups, and recovery steps.
20
+ - `{{docsRoot}}/security.md`: security model, threat model, auth, permissions, secrets, abuse controls, and incident response.
21
+ - `{{docsRoot}}/data-governance.md`: data classification, PII handling, retention, deletion/export, consent, and training-data rules.
22
+ - `{{docsRoot}}/local-cloud.md`: local runtime, cloud runtime, parity expectations, environment differences, and deployment notes.
23
+ - `{{docsRoot}}/scalability.md`: scaling strategy for server, cloud, AI/model usage, frontend, databases, and overall architecture.
24
+ - `{{docsRoot}}/ai.md`: AI workflows, model/provider choices, prompts, evals, safety controls, cost tracking, replayability, and training-data strategy when the app uses AI.
25
+ - `{{docsRoot}}/ai-evals.md`: AI eval suites, golden examples, adversarial cases, quality gates, and prompt/model regression results.
26
+ - `{{docsRoot}}/ai-costs.md`: AI cost tracking, cost per task, provider/model costs, high-cost workflows, and optimization notes.
27
+ - `{{docsRoot}}/tickets.md`: ticket log, roadmap, backlog, status, acceptance criteria, and future ideas.
28
+ - `{{docsRoot}}/decisions/`: ADRs and decision history for meaningful architecture, product, data, vendor, AI, or cost decisions.
29
+ - `{{docsRoot}}/decisions/README.md`: decision-making history index with links to ADRs and a short status summary.
30
+ - `{{docsRoot}}/release-checklist.md`: release readiness, versioning, migrations, rollback, smoke tests, and post-release checks.
31
31
  - `CHANGELOG.md`: notable user-facing, API, migration, and operational changes.
32
32
  - `.env.example`: documented environment variables with safe placeholder values.
33
33
 
@@ -3,14 +3,14 @@ name: release
3
3
  category: process
4
4
  description: "Changelog, semver, release checklist, and post-release notes."
5
5
  condition: always
6
- template: false
6
+ template: true
7
7
  ---
8
8
  ## Release, Versioning, And Change Management
9
9
 
10
10
  - Maintain `CHANGELOG.md` for notable user-facing, API, migration, security, AI/model, and operational changes.
11
11
  - Use semantic versioning where it applies to published apps, APIs, packages, SDKs, or user-visible releases.
12
12
  - Document breaking changes, deprecations, migration steps, rollback steps, and user/admin impact.
13
- - Use `docs/release-checklist.md` before releases that affect users, production data, public APIs, infrastructure, billing, auth, or AI behavior.
13
+ - Use `{{docsRoot}}/release-checklist.md` before releases that affect users, production data, public APIs, infrastructure, billing, auth, or AI behavior.
14
14
  - Include smoke tests, monitoring checks, migration checks, environment-variable checks, documentation updates, and rollback readiness in release planning.
15
15
  - After release, document incidents, regressions, follow-up work, and any release-process improvements.
16
16
 
@@ -3,12 +3,12 @@ name: tickets
3
3
  category: process
4
4
  description: "Ticket log expectations when no external tracker is configured."
5
5
  condition: always
6
- template: false
6
+ template: true
7
7
  supersededByForeman: true
8
8
  ---
9
9
  ## Ticket Tracking
10
10
 
11
- - Maintain `docs/tickets.md` as the source of truth if no external tracker is configured.
11
+ - Maintain `{{docsRoot}}/tickets.md` as the source of truth if no external tracker is configured.
12
12
  - Break work into epics, stories, and implementation tickets where useful.
13
13
  - Every ticket should include: ID, title, status, priority, user/business value, acceptance criteria, implementation notes, test expectations, and links to related docs or code when available.
14
14
  - Valid statuses: `Backlog`, `Ready`, `In Progress`, `Blocked`, `In Review`, `Done`, `Won't Do`.
@@ -12,5 +12,5 @@ template: true
12
12
  - Keep migrations reviewable and, where practical, reversible.
13
13
  - Update seed data, fixtures, and `.env.example` when schema or setup requirements change.
14
14
  - Validate data at system boundaries and before persistence.
15
- - Document important entities and relationships in `docs/architecture.md`.
15
+ - Document important entities and relationships in `{{docsRoot}}/architecture.md`.
16
16
 
@@ -13,6 +13,6 @@ template: true
13
13
  - Keep `.env.example`, setup docs, seed data, and local database instructions current.
14
14
  - Define cloud infrastructure with Infrastructure as Code such as AWS CDK, Terraform, Pulumi, or CloudFormation unless there is a documented reason not to.
15
15
  - Avoid manual cloud console changes for durable infrastructure. If manual changes are unavoidable, document them and add follow-up work to codify them.
16
- - Document {{cloud}} account/region assumptions, IAM model, networking, secrets, storage, databases, queues, observability, and deployment flow in `docs/local-cloud.md`, `docs/architecture.md`, or `docs/operations.md`.
16
+ - Document {{cloud}} account/region assumptions, IAM model, networking, secrets, storage, databases, queues, observability, and deployment flow in `{{docsRoot}}/local-cloud.md`, `{{docsRoot}}/architecture.md`, or `{{docsRoot}}/operations.md`.
17
17
  - Consult the user when local/cloud runtime expectations, hosting constraints, or infrastructure ownership are unclear.
18
18
 
package/dist/compile.d.ts CHANGED
@@ -53,7 +53,7 @@ export declare function buildConditionsHeader(flags: {
53
53
  usesAI: boolean;
54
54
  hasFrontend: boolean;
55
55
  runsInCloud: boolean;
56
- }): string;
56
+ }, docsRoot?: string): string;
57
57
  /**
58
58
  * Write `<targetDir>/AGENTS.md` — the flattened Codex rules document.
59
59
  * Format: one-line conditions header + preamble + all packs rendered with defaults.
package/dist/compile.js CHANGED
@@ -19,7 +19,10 @@ import { loadAllSkills, SKILLS_DIR } from "./skills.js";
19
19
  export const CUSTOM_ARTIFACTS_NOTE = "Custom Rafi skills or agents can replace the defaults by setting `artifact_source: existing` and editing their paths in `rafi-config.yaml`.\n";
20
20
  /** Render one pack body, substituting `{{vars}}` and resolving `{{#if flag}}` blocks. */
21
21
  export function renderPackBody(pack, defaults) {
22
- return render(pack.body, { vars: defaults.stack, flags: defaults.flags });
22
+ return render(pack.body, {
23
+ vars: { ...defaults.stack, docsRoot: defaults.docsRoot ?? "docs" },
24
+ flags: defaults.flags,
25
+ });
23
26
  }
24
27
  /**
25
28
  * The full flattened rules doc: preamble + all packs (index order), rendered.
@@ -61,10 +64,11 @@ export function getAgent(role, opts = {}) {
61
64
  * are active. Written at the top of `AGENTS.md` and `CLAUDE.md` so the choice
62
65
  * is never invisible.
63
66
  */
64
- export function buildConditionsHeader(flags) {
67
+ export function buildConditionsHeader(flags, docsRoot = "docs") {
65
68
  return (`# rafi: ai=${flags.usesAI ? "on" : "off"}` +
66
69
  ` frontend=${flags.hasFrontend ? "on" : "off"}` +
67
- ` cloud=${flags.runsInCloud ? "on" : "off"}\n`);
70
+ ` cloud=${flags.runsInCloud ? "on" : "off"}` +
71
+ ` docs=${docsRoot}\n`);
68
72
  }
69
73
  /**
70
74
  * Write `<targetDir>/AGENTS.md` — the flattened Codex rules document.
@@ -81,12 +85,12 @@ export function emitClaudeMd(targetDir, opts = {}) {
81
85
  }
82
86
  export function renderAgentsMd(opts = {}) {
83
87
  const defaults = opts.defaults ?? loadDefaults();
84
- const header = buildConditionsHeader(defaults.flags);
88
+ const header = buildConditionsHeader(defaults.flags, defaults.docsRoot ?? "docs");
85
89
  return header + composeRulesMarkdown({ defaults });
86
90
  }
87
91
  export function renderClaudeMd(opts = {}) {
88
92
  const defaults = opts.defaults ?? loadDefaults();
89
- const header = buildConditionsHeader(defaults.flags);
93
+ const header = buildConditionsHeader(defaults.flags, defaults.docsRoot ?? "docs");
90
94
  return header + "@AGENTS.md\n\n" + CUSTOM_ARTIFACTS_NOTE;
91
95
  }
92
96
  /**