@tera-system/core 0.7.3 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MANIFEST.json +4 -4
- package/README.md +14 -13
- package/RELEASES.md +27 -0
- package/agents/auditor.md +4 -0
- package/agents/coordination-orchestrator.md +99 -0
- package/agents/qa-agent.md +6 -1
- package/agents/tera-client-engagement.md +4 -1
- package/agents/tera-system-evolution.md +4 -3
- package/agents/tera.md +130 -259
- package/commands/tera-approve.md +2 -0
- package/commands/tera-gate.md +3 -1
- package/commands/tera-orient-coordinator.md +12 -0
- package/commands/tera-plan.md +3 -1
- package/commands/tera-reconcile.md +2 -0
- package/commands/tera-request-build.md +3 -1
- package/commands/tera-resume.md +3 -1
- package/commands/tera-review.md +3 -1
- package/commands/tera-status.md +3 -1
- package/core/tera-system/AGENT_ACTIVATION_MATRIX.md +7 -2
- package/core/tera-system/AGENT_DEPENDENCY_MAP.md +5 -2
- package/core/tera-system/AGENT_PERMISSION_MODEL.md +9 -4
- package/core/tera-system/TERA_AGENT_CONDUCT.md +1 -1
- package/core/tera-system/TERA_DISTRIBUTION_POLICY.md +7 -1
- package/core/tera-system/TeraArchitectureMap.md +3 -0
- package/core/tera-system/TeraHelperAgents.md +3 -3
- package/core/tera-system/TeraPolicyMap.md +4 -2
- package/core/tera-system/TeraPreExecutionGate.md +1 -1
- package/core/tera-system/TeraScenarioStressTests.md +18 -19
- package/core/tera-system/TeraSubAgents.md +11 -6
- package/core/tera-system/client-helpers/tera-client-engagement-pricing.md +3 -4
- package/core/tera-system/runtime/TERA_COMMAND_PROTOCOL.md +16 -0
- package/core/tera-system/runtime/TERA_COORDINATION_PROTOCOL.md +192 -0
- package/core/tera-system/runtime/TERA_RUNTIME_CHECKLISTS.md +5 -2
- package/core/tera-system/runtime/TERA_RUNTIME_PROTOCOLS_CORE.md +11 -3
- package/core/tera-system/runtime/TERA_RUNTIME_TEMPLATES_DELIVERY.md +9 -3
- package/package.json +2 -2
- package/tools/tera-release.ps1 +13 -0
- package/tools/tera-update.ps1 +37 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Tera Coordination Protocol — فريق التنفيذ المعزول
|
|
2
|
+
|
|
3
|
+
<!-- © 2026 Majed Khaireddin (Alabasi1980). Tera System — Proprietary. All rights reserved. -->
|
|
4
|
+
|
|
5
|
+
> Source: SCP-2026-10-31-001 R3, approved by Majed on 2026-11-06. Implementation stage S1; OpenCode loading/readiness and Pilot remain unverified. No API, daemon, scheduler, new MCP or automatic session control.
|
|
6
|
+
|
|
7
|
+
## 1. Activation and Authority — Team Mode Contract
|
|
8
|
+
|
|
9
|
+
This is the **single source of the conditional team workflow**. Without a known ACTIVE run, standalone Tera retains its existing planning, delegation, records and closure rules. If a run is declared ACTIVE but its board/approval/paths cannot be verified, **BLOCK**; never fall back to standalone to escape controls.
|
|
10
|
+
|
|
11
|
+
Activation requires Majed's recorded Team Mode decision, `ACCEPTED_FOR_ENGINEERING`, approved plans/tasks, Build authorization as required, and a signed-off workspace/resource contract. Folder presence alone is not activation. Never bypass `TeraPreExecutionGate.md`, owner approval, Security/UI/Operational gates, reviewer neutrality or Delivery Stop Rule.
|
|
12
|
+
|
|
13
|
+
Authority: Majed -> coordinator -> manually started Tera workers -> their specialists. Coordination only reallocates planning/sequencing and record-writing; it does not change instruction priority or product scope. The owner starts/stops sessions and notifies the coordinator. Freeze takes effect at a checkpoint; it is not remote process termination.
|
|
14
|
+
|
|
15
|
+
## 2. Resolve Identity and Paths Before Any Action
|
|
16
|
+
|
|
17
|
+
Required for each run/assignment (absolute paths, no assumed main/master):
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
RunID / TeamMode / TeamApprovalRef / BuildApprovalRef / GitWorkflowApprovalRef
|
|
21
|
+
HostRepoPath / CanonicalWorktreePath / CanonicalAppPath / CoordinationRoot
|
|
22
|
+
IntegrationBranch / StableSHA
|
|
23
|
+
WorkerID / SessionLabel / PackageID / AssignmentID / AssignmentRevision
|
|
24
|
+
WorktreePath / WorktreeAppPath / Branch / BaseSHA / assigned TASK-IDs
|
|
25
|
+
AllowedSources / AllowedWriteTargets / RuntimeResources
|
|
26
|
+
CandidateID / CandidateBaseSHA / CandidateBranch / CandidateWorktreePath / CandidateSHA
|
|
27
|
+
RepairWorktreePath / RepairBranch / RepairSubmittedSHA (when needed)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- `CoordinationRoot = <CanonicalAppPath>/project-control/coordination/`, shared by explicit absolute path, not replicated worker copies.
|
|
31
|
+
- In worker/subagent tasks, `ClientAppPath` and code/test CWD are **WorktreeAppPath**. Central plans/state/registry are read from CanonicalAppPath. Local `SYSTEM_ACTIVE_CONTEXT` and tools must agree with the run; stale inherited paths are a blocker, not permission to write centrally.
|
|
32
|
+
- Confirm repository root, current branch, BaseSHA/declared branch head, assignment revision and current work before starting/resuming/submitting. A continued worker may be ahead of BaseSHA by its own recorded task commits; unknown ancestry or changes require reconciliation. Branch per package, never a permanent branch per session.
|
|
33
|
+
- Create worker/candidate/repair worktrees outside one another, from a pinned base, only under the recorded Git Workflow approval. Separate HEAD/index are not a sandbox: refs/config/hooks and external services may still be shared.
|
|
34
|
+
- Inspect installed agent definitions, tool CWD, allowed external paths, MCP targets and test dependencies per workspace. Never assume ignored files/node_modules/configs copy themselves or grant `external_directory: allow *`.
|
|
35
|
+
- Do not copy secrets/production data. Resolve DB/schema, SQLite paths, Redis namespaces, ports, uploads, browser/test artifacts and accounts. A shared writable resource that cannot be isolated is serialized or BLOCKED. No concurrent migrations against one database.
|
|
36
|
+
|
|
37
|
+
## 3. Ownership — One Writer Per Artifact
|
|
38
|
+
|
|
39
|
+
| Artifact | Writer | Others |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| Central master/detailed/batch plans, TASK_REGISTRY, PROJECT_STATE, activity/audit/decision/issue records, TERA_ACTIVE_CONTEXT | Coordinator, only in ACTIVE Team Mode | Workers read canonical paths; their checked-out copies are historical |
|
|
42
|
+
| `coordination/BOARD.md` and `windows/<WorkerID>/<AssignmentID>.md` | Coordinator | Workers read; assignment scope/revision is immutable once dispatched |
|
|
43
|
+
| Matching `<AssignmentID>.report.md` | Assigned Tera only | Coordinator reads; never edits a worker's report or acceptance |
|
|
44
|
+
| Local assigned TASK files and task-specific artifacts | Tera in its worker branch; reviewers write only their named report targets | No edits to another task, central/global records or other workspaces |
|
|
45
|
+
| Canonical TASK after integration | Coordinator, transcribing Tera's decision/receipt | Worker copy frozen; no later overwrite from it |
|
|
46
|
+
| Closure-metadata artifacts: canonical `project-knowledge/*.md` after acceptance (named in the assignment) | Tera content (via ProjectKnowledgeAgent) then Coordinator commits/records in the canonical workspace | Not the frozen delivery branch; no unrelated central edits by the worker |
|
|
47
|
+
| `project-control/coordination/**` commits inside the canonical workspace | Coordinator | Workers never commit canonical coordination state |
|
|
48
|
+
|
|
49
|
+
Assign unique TASK/Package/Attempt IDs centrally. A revised objective needs a new immutable revision and matching report, after confirming the former writer stopped. RunID/worker/revision mismatch or duplicate active ownership blocks work. No automatic lease expiry/reassignment merely because a session is quiet.
|
|
50
|
+
|
|
51
|
+
Reuse plans/DECISIONS_LOG/project-knowledge rather than create SCHEDULE/DECISIONS/APP_SNAPSHOT duplicates. BOARD is an operational index, not a second specification or acceptance register. No authority to edit system files or product baselines.
|
|
52
|
+
|
|
53
|
+
## 4. Scheduling and Worker Cycle
|
|
54
|
+
|
|
55
|
+
The coordinator reads plans, current canonical state, new complete reports, knowledge and relevant application code/contracts for the next decision. Read on change and demand, not the entire repository every cycle. No arbitrary file/line budget that makes leadership blind.
|
|
56
|
+
|
|
57
|
+
Before parallel assignment check semantic dependencies, data/API meaning, shared components/permissions/schema/lockfiles, writable resources, and write sets. Different filenames alone do not prove independence. Serialize common foundations and unresolved contract changes. Idle workers are allowed.
|
|
58
|
+
|
|
59
|
+
Start with two workers; up to two bounded TASKs per package. Four is an expansion target requiring owner decision and Pilot evidence, not a guaranteed capacity. A package is not one oversized TASK.
|
|
60
|
+
|
|
61
|
+
Tera worker must:
|
|
62
|
+
1. Resolve §2, verify current assignment, task/batch/Build approvals and Pre-Execution gates. No work without assignment in ACTIVE Team Mode; do not invent the next task.
|
|
63
|
+
2. Write Start in its own report, then dispatch specialists using exact worker paths. Preserve each specialist's profile, Allowed Write Targets and STOP/ASK.
|
|
64
|
+
3. Complete each TASK's local Handback, actual Post-Execution Review and applicable QA/Auditor/Security/UI checks. Commit only its approved files with TASK-ID. Do not stage unrelated work, amend/force/clean or push without approval.
|
|
65
|
+
4. Record `LocalTechnicalResult: PASS/FAIL/BLOCKED` separately from `FinalClosureCompliance: PENDING`. Pending central records or owner acceptance are not N/A and not COMPLIANT.
|
|
66
|
+
5. An explicitly handled local-ready TASK permits the next approved TASK **inside the package** only if its dependencies are satisfied locally and approvals permit it. A dependency requiring central integration must wait. Central TASK status remains Submitted until final acceptance.
|
|
67
|
+
6. Submit pinned BaseSHA/SubmittedSHA and complete report; freeze the submitted branch. No subsequent commit there without a rework/revision assignment. No empty commit for read-only work; record `NO_CODE_CHANGES` and SubjectSHA when appropriate.
|
|
68
|
+
|
|
69
|
+
## 5. Evidence and Handoff
|
|
70
|
+
|
|
71
|
+
Report target <=80 lines plus links to details. Record task/revision/workspace, changed paths, approvals, classifications, results, evidence paths and subject SHAs. Mark `ReportComplete: Yes` **last**; partial/mismatched reports are not ready. QA, Auditor and Security decisions are not interchangeable.
|
|
72
|
+
|
|
73
|
+
No duplicate audit: the coordinator validates evidence identity, scope, actual decision, required conditions and tested version; existence of a file or PASS alone is insufficient. `NOT_REQUIRED` requires reason/rule; a waiver requires Majed's reference. A missing/stale report gets a targeted correction, not an automatic full audit.
|
|
74
|
+
|
|
75
|
+
Reviewers independently discover committed scope using pinned BaseSHA..SubmittedSHA (or TASK-specific range) and current worktree status; no `HEAD~1` assumption for a multi-commit package. Handback is context, not evidence. Do not supply predicted result/diff counts.
|
|
76
|
+
|
|
77
|
+
Evidence uses `EvidenceSubjectSHA` for tested code and `SubmittedSHA` for delivery; no self-referential commit requirement. Later report-only commits can preserve a subject only with a recorded content/meaning check excluding code, tests, configuration, dependencies, migrations and acceptance-contract changes. A project-control path alone is not proof of harmless metadata.
|
|
78
|
+
|
|
79
|
+
## 6. Candidate Isolation and Exact Promotion
|
|
80
|
+
|
|
81
|
+
### 6.1 Prepare
|
|
82
|
+
1. `StableSHA` is an evidenced approved head, not an arbitrary current HEAD. Finalize pending central control updates before starting an attempt when feasible; use a short coordinated promotion window to avoid endless record-driven retries.
|
|
83
|
+
2. Pin CandidateID, `CandidateBaseSHA=StableSHA`, SubmittedSHA, workspace/branch and resource identities. Verify approved branch HEAD is that base; do not relabel a running candidate after any advancement.
|
|
84
|
+
3. Create a clean candidate branch/worktree from the pinned base, with isolated test resources. Merge the exact SubmittedSHA **only there**. The approved branch/leadership workspace never hosts experimental merge conflicts.
|
|
85
|
+
|
|
86
|
+
### 6.2 Test and preserve evidence
|
|
87
|
+
1. Pin CandidateSHA, test that version. QA runs integration checks selected by impact (build/typecheck, affected tests and shared E2E/API/DB paths as needed); no production migrations/resources. Auditor only for a new quality effect or an unresolved evidence risk, not duplicate review by default.
|
|
88
|
+
2. Reports get unique AttemptID paths, with candidate CWD/SHA and explicit report-write targets. Reviewer writes must not silently move the tested subject. Preserve outputs, then finalize report-only commits with §5 proof, record the subject mapping and final candidate head, and verify a clean candidate before promotion. If runnable content changed, retest affected gates and repin the tested candidate.
|
|
89
|
+
3. All required gates must be evidenced; missing environment/evidence is BLOCKED/PARTIAL under existing rules, never an invented PASS. Local success does not substitute for composed-system checks.
|
|
90
|
+
|
|
91
|
+
### 6.3 Promote
|
|
92
|
+
Require: approved operation scope, both workspaces clean, no unresolved merge, final candidate/subject mapping valid, and **current approved HEAD equals CandidateBaseSHA**. Promote the recorded final candidate by fast-forward-only, no extra untested merge commit or force. Verify resulting HEAD, record IntegrationSHA, evidence subject and StableSHA, then notify Tera in its assignment file.
|
|
93
|
+
|
|
94
|
+
If central metadata commits advanced the approved branch, inherit evidence only after an explicit diff/meaning proof and retain original subject; record StableSHA advancement. The old candidate base is still stale: create a new attempt against the new approved base with the frozen submission and repeat affected checks. An unexplained advance blocks promotion. Never merge over a changed base just because previous tests were green.
|
|
95
|
+
|
|
96
|
+
### 6.4 Fail or repair
|
|
97
|
+
- Failed tests after a clean merge: preserve failed CandidateID/branch/worktree and evidence; **do not advance IntegrationBranch/StableSHA because of it**. A new independent B candidate starts from the approved stable head, never failed A. Dependencies of A remain blocked.
|
|
98
|
+
- Merge conflict: preserve it in the candidate; coordinator never writes conflict resolution or chooses ours/theirs. Issue a repair assignment with RepairWorktreePath/RepairBranch, exact stable/submitted SHAs to reproduce, specialist, write targets and updated verification requirements.
|
|
99
|
+
- Tera's specialist repairs in that separate space, not the canonical workspace or frozen submission. Return RepairSubmittedSHA with new evidence; form a new candidate on current stable. Contract/business ambiguity goes to the approved baseline/مُهندس/Majed.
|
|
100
|
+
- Stop only affected dependencies; unrelated authorized work may continue. Preserve work and stop attempt-specific services safely; no force removal of a dirty worktree, reset/clean or lock deletion. Do not treat Git as rollback for databases.
|
|
101
|
+
|
|
102
|
+
## 7. Final Acceptance, Knowledge and Central Closure
|
|
103
|
+
|
|
104
|
+
States: `QUEUED -> ASSIGNED -> CLAIMED -> LOCAL_READY -> CANDIDATE_TESTING -> INTEGRATED_VERIFIED -> CLOSED`; exceptions `BLOCKED / REWORK_REQUIRED / CANCELLED`.
|
|
105
|
+
|
|
106
|
+
Local readiness leaves central TASK `Submitted` (not Accepted/Closed); no request for Closed before candidate testing. INTEGRATED_VERIFIED requires actual promotion, not merely a green isolated candidate. It is not owner acceptance.
|
|
107
|
+
|
|
108
|
+
After the coordinator writes integration notice, Tera reads the exact IntegrationSHA/evidence and records its decision in its **own report**, with `ClosureComplete: Yes` last. Verify IntegrationSHA still represents the task's current integrated result; later code-bearing changes invalidating it require renewed affected evidence/receipt. A stale receipt or an owner-approval Pending cannot close the task.
|
|
109
|
+
|
|
110
|
+
Tera retains its existing post-acceptance knowledge obligation. When needed, coordinator issues a narrowly scoped closure-metadata assignment: Tera invokes ProjectKnowledgeAgent with the accepted subject and exact named canonical `project-knowledge/*.md` targets, with external-path authorization if needed and no concurrent promotion. This is the existing knowledge writer, not worker permission to alter canonical code or global records. Keep the frozen delivery branch untouched; missing knowledge remains an explicit closure blocker, never a fabricated N/A.
|
|
111
|
+
|
|
112
|
+
Coordinator records **Tera's** decision (decision-maker, recorder, receipt reference, revision, subject/IntegrationSHA and owner approvals) in the canonical TASK itself and all applicable registry/state/activity/audit/decision/issue records. Read them back as one reconciled closure transaction; BOARD becomes CLOSED last. No Closed with split state. Reprocessing the same complete receipt must not duplicate audit events or overwrite a later task revision. Missing updates remain visibly PENDING; coordinator cannot invent acceptance.
|
|
113
|
+
|
|
114
|
+
**Closure-metadata commit ownership:** the coordinator — not the worker — commits/records canonical closure metadata (TASK/registry/state/activity/audit/decision/issue and any named `project-knowledge` writes) in the canonical workspace, attribute content to its author, and re-verify workspace cleanliness before any further promotion. If a promotion is pending, this work is serialized as a short coordinated window; it never happens concurrently with a test whose subject SHA is still being validated.
|
|
115
|
+
|
|
116
|
+
### 7.1 Paused, cancelled or deactivated
|
|
117
|
+
Do not reassign a possibly live worker on timeout; owner/worker confirms tools and subagents stopped. Preserve unfinished files and SHAs. Deactivation requires canonical reconciliation, owner decision and recorded transfer to one Tera; deleting/inactivating a board is not an escape from unfinished work. Standalone ownership returns only after that transfer. No client Pilot or release is authorized by a system-document edit.
|
|
118
|
+
|
|
119
|
+
## 8. Minimal Templates
|
|
120
|
+
|
|
121
|
+
Populate these per application after approval; the runtime file itself holds no client state. All timestamps ISO-8601 with timezone.
|
|
122
|
+
|
|
123
|
+
### 8.1 BOARD.md — coordinator writer
|
|
124
|
+
```text
|
|
125
|
+
TeamMode: INACTIVE | ACTIVE | PAUSED
|
|
126
|
+
RunID:
|
|
127
|
+
OwnerApprovalRef / BuildApprovalRef / GitWorkflowApprovalRef:
|
|
128
|
+
CanonicalWorktreePath / CanonicalAppPath / CoordinationRoot / HostRepoPath:
|
|
129
|
+
IntegrationBranch / StableSHA / evidence reference:
|
|
130
|
+
StartWorkers: 2; ExpansionLimit: 4 only after owner approval + Pilot
|
|
131
|
+
PackageTaskLimit: 2
|
|
132
|
+
WorkerID | SessionLabel | Assignment/Revision | Worktree/Branch | TASKs | State | Dependencies/Resources | ReportPath | UpdatedAt
|
|
133
|
+
CandidateID | BaseSHA | SubmittedSHA | Branch/Path | CandidateSHA/SubjectSHA | Result | Promotion/IntegrationSHA | Evidence
|
|
134
|
+
ClosurePending / ReconciliationStatus / ManualNotificationsNeeded:
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### 8.2 A-001.md — coordinator writer
|
|
138
|
+
```text
|
|
139
|
+
RunID / AssignmentID / Revision / WorkerID / PackageID / TASK-IDs:
|
|
140
|
+
Objective / approved contract/task paths / acceptance criteria and evidence TYPES:
|
|
141
|
+
Scope/Build/owner approvals / Pre-Execution gate references:
|
|
142
|
+
HostRepoPath / CanonicalAppPath / CoordinationRoot:
|
|
143
|
+
WorktreePath / ClientAppPath / Branch / BaseSHA:
|
|
144
|
+
AllowedSources / AllowedWriteTargets (absolute) / ForbiddenActions:
|
|
145
|
+
Dependencies / RuntimeResources / review classifications:
|
|
146
|
+
ReportTarget: <same-folder>/A-001.report.md
|
|
147
|
+
IssuedAt:
|
|
148
|
+
## Integration notice (append; exact assignment revision)
|
|
149
|
+
CandidateID / CandidateBaseSHA / CandidateSHA / EvidenceSubjectSHA / IntegrationSHA:
|
|
150
|
+
Gate artifacts / approval state / permitted closure-metadata targets:
|
|
151
|
+
Requested next action / UpdatedAt:
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 8.3 A-001.report.md — assigned Tera writer
|
|
155
|
+
```text
|
|
156
|
+
RunID / AssignmentID / Revision / WorkerID / PackageID / TASK-IDs:
|
|
157
|
+
StartedAt / confirmed worktree+branch+base / Status:
|
|
158
|
+
## Delivery
|
|
159
|
+
SubmittedSHA / EvidenceSubjectSHA / changed paths / scope exceptions:
|
|
160
|
+
LocalTechnicalResult / FinalClosureCompliance: PENDING
|
|
161
|
+
Pre/Post gates / QA/Auditor/Security/UI classifications+results+artifact subjects:
|
|
162
|
+
Owner approvals / resources+migrations / unresolved items:
|
|
163
|
+
ReportedAt:
|
|
164
|
+
ReportComplete: Yes # LAST delivery field; not present while incomplete
|
|
165
|
+
## Closure Receipt (append only after integration notice)
|
|
166
|
+
ReceiptID / RunID / AssignmentRevision / TASK-IDs / Tera identity:
|
|
167
|
+
CandidateID / IntegrationSHA / evidence references / owner approvals:
|
|
168
|
+
Decision: ACCEPT | NEEDS_FIX | BLOCKED | READY_FOR_OWNER_ACCEPTANCE
|
|
169
|
+
Knowledge result or justified Not Applicable / permitted target references:
|
|
170
|
+
AcceptedAt / UnverifiedItems:
|
|
171
|
+
ClosureComplete: Yes # LAST receipt field
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 8.4 Repair/attempt record — in existing assignment and BOARD
|
|
175
|
+
```text
|
|
176
|
+
AttemptID / reason / affected dependencies:
|
|
177
|
+
CandidateBaseSHA / SubmittedSHA / CandidateBranch+Path / CandidateSHA:
|
|
178
|
+
Result / evidence+SubjectSHA / failed attempt preserved:
|
|
179
|
+
RepairWorktreePath / RepairBranch / exact reproduction pair / write targets:
|
|
180
|
+
RepairSubmittedSHA / updated gates / next candidate reference:
|
|
181
|
+
Promotion conditions / approved HEAD check / resulting IntegrationSHA:
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## 9. Readiness and Pilot Gate
|
|
185
|
+
|
|
186
|
+
S1 registration/text validation is not proof of session/tool isolation. Restart OpenCode and verify primary selection, orientation, all per-worktree subagent/MCP paths and permissions. Majed selects/authorizes a non-production Pilot repository; start coordinator + two workers. No global config edits, API automation, tag, publish, or production access by implication.
|
|
187
|
+
|
|
188
|
+
> **S1a amendment (SCP-2026-10-31-001):** يجوز `commit + push` لتعريفات S1 في مستودع المصدر بعد مراجعة مستقلة، لتفادي فقدان العمل (GAP-026) وضمان رجوع نظيف. **لا** يعني ذلك إنشاء tag/bundle/publish أو Pilot على عميل حقيقي أو تفعيل Team Mode؛ تبقى هذه حتى S4.
|
|
189
|
+
|
|
190
|
+
Pilot cases: independent packages; distinct files with shared writable DB/API/resource; conflict repaired outside leadership; merge-success/test-failure A followed by independent B; canonical-head advance during candidate test; stale subject/revision; incomplete reports and replayed receipts; paused/live worker; owner approval pending; canonical TASK/registry consistency; standalone regression/deactivation.
|
|
191
|
+
|
|
192
|
+
Report two independent verdicts: **safety/correctness**, then **owner-effort/productivity**. Count start/report/integration/closure notifications, blocked time and rework; compare comparable baseline when available. No claimed speedup/cost saving without measurement. Safety success alone does not approve expansion/release. System rollout/Pilot/publication decisions stay with Majed; use `SYSTEM_EVOLUTION_LOG.md`, not a client TASK_REGISTRY, for system changes.
|
|
@@ -64,7 +64,8 @@ When the user provides a project idea and technical information:
|
|
|
64
64
|
- Accept, reject, or request rework.
|
|
65
65
|
13. **This is not application implementation.**
|
|
66
66
|
|
|
67
|
-
### Phase 5: Execution Planning
|
|
67
|
+
### Phase 5: Execution Planning
|
|
68
|
+
> **Team Mode:** إن فعّله Majed، خطط وسجلات القيادة يكتبها المنسّق، لا كل نافذة Tera. تحقّق من Intake والموافقات وعقد المساحات/الموارد وفق `TERA_COORDINATION_PROTOCOL.md`؛ وجود المجلد ليس تفعيلاً، وخارج هذا الوضع لا تغيير للملكية الفردية.
|
|
68
69
|
1. Run **Execution Readiness Check**:
|
|
69
70
|
- [ ] All required preparation files complete and approved.
|
|
70
71
|
- [ ] `AGENT_DELEGATION_PLAN.md` approved.
|
|
@@ -97,7 +98,9 @@ When the user provides a project idea and technical information:
|
|
|
97
98
|
8. Wait for user approval before moving to Phase 6.
|
|
98
99
|
9. **No coding. No UI without Design Source Decision. No TASK-ID without Pre-Execution Gate PASS.**
|
|
99
100
|
|
|
100
|
-
### Phase 6: Implementation
|
|
101
|
+
### Phase 6: Implementation
|
|
102
|
+
|
|
103
|
+
> **Team Mode — conditional checklist:** حلّ RunID/AssignmentRevision/worktree أولاً، واعمل على TASKs الإسناد فقط. `LOCAL_READY` يعني Submitted مركزياً مع FinalClosureCompliance معلّق؛ لا تعديل لسجلات القيادة من العامل. بعد فحص المرشّح وترقيته، Tera يصدر Closure Receipt والمنسّق يحدّث TASK المركزي والسجلات ويصالحها وفق `TERA_COORDINATION_PROTOCOL.md` §§4–7. هذه القاعدة تضبط تنفيذ الخطوات 1/8/9/10 أدناه للفريق فقط؛ لا تلغي موافقة Build أو أي بوابة.
|
|
101
104
|
|
|
102
105
|
0. **Request Build Mode:** Ask the user explicitly: "Do you approve entering Build Mode for TASK-COD-XXX?" before any implementation delegation. Remain in Plan Mode until approved.
|
|
103
106
|
1. Select one approved `TASK-COD-XXX` from the approved `EXECUTION_BATCH_PLAN.md`.
|
|
@@ -204,9 +204,17 @@ Tera uses a two-tier write location system. The root-level `project-preparation/
|
|
|
204
204
|
|
|
205
205
|
---
|
|
206
206
|
|
|
207
|
-
## 4. Execution Orchestration Protocol
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
## 4. Execution Orchestration Protocol
|
|
208
|
+
|
|
209
|
+
### Conditional Team Mode (SCP-2026-10-31-001 R3)
|
|
210
|
+
|
|
211
|
+
عند تشغيل فريق بموافقة موثقة، مصدر القواعد الشرطية هو `TERA_COORDINATION_PROTOCOL.md`: المنسّق يملك الخطط والسجلات العامة، وTera يملك TASKs حزمته وقراره الهندسي. أي تعليمات عامة أدناه لا تعيد للعامل صلاحية كتابة سجلات القيادة أو اختيار مهمته. خارج Team Mode يبقى المسار الفردي كما هو.
|
|
212
|
+
|
|
213
|
+
في الفريق: المسارات تُحل قبل التفويض، والنتيجة المحلية `LOCAL_READY` تترك TASK مركزياً Submitted. Post-Review وCompliance الفني المحليان لا يثبتان FinalClosureCompliance؛ البنود المركزية/اعتماد المالك المعلقة ليست N/A. بعد مرشّح معزول وترقية صحيحة وClosure Receipt من Tera ينفذ المنسّق معاملة الإغلاق على **TASK المركزي وجميع السجلات المعنية** ويعيد قراءتها. لا تجاوز لبوابة `TeraPreExecutionGate.md` §6.2 أو Owner Approval؛ أي نقص يبقى PENDING ولا يُعلَن COMPLIANT/Closed.
|
|
214
|
+
|
|
215
|
+
إذا تعذر إتمام بند معرفة تشغيلية بعد القبول، استخدم تكليف closure-metadata المحدود في بروتوكول التنسيق §7؛ لا تغيّر فرع التسليم المجمد. تقسيم ملكية الكتابة لا يُسقط الالتزام الحالي بالمعرفة أو paired records أو staleness sweep.
|
|
216
|
+
|
|
217
|
+
Task lifecycle:
|
|
210
218
|
|
|
211
219
|
```text
|
|
212
220
|
Draft -> Approved -> Assigned -> In Progress -> Submitted -> Needs Fix / Blocked / Deferred / Cancelled -> [READY FOR OWNER ACCEPTANCE] -> Accepted -> Closed
|
|
@@ -196,7 +196,9 @@ The generated file is saved to `project-control/EXECUTION_BATCH_PLAN.md`.
|
|
|
196
196
|
|
|
197
197
|
## 32. Post-Execution Review (Phase 6 Review Template)
|
|
198
198
|
|
|
199
|
-
This template is used inside `project-control/tasks/TASK-COD-XXX.md` after an agent handback and before any task acceptance or closure.
|
|
199
|
+
This template is used inside `project-control/tasks/TASK-COD-XXX.md` after an agent handback and before any task acceptance or closure.
|
|
200
|
+
|
|
201
|
+
> **Team Mode:** اربط المراجعة بـRunID/AssignmentRevision/worktree وEvidenceSubjectSHA/SubmittedSHA. النجاح الفني المحلي يترك TASK مركزياً Submitted؛ الاختبار على CandidateSHA والترقية ثم Closure Receipt يحكمان القبول النهائي وفق `TERA_COORDINATION_PROTOCOL.md`. البنود المركزية المعلقة تظل PENDING لا N/A ولا قبولاً محلياً نهائياً.
|
|
200
202
|
|
|
201
203
|
```markdown
|
|
202
204
|
## Post-Execution Review
|
|
@@ -244,7 +246,9 @@ Required Record Updates:
|
|
|
244
246
|
## 33. Compliance Record (Task Closure Governance Summary)
|
|
245
247
|
|
|
246
248
|
هذا القسم يُضاف إلى `project-control/tasks/TASK-COD-XXX.md` كآخر قسم قبل الإغلاق (بعد `Post-Execution Review`).
|
|
247
|
-
وهو المرجع المعتمد لـ Monitor للتحقق من مطابقة Handback + Git diff + القواعد.
|
|
249
|
+
وهو المرجع المعتمد لـ Monitor للتحقق من مطابقة Handback + Git diff + القواعد.
|
|
250
|
+
|
|
251
|
+
> **Team Mode:** افصل `LocalTechnicalResult` عن `FinalClosureCompliance: PENDING`؛ الحقول المركزية/الموافقة غير المنجزة لا تُعلّم PASS أو N/A. بعد التكامل يثبت المنسّق نتيجة الإغلاق في TASK المركزي والسجلات، نقلاً لقرار Tera ومع مراعاة المعرفة المطلوبة، وفق `TERA_COORDINATION_PROTOCOL.md` §7. القالب الفردي أدناه لا يمنح العامل صلاحية تلك الكتابة.
|
|
248
252
|
|
|
249
253
|
```markdown
|
|
250
254
|
## Compliance Record
|
|
@@ -594,7 +598,9 @@ clients/CLIENT-[client-name-or-id]/applications/APP-[app-name-or-id]/delivery/CL
|
|
|
594
598
|
|
|
595
599
|
## 39. TERA Audit Trail Entry Template (moved from tera.md §26 — SCP-2026-09-16-004)
|
|
596
600
|
|
|
597
|
-
Operational core stays in `tera.md` §26 (file, sole owner, when in brief, minimum fields, closure gate). This section holds the full record-once reference: event list + entry structure + evidence guidance.
|
|
601
|
+
Operational core stays in `tera.md` §26 (file, sole owner, when in brief, minimum fields, closure gate). This section holds the full record-once reference: event list + entry structure + evidence guidance.
|
|
602
|
+
|
|
603
|
+
في ACTIVE Team Mode كاتب السجل المركزي المنسّق فقط؛ Actor/DecisionMaker يبقى صاحب الحدث الفعلي. اذكر RunID/Task/AssignmentRevision/ReceiptID وIntegrationSHA حيث تنطبق؛ لا تمنح النقلَ سلطةَ القبول. خارج الفريق تبقى ملكية Tera المنفردة. المرجع: `TERA_COORDINATION_PROTOCOL.md` §3/§7.
|
|
598
604
|
|
|
599
605
|
### 39.1 When to Record (substantive events only)
|
|
600
606
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tera-system/core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Tera System OpenCode Plugin — governance core,
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Tera System OpenCode Plugin — governance core, 28 agents, 41 commands, distribution tools (personal edition)",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
package/tools/tera-release.ps1
CHANGED
|
@@ -48,6 +48,14 @@ $tempRoot = Join-Path ([System.IO.Path]::GetTempPath()) ("tera-release-" + [guid
|
|
|
48
48
|
$archivePath = Join-Path $tempRoot 'tag.zip'
|
|
49
49
|
$snapshotRoot = Join-Path $tempRoot 'snapshot'
|
|
50
50
|
$managedRoots = @('.opencode', 'tera-system', 'tera-workshop')
|
|
51
|
+
# User/environment files, not Tera-managed content. Shipping them would let an
|
|
52
|
+
# update overwrite a customer's own config; they are excluded from the package.
|
|
53
|
+
$excludedReleasePaths = @(
|
|
54
|
+
'.opencode/opencode.json',
|
|
55
|
+
'.opencode/opencode.tera.example.json',
|
|
56
|
+
'.opencode/tera-core.manifest.json',
|
|
57
|
+
'.opencode/tera.manifest.json'
|
|
58
|
+
)
|
|
51
59
|
$files = New-Object System.Collections.Generic.List[string]
|
|
52
60
|
|
|
53
61
|
try {
|
|
@@ -63,6 +71,11 @@ try {
|
|
|
63
71
|
if (-not (Test-Path -LiteralPath $sourceRoot -PathType Container)) { continue }
|
|
64
72
|
foreach ($file in Get-ChildItem -LiteralPath $sourceRoot -File -Recurse) {
|
|
65
73
|
$relative = ($file.FullName.Substring($snapshotRoot.Length + 1) -replace '\\', '/')
|
|
74
|
+
$isExcluded = $false
|
|
75
|
+
foreach ($excluded in $excludedReleasePaths) {
|
|
76
|
+
if ($relative.Equals($excluded, [System.StringComparison]::OrdinalIgnoreCase)) { $isExcluded = $true; break }
|
|
77
|
+
}
|
|
78
|
+
if ($isExcluded) { continue }
|
|
66
79
|
$target = Join-Path $OutputPath $relative
|
|
67
80
|
$targetDir = Split-Path -Parent $target
|
|
68
81
|
if (-not (Test-Path -LiteralPath $targetDir)) { New-Item -ItemType Directory -Path $targetDir -Force | Out-Null }
|
package/tools/tera-update.ps1
CHANGED
|
@@ -29,6 +29,15 @@ param(
|
|
|
29
29
|
Set-StrictMode -Version 5
|
|
30
30
|
$ErrorActionPreference = 'Stop'
|
|
31
31
|
|
|
32
|
+
# Files under .opencode/ that belong to the USER, never to Tera content.
|
|
33
|
+
# They may appear in older release packages; they must be skipped, not written.
|
|
34
|
+
$script:ProtectedUserPaths = @(
|
|
35
|
+
'.opencode/opencode.json',
|
|
36
|
+
'.opencode/opencode.tera.example.json',
|
|
37
|
+
'.opencode/tera-core.manifest.json',
|
|
38
|
+
'.opencode/tera.manifest.json'
|
|
39
|
+
)
|
|
40
|
+
|
|
32
41
|
function Fail([string]$Message) {
|
|
33
42
|
throw $Message
|
|
34
43
|
}
|
|
@@ -123,6 +132,13 @@ function Assert-ManagedRelativePath([string]$Path) {
|
|
|
123
132
|
return $normalized
|
|
124
133
|
}
|
|
125
134
|
|
|
135
|
+
function Test-ProtectedUserPath([string]$NormalizedPath) {
|
|
136
|
+
foreach ($p in $script:ProtectedUserPaths) {
|
|
137
|
+
if ($NormalizedPath.Equals($p, [System.StringComparison]::OrdinalIgnoreCase)) { return $true }
|
|
138
|
+
}
|
|
139
|
+
return $false
|
|
140
|
+
}
|
|
141
|
+
|
|
126
142
|
function Read-RequiredLock([string]$Path) {
|
|
127
143
|
if (-not (Test-Path -LiteralPath $Path)) {
|
|
128
144
|
return $null
|
|
@@ -256,6 +272,10 @@ $packageFiles = New-Object System.Collections.Generic.List[string]
|
|
|
256
272
|
foreach ($entry in @($manifestFiles)) {
|
|
257
273
|
if ($entry -isnot [string]) { Fail 'Manifest files must contain strings only.' }
|
|
258
274
|
$relative = Assert-ManagedRelativePath $entry
|
|
275
|
+
if (Test-ProtectedUserPath $relative) {
|
|
276
|
+
Write-Host " [skip] protected user file: $relative"
|
|
277
|
+
continue
|
|
278
|
+
}
|
|
259
279
|
if ($packageFiles -contains $relative) { Fail "Manifest contains duplicate file: $relative" }
|
|
260
280
|
$packageFiles.Add($relative)
|
|
261
281
|
if (-not $hashes.ContainsKey($relative)) { Fail "SHA256SUMS has no hash for: $relative" }
|
|
@@ -277,6 +297,11 @@ foreach ($relative in $packageFiles) { $managedSet[$relative] = $true }
|
|
|
277
297
|
$oldFiles = @()
|
|
278
298
|
if ($currentLock) {
|
|
279
299
|
foreach ($entry in @($currentLock.files)) {
|
|
300
|
+
$lockRelative = Normalize-RelativePath ([string]$entry)
|
|
301
|
+
if (Test-ProtectedUserPath $lockRelative) {
|
|
302
|
+
Write-Host " [skip] protected user file: $lockRelative"
|
|
303
|
+
continue
|
|
304
|
+
}
|
|
280
305
|
$oldFiles += Assert-ManagedRelativePath ([string]$entry)
|
|
281
306
|
$managedSet[$oldFiles[-1]] = $true
|
|
282
307
|
}
|
|
@@ -318,6 +343,10 @@ $newFiles = @()
|
|
|
318
343
|
$changedFiles = @()
|
|
319
344
|
$sameFiles = @()
|
|
320
345
|
foreach ($relative in $packageFiles) {
|
|
346
|
+
if (Test-ProtectedUserPath $relative) {
|
|
347
|
+
Write-Host " [skip] protected user file: $relative"
|
|
348
|
+
continue
|
|
349
|
+
}
|
|
321
350
|
$sourceFile = Join-Path $SourcePath $relative
|
|
322
351
|
$targetFile = Join-Path $RepoPath $relative
|
|
323
352
|
if (-not (Test-Path -LiteralPath $targetFile -PathType Leaf)) {
|
|
@@ -369,11 +398,19 @@ try {
|
|
|
369
398
|
}
|
|
370
399
|
|
|
371
400
|
foreach ($relative in $deletedFiles) {
|
|
401
|
+
if (Test-ProtectedUserPath $relative) {
|
|
402
|
+
Write-Host " [skip] protected user file: $relative"
|
|
403
|
+
continue
|
|
404
|
+
}
|
|
372
405
|
Assert-NoReparsePointInPath $RepoPath $relative
|
|
373
406
|
Remove-Item -LiteralPath (Join-Path $RepoPath $relative) -Force
|
|
374
407
|
$touched.Add($relative)
|
|
375
408
|
}
|
|
376
409
|
foreach ($relative in $packageFiles) {
|
|
410
|
+
if (Test-ProtectedUserPath $relative) {
|
|
411
|
+
Write-Host " [skip] protected user file: $relative"
|
|
412
|
+
continue
|
|
413
|
+
}
|
|
377
414
|
Assert-NoReparsePointInPath $RepoPath $relative
|
|
378
415
|
$sourceFile = Join-Path $SourcePath $relative
|
|
379
416
|
$targetFile = Join-Path $RepoPath $relative
|