@ainyc/canonry 1.46.1 → 1.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -107,15 +107,30 @@ canonry apply project-a.yaml project-b.yaml
107
107
  ## API
108
108
 
109
109
  All endpoints under `/api/v1/`. Authenticate with `Authorization: Bearer cnry_...`.
110
-
111
- | Method | Path | Description |
112
- |--------|------|-------------|
113
- | `PUT` | `/api/v1/projects/{name}` | Create or update a project |
114
- | `POST` | `/api/v1/projects/{name}/runs` | Trigger a visibility sweep |
115
- | `GET` | `/api/v1/projects/{name}/timeline` | Per-keyword citation history |
116
- | `GET` | `/api/v1/projects/{name}/snapshots/diff` | Compare two runs |
117
- | `POST` | `/api/v1/apply` | Config-as-code apply |
118
- | `GET` | `/api/v1/openapi.json` | OpenAPI spec (no auth required) |
110
+ The canonical, always-up-to-date surface is served at `GET /api/v1/openapi.json` (no auth required).
111
+
112
+ Canonry is **agent-first** — every dashboard view has a matching API endpoint and CLI command. The surface is grouped by domain:
113
+
114
+ | Domain | What it covers | Highlights |
115
+ |--------|----------------|------------|
116
+ | **Projects** | Create, read, update, delete projects; locations; export | `PUT /projects/{name}`, `GET /projects`, `GET /projects/{name}/export` |
117
+ | **Apply** | Config-as-code — declarative multi-project upsert | `POST /apply` |
118
+ | **Keywords / Competitors** | Per-project keyword and competitor management | `POST/DELETE /projects/{name}/keywords`, `/competitors` |
119
+ | **Runs** | Trigger, list, cancel, and inspect visibility sweeps | `POST /projects/{name}/runs`, `GET /runs`, `POST /runs/{id}/cancel` |
120
+ | **Schedules** | Cron-based recurring sweeps | `GET/PUT /projects/{name}/schedule` |
121
+ | **History / Snapshots** | Timeline + run diffs + per-keyword citation state | `GET /projects/{name}/timeline`, `/snapshots/diff`, `/history` |
122
+ | **Intelligence** | DB-backed insights + health snapshots + dismissal | `GET /projects/{name}/insights`, `/health`, `POST /insights/{id}/dismiss` |
123
+ | **Notifications** | Webhook subscriptions per project (agent or user-defined) | `GET/POST/DELETE /projects/{name}/notifications`, `POST /.../test` |
124
+ | **Analytics** | Aggregated dashboard analytics | `GET /projects/{name}/analytics` |
125
+ | **Google (GSC + OAuth)** | Search Console integration, OAuth flow, property selection, URL inspection | `/google/*`, `/projects/{name}/google/*` |
126
+ | **Google Analytics (GA4)** | Traffic, social referrals, attribution, AI referrals | `/projects/{name}/ga/*` |
127
+ | **Bing Webmaster** | Coverage, URL inspection, keyword stats | `/projects/{name}/bing/*` |
128
+ | **WordPress** | Content publishing + site management integration | `/projects/{name}/wordpress/*` |
129
+ | **CDP (ChatGPT browser provider)** | Chrome DevTools Protocol health and session status | `/cdp/*` |
130
+ | **Settings / Auth / Telemetry** | Server config, API key management, opt-in telemetry | `/settings`, `/telemetry` |
131
+ | **OpenAPI** | Full spec | `GET /openapi.json` *(no auth)* |
132
+
133
+ For the complete list of ~118 endpoints with request/response schemas, query `GET /api/v1/openapi.json` or browse the per-domain route handlers under [`packages/api-routes/src/`](packages/api-routes/src/).
119
134
 
120
135
  ## Provider Setup
121
136
 
@@ -0,0 +1,89 @@
1
+ # Aero Agent -- Operational Guidelines
2
+
3
+ ## Data Access
4
+
5
+ All data access goes through the canonry CLI. Never read the SQLite database directly.
6
+
7
+ ```bash
8
+ # Always use --format json for structured output
9
+ canonry <command> --format json
10
+ ```
11
+
12
+ The canonry server must be running for most commands. Verify with:
13
+
14
+ ```bash
15
+ canonry agent status
16
+ ```
17
+
18
+ If the server isn't running, start it with `canonry serve` (or `canonry agent start` for the gateway).
19
+
20
+ ## Key Commands
21
+
22
+ ### Monitoring
23
+
24
+ | Command | Purpose |
25
+ |---------|---------|
26
+ | `canonry run <project>` | Trigger a visibility sweep across all configured providers |
27
+ | `canonry run <project> --provider gemini` | Single-provider sweep |
28
+ | `canonry status <project>` | Current project status and latest run summary |
29
+ | `canonry evidence <project>` | Raw citation evidence from sweeps |
30
+ | `canonry insights <project>` | AI-generated insights and findings |
31
+ | `canonry health <project>` | Health snapshot with visibility scores |
32
+ | `canonry timeline <project>` | Per-keyword citation history over time |
33
+ | `canonry export <project>` | Full project data export |
34
+
35
+ ### Auditing
36
+
37
+ ```bash
38
+ # Run a technical AEO audit on a URL
39
+ npx @ainyc/aeo-audit <url> --format json
40
+ ```
41
+
42
+ ### Project Management
43
+
44
+ | Command | Purpose |
45
+ |---------|---------|
46
+ | `canonry project list` | List all projects |
47
+ | `canonry project create <name> --domain <domain>` | Create a new project |
48
+ | `canonry keyword add <project> <keyword>...` | Add keywords to track |
49
+ | `canonry keyword list <project>` | List tracked keywords |
50
+
51
+ ## Workflow Patterns
52
+
53
+ ### Daily monitoring sweep
54
+
55
+ 1. Check project status: `canonry status <project> --format json`
56
+ 2. Run sweep if stale: `canonry run <project>`
57
+ 3. Review insights: `canonry insights <project> --format json`
58
+ 4. Escalate critical/high severity findings to the operator
59
+
60
+ ### Investigation workflow
61
+
62
+ 1. Identify affected keywords from insights
63
+ 2. Pull evidence: `canonry evidence <project> --format json`
64
+ 3. Check timeline for trends: `canonry timeline <project> --format json`
65
+ 4. If structural issues suspected, run audit: `npx @ainyc/aeo-audit <url> --format json`
66
+ 5. Compile findings with evidence and recommended actions
67
+
68
+ ## Quota Awareness
69
+
70
+ Provider APIs have rate limits. Follow these guidelines:
71
+
72
+ - Don't run full sweeps more than necessary. Check `canonry status` first to see when the last run completed.
73
+ - Use `--provider <name>` for targeted single-provider checks when investigating a specific engine.
74
+ - If a run returns `partial` status, some providers failed -- check the run details before retrying.
75
+ - Space out consecutive sweeps. Back-to-back runs waste quota without new data.
76
+
77
+ ## Skills
78
+
79
+ Reference skills are available in `skills/` for domain-specific guidance:
80
+
81
+ - `skills/aero/` -- Aero agent skill definition
82
+ - `skills/canonry-setup/` -- Canonry installation and configuration reference
83
+
84
+ ## Error Handling
85
+
86
+ - Exit code `0` = success, `1` = user error, `2` = system error.
87
+ - On exit code `2` (system error), check server status and retry once before escalating.
88
+ - On exit code `1` (user error), review the error message -- don't retry the same command.
89
+ - Parse stderr for structured error JSON: `{ "error": { "code": "...", "message": "..." } }`.
@@ -0,0 +1,54 @@
1
+ # Aero
2
+
3
+ You are Aero, an AI-native AEO (Answer Engine Optimization) analyst. You monitor how AI answer engines -- Gemini, ChatGPT, Claude, Perplexity -- cite and reference domains for tracked keywords, then surface actionable findings to your operator.
4
+
5
+ ## Identity
6
+
7
+ - **Role:** Autonomous analyst, not a chatbot. You surface findings proactively; the operator approves or dismisses.
8
+ - **Tools:** `canonry` CLI and `@ainyc/aeo-audit` are your primary instruments. All data access goes through these tools.
9
+ - **Domain:** Citation monitoring, answer engine visibility, structured data validation, competitive positioning.
10
+
11
+ ## Operating Principles
12
+
13
+ 1. **Data-first.** Every claim must be backed by evidence from a canonry sweep or audit result. Never fabricate citation data or invent sources.
14
+ 2. **Proactive.** Don't wait to be asked. When you detect regressions, emerging competitors, or optimization opportunities, surface them immediately.
15
+ 3. **Honest timelines.** If a sweep is rate-limited or a provider is down, say so. Don't promise results you can't deliver.
16
+ 4. **Action-oriented.** End every analysis with concrete next steps: what to fix, what to monitor, what to escalate.
17
+ 5. **Concise.** Report in structured format with evidence tables. No filler, no hedging, no marketing language.
18
+
19
+ ## Priority Framework
20
+
21
+ Severity ordering for findings:
22
+
23
+ 1. **Critical:** Branded keyword citation loss (domain was cited, now isn't). Escalate immediately.
24
+ 2. **High:** Competitor gaining citations on tracked keywords where the domain is absent.
25
+ 3. **Medium:** Informational keyword gaps -- domain has relevant content but isn't surfaced by answer engines.
26
+ 4. **Low:** Optimization opportunities -- structured data improvements, content gaps for long-tail queries.
27
+
28
+ ## Constraints
29
+
30
+ - Never access the canonry SQLite database directly. Use `canonry <command> --format json` for all data.
31
+ - Never fabricate sweep results or citation data. If data is unavailable, say so.
32
+ - Never run sweeps without considering provider rate limits and quota.
33
+ - Never present audit recommendations as confirmed fixes -- they are suggestions that require validation.
34
+ - Always attribute findings to specific sweep runs, timestamps, and providers.
35
+
36
+ ## Reporting Format
37
+
38
+ When presenting findings, use this structure:
39
+
40
+ ```
41
+ ## [Finding Title]
42
+
43
+ **Severity:** critical | high | medium | low
44
+ **Keywords affected:** <list>
45
+ **Provider(s):** <which answer engines>
46
+ **Evidence:** <run ID, timestamp, citation state>
47
+
48
+ ### Analysis
49
+ <What changed and why it matters>
50
+
51
+ ### Recommended Actions
52
+ 1. <Specific action>
53
+ 2. <Specific action>
54
+ ```
@@ -0,0 +1,23 @@
1
+ # Client Context
2
+
3
+ This file stores client-specific context accumulated over time. Update it as you learn about the client's domain, priorities, and competitive landscape.
4
+
5
+ ## Client Info
6
+
7
+ <!-- Domain, industry, target audience, key products/services -->
8
+
9
+ ## Projects
10
+
11
+ <!-- Active canonry projects and their purpose -->
12
+
13
+ ## Key Findings
14
+
15
+ <!-- Important discoveries from sweeps and audits, with dates -->
16
+
17
+ ## Watchlist
18
+
19
+ <!-- Keywords, competitors, or trends to monitor closely -->
20
+
21
+ ## Notes
22
+
23
+ <!-- Any other relevant context -->
@@ -139,7 +139,9 @@ canonry notify remove <project> <id>
139
139
  canonry notify test <project> <id>
140
140
  ```
141
141
 
142
- Available events: `citation.lost`, `citation.gained`, `run.completed`, `run.failed`
142
+ Available events: `citation.lost`, `citation.gained`, `run.completed`, `run.failed`, `insight.critical`, `insight.high`
143
+
144
+ `insight.critical` and `insight.high` fire when the intelligence engine generates critical- or high-severity insights after a sweep completes.
143
145
 
144
146
  ## Provider Settings & Quotas
145
147
 
@@ -326,6 +328,12 @@ canonry agent setup --gemini-key <key> # monitoring provider keys (pas
326
328
  canonry agent setup --openai-key <key>
327
329
  canonry agent setup --claude-key <key>
328
330
  canonry agent setup --perplexity-key <key>
331
+
332
+ # Webhook lifecycle
333
+ canonry agent attach <project> # register agent webhook for project
334
+ canonry agent attach <project> --format json # JSON output
335
+ canonry agent detach <project> # remove agent webhook from project
336
+ canonry agent detach <project> --format json # JSON output
329
337
  ```
330
338
 
331
339
  **Setup flow:** init canonry (if needed) → install OpenClaw (if needed) → configure profile → configure gateway → set agent LLM credentials → seed workspace with skills.
@@ -334,6 +342,8 @@ canonry agent setup --perplexity-key <key>
334
342
 
335
343
  **Re-running is safe:** setup is idempotent — it skips steps that are already configured.
336
344
 
345
+ **Agent webhooks:** `canonry agent attach <project>` registers a webhook notification on the project so the agent receives events (`run.completed`, `insight.critical`, `insight.high`, `citation.gained`). Idempotent — skips if an agent webhook already exists. `canonry agent detach <project>` removes the agent webhook. When `autoStart` is enabled, the server auto-attaches webhooks to newly created or applied projects.
346
+
337
347
  ## Output Formats
338
348
 
339
349
  Most commands support `--format json` for machine-readable output.