NujacsaintS Claude Opus 4.7 (1M context) commited on
Commit
93528c6
Β·
1 Parent(s): a64d9be

Pre-stage mu-plugin for spec_root override; ONBOARDING references file not snippet

Browse files

Adds:
mu-plugins/sa-orch-spec-root.php (1.7 KB) β€” auto-loaded WP filter that
redirects SA-Orchestration's
spec_root() to wp-content/sa-asterion/.

ONBOARDING.md updated to copy the pre-staged file rather than author it from
an embedded snippet. Same v2 pattern as asterion/ + sa-orchestration/ +
SA-orchestration MD/.

Why: the SA-Orch plugin hardcodes a default spec_root path that only exists
on the source-author's machine (F:/SleeperAgents/SA-orchestration/Archvie/...).
Every other WP install β€” WPE dev root, leaf installs β€” needs this mu-plugin
to redirect spec_root, otherwise Asterion queries return 'no canonical
reference found in the spec corpus (corpus root unreachable)'. Discovered
during WPE deploy verification on 2026-05-06.

Source-of-truth file: F:\SleeperAgents\SA-orchestration\mu-plugins\sa-orch-spec-root.php
(committed at aa78b71). Copies in seeded repos are byte-identical.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files changed (2) hide show
  1. ONBOARDING.md +7 -16
  2. mu-plugins/sa-orch-spec-root.php +35 -0
ONBOARDING.md CHANGED
@@ -167,30 +167,21 @@ The SA-Orchestration plugin reads its canonical content from a filterable path.
167
 
168
  Two valid placements:
169
 
170
- **A. Mirror corpus into WP content** (recommended):
171
 
172
  ```
 
173
  mkdir -p <wp-install>/wp-content/sa-asterion
174
  cp -r <this-repo>/asterion/* <wp-install>/wp-content/sa-asterion/
175
- ```
176
-
177
- **B. Point the spec_root filter at this repo's `asterion/` directory directly** (no copy):
178
 
179
- Drop a mu-plugin at `<wp-install>/wp-content/mu-plugins/sa-orch-spec-root.php`. The filter must return the **absolute path to this repo's `asterion/` directory on the developer's machine** β€” substitute `<repo-root>` with whatever the developer's actual clone path is (Phase 0 should have surfaced this; if not, ask):
180
-
181
- ```php
182
- <?php
183
- add_filter( 'sa_orch_asterion_spec_root', function () {
184
- // Replace <repo-root> with the absolute path to where this repo lives
185
- // on the developer's machine. DO NOT hardcode a drive letter or path
186
- // that has not been confirmed by the developer.
187
- return '<repo-root>/asterion';
188
- }, 5 );
189
  ```
190
 
191
- If the developer prefers POSIX-style forward slashes vs. Windows backslashes, follow their convention β€” WordPress accepts either, but consistency aids debugging. **Verify the path resolves** (`is_dir()` returns true) before trusting it; otherwise the Asterion Explorer will silently render an empty tree.
192
 
193
- Choose A for cleanliness (corpus lives inside the WP install, no path-resolution surprises). Choose B for "single source of truth" (corpus stays in this repo, the WP install reads through). Either is acceptable for JNO. **Discuss the trade-off with the developer; they pick.**
194
 
195
  **Verify**: filesystem readable by the web user; `01-ontology.md` and `02-invariants.md` exist at the chosen location.
196
 
 
167
 
168
  Two valid placements:
169
 
170
+ **Locked approach: mirror corpus + install pre-staged mu-plugin.**
171
 
172
  ```
173
+ # (a) Mirror the canonical corpus into the WP install
174
  mkdir -p <wp-install>/wp-content/sa-asterion
175
  cp -r <this-repo>/asterion/* <wp-install>/wp-content/sa-asterion/
 
 
 
176
 
177
+ # (b) Install the pre-staged mu-plugin (already in this repo at <repo-root>/mu-plugins/sa-orch-spec-root.php)
178
+ mkdir -p <wp-install>/wp-content/mu-plugins
179
+ cp <this-repo>/mu-plugins/sa-orch-spec-root.php <wp-install>/wp-content/mu-plugins/sa-orch-spec-root.php
 
 
 
 
 
 
 
180
  ```
181
 
182
+ The pre-staged mu-plugin points the `sa_orch_asterion_spec_root` filter at `WP_CONTENT_DIR . '/sa-asterion'`. **Do not author it from a snippet** β€” the file exists at `<repo-root>/mu-plugins/sa-orch-spec-root.php`. If missing, the seed is corrupt β€” surface to the human.
183
 
184
+ Earlier seed versions described a "Path B" pointing the filter at the repo's `asterion/` directly without mirroring. That fails on container-based stacks (DDEV) where the container only mounts `public_html/`. The mirror approach above works on every stack.
185
 
186
  **Verify**: filesystem readable by the web user; `01-ontology.md` and `02-invariants.md` exist at the chosen location.
187
 
mu-plugins/sa-orch-spec-root.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SA-Orchestration β€” Asterion spec_root override
4
+ *
5
+ * Type: mu-plugin (must-use plugin) β€” auto-loaded by WordPress;
6
+ * no activation needed; survives plugin deactivation.
7
+ *
8
+ * Purpose: Point the SA-Orchestration Asterion canonical corpus root at
9
+ * the deployed `wp-content/sa-asterion/` directory.
10
+ *
11
+ * Why it exists: The SA-Orchestration plugin's `SA_Orch_Asterion_Explorer::DEFAULT_SPEC_ROOT`
12
+ * is hardcoded to a path that exists on the source-author's machine
13
+ * (`F:/SleeperAgents/SA-orchestration/Archvie/sa-core/docs/specs`).
14
+ * On every other WordPress install β€” WPE, client deployments, leaf
15
+ * installs β€” that path doesn't exist. Without this filter, every
16
+ * Asterion query returns
17
+ * "no canonical reference found in the spec corpus (corpus root unreachable)".
18
+ *
19
+ * Deploy path: Copy this file to `<wp-install>/wp-content/mu-plugins/sa-orch-spec-root.php`.
20
+ * No `mu-plugins/` directory? Create it. WordPress auto-discovers it.
21
+ *
22
+ * Companion: The Asterion corpus directory itself must exist at
23
+ * `<wp-install>/wp-content/sa-asterion/` and contain the canonical
24
+ * spec files (`01-ontology.md`, `02-invariants.md`, `concepts/`, etc.).
25
+ * Source of those files: `F:\SleeperAgents\SA-orchestration\asterion\`
26
+ * (committed at v1.1, commit 848ee70).
27
+ *
28
+ * One file per WP install. Idempotent. No DB writes. No state.
29
+ */
30
+
31
+ defined( 'ABSPATH' ) || exit;
32
+
33
+ add_filter( 'sa_orch_asterion_spec_root', function () {
34
+ return WP_CONTENT_DIR . '/sa-asterion';
35
+ }, 5 );