cache-perplexity-session

A command that saves login and preference data from an already signed-in Perplexity browser session. Perplexity is a web service for searching and asking questions, and the saved session can be reused by related commands.

In plain words
What is it for?
Use it to verify a signed-in Perplexity session, capture its cookies and relevant browser preferences, and prepare the session for council-related commands.
Why use it?
It avoids repeating fragile browser clicks to choose a model or restore the session when other commands use Perplexity. It requires the user to already be logged in through Chrome.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/intellegix/intellegix-code-agent-toolkit/cache-perplexity-session
Clone the repo
git clone --depth 1 https://github.com/intellegix/intellegix-code-agent-toolkit
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,167 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01167
Opus 5 $0.00000 $0.00583
Sonnet 5 $0.00000 $0.00233
Haiku 4.5 $0.00000 $0.00117

Measured 2d ago against content hash 8c8af9291a2e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

cache-perplexity-session scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

- Write to `~/.claude/config/perplexity-session.json`:
commands/cache-perplexity-session.md · 114 lines

How it starts

The opening of the file, as written. The whole thing — 114 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/cache-perplexity-session — Cache Perplexity Login for Council Commands

Capture Perplexity session state (cookies, localStorage, model preferences) from an already-authenticated browser session. Cached data is used by /council-refine and /export-to-council to skip fragile UI model-selector clicks.

Prerequisites: User must be logged into Perplexity in Chrome. Browser-bridge MCP server running with Chrome extension connected.

Input

$ARGUMENTS = Ignored (no arguments needed).

Workflow

Step 1: Navigate to Perplexity

  • browser_navigate to https://www.perplexity.ai/
  • Wait 3 seconds for full page load (auth state must be hydrated)

Step 2: Verify logged in

  • Take a screenshot to confirm the user is logged in
  • Look for indicators: user avatar, "New Thread" button, absence of "Sign in" button
  • If NOT logged in, abort with message: "Please log into Perplexity in Chrome first, then re-run this command"

Step 3: Read session cookies

  • Use browser_evaluate to read cookies:
    document.cookie
    
  • Store the result as cookies string

Step 4: Read localStorage preferences

  • Use browser_evaluate to read relevant localStorage keys:
    JSON.stringify(Object.fromEntries(
      Object.keys(localStorage)
        .filter(k => k.includes('session') || k.includes('model') || k.includes('user') || k.includes('auth') || k.includes('token') || k.includes('pplx') || k.includes('preference'))
        .map(k => [k, localStorage.getItem(k)])
    ))
    
  • Parse the JSON result as localStorageData

Step 5: Detect current model and council state

  • IMPORTANT: Council is NOT in the model selector dropdown. It's a separate "Model council" button/chip in the input toolbar area.
  • Use browser_evaluate to check for the council button:
    (function() {
      const btn = [...document.querySelectorAll('button')].find(b => b.textContent.trim() === 'Model council');
      const modelBtn = document.querySelector('button[aria-label="Choose a model"]');
      const threeModels = document.querySelector('button[aria-label="3 models"]');
      return {
        councilButton: btn ? { found: true, classes: btn.className, active: btn.className.includes('bg-subtle') } : { found: false },
        modelSelector: modelBtn?.textContent?.trim() || 'not found',
        threeModelsDropdown: threeModels ? true : false
      };
    })()
    
  • If council button found → currentModel = "council"
  • If council button NOT found → currentModel = modelSelector text

Read the full file on GitHub · 114 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 114 lines · 0 tokens per session scan B 8c8af9291a2e

Subscribe to this mod's changes

cache-perplexity-session is a command published in the GitHub repository intellegix/intellegix-code-agent-toolkit (57 stars, last pushed 9d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,167 tokens. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.