Skill: dannyshmueli/agent-analytics-autoresearch (version 1.0.9)

--- name: agent-analytics-autoresearch description: "Run an autoresearch-style growth loop for landing pages, onboarding, pricing, and experiment candidates. Collect or read analytics snapshots, preserve product truth, generate/critique/synthesize variants, blind-rank with Borda scoring, and output two review-ready A/B test variants. Works with any analytics data; best with Agent Analytics CLI/API." version: 1.0.9 author: dannyshmueli license: MIT repository: https://github.com/Agent-Analytics/skills homepage: https://agentanalytics.sh compatibility: Requires a coding agent that can read and write local files. Agent Analytics data collection requires npx and browser approval or detached login. The loop can also run from pasted reports, SQL output, CSV exports, or existing analytics files. tags: - analytics - autoresearch - growth - experiments - ab-testing - landing-pages provides: - capability: autoresearch - capability: ab-testing - capability: growth-experiments - capability: landing-page-optimization metadata: openclaw: requires: anyBins: - npx --- # Agent Analytics Autoresearch Use this skill when the user wants a data-informed growth loop for landing pages, onboarding, pricing, CTAs, signup, checkout, activation, or other experiment candidates. This skill is based on: - Autoresearch Growth template: <https://github.com/Agent-Analytics/autoresearch-growth> - Agent Analytics: <https://agentanalytics.sh> - Regular Agent Analytics skill: <https://github.com/Agent-Analytics/skills/tree/main/skills/agent-analytics> Use the regular `agent-analytics` skill for general setup, tracking installation, ad hoc reporting, and normal experiment operations. Use this skill for structured variant generation and judging from a project brief plus analytics data. ## Core Rule Do not edit production copy, product code, or live experiment setup while running the loop unless the user explicitly asks. Produce reviewable artifacts first. Default mode is review-only: generate variants, log rounds, and write `final_variants.md`. After explicit human approval, continue into the outer experiment loop when requested: implement the approved variant or variants, create the experiment, run it, measure it with Agent Analytics or another analytics source, save the results as the next snapshot, and start the next autoresearch run from evidence. ## Inputs The loop needs: - target surface - current control copy - product truth - audience - primary metric - proxy metric - guardrails - analytics snapshot or data brief - drift constraints Agent Analytics is preferred, but not required. Accept any evidence source: Agent Analytics CLI/API, PostHog, GA4, Mixpanel, SQL, CSV exports, product logs, dashboard screenshots summarized by the user, or hand-written notes. When Agent Analytics is the evidence source, use project context as the self-improving product memory for the loop. Read `context get <project>` before collecting a snapshot, fold `project_context` into the product truth and metric definitions, and keep activation/event meaning separate per project or domain. After a human correction, scanner result, completed experiment, or repeated measured finding, update context only with durable product truth. Save activation definitions, event meanings, stable goals, and confirmed interpretations; skip weekly numbers, temporary spikes, pasted reports, PII, and unconfirmed guesses. ## Quick Start If the user already has a repo or run folder, work there. Otherwise initialize a run: ```bash bash <skill_dir>/scripts/init_autoresearch_run.sh homepage-signup ``` Then fill `brief.md`, collect or paste data, and run the loop: ```text Read brief.md and run the autoresearch growth loop. Use the latest data snapshot. Run 5 rounds. Append one row per round to results.tsv and write final_variants.md with two distinct variants for review. ``` When using Agent Analytics, collect a snapshot: ```bash bash <skill_dir>/scripts/collect_agent_analytics_snapshot.sh my-site signup cta_click ``` If `<skill_dir>` is not obvious in the runtime, read the script from this skill's `scripts/` folder and run an equivalent local command. ## References Load these files only when needed: - `references/program.md` - exact loop instructions. - `references/brief-template.md` - project brief template. - `references/final-variants-template.md` - final output template. - `references/results-header.txt` - exact `results.tsv` header. ## Loop Shape ### Inner Autoresearch Loop 1. Define the surface, control, audience, product truth, metric, proxy, and guardrails. 2. Collect or read a dated analytics snapshot. 3. Summarize useful signals and data limitations. 4. Generate candidate A. 5. Critique A harshly for genericness, drift, unsupported claims, weak conversion intent, and competitor-sayable language. 6. Write candidate B from the critique. 7. Synthesize AB from the strongest parts of A and B. 8. Blind-rank A, B, and AB with Borda scoring. 9. Append one TSV-safe row to `results.tsv`. 10. Repeat several rounds. 11. Write `final_variants.md` with two distinct variants and the recommended experiment shape. ### Outer Experiment Loop Only run this phase when the user explicitly approves implementation or experiment setup. 1. Implement the approved variant or variants in the target product surface. 2. Create the experiment with a control and the approved candidate variants. 3. Verify tracking for the primary metric, proxy metric, and guardrails. 4. Let the experiment collect real behavior for the requested window. 5. Pull experiment results, screenshots or changed-copy notes, funnel movement, guardrails, and data limitations into a new snapshot. 6. Start the next inner autoresearch loop from that measured evidence. The outer loop prevents the LLM panel from becoming the final judge. LLMs generate and criticize, humans approve risk, and users decide what worked. ## Agent Analytics Snapshot Use the official CLI when collecting live Agent Analytics data: ```bash npx --yes @agent-analytics/cli@0.5.31 insights "$PROJECT_SLUG" --period 7d npx --yes @agent-analytics/cli@0.5.31 pages "$PROJECT_SLUG" --since 7d npx --yes @agent-analytics/cli@0.5.31 funnel "$PROJECT_SLUG" --steps "page_view,$PROXY_EVENT,$PRIMARY_EVENT" --since 7d npx --yes @agent-analytics/cli@0.5.31 events "$PROJECT_SLUG" --event "$PROXY_EVENT" --days 7 --limit 50 npx --yes @agent-analytics/cli@0.5.31 events "$PROJECT_SLUG" --event "$PRIMARY_EVENT" --days 7 --limit 50 npx --yes @agent-analytics/cli@0.5.31 experiments list "$PROJECT_SLUG" ``` If login is needed, prefer the regular `agent-analytics` skill's browser approval or detached login guidance. Before interpreting the snapshot, also read the compact project memory: ```bash npx --yes @agent-analytics/cli@0.5.31 context get "$PROJECT_SLUG" ``` If the autoresearch run reveals durable product truth that should guide future analytics, use the regular `agent-analytics` skill's project context workflow to read the existing context, merge the compact update, and write it back. Do not store raw round notes or time-bound metric values as project context. ## Scoring Use Borda scoring: - first place: 2 points - second place: 1 point - third place: 0 points Judge by: - specificity to the product - clarity for the target audience - likely primary-event intent - preservation of product truth - low competitor-sayable language - fit with analytics data - respect for guardrails ## Output `final_variants.md` must include: - candidate_1 - candidate_2 - exact changed copy - rationale - risks - recommended experiment name - experiment shape - data limitations - clear note that the experiment has not been wired yet Only create or wire an experiment after explicit human approval.

path: references/brief-template.md
content: # Growth Loop Brief

## Target

- Project:
- Surface:
- Public URL:
- Local source file or copy source:
- Primary metric:
- Proxy metric:
- Guardrail metrics:
- Recommended experiment name:
- Variant shape:

```text
variants: control,candidate_1,candidate_2
goal: <primary_event>
proxy: <proxy_event>
```

## Product Truth

Describe what the product is, who it serves, and what must remain true in every candidate.

Include:

- core promise
- target audience
- strongest differentiator
- language the product should own
- claims the product can support
- claims the product should not make

## Audience

Primary audience:

-

Pain:

-

Desired action:

-

## Current Control

Headline:

```text

```

Subheadline:

```text

```

Primary CTA:

```text

```

Supporting copy:

```text

```

## Analytics Commands Or Data

List commands, API calls, SQL queries, exports, or pasted data the agent should use before generating variants.

Agent Analytics CLI example:

```bash
# Run once if this machine or agent runtime is not logged in.
npx --yes @agent-analytics/cli@0.5.31 login

PROJECT_SLUG=<project_slug>
PRIMARY_EVENT=<primary_event>
PROXY_EVENT=<proxy_event>
RUN_DATE=$(date +%F)

mkdir -p "data/$RUN_DATE"

# Keep collecting the full snapshot even if one analytics command fails.
# Failed commands write their error output and exit code into the saved file.
run_snapshot_command() {
  output_file="$1"
  shift
  set +e
  "$@" > "$output_file" 2>&1
  command_status=$?
  set -e
  perl -i -pe 's/\e\[[0-9;]*m//g' "$output_file"
  if [ "$command_status" -ne 0 ]; then
    printf '\ncommand_exit_code: %s\n' "$command_status" >> "$output_file"
  fi
}

run_snapshot_command "data/$RUN_DATE/insights.txt" npx --yes @agent-analytics/cli@0.5.31 insights "$PROJECT_SLUG" --period 7d
run_snapshot_command "data/$RUN_DATE/pages.txt" npx --yes @agent-analytics/cli@0.5.31 pages "$PROJECT_SLUG" --since 7d
run_snapshot_command "data/$RUN_DATE/funnel.txt" npx --yes @agent-analytics/cli@0.5.31 funnel "$PROJECT_SLUG" --steps "page_view,$PROXY_EVENT,$PRIMARY_EVENT" --since 7d
run_snapshot_command "data/$RUN_DATE/${PROXY_EVENT}-events.txt" npx --yes @agent-analytics/cli@0.5.31 events "$PROJECT_SLUG" --event "$PROXY_EVENT" --days 7 --limit 50
run_snapshot_command "data/$RUN_DATE/${PRIMARY_EVENT}-events.txt" npx --yes @agent-analytics/cli@0.5.31 events "$PROJECT_SLUG" --event "$PRIMARY_EVENT" --days 7 --limit 50
run_snapshot_command "data/$RUN_DATE/experiments.txt" npx --yes @agent-analytics/cli@0.5.31 experiments list "$PROJECT_SLUG"
```

Generic placeholders:

```bash
<analytics-command> summary --project <project> --period 7d
<analytics-command> pages --project <project> --period 7d
<analytics-command> events --project <project> --event <proxy_event> --period 7d
<analytics-command> events --project <project> --event <primary_event> --period 7d
<analytics-command> funnel --project <project> --steps "page_view,<proxy_event>,<primary_event>"
<analytics-command> experiments --project <project> list
```

## Live Data Snapshot

Summary:

-

Primary event:

-

Proxy event:

-

Guardrails:

-

Data limitations:

-

## Drift Constraints

Candidates must not:

-

Candidates should:

-

## Judging Rubric

Rank candidates by:

- specificity to this product
- clarity for the target audience
- likely primary-event intent
- preservation of product truth
- low competitor-sayable language
- fit with available analytics data


path: references/final-variants-template.md
content: # Final Variants

## Target Experiment

```text
experiment:
variants: control,candidate_1,candidate_2
goal:
proxy:
```

The experiment has not been wired yet.

## Control

Headline:

```text

```

Subheadline:

```text

```

Primary CTA:

```text

```

Supporting copy:

```text

```

## Candidate 1

Headline:

```text

```

Subheadline:

```text

```

Primary CTA:

```text

```

Supporting copy:

```text

```

Hypothesis:

Risks:

## Candidate 2

Headline:

```text

```

Subheadline:

```text

```

Primary CTA:

```text

```

Supporting copy:

```text

```

Hypothesis:

Risks:

## Why These Two

## Data Notes

## Next Step


path: references/program.md
content: # Autoresearch Growth Loop

You are running an instruction-driven growth loop. Produce two high-quality variants that can be tested against the current control for the project described in `brief.md`.

Do not change product code while running the loop. Produce reviewable copy artifacts first.

Default mode is review-only. Only move into implementation, experiment creation, or measurement after the user explicitly approves that next phase.

## Setup

1. Read `brief.md` fully.
2. Treat `brief.md` as the source of truth for the project, audience, surface, control, metrics, analytics data, and drift constraints.
3. If `results.tsv` does not exist, create it with:

```tsv
round	candidate_a	candidate_b	candidate_ab	winner	borda_a	borda_b	borda_ab	status	rationale
```

4. If `final_variants.md` exists, overwrite it only at the end of a completed loop.

## Data Brief

Before generating copy, collect or read the data described in `brief.md`.

The data source can be Agent Analytics, another analytics CLI, an API, SQL, CSV, exported reports, product logs, or manually supplied data.

Rules:

- Never invent numbers.
- If a command fails, record the failure.
- Treat missing data as missing data, not zero data.
- Separate primary outcome data from proxy and guardrail data.
- If data is sparse, say so and treat it as weak signal.

## Scope

During the loop, edit only:

- `results.tsv`
- `final_variants.md`
- optional scratch notes

Do not edit the live site, app, product code, or experiment setup until the variants have been reviewed.

## Product Truth

Every candidate must preserve the product truth from `brief.md`.

Penalize:

- generic category language
- copy a competitor could say word for word
- unsupported claims
- drift away from the real product value
- clickbait that weakens primary conversion intent
- changes that ignore the current control's strengths

Reward:

- specificity
- clear audience fit
- concrete user outcome
- stronger primary-event intent
- honest use of the available data
- language only this product could credibly say

## Loop

Run at least 5 rounds unless `brief.md` specifies a different count.

Each round has four phases.

### 1. Candidate A

For round 1, candidate A is your first new hypothesis based on the brief, control, and data.

For later rounds, candidate A is the previous round winner.

Include the editable parts named in the brief, usually headline, subheadline, CTA, supporting copy, and hypothesis.

### 2. Critique

Critique candidate A harshly:

- what is generic
- what a competitor could say
- where value is unclear
- where copy drifts from product truth
- whether primary-event intent is strong enough
- whether the control is clearer

### 3. Candidate B And Synthesis AB

Write candidate B from the critique as if starting fresh. It may use the brief and critique, but it should not be a mild rewrite of A.

Then write candidate AB by combining the strongest parts of A and B. Do not average them into bland middle copy.

### 4. Blind Borda Ranking

Blind-rank A, B, and AB. To simulate blind judging, anonymize them as `option_1`, `option_2`, and `option_3` in a different order each round before scoring.

Score:

- first place: 2 points
- second place: 1 point
- third place: 0 points

Use the rubric in `brief.md`. If none exists, rank by specificity, clarity, primary-event intent, product truth, low competitor-sayable language, and fit with analytics data.

Append one row to `results.tsv` after each round. Keep rationale short and TSV-safe.

Winner becomes candidate A for the next round.

## Final Selection

After the final round, choose the two strongest distinct candidates. They should not be tiny wording variations of each other.

Write `final_variants.md` with:

- candidate_1
- candidate_2
- exact changed copy
- rationale
- risks
- recommended experiment name
- experiment shape
- data limitations

End with a clear note that the experiment has not been wired yet.

## Approved Outer Experiment Loop

Run this section only if the user explicitly asks you to implement or wire the approved experiment.

1. Implement the approved variant or variants in the product surface named in `brief.md`.
2. Create the experiment with the recommended control and candidate variants.
3. Verify tracking for the primary metric, proxy metric, and guardrails.
4. Let the experiment collect behavior for the requested window.
5. Pull the experiment results into a new dated data snapshot, including:
   - winning and losing variants
   - primary metric movement
   - proxy metric movement
   - guardrail movement
   - screenshots or changed-copy notes
   - data limitations
6. Start the next autoresearch loop from that measured evidence.

The LLM loop generates pressure. The outer experiment loop decides what survived contact with users.


path: references/results-header.txt
content: round	candidate_a	candidate_b	candidate_ab	winner	borda_a	borda_b	borda_ab	status	rationale


path: scripts/collect_agent_analytics_snapshot.sh
content: #!/usr/bin/env bash
set -u

if [ "$#" -lt 3 ]; then
  printf 'Usage: %s <project_slug> <primary_event> <proxy_event> [output_dir]\n' "$0" >&2
  exit 2
fi

PROJECT_SLUG="$1"
PRIMARY_EVENT="$2"
PROXY_EVENT="$3"
OUTPUT_DIR="${4:-data/$(date +%F)}"

mkdir -p "$OUTPUT_DIR"

run_snapshot_command() {
  output_file="$1"
  shift
  "$@" > "$output_file" 2>&1
  command_status=$?
  perl -i -pe 's/\e\[[0-9;]*m//g' "$output_file" 2>/dev/null || true
  if [ "$command_status" -ne 0 ]; then
    printf '\ncommand_exit_code: %s\n' "$command_status" >> "$output_file"
  fi
}

run_snapshot_command "$OUTPUT_DIR/insights.txt" \
  npx --yes @agent-analytics/cli@0.5.31 insights "$PROJECT_SLUG" --period 7d
run_snapshot_command "$OUTPUT_DIR/pages.txt" \
  npx --yes @agent-analytics/cli@0.5.31 pages "$PROJECT_SLUG" --since 7d
run_snapshot_command "$OUTPUT_DIR/funnel.txt" \
  npx --yes @agent-analytics/cli@0.5.31 funnel "$PROJECT_SLUG" \
  --steps "page_view,$PROXY_EVENT,$PRIMARY_EVENT" \
  --since 7d
run_snapshot_command "$OUTPUT_DIR/${PROXY_EVENT}-events.txt" \
  npx --yes @agent-analytics/cli@0.5.31 events "$PROJECT_SLUG" \
  --event "$PROXY_EVENT" \
  --days 7 \
  --limit 50
run_snapshot_command "$OUTPUT_DIR/${PRIMARY_EVENT}-events.txt" \
  npx --yes @agent-analytics/cli@0.5.31 events "$PROJECT_SLUG" \
  --event "$PRIMARY_EVENT" \
  --days 7 \
  --limit 50
run_snapshot_command "$OUTPUT_DIR/experiments.txt" \
  npx --yes @agent-analytics/cli@0.5.31 experiments list "$PROJECT_SLUG"

printf 'Saved Agent Analytics snapshot to %s\n' "$OUTPUT_DIR"


path: scripts/init_autoresearch_run.sh
content: #!/usr/bin/env bash
set -euo pipefail

RUN_NAME="${1:-$(date +%F)-growth-loop}"
RUN_DIR="${2:-autoresearch-runs/$RUN_NAME}"
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"

mkdir -p "$RUN_DIR/data"

cp "$SKILL_DIR/references/brief-template.md" "$RUN_DIR/brief.md"
cp "$SKILL_DIR/references/final-variants-template.md" "$RUN_DIR/final_variants.md"
cp "$SKILL_DIR/references/results-header.txt" "$RUN_DIR/results.tsv"
touch "$RUN_DIR/scratch.md"

printf 'Created autoresearch run at %s\n' "$RUN_DIR"
printf 'Next: fill %s/brief.md, collect data, then run the loop.\n' "$RUN_DIR"


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)