Price alert

From aaronjmars/aeon · View interactive version

Price alert is an AI agent skill from the GitHub repository aaronjmars/aeon. Fire when the tracked token does something - new ATH, sharp 1h move, or operator-set target crossed. Silent on normal days.

How to use this skill

Skill file

${var} — Optional. Pass one or more target_price levels (comma-separated USD numbers, scientific notation allowed) to fire a one-time alert when the price crosses any of them. Empty = only ATH and sharp-move gates run. Pass dry-run to skip notify (state still updates). Pass set-target:<price> — the shape the Telegram force-reply sends (step 7) — to register a target and get a one-line confirmation.

Today is ${today}. The scheduled digests (digest, token-movers, ...) run at fixed hours. None of them tell the operator "the price just hit a new high" or "the token moved 28% in the last hour" — both are events that warrant attention the moment they happen, not 14 hours later in a daily digest. This skill closes that window.

Why this exists

Scheduled daily digests are calm summaries. Real moves need real-time signal. Three classes of move are worth a same-day ping:

Everything else is noise not worth a same-day ping.

Config

Reads:

Writes:

No new secrets. Uses keyless DexScreener; falls back to WebFetch when a public curl GET is flaky (there is no network sandbox).

State schema

{
  "contract": "0xbf8e8f0e8866a7052f948c16508644347c57aba3",
  "chain": "base",
  "ath": {
    "price_usd": 0.000003757,
    "observed_at": "2026-05-10T19:00:00Z",
    "announced_at": "2026-05-10T19:30:00Z"
  },
  "last_alerts": {
    "ath": "2026-05-10T19:30:00Z",
    "sharp_move": null,
    "target_hit": null
  },
  "targets": {
    "0.000005": {
      "side": "above",
      "first_seen_below_at": "2026-05-11T08:00:00Z",
      "hit_at": null,
      "announced_at": null
    }
  }
}

Key invariants:

Steps

1. Parse var

2. Resolve tracked token

Each step below is one Bash call (see Shell shape in the Network note):

mkdir -p memory/topics

Check for memory/topics/price-alert-state.json with Glob. If it does not exist, create it with Write:

{"contract":null,"chain":null,"ath":null,"last_alerts":{"ath":null,"sharp_move":null,"target_hit":null},"targets":{}}

Parse the "Tracked Token" table in memory/MEMORY.md. Pull CONTRACT (column 2 of the first data row) and CHAIN (column 3, lowercased). If the section is missing, the table is empty, or the contract field doesn't match ^0x[0-9a-fA-F]{40}$ → log PRICE_ALERT_NO_TOKEN and exit (no notify, no state write).

If the state file's contract is set and differs from the resolved contract → log PRICE_ALERT_TOKEN_CHANGED and reset the state file to defaults with the new contract/chain. ATH starts over with the new token.

3. Fetch current price (DexScreener primary)

One call, with the contract written in literally:

curl -fsS -o /tmp/price-alert-dex.json "https://api.dexscreener.com/latest/dex/tokens/<CONTRACT>"

Then parse it with jq as its own call (e.g. jq '.pairs | length' /tmp/price-alert-dex.json). If curl fails, or the response is empty, falsy, or jq can't parse it → fall back to WebFetch on the same URL with prompt "Return the raw JSON body verbatim." and try again. If both paths fail → log PRICE_ALERT_FETCH_FAIL and exit with status ERROR (no notify, no state mutation beyond touching last_run_at).

From the parsed JSON:

If CURRENT_PRICE is missing, zero, or non-numeric → log PRICE_ALERT_BAD_PRICE and exit ERROR.

4. Evaluate ATH gate

prior_ath = state.ath.price_usd  (null on first run)
new_ath   = (prior_ath is null) OR (CURRENT_PRICE > prior_ath)

If new_ath:

5. Evaluate sharp-move gate

sharp = abs(H1_CHANGE_PCT) >= 20.0

If sharp:

Sign of H1_CHANGE_PCT decides the direction word in the message (up for ≥0, down for <0).

6. Evaluate target-crossing gate

For each target in TARGETS:

Targets that crossed in prior runs stay in the state file with hit_at set so they don't refire if the price wobbles back.

7. Combine verdicts and notify

Run-level verdict precedence (used for the log status line and the notification ordering):

  1. ATH — strict new high after baseline.
  2. TARGET_HIT — operator-set level crossed.
  3. SHARP_MOVE — ±20% in 1h.
  4. OK — no gate fired.

If multiple gates fired in the same run, send one notification per gate. Each gate independently respects its own dedup clock — an ATH and a TARGET_HIT in the same run produce two messages; an ATH and a SHARP_MOVE_DEDUPED produce one.

Notification templates

ATH:

*$TOKEN - New ATH - ${today}*

$TOKEN just printed a new all-time high at $X.XXXXe-N.
Previous ATH: $Y.YYYYe-N (set ${prior_ath_age} ago).
24h move: ±Z.Z% · 1h move: ±W.W%

Chart: ${POOL_URL}

SHARP_MOVE:

*$TOKEN - Sharp 1h Move - ${today}*

$TOKEN ${up|down} ${abs(h1):.1f}% in the last hour - now $X.XXXXe-N.
24h: ±Z.Z%
${one of: "Buyer wave - watch for follow-through." | "Selling pressure - watch the next hour for stabilisation." }

Chart: ${POOL_URL}

(Direction phrase is hard-coded by sign: positive = buyer wave; negative = selling pressure. No freelance commentary.)

TARGET_HIT:

*$TOKEN - Target Hit - ${today}*

$TOKEN just crossed $${target} (now $X.XXXXe-N).
Direction: ${above|below}
24h: ±Z.Z% · 1h: ±W.W%

Chart: ${POOL_URL}

If MODE == dry-run: build the messages, log the planned notifications, but skip ./notify. State still updates so dedup clocks advance correctly.

Cap each message at ~2500 chars; price-alert messages are short by nature and shouldn't approach this.

Send the alert

Build each firing gate's message to a file and send it with ./notify -f alert.md (one send per

gate). State still advances even on a deduped run, so the dedup clocks stay correct.

Set-a-target follow-up (force-reply)

Buttons and force_reply can't share one message, so this is a separate send. After a genuine

ATH alert (post-baseline, not a deduped repeat), and only when no un-hit operator target

currently sits above CURRENT_PRICE (don't nag operators who already queued one), offer to capture

the next level:

./notify "New high - want an alert when <SYMBOL> clears a level above this? Reply with a price." \
  --force-reply --placeholder "e.g. 0.000005" \
  --context "price-alert::set-target"

The reply routes back as var=set-target:<price> (handled in step 1). On that run, once the target

is registered (step 6, first-observation — no cross alert), close the loop with a one-line

confirmation: ./notify "Target set: \$<price> for <SYMBOL> - I'll alert you when it crosses." (symbol written in literally)

(Send it only when a new target was actually registered this run.)

8. Persist state

Rewrite memory/topics/price-alert-state.json as one whole-file write. Get the timestamp as its own call:

date -u +%FT%TZ

It prints NOW. First save the current file's contents to memory/topics/price-alert-state.json.bak with Write (the one rolling .bak). Then Write the full new state: the old object with last_run_at = NOW (written in literally) and contract, chain, ath, last_alerts and targets set to this run's values.

Validate with jq empty memory/topics/price-alert-state.json after writing; if it fails, restore from the .bak copy (Write its contents back) and log PRICE_ALERT_STATE_CORRUPT.

Cap state.targets to 20 most-recent entries (LRU by first_seen_below_at) so a long-running fork doesn't accumulate stale operator targets.

9. Log

Append to memory/logs/${today}.md under a ### price-alert heading:

### price-alert
- **Skill**: price-alert
- **Token**: ${SYMBOL} (${CONTRACT})
- **Current**: $X.XXXXe-N | 1h: ±W.W% | 24h: ±Z.Z%
- **ATH**: $Y.YYYYe-N (set ${YYYY-MM-DD HH:MM} UTC) [${UNCHANGED|NEW}]
- **Sharp-move gate**: ${FIRED|QUIET|DEDUPED}
- **Targets evaluated**: ${comma-list of target prices} → ${comma-list of per-target verdicts}
- **Verdicts fired**: ${comma-list, or NONE}
- **Notifications sent**: ${N}
- **Status**: ${PRICE_ALERT_OK | PRICE_ALERT_ATH | PRICE_ALERT_SHARP_MOVE | PRICE_ALERT_TARGET_HIT | PRICE_ALERT_DRY_RUN | PRICE_ALERT_NO_TOKEN | PRICE_ALERT_TOKEN_CHANGED | PRICE_ALERT_FETCH_FAIL | PRICE_ALERT_BAD_PRICE | PRICE_ALERT_BAD_VAR | PRICE_ALERT_STATE_CORRUPT}

The status field carries the highest-priority gate fired this run, or the most relevant error. OK means the run completed cleanly and no gate fired.

Exit taxonomy

| Status | Meaning | Notify? |

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

| PRICE_ALERT_OK | Run completed, no gate fired | No |

| PRICE_ALERT_ATH | New strict all-time high (post-baseline) | Yes |

| PRICE_ALERT_SHARP_MOVE | ±20% in 1h, outside dedup window | Yes |

| PRICE_ALERT_TARGET_HIT | Operator target crossed for the first time | Yes |

| PRICE_ALERT_DRY_RUN | var=dry-run mode | No (state still updates) |

| PRICE_ALERT_NO_TOKEN | No tracked token configured in MEMORY.md | No |

| PRICE_ALERT_TOKEN_CHANGED | Tracked contract changed since last run; state reset | No |

| PRICE_ALERT_FETCH_FAIL | Both curl and WebFetch failed | No |

| PRICE_ALERT_BAD_PRICE | API returned malformed/zero price | No |

| PRICE_ALERT_BAD_VAR | ${var} had non-empty, non-dry-run text but yielded zero valid targets | No |

| PRICE_ALERT_STATE_CORRUPT | jq validation failed after write; restored from .bak | No |

Network note

DexScreener is keyless and public — curl works; there is no network sandbox. If a public curl GET is flaky, the WebFetch fallback kicks in (built-in Claude tool, prompt: "Return the raw JSON body verbatim."). There's no auth header, and the URL doesn't change between runs. Notify goes through ./notify, which stages to .pending-notify/; the workflow re-delivers any messages that failed to send after the run — no extra script needed.

Shell shape. Each Bash call is one allowed command (pipes are fine). The run refuses a call that sets a variable (X=$(...)), uses if / [ -f ... ] || tests, mktemp or mv, or joins commands with ;, && or ||, and each refusal costs a model turn. So the state-file check is a Glob, the DexScreener fetch is one curl to a file with the contract written in literally, timestamps come from a bare date call, and the state file is written with Write (never a shell redirect).

Constraints

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.