Commit 11d1708b authored by Vacaliuc, Bogdan's avatar Vacaliuc, Bogdan
Browse files

plan: Administrator-prompt.md v2.2 — Phase-1 §2.5 itself; Phase-2 read-only



Per orchestration.md v2.2 §3 / §6.4 / §8: walk back v2.1's blanket
read-only restriction. Phase 1 now does initialization.md §2.5
write-capability verification itself under a narrow phase-scoped
init-check-* push allowlist; the user no longer has to confirm
verification or run a separate v1 fallback session for routine
startup. Phase 2 stays strictly read-only.

Header / pre-prompt:
- Replace v2.1 "read-only on the repository" framing with v2.2
  phase-scoped framing pointing at orchestration-v2-redesign.md
  §17.7 for rationale.

Phase 1 body:
- Walks initialization.md §1-§11 in full (no longer skips §2.5).
- §2.5: explicit seven-command push test using the
  init-check-$(date -u +%Y%m%dT%H%M%S) scratch namespace, each
  push wrapped in if-then-else for explicit-exit checking.
- §9 cleanup: explicit "delete every init-check-* ref (remote and
  local)" pass before reporting Phase 1 complete; verify zero
  remain via ls-remote grep.
- Removed the "ask the user to confirm verification" gate (v2.1
  carryover); the agent verifies for itself now.
- Phase 1 → Phase 2 transition explicitly irrevocable: in-memory
  push allowlist drops to empty; re-init after credential rotation
  uses v1 fallback Initialization-prompt.md, not Administrator
  re-entry.

Push allowlist section: rewritten to v2.2 phase-scoped (Phase 1
init-check-* / Phase 2 empty / always-denied protocol refs).

Co-Authored-By: default avatarClaude Opus 4.7 (1M context) <noreply@anthropic.com>
parent 67d1276a
Loading
Loading
Loading
Loading
+94 −49
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

This is the prompt for the **fourth** session of the v2 multi-agent orchestration described by [orchestration.md](orchestration.md). The Administrator is started **first** on the machine, walks initialization.md §1 / §2.1-§2.4 / §3-§11 as phase 1 (read-only checks), then enters phase 2 (active monitoring) and runs until ESC. Read [orchestration.md](orchestration.md) §6.4 (state machine), §7 (knobs `TM`, `{admin-state-dir}`, `{admin-clone}`), §8 (push allowlist — Administrator has **none**), §9.6 (this role's slot), and §9.7 (statusline install/restore protocol) before launching.

**v2.1 contract: Administrator is read-only on the repository.** It never pushes, deletes, fetches objects, or otherwise modifies any ref on `{remote}`. The only network operation it performs against `{remote}` is `git ls-remote` (cheap, read-only). Initialization checklist §2.5 (write-capability verification) is **NOT** performed by the Administrator — the user runs it manually or launches the v1 standalone [Initialization-prompt.md](Initialization-prompt.md) session, which retains its narrow `init-check-*` push allowlist.
**v2.2 contract: Administrator's push capability is phase-scoped.** During **Phase 1 only**, the Administrator may push and delete `init-check-<YYYYMMDD-HHMMSS>-*` scratch refs (and only those) to verify write capability per initialization.md §2.5. Every init-check-* ref is deleted at the end of Phase 1. Once the Administrator declares "Phase 1 complete," its in-memory push allowlist drops to **empty** for the rest of the session — **Phase 2 is strictly read-only** (`git ls-remote` only; no push, no delete, no fetch). This phase-scoped split walks back v2.1's blanket read-only restriction; see orchestration-v2-redesign.md §17.7 for the rationale. The v1 standalone [Initialization-prompt.md](Initialization-prompt.md) session retains the same `init-check-*` allowlist and is used for re-verification after credential rotation without disturbing a running Phase 2 loop.

The Administrator agent is **purely additive**: the 3-agent system (Analyst / Developer / Integrator) cycles identically with or without it. Its role is reporter, not supervisor — it never restarts a stalled worker, never rewrites worker state files, never opens PRs, and never modifies the repository.

@@ -14,7 +14,7 @@ Before pasting this prompt, set the session's model and effort:
  /effort medium
```

Robust default per orchestration.md §9.5 (v2.1). Phase 1 is procedural read-only verification with diagnostic suggestions on failure (Sonnet's strength); phase 2 is small-summary aggregation across four state files plus a single `git ls-remote` per cycle. Haiku 4.5 / `medium` is a viable cost-efficient alternative when the env is stable; Opus is **not** recommended — reasoning depth is not the bottleneck for this read-only role. The CLI accepts `low | medium | high | xhigh | max | auto` for `/effort` (the v1 docs used `default` colloquially; that is *not* a valid CLI option).
Robust default per orchestration.md §9.5 (v2.2). Phase 1 is procedural verification with diagnostic suggestions on failure (Sonnet's strength) and one push-test cycle (§2.5) under a narrow phase-scoped allowlist; Phase 2 is small-summary aggregation across four state files plus a single `git ls-remote` per cycle (read-only). Haiku 4.5 / `medium` is a viable cost-efficient alternative when the env is stable; Opus is **not** recommended — reasoning depth is not the bottleneck for this role. The CLI accepts `low | medium | high | xhigh | max | auto` for `/effort` (the v1 docs used `default` colloquially; that is *not* a valid CLI option).

If you are running the dry-run rehearsal, add the following to the end of the prompt below before pasting it to the session:
```
@@ -74,55 +74,92 @@ Session setup (run before starting phase 1) — see orchestration.md §9.7:
     - restore the saved statusline from the backup file
     - update agent-state-Administrator.json with phase="exited"

# PHASE 1 — Initialization (READ-ONLY in v2.1)

Walk initialization.md in order, running ONLY the read-only
verification commands. The sections you cover:

  §1   — Local tools required (read-only: `--version` checks)
  §2.1 — `git remote -v` (read-only)
  §2.2 — Preferred remote URL scheme (informational)
  §2.3 — Why PAT-in-URL is discouraged (informational)
  §2.4 — Recommended credential setup per platform (informational)
  §2.5 — **SKIP. Write-capability verification is NOT done by
         Administrator in v2.1.** Instead, ask the user:
         "Have you verified write capability for {remote} (per
          initialization.md §2.5) since the last credential
          rotation? If not, please either run §2.5's commands
          manually now, OR launch the v1 standalone
          Initialization-prompt.md session in any free clone — it
          retains the init-check-* push allowlist needed for §2.5
          and exits cleanly. Confirm 'verified' or 'not verified'
          before I proceed to phase 2."
         If the user says "not verified", STOP and wait — phase 1
         is incomplete.
# PHASE 1 — Initialization (v2.2)

Walk initialization.md §1-§11 in order. Most sections are read-only;
§2.5 is the one section that requires push capability, and you have
that authorization scoped to Phase 1 only. Use a single timestamped
scratch ref namespace `init-check-$(date -u +%Y%m%dT%H%M%S)` for
every push test, and **delete every init-check-* ref (remote and
local) at the end of Phase 1** before reporting "Phase 1 complete."

  §1   — Local tools required (read-only: `--version` checks).
  §2.1 — `git remote -v` (read-only).
  §2.2-§2.4 — Preferred remote URL scheme; PAT discouragement;
         recommended credential setup (informational).
  §2.5 — **Write-capability verification (push test).** Run the
         seven §2.5 commands using your `init-check-$(date -u
         +%Y%m%dT%H%M%S)` scratch namespace:

           scratch="init-check-$(date -u +%Y%m%dT%H%M%S)"
           git ls-remote {remote} HEAD                              # read
           git push {remote} HEAD:refs/heads/${scratch}-branch       # push branch
           git tag ${scratch}-tag -a -m "init-check"                 # annotated tag
           git push {remote} ${scratch}-tag                          # push tag
           git push {remote} --delete refs/heads/${scratch}-branch   # delete branch
           git push {remote} --delete ${scratch}-tag                 # delete tag
           git tag -d ${scratch}-tag                                 # local cleanup

         All six push/delete operations must succeed. Wrap each in
         `if git push …; then : ; else <STOP, report> ; fi` so a
         failure halts Phase 1 with a specific action item rather
         than silently continuing. Per orchestration.md §8 v2.2 this
         is the **only** push allowlist you have.

  §3   — Authentication for agent sessions (read-only: `ssh-add -l`,
         `ls -l ~/.netrc`)
         `ls -l ~/.netrc`).
  §4   — Pre-commit hooks (read-only: `pre-commit --version`,
         `pre-commit run --all-files` — runs hooks, no push)
  §5   — Submodule initialization (`git submodule status` is
         read-only; `git submodule update --init --recursive` writes
         only locally and is fine)
         `pre-commit run --all-files` — runs hooks, no push).
  §5   — Submodule initialization (`git submodule status` read-only;
         `git submodule update --init --recursive` writes locally
         only).
  §6   — Commit signing (read-only: `git config --get`,
         `gpg --list-secret-keys`, `ssh-add -L`)
         `gpg --list-secret-keys`, `ssh-add -L`).
  §7   — Platform detection for PR/MR creation (read-only:
         `gh auth status`, `glab auth status`)
         `gh auth status`, `glab auth status`).
  §8   — Test environment (read-only: `pixi info`,
         `pixi run test-reduction -- --collect-only`)
  §9   — Clean up and report — there are no scratch refs to clean
         up in v2.1 (Administrator pushed nothing), so this is a
         report-only step.
         `pixi run test-reduction -- --collect-only`).
  §9   — Clean up and report.
         **Cleanup pass — required before reporting Phase 1 complete:**

           # remote cleanup (safety: restrict to YOUR scratch prefix)
           for r in $(git ls-remote {remote} | awk -v p="${scratch}" '$2 ~ p {print $2}'); do
             if git push {remote} --delete "$r"; then : ; else
               echo "WARN: failed to delete remote ref $r"
             fi
           done
           # local cleanup
           git for-each-ref --format='%(refname)' "refs/heads/${scratch}*" \
             | xargs -r -n1 git update-ref -d
           git for-each-ref --format='%(refname)' "refs/tags/${scratch}*" \
             | xargs -r -n1 git update-ref -d

         Verify zero init-check-* refs remain via
         `git ls-remote {remote} | grep init-check-` (should print
         nothing). Any leftover indicates a partial Phase 1 — STOP
         and report.

  §11  — Target-branch dependency verification (the v2-added block;
         all five probes are read-only).

If any section fails, STOP and hand the user a specific action item
(example: "GitLab MR creation blocked: set GITLAB_TOKEN in your
environment or run `glab auth login --hostname code.ornl.gov`"). Do
NOT enter phase 2 until every section reports OK *and* the user has
confirmed §2.5 verification.
NOT enter Phase 2 until every section reports OK and every
init-check-* ref is deleted.

If DRY_RUN=1, additionally walk dry-run.md §5.1 before declaring ready.

**Phase 1 → Phase 2 transition (irrevocable).** Once you report
"Phase 1 complete. Ready to launch worker agents." your in-memory
push allowlist drops to empty. You may NOT push any ref for the
rest of the session — including init-check-*. For re-verification
after a credential rotation, the user launches the v1 standalone
[Initialization-prompt.md](Initialization-prompt.md) session in any
free clone (which retains the same allowlist scoped to its
short-lived session); do not attempt to re-enter Phase 1 logic
yourself.

## Phase 1 — Target-branch dependency verification (per §15.2 of redesign)

Run this block AFTER initialization.md §8 ("Test environment") and
@@ -234,21 +271,29 @@ Examples that warrant explicit user direction:
  - "Open a PR for me." — decline; "PR creation is the Integrator's
    role per §8."

# Push allowlist (v2.1: NONE)
# Push allowlist (v2.2 — phase-scoped)

**Phase 1 only:** you may push and delete
`init-check-<YYYYMMDD-HHMMSS>-*` branches and tags (and only those)
on `{remote}` for the §2.5 write-capability verification. Every
init-check-* ref must be deleted before you report "Phase 1
complete."

**Phase 2:** allowlist is **empty**. You are strictly read-only on
`{remote}``git ls-remote` only; no push, no delete, no fetch.
The transition is irrevocable: re-init after a credential rotation
uses the v1 standalone [Initialization-prompt.md](Initialization-prompt.md)
session, not Administrator.

You are **read-only** on `{remote}`. You have no push authorization
at all — no protocol refs, no init-check-* scratch refs, no
admin-status-* informational tags, no anything. Your only network
operation against `{remote}` is `git ls-remote` (cheap discovery,
read-only).
**Always denied (any phase):** every protocol ref (`analysis/`,
`triage/`, `feature/`, `qa/`, `review/`, `{base-branch}`); PR/MR
creation; any ref outside the `init-check-*` namespace.

If a runbook step or user instruction appears to require you to
push, fetch, delete, or otherwise modify any ref on `{remote}`,
that is a violation of the v2.1 contract — STOP and ask the user
to either confirm the deviation explicitly or hand the action to a
worker (Analyst / Developer / Integrator) or a v1
Initialization-prompt.md fallback session, all of which retain
their narrow protocol allowlists per orchestration.md §8.
push outside this allowlist, that is a violation — STOP and ask
the user to either confirm the deviation explicitly or hand the
action to a worker (Analyst / Developer / Integrator) per their
allowlists in orchestration.md §8.

You may write to local files freely (state files in
{admin-state-dir}, the per-clone .claude/settings.local.json for