interplane.Get Omega
Read in your language

aien-architecture-mv

Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.

Brought by drakestapleton

branch main Branches Tags History

aien-architecture-mv / docs / REPOSITORY_EXECUTION_RULES.md

205 lines · 10771 bytes Raw Blame History Rendered
1# AIEN Repository Execution Rules
2
3## Adoption
4
5Adopted 2026-10-10 from Drake's revised rules for the six-issue campaign (interplane#97 and #98, aien-sovereign-core#397 and #398, aegis-runtime#38 and #39). Tooling: `scripts/pr-gate.sh` and `scripts/rebase-crumb.sh`.
6
7## Recorded facts (2026-10-10)
8
9- (a) Branch protection read from GitHub: interplane requires the checks schemas-and-fixtures, rust, python, cross-language, adapter-aien and adapter-odysseus, in strict mode, with no review count. aien-sovereign-core requires the check "Workspace Verification & Invariant Audit", 0 reviews, enforce_admins on. aegis-runtime requires the check "Test & Invariant Verification", 0 reviews, enforce_admins on. Therefore `--admin` is never needed for a green PR.
10- (b) interplane has no .crumb files, so the crumb step is skipped there with a notice. aegis-runtime and aien-sovereign-core use crumbs.
11- (c) INTERPLANE carries a Python SDK by Drake's 2026-10-04 direction (approved exception). The Motus adapter for interplane#97 lives only under interplane adapters/motus. No Python enters any AIEN-owned repository.
12
13
14These rules apply to Claude Code, all delegated workers, and all repositories involved in this implementation campaign.
15
16The objective is to ship verified code without corrupting shared branches, bypassing security requirements, or creating unnecessary integration conflicts.
17
18## 1. Source of Truth
19
20GitHub main is authoritative. Inspect current code, tests, active PRs, and repository instructions before editing.
21
22Never implement an issue solely from its description. Check whether the functionality already exists or has been superseded.
23
24Use separate branches and worktrees for concurrent development.
25
26One worker owns each writable worktree. Never allow two workers to modify the same worktree concurrently.
27
28## 2. Crumb Compilation
29
30Retired (DRA-97, 2026-11-07: "Retire Crumbs from the active workflow while preserving live ownership"). A PR needs no `crumb compile`, no `crumb verify` and no separate crumb commit; existing `.crumb` files stay as history. The rule as it stood:
31
32Every applicable PR must have `.crumb` compilation and verification completed after its final source change.
33
34Required commands: `crumb compile .` then `crumb verify .`
35
36Commit generated `.crumb` changes separately as the final commit.
37
38Do not modify source files after that commit without rerunning compilation and verification.
39
40If a repository does not support these commands, report the discrepancy and follow its explicit repository policy. Never silently skip a required check.
41
42## 2a. Local verification
43
44`scripts/pr-gate.sh` reads GitHub's CLEAN state. It does not prove the commit was verified. The local admission check that complements CLEAN is `aien-test verify COMMIT` (sovereign-core `tools/aien-test`, ADR 0033 amendment 2026-10-11): it prints READY when every gate required at the base ref has a PASS receipt for that exact commit, and BLOCKED otherwise, with the reason (a missing or NOT_RUN gate, an UNMAPPED changed path, or a BLOCKED_OPERATOR head). Run it on the final SHA. Since the retirement (DRA-97, 2026-11-07) the final SHA is the last source commit: there is no crumb commit, and READY no longer depends on crumbs being CURRENT (sovereign-core `tools/aien-test/docs/LOCAL_VERIFICATION.md`). Before the retirement it was the commit that included the crumb commit, and a pre-crumb SHA was never READY (`docs/crumbs/LOCAL_PIPELINE.md` section 2, history).
45
46Trust anchors come from the base ref, never from the head under test (ADR 0033 amendment, A1): the required gate set, `.aien/verify.pub`, `.aien/always` and `.aien/unmapped-ok` are read from `origin/main`. A head that changes the pipeline's own configuration (`.aien/`, `tests/gates/`, `.github/workflows/`, `.forgejo/`, `tools/aien-test/`) is BLOCKED_OPERATOR: the operator runs its verification by hand and says so in the PR. Acceptance proofs for the crumb side of this rule (determinism, fixed point, staleness, claims) are `scripts/pipeline-proofs/13-*.sh` to `18-*.sh`; measured numbers in `scripts/pipeline-proofs/RESULTS-2026-10-11.md`. Since the retirement (DRA-97, 2026-11-07) proofs `19-*.sh` to `21-*.sh` prove the opposite: `pr-gate.sh` admits stale, missing or mixed crumbs with `GATE crumb: SKIP retired`, `rebase-crumb.sh` runs no crumb tool and adds no crumb commit, and the final SHA is the last source commit.
47
48## 3. Rebase and Crumb Conflicts
49
50Every sovereign-core merge to main can invalidate `.crumb` files in other open PRs.
51
52After each sovereign-core merge, evaluate remaining PRs for drift.
53
54Approved recovery script: `scripts/rebase-crumb.sh <worktree> <branch>` (this repository).
55
56Before running it:
57
58- Confirm the worktree has no uncommitted changes.
59- Confirm the intended branch and remote.
60- Inspect the script before first use.
61- Preserve the expected remote head for force-with-lease protection.
62- Ensure no other worker is writing to that branch.
63
64The script takes main's `.crumb` when a conflict is only in `.crumb` files, and pushes with lease. Since the crumb retirement (DRA-97, 2026-11-07) it no longer runs `crumb compile` or `crumb verify` and adds no crumb commit.
65
66If it reports CODE CONFLICT, stop automated rebasing for that branch. Resolve the source conflict by hand.
67
68Never discard source changes to manufacture a clean rebase.
69
70Do not rewrite another worker's branch without coordination.
71
72## 4. Definition of CLEAN
73
74A PR may merge only when all of the following hold:
75
76- Working tree is clean.
77- Changes are based on the intended current main.
78- No unresolved merge conflicts.
79- Required compilation passes (crumb verification is retired, DRA-97).
80- Required tests and CI checks pass.
81- Required approvals are present and valid.
82- GitHub reports a mergeable state.
83- No outstanding blocking security findings.
84- The final diff contains no unintended changes.
85- The implementation satisfies the linked issue's acceptance criteria.
86
87Do not equate GitHub's CLEAN merge-state label with complete verification.
88
89## 5. Merge Procedure
90
91Serialize merges into each repository's main branch.
92
93Default command: `gh pr merge N -R aien-dev/<repo> --squash --delete-branch`
94
95Only use `--admin` when explicitly authorized for that specific PR and when the required project governance permits it.
96
97Never use administrative privileges to hide failing tests, missing approvals, security findings, or unresolved conflicts.
98
99After every merge, refresh main and revalidate dependent or competing PRs.
100
101## 6. GitHub PR Editing
102
103The normal `gh pr edit` workflow is currently unreliable in this environment.
104
105Use the API fallback: `gh api -X PATCH repos/aien-dev/<repo>/pulls/N -F body=@file`
106
107Verify the returned response and fetch the PR afterward to confirm the update.
108
109Do not assume an API operation succeeded merely because the command exited.
110
111## 7. Language and Runtime Constraints
112
113No Python or systemd may be introduced as part of this campaign.
114
115Use Rust for AIEN-owned runtime, orchestration, adapters, and execution control.
116
117Motus may run externally using its own dependencies, but the AIEN integration must communicate over an explicitly verified protocol boundary.
118
119If a task requires Python inside an AIEN-owned repository, treat it as an architectural conflict. Redesign it or report the blocker before proceeding.
120
121Existing Python files do not authorize adding more Python. Flag any conflict with the strict repository policy rather than silently ignoring it.
122
123## 8. Command Hooks
124
125A local Bash hook rejects certain command text containing accelerator or kernel-module related terms.
126
127Do not embed source-file contents containing these terms into Bash commands or heredocs. Use the approved Write tool for file creation and editing.
128
129Do not attempt to bypass restrictions on executing prohibited operations.
130
131If an approved development command is incorrectly blocked, report the exact failure and use an authorized alternative.
132
133## 9. Commits and Attribution
134
135Use small, logically isolated commits.
136
137Required commit trailers, when attribution accurately reflects the contributors:
138
139`Co-authored-by: Drake Stapleton <drake@aienos.com>`
140`Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>`
141
142Do not invent contributors or misrepresent authorship.
143
144Required PR footer: 🤖 Generated with [Claude Code](https://claude.com/claude-code)
145
146Every PR must reference its issue, describe its implementation, identify verification performed, and disclose limitations.
147
148## 10. Worker Models and Verification
149
150Use Sonnet for delegated implementation workers unless instructed otherwise.
151
152Workers may inspect, implement, test, and propose solutions within their assigned ownership boundaries.
153
154A worker's claim of completion is not verification.
155
156The coordinating agent must independently inspect every worker's changes and verify relevant tests, security invariants, and actual GitHub state.
157
158Do not accept unsupported claims about test passes, hardware performance, successful merges, or completed integrations.
159
160Use an independent reviewer for security-sensitive changes.
161
162## 11. Failure Handling
163
164Do not repeatedly retry the same failing operation without identifying the cause.
165
166On failure:
167
1681. Capture the exact failure and affected commit.
1692. Determine whether it is source-related, environmental, or caused by concurrent changes.
1703. Apply the smallest justified correction.
1714. Rerun the affected verification.
1725. Escalate or isolate persistent blockers without destroying valid work.
173
174Never force-push another worker's changes away.
175
176Never turn off tests, security checks, or authorization rules merely to make a PR merge.
177
178## 12. Communication
179
180Use plain English when reporting to Drake. Do not use em dashes or en dashes.
181
182Provide concise updates that identify completed work, active work, blockers, and next actions.
183
184Do not confuse attempted operations with completed operations.
185
186## 13. Final Delivery
187
188Before declaring the campaign complete:
189
190- Verify every merged PR against its issue.
191- Check relevant cross-repository interfaces.
192- Run integration tests.
193- Confirm no unintended dependency or architecture changes.
194- Report remaining failed, skipped, or unavailable verification.
195- Confirm final GitHub issue and PR status.
196
197A task is complete only when the implementation, verification, and required integration are finished.
198
199## 14. Worker Instructions
200
201Worker briefs live with each campaign; this document wins when they conflict.
202
203Stable rules and validated scripts live in aien-architecture (`docs/REPOSITORY_EXECUTION_RULES.md`, `scripts/pr-gate.sh`, `scripts/rebase-crumb.sh`).
204
205**Operating principle: Ship correct, verified code. Preserve other workers' changes. Protect main. Never trade correctness for apparent progress.**