--- name: shiplog description: Recap of everything shipped since the last run - cross-repo PRs, security fixes, star deltas, and X traction, synthesized into a digest article and a ready-to-post shiplog in your voice. metadata: title: Shiplog category: core var: "" requires: - TWITTER_API_KEY - XAI_API_KEY? - GH_GLOBAL? tags: - content - social --- > **${var}** — Optional, space-separated flags: > - `since:YYYY-MM-DD` — override the window start (default: when this skill last ran). > - `days:N` — window = last N days. > - `dry-run` — render to stdout; write no article, no state, no notify. > - `owner/repo` — narrow GitHub coverage to that one repo. > - any other word — focus/theme filter (a product name or keyword). > > Empty = everything shipped since the last run, across all configured repos. Produce two artifacts: 1. **Digest** — a themed, human-readable recap of everything that shipped + traction (the article). 2. **Shiplog post** — a tight, bulleted, ready-to-post version in the operator's voice, every project @-tagged (the notification). This is **cadence-agnostic**: the window is always "since the last run" (`memory/state/shiplog-last.json`), so the `aeon.yml` schedule alone decides whether this is a daily, weekly, or on-demand recap. One skill, any frequency. Read `STRATEGY.md`, `memory/MEMORY.md`, and the last 7 days of `memory/logs/` for context. Read `soul/SOUL.md` + `soul/STYLE.md` before writing any output — the shiplog post must sound like the operator, not a changelog bot. **If `soul/` is empty, use a clear, direct, neutral voice** (drop the signature flourishes below). ## Config — all derived, nothing hardcoded ``` operator = gh api user --jq .login # the authenticated operator (PR-author search) product_handles = memory/products.md `handles:` lines (@x) # product X accounts to read flagship_repos = memory/products.md `repos:` tagged (public) # the star / north-star story watched_repos = memory/watched-repos.md, else products.md repos: # everything shipped across ecosystem_scouts= memory/products.md `scouts:` line (optional) # recap accounts to scan for features star_state = memory/state/shiplog-stars.json # snapshot for week-over-week star deltas ``` If neither `watched-repos.md` nor `products.md` yields a repo, exit `SHIPLOG_NO_REPOS` (notify + log, no article). Sections whose config is absent (X handles, scouts) are **skipped gracefully**, not failed. ## Steps ### 1. Compute the window — "since last run" Each `date` / `jq` below is its own Bash call (see **Shell shape** under Fetching & sources): ```bash date -u +%Y-%m-%dT%H:%M:%SZ ``` ```bash date -u +%Y-%m-%d ``` The first prints NOW, the second TODAY. Check for the state file `memory/state/shiplog-last.json` with Glob. If it exists, read the last run time: ```bash jq -r '.last_run_at // empty' memory/state/shiplog-last.json ``` It prints LAST. `SINCE` = LAST. If the file is missing or LAST is empty, use the first-run default instead: ```bash date -u -d '7 days ago' +%Y-%m-%dT%H:%M:%SZ ``` It prints SINCE. `SINCE_DATE` = the part of SINCE before the `T`. Every later command has these values (and OPERATOR, handles, repos) written in literally where it shows ``, ``, ``, ``. - `since:YYYY-MM-DD` in `${var}` → `SINCE` = that date at `T00:00:00Z`; `days:N` → N days ago (`date -u -d ' days ago' +%Y-%m-%dT%H:%M:%SZ` as its own call). These override the state file. - Use `SINCE` for ALL time filtering - never substitute "since Monday" or other drift-prone shortcuts. The window is `[SINCE, NOW)`; state the span (`SINCE_DATE → TODAY`) in the output. - **Idempotency is the state file** (step 8 advances it each run, so windows never overlap). No once-per-day lock — a back-to-back re-run just yields an empty window → `SHIPLOG_NOTHING_NEW`. Write the digest to `output/articles/shiplog-${TODAY}.md`; if that name exists and there's genuinely new activity since the last run, use `output/articles/shiplog-${TODAY}-2.md` rather than clobbering. ### 2. GitHub activity (the bytes) Cross-repo PR/commit visibility needs the global token. When `GH_GLOBAL` is set the workflow already exports it as `gh`'s `GH_TOKEN`, so plain `gh` calls reach every repo it can see; don't put the token on the command line (a `$SECRET` expansion is refused): gh reads GH_TOKEN from the environment (GH_GLOBAL when set, else the repo-scoped token): ```bash gh api user --jq .login ``` It prints OPERATOR. Track success/failure per source in a `sources` map; on a single endpoint failure log `fail` and continue — never abort the whole skill. **a) Operator PRs across all repos in the window** (grouped by repo + totals): ```bash gh search prs --author "" --created ">=" \ --json number,title,repository,state,createdAt,url --limit 100 \ --jq 'group_by(.repository.nameWithOwner)[] | {repo: .[0].repository.nameWithOwner, count: length, prs: [.[] | {date: .createdAt[0:10], state, number, title}]}' ``` If 100 rows come back, note the result may be truncated. **b) Flagship headline numbers** - for each `flagship_repos` entry, count commits + merged PRs in the window (the numbers the audience cares about). Two calls per repo, with the repo and SINCE written in literally: ```bash gh api "repos//commits" -X GET -f since="" \ --jq '" commits: " + ([.[] | .sha] | length | tostring)' ``` ```bash gh api "repos//pulls" -X GET -f state=closed -f sort=updated -f direction=desc \ --jq '" merged PRs: " + ([.[] | select(.merged_at != null and .merged_at > "")] | length | tostring)' ``` If a call fails, log `fail` for that repo and move on. **c) The security flex** — PRs the operator landed in repos they do NOT own (the "a project merged a fix from us" candidates). Filter the Step-2a result to external repos whose title matches a security keyword (`security|ssrf|cve|credential|sandbox|escape|injection|vuln|redos|xss|toctou|path traversal|prototype pollution|deserial`). Merged ones are the marquee story — if it's a named org (not a random fork), that's a headline bullet. **d) Star delta** (north-star metric — flagships only, they're public): ```bash mkdir -p memory/state ``` Then one call per flagship repo, written in literally (prints the current total): ```bash gh api "repos/" --jq '.stargazers_count' ``` Read the prior snapshot `memory/state/shiplog-stars.json` (if present): `delta = current_total − last_total` per repo. After computing, overwrite the snapshot with Write: `{ "": {"count": N, "date": "${TODAY}"}, ... }`. If no prior snapshot exists, report totals only and note "no baseline yet - deltas start next run." Do NOT fabricate a delta. ### 3. X activity (twitterapi.io - primary) `TWITTER_API_KEY` is **injected into this skill's environment** (declared in `requires:`) and is the primary way to read X. twitterapi.io returns **structured tweet objects** - exact engagement counts, real permalinks, parsed fields - so you read ground-truth data instead of free text and **fabrication risk is gone**. It is also fast (~700ms). Grok `x_search` (`XAI_API_KEY`) stays wired as a demoted fallback. **Check the key first:** read the "Keys set for this run" line in your run notes, never a shell test (those are refused and cost a turn). `TWITTER_API_KEY` on that line = `KEY_PRESENT`, not on it = `KEY_UNSET`. There are two X sources here - the **operator** handle (`OPERATOR_HANDLE`, the operator's own X account from `memory/products.md`) and the **product/project** accounts (`PRODUCT_HANDLES`). Fetch each independently into its own tmp file so one failing source can't clobber or sink another. **Path A - twitterapi.io (primary).** Base `https://api.twitterapi.io/twitter`, auth header `X-API-Key: {TWITTER_API_KEY}` via `./secretcurl` (keep the key off the command line). The `-w` label prints the status and size in the same call, before parsing. *Operator posts* (`SRC=operator`) - the operator's own timeline. `/user/last_tweets` has **no server-side date filter**, so keep only posts inside `[SINCE_DATE, TODAY]` client-side on `.createdAt`. One call, the handle written in literally: ```bash ./secretcurl -s -o /tmp/tw-operator.json -w 'twitterapi http=%{http_code} bytes=%{size_download}\n' -G "https://api.twitterapi.io/twitter/user/last_tweets" \ --data-urlencode "userName=" -H "X-API-Key: {TWITTER_API_KEY}" ``` On `HTTP=200`, parse `.data.tweets[]` (`createdAt` is Twitter's native `Day Mon DD HH:MM:SS +0000 YYYY` string; the `strptime` normalizes it to a date for the window compare); paginate with `&cursor=` when `.has_next_page` is true and older in-window posts remain: ```bash jq -r ' .data.tweets[] | .day = (try (.createdAt | strptime("%a %b %d %H:%M:%S %z %Y") | strftime("%Y-%m-%d")) catch (.createdAt[0:10])) | select(.day >= "") | [.id, .day, .isReply, .likeCount, .retweetCount, .replyCount, .url, .text] | @tsv' /tmp/tw-operator.json ``` Separate **original posts** from **replies/RTs** (`.isReply`, or text starting `RT @`) - RTs are amplification, not ships. *Product/project accounts* (`SRC=projects`) - one `advanced_search` across every product handle, with the date window inside the query string. Build `FROMQ` yourself (no shell text tools): split `PRODUCT_HANDLES` on commas/spaces, drop each leading `@` and any blanks, prefix each with `from:`, join with ` OR ` (e.g. `from:aeonframework OR from:miroshark_`). Then one call with the query written in literally: ```bash ./secretcurl -s -o /tmp/tw-projects.json -w 'twitterapi http=%{http_code} bytes=%{size_download}\n' -G "https://api.twitterapi.io/twitter/tweet/advanced_search" \ --data-urlencode "query=() since: until:" --data-urlencode "queryType=Latest" -H "X-API-Key: {TWITTER_API_KEY}" ``` On `HTTP=200`, parse `.tweets[]` (author under `.author.userName`); note the bangers by `.likeCount` / `.viewCount` - one or two feed the digest narrative. Skip retweets of others: ```bash jq -r '.tweets[] | [.author.userName, .createdAt, .likeCount, .retweetCount, .replyCount, .url, .text] | @tsv' /tmp/tw-projects.json ``` Supported query operators: `from: to: url: lang: #tag @mention since: until:`, `OR`/`AND`, quoted phrases. There is **no `list:` operator**. For each source, mark `x_source=twitterapi` on a `200` with parsed rows. **On a real failure, skip that source with the true reason - never fabricate posts** (with structured objects there is no fabrication risk, but the skip-on-real-failure rule still holds). Reason codes: `key-unset` (only if the key check gave `KEY_UNSET`), `http-` (non-2xx), `empty` (200 but no tweets parsed), `timeout` (exceeded `--max-time`). **Path B - xAI Grok `x_search` (fallback).** Only if a source's Path A returned non-2xx, empty, or timed out. `XAI_API_KEY` is also injected (`requires:`). `x_search` runs a live X search and typically takes 30-120s - when you invoke the Bash tool for these curls, **set the tool's `timeout` to at least 180000 (180s)**; each curl carries `--max-time 150` so it fails cleanly instead of hanging. **A slow curl is not a missing key - never treat a timeout as key-unavailable.** Each source is one call: build the body with `jq -n` (values written into the filter literally: a jq `$name` variable and a `>` redirect into a file are both refused; a `"` inside a value becomes `\"`, and reword any `'`) and pipe it straight into the send. Keep `-w '%{http_code}'` exactly on the xAI send (secretcurl's retry reads it); secretcurl itself prints an `http=... bytes=...` line on stderr. *Operator posts* (`SRC=operator`): ```bash jq -n '{model:"grok-4.7", input:[{role:"user", content:"Search X for posts by @ between and . Return each post with full text, date, type (original|reply|RT - an RT text starts with \"RT @\"), exact engagement counts (likes, retweets, replies; 0 if unknown), and the direct link https://x.com//status/ID. Return chronological."}], tools:[{type:"x_search"}]}' \ | ./secretcurl -s -o /tmp/xai-shiplog-operator.json -w '%{http_code}' --max-time 150 -X POST "https://api.x.ai/v1/responses" \ -H "Content-Type: application/json" -H "Authorization: Bearer {XAI_API_KEY}" --data-binary @- ``` *Product/project accounts* (`SRC=projects`): ```bash jq -n '{model:"grok-4.7", input:[{role:"user", content:"Search X for posts between and from these accounts: . Focus on launches, announcements, and any brag about a security fix merged into another project. For each: @handle, full text, date, exact engagement counts (likes, retweets, replies; 0 if unknown), and the direct link https://x.com/handle/status/ID. Skip retweets of others."}], tools:[{type:"x_search"}]}' \ | ./secretcurl -s -o /tmp/xai-shiplog-projects.json -w '%{http_code}' --max-time 150 -X POST "https://api.x.ai/v1/responses" \ -H "Content-Type: application/json" -H "Authorization: Bearer {XAI_API_KEY}" --data-binary @- ``` For each source, on `HTTP=200` with a non-empty body, parse that source's file with the standard extractor and mark `x_source=xai`: ```bash jq -r '.output[] | select(.type == "message") | .content[] | select(.type == "output_text") | .text' /tmp/xai-shiplog-.json ``` From the **operator** text, separate **original posts** from **RTs** (RT text starts with `RT @`) — RTs are amplification, not ships. From the **projects** text, note the bangers (sort by likes/views) — one or two feed the digest's narrative section. **On a real failure, skip that source — never fabricate posts.** If a source's curl returns non-200, an empty/unparseable body, or times out, record the **true reason** for that source and continue with whatever other sources succeeded. Reason codes: `key-unset` (only if the key check above gave `KEY_UNSET`), `http-` (non-2xx), `empty` (200 but no posts parsed), `timeout` (exceeded `--max-time`). Never write "XAI_API_KEY unavailable" when the key was set. **Path C - WebFetch (last resort, per source).** Only if a source failed BOTH Path A and Path B for one of the real reasons above: WebFetch that source's public `https://x.com/` profile(s), no auth, and mark that source `x_source=webfetch` (lower quality; prefer posts inside the window). If every X source fails all paths, set `x_source=none` and write the GitHub-only shiplog (note the gap) - **never abort**. ### 4. Ecosystem + traction sweep (best-effort — skip gracefully) - **Ecosystem mentions** - only if `ecosystem_scouts` (`scouts:`) is configured. **Path A (primary): twitterapi.io `advanced_search`** across the scout handles, scoped to product terms and the window (`SRC=ecosystem`): Build `SCOUTQ` yourself the same way as `FROMQ` (scout handles, `@` dropped, each prefixed `from:`, joined with ` OR `) and `TERMS` from `PRODUCT_HANDLES` (`@` dropped, no prefix, joined with ` OR `). Then one call with the query written in literally: ```bash ./secretcurl -s -o /tmp/tw-ecosystem.json -w 'twitterapi http=%{http_code} bytes=%{size_download}\n' -G "https://api.twitterapi.io/twitter/tweet/advanced_search" \ --data-urlencode "query=() () since: until:" --data-urlencode "queryType=Latest" -H "X-API-Key: {TWITTER_API_KEY}" ``` On HTTP 200, parse it as its own call: ```bash jq -r '.tweets[] | [.author.userName, (.author.followers // "?"), .createdAt, .url, .text] | @tsv' /tmp/tw-ecosystem.json ``` On `HTTP=200` with parsed rows, mark `x_source=twitterapi` and capture `.author.followers` when present for the flex ("featured by @X (Nk)"; follower counts are best-effort on search results). **Path B (fallback): xAI Grok `x_search`** - only on a real Path A failure (`http-` / `empty` / `timeout` / `key-unset`), the same curl shape as Step 3 Path B, into its own tmp file: ```bash jq -n '{model:"grok-4.7", input:[{role:"user", content:"Search X between and for posts from these recap/scout accounts: that mention any of these products: . Return each mention with @handle, follower_count, full text, date, and the direct link https://x.com/handle/status/ID - recaps, rankings, partner shares."}], tools:[{type:"x_search"}]}' \ | ./secretcurl -s -o /tmp/xai-shiplog-ecosystem.json -w '%{http_code}' --max-time 150 -X POST "https://api.x.ai/v1/responses" \ -H "Content-Type: application/json" -H "Authorization: Bearer {XAI_API_KEY}" --data-binary @- ``` On `HTTP=200` + non-empty, parse `/tmp/xai-shiplog-ecosystem.json` with the standard extractor and mark `x_source=xai`. If both paths fail for a real reason (`http-` / `empty` / `timeout`, or `key-unset`), skip this source with the true reason - **never fabricate a mention**. Confirm any handle is real before @-mentioning (a wrong tag in a public post is worse than none). Skip entirely if no `scouts:` configured. - **Product traction** (OpenRouter / x402 / analytics) — only if a source is configured for the product. If you have an app/server id, WebFetch its page; otherwise say "no product-traction sources wired yet" and move on. Keep any number exactly as measured — don't round 79 → ~80. ### 5. Classify the window | Condition | Status | Action | |-----------|--------|--------| | 0 PRs AND 0 flagship commits AND no notable X | `SHIPLOG_NOTHING_NEW` | Notify-optional — no article. Skip to Step 8, **still advance state.** | | < 3 substantive ships total | `SHIPLOG_LIGHT` | Short post (3-bullet form). | | Otherwise | `SHIPLOG_OK` | Full digest + post. | If `${var}` narrows to one repo/project and nothing matched, status `SHIPLOG_NO_MATCH` — notify and exit (still advance state). ### 6. Synthesize + write the article **Output handling — no PR.** This is a content skill: write the article straight to `output/articles/` and let the workflow's commit step push it to `main` (same as the `article` skill). Do **not** create a branch or open a pull request — `CLAUDE.md`'s "branch + PR, never push to main" rule is for source-code changes, not generated articles. Write the **digest** to `output/articles/shiplog-${TODAY}.md`: themed "what shipped" sections, a **By-the-numbers** line (PRs · commits · star deltas), traction/ecosystem, and the gaps you hit. Then append the **ready-to-post shiplog** using this template — load `soul/STYLE.md` first so the register matches (if `soul/` is empty, write a plain, direct post and drop the `⭐` sign-off): ``` shiplog ⭐ shipped ~ PRs + commits this window. the bytes: - : . <@handles of projects involved> - : ... - : ... - security: fixes into other people's repos () - even got one merged into <@MarqueeOrg>'s traction: - ⭐ (+ this window) - featured by <@scout> () "" + ranked # ⭐ ``` - **Tag every project** with a handle you verified. If you couldn't confidently resolve one, leave it untagged and say which is missing. - Keep numbers exactly as measured. If a flex (a security merge, a milestone) landed just outside the window, keep it but flag the date. - Also draft two variants below the post: a tight thread (hook + one tweet per ship) and a 3-bullet short version. ### 7. (folded into 6) ### 8. Advance the state file Unless `dry-run`, record this run so the next one starts where this ended: ```bash mkdir -p memory/state ``` ```bash git rev-parse HEAD ``` It prints HEAD_SHA (if it fails, HEAD_SHA is empty). Write `memory/state/shiplog-last.json` with Write, values written in literally: ```json {"last_run_at":"","last_commit_sha":"","window_start":""} ``` Advance on **every** completed run — including `SHIPLOG_NOTHING_NEW` / `SHIPLOG_LIGHT` / `SHIPLOG_NO_MATCH` — so the window always moves forward. The workflow auto-commits it (no `git` here). On `dry-run`, do NOT write it. ### 9. Notify ```bash gh repo view --json url -q .url ``` It prints REPO_URL. `ARTICLE_URL` = `/blob/main/output/articles/shiplog-.md`. Write the ready-to-post shiplog to a temp file with Write - `/tmp/shiplog-notify.md` - and send it with `./notify -f /tmp/shiplog-notify.md` (use `-f` rather than `./notify "$(cat …)"` so a long multi-line post is passed as a file instead of a giant argv). Append `${ARTICLE_URL}` as the last line. For `SHIPLOG_NOTHING_NEW` / `SHIPLOG_NO_MATCH`, send a one-line status instead of the post (or stay silent on sub-daily cadences). ### 10. Log Append to `memory/logs/${TODAY}.md`: ``` ### shiplog - Status: SHIPLOG_OK | SHIPLOG_LIGHT | SHIPLOG_NOTHING_NEW | SHIPLOG_NO_MATCH | SHIPLOG_NO_REPOS - Window: ${SINCE_DATE} → ${TODAY} (var: ${var:-none}) - PRs / flagship commits: N / M · external-security PRs: K - Stars: (+d) … [or: no baseline yet] - X source: twitterapi | xai | webfetch | none (+ per-source skip reasons if any: operator=http- | projects=timeout | ecosystem=empty …) - Article: output/articles/shiplog-${TODAY}.md (if written) - State advanced to: ${NOW} (unless dry-run) - Sources: prs=ok|fail · commits=ok|fail · stars=ok|fail · x=ok|fail · ecosystem=ok|fail ``` ## Fetching & sources - **GitHub**: every call uses `gh` (auth handled internally) — never curl the GitHub API. For cross-repo reach set `GH_GLOBAL` (the workflow exports it as `GH_TOKEN`; never pass it inline); with only the built-in token you'll see this repo plus public repos, which still covers public flagships. - **X**: the primary path for every X source is **twitterapi.io** (`https://api.twitterapi.io/twitter`, header `X-API-Key: {TWITTER_API_KEY}` via `./secretcurl`) - fast (~700ms) structured tweet objects with exact engagement counts, real permalinks, and parsed dates, so no fabrication risk. Use `/user/last_tweets?userName=` for a single timeline (filter the window client-side on `.createdAt`) and `/tweet/advanced_search?queryType=Latest` with `since:`/`until:` inside the query for multi-account or scout sweeps (Step 3). On a real failure (`key-unset` / `http-` / `empty` / `timeout`) fall back to Grok `x_search` (`XAI_API_KEY`, `curl https://api.x.ai/v1/responses`, `--max-time 150`, Bash tool `timeout` >=180000), then WebFetch of the public `x.com/` profile as a last resort. - **Never abort on a single source failure** — note the gap in the digest and still write + notify. - **Shell shape.** Each Bash call is one allowed command (pipes are fine). The run refuses a call that sets a variable (`X=$(...)`), uses `if` / `for` / `[ ... ] &&` tests, or joins commands with `;`, `&&` or `||`, and each refusal costs a model turn. So each `date`, `jq`, `gh` and `./secretcurl` is its own call: read the value it prints and write it in literally where a later command shows ``; loop over repos as one call per repo; build the `from:` queries yourself instead of with `printf | tr | sed | paste`; check the key on the run notes' "Keys set for this run" line, never with a shell test; build each X body with a `jq -n` filter that has every value written in (no `--arg` or `$name`: refused) and pipe it straight into `./secretcurl ... --data-binary @-`; and write state files with Write, not a shell redirect (a `>` into /tmp is refused too). ## Constraints - The window is **always** "since last run" (state file) unless `${var}` overrides it — never hardcode 7 days except as the first-run default. Always advance `memory/state/shiplog-last.json` on a real run, even a quiet one. - Content, not code: write the article to `output/articles/` and let the workflow commit it to `main`. Never open a per-run PR for the shiplog. - Every concrete claim traces to real data — a PR `(#N)`, a commit, a measured number, or a fetched tweet (with its permalink). No invented activity, no fabricated star deltas. - RTs are amplification, not ships — narrative/ecosystem only, never "the bytes". - Verify a handle before @-mentioning it; an unverified tag stays untagged. - Voice from `soul/`; neutral and direct if `soul/` is empty. No hype adjectives, no hashtags. - The notify URL is the GitHub web URL via `gh repo view --json url`, not the SSH remote.