Surgegraph

From mvanhorn/printing-press-library · View interactive version

Surgegraph is an AI agent skill from the GitHub repository mvanhorn/printing-press-library. SurgeGraph is the Answer Engine Optimization (AEO) platform that tracks AI citations, scores pages for citation readiness, and one-click fixes the gaps — now every workflow runs from the terminal or any agent. Trigger phrases: `what changed in SurgeGraph this week`, `AI Visibility for my project`, `

How to use this skill

Skill file

SurgeGraph — Printing Press CLI

Prerequisites: Install the CLI

This skill drives the surgegraph-pp-cli binary. You must verify the CLI is installed before invoking any command from this skill. If it is missing, install it first:

  1. Install via the Printing Press installer. It defaults binaries to $HOME/.local/bin on macOS/Linux and %LOCALAPPDATA%\Programs\PrintingPress\bin on Windows:

```bash

npx -y @mvanhorn/printing-press-library install surgegraph --cli-only

```

  1. Verify: surgegraph-pp-cli --version
  2. Ensure the reported install directory is on $PATH for the agent/runtime that will invoke this skill.

If the npx install fails (no Node, offline, etc.), fall back to a direct Go install (requires Go 1.26.6 or newer):

go install github.com/mvanhorn/printing-press-library/library/ai/surgegraph/cmd/surgegraph-pp-cli@latest

If --version reports "command not found" after install, the runtime cannot see the binary directory on $PATH. Do not proceed with skill commands until verification succeeds.

When to Use This CLI

Reach for this CLI when an agent needs to operate against SurgeGraph for any AI-search content task: monitoring AI Visibility deltas, drafting and publishing articles in bulk, auditing knowledge-library impact, or seeding another agent with a project's current state. Every visible web-app feature is also a CLI command, and every transcendence command is an MCP tool — the agent that opened the loop can close it without leaving the terminal.

Unique Capabilities

These capabilities aren't available in any other tool for this API.

Local state that compounds

_Use this when the user asks what changed in AI Visibility or wants a movers report; it answers without burning a follow-up API roundtrip._

```bash

surgegraph-pp-cli visibility delta --project proj_abc123 --window 168h --metric overview,trend --agent

```

_Pick this when the user is hunting for visibility regressions; gives the agent a ranked, actionable list instead of two raw snapshots to compare._

```bash

surgegraph-pp-cli visibility prompts losers --project proj_abc123 --since 720h --agent --select prompt_id,prompt,citation_delta,position_delta

```

_Use when monitoring competitive share-of-voice in AI answers._

```bash

surgegraph-pp-cli visibility citation-domains rank-shift --project proj_abc123 --window 720h --agent

```

_Use when prioritizing a content refresh queue._

```bash

surgegraph-pp-cli docs stale --project proj_abc123 --older-than 90 --agent --select document_id,title,last_updated,ai_traffic_30d

```

_Use when the user manages multiple projects (agency, multi-brand) and asks for an executive summary._

```bash

surgegraph-pp-cli visibility portfolio --window 168h --agent

```

_Pick this before kicking off a bulk operation to confirm you have credits._

```bash

surgegraph-pp-cli account burn --window 720h --agent

```

Cross-entity joins no single API call returns

_Pick this when the user audits knowledge libraries or asks which library is paying off._

```bash

surgegraph-pp-cli knowledge impact --project proj_abc123 --agent

```

_Use when planning a content sprint from a topic research; tells the agent exactly which subtopics still need articles._

```bash

surgegraph-pp-cli research drift --research-id res_xyz789 --project proj_abc123 --agent --select topic,parent,covered

```

_Pick this when comparing topical coverage against a named competitor._

```bash

surgegraph-pp-cli research domain diff --project proj_abc123 --mine res_xyz789 --theirs dom_res_aaa --agent

```

_Use when explaining traffic patterns or planning new content based on what's already pulling AI clicks._

```bash

surgegraph-pp-cli visibility traffic-citations --project proj_abc123 --agent --select page_url,ai_visits,citations

```

Compound workflows that span products

_Pick this when the user wants to ship articles for every gap from a topic research; collapses a multi-tab manual workflow into one call._

```bash

surgegraph-pp-cli research gaps publish --research-id res_xyz789 --project proj_abc123 --integration wp_int_456 --dry-run --agent

```

Agent-native plumbing

_Use to seed another agent's working memory with everything you know about a SurgeGraph project, in one round-trip._

```bash

surgegraph-pp-cli context bundle --project proj_abc123 --include prompts,citations,docs,topics

```

_Pick this when an agent needs to locate any signal — a prompt, a citation, a draft — across the whole local cache._

```bash

surgegraph-pp-cli search "AI search optimization" --kind prompts,citations,docs,topics --agent --select kind,id,title,snippet

```

_Run after sync to inspect cursor freshness, or in an agent loop to decide whether the local store needs to be re-synced before reading._

```bash

surgegraph-pp-cli sync diff --agent

```

Command Reference

create-ai-visibility-prompt — Manage create ai visibility prompt

create-api-key — Manage create api key

create-bulk-documents — Manage create bulk documents

create-document — Manage create document

create-domain-research — Manage create domain research

create-image — Manage create image

create-knowledge-library — Manage create knowledge library

create-knowledge-library-document — Manage create knowledge library document

create-optimized-document — Manage create optimized document

create-topic-research — Manage create topic research

create-topic-research-expansion — Manage create topic research expansion

delete-ai-visibility-prompt — Manage delete ai visibility prompt

delete-api-key — Manage delete api key

delete-document — Manage delete document

delete-knowledge-library — Manage delete knowledge library

delete-knowledge-library-document — Manage delete knowledge library document

get-ai-visibility-citation-domain — Manage get ai visibility citation domain

get-ai-visibility-citation-own-domain — Manage get ai visibility citation own domain

get-ai-visibility-citations — Manage get ai visibility citations

get-ai-visibility-config — Manage get ai visibility config

get-ai-visibility-emerging-topics — Manage get ai visibility emerging topics

get-ai-visibility-metadata — Manage get ai visibility metadata

get-ai-visibility-opportunities — Manage get ai visibility opportunities

get-ai-visibility-overview — Manage get ai visibility overview

get-ai-visibility-prompt-detail — Manage get ai visibility prompt detail

get-ai-visibility-prompt-response — Manage get ai visibility prompt response

get-ai-visibility-prompts — Manage get ai visibility prompts

get-ai-visibility-response-structure — Manage get ai visibility response structure

get-ai-visibility-sentiment — Manage get ai visibility sentiment

get-ai-visibility-topic-gaps — Manage get ai visibility topic gaps

get-ai-visibility-topics — Manage get ai visibility topics

get-ai-visibility-traffic-pages — Manage get ai visibility traffic pages

get-ai-visibility-traffic-summary — Manage get ai visibility traffic summary

get-ai-visibility-trend — Manage get ai visibility trend

get-anthropic-keys — Manage get anthropic keys

get-author-brand — Manage get author brand

get-authors — Manage get authors

get-brand-mentions — Manage get brand mentions

get-content-vision-gallery — Manage get content vision gallery

get-content-vision-settings — Manage get content vision settings

get-document — Manage get document

get-domain-research — Manage get domain research

get-gemini-keys — Manage get gemini keys

get-knowledge-libraries — Manage get knowledge libraries

get-knowledge-library-documents — Manage get knowledge library documents

get-languages — Manage get languages

get-locations — Manage get locations

get-openai-keys — Manage get openai keys

get-optimized-documents — Manage get optimized documents

get-organization-cms-integrations — Manage get organization cms integrations

get-project-cms-integration — Manage get project cms integration

get-projects — Manage get projects

get-team — Manage get team

get-topic-map — Manage get topic map

get-topic-research — Manage get topic research

get-usage — Manage get usage

get-wordpress-authors — Manage get wordpress authors

get-wordpress-categories — Manage get wordpress categories

get-wordpress-integrations — Manage get wordpress integrations

get-writer-documents — Manage get writer documents

get-writer-models — Manage get writer models

list-domain-researches — Manage list domain researches

list-topic-researches — Manage list topic researches

publish-document-to-cms — Manage publish document to cms

update-ai-visibility-prompt — Manage update ai visibility prompt

update-api-key — Manage update api key

update-document — Manage update document

update-project-cms-integration — Manage update project cms integration

Finding the right command

When you know what you want to do but not which command does it, ask the CLI directly:

surgegraph-pp-cli which "<capability in your own words>"

which resolves a natural-language capability query to the best matching command from this CLI's curated feature index. Exit code 0 means at least one match; exit code 2 means no confident match — fall back to --help or use a narrower query.

Recipes

Monday AI Visibility review

surgegraph-pp-cli visibility delta --project proj_abc123 --window 168h --agent --select brand,metric,delta_pct

Pull week-over-week movers and pipe straight into the Monday CMO update.

Trim a deeply-nested citations response

surgegraph-pp-cli get-ai-visibility-citations --project-id proj_abc123 --agent --select data.domains.domain,data.domains.citationCount

Citation responses are deeply nested; dotted-path --select keeps the payload under an agent's context budget.

Find every signal about a topic across the local cache

surgegraph-pp-cli search "AI search optimization" --kind prompt,citation,doc,topic --agent --select kind,id,title,snippet

FTS5 across all four entities in one round-trip; results are unified and rankable. Run sync first to populate the index.

Publish every gap topic to WordPress

surgegraph-pp-cli research gaps publish --research-id res_xyz789 --project proj_abc123 --integration wp_int_456 --dry-run

Compounds get_topic_map → create_bulk_documents → publish_document_to_cms; idempotent on retries.

Filter results to one citation kind from the local cache

surgegraph-pp-cli search "answer engine" --kind citation --agent

Limit FTS hits to one entity kind via --kind; combine with --limit to keep output bounded.

Auth Setup

SurgeGraph uses OAuth 2.1 against https://mcp.surgegraph.io with Authorization Code + PKCE + Dynamic Client Registration. Run surgegraph-pp-cli auth login once; the CLI registers a client, walks you through the browser flow, and stores the bearer plus refresh token for subsequent calls. auth status shows the current TTL and auth logout clears it.

Run surgegraph-pp-cli doctor to verify setup.

Agent Mode

Add --agent to any command. Expands to: --json --compact --no-input --no-color --yes.

```bash

surgegraph-pp-cli create-ai-visibility-prompt --intent example-value --agent --select id,name,status

```

Agent Feedback

When you (or the agent) notice something off about this CLI, record it:

surgegraph-pp-cli feedback "the --since flag is inclusive but docs say exclusive"
surgegraph-pp-cli feedback --stdin < notes.txt
surgegraph-pp-cli feedback list --json --limit 10

Entries are stored locally at ~/.surgegraph-pp-cli/feedback.jsonl. They are never POSTed unless SURGEGRAPH_FEEDBACK_ENDPOINT is set AND either --send is passed or SURGEGRAPH_FEEDBACK_AUTO_SEND=true. Default behavior is local-only.

Write what surprised you, not a bug report. Short, specific, one line: that is the part that compounds.

Output Delivery

Every command accepts --deliver <sink>. The output goes to the named sink in addition to (or instead of) stdout, so agents can route command results without hand-piping. Three sinks are supported:

| Sink | Effect |

|------|--------|

| stdout | Default; write to stdout only |

| file:<path> | Atomically write output to <path> (tmp + rename) |

| webhook:<url> | POST the output body to the URL (application/json or application/x-ndjson when --compact) |

Unknown schemes are refused with a structured error naming the supported set. Webhook failures return non-zero and log the URL + HTTP status on stderr.

Named Profiles

A profile is a saved set of flag values, reused across invocations. Use it when a scheduled agent calls the same command every run with the same configuration - HeyGen's "Beacon" pattern.

surgegraph-pp-cli profile save briefing --json
surgegraph-pp-cli --profile briefing create-ai-visibility-prompt --intent example-value
surgegraph-pp-cli profile list --json
surgegraph-pp-cli profile show briefing
surgegraph-pp-cli profile delete briefing --yes

Explicit flags always win over profile values; profile values win over defaults. agent-context lists all available profiles under available_profiles so introspecting agents discover them at runtime.

Exit Codes

| Code | Meaning |

|------|---------|

| 0 | Success |

| 2 | Usage error (wrong arguments) |

| 3 | Resource not found |

| 4 | Authentication required |

| 5 | API error (upstream issue) |

| 7 | Rate limited (wait and retry) |

| 10 | Config error |

Argument Parsing

Parse $ARGUMENTS:

  1. Empty, help, or --help → show surgegraph-pp-cli --help output
  2. Starts with install → ends with mcp → MCP installation; otherwise → see Prerequisites above
  3. Anything else → Direct Use (execute as CLI command with --agent)

MCP Server Installation

Install the MCP binary from this CLI's published public-library entry or pre-built release, then register it:

claude mcp add surgegraph-pp-mcp -- surgegraph-pp-mcp

Verify: claude mcp list

Direct Use

  1. Check if installed: which surgegraph-pp-cli

If not found, offer to install (see Prerequisites at the top of this skill).

  1. Match the user query to the best command from the Unique Capabilities and Command Reference above.
  2. Execute with the --agent flag:

```bash

surgegraph-pp-cli <command> [subcommand] [args] --agent

```

  1. If ambiguous, drill into subcommand help: surgegraph-pp-cli <command> --help.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.