Ox sageox-summary
Generate an overall team summary covering the last 24 hours across all SageOx-enabled teams. Reads distilled daily entries via `ox distill history` and produces a structured, Slack-ready overview.
git clone https://github.com/sageox/ox
T=$(mktemp -d) && git clone --depth=1 https://github.com/sageox/ox "$T" && mkdir -p ~/.claude/skills && cp -r "$T/claws/openclaw/sageox-summary" ~/.claude/skills/sageox-ox-sageox-summary && rm -rf "$T"
T=$(mktemp -d) && git clone --depth=1 https://github.com/sageox/ox "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/claws/openclaw/sageox-summary" ~/.openclaw/skills/sageox-ox-sageox-summary && rm -rf "$T"
claws/openclaw/sageox-summary/SKILL.mdSageOx Summary
You are an agent that generates a cross-team summary of the last 24 hours of SageOx distilled activity. You enumerate each team's recent distilled entries via
ox distill history, inline their content into a prompt for claude -p,
and return a structured Slack-formatted summary.
This skill pairs with the
skill — distill writes the source material, this skill synthesizes it.sageox-distill
ox version requirement: this skill uses
ox distill history list and
ox distill history show, which landed in PR #507.
If ox distill history --help returns "unknown command" or similar, update
ox (see § 3 below) before continuing.
Prerequisites
Before doing anything else, verify the user's environment. Run every check in order. If any required check fails, explain precisely what's missing and stop. Do not proceed until the user has fixed it.
1. Required binaries
ox, claude, and jq are declared in the front matter's
requires.bins, so OpenClaw checks them before running the skill.
claude (npm) and jq (brew) have declarative installs in the front
matter; ox does not. If OpenClaw reports a missing bin, surface its
message to the user and stop — except for ox, which has the
interactive install flow in § 3 below.
claude -p will use whatever credentials claude already has — either
an OAuth session from claude login (Pro/Max subscription) or
ANTHROPIC_API_KEY exported in the shell that launched OpenClaw. The
skill no longer accepts a per-skill apiKey.
2. Path validation rules
Several steps below read a path from a JSON state file. Before interpolating any such value into a shell command, the agent must validate it against these rules:
- Absolute path required. Must start with
or/
. Reject relative paths and bare names.~ - No
segments. Reject anything containing..
... - No shell metacharacters. Reject anything containing any of these
characters:
;$`|&<>(){}*?[]!
newline.\
On any validation failure: print a clear error to the user explaining which rule failed and ask them to provide a different path. Do not attempt to "fix up" or sanitize the input — reject and re-prompt.
Treat values read from
~/.openclaw/memory/*.json files as untrusted
even though this skill writes them: the user (or a process running as
the user) may have edited the file by hand or by another tool between
runs. Re-validate every read.
3. Installing ox
oxThe
ox CLI install state is recorded in
~/.openclaw/memory/sageox-ox-install.json. On every run of this
skill, invoke the bundled readiness gate:
bash scripts/update-ox.sh
Contract:
- Stdout: nothing on success
- Stderr: on any failure, a two-line message — an
line describing what's wrong, followed by aerror:
line with the remediation. Surface both verbatim to the user.fix: - Exit:
ox is pinned, installed, and reports the expected version (continue to § 4);0
ox is not usable — one of: state file missing, binary missing at2
,$HOME/.local/bin/ox
on PATH resolves to a different binary, binary fails to run, or binary reports a version other than the one recorded inox
. On exitsageox-ox-install.json
, STOP, read2
, follow the install flow, then re-run this script to confirm.references/INSTALL.md
There is no per-run auto-update. The curl install pins a specific
ox
release by tag and sha256; users pick up newer releases by re-running
clawhub install for this skill after a new skill version publishes.
The user can say "reinstall ox" at any time to re-enter the flow in
references/INSTALL.md.
Do not install
via Homebrew or any package manager (e.g.
ox
brew install sageox/tap/ox, apt, dnf, pacman). The tap exists
for general use but is not supported inside OpenClaw skills — only the
pinned-release curl flow is.
4. Authentication
-
— confirm ox is authenticated. If not, tell the user to runox status
and try again.ox login -
Smoke-test
:claude -pclaude -p "say hi" --model claude-sonnet-4-6If it fails with an auth error,
has no usable credentials. Tell the user to either runclaude
(Pro/Max OAuth) or exportclaude login
in the shell that launches OpenClaw, then re-run the skill. The skill cannot inject the key itself.ANTHROPIC_API_KEY
Configuration
The skill uses two pieces of state:
-
Repo manifest —
(shared with the~/.openclaw/memory/sageox-distill-repos.json
skill). Format:sageox-distill{ "repos": [ { "path": "/home/user/repos/my-project", "team_id": "my-team" } ] }The
values are what drive the summary — they're passed directly toteam_id
. Theox distill history list --team
entries are not used by this skill, but stay in the manifest sopath
keeps working.sageox-distill -
Summary state —
. Tracks which distilled daily entry ids have already been included in a prior summary run so the skill never re-summarizes the same content. Shape:~/.openclaw/memory/sageox-summary-state.json
. Missing file → empty state (first run). Treat contents as untrusted: every id must pass{updated_at, teams: {<team_id>: {included_ids: [<id>, ...]}}}
or be silently dropped. Both bundled scripts handle this already — the rule is stated here for anyone reading the state file directly.^[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9a-f-]+$Pre-0.2.0 versions of this skill stored entries under
(with aincluded_files
suffix). That field is ignored by the current scripts; users upgrading from 0.1.x will re-summarize the most recent window once and the state file will converge to the new schema on the next successful run..md
If the manifest does not exist, tell the user to run the
sageox-distill
skill first to set up the repos, or ask for paths directly and populate
it.
The skill no longer needs a SageOx endpoint file or any team-context directory layout knowledge —
ox distill history resolves paths
internally. Earlier versions read ~/.openclaw/memory/sageox-endpoint.txt;
that file is ignored now and can be left alone or removed.
Summary Pipeline
When the user asks for a summary, run the steps in order. Steps 2 and 5 delegate their mechanics to
scripts/select-new-entries.sh and
scripts/update-state.sh (invoke via bash scripts/<name>).
Step 1: Load the Manifest and Summary State
-
Read
with~/.openclaw/memory/sageox-distill-repos.json
. Re-validate everyjq
entry against the Path validation rules in Prerequisites § 2 before using it — the manifest is user-writable and may have been hand-edited between runs. (The summary pipeline itself does not dereference the paths, but if the manifest looks corrupt we stop rather than guess at intent.)path -
Read
with~/.openclaw/memory/sageox-summary-state.json
if it exists. If it is missing, proceed silently as if thejq
map were empty — first runs are normal. If it exists but is malformed or unreadable, proceed as if empty AND emit exactly one warning to stderr:teamswarning: sageox-summary-state.json was unreadable, starting from empty stateNever route this warning to stdout — stdout is the final summary (Step 6), and mixing decorative output into it breaks downstream consumers. This file is rewritten at the end of every successful run (see Step 5).
-
Collect the unique
values from the manifest. These drive every subsequentteam_id
call.ox distill history
Step 2: Select New Entries per Team
The window is the last 24h, resolved server-side by
ox distill history list against entry created_at timestamps. ox auto-expands the
window around the UTC day boundary so runs don't miss yesterday's late
entries — this skill passes 24h verbatim and lets ox decide how wide
to actually look. The state file then subtracts anything already
summarized, so re-runs within the window are idempotent. First run (no
state file) = every candidate is new, not an error.
For each unique
team_id, invoke scripts/select-new-entries.sh. It
runs ox distill history list --team <tid> --since 24h --layer daily --format json, extracts the entry ids, and subtracts the team's
included_ids set from the state file. Contract:
- Usage:
select-new-entries.sh <team_id> <since> <state_file> - Stdout: one entry id per line, sorted; empty if nothing new
- Stderr: one-line warnings (malformed state, failed ox call)
- Exit:
success (empty is not a failure; a failed ox call is treated as "no new entries" so the remaining teams still summarize),0
usage,2
internal (3
orjq
missing)ox
STATE_FILE=~/.openclaw/memory/sageox-summary-state.json NEW_IDS="$(bash scripts/select-new-entries.sh \ "$TEAM_ID" 24h "$STATE_FILE")"
Then:
- If
is empty for a team, skip it this run — logNEW_IDS
to stderr and continue with the remaining teams.<team_id>: no new entries since last summary - If every team ends up with zero new entries, stop the pipeline
before invoking Claude. Print one line to stdout —
— and exit. Do not modify the state file; Step 5's prune on the next successful run will collect any stale entries.No new distilled content since last summary.
Step 3: Fetch Entry Content and Build the Prompt
For each team that survived Step 2, fetch the content of every new entry in a single
ox distill history show call. show accepts
multiple ids and emits each entry's markdown separated by its own
<!-- entry: <id> --> header:
# shellcheck disable=SC2086 TEAM_BLOCK="$(ox distill history show \ --team "$TEAM_ID" \ --format content \ $NEW_IDS)"
(Intentionally unquoted expansion:
NEW_IDS is a sorted set of ids,
each already matched against ^[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9a-f-]+$
by Step 2, so word-splitting is safe and desired here.)
If the
show call fails for a team, surface the stderr and stop the
whole run — partial summaries misrepresent the team's activity, and
Step 5 stays untouched so the next run retries the same set.
Then read the template from the skill's assets directory:
./assets/SUMMARIZE.md (relative to this SKILL.md file). The file path
on disk depends on where OpenClaw loaded the skill from — typically
one of:
~/.openclaw/skills/sageox-summary/assets/SUMMARIZE.md
(workspace skill)./skills/sageox-summary/assets/SUMMARIZE.md
Substitute template placeholders:
-
— one section per team that has a non-empty{{ENTRIES}}
set, in this format:NEW_IDS### Team "<team_id>" <TEAM_BLOCK for that team>Teams with zero new entries were already dropped in Step 2 and must not appear in
. Do not re-number, re-wrap, or otherwise mutate the markdown inside{{ENTRIES}}
— it is authored byTEAM_BLOCK
and preserves the citation anchors Claude references in the final summary.ox distill -
— if two or more teams survived Step 2 with non-empty entry sets, replace with:{{MULTI_TEAM_RULES}}- Organize the summary by team, using each team ID as a section header - Attribute insights to the correct teamOtherwise, replace with an empty string.
Step 4: Run Claude
Invoke
claude -p with the substituted prompt. The prompt already
contains every entry's full text, so Claude does not need filesystem
access — do not pass --add-dir and do not grant read tools.
--model claude-sonnet-4-6- No
(content is inline)--add-dir - No
(prompt is self-contained)--allowedTools - The substituted prompt passed via stdin
claude -p will use whatever credentials claude already has — either
an OAuth session from claude login or ANTHROPIC_API_KEY from the
shell that launched OpenClaw (see Prerequisites § 1). Wrap the
invocation in timeout 600 (10 minutes) — this matches the
timeout used by pkg/sessionsummary/claude.go in the ox repo for
comparable Claude synthesis work and gives the model enough headroom for
cross-team summaries that inline many daily entries:
timeout 600 claude -p \ --model claude-sonnet-4-6 <<< "$PROMPT"
If the invocation fails (non-zero exit, timeout exit 124, network error), surface the error to the user and do not proceed to Step 5 — leaving the state file untouched lets the next run retry exactly the same candidate set.
Step 5: Update Summary State
Only run this step if Claude exited successfully. On any failure (non-zero exit, timeout, network error), skip it entirely — leaving the state file untouched lets the next run retry the same candidate set.
For each team that had non-empty
NEW_IDS in Step 2, pipe that team's
ids into scripts/update-state.sh. The script merges them into the
team's included_ids, prunes entries whose date prefix is strictly
older than yesterday UTC (the candidate window, after ox's auto-expansion,
spans at most today + yesterday), and writes the result atomically via
a sibling temp file + mv -f. See the script header for full details;
the short form:
- Usage:
update-state.sh <state_file> <team_id> - Stdin: one entry id per line (regex-filtered on read)
- Stdout: nothing on success
- Stderr: one-line warnings (e.g. malformed prior state)
- Exit:
success,0
usage,2
internal3
printf '%s\n' "$NEW_IDS" \ | bash scripts/update-state.sh "$STATE_FILE" "$TEAM_ID"
Teams skipped in Step 2 are not invoked here — their prior state passes through unchanged because
update-state.sh only rewrites the
team_id it was given. Teams with no prior entry AND no new ids are
correctly never added to the state file.
Step 6: Return the Summary
Return Claude's stdout to the user directly. It is already formatted for Slack mrkdwn. Do not reformat or annotate — just show it.
Output
The primary output is the Claude-generated summary. Prefix it with a brief one-line header showing:
- How many teams were summarized
- Any teams that were skipped (and why — typically "no new entries since last summary" from Step 2)
Keep any preamble or postamble minimal. The summary itself is the value.
If Step 2 short-circuited because every team had zero new entries, the only output is the single line
No new distilled content since last summary. — do not invoke Claude and do not print a header.