Files
hk-ipo/scripts/run_hk_ipo_analyst_once.sh
T
geometrybase 907aeeee9b Codify latest IPO report refresh
Request:
- Make each scheduled analyst run refresh the latest IPO universe and all report-relevant online facts, especially subscription/margin multiples.
- Mirror the latest dated IPO candidate report to reports/README.md.
- Add this latest-report behavior to the hk-ipo-analyst skill instructions.

Changes:
- Expanded the scheduled analyst runner prompt to require online candidate refresh, market-heat/subscription-multiple refresh, official T1 updates when available, complete latest report regeneration, and reports/README.md mirroring.
- Added a Latest Candidate Report Refresh section to hk-ipo-analyst documenting the refresh flow, stage-safe market-heat handling, official T1 boundaries, and README mirror contract.
- Added reports/README.md as a copy of the current latest dated candidate report.

Verification:
- Ran bash -n scripts/run_hk_ipo_analyst_once.sh.
- Ran git diff --check and git diff --cached --check.
- Confirmed reports/README.md matches reports/2026-06-22_latest_ipo_candidates_analysis.md with cmp.
- Confirmed hk-ipo-analyst.timer still points to 2026-06-22 23:00:00 UTC as the next run.

Next useful context:
- reports/README.md is intentionally overwriteable on each latest candidate refresh; dated reports remain the historical copies.
- Unofficial subscription multiples should stay in ipo_market_heat and not be copied into official T1 demand fields.
2026-06-22 15:41:49 +00:00

46 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd)"
mkdir -p /run/hk-ipo
exec 9>/run/hk-ipo/analyst.lock
if ! flock -n 9; then
echo "$(date -Is) hk-ipo-analyst already running; skip"
exit 0
fi
cd "${REPO_ROOT}"
AS_OF="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
PROMPT_TEMPLATE="$(cat <<'EOF'
Use the `hk-ipo-analyst` skill from `.agents/skills/hk-ipo-analyst/SKILL.md`.
Run one scheduled HK IPO analyst refresh as of __AS_OF__.
Goals:
- Inspect the current worktree and recent git history first.
- Refresh the latest IPO candidate universe from online sources through `hk-ipo-archivist` before analysis.
- Update all relevant fresh network facts for the latest candidate report, especially live subscription-period market heat / margin subscription multiples, official T1 allotment demand when published, prospectus documents, listing calendars, and recent D1 review data.
- Keep unofficial subscription multiples in `ipo_market_heat` with their provider and `observed_at`; do not copy them into official T1 public oversubscription fields.
- Rebuild the analysis dataset after any archive refresh.
- Produce a complete latest broad IPO candidate report for actionable subscriptions, including ranking, fundamentals, break-risk/risk-reward, per-IPO notes, closed/waiting names, recent 30-day review, guardrails, and sources.
- Write the dated report as `reports/YYYY-MM-DD_latest_ipo_candidates_analysis.md`, then copy the same final content to `reports/README.md` so the reports directory opens on the latest report.
- Keep stage discipline: no later facts leaking into earlier-stage conclusions.
- Write analyst output in Simplified Chinese.
- Commit only related project changes, including the dated report and `reports/README.md`, and push the current branch if upstream exists.
- If data is missing or stale, state the `data_gap` clearly instead of guessing.
- Do not ask interactive questions during this scheduled run.
- Do not change the systemd units or this wrapper script during this scheduled run.
EOF
)"
PROMPT="${PROMPT_TEMPLATE//__AS_OF__/${AS_OF}}"
codex --search exec \
-C "${REPO_ROOT}" \
-s danger-full-access \
-a never \
"${PROMPT}"