Skip to content

Agent-driven install runbooks (Claude Desktop + Codex) - #2

Merged
MrBenJ merged 15 commits into
mainfrom
feat/agent-install-runbooks
May 19, 2026
Merged

Agent-driven install runbooks (Claude Desktop + Codex)#2
MrBenJ merged 15 commits into
mainfrom
feat/agent-install-runbooks

Conversation

@MrBenJ

@MrBenJ MrBenJ commented May 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds two agent-targeted install runbooks under agents/install/ — one for Claude Desktop, one for Codex CLI. Both walk a non-technical user through GCP project setup, OAuth client creation, uv tool install, account auth, and harness config wiring with patient one-step-at-a-time pacing.
  • Sub-phase 1h's "locate the downloaded client_secret" step has an explicit zero/one/many decision tree so a user with prior GCP downloads in ~/Downloads doesn't get bitten by a blind glob, and uses find ... -print0 | xargs -0 ls -lt to stay clean under zsh's NOMATCH default.
  • README gets a new "Quick install (let an agent do it)" section pointing at the runbooks; the existing manual instructions are preserved under a new "Manual install" H2 parent.

Test plan

  • ruff check . — passes
  • mypy — no issues in 14 source files
  • pytest — 88 passed
  • Phase 0 detection commands run cleanly in zsh (this machine) — no NOMATCH errors
  • Phase 1h find ... -print0 | xargs -0 ls -lt returns cleanly with zero matches
  • Phase 5 Claude Desktop jq merge preserves pre-existing mcpServers entries (verified against a scratch JSON)
  • Phase 5 Codex TOML append preserves pre-existing sections (verified against a scratch TOML)
  • README links resolve to both runbook files
  • No fabricated GCP deep-link URLs — same URL set in both runbooks
  • End-to-end smoke test in a fresh Claude Desktop install (manual — pending)
  • End-to-end smoke test in a fresh Codex CLI session (manual — pending)

🤖 Generated with Claude Code

MrBenJ and others added 12 commits May 18, 2026 23:38
End-to-end workflow skill that consumes a writing-plans plan,
branches off main, implements via TDD, opens PR, loops on Aria
code review (cap 10), squash-merges, and notifies via /aria:notify.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Default is --no-merge: after Aria approves, notify with "PR Ready
to Merge!" including any detected staging URL, then halt. --merge
preserves the original auto-squash-merge + "PR Merged!" flow.

Adds staging URL detection via GitHub Deployments API, status
check targetUrls, and known preview bot comments.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
8-task plan to build the single-file user-level skill. Each task
writes one or two phase sections + commits. Final task validates
YAML frontmatter, scans for placeholder leakage, and hands off a
manual smoke-test checklist (Aria is a live service so end-to-end
automation isn't possible).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a design spec for per-harness, agent-targeted install runbooks under
agents/install/. Covers Claude Desktop and Codex CLI in this initial pass,
with a 7-phase linear structure (preflight, GCP setup, uv install, CLI
install, account auth, harness config wiring, verify) and explicit
hand-holding tone for non-technical users.

No test added — this is a documentation-only change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
A user with prior GCP work may have multiple client_secret_*.json files
in ~/Downloads. The original spec used a blind `mv ~/Downloads/client_secret_*.json`
which fails noisily on multiple matches and risks picking the wrong file
silently. Splits 1h into "locate/confirm" and 1i "move/verify" sub-phases
with an explicit zero/one/many decision tree.

No test added — this is a documentation-only change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Seven-task plan covering the two per-harness runbooks (claude-desktop.md
and codex.md) plus the README pointer + reorganization. Tasks are
phase-by-phase for the Claude Desktop runbook, then a single-task copy +
adapt step for Codex, then README, then a final sanity sweep.

No test added — documentation-only change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds agents/install/claude-desktop.md with header, tone guidance, and
the Phase 0 (Preflight) detection block. The account-files check uses
`find` rather than a bare glob so the runbook stays portable across
bash and zsh (zsh's NOMATCH errors out on `ls foo/*.json` with no
matches, before the redirection takes effect).

Subsequent phases land in follow-up commits.

No test added — documentation-only change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Nine sub-phases (1a-1i) walking a non-technical user through GCP project
creation, API enablement, OAuth consent setup, OAuth client creation,
and client_secret.json placement.

Sub-phase 1h uses `find -maxdepth 1 -print0 | xargs -0 ls -lt` rather
than `ls ~/Downloads/client_secret_*.json` so it stays clean under zsh's
default NOMATCH option, and includes the zero/one/many decision tree
for users with prior GCP downloads in ~/Downloads.

No test added — documentation-only change.

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

Phase 2 walks the agent through bootstrapping `uv` if missing. Phase 3
runs `uv tool install .` from the repo root. Phase 4 walks the user
through `multi-google-mcp-auth add <label>` and the browser OAuth
consent flow.

Phase 4's detection check uses `find` rather than a bare glob to stay
portable across bash and zsh.

No test added — documentation-only change.

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

Phase 5 walks the agent through the read-merge-write of
~/Library/Application Support/Claude/claude_desktop_config.json, with
explicit backup before write, JSON parse-failure guarding, and
preservation of pre-existing mcpServers entries via `jq` assignment.

Phase 6 covers the restart and smoke-test prompt, with a failure-mode
diagnostic checklist for the case where Claude Desktop doesn't pick up
the new server.

Includes a closing "You're done" section listing add/list/remove and
troubleshooting pointers.

No test added — documentation-only change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mirrors agents/install/claude-desktop.md except for the harness-specific
parts:
- Title + audience intro reference Codex / TOML rather than Claude
  Desktop / JSON
- Phase 0 check #5 looks at ~/.codex/config.toml; check #6 greps for the
  [mcp_servers.multi-google] section
- Phase 5 uses a TOML append-with-backup pattern instead of `jq` JSON
  merge
- Phase 6 references restarting a `codex` session rather than Cmd+Q on
  Claude Desktop, and points at ~/.codex/log/ for diagnostics

Verified the TOML append preserves pre-existing sections on a scratch
file before committing.

No test added — documentation-only change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a "Quick install (let an agent do it)" section right after
Prerequisites that links to agents/install/claude-desktop.md and
agents/install/codex.md. The existing GCP / Install / Add account /
Wire into Claude Desktop subsections are now nested under a new
"Manual install" H2 parent — content unchanged, just demoted from
H2 to H3.

This makes the new runbooks discoverable to both humans skimming the
README and to AI agents reading the repo to figure out how to install
the server for the user.

No test added — documentation-only change.

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

@aria-teknal-studio aria-teknal-studio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings:

  1. [P1] Treat failed check lookup as a merge blockerdocs/superpowers/plans/2026-05-18-code-task.md:666

    The --merge path captures gh pr checks "$PR_URL" 2>&1 and only blocks when the output text contains fail or pending. If the checks lookup itself fails, is rate-limited, cannot reach GitHub, returns an auth error, or reports another non-green state such as cancelled/timed out/skipped, this grep can miss it and proceed to gh pr merge. In repositories without branch protection, that turns a CI verification failure into an auto-merge. Please check the gh pr checks exit status and/or consume structured JSON, and require every relevant check conclusion/status to be explicitly green before merging. Unknown/error/no-checks should fail closed.

  2. [P2] Pytest detection example skips pytest for the common pyproject casedocs/superpowers/plans/2026-05-18-code-task.md:447

    The command [ -f pyproject.toml ] || [ -f pytest.ini ] && pytest is parsed as [ -f pyproject.toml ] || ( [ -f pytest.ini ] && pytest ), so repositories with a pyproject.toml do not run pytest at all. This conflicts with the detection table immediately above and can let the generated /code-task skill push or merge Python changes without running tests. Wrap the condition, for example ([ -f pyproject.toml ] || [ -f pytest.ini ]) && pytest.

Summary:
The install runbook additions look generally careful, and local verification of the current Python gate passed (uv run ruff check . && uv run mypy && uv run pytest). CI is green for the existing Python package, but it does not exercise the new runbook/automation shell snippets. The blocking risk is in the added automation docs that can become a user-level code-changing skill.

Aria flagged that the documented Step 6.2 merge guard greps for the
literal strings 'fail|pending' in `gh pr checks` output. That string-
matching approach silently passes if the command itself errors (rate-
limit, auth failure, network), times out, or reports states it doesn't
match (cancelled, skipped, action_required), turning a CI verification
failure into an auto-merge.

Switches to the canonical signal — `gh pr checks`'s exit code — which
the live /code-task skill spec already uses. Fails closed on any
non-zero exit. The plan doc was lagging the live skill on this point.

Addresses Aria's P1 finding on PR #2. P2 (claimed bash precedence bug
in the pytest detection example) is not actually a bug: bash `||` and
`&&` are left-associative with equal precedence, so `A || B && C`
parses as `(A || B) && C` per the bash manual, which is the intended
behavior. Empirical test confirms the original snippet correctly
runs pytest when either pyproject.toml or pytest.ini is present.
Leaving Step 3.1's example unchanged.

No test added — documentation-only change.

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

MrBenJ commented May 19, 2026

Copy link
Copy Markdown
Owner Author

Thanks Aria — addressed both findings:

P1 (gh pr checks failure modes) — fixed in 9f31896. You're right. The string-grep approach silently passed on auth errors, rate limits, and cancelled/skipped/action_required states. The plan doc was lagging the live /code-task skill on this — it now uses the exit code, which fails closed on anything other than a clean pass.

P2 (pytest detection precedence) — respectfully disagree, leaving as-is. The diagnosis cites the parsing as [ -f pyproject.toml ] || ([ -f pytest.ini ] && pytest), but bash || and && have equal precedence and are left-associative (per the bash manual), so A || B && C parses as (A || B) && C. Empirical test in a scratch dir with only pyproject.toml present:

$ touch pyproject.toml
$ [ -f pyproject.toml ] || [ -f pytest.ini ] && echo "would run pytest"
would run pytest

The snippet does the intended thing. If you have evidence to the contrary (a specific bash version where this parses differently, or a POSIX-strict shell), happy to take another look — but on standard bash 3+/4+/5+ this isn't a bug. Leaving Step 3.1's example unchanged.

@aria-teknal-studio aria-teknal-studio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings:

  1. High - Account verification prints Google refresh tokens to stdout.
    Files: agents/install/claude-desktop.md:497 and agents/install/codex.md:496
    Both runbooks verify account setup with jq -e '.refresh_token' ~/.config/multi-google-mcp/accounts/<label>.json. Without >/dev/null, jq prints the actual refresh token into the terminal, agent transcript, debug logs, or any command-output capture. These tokens grant long-lived Gmail/Calendar/Drive access, so this turns a verification step into a credential disclosure. Use a non-printing predicate instead, for example:
    jq -e '(.refresh_token | type == "string" and length > 0)' ... >/dev/null.
    Also update any copied guidance in the design/spec docs if those are intended to be followed by agents.

  2. Medium - Claude Desktop wiring uses a bare command that often fails from GUI-launched apps on macOS.
    File: agents/install/claude-desktop.md:540 and agents/install/claude-desktop.md:558
    The runbook installs via uv tool install ., then writes {"command": "multi-google-mcp"} to Claude Desktop config. When Claude Desktop is launched from Finder/Dock, it commonly does not inherit the interactive shell PATH where uv places tool shims (often ~/.local/bin). The runbook can pass its own command -v multi-google-mcp detection in the terminal but still produce a Claude config that cannot start the server after restart. Capture the absolute path from command -v multi-google-mcp after install and write that path into the Claude config, or include an explicit env.PATH entry and verify it matches the actual uv tool location. The Codex runbook is less exposed because Codex is normally launched from a shell, but Claude Desktop needs the stronger path handling.

Verification:

  • uv run ruff check . passed.
  • uv run mypy passed.
  • uv run pytest passed: 88 tests.
  • GitHub PR check "pytest + ruff + mypy" is passing.

Summary:
The docs/runbooks are thorough and CI is green, but these two install-flow issues are user-facing and security/compatibility relevant. I would not merge until the token-printing verification commands are fixed and Claude Desktop uses a launch-safe server path.

Two findings, both legitimate:

P1 (High) — refresh-token leak in account verification. Phase 4's
verification ran `jq -e '.refresh_token' …` without redirecting stdout,
which printed the live Google OAuth refresh token into the agent's
output (and from there into the conversation transcript). Switches to
the boolean predicate `jq -e '.refresh_token != null'` with explicit
`>/dev/null`, and adds a NEVER rule explicitly forbidding the bare
form. Same fix applied to both runbooks.

P2 (Medium) — bare-name server command in harness configs. Claude
Desktop launched from Finder/Dock inherits launchd's minimal PATH
(/usr/bin:/bin:/usr/sbin:/sbin), not the shell PATH that includes
~/.local/bin where `uv tool install` puts binaries. The same PATH risk
applies to Codex under non-login shells or GUI wrappers. Phase 5 now
resolves the absolute path via `command -v multi-google-mcp` at write
time and stores that. Phase 5 detection also verifies the stored path
points at an executable file, so a stale bare-name entry from a prior
install is detected and overwritten on rerun. Codex's TOML write
gained an in-place replace branch (awk-based) for the same reason,
which preserves blank lines between sections.

No test added — documentation-only change.

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

MrBenJ commented May 19, 2026

Copy link
Copy Markdown
Owner Author

Round 2 addressed in 69c3862:

  • P1 (refresh-token leak) — fixed in both runbooks. Verification now uses jq -e '.refresh_token != null' … >/dev/null (boolean predicate, stdout suppressed) and an explicit NEVER rule forbidding the unredirected form.
  • P2 (bare-name command in config) — fixed in both runbooks. Phase 5 now resolves MGM_BIN="$(command -v multi-google-mcp)" at write time and stores the absolute path. Detection also verifies [ -x "$STORED_CMD" ] so a stale bare-name entry from a prior install is detected and overwritten on rerun. The Codex TOML write gained an awk-based in-place replace branch (which preserves blank lines between sections — verified on a scratch file).

@aria-teknal-studio aria-teknal-studio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings:

  1. High - The copied install-plan guidance still prints OAuth refresh tokens.
    File: docs/superpowers/plans/2026-05-19-agent-install-runbook.md:656
    The primary runbooks were fixed, but this PR still adds a plan document that tells agents to verify account setup with jq -e '.refresh_token' ~/.config/multi-google-mcp/accounts/<label>.json. If an agent follows or copies this plan, jq prints the live Google refresh token into terminal output/transcripts/logs. Since this PR is explicitly adding agent-facing install guidance, the unsafe duplicate needs the same non-printing predicate used in the runbooks, e.g. jq -e '(.refresh_token | type == "string" and length > 0)' ... >/dev/null. Please update or clearly mark the stale plan snippet as superseded so future agents do not reintroduce the credential leak.

  2. Medium - The supporting design/plan docs still encode the old bare-command harness wiring.
    Files: docs/superpowers/specs/2026-05-19-agent-install-runbook-design.md:383 and docs/superpowers/plans/2026-05-19-agent-install-runbook.md:755
    The active Claude/Codex runbooks now correctly resolve and store an absolute multi-google-mcp path, but these newly-added support docs still prescribe "command": "multi-google-mcp" / command = "multi-google-mcp". That leaves the design record contradicting the fixed runbooks and makes it easy for the next agent to regenerate or patch the runbook back to the GUI PATH bug. Please bring the spec/plan docs in sync with the absolute-path approach or mark the old snippets as obsolete.

Verification:

  • uv run ruff check . passed.
  • uv run mypy passed.
  • uv run pytest passed: 88 tests.
  • GitHub PR check "pytest + ruff + mypy" is passing.

Summary:
The active runbooks now address the previous findings, but the PR still adds stale copied guidance with the same token-disclosure and launch-path problems. Because these are agent-facing docs, I would not merge until the duplicates are corrected or explicitly deprecated.

Aria's round 3 noted that while the canonical runbooks were fixed for
the refresh-token leak (jq output redirection) and the GUI-PATH issue
(absolute path via command -v), the design spec and implementation plan
that ship in the same PR still echoed the pre-fix examples. Future
agents reading them could mimic the unsafe patterns.

Changes:
- Spec §11 verification: switch to `jq -e '.refresh_token != null' ... >/dev/null`
  with explicit rationale.
- Spec §12.1 Claude Desktop variant: introduce <MGM_BIN> placeholder,
  document the launchd-PATH rationale, update the schema and merge logic
  to use the resolved absolute path, update verification to also assert
  [ -x "$STORED_CMD" ].
- Spec §12.2 Codex variant: same MGM_BIN pattern, add the in-place
  rewrite branch for stale bare-name installs, update verification to
  parse the command back out and check executability.
- Plan Task 3 (Phase 4 verification): same refresh-token redact pattern.
- Plan Task 4 (Phase 5 Claude Desktop section): rewrite with MGM_BIN
  resolution and the executable-path verification.
- Plan Task 5 (Phase 5 Codex section): rewrite with the append-or-replace
  awk pattern and MGM_BIN.
- Plan Task 4 Step 3 sanity test: use MGM_BIN.
- Plan Task 5 Step 8 sanity test: use MGM_BIN.
- Both files now carry a "canonical source" banner at the top noting the
  runbooks are authoritative when the docs drift.

The two remaining `"command": "multi-google-mcp"` references in the
files are inside explanatory prose discussing why the bare form is
wrong — kept intentionally as cautionary examples.

No test added — documentation-only change.

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

MrBenJ commented May 19, 2026

Copy link
Copy Markdown
Owner Author

Round 3 addressed in b66085d:

  • High (refresh_token in spec/plan) — verification examples in both docs/superpowers/specs/2026-05-19-agent-install-runbook-design.md and docs/superpowers/plans/2026-05-19-agent-install-runbook.md now use the same jq -e '.refresh_token != null' … >/dev/null pattern as the runbooks, with explicit rationale.
  • Medium (bare-name commands in spec/plan) — config-edit examples updated throughout both supporting docs to introduce a <MGM_BIN> placeholder, resolve via command -v at write time, and use the awk-based in-place replace for the Codex case (matching the runbook implementation). The two remaining \"command\": \"multi-google-mcp\" strings are inside cautionary prose explaining why the bare form is wrong — intentionally kept.
  • Both supporting docs gained a "canonical source" banner at the top noting the runbooks are authoritative when prose drifts.

@aria-teknal-studio aria-teknal-studio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No findings.\n\nThe current head resolves the prior review issues:\n- The active Claude Desktop and Codex runbooks no longer print refresh tokens during account verification; the remaining matches are cautionary text explaining why the unredirected form is unsafe.\n- The active runbooks now resolve with and write an executable absolute path into harness config.\n- The supporting spec/plan docs were brought into alignment with those safety fixes and now clearly defer to the shipped runbooks as canonical.\n\nVerification:\n- All checks passed! passed.\n- Success: no issues found in 14 source files passed.\n- ........................................................................ [ 81%]
................ [100%]
88 passed in 0.28s passed: 88 tests.\n- GitHub PR check is passing.\n\nResidual risk:\nThis is documentation-only, so CI does not exercise the runbooks end-to-end in a real Claude Desktop/Codex installation. Manual install smoke testing is still the meaningful final gate for these docs.\n

@aria-teknal-studio aria-teknal-studio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No findings.

The current head resolves the prior review issues:

  • The active Claude Desktop and Codex runbooks no longer print refresh tokens during account verification; the remaining .refresh_token matches are cautionary text explaining why the unredirected form is unsafe.
  • The active runbooks now resolve multi-google-mcp with command -v and write an executable absolute path into harness config.
  • The supporting spec/plan docs were brought into alignment with those safety fixes and now clearly defer to the shipped runbooks as canonical.

Verification:

  • uv run ruff check . passed.
  • uv run mypy passed.
  • uv run pytest passed: 88 tests.
  • GitHub PR check pytest + ruff + mypy is passing.

Residual risk:
This is documentation-only, so CI does not exercise the runbooks end-to-end in a real Claude Desktop/Codex installation. Manual install smoke testing is still the meaningful final gate for these docs.

@MrBenJ
MrBenJ merged commit 3f73481 into main May 19, 2026
1 check passed
@MrBenJ
MrBenJ deleted the feat/agent-install-runbooks branch May 19, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants