auto
Smart router - Single entry point with natural language intent detection
Design System & Product Reverse-Engineering - Extract tokens, components, architecture, and PRDs from codebases or live products
> /plugin marketplace add nyldn/claude-octopusHow it fires
How this command gets triggered: by you, by Claude, or both.
/extractContext preview
What this command does when you run it.
Design System & Product Reverse-Engineering - Extract tokens, components, architecture, and PRDs from codebases or live products
command: extract disable-model-invocation: true description: "Design System & Product Reverse-Engineering - Extract tokens, components, architecture, and PRDs from codebases or live products" aliases: - reverse-engineer - analyze-codebase
**Your first output line MUST be:** `๐ Octopus Extract`
When the user invokes this command (e.g., `/octo:extract <target>` or `/octo:extract <target>`):
**CRITICAL: For PDF files > 10 pages, ask user which pages to extract:**
// Check if target is a PDF file
if (target.endsWith('.pdf') && isFile(target)) {
// Use Claude Octopus PDF page selection utility
const pageCount = await getPdfPageCount(target);
if (pageCount > 10) {
console.log(`๐ Large PDF detected: ${pageCount} pages`);
console.log(`Reading all pages may use ${pageCount * 750} tokens (~${Math.ceil(pageCount/133)} API calls).`);
const selection = await AskUserQuestion({
questions: [{
question: `This PDF has ${pageCount} pages. Which pages would you like to extract?`,
header: "PDF Pages",
multiSelect: false,
options: [
{label: "First 10 pages", description: "Quick overview (pages 1-10)"},
{label: "Specific pages", description: "Enter custom page range"},
{label: "All pages", description: `Full document (~${Math.ceil(pageCount/133)} API calls)`}
]
}]
});
let pageParam = "";
if (selection === "First 10 pages") {
pageParam = "1-10";
} else if (selection === "Specific pages") {
pageParam = await askForInput("Enter page range (e.g., 1-5, 10, 15-20):");
}
// else "All pages" - use empty string
// Store for use in extraction phases
target = { path: target, pages: pageParam };
console.log(`โ Will extract pages: ${pageParam || 'all'}`);
}
}**Example output:**
๐ Large PDF detected: 45 pages Reading all pages may use 33,750 tokens (~34 API calls). โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ This PDF has 45 pages. Which pages would you like to โ โ extract? โ โ โ โ โ First 10 pages โ โ Quick overview (pages 1-10) โ โ โ โ โ Specific pages โ โ Enter custom page range โ โ โ โ โ All pages โ โ Full document (~34 API calls) โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ Will extract pages: 1-10
**Parse the command arguments:**
# Expected format: # /octo:extract <target> [options] # target: URL or local directory path # options: --mode, --scope, --depth, --output, --storybook, --ignore
**Check Claude Octopus availability with the Bash tool.** Run the shared live readiness check because extraction may use an external provider:
OCTO_ROOT="${CLAUDE_PLUGIN_ROOT:-${HOME}/.claude-octopus/plugin}"
provider_helper="$OCTO_ROOT/scripts/helpers/check-providers.sh"
if [[ ! -x "$provider_helper" ]]; then
echo "ERROR: Claude Octopus provider readiness helper is unavailable. Run /octo:setup." >&2
exit 1
fi
PROVIDER_STATUS="$(OCTOPUS_PREFLIGHT_PROBE=1 "$provider_helper" 2>/dev/null || true)"
printf '%s\n' "$PROVIDER_STATUS"
READY_EXTERNAL="$(printf '%s\n' "$PROVIDER_STATUS" |
awk -F: '$1 !~ /^claude($|-)/ && $2 == "available" { print $1 }')"
if [[ -z "$READY_EXTERNAL" ]]; then
echo "No external provider is ready. Continuing extraction with Claude only."
echo "Run /octo:setup to configure an external provider."
fiTreat the emitted `provider:status` lines and `READY_EXTERNAL` as authoritative. Do not re-detect binaries or credentials inside this command.
**CRITICAL: Use AskUserQuestion to gather extraction intent:**
AskUserQuestion({
questions: [
{
question: "What do you want to extract from this codebase/URL?",
header: "Extract Mode",
multiSelect: false,
options: [
{label: "Design system only", description: "Tokens, components, Storybook scaffold"},
{label: "Product architecture only", description: "Architecture, features, PRDs"},
{label: "Both (Recommended)", description: "Complete design + product documentation"},
{label: "Auto-detect", description: "Let Claude decide based on what's found"}
]
},
{
question: "Who will use these extraction outputs?",
header: "Audience",
multiSelect: true,
options: [
{label: "Designers", description: "Need design tokens and component inventory"},
{label: "Frontend Engineers", description: "Need Storybook and component docs"},
{label: "Product/Leadership", description: "Need architecture maps and PRDs"},
{label: "AI Agents", description: "Need structured, implementation-ready outputs"}
]
},
{
question: "What should be the source of truth?",
header: "Source Priority",
multiSelect: false,
options: [
{label: "Code files (Recommended)", description: "Extract from codebase directly"},
{label: "Live UI rendering", description: "Analyze computed styles from browser"},
{label: "Both - prefer code", description: "Use code when available, infer from UI otherwise"}
]
},
{
question: "What extraction depth do you need?",
header: "Depth",
multiSelect: false,
options: [
{label: "Quick (< 2 min)", description: "Basic token/compoEvery AI model has blind spots. Claude Octopus supports twelve external provider integrations โ Codex, Antigravity CLI, Copilot, Qwen, Ollama, Perplexity, OpenRouter, OrcaRouter, OpenCode, Cursor CLI, Grok, and Kimi Code โ alongside the built-in Claude Code
Repo: nyldn/claude-octopus
Smart router - Single entry point with natural language intent detection
Start a creative thought partner brainstorming session
Switch Octopus model routing to the configured budget tier
[advanced] Activate destructive command warnings for the session
[advanced] Compatibility view of the deterministic Octopus usage report
Multi-LLM council for advice, decision support, implementation plans, and gated implementation