Skip to content

docs: add Claude Desktop + Codex desktop install paths#509

Draft
murataslan1 wants to merge 9 commits into
mksglu:nextfrom
murataslan1:docs/readme-desktop-platforms
Draft

docs: add Claude Desktop + Codex desktop install paths#509
murataslan1 wants to merge 9 commits into
mksglu:nextfrom
murataslan1:docs/readme-desktop-platforms

Conversation

@murataslan1
Copy link
Copy Markdown
Contributor

Why

Claude Desktop and the Codex desktop app weren't covered in the README. /plugin slash command isn't available in Claude Desktop UI (verified empirically — the model returns /plugin isn't available in this environment.), so the plugin marketplace install isn't a viable path there.

What's in

  • README: new Claude Desktop section between Claude Code and Gemini CLI — manual MCP install via claude_desktop_config.json, three verification prompts, troubleshooting (PATH, ABI mismatch), npx-on-demand alternative.
  • README: Codex section updated — header now reads "Codex CLI + Codex Desktop", prerequisites mention the desktop app, and Verify splits into CLI (terminal) and Desktop (chat prompts). The CLI and desktop app share ~/.codex/, so the existing install steps already cover both.
  • README: a Diagnostic line at the bottom of each section pointing to a debug script.
  • scripts/ctx-debug-claude-desktop.sh — checks Claude.app, claude_desktop_config.json, MCP log (recent failures only), better-sqlite3 ABI, plugin cache cohabitation.
  • scripts/ctx-debug-codex-desktop.sh — checks Codex.app, ~/.codex/config.toml, hooks.json (per-event registration + hardcoded-nvm-path detection), AGENTS.md routing, session/log dirs.

Both scripts are read-only, redact secrets, and write a paste-ready markdown report to ~/ctx-debug-{claude,codex}-desktop-<ts>.md.

Verified empirically

Smoke-test prompt (ctx_doctor + ctx_execute + ctx_batch_execute + ctx_stats) ran clean on both desktops. Debug scripts validated against the same setup:

  • ctx-debug-claude-desktop.sh: 9 PASS / 0 FAIL / 0 WARN
  • ctx-debug-codex-desktop.sh: 17 PASS / 0 FAIL / 2 WARN — the warnings caught a real config gap (UserPromptSubmit + Stop hooks missing in the tester's ~/.codex/hooks.json), which is exactly the beta-tester signal these scripts are meant to surface.

Notes for review

  • Diagnostic curl URLs target mksglu/context-mode/main and only go live post-merge. For pre-merge review, the scripts can be run directly from a PR branch checkout.
  • Related to Beta testers wanted — 15 platforms × 3 operating systems #45 — adds OS/platform coverage for desktop apps that beta testers were missing a reference for.

Copilot AI review requested due to automatic review settings May 10, 2026 14:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds installation/verification guidance for Claude Desktop and Codex Desktop to the README, plus two new paste-ready diagnostic scripts to help beta testers report actionable desktop-specific failures (MCP config, hooks, logs, runtime issues).

Changes:

  • README: document Claude Desktop MCP-only install flow (manual claude_desktop_config.json), verification prompts, troubleshooting, and a diagnostic script link.
  • README: expand Codex section to cover both CLI + desktop, split verification instructions, and add a diagnostic script link.
  • Scripts: add ctx-debug-claude-desktop.sh and ctx-debug-codex-desktop.sh to generate redacted markdown reports for issue filing.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.

File Description
README.md Adds Claude Desktop install/verify/troubleshooting section and updates Codex docs to cover desktop + links to new debug scripts.
scripts/ctx-debug-claude-desktop.sh New Claude Desktop-focused diagnostic script (config, PATH, logs) with redaction and report generation.
scripts/ctx-debug-codex-desktop.sh New Codex Desktop/CLI diagnostic script (config, hooks, routing, sessions/logs) with redaction and report generation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/ctx-debug-claude-desktop.sh Outdated
Comment on lines +46 to +58
# Use Python for JSON parsing (preinstalled on macOS)
json_get() {
local file="$1" path="$2"
python3 -c "import json,sys
try:
d = json.load(open('$file'))
keys = '''$path'''.split('.')
for k in keys:
if k: d = d[k]
if isinstance(d, list): d = ' '.join(map(str, d))
print(d)
except (KeyError, TypeError, FileNotFoundError, json.JSONDecodeError):
print('')" 2>/dev/null
Comment thread scripts/ctx-debug-claude-desktop.sh Outdated
Comment on lines +27 to +29
-e 's/(ghp_[A-Za-z0-9]{4})[A-Za-z0-9]+/\1***REDACTED***/g' \
-e 's/("(token|secret|password|apiKey|api_key|auth|authorization)"[[:space:]]*:[[:space:]]*")([^"]{4})[^"]*/\1\3***REDACTED***/g' \
-e 's|(https?://[^:]+:)[^@]+(@)|\1***REDACTED***\2|g'
Comment thread scripts/ctx-debug-claude-desktop.sh Outdated
Comment on lines +63 to +64
# Tee output to both terminal and report file.
exec > >(tee "$OUT")
Comment thread README.md
Comment on lines +153 to +154
3. In Claude Desktop, go to Settings → Projects → New Project. Paste the contents of `node_modules/context-mode/configs/claude-code/CLAUDE.md` into the **Custom Instructions** field. Without this, the model falls back to raw `Bash`/`Read` for ~40% of operations.

Comment thread scripts/ctx-debug-codex-desktop.sh Outdated
Comment on lines +184 to +200
echo "## 5. hooks.json"
HOOKS="$CODEX_DIR/hooks.json"
if [[ -r "$HOOKS" ]]; then
ok "hooks.json exists"
if python3 -m json.tool "$HOOKS" >/dev/null 2>&1; then
ok "valid JSON"

# Inspect each event
EVENTS=("PreToolUse" "PostToolUse" "SessionStart" "UserPromptSubmit" "Stop")
for ev in "${EVENTS[@]}"; do
HAS="$(python3 -c "import json; d=json.load(open('$HOOKS')); print('yes' if '$ev' in d.get('hooks',{}) else 'no')" 2>/dev/null)"
if [[ "$HAS" == "yes" ]]; then
ok "$ev hook registered"
else
wn "$ev hook missing — context-mode session continuity may degrade."
fi
done
Comment thread scripts/ctx-debug-codex-desktop.sh Outdated
Comment on lines +47 to +65
# Extract a TOML scalar (best-effort, handles `key = "value"` and `key = value`).
toml_get() {
local file="$1" section="$2" key="$3"
awk -v sec="[$section]" -v k="$key" '
BEGIN { in_section = 0 }
/^\[/ { in_section = ($0 == sec); next }
in_section && $1 == k {
sub(/^[^=]*=[[:space:]]*/, "")
gsub(/^"|"$/, "")
print
exit
}
' "$file" 2>/dev/null
}

# Check whether a TOML section exists.
toml_has_section() {
grep -q "^\[$1\]" "$2" 2>/dev/null
}
Comment thread scripts/ctx-debug-codex-desktop.sh Outdated
fi
if [[ -d "$CODEX_DIR/log" ]]; then
ok "log dir present"
LATEST_LOG="$(find "$CODEX_DIR/log" -name '*.log' -type f 2>/dev/null | head -1)"
Comment thread scripts/ctx-debug-codex-desktop.sh Outdated
Comment on lines +28 to +30
-e 's/(ghp_[A-Za-z0-9]{4})[A-Za-z0-9]+/\1***REDACTED***/g' \
-e 's/("(token|secret|password|apiKey|api_key|auth|authorization)"[[:space:]]*:[[:space:]]*")([^"]{4})[^"]*/\1\3***REDACTED***/g' \
-e 's|(https?://[^:]+:)[^@]+(@)|\1***REDACTED***\2|g'
Comment thread scripts/ctx-debug-codex-desktop.sh Outdated

# ─── start ────────────────────────────────────────────────────────────────────

exec > >(tee "$OUT")
@murataslan1 murataslan1 force-pushed the docs/readme-desktop-platforms branch from 0d28f85 to 85e0852 Compare May 10, 2026 18:03
Claude Desktop's /plugin slash command isn't available in the desktop UI
(verified empirically), so plugin marketplace install isn't a viable path
there. README adds an MCP-only install block via claude_desktop_config.json
with three verification prompts and troubleshooting for PATH and ABI mismatch.

Codex CLI and the Codex desktop app share ~/.codex/, so the existing
install steps already cover both. Header now reads "Codex CLI + Codex
Desktop", desktop app appears in prerequisites, and Verify splits into
CLI (terminal) and Desktop (chat prompts).

Extends scripts/ctx-debug.sh with desktop-specific checks instead of
introducing parallel scripts: Claude.app / Codex.app version detection,
claude_desktop_config.json (macOS + Windows paths), and a
hardcoded-nvm-path warning for hook command paths that silently die
after \`nvm install <newer>\`. README diagnostic lines point to the
single canonical script.
@murataslan1 murataslan1 force-pushed the docs/readme-desktop-platforms branch from 85e0852 to ecb318e Compare May 10, 2026 18:07
@murataslan1
Copy link
Copy Markdown
Contributor Author

Amended after a closer look at scripts/ctx-debug.sh — original draft added two parallel scripts (ctx-debug-claude-desktop.sh + ctx-debug-codex-desktop.sh), but ~70% of the Codex one duplicated existing sections (Adapter Detection, Config Files, Hook Validation). Reshaped to extend the canonical script instead.

Three minimal additions to scripts/ctx-debug.sh:

  • Section 1 (System Info): Claude.app + Codex.app version detection via CFBundleShortVersionString (macOS only).
  • Section 6 (Config Files): claude_desktop_config.json check — macOS (~/Library/Application Support/Claude/...) and Windows (%APPDATA%\Claude\...). Existing script only covered ~/.claude/settings.json (Claude Code, not Desktop).
  • Section 7 (Hook Validation): hardcoded-nvm-path warning. Hook commands like node /Users/x/.nvm/versions/node/v22.X.Y/... silently die after nvm install <newer> — pattern picked up in both ~/.codex/hooks.json and ~/.claude/settings.json.

Verified on macOS 15.5: all three checks fire. The nvm warn caught a real config gap in my own setup (Codex hooks.json + Claude settings.json both had hardcoded paths from an older nvm version). Smoke test (ctx_doctor + ctx_execute + ctx_batch_execute + ctx_stats) passes on both Claude Desktop and Codex Desktop with the documented install steps.

Diff is now +128 / -5 (was +654 / -4). README diagnostic lines point to the single canonical scripts/ctx-debug.sh.

Related to #45 — adds the OS/platform install reference beta testers were missing for the two desktop apps.

@murataslan1 murataslan1 force-pushed the docs/readme-desktop-platforms branch from e3691b6 to ab5360a Compare May 10, 2026 18:28
The README diagnostic line uses `bash <(curl -fsSL .../ctx-debug.sh)`.
That lands SCRIPT_DIR in /dev/fd so SCRIPT_DIR/.. resolves to /dev —
not a context-mode checkout. The script then reports 17 false-negative
failures (package.json, build/, hooks/*.mjs, server.bundle.mjs,
better-sqlite3, FTS5, etc.) which look like a broken install.

Now falls back to common install locations after the existing detection:
  1. ~/.claude/plugins/cache/context-mode/context-mode/<latest>/
  2. $(npm root -g)/context-mode
  3. /opt/homebrew/lib/node_modules/context-mode
  4. /usr/local/lib/node_modules/context-mode

Each candidate is validated by checking that package.json declares
"name": "context-mode" before adopting it. Verified locally on macOS:
17 failures collapse to 1 (unrelated -shm orphan check).
@murataslan1 murataslan1 force-pushed the docs/readme-desktop-platforms branch from ab5360a to 9782e31 Compare May 10, 2026 18:32
@murataslan1
Copy link
Copy Markdown
Contributor Author

Two updates, one of them a recovery note — sorry in advance.

Recovery note: Your Merge branch 'main' into docs/readme-desktop-platforms commit (e3691b6) was briefly force-pushed over while I was preparing a follow-up fix. I noticed immediately, reset the branch back to your merge state, and applied the new commit on top instead of replacing it. The merge is restored — current head: 9782e31e3691b6 (your merge) → ecb318e (original work).

The follow-up fix: Empirical testing surfaced a real UX problem with the README's diagnostic line. bash <(curl -fsSL …/ctx-debug.sh) lands SCRIPT_DIR in /dev/fd, so SCRIPT_DIR/.. resolves to /dev — not a context-mode checkout. The script then reports 17 false-negative failures (package.json, build/, hooks/*.mjs, server.bundle.mjs, better-sqlite3, FTS5, etc.) that look like a broken install. Real test output from a beta-tester perspective:

context-mode diagnostic v2.0.0
─────────────────────────────
13 passed, 17 failed, 4 warnings

Failed:
  ✗ package.json at plugin root
  ✗ build/ directory exists
  ✗ hooks/pretooluse.mjs exists
  …

9782e31 adds an auto-detect fallback after the existing SCRIPT_DIR/.. resolution. If PLUGIN_ROOT/package.json doesn't declare "name": "context-mode", probe in order:

  1. ~/.claude/plugins/cache/context-mode/context-mode/<latest>/ (sorted by sort -V)
  2. $(npm root -g)/context-mode
  3. /opt/homebrew/lib/node_modules/context-mode
  4. /usr/local/lib/node_modules/context-mode

Each candidate is validated by checking the package.json name field before adopting it.

Verified locally on macOS 15.5: bash <(curl …) invocation goes from 17 → 1 failure (the 1 is unrelated -shm orphan check). Local repo invocation (bash scripts/ctx-debug.sh) still works exactly as before — the new fallback only kicks in when explicit detection fails.

@mksglu mksglu marked this pull request as draft May 13, 2026 15:51
@murataslan1
Copy link
Copy Markdown
Contributor Author

Quick note for context: this PR is purely docs + debug-script and is orthogonal to #547 — no Codex hook matchers or mcp__(?!...) patterns are touched here.

I separately audited #547 against main and confirmed the look-around drop in 675fec6 plus the universal-bundle alignment in 16e2bfc. The full regression-audit prompt I'm using (verdict, evidence, and a self-contained Codex prompt that re-validates both configs/codex/hooks.json and hooks/hooks.json) is here for reference:

https://gist.github.com/murataslan1/8c2196c122b91c7cbb79d3454815436e

Happy to keep that audit work in a separate PR if it ever finds something the existing tests don't already cover. This one stays scoped to the README and debug-script changes.

@mksglu mksglu marked this pull request as ready for review May 14, 2026 17:44
@mksglu mksglu changed the base branch from main to next May 14, 2026 17:45
@mksglu mksglu marked this pull request as draft May 14, 2026 17:46
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.

3 participants