council-extract

A command that turns a completed Perplexity Model Council response into a structured Markdown file, including which models contributed. Perplexity Model Council is a Perplexity feature that asks several AI models for responses and combines them.

In plain words
What is it for?
Use it when a completed council response is open in a Perplexity browser tab and you want to save it to disk as Markdown.
Why use it?
It avoids manually copying and organizing a finished browser response while preserving its model attribution.

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/council-extract
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 4,638 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.04638
Opus 5 $0.00000 $0.02319
Sonnet 5 $0.00000 $0.00928
Haiku 4.5 $0.00000 $0.00464

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

Security

Grade A, and why

council-extract scanned grade A with 0 findings 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 3d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/council-extract.md · 447 lines

How it starts

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

/council-extract — Extract Model Council Response to Markdown

Extract a completed Perplexity Model Council response from the current browser tab, converting it to structured markdown with model attribution, and save to disk.

Input

$ARGUMENTS = Optional output filename or tabId. Defaults to timestamped name. If a number, treated as tabId.

Prerequisites

  • Browser-bridge MCP server running with Chrome extension connected
  • A completed Model Council response visible in an active Perplexity tab
  • Read ~/.claude/perplexity-selectors.json for CSS selectors

Workflow

Step 1: Identify the target tab

  • browser_get_tabs to find tabs with perplexity.ai URLs
  • If $ARGUMENTS is a number, use that as the specific tabId
  • Otherwise use the most recently active Perplexity tab in the current session group
  • If no Perplexity tab found, error: "No Perplexity tab found. Navigate to a council response first."
  • Store the target tabId for all subsequent tool calls

Step 2: DOM Recon (adaptive selector discovery)

Run browser_evaluate on the target tab with this script to discover the actual DOM structure:

(() => {
  const results = {
    proseBlocks: document.querySelectorAll('.prose').length,
    proseFallback: document.querySelectorAll("[class*='prose']").length,
    modelNames: [],
    modelRows: [],
    completedIndicators: 0,
    thinkingSteps: 0,
    hasCloseButton: false,
    hasThreeDotMenu: false,
    pageUrl: location.href,
    pageTitle: document.title,
    queryText: ''
  };

  // Find model name elements — look for short text matching known model patterns
  const MODEL_PATTERNS = [/Claude/i, /GPT/i, /Gemini/i, /Llama/i, /Grok/i, /Mistral/i, /Sonar/i, /DeepSeek/i];
  document.querySelectorAll('div, span').forEach(el => {
    const text = el.textContent?.trim();
    if (text && text.length < 40 && MODEL_PATTERNS.some(p => p.test(text))) {
      // Check this isn't a huge container — should be a leaf-ish element
      if (el.children.length <= 3 && !results.modelNames.includes(text)) {
        results.modelNames.push(text);
      }
    }
  });

  // Try configured selectors
  const selectors = {
    councilModelRow: "[class*='interactable'][class*='appearance-none']",
    councilModelRowFallback: "[class*='gap-x-xs'][class*='items-center']",
    councilModelName: "div[class*='font-sans'][class*='text-xs'][class*='font-medium']",
    councilCompletedIndicator: "[class*='Completed'], svg[class*='check']",
    councilThinkingSteps: "[class*='steps']",
    councilPanelClose: "button[aria-label='Close']",
    councilThreeDotMenu: "button[aria-label='More'], [class*='overflow']"
  };

  results.modelRows = document.querySelectorAll(selectors.councilModelRow).length ||
    document.querySelectorAll(selectors.councilModelRowFallback).length;
  results.completedIndicators = document.querySelectorAll(selectors.councilCompletedIndicator).length;
  results.thinkingSteps = document.querySelectorAll(selectors.councilThinkingSteps).length;
  results.hasCloseButton = !!document.querySelector(selectors.councilPanelClose);
  results.hasThreeDotMenu = !!document.querySelector(selectors.councilThreeDotMenu);

  // Try to extract query text from the page
  const askInput = document.querySelector('#ask-input');
  if (askInput) results.queryText = askInput.textContent?.trim() || '';
  // Also try the first user message block
  if (!results.queryText) {
    const userMsg = document.querySelector('[class*="query"], [class*="question"]');
    if (userMsg) results.queryText = userMsg.textContent?.trim().slice(0, 200) || '';
  }

  return results;
})()

Read the full file on GitHub · 447 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. 3d ago First seen · 447 lines · 0 tokens per session scan A 9a248056b004

Subscribe to this mod's changes

council-extract 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 4,638 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.