@tera-system/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/LICENSE.md +13 -0
  2. package/MANIFEST.json +24 -0
  3. package/README.md +67 -0
  4. package/RELEASES.md +28 -0
  5. package/WELCOME.md +35 -0
  6. package/agents/application-blueprint.md +407 -0
  7. package/agents/auditor.md +665 -0
  8. package/agents/design-reviewer.md +392 -0
  9. package/agents/domain-expert-agent.md +510 -0
  10. package/agents/domain-research-agent.md +360 -0
  11. package/agents/engineering-agent-dotnet.md +218 -0
  12. package/agents/engineering-agent-phaser.md +275 -0
  13. package/agents/engineering-agent-typescript.md +300 -0
  14. package/agents/engineering-agent.md +143 -0
  15. package/agents/monitor.md +395 -0
  16. package/agents/production-erp-expert.md +506 -0
  17. package/agents/project-knowledge-agent.md +271 -0
  18. package/agents/qa-agent.md +498 -0
  19. package/agents/tera-business-transformation-consultant.md +290 -0
  20. package/agents/tera-client-engagement.md +891 -0
  21. package/agents/tera-software-designer.md +237 -0
  22. package/agents/tera-strategic-advisor.md +325 -0
  23. package/agents/tera-system-evolution.md +759 -0
  24. package/agents/tera.md +520 -0
  25. package/agents/ui-designer.md +426 -0
  26. package/commands/tera-approve.md +34 -0
  27. package/commands/tera-diagnose.md +47 -0
  28. package/commands/tera-gate.md +40 -0
  29. package/commands/tera-help.md +41 -0
  30. package/commands/tera-new-project.md +35 -0
  31. package/commands/tera-plan.md +34 -0
  32. package/commands/tera-request-build.md +45 -0
  33. package/commands/tera-resume.md +34 -0
  34. package/commands/tera-review.md +52 -0
  35. package/commands/tera-status.md +38 -0
  36. package/commands/tera-update.md +48 -0
  37. package/core/project-control/templates/TASK_TEMPLATE.md +146 -0
  38. package/core/tera-system/AGENT_ACTIVATION_MATRIX.md +285 -0
  39. package/core/tera-system/AGENT_DEPENDENCY_MAP.md +117 -0
  40. package/core/tera-system/AGENT_GENERATION_TEMPLATE.md +312 -0
  41. package/core/tera-system/AGENT_PERMISSION_MODEL.md +343 -0
  42. package/core/tera-system/AIS_PROTOCOL.md +191 -0
  43. package/core/tera-system/TERA_AGENT_CONDUCT.md +102 -0
  44. package/core/tera-system/TERA_CONTINUOUS_IMPROVEMENT_POLICY.md +111 -0
  45. package/core/tera-system/TERA_DISTRIBUTION_POLICY.md +291 -0
  46. package/core/tera-system/TERA_PROJECT_DECISION.md +281 -0
  47. package/core/tera-system/TERA_USER_GUIDE.md +462 -0
  48. package/core/tera-system/TOOLING_AND_MCP_POLICY.md +285 -0
  49. package/core/tera-system/TeraApplicationQuestionBank.md +362 -0
  50. package/core/tera-system/TeraArchitectureMap.md +91 -0
  51. package/core/tera-system/TeraClientPolicy.md +366 -0
  52. package/core/tera-system/TeraHelperAgents.md +970 -0
  53. package/core/tera-system/TeraPolicyMap.md +131 -0
  54. package/core/tera-system/TeraPreExecutionGate.md +818 -0
  55. package/core/tera-system/TeraPreparationDocumentationGovernance.md +370 -0
  56. package/core/tera-system/TeraPricingPolicy.md +674 -0
  57. package/core/tera-system/TeraProjectIntakePolicy.md +164 -0
  58. package/core/tera-system/TeraScenarioStressTests.md +168 -0
  59. package/core/tera-system/TeraSubAgents.md +854 -0
  60. package/core/tera-system/TeraSystemMaintenanceChecklist.md +80 -0
  61. package/core/tera-system/TeraTokenPolicy.md +362 -0
  62. package/core/tera-system/Tera_Project_Preparation_Files.md +1045 -0
  63. package/core/tera-system/agent-helpers/application-blueprint-details.md +177 -0
  64. package/core/tera-system/client-helpers/tera-client-engagement-discovery-domains.md +99 -0
  65. package/core/tera-system/client-helpers/tera-client-engagement-gates.md +258 -0
  66. package/core/tera-system/client-helpers/tera-client-engagement-pricing.md +341 -0
  67. package/core/tera-system/client-helpers/tera-client-engagement-protocols.md +692 -0
  68. package/core/tera-system/consulting-helpers/BTCA_METHODOLOGY_FRAMEWORK.md +195 -0
  69. package/core/tera-system/consulting-helpers/BTCA_REPORT_TEMPLATES.md +266 -0
  70. package/core/tera-system/design-system/ACCESSIBILITY_RULES.md +31 -0
  71. package/core/tera-system/design-system/COMPONENT_LIBRARY_SCHEMA.md +46 -0
  72. package/core/tera-system/design-system/DESIGN_MD_INTEGRATION.md +59 -0
  73. package/core/tera-system/design-system/DESIGN_REVIEW_STANDARDS.md +241 -0
  74. package/core/tera-system/design-system/DESIGN_SOURCE_PROTOCOL.md +61 -0
  75. package/core/tera-system/design-system/DESIGN_SYSTEM_OVERVIEW.md +66 -0
  76. package/core/tera-system/design-system/DESIGN_TOKENS_SCHEMA.md +66 -0
  77. package/core/tera-system/design-system/EXTERNAL_REFERENCE_ANALYSIS.md +52 -0
  78. package/core/tera-system/design-system/FIGMA_INTEGRATION.md +138 -0
  79. package/core/tera-system/design-system/INTERNAL_KITS_INDEX.md +26 -0
  80. package/core/tera-system/design-system/LAYOUT_PATTERNS.md +52 -0
  81. package/core/tera-system/design-system/MOBILE_UI_UX_STANDARDS.md +342 -0
  82. package/core/tera-system/design-system/RTL_LTR_RULES.md +39 -0
  83. package/core/tera-system/design-system/UI_ACCEPTANCE_GATE.md +80 -0
  84. package/core/tera-system/design-system/kits/KIT_ADMIN_DASHBOARD.md +102 -0
  85. package/core/tera-system/engineering-governance/ENGINEERING_AGENT_RESPONSIBILITIES.md +210 -0
  86. package/core/tera-system/engineering-governance/ENGINEERING_BEST_PRACTICES.md +468 -0
  87. package/core/tera-system/engineering-governance/ENGINEERING_GOVERNANCE_GATE.md +131 -0
  88. package/core/tera-system/engineering-governance/ENGINEERING_REVIEW_CHECKLIST.md +129 -0
  89. package/core/tera-system/engineering-governance/QUALITY_GATE_THRESHOLDS.md +159 -0
  90. package/core/tera-system/engineering-helpers/engineering-agent-core.md +171 -0
  91. package/core/tera-system/knowledge-base/OPENHANDS_ARCHITECTURE_REFERENCE.md +243 -0
  92. package/core/tera-system/knowledge-base/manufacturing/00_INDEX.md +32 -0
  93. package/core/tera-system/knowledge-base/manufacturing/01_MANUFACTURING_ERP_CORE_CONCEPTS.md +7 -0
  94. package/core/tera-system/knowledge-base/manufacturing/02_SAP_MANUFACTURING_RESEARCH.md +7 -0
  95. package/core/tera-system/knowledge-base/manufacturing/03_DYNAMICS_365_MANUFACTURING_RESEARCH.md +7 -0
  96. package/core/tera-system/knowledge-base/manufacturing/04_ORACLE_MANUFACTURING_RESEARCH.md +7 -0
  97. package/core/tera-system/knowledge-base/manufacturing/05_ODOO_MANUFACTURING_RESEARCH.md +7 -0
  98. package/core/tera-system/knowledge-base/manufacturing/06_ERPNEXT_MANUFACTURING_RESEARCH.md +7 -0
  99. package/core/tera-system/knowledge-base/manufacturing/07_MANUFACTURING_COSTING_GUIDE.md +7 -0
  100. package/core/tera-system/knowledge-base/manufacturing/08_PRODUCTION_DISCOVERY_QUESTIONS.md +7 -0
  101. package/core/tera-system/knowledge-base/manufacturing/09_MANUFACTURING_BLUEPRINT_CHECKLIST.md +7 -0
  102. package/core/tera-system/knowledge-base/manufacturing/10_PRODUCTION_TEST_SCENARIOS.md +7 -0
  103. package/core/tera-system/knowledge-base/manufacturing/11_QUALITY_REWORK_AND_SCRAP_GUIDE.md +7 -0
  104. package/core/tera-system/knowledge-base/manufacturing/12_MRP_AND_PLANNING_GUIDE.md +7 -0
  105. package/core/tera-system/knowledge-base/manufacturing/13_LOCAL_AND_REGIONAL_MANUFACTURING_CONTEXT.md +7 -0
  106. package/core/tera-system/knowledge-base/manufacturing/14_VENDOR_COMPARISON_MATRIX.md +7 -0
  107. package/core/tera-system/product-standards/maintenance-apps/BEST_PRACTICES_DOMAIN.md +325 -0
  108. package/core/tera-system/product-standards/maintenance-apps/STANDARD_DEFINITION.md +142 -0
  109. package/core/tera-system/profiles/PROFILES_INDEX.md +57 -0
  110. package/core/tera-system/profiles/TEMPLATE.md +47 -0
  111. package/core/tera-system/profiles/dotnet-blazor-ef.md +76 -0
  112. package/core/tera-system/profiles/dotnet-razorpages-adonet.md +137 -0
  113. package/core/tera-system/profiles/dotnet-wpf-sqlite.md +159 -0
  114. package/core/tera-system/profiles/effect-bun-opencode.md +109 -0
  115. package/core/tera-system/profiles/flutter-mobile.md +369 -0
  116. package/core/tera-system/profiles/nextjs-prisma.md +110 -0
  117. package/core/tera-system/profiles/phaser-react-node.md +302 -0
  118. package/core/tera-system/profiles/react-pwa.md +97 -0
  119. package/core/tera-system/runtime/CLIENT_DISCOVERY_PROTOCOL.md +145 -0
  120. package/core/tera-system/runtime/DOMAIN_INTELLIGENCE_PROTOCOL.md +124 -0
  121. package/core/tera-system/runtime/MVP_DEFINITION_PROTOCOL.md +176 -0
  122. package/core/tera-system/runtime/TERA_RUNTIME_CHECKLISTS.md +646 -0
  123. package/core/tera-system/runtime/TERA_RUNTIME_PROTOCOLS.md +50 -0
  124. package/core/tera-system/runtime/TERA_RUNTIME_PROTOCOLS_CLIENT.md +355 -0
  125. package/core/tera-system/runtime/TERA_RUNTIME_PROTOCOLS_CORE.md +799 -0
  126. package/core/tera-system/runtime/TERA_RUNTIME_TEMPLATES.md +908 -0
  127. package/core/tera-system/runtime/TERA_RUNTIME_TEMPLATES_DELIVERY.md +584 -0
  128. package/core/tera-system/runtime/TERA_RUNTIME_TEMPLATES_PREPARATION.md +376 -0
  129. package/core/tera-system/runtime/TERA_SOLUTION_PREPARATION_PROTOCOL.md +335 -0
  130. package/core/tera-system/runtime/TERA_SOLUTION_PREPARATION_TEMPLATES.md +397 -0
  131. package/core/tera-system/runtime/VERSION_LIFECYCLE_PROTOCOL.md +296 -0
  132. package/core/tera-system/semgrep-rules/README.md +32 -0
  133. package/core/tera-system/semgrep-rules/tera-security.yml +66 -0
  134. package/core/tera-system/semgrep-rules/tera-standards.yml +49 -0
  135. package/core/tera-system/teranoo-ui/README.md +48 -0
  136. package/core/tera-system/teranoo-ui/components/button.tsx +51 -0
  137. package/core/tera-system/teranoo-ui/components/card.tsx +49 -0
  138. package/core/tera-system/teranoo-ui/components/dashboard-layout.tsx +36 -0
  139. package/core/tera-system/teranoo-ui/components/data-table.tsx +146 -0
  140. package/core/tera-system/teranoo-ui/components/empty-state.tsx +31 -0
  141. package/core/tera-system/teranoo-ui/components/kpi-card.tsx +42 -0
  142. package/core/tera-system/teranoo-ui/components/page-header.tsx +25 -0
  143. package/core/tera-system/teranoo-ui/components/search-input.tsx +40 -0
  144. package/core/tera-system/teranoo-ui/components/sidebar.tsx +66 -0
  145. package/core/tera-system/teranoo-ui/components/stats-card.tsx +37 -0
  146. package/core/tera-system/teranoo-ui/registry.json +77 -0
  147. package/core/tera-system/teranoo-ui/styles/teranoo-theme.css +61 -0
  148. package/opencode.tera.example.json +30 -0
  149. package/package.json +37 -0
  150. package/scripts/build.mjs +110 -0
  151. package/scripts/install.js +244 -0
  152. package/scripts/lib/license.mjs +90 -0
  153. package/scripts/lib/public-key.pem +3 -0
  154. package/scripts/tera-license.mjs +63 -0
  155. package/tools/tera-clean.ps1 +97 -0
  156. package/tools/tera-fetch.ps1 +165 -0
  157. package/tools/tera-release.ps1 +96 -0
  158. package/tools/tera-schedule.ps1 +59 -0
  159. package/tools/tera-update.ps1 +472 -0
  160. package/tools/tera-watch.ps1 +154 -0
  161. package/tools/update-client-repositories.ps1 +92 -0
@@ -0,0 +1,370 @@
1
+ # Tera Preparation Documentation Governance Model
2
+
3
+ ## 1. Purpose
4
+
5
+ This file defines how application preparation documents are **classified, created, reviewed, approved, consumed, and changed** within the Tera system.
6
+
7
+ It is the source of truth for **document lifecycle governance**. It applies to all files under `project-preparation/` and all agent activity that produces or consumes them.
8
+
9
+ ### Relation to other files
10
+
11
+ | File | Role |
12
+ |---|---|
13
+ | `Tera_Project_Preparation_Files.md` | Catalog of available preparation files |
14
+ | `.opencode/agents/application-blueprint.md` | Governs blueprint artifacts before formal preparation begins |
15
+ | `.opencode/agents/tera.md` (§4.2–4.4) | Phase 3/4/5 workflow using this governance model |
16
+ | `.opencode/agents/application-blueprint.md` | Solution Preparation Authority (phases 1–4) — SCP-2026-07-28-118 |
17
+ | `TeraSubAgents.md` | Agent definitions that follow maker/checker rules |
18
+ | `TERA_RUNTIME_TEMPLATES.md` | Templates that include lifecycle fields |
19
+ | `AGENT_ACTIVATION_MATRIX.md` | Activation triggers respecting document readiness |
20
+
21
+ ---
22
+
23
+ ## 1.1 Pre-Baseline Blueprint Artifacts
24
+
25
+ Before formal preparation begins, `ApplicationBlueprintAgent` may create:
26
+
27
+ ```text
28
+ project-preparation/APPLICATION_BLUEPRINT.md
29
+ project-preparation/BLUEPRINT_OPEN_QUESTIONS.md
30
+ project-preparation/BLUEPRINT_DECISION_CANDIDATES.md
31
+ project-preparation/draft-seeds/*
32
+ ```
33
+
34
+ These are **pre-baseline blueprint artifacts**, not formal preparation baseline documents.
35
+
36
+ Special rules:
37
+
38
+ - `APPLICATION_BLUEPRINT.md` starts as `Draft`.
39
+ - Allowed blueprint statuses are:
40
+ - `draft`
41
+ - `pending_confirmation`
42
+ - `approved_for_preparation`
43
+ - `revision_required`
44
+ - `blocked_by_unconfirmed_handoff`
45
+ - No preparation agent may consume blueprint artifacts downstream unless `APPLICATION_BLUEPRINT.md` has reached `approved_for_preparation`.
46
+ - `draft-seeds/` are never baseline by themselves and must not be consumed as execution-ready preparation files.
47
+
48
+ Once blueprinting is approved, ApplicationBlueprintAgent (مُهندس — SCP-2026-07-28-118) uses the blueprint as an upstream advisory source to create formal preparation documents, which then follow the normal lifecycle below.
49
+
50
+ ---
51
+
52
+ ## 2. Document Taxonomy
53
+
54
+ Preparation documents are classified along **two orthogonal dimensions**:
55
+
56
+ ### 2.1 By Role in the Project Lifecycle
57
+
58
+ | Class | Meaning | Examples |
59
+ |---|---|---|
60
+ | **Intake / Client Understanding** | Captures client idea, context, and scope | `00_PROJECT_INPUTS.md`, `01_PROJECT_BRIEF.md`, `02_SCOPE_AND_BOUNDARIES.md` |
61
+ | **Structural Analysis** | Defines modules, users, workflows, data, screens | `03_MODULES_AND_FEATURES.md`, `04_USERS_ROLES_PERMISSIONS.md`, `05_BUSINESS_WORKFLOWS.md`, `06_DATA_MODEL_PREPARATION.md`, `07_SCREENS_AND_UI_STRUCTURE.md`, `12_BUSINESS_RULES.md` |
62
+ | **Cross-Cutting Rules** | Define shared constraints across all modules | `08_TECHNICAL_ARCHITECTURE.md`, `15_SECURITY_AND_ACCESS_CONTROL.md`, `21_VALIDATION_AND_ERROR_HANDLING.md`, `28_UI_UX_GUIDELINES.md` |
63
+ | **Executable Design** | Drive implementation directly | `19_DATABASE_DESIGN.md`, `20_API_CONTRACTS.md`, `28_UI_UX_GUIDELINES.md` (executable rules) |
64
+ | **Planning & Control** | Govern the execution process | `09_IMPLEMENTATION_PLAN.md`, `25_CHANGE_REQUESTS.md`, `24_CLIENT_REVIEW_NOTES.md` |
65
+ | **Late-Closure / Delivery** | Complete only before or after delivery | `10_TESTING_AND_ACCEPTANCE.md`, `11_DELIVERY_AND_HANDOVER.md`, `30_USER_MANUAL_DRAFT.md`, `31_MAINTENANCE_AND_SUPPORT.md` |
66
+
67
+ ### 2.2 By Dependency Flow
68
+
69
+ | Dependency Profile | Meaning | Rules |
70
+ |---|---|---|
71
+ | **Foundation** | No dependency on other prep files | Can be created first, approved first |
72
+ | **Consumer** | Depends on one or more Foundation files | Must wait until its dependencies reach at least `Module Baseline Approved` |
73
+ | **Derived** | Built by transforming/reconciling other files | Must wait until all sources are `Module Baseline Approved` or higher |
74
+ | **Living** | Updated throughout the project lifecycle | May start early but closes late; partial baselines allowed per module |
75
+ | **Late-Bound** | Created only after execution begins or before delivery | Not needed during early phases; closes last |
76
+
77
+ ---
78
+
79
+ ## 3. Document Lifecycle States
80
+
81
+ Every preparation document passes through these states. Not all states are mandatory for every document — the closure condition determines its final state.
82
+
83
+ ```text
84
+ ┌──────────────┐
85
+ │ Draft │
86
+ └──────┬───────┘
87
+
88
+
89
+ ┌─────────────────┐
90
+ │ Under Cross- │
91
+ │ Review │
92
+ └──────┬──────────┘
93
+
94
+ ┌──────▼──────────┐
95
+ │ Module Baseline │
96
+ │ Approved (MBA) │
97
+ └──────┬──────────┘
98
+
99
+ ┌────────────┼────────────┐
100
+ │ │ │
101
+ ▼ ▼ ▼
102
+ ┌────────────┐ ┌──────────┐ ┌──────────┐
103
+ │ System │ │ Change │ │ Superseded│
104
+ │ Pending │ │ Requested│ │ │
105
+ │ Integration│ └────┬─────┘ └──────────┘
106
+ └──────┬─────┘ │
107
+ │ │
108
+ ▼ │
109
+ ┌────────────┐ │
110
+ │ System │◄─────┘
111
+ │ Approved │
112
+ └──────┬─────┘
113
+
114
+
115
+ ┌────────────┐
116
+ │ Locked │
117
+ └────────────┘
118
+ ```
119
+
120
+ ### 3.1 State Definitions
121
+
122
+ | State | Meaning | Who Can Advance | Consumption Allowed By |
123
+ |---|---|---|---|
124
+ | **Draft** | Being written; content may be incomplete | Maker agent + Tera | No consumer agent |
125
+ | **Under Cross-Review** | Submitted for cross-document review by Checker agent(s) | Tera submits; Checker returns findings | Reviewers only |
126
+ | **Module Baseline Approved** | A defined module/wave of this document is approved for that module | Tera → Owner (for sensitive items only) | SoftwareDesignerAgent for that module; execution planning for that module |
127
+ | **System Pending Integration** | Approved at module level but not yet reconciled with all system-level documents | Tera | Limited: execution planning for the module only |
128
+ | **System Approved** | All modules approved; system-level consistency confirmed | Tera → Owner (summary only) | All consumer agents; full execution planning |
129
+ | **Locked** | No further changes expected; only Change Request can reopen | Owner | All consumers (read-only) |
130
+ | **Change Requested** | Formal change requested after baseline; impact analysis required | Owner → Tera | Only the impact analysis |
131
+ | **Superseded** | Replaced by a newer version of the same document | Tera | None (read archived copy only) |
132
+
133
+ ### 3.2 Closure Conditions
134
+
135
+ | Document Type | Minimal Usable State | Final Target State |
136
+ |---|---|---|
137
+ | Intake / Client Understanding | Module Baseline Approved (single module) | System Approved |
138
+ | Structural Analysis | Module Baseline Approved (per module) | System Approved |
139
+ | Cross-Cutting Rules | Module Baseline Approved (initial version) | System Approved |
140
+ | Executable Design | Module Baseline Approved (per module) | Locked |
141
+ | Planning & Control | Module Baseline Approved | System Approved |
142
+ | Late-Closure | Draft (early) → Locked (delivery) | Locked (at delivery) |
143
+
144
+ ---
145
+
146
+ ## 4. Maker / Checker / Orchestrator / Owner Model
147
+
148
+ ### 4.1 Roles
149
+
150
+ | Role | Who | Responsibility |
151
+ |---|---|---|
152
+ | **Maker** | Specialized preparation agent (e.g., `DataDesignAgent`, `UIUXStructureAgent`) | Writes the document following its template and assigned allowed-write-targets |
153
+ | **Checker** | A different preparation agent or coordination agent | Reviews the document for: cross-document consistency, dependency alignment, completeness against its template |
154
+ | **Orchestrator** | ApplicationBlueprintAgent (مُهندس) — SCP-2026-07-28-118 | Plans the document, assigns Maker, assigns Checker, tracks state, detects contradictions, prepares approval packages |
155
+ | **Owner** | Majed | Approves only sensitive decisions (module boundaries, scope changes, critical Cross-Cutting Rules, System Approved promotion). Does not review every field. |
156
+
157
+ ### 4.2 Cross-Review Rules
158
+
159
+ 1. **Every preparation document** that advances from `Draft` to `Module Baseline Approved` must pass through `Under Cross-Review`.
160
+ 2. The Checker must be an agent **different from the Maker**.
161
+ 3. The Checker reviews for:
162
+ - Consistency with upstream documents (e.g., `06_DATA_MODEL_PREPARATION.md` must align with `03_MODULES_AND_FEATURES.md` and `05_BUSINESS_WORKFLOWS.md`)
163
+ - Completeness against the document's own required sections (from the template)
164
+ - Edge cases and missing dependencies
165
+ 4. If the Checker finds issues, the document returns to `Draft` with documented findings.
166
+ 5. If the Checker approves, Tera advances it to the next state.
167
+
168
+ ### 4.3 Owner Approval Points
169
+
170
+ The Owner (Majed) approves only these decision points:
171
+
172
+ | Approval Point | What Is Approved | Document State After |
173
+ |---|---|---|
174
+ | **Module scope** | What is inside/outside scope for a module | Module Baseline Approved |
175
+ | **Critical Cross-Cutting Rule** | Architecture, security model, compliance | System Approved (section) |
176
+ | **System Integration** | All modules reconciled and consistent | System Approved |
177
+ | **Change After Baseline** | A formal change request with impact analysis | Change Requested → (back to MBA or higher) |
178
+
179
+ **The Owner does not approve:**
180
+ - Every field in every document
181
+ - Routine updates after initial baseline (unless the update changes scope or cross-cutting rules)
182
+ - Checker findings or routine state transitions
183
+
184
+ ---
185
+
186
+ ## 5. Partial Approval / Module Baseline
187
+
188
+ ### 5.1 Principle
189
+
190
+ Large projects may have multiple modules (e.g., Inventory, Sales, HR). Each module can reach `Module Baseline Approved` independently, **without waiting for all other modules**.
191
+
192
+ ### 5.2 Rules
193
+
194
+ 1. A `Module Baseline Approved` state means: *this module's content in this document is stable and approved for consumption.*
195
+ 2. Changes to an `MBA` section require a **Documentation Change Request** with impact analysis.
196
+ 3. Each module's baseline must identify:
197
+ - Which sections/entities are covered
198
+ - Which other documents depend on this module
199
+ - Any open assumptions specific to this module
200
+ 4. When all modules reach `MBA`, the entire document may advance to `System Pending Integration`.
201
+
202
+ ### 5.3 Cross-Module Consistency
203
+
204
+ Before advancing to `System Approved`:
205
+ 1. Tera orchestrates a **system-level reconciliation check**:
206
+ - No duplicate entities across modules
207
+ - Consistent naming and relationships
208
+ - No orphan references (e.g., a screen that refers to a removed entity)
209
+ 2. Any conflict found is resolved either by adjusting the affected modules or by raising a Documentation Gap.
210
+
211
+ ---
212
+
213
+ ## 6. Documentation Impact Analysis
214
+
215
+ ### 6.1 When Required
216
+
217
+ A formal impact analysis is required **after** any document has reached `Module Baseline Approved` and a change is proposed that affects:
218
+
219
+ - A table, field, or relationship in the data model
220
+ - A screen, navigation path, or UI component
221
+ - A business workflow state or transition
222
+ - A business rule (validation, calculation, authorization)
223
+ - An API endpoint, request, or response
224
+ - A security permission or role
225
+ - A cross-cutting rule (architecture, design token, compliance)
226
+
227
+ ### 6.2 Impact Analysis Format
228
+
229
+ When a change is proposed after baseline, the agent requesting the change must produce:
230
+
231
+ ```text
232
+ Affected Documents: [list of documents that must be updated]
233
+ Affected Modules: [list of modules impacted]
234
+ Nature of Change: [addition / modification / deletion / deprecation]
235
+ Dependency Impact: [list of documents that depend on the changed content]
236
+ Open Questions: [any unresolved questions before approval]
237
+ ```
238
+
239
+ ### 6.3 Approval Path for Changes
240
+
241
+ | Change Severity | Approval Required |
242
+ |---|---|
243
+ | Addition within existing scope (no breaking change) | Tera (recorded in `CHANGE_REQUESTS.md`) |
244
+ | Modification affecting cross-module consistency | Tera + Owner (summary only) |
245
+ | Deletion or deprecation of existing content | Owner |
246
+ | Change affecting architecture, security, or compliance | Owner |
247
+
248
+ ---
249
+
250
+ ## 7. Focused Research for Documentation Gaps
251
+
252
+ ### 7.1 When Research Is Allowed
253
+
254
+ Targeted web research is permitted **only** when all of the following are true:
255
+
256
+ 1. A **specific documentation gap** exists (e.g., "What are the standard chart of accounts categories for a Saudi retail company?")
257
+ 2. The gap **blocks** a decision required for document completeness
258
+ 3. No existing Tera system knowledge, profile, or domain intelligence can resolve it
259
+
260
+ ### 7.2 Research Protocol
261
+
262
+ 1. The requesting agent (Maker or Checker) produces a `Research Request` with:
263
+ - **Gap Description**: what is missing and why it is needed
264
+ - **Research Question**: a single, precise question
265
+ - **Source Criteria**: what kind of sources are acceptable
266
+ 2. Tera or `DomainResearchAgent` executes the search.
267
+ 3. The result is documented as:
268
+
269
+ ```text
270
+ Research Topic: [the gap]
271
+ Sources Reviewed: [list of sources]
272
+ Findings: [what the research found]
273
+ Applicability: [whether it applies to this project's context]
274
+ Adoption Decision: Adopted / Rejected / Deferred
275
+ Reason: [why it was adopted, rejected, or deferred]
276
+ ```
277
+
278
+ 4. The decision is recorded in the relevant preparation document or in `project-control/DECISIONS_LOG.md`.
279
+
280
+ ### 7.3 Anti-Bloat for Research
281
+
282
+ - No research without a gap.
283
+ - No research without a specific question.
284
+ - No research that duplicates prior findings (check `DECISIONS_LOG.md` first).
285
+ - No adoption without context evaluation.
286
+
287
+ ---
288
+
289
+ ## 8. Consumption Readiness Rules
290
+
291
+ ### 8.1 Who May Consume What
292
+
293
+ | Consumer | May Consume Documents At State | Notes |
294
+ |---|---|---|
295
+ | Tera (planning) | Draft (for planning only) | Tera must not delegate execution based on Draft content |
296
+ | Preparation agents (Checker) | Draft + Under Cross-Review | For review purposes only |
297
+ | Preparation agents (Maker of downstream docs) | Module Baseline Approved (of upstream docs only) | Must check dependency profile |
298
+ | **SoftwareDesignerAgent** | **Module Baseline Approved** or higher | Must check that the document's baseline covers the module in the task |
299
+ | Execution agents (EngineeringAgent, etc.) | System Approved or Locked | Draft or MBA content must not reach implementation without Tera approval |
300
+ | QA / Testing | System Approved or Locked | Test cases derived from approved content |
301
+
302
+ ### 8.2 SoftwareDesignerAgent Specific Rules
303
+
304
+ SoftwareDesignerAgent:
305
+ - Reads preparation documents that are at `Module Baseline Approved` or higher
306
+ - If a required document is at `Draft` or `Under Cross-Review`, it raises a **Design Gap** — it does not guess
307
+ - If a document is at `MBA` but does not cover the required module, it raises a **Module Coverage Gap**
308
+ - Documents at `System Approved` or `Locked` are treated as authoritative
309
+
310
+ ### 8.3 What "Approved" Means for Each Phase
311
+
312
+ | Phase | Minimum Document Readiness |
313
+ |---|---|
314
+ | Phase 3 (Preparation Planning) | Documents are classified; no readiness required yet |
315
+ | Phase 4 (Delegation) | At least `Draft` for the delegation batch; `Under Cross-Review` for dependent files |
316
+ | Phase 5 (Execution Planning) | At least `Module Baseline Approved` for the modules in the execution batch |
317
+ | Phase 6 (Implementation) | At least `Module Baseline Approved`; `System Approved` preferred for cross-cutting rules |
318
+ | Phase 7 (Delivery) | All required documents at `System Approved` or `Locked` |
319
+
320
+ ---
321
+
322
+ ## 9. Exceptions for Small Projects
323
+
324
+ For small projects (as classified in `TERA_PROJECT_DECISION.md`):
325
+
326
+ - The full lifecycle may be simplified: `Draft` → `System Approved` → `Locked`, skipping intermediate states
327
+ - Cross-review may be done by Tera itself rather than a separate Checker agent
328
+ - Partial baselines are not needed (single module)
329
+ - The Owner may approve a single bulk approval instead of per-decision-point approvals
330
+
331
+ The project classification determines which simplification applies. The governance model is not bypassed — it is scaled.
332
+
333
+ ---
334
+
335
+ ## 10. Anti-Bloat Gate for Documents
336
+
337
+ Before creating any preparation document, answer:
338
+
339
+ | Question | Required |
340
+ |---|---|
341
+ | What specific gap does this document fill? | Yes |
342
+ | Can this content be merged into an existing document? | Yes |
343
+ | What is the minimal usable state for this document? | Yes |
344
+ | Is the document Foundation, Consumer, Derived, Living, or Late-Bound? | Yes |
345
+ | Does this document duplicate an existing system policy? | Must not duplicate |
346
+ | Is the document needed for the current project's classification (Small/Medium/Large/ERP)? | Yes |
347
+
348
+ **Rule:** No document is created just because it exists in the catalog. A document is created only when the gap it fills is real and cannot be absorbed by an existing document.
349
+
350
+ ---
351
+
352
+ ## 11. Policy Map Entry
353
+
354
+ ```text
355
+ | Topic | Source of truth | Runtime summary allowed in | Notes |
356
+ |---|---|---|---|
357
+ | Preparation documentation governance | `tera-system/TeraPreparationDocumentationGovernance.md` | `.opencode/agents/tera.md`, `TERA_RUNTIME_CHECKLISTS.md` | Defines document taxonomy, lifecycle states, maker/checker/owner model, partial baselines, impact analysis, and consumption readiness |
358
+ ```
359
+
360
+ ## 12. Architecture Map Entry
361
+
362
+ ```text
363
+ | Layer | Responsibility | Main files/folders |
364
+ |---|---|---|
365
+ | Preparation documentation governance | Governs document lifecycle, cross-review, baselines, and consumption readiness for all application preparation documents | `TeraPreparationDocumentationGovernance.md`, active application workspace `project-preparation/` |
366
+ ```
367
+
368
+ ---
369
+
370
+ *Governance model v1.0 — 2026-07-03*