@agentsfleet/orly 0.10.13 → 0.11.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 (155) hide show
  1. package/.githooks/pre-push +2 -1
  2. package/AGENTS.md +21 -31
  3. package/README.md +65 -29
  4. package/SOUL.md +13 -23
  5. package/audits/agents-md.md +67 -57
  6. package/audits/deinit-pairs.sh +13 -18
  7. package/audits/design-tokens.sh +9 -23
  8. package/audits/doc-read.sh +10 -33
  9. package/audits/doc-reads.ts +41 -0
  10. package/audits/error-codes.sh +18 -25
  11. package/audits/logging-rust.awk +145 -0
  12. package/audits/logging.sh +10 -166
  13. package/audits/msid-ui.sh +45 -18
  14. package/audits/rule-ledger-lib.sh +9 -6
  15. package/audits/rust-error.sh +20 -15
  16. package/audits/scope.sh +88 -0
  17. package/audits/spec-template.sh +2 -2
  18. package/audits/spec-template.ts +1 -1
  19. package/audits/sql-mod.sh +11 -14
  20. package/audits/ufs-strings.awk +164 -0
  21. package/audits/ufs.sh +10 -188
  22. package/core/operating-model.md +8 -8
  23. package/dispatch/edit_rules.md +8 -6
  24. package/dispatch/lib.sh +41 -26
  25. package/dispatch/lifecycle.md +18 -6
  26. package/dispatch/name_architecture.md +8 -3
  27. package/dispatch/verify.md +1 -1
  28. package/dispatch/write_any.md +10 -3
  29. package/dispatch/write_changelog.md +7 -4
  30. package/dispatch/write_go.md +1 -1
  31. package/dispatch/write_http.md +5 -7
  32. package/dispatch/write_python.md +1 -1
  33. package/dispatch/write_rust.md +17 -1
  34. package/dispatch/write_shell.md +1 -1
  35. package/dispatch/write_spec.md +3 -1
  36. package/dispatch/write_sql.md +28 -6
  37. package/dispatch/write_ts_adhere_bun.md +11 -0
  38. package/dispatch/write_zig.md +53 -21
  39. package/docs/CHANGELOG_VOICE.md +11 -2
  40. package/docs/EXECUTE_DOC_READS.md +10 -10
  41. package/docs/HARNESS_VERIFY_OUTPUT.md +6 -3
  42. package/docs/JUDGMENTS.md +153 -0
  43. package/docs/LIFECYCLE_PATTERNS.md +26 -16
  44. package/docs/LOGGING_STANDARD.md +39 -19
  45. package/docs/ORLY_ARCHITECTURE.md +77 -6
  46. package/docs/RELEASE_TEMPLATE.md +21 -5
  47. package/docs/REST_API_DESIGN_GUIDELINES.md +86 -21
  48. package/docs/RULE_ENFORCEMENT.md +6 -6
  49. package/docs/SCHEMA_CONVENTIONS.md +24 -3
  50. package/docs/TEMPLATE.md +4 -4
  51. package/docs/VERIFY_TIERS.md +2 -2
  52. package/docs/greptile-learnings/RULES.md +81 -26
  53. package/llms.txt +37 -34
  54. package/package.json +6 -1
  55. package/packs/language/go/rules.md +1 -1
  56. package/packs/language/python/rules.md +1 -1
  57. package/packs/language/rust/rules.md +17 -1
  58. package/packs/language/shell/rules.md +1 -1
  59. package/registry.json +22 -7
  60. package/schemas/profile.schema.json +48 -5
  61. package/skills/orly-babysit-prs/SKILL.md +87 -34
  62. package/skills/orly-spec-new/SKILL.md +19 -6
  63. package/skills/orly-write-integration-test/SKILL.md +4 -4
  64. package/skills/orly-write-unit-test/SKILL.md +10 -1
  65. package/src/cli.test.ts +2 -2
  66. package/src/cli.ts +19 -75
  67. package/src/cli_help.ts +69 -0
  68. package/src/command_limits.ts +20 -0
  69. package/src/command_process.test.ts +109 -0
  70. package/src/command_process.ts +88 -0
  71. package/src/command_runner.test.ts +88 -0
  72. package/src/command_runner.ts +33 -0
  73. package/src/comprehension_cache.test.ts +123 -0
  74. package/src/config.test.ts +5 -4
  75. package/src/config.ts +26 -164
  76. package/src/config_discovery.ts +159 -0
  77. package/src/config_validation.test.ts +56 -0
  78. package/src/config_validation.ts +25 -0
  79. package/src/criteria.test.ts +1 -1
  80. package/src/criteria.ts +10 -26
  81. package/src/criteria_spec.ts +12 -20
  82. package/src/criteria_support.ts +2 -19
  83. package/src/doc_reads.test.ts +42 -0
  84. package/src/doc_rules.ts +2 -2
  85. package/src/evaluation_resources.test.ts +64 -0
  86. package/src/execution/config.ts +22 -0
  87. package/src/execution/plan.test.ts +65 -0
  88. package/src/execution/plan.ts +51 -0
  89. package/src/gates.ts +39 -24
  90. package/src/gates_spec.test.ts +110 -4
  91. package/src/gates_test_support.ts +9 -7
  92. package/src/install.test.ts +38 -222
  93. package/src/install.ts +117 -308
  94. package/src/install_loaders.test.ts +203 -0
  95. package/src/install_nested.test.ts +2 -2
  96. package/src/install_packs.test.ts +66 -6
  97. package/src/installation/hooks.ts +63 -0
  98. package/src/installation/lock.test.ts +97 -0
  99. package/src/installation/lock.ts +56 -0
  100. package/src/installation/migration.test.ts +212 -0
  101. package/src/installation/migration.ts +65 -0
  102. package/src/installation/plan.ts +96 -0
  103. package/src/installation/transaction.ts +126 -0
  104. package/src/installation_preservation.test.ts +48 -0
  105. package/src/judgments/advice.test.ts +38 -0
  106. package/src/judgments/advice.ts +32 -0
  107. package/src/judgments/command.integration.test.ts +47 -0
  108. package/src/judgments/command.ts +90 -0
  109. package/src/judgments/constants.ts +55 -0
  110. package/src/judgments/evidence.test.ts +48 -0
  111. package/src/judgments/evidence.ts +34 -0
  112. package/src/judgments/files.test.ts +62 -0
  113. package/src/judgments/files.ts +73 -0
  114. package/src/judgments/questions.test.ts +19 -0
  115. package/src/judgments/questions.ts +85 -0
  116. package/src/judgments/replay.test.ts +43 -0
  117. package/src/judgments/replay.ts +66 -0
  118. package/src/judgments/runner.integration.test.ts +165 -0
  119. package/src/judgments/runner.ts +97 -0
  120. package/src/judgments/scan.test.ts +19 -0
  121. package/src/judgments/scan.ts +40 -0
  122. package/src/judgments/syntax.test.ts +115 -0
  123. package/src/judgments/syntax.ts +71 -0
  124. package/src/judgments/syntax_worker.ts +70 -0
  125. package/src/judgments/test_support.ts +60 -0
  126. package/src/judgments/transport.integration.test.ts +63 -0
  127. package/src/judgments/transport.ts +35 -0
  128. package/src/judgments/types.test.ts +43 -0
  129. package/src/judgments/types.ts +66 -0
  130. package/src/judgments/wire.test.ts +48 -0
  131. package/src/judgments/wire.ts +40 -0
  132. package/src/loaders.test.ts +13 -16
  133. package/src/loaders.ts +28 -10
  134. package/src/model.test.ts +20 -3
  135. package/src/model.ts +7 -18
  136. package/src/pack_hygiene.test.ts +42 -1
  137. package/src/pack_hygiene.ts +18 -8
  138. package/src/references.ts +15 -7
  139. package/src/release_inventory.test.ts +80 -0
  140. package/src/render.test.ts +1 -1
  141. package/src/render.ts +3 -8
  142. package/src/required_scanner.test.ts +36 -0
  143. package/src/review_poll.test.ts +158 -0
  144. package/src/scanner_scope.test.ts +202 -0
  145. package/src/setup.test.ts +9 -6
  146. package/src/spec_baseline.test.ts +1 -1
  147. package/src/spec_completion.test.ts +74 -0
  148. package/src/spec_obligations.ts +64 -0
  149. package/src/spec_rehearsal.test.ts +182 -0
  150. package/src/spec_template_io.test.ts +11 -9
  151. package/src/surfaces.test.ts +2 -0
  152. package/src/surfaces.ts +1 -1
  153. package/src/validation.ts +7 -4
  154. package/src/verify.test.ts +18 -2
  155. package/src/verify.ts +7 -3
@@ -91,7 +91,7 @@ Auto-memory is **disabled** (`autoMemoryEnabled: false` + `CLAUDE_CODE_DISABLE_A
91
91
  - `*.zig` → read `dispatch/write_zig.md`; ZIG GATE fires. <!-- oracle-packs:language.zig -->
92
92
  - Auth-flow (token-minting handlers, credential-typed spec dimensions, the repository's auth directories) → read the repository's `docs/AUTH.md` first, where it exists. <!-- oracle-packs:domain.auth -->
93
93
  <!-- oracle-packs:start persona.indy -->
94
- - **Indy's reference checkouts** (the machine-local half of the rule above): TypeScript → `oss/supabase/apps/studio` + `oss/supabase/packages/{ui,ui-patterns}` + `oss/cli`; Zig → `oss/ghostty/src/`; Rust → `oss/bun/src/` + `oss/exonum` + `oss/core_api-develop`. Missing checkout → ask, then clone into `~/Projects/oss/`.
94
+ - **Indy's reference checkouts** (`~/Projects/`): TypeScript → `oss/supabase/apps/studio` + `oss/supabase/packages/{ui,ui-patterns}` + `oss/cli`; Zig → `oss/ghostty/src/`; Rust → `oss/rs/exonum` + `oss/rs/arrow-rs` + `agentsfleet/rustd/` + `oss/rs/builder/components/builder-core/`. Missing → search `oss/rs/`; ask before cloning.
95
95
  <!-- oracle-packs:end -->
96
96
 
97
97
  **Forge detection:** `github.com` → `gh`; `gitlab.com` → `glab`. Check `git remote -v`.
@@ -124,24 +124,24 @@ Guards fire pre-hoc regardless of lifecycle stage. Override: `<GATE>: SKIPPED pe
124
124
 
125
125
  **🚦 Gate-flag triage** — gate fires → never silence, never harness-patch. **Mechanical** (obvious deterministic fix: fmt, lint-autofix, literal → const, over-length → split, dead code): auto-apply + inform the user in one line. **Judgment** (design call / weakened guarantee / security boundary / possible false-positive): STOP, surface the ask — 📟 flagged (symbol·file·line) · 🔦 fix scope (files·lines·follow-on) · 📈 what we gain · 💥 if not fixed (debt·blockages) · ☠️ my call — the user decides fix-or-defer. Never unilaterally call a flag a false-positive.
126
126
 
127
- **Seeded `.oracle/orly.json`?** Complete it first — `verify.*`, `surfaces`, opt-in packs: `dispatch/lifecycle.md` §Bootstrap.
127
+ **Seeded `.orly/orly.json`?** Complete it first — `verify.*`, `surfaces`, opt-in packs: `dispatch/lifecycle.md` §Bootstrap.
128
128
 
129
129
  **Rule paths resolve relative to this repository's root.** Every `dispatch/…`, `docs/…`, and `audits/…` path a rule cites is a real file here — `orly init`/`orly update` materialised it from the packs this repository selected. A path your repo lacks means its sources never selected that pack, not that the reference is broken.
130
130
 
131
131
  **Dispatch index — full rule prose in each `dispatch/<entry>.md` façade. Read the façade when its trigger fires — sectioned: scan headers, read the sections the diff touches.** Trigger-surface extensions: `*.zig`, `*.ts`, `*.tsx`, `*.js`, `*.jsx`, `*.py`, `*.rs`, `*.go`, `*.sh`, `*.sql`, `*.mdx`, and public OpenAPI prose. Latent `.md` per entry, deterministic `.sh` where mechanisable. Signals: 🟢 pass · 🟠 warn · 🔴 fail · 🛑 blocked · 🔥 critical · 🤔 judgment-only · 🟣 delegated. Output glyphs: 🧲 eval · 🛍️ evidence · 👮 security · ⛈️ rule · 💡 info · 📌 note. The router below **is** the gate set.
132
132
 
133
- **Legacy-workaround family** — four rules together: **RULE NDC** (no dead code at write time, `docs/greptile-learnings/RULES.md`), **RULE NLR** (touch-it-fix-it cleanup), **RULE NLG** (no new legacy framing pre-`0.30.0`), **Legacy-Design Consult Guard** (user A/B/C consult before patching/keeping/testing legacy). **No compatibility aliases** — old verbs, flag aliases, route wrappers, env aliases, fallback spellings — unless the user explicitly asks in-session.
133
+ **Legacy-workaround family** — four rules together: **RULE NDC** (no dead code at write time, `docs/greptile-learnings/RULES.md`), **RULE NLR** (touch-it-fix-it cleanup), **RULE NLG** (no speculative compatibility framing; selected product version policy applies), **Legacy-Design Consult Guard** (user A/B/C consult before patching/keeping/testing legacy). **No compatibility aliases** — old verbs, flag aliases, route wrappers, env aliases, fallback spellings — unless the user explicitly asks in-session.
134
134
 
135
135
  | Trigger — when you… | Dispatch | Latent façade carries · override |
136
136
  |---|---|---|
137
- | write `*.zig` | `write_zig` | `dispatch/write_zig.md` — memory safety, init/deinit + `errdefer`, pub shape verdict (`FILE SHAPE DECISION` — auto-mode does NOT cover), tagged unions, length caps, cross-compile both linux targets · `ZIG GATE` / `PUB GATE` / `LIFECYCLE GATE: SKIPPED per user override (reason: ...)`. | <!-- oracle-packs:language.zig -->
137
+ | write `*.zig` | `write_zig` | `dispatch/write_zig.md` — memory safety, init/deinit + `errdefer`, pub shape verdict (`FILE SHAPE DECISION` — auto-mode does NOT cover), tagged unions, length caps, declared cross-compile matrix · `ZIG GATE` / `PUB GATE` / `LIFECYCLE GATE: SKIPPED per user override (reason: ...)`. | <!-- oracle-packs:language.zig -->
138
138
  | write `*.ts`/`*.tsx`/`*.js`/`*.jsx` | `write_ts_adhere_bun` | `dispatch/write_ts_adhere_bun.md` — TS FILE SHAPE DECISION at PLAN, `const`/import/Bun-primitive discipline, raw-HTML → design-system primitive, `*-[...]` → token utility · `UI GATE` / `DESIGN TOKEN GATE: SKIPPED per user override (reason: ...)`; auto-mode does NOT cover; reason must cite a concrete external constraint. | <!-- oracle-packs:language.typescript,language.javascript -->
139
139
  | write `*.rs` | `write_rust` | `dispatch/write_rust.md` — ownership, justified `unsafe`, preserved error variants, feature combinations, deterministic concurrency tests · 🤔 judgment-only. | <!-- oracle-packs:language.rust -->
140
140
  | write `*.go` | `write_go` | `dispatch/write_go.md` — wrapped errors, goroutine exit paths, context first, defer at acquire, `-race` · 🤔 judgment-only. | <!-- oracle-packs:language.go -->
141
141
  | write `*.py` | `write_python` | `dispatch/write_python.md` — standard-library parsing, context-managed resources, boundary validation, specific exceptions · 🤔 judgment-only. | <!-- oracle-packs:language.python -->
142
142
  | write `*.sh` | `write_shell` | `dispatch/write_shell.md` — quoted expansions, array arguments, temp-file cleanup, no untrusted `eval`, shell compatibility · 🤔 judgment-only. | <!-- oracle-packs:language.shell -->
143
143
  | write `*.mdx` | `write_mdx` | `dispatch/write_mdx.md` — Markdown JSX structure, front matter, links, code fences, image descriptions, Mintlify isolation · 🤔 judgment-only. | <!-- oracle-packs:language.mdx -->
144
- | write `schema/*.sql` | `write_sql` | `dispatch/write_sql.md` — schema / migration rules + Schema Table Removal Guard (`DROP`/`ALTER` / `schema/embed.zig` / migration-array edits), STS/NSQ/SGR/ITF rules · `SCHEMA GUARD: SKIPPED per user override (reason: ...)`. | <!-- oracle-packs:domain.sql -->
144
+ | write SQL or migration registration | `write_sql` | `dispatch/write_sql.md` — schema / migration rules, repository live-data policy and owner approval for destructive changes; product-specific Schema Table Removal Guard only when selected. | <!-- oracle-packs:domain.sql -->
145
145
  | write **any** source file | `write_any` | `dispatch/write_any.md` — File & Function Length, LOGGING, MILESTONE-ID, ERROR REGISTRY (repo-declared scheme, delegated), UFS named-constants, GREPTILE end-of-turn read, legacy family · `LENGTH` / `LOGGING` / `MILESTONE ID` / `UFS GATE: SKIPPED per user override (reason: ...)`; auto-mode does NOT cover. | <!-- oracle-packs:universal.authoring -->
146
146
  | write a spec under `docs/v*/…` | `write_spec` | `dispatch/write_spec.md` — required + prohibited spec sections (SPEC TEMPLATE GATE), `docs/TEMPLATE.md` shape · `SPEC TEMPLATE GATE: SKIPPED per user override (reason: ...)`; auto-mode does NOT cover; reason must cite a concrete external constraint. | <!-- oracle-packs:workflow.specifications -->
147
147
  | write `src/http/handlers/**` / OpenAPI | `write_http` | `dispatch/write_http.md` — REST API design rules; reads `docs/REST_API_DESIGN_GUIDELINES.md` before · 🟣 delegated. | <!-- oracle-packs:domain.http -->
@@ -152,7 +152,7 @@ Guards fire pre-hoc regardless of lifecycle stage. Override: `<GATE>: SKIPPED pe
152
152
  | claim "tests pass / ready / shipping" | `verify` | `dispatch/verify.md` — verification tiers (`make` canonical; package-scoped runners are **not** verification), done-message glyph format · 🤔 judgment-only, `VERIFY GATE: <target> skipped per environment constraint (reason: ...)` only when genuinely unrunnable. | <!-- oracle-packs:product.agentsfleet -->
153
153
  | name a stream/channel/Redis namespace/queue/RPC/Postgres schema, or describe a flow | `name_architecture` | `dispatch/name_architecture.md` — architecture-consult discipline; grep relevant `docs/architecture/` (chat brainstorming counts) · **no override** — doc wins until reconciled. | <!-- oracle-packs:universal.authoring -->
154
154
  | run a lifecycle stage (open→close a stream, worktree setup, milestone bootstrap) | `lifecycle` | `dispatch/lifecycle.md` — stage runbooks: CHORE(open/close) checklists, PLAN expansions, spec discipline, deferral format, pre-PR gates, LAND · 🤔 judgment-only. |
155
- | edit the governance (`core/**`, `packs/**`, `schemas/**`, `src/**`, `registry.json`, generated `AGENTS.md`, `dispatch/`, audits, hooks) | `edit_rules` | `dispatch/edit_rules.md` — runs `make audit`, the `audits/agents-md.md` questionnaire, live comprehension evaluation when semantics change, and generated evidence · **no override** from the agent (user-only push: `SKIP_INVARIANCE_PUSH=1`). | <!-- oracle-packs:workflow.governance -->
155
+ | edit the governance (`core/**`, `packs/**`, `schemas/**`, `src/**`, `registry.json`, generated `AGENTS.md`, `dispatch/`, audits, hooks) | `edit_rules` | `dispatch/edit_rules.md` — runs `make audit`, the `audits/agents-md.md` questionnaire, live comprehension evaluation when semantics change, and generated evidence · **no override** from the agent. | <!-- oracle-packs:workflow.governance -->
156
156
 
157
157
  ---
158
158
 
@@ -169,7 +169,7 @@ Guards fire pre-hoc regardless of lifecycle stage. Override: `<GATE>: SKIPPED pe
169
169
 
170
170
  | Event | Action |
171
171
  |---|---|
172
- | New milestone, plan-{eng,ceo,design}-review, `TODO.md` attempt | Invoke `orly-spec-new`. Land in `docs/v{N}/pending/`, `Status: PENDING`, commit on main. |
172
+ | New milestone, plan-{eng,ceo,design}-review, `TODO.md` attempt | Invoke `orly-spec-new`. Land in `docs/v{N}/pending/`, `Status: PENDING`, commit on the detected default branch. |
173
173
  | Begin implementation OR branch carries spec changes in `pending/` | CHORE(open): `pending/`→`active/`, `Status: IN_PROGRESS` + `Branch:`, create worktree, commit on feature branch. **No code until 4 steps committed.** |
174
174
  | Every commit during implementation | Mark completed Dimensions/Sections `DONE` same commit as the code. |
175
175
  | All work complete, before PR | CHORE(close). |
@@ -215,7 +215,7 @@ Edit only approved scope; no opportunistic refactors. Stay in active worktree. C
215
215
 
216
216
  ### CONFORM
217
217
 
218
- Runs after EXECUTE, before VERIFY. Invokes the `conform` commands the repository declares in `.oracle/orly.json` and aggregates every gate verdict. Any 🔴 returns to EXECUTE; the lifecycle does not advance. This is the `work` gate's tier and the pre-commit hook runs it at every commit: declare a `conform` costing seconds, not minutes.
218
+ Runs after EXECUTE, before VERIFY. Invokes the `conform` commands the repository declares in `.orly/orly.json` and aggregates every gate verdict. Any 🔴 returns to EXECUTE; the lifecycle does not advance. This is the `work` gate's tier and the pre-commit hook runs it at every commit: declare a `conform` costing seconds, not minutes.
219
219
  <!-- oracle-packs:start product.agentsfleet -->
220
220
  In `agentsfleet` this stage is `make harness-verify`; its output block and end-of-turn audit detail live in `docs/HARNESS_VERIFY_OUTPUT.md`. Required rows: FILE SHAPE, PUB GATE, LENGTH GATE, MILESTONE-ID GATE, ZIG GATE, UI GATE, DESIGN TOKEN GATE, UFS GATE, SCHEMA GUARD, GREPTILE GATE, Architecture consult, Coverage, and `/orly-write-unit-test`.
221
221
  <!-- oracle-packs:end -->
@@ -20,8 +20,7 @@ This dispatch fires for edits to:
20
20
  - `.githooks/pre-commit`, `.githooks/pre-push`, or governance `Makefile` targets
21
21
  - `README.md` setup or propagation instructions
22
22
 
23
- The agent has no override. Indy may use `SKIP_INVARIANCE_PUSH=1` for one push
24
- when the reason is recorded in the newest commit message.
23
+ The agent has no override. Governance pushes run the required audit.
25
24
 
26
25
  ## Required action
27
26
 
@@ -33,7 +32,9 @@ when the reason is recorded in the newest commit message.
33
32
  push path by policy (the hook records `--llm-result not-required` with its
34
33
  rationale); run the matrix manually with `make llmevals` (or `SMOKE=1`)
35
34
  when semantics change.
36
- 5. Run `orly verify --write-evidence --llm-result pass`.
35
+ 5. Write evidence with `orly verify --write-evidence --llm-result pass` only
36
+ after a passing live run. The push policy below uses `not-required`;
37
+ an owner-approved live deferral never becomes a passing result.
37
38
  6. Emit the invariance report before declaring the work complete.
38
39
 
39
40
  Render command (writes this checkout's root `AGENTS.md`; pack sources already
@@ -49,9 +50,10 @@ Any failure returns to the edit. Do not patch the checker to silence its result.
49
50
 
50
51
  ## Push enforcement
51
52
 
52
- Pre-commit records the doc-read proof when governance files are staged, and
53
- defers `make audit` to pre-push. Pre-push runs the deterministic chain, runs one live fixture per installed agent for semantic
54
- changes, and regenerates `.oracle/evidence.json` against the pushed commit.
53
+ Pre-commit checks existing doc-read records when governance files are staged
54
+ and defers `make audit` to pre-push. Pre-push runs the deterministic chain and
55
+ regenerates `.orly/evidence.json` for checkout HEAD; it does not pass pushed
56
+ revisions to the verifier. Live comprehension runs manually for semantic changes.
55
57
 
56
58
  Repository synchronization remains explicit. Governance verification never
57
59
  mutates a consumer repository or sibling worktree.
package/dispatch/lib.sh CHANGED
@@ -49,6 +49,7 @@ DISPATCH_LANG=""
49
49
  DISPATCH_EXTS=()
50
50
  DISPATCH_FILES=()
51
51
  DISPATCH_RC=0
52
+ source "$DISPATCH_SCRIPTS/scope.sh"
52
53
 
53
54
  # Rule-code gloss map — canonical short expansions (full text in RULES.md legend).
54
55
  # Keep in sync with RULES.md; dispatch-coverage.sh fails on a code with no
@@ -111,29 +112,37 @@ dispatch_init() {
111
112
  # orly's own length gate — audits/logging.sh is 444 lines against a 350 cap —
112
113
  # and the first commit of an adoption failed on the adoption itself.
113
114
  dispatch_managed_paths() {
114
- local config="$TARGET_ROOT/.oracle/orly.json"
115
+ local config="$TARGET_ROOT/.orly/orly.json"
115
116
  [ -f "$config" ] || return 0
116
- sed -n '/"managed"[[:space:]]*:[[:space:]]*\[/,/\]/p' "$config" \
117
- | grep -oE '"[^"]+"' \
118
- | sed -e 's/^"//' -e 's/"$//' \
119
- | grep -vx 'managed' || true
117
+ bun -e 'const c = JSON.parse(await Bun.file(process.argv[1]).text());
118
+ if (!Array.isArray(c.managed) || c.managed.some(p => typeof p !== "string" || p.includes("\u0000")))
119
+ throw new Error("invalid managed ownership array");
120
+ for (const p of c.managed) process.stdout.write(p + "\u0000");' "$config"
120
121
  }
121
122
 
122
123
  # Resolve targets: explicit file args, or --staged self-discovery via git.
123
124
  # Explicit arguments are never filtered — naming a file is asking about it.
124
125
  dispatch_resolve_files() {
125
126
  DISPATCH_FILES=()
127
+ audit_scope_init --all "$@"
128
+ audit_index_snapshot "$@"
129
+ DISPATCH_STAGED=0
126
130
  if [ "${1:-}" = "--staged" ]; then
127
- local pathspecs=() e managed
131
+ DISPATCH_STAGED=1
132
+ local pathspecs=() e f owned skip managed_file
128
133
  for e in "${DISPATCH_EXTS[@]}"; do pathspecs+=("$e"); done
129
- managed="$(dispatch_managed_paths)"
130
- while IFS= read -r f; do
131
- [ -n "$f" ] || continue
132
- [ -n "$managed" ] && grep -qxF "$f" <<<"$managed" && continue
134
+ managed_file="$(mktemp "${TMPDIR:-/tmp}/orly-managed.XXXXXX")"
135
+ if ! dispatch_managed_paths > "$managed_file"; then
136
+ rm -f -- "$managed_file"; exit 2
137
+ fi
138
+ while IFS= read -r -d '' f; do
139
+ case "$f" in */vendor/*|vendor/*|*/third_party/*|third_party/*|*/node_modules/*|node_modules/*|*/dist/*|*/build/*|*/.next/*|*/.zig-cache/*) continue ;; esac
140
+ skip=0
141
+ while IFS= read -r -d '' owned; do [ "$f" != "$owned" ] || skip=1; done < "$managed_file"
142
+ [ "$skip" -eq 0 ] || continue
133
143
  DISPATCH_FILES+=("$f")
134
- done \
135
- < <(git -C "$TARGET_ROOT" diff --cached --name-only --diff-filter=ACMRT -- "${pathspecs[@]}" \
136
- | grep -vE '(^|/)(vendor|third_party|node_modules|\.zig-cache|dist|build|\.next)/' || true)
144
+ done < <(audit_scope_paths "${pathspecs[@]}")
145
+ rm -f -- "$managed_file"
137
146
  elif [ "$#" -ge 1 ]; then
138
147
  local f matched
139
148
  for f in "$@"; do
@@ -157,18 +166,20 @@ dispatch_resolve_files() {
157
166
  # dispatch must never claim a file its gates cannot parse.
158
167
  dispatch_add_shebang_files() {
159
168
  [ "${1:-}" = "--staged" ] || return 0
160
- local f base path firstline managed
161
- managed="$(dispatch_managed_paths)"
162
- while IFS= read -r f; do
163
- [ -n "$f" ] || continue
164
- [ -n "$managed" ] && grep -qxF "$f" <<<"$managed" && continue
169
+ local f base path firstline owned skip managed_file
170
+ managed_file="$(mktemp "${TMPDIR:-/tmp}/orly-managed.XXXXXX")"
171
+ if ! dispatch_managed_paths > "$managed_file"; then rm -f -- "$managed_file"; exit 2; fi
172
+ while IFS= read -r -d '' f; do
173
+ skip=0
174
+ while IFS= read -r -d '' owned; do [ "$f" != "$owned" ] || skip=1; done < "$managed_file"
175
+ [ "$skip" -eq 0 ] || continue
165
176
  base="${f##*/}"
166
177
  case "$base" in *.*) continue ;; esac
167
178
  path="$TARGET_ROOT/$f"; [ -f "$path" ] || path="$f"; [ -f "$path" ] || continue
168
179
  IFS= read -r firstline < "$path" || true
169
180
  case "$firstline" in "#!"*) DISPATCH_FILES+=("$f") ;; esac
170
- done < <(git -C "$TARGET_ROOT" diff --cached --name-only --diff-filter=ACMRT \
171
- | grep -vE '(^|/)(vendor|third_party|node_modules|\.zig-cache|dist|build|\.next)/' || true)
181
+ done < <(audit_scope_paths)
182
+ rm -f -- "$managed_file"
172
183
  }
173
184
 
174
185
  dispatch_header() {
@@ -198,9 +209,8 @@ dispatch_length_gate() {
198
209
  # Delegate to a deterministic leaf helper in audits/. Normalizes the verdict.
199
210
  # CODE prints with its gloss (no naked codes — audit-enforced).
200
211
  #
201
- # Leaf helpers have NON-UNIFORM arg contracts (e.g. audit-deinit-pairs takes
202
- # --staged; audit-ufs takes --all/no-arg after M70). The caller MUST pass the
203
- # mode the helper actually accepts as the 3rd arg — never assume --staged.
212
+ # Leaf helpers receive explicit targets when the caller names files. In
213
+ # staged mode the third argument preserves the helper's declared wider scope.
204
214
  # dispatch_run_helper UFS ufs.sh --all
205
215
  # dispatch_run_helper DEINIT deinit-pairs.sh --staged
206
216
  dispatch_run_helper() {
@@ -213,9 +223,14 @@ dispatch_run_helper() {
213
223
  DISPATCH_RC=1
214
224
  return 1
215
225
  fi
216
- local log="/tmp/dispatch-${DISPATCH_LANG}-${code}.log"
217
- if bash "$DISPATCH_SCRIPTS/$script" $mode >"$log" 2>&1; then
218
- printf ' %-8s 🟢 %s — pass (audits/%s %s)\n' "$code" "$g" "$script" "$mode"
226
+ local receipt_dir log args=()
227
+ receipt_dir="$(mktemp -d "${TMPDIR:-/tmp}/orly-dispatch.XXXXXX")" || return 1
228
+ log="$receipt_dir/receipt.log"
229
+ if [ "$DISPATCH_STAGED" -eq 1 ]; then [ -z "$mode" ] || args+=("$mode")
230
+ else args=("${DISPATCH_FILES[@]}"); fi
231
+ if (umask 077; bash "$DISPATCH_SCRIPTS/$script" ${args[@]+"${args[@]}"} >"$log" 2>&1); then
232
+ printf ' %-8s 🟢 %s — pass (audits/%s); receipt: %s\n' "$code" "$g" "$script" "$log"
233
+ cat "$log"
219
234
  else
220
235
  printf ' %-8s 🔴 %s — fail (audits/%s %s) — see %s\n' "$code" "$g" "$script" "$mode" "$log"
221
236
  DISPATCH_RC=1
@@ -13,7 +13,7 @@ are entering, not the whole file.
13
13
  ## What runs at each stage
14
14
 
15
15
  This is the authoritative sequence. Commands come from the repository's
16
- `.oracle/orly.json`; the engine contains no product-specific build recipes.
16
+ `.orly/orly.json`; the engine contains no product-specific build recipes.
17
17
 
18
18
  | Stage | Runs | Owner |
19
19
  |---|---|---|
@@ -145,7 +145,7 @@ into a separate tree.
145
145
 
146
146
  ## Bootstrap & milestone gates
147
147
 
148
- - **Complete `.oracle/orly.json` on first sight.** `orly init` seeds it
148
+ - **Complete `.orly/orly.json` on first sight.** `orly init` seeds it
149
149
  mechanically — it reads the Makefile (following `include` one level) and
150
150
  `package.json` scripts, matches a fixed list of target names, and writes what
151
151
  it matched. It finds the obvious ones and misses the rest, and it never
@@ -166,6 +166,7 @@ into a separate tree.
166
166
  A documentation repository can declare `verify.docs` for its site and link
167
167
  checks without application unit or integration suites. `init` reports
168
168
  missing commands; `doctor` and the gates reject incomplete setup.
169
+ <!-- oracle-packs:start product.agentsfleet -->
169
170
  - **Priming:** (1) Human runs `playbooks/founding/01_bootstrap/001_playbook.md`.
170
171
  (2) Agent runs `./playbooks/founding/02_preflight/00_gate.sh` (green before
171
172
  next). (3) Agent runs `playbooks/founding/03_priming_infra/001_playbook.md`.
@@ -176,6 +177,7 @@ into a separate tree.
176
177
  - **Agent-first sequencing** — minimize human steps; post-handoff steps
177
178
  retryable + idempotent. Vault is the inter-step interface; never pass creds
178
179
  by argument/env.
180
+ <!-- oracle-packs:end -->
179
181
 
180
182
  ## PLAN — expansions
181
183
 
@@ -186,8 +188,8 @@ surface option + cost, the user picks. Read docs when behavior is unclear.
186
188
 
187
189
  **Surface-area checklist** — yes/no + reason each: OpenAPI changes (list paths)
188
190
  · the product's CLI · user-facing docs · release notes
189
- / version bump · schema changes (≤100 lines/file, single-concern, update
190
- `schema/embed.zig` + migration array) · Schema Removal Guard output ·
191
+ / version bump · schema changes (the repository's migration registration,
192
+ file limits and live-data policy) · Schema Removal Guard output where selected ·
191
193
  spec-vs-rules conflict (amend spec).
192
194
 
193
195
  ## EXECUTE — spec discipline expansions
@@ -204,8 +206,10 @@ spec-vs-rules conflict (amend spec).
204
206
  update spec first); every Acceptance Criterion → verifiable command ("works
205
207
  correctly" is not a criterion; "`make test` passes" is); no code commits
206
208
  without tests (`/orly-write-unit-test`); every Error Table row → negative test.
209
+ <!-- oracle-packs:start persona.indy -->
207
210
  - **Recovery notes:** local Docker `ENOSPC` → `~/bin/mac-cleanup.sh`, verify
208
211
  `docker system df`, retry.
212
+ <!-- oracle-packs:end -->
209
213
 
210
214
  ## CHORE (close) — required outputs
211
215
 
@@ -255,10 +259,18 @@ version-sync check passes where defined; branch contains `origin/main` HEAD
255
259
  **`orly gate pr` follows the spec through the close.** A spec moved to `done/`
256
260
  on this branch is still discovered — its `Branch:` header names the branch —
257
261
  and every spec criterion runs against it; skip-pass is only for genuinely
258
- spec-less branches. A deliberately folded spec retains the exact branch header
262
+ spec-less branches. Branch and fold headers accept a plain token or an inline-code
263
+ token. Active specs explicitly naming another branch do not displace the current
264
+ branch's owner; an active spec without a branch declaration remains in scope.
265
+ A deliberately folded spec retains the exact branch header
259
266
  and adds `**Folded-into:** \`M178_001\`` naming the owning spec. Discovery
260
267
  validates that relation and gates the sole non-folded owner; two non-folded
261
- specs on one branch remain a hard error. Mechanical criteria: `spec.moved`
268
+ specs on one branch remain a hard error. **The same relation holds in
269
+ `active/`, from the moment the fold is decided.** A second workstream may sit
270
+ beside an open stream while it names that stream through `Folded-into`, and the
271
+ gates run against the owner — a fold is not a second stream, and it was decided
272
+ when the scope was, not when the spec moved. Extra `active/` specs without the
273
+ header are still the hard error they were: one stream per worktree. Mechanical criteria: `spec.moved`
262
274
  (`Status: DONE` ⇒ the spec sits under `done/` and was moved on this branch) · `spec.baseline`
263
275
  (`Test Baseline:` recorded) · `spec.ordering` (the branch's first commit
264
276
  carries the spec — no code before CHORE(open)) · `spec.deferrals` (a deferral
@@ -17,7 +17,7 @@ cardinality*. It is a pure **🤔 judgment** dispatch grounded in `docs/architec
17
17
  - Naming a stream / pub-sub channel / Redis key namespace / consumer group /
18
18
  queue / RPC method / Postgres schema / table.
19
19
  - Asserting cardinality ("one row per X", "exactly one consumer per stream",
20
- "fleet-wide vs per-tenant").
20
+ "repository-wide vs per-tenant").
21
21
  - Describing a flow ("on crash → X reclaims via Y", "trigger source A lands on
22
22
  stream B with actor C").
23
23
  - Answering a user question about how data flows between components.
@@ -81,13 +81,18 @@ branch settles both before the Pull Request (PR) opens:
81
81
  branch that touched flow-defining code produces a non-empty
82
82
  `git diff origin/main..HEAD -- docs/architecture/`. Else PR Session Notes
83
83
  documents why nothing architectural changed.
84
- - **Docs project `~/Projects/docs/`** (user-facing, `docs.agentsfleet.net`). When
84
+ - **Published docs** (the repository's declared `surfaces.docs`). When
85
85
  the change alters documented user-facing behaviour (endpoints, Command-Line
86
86
  Interface (CLI) surface, flags, flows users see), the affected pages are
87
- revised per the CHORE(close) required
87
+ revised in their owning repository per the CHORE(close) required
88
88
  outputs in `AGENTS.md` — a changelog `<Update>` alone is insufficient.
89
89
  Internal-only reshaping with no documented-behaviour change → no docs-project
90
90
  edit, and Session Notes say so.
91
91
 
92
+ <!-- oracle-packs:start product.agentsfleet -->
93
+ For `agentsfleet`, the published docs repository is `~/Projects/docs/` at
94
+ `docs.agentsfleet.net`; edits use its own branch and explicit authorization.
95
+ <!-- oracle-packs:end -->
96
+
92
97
  Updating one home and not the other is the failure mode this section names: the
93
98
  internal doc drifts from what users are told, or vice versa.
@@ -27,7 +27,7 @@ pass".
27
27
 
28
28
  ## Repository commands are canonical
29
29
 
30
- The commands in `.oracle/orly.json` define full verification. Use repository
30
+ The commands in `.orly/orly.json` define full verification. Use repository
31
31
  Make targets where declared; a repository may also declare its native tools
32
32
  directly. A narrower package run never substitutes for a declared full check.
33
33
  Documentation repositories may use `verify.docs` for site and link checks;
@@ -346,7 +346,7 @@ ERROR REGISTRY GATE: <file>
346
346
  **Family:** Constant discipline. **Source:** `AGENTS.md` conformance enforcement
347
347
  + the selected language façade's Uniform Free Strings (UFS) clauses.
348
348
 
349
- **Triggers** — every `Edit`/`Write` to a source file under the repository's own source surfaces — the `surfaces.user` prefixes it declares in `.oracle/orly.json`, or its source roots where it declares none — matching `*.zig`, `*.ts`, `*.tsx`, `*.js`, `*.jsx`, `*.rs`, `*.go`. Excluded: `vendor/`, `third_party/`, `.zig-cache/`, `node_modules/`, `*.tsbuildinfo`. `*.py` and `*.sh` fire this façade but are held out of the UFS leaf — see Scope. Each repository binds its own prefixes; naming one repository's layout here is what sends every other repository a trigger list it cannot match.
349
+ **Triggers** — every `Edit`/`Write` to a source file under the repository's own source surfaces — the `surfaces.user` prefixes it declares in `.orly/orly.json`, or its source roots where it declares none — matching `*.zig`, `*.ts`, `*.tsx`, `*.js`, `*.jsx`, `*.rs`, `*.go`. Excluded: `vendor/`, `third_party/`, `.zig-cache/`, `node_modules/`, `*.tsbuildinfo`. `*.py` and `*.sh` fire this façade but are held out of the UFS leaf — see Scope. Each repository binds its own prefixes; naming one repository's layout here is what sends every other repository a trigger list it cannot match.
350
350
 
351
351
  <!-- oracle-packs:start product.agentsfleet -->
352
352
  In this repository those surfaces are `src/` (Zig), `rustd/crates/*/src/` (Rust), `cli/src/` and `ui/packages/*/{src,app,lib,components,pages,tests}/` (TypeScript).
@@ -446,19 +446,26 @@ The test-seam match is deliberately narrow — `test` as a whole word or a `-`/`
446
446
  `audits/ufs.sh` is invoked at CONFORM by the agent. Convention follows the sibling audit scripts (`logging.sh`, `error-codes.sh`, `deinit-pairs.sh`, `spec-template.sh`) — none of them wire into `make lint`; the agent runs each as part of the gate ceremony, with the result feeding the CONFORM table. The script is generic — no manifest of known literals — so it scales as the codebase grows:
447
447
 
448
448
  ```bash
449
- bash audits/ufs.sh # full-codebase scan (default and only mode)
449
+ bash audits/ufs.sh # full-codebase scan (default)
450
450
  bash audits/ufs.sh --all # alias for default
451
+ bash audits/ufs.sh --staged # indexed bytes of staged source files
452
+ bash audits/ufs.sh -- src/example.ts # explicit working-tree source files
451
453
  ```
452
454
 
453
455
  The script emits a violations table. Empty table = pass. Each row is one of:
454
456
 
455
457
  - `string-dup-file <file> "<literal>" <count>` — same string ≥2× in one file
456
- - `string-dup-module <module> "<literal>" <count>` — same string ≥2× across a module/package
457
458
  - `numeric-suspect <file>:<line> <literal>` — power-of-ten or known unit-factor numeric not bound to a const (excludes anything on a `// pin test: literal is the contract` line)
458
459
  - `cross-runtime-orphan <const_name> <runtime>` — SCREAMING_SNAKE constant defined in one runtime, missing from a sibling runtime that the same diff touches
459
460
 
460
461
  Violations resolve by either (1) extracting to a named const + replacing all sites, (2) adding the constant in the missing sibling runtime same-commit, or (3) adding the `// pin test: literal is the contract` comment.
461
462
 
463
+ Cross-file repeated strings are a reviewer check: the leaf does not emit
464
+ `string-dup-module`. Review the changed module's callers and shared vocabulary;
465
+ a clean per-file scan does not establish that each value has one definition.
466
+ In staged mode, both source and configuration come from an owned index snapshot;
467
+ unstaged edits cannot clear an indexed violation.
468
+
462
469
  #### CONFORM row
463
470
 
464
471
  > [DETERMINISTIC → UFS]
@@ -2,7 +2,7 @@
2
2
 
3
3
  This is the prose the AGENT reads after `write_documentation.md` and
4
4
  `docs/DOCUMENTATION_RULES.md`, **before writing any `<Update>` entry in the
5
- changelog** (`~/Projects/docs/changelog.mdx`). Like `verify` and
5
+ repository's declared changelog**. Like `verify` and
6
6
  `name_architecture`, it has **no deterministic `.sh` half** — voice is a judgment
7
7
  call no script can grade. It is a pure **🤔 judgment** dispatch: the agent reads
8
8
  this, drafts the entry, and self-audits against the rules below. The deep
@@ -12,9 +12,8 @@ reference is `docs/CHANGELOG_VOICE.md` (Mintlify-style) — read it before writi
12
12
 
13
13
  - 🤔 DECIDE — judgment-only; the agent writes to the voice below and self-audits.
14
14
  No script gates it — it blocks the *turn* (the changelog entry), not a commit.
15
- - 🟣 delegated — the changelog itself lives in `~/Projects/docs` (its own repo +
16
- own-branch flow per AGENTS.md Operational defaults); dotfiles carries only the
17
- voice discipline.
15
+ - 🟣 delegated — edit the declared changelog in its owning repository with
16
+ that repository's branch rules and authorization.
18
17
 
19
18
  ## Trigger — read `docs/DOCUMENTATION_RULES.md`, then `docs/CHANGELOG_VOICE.md`
20
19
 
@@ -40,9 +39,13 @@ a gate skip.
40
39
  names, money amounts stay verbatim.
41
40
  - **Internal cleanup** gets aggressive trimming, not a paragraph.
42
41
  - **History is archived, not rewritten** — past entries are an immutable record.
42
+ - **Rate claims** match the repository's canonical billing constants and
43
+ published rate tables, with both updated when the behavior changes.
44
+ <!-- oracle-packs:start product.agentsfleet -->
43
45
  - **Rate constants** are declared once, in `afd_billing`'s `nanos.rs`, with the
44
46
  nanos denominator in `afd_core::money`. A changelog money or rate claim must
45
47
  match those — and `rates.mdx` in the docs repository, which no test reaches.
48
+ <!-- oracle-packs:end -->
46
49
 
47
50
  ## Required output (self-audit line before committing the changelog)
48
51
 
@@ -31,4 +31,4 @@ Both are carve-outs for what the *language* makes unfixable, not permission —
31
31
  a flag name or a label spelled inline twice is still the rule.
32
32
 
33
33
  The repository owns formatting, vet, lint, build, and test commands — it
34
- declares them in `.oracle/orly.json`.
34
+ declares them in `.orly/orly.json`.
@@ -7,19 +7,17 @@ self-contained product-surface design guide, so this façade *routes* to it rath
7
7
  than duplicating it. **Residence vs enforcement:** `orly init` materialises the
8
8
  guide into this repository under the `domain.http` pack — it is a real local
9
9
  file, not something read through another checkout. Its checks are *enforced*
10
- in the product repo (`make lint` / `/review` against the guide) — hence
10
+ in the consuming repository (its declared checks and `/review` against the guide) — hence
11
11
  **🟣 delegated**.
12
12
 
13
13
  **Signal legend:**
14
14
 
15
- - 🟣 delegated — the REST checklist is enforced in the product repo (agentsfleet),
16
- by `make lint` + adversarial `/review` against the guide. Dotfiles carries the
17
- doc itself, the routing, and the discipline that the guide is a *checklist, not
18
- background reading*.
15
+ - 🟣 delegated — the consuming repository enforces the checklist through its
16
+ declared checks and adversarial review. The installed guide is a checklist.
19
17
 
20
18
  ## Trigger — read `docs/REST_API_DESIGN_GUIDELINES.md` before
21
19
 
22
- - Editing `src/http/handlers/**`, `public/openapi/**`, or any `route_*` file.
20
+ - Editing the repository's HTTP handlers, route registration or OpenAPI sources.
23
21
  - Adding, modifying, or removing an HTTP endpoint or its OpenAPI shape.
24
22
 
25
23
  **Override:** none from dotfiles — the REST guide's own `MUST`/`SHOULD`
@@ -38,7 +36,7 @@ checklist run at `CHORE(close)` before `gh pr create`.
38
36
  ## Why route, not merge
39
37
 
40
38
  REST design rules bind the *product repo's* HTTP surface, but the doc has one
41
- canonical source in dotfiles — `orly init`/`orly update` materialise it here,
39
+ canonical source in the selected pack — `orly init`/`orly update` materialise it here,
42
40
  so this repository's copy tracks that source. Merging its full text into
43
41
  this façade would create a second source of truth. The guide stays canonical;
44
42
  this façade is the dispatch entry that points the agent at it when the trigger
@@ -7,4 +7,4 @@ context managers. Validate data at parse boundaries and preserve specific
7
7
  exception classes until the caller can decide how to respond.
8
8
 
9
9
  The repository owns formatting, linting, type checking, and tests — it declares
10
- them in `.oracle/orly.json`.
10
+ them in `.orly/orly.json`.
@@ -10,10 +10,26 @@ Test the feature combinations the repository actually builds. Concurrency work
10
10
  needs a deterministic contention test, not only a happy-path asynchronous test.
11
11
 
12
12
  The repository owns formatting, Clippy, build, test, security, and benchmark
13
- commands — it declares them in `.oracle/orly.json`.
13
+ commands — it declares them in `.orly/orly.json`.
14
14
 
15
15
  ## Reference guideline (mandatory in review)
16
16
 
17
+ Before designing Rust modules, read the relevant implementation in Exonum,
18
+ Apache Arrow's Rust implementation, or the local `agentsfleet` Rust workspace.
19
+ Indy's checkouts are `~/Projects/oss/rs/exonum`,
20
+ `~/Projects/oss/rs/arrow-rs`, `~/Projects/agentsfleet/rustd/`, and
21
+ `~/Projects/oss/rs/builder/components/builder-core/`.
22
+ Use Exonum for state and API boundaries and Arrow for typed data and workspace
23
+ structure. Use `agentsfleet/rustd/crates/agentsfleetd/` specifically for errors
24
+ and the command-line interface (CLI); inspect its actual call sites before designing.
25
+ Use `afd_core::env::EnvSource` for injected process and test environments.
26
+ Builder's `ConfigFile` trait supplies prior art for composable file loading and
27
+ cause-preserving parsing. Read its call sites; retain current edition safety and
28
+ library logging rather than copying its older global environment mutation or logger.
29
+ Read only relevant modules and name the pattern applied or the reason to diverge.
30
+ These are read-only references; consumer changes require their own authorization.
31
+ Other machines locate the equivalent checkout before asking to clone one.
32
+
17
33
  Microsoft's Pragmatic Rust Guidelines are this pack's depth — thorough,
18
34
  agent-facing, and continuously maintained upstream. The local copy lives at
19
35
  `~/Projects/oss/rust-guidelines/all.txt`; fetch it when absent:
@@ -7,4 +7,4 @@ every exit path. Avoid `eval` for external input. Match the repository's require
7
7
  shell and macOS Bash compatibility level.
8
8
 
9
9
  The repository owns ShellCheck and executable tests — it declares them in
10
- `.oracle/orly.json`.
10
+ `.orly/orly.json`.
@@ -35,6 +35,8 @@ parsed Markdown tree. Code examples and quoted headings cannot supply sections.
35
35
  decides their applicability from the actual branch diff. Additional
36
36
  spec-specific commands and explicitly named manual checks remain valid.
37
37
 
38
+ ## Scope
39
+
38
40
  `--staged` reads spec contents, configuration, and local references from the Git
39
41
  index. `--file <path>` checks the working copy. Missing runtime or configuration
40
42
  fails these readiness checks. Bulk `--all` and `--include-done` scans retain
@@ -88,4 +90,4 @@ Incident-derived rules the deterministic half can't check — apply while writin
88
90
 
89
91
  - `docs/TEMPLATE.md` — canonical Prohibited section + required sections.
90
92
  - `orly-spec-new` skill — creates specs from the template; inserts the banner.
91
- - `audits/spec-template.sh` — mechanical regex enforcement, runs in `make lint`.
93
+ - `audits/spec-template.sh` — structural and prohibited-section checks; `orly gate pr` invokes it through `spec.gate`.
@@ -26,7 +26,21 @@ deterministic façade in this snapshot.
26
26
 
27
27
  > [JUDGMENT → SCH]
28
28
 
29
- Triggers on every `Edit`/`Write` to `schema/*.sql`, `schema/embed.zig` (`@embedFile` constants), and the canonical migration array in `src/cmd/common.zig`. **Before authoring DDL, read `docs/SCHEMA_CONVENTIONS.md`** (naming, types, schema-qualification). SQL embedded in handlers (`*.zig`) and integration-test fixtures is also governed by the companion rules below — those surfaces additionally fire `write_zig.md` and the GREPTILE GATE.
29
+ Triggers on SQL files, embedded SQL and the repository's migration registration.
30
+ Before writing schema changes, read `docs/SCHEMA_CONVENTIONS.md` and locate the
31
+ repository's current migrations, registration and deployment policy.
32
+ Embedded SQL also fires its selected language façade and the GREPTILE GATE.
33
+
34
+ ## Repository schema policy
35
+
36
+ > [JUDGMENT → SCH]
37
+
38
+ Preserve shipped migrations and live data under the repository's own policy.
39
+ Destructive changes require the owner's approval for the specific change.
40
+ A version number, missing `VERSION` file or another product's rebuild policy
41
+ never proves that this repository's data is disposable.
42
+
43
+ <!-- oracle-packs:start product.agentsfleet -->
30
44
 
31
45
  ## Merged from dissolved gate cards
32
46
 
@@ -44,7 +58,7 @@ The **Schema Table Removal Guard** card dissolves into this façade; its prose i
44
58
 
45
59
  - Creating, editing, or deleting any file under `schema/*.sql`.
46
60
  - Editing `schema/embed.zig` (any `@embedFile` constant).
47
- - Editing the canonical migration array in `src/cmd/common.zig`.
61
+ - Editing the canonical migration array in `rustd/crates/afd_db/src/migration.rs`.
48
62
  - Writing `DROP TABLE`, `ALTER TABLE`, or `SELECT 1;` into any SQL file.
49
63
  - Accepting a spec dimension prescribing a "DROP migration", "ALTER migration", or "version marker".
50
64
 
@@ -60,7 +74,7 @@ To remove a table:
60
74
 
61
75
  1. `rm schema/NNN_foo.sql`
62
76
  2. Remove `@embedFile` from `schema/embed.zig`
63
- 3. Remove the entry from the migration array in `src/cmd/common.zig` and update length + index-based tests.
77
+ 3. Remove the entry from the migration array in `rustd/crates/afd_db/src/migration.rs` and update its registration tests.
64
78
 
65
79
  **Forbidden:** `ALTER TABLE`, `DROP TABLE`, `SELECT 1;` markers, comment-only files, "keep file for slot numbering". Slot gaps are fine — the DB is wiped on rebuild.
66
80
 
@@ -82,6 +96,7 @@ SCHEMA GUARD: VERSION=<v> (<0.30.0 ? teardown : migrate)
82
96
  ```
83
97
 
84
98
  Below `0.30.0`, all three rm- lines appear. From `0.30.0`, replace them with `migration:schema/<NNN>_<change>.sql`.
99
+ <!-- oracle-packs:end -->
85
100
 
86
101
  ## Companion SQL rules (retained in `docs/greptile-learnings/RULES.md`)
87
102
 
@@ -99,16 +114,23 @@ No string literal in `schema/**.sql` may name a value or identifier the applicat
99
114
 
100
115
  > [DETERMINISTIC → TODO-CHECK]
101
116
 
102
- No magic numbers; all SQL in handlers is schema-qualified (`core.table`, not `table`) — unqualified names fail when `search_path` differs across environments. (RULES.md `RULE NSQ`.)
117
+ No magic numbers; qualify tables with the repository's actual schema —
118
+ unqualified names fail when `search_path` differs across environments.
119
+ (RULES.md `RULE NSQ`.)
103
120
 
104
121
  ### RULE SGR — Migrations include GRANT statements
105
122
 
106
123
  > [DETERMINISTIC → TODO-CHECK]
107
124
 
108
- Every `CREATE TABLE` migration ends with `GRANT`s for every role that queries the table (`api_runtime` / `worker_runtime`), mirroring the table's callers. PostgreSQL denies by default — a missing grant fails only at first runtime use. (RULES.md `RULE SGR`.)
125
+ Every `CREATE TABLE` migration grants the required operations to the roles that
126
+ actually query the table. PostgreSQL denies by default — a missing grant fails
127
+ only at first runtime use. (RULES.md `RULE SGR`.)
109
128
 
110
129
  ### RULE ITF — Integration tests use the real schema
111
130
 
112
131
  > [JUDGMENT → ITF]
113
132
 
114
- An integration test touching a production table seeds rows through a shared `src/db/test_fixtures_<scope>.zig` module against the real schema — never a session-local `CREATE TEMP TABLE` mocking the production shape (the mock drifts and hides schema changes). Fixtures use semantic scope names, never milestone-numbered ones. (RULES.md `RULE ITF`.)
133
+ An integration test touching a production table uses shared repository fixture
134
+ helpers against the real schema — never a session-local `CREATE TEMP TABLE`
135
+ mocking the production shape. Fixtures use semantic scope names.
136
+ (RULES.md `RULE ITF`.)