--- name: aegis-routines-and-quiet-rules description: How the Aegis desk's routines run on Grok Bot, for every Bot. The platform's limits as reported, routines/manifest.toml as the schedule, one reviewed routine.py command per run posted verbatim, the written quiet rules, heartbeats and the day audit with no backfill, stale upstream records refused, the re-post ladder, the lean and active profiles with their weekly budget, Timezone America/New_York and the owner-side dead-man rule. license: MIT metadata: version: "0.1.0" author: FairGradient category: desk --- # Routines and quiet rules ## What Grok Bot routines can and cannot do These are the platform's limits as reported by its documentation and staff; the desk does not measure them. - Routines run at least 5 minutes apart, plus up to about 10 minutes of randomisation. - A Bot holds at most 50 routines; 20 run records are kept; at most 300 runs an hour. - A routine's output lands in the chat of the Bot that owns it. - Queue delays of 10 to 37 minutes are reported, worst between 08:00 and 12:00 ET. - A missed run is not replayed. Routines pause themselves after a long absence of the owner. - Routines need a Pro-or-higher plan, and every run spends weekly usage. - The desk computer sleeps minutes after the app disconnects, so only routine-woken jobs that run to completion work. - An approval card raised by a routine expires after 30 minutes. So the desk is an interval checker and a level-setter, not a real-time watcher. The data is delayed 15 minutes on top of any queue delay. ## The manifest is the schedule [routines/manifest.toml](../../routines/manifest.toml) lists every routine: its id, the owning Bot, the stage, the America/New_York slots per cadence profile, the days, whether it runs on trading days only, the step chain, the tools whose text it may post, the posting policy, the written quiet rule and the prompt. `bash scripts/check.sh` checks it: - no weekday slot falls in the delay window from 08:00 to 10:00 ET (08:00 inside, 10:00 outside); - a routine with `depends_on` runs at least 20 minutes after the routine it depends on (`min_gap_min` 20 or more); - a chain holds only the eight step tools: `assignment_watch`, `book`, `book_check`, `csv_recon`, `desk_doctor`, `eod_summary`, `expiry_checklist` and `trigger_levels`; - `ack` and `routine_audit` are never steps, and neither are the Structuring Desk's three tools: a manifest step naming `exit_ticket` or `roll_analysis` or `propose` is refused with the reason `owner-requested only: a structuring text names candidates and never runs in a routine`; - no chain carries `--owner-tapped`, `--allow-rth`, `--diff` or `--allow-dirty`; - every prompt is the one template below; - each Auto-review text in `routines/autoreview.toml` stays within 1,000 characters, and the Allow text names every routine id. ## One reviewed command per run One Grok routine runs one slot. Its prompt is exactly the template, with the routine id and the slot filled in: ```text Run python3 /workspace/aegis-grok-desk/scripts/routine.py --slot {slot} and post its output verbatim. ``` The Allow-automatically rule covers exactly that command and nothing else: no pipe, no redirection, no second command. The Ask-first owner-authority rule names `desk_init.py` and the Structuring Desk's three tools, so each interactive run of them raises a card for the owner's tap. What `routine.py` does in one run: 1. It checks the release pin: the checkout must be the clean commit of tag v1.0.0. Otherwise no step runs. 2. It picks the slot (`--slot`, else the latest slot at or before now) and the slot's chain. 3. On a closed day it runs no step and prints `quiet`: a weekend, an NYSE holiday, or a full closure the owner entered in `research/calendar.toml`. The final-call routine also prints `quiet` on an early-close day. 4. It runs each step once, in order, in the same process. A failed step never stops the others. 5. It composes one message, lints it, writes the heartbeat and a run record under `reports/routines//`, and prints the message. Post the output verbatim: every line, in order, the footer included. The single word `quiet` means there was nothing to post, and it is posted as printed. Never run `routine.py` with `--allow-dirty`: that flag is for development checkouts only, and no routine prompt carries it. The posting policies: `always` posts every post step's text; `transitions` posts the book check's message when it has one; `fired` posts each post step that exited 10 or 20, and is otherwise quiet. Lines a routine prints in place of a part, each ending with the fixed footer (shapes from `scripts/routine.py`): ```text INCIDENT | ET | failed (); the other steps ran; details in incidents/ WITHHELD | : the text failed the alert lint () and is withheld; .py shows it INCIDENT | | another run of this routine holds its lock; this run did nothing INCIDENT | | the desk checkout is not the pinned release v1.0.0: ; no step ran | details in incidents/-dirty-checkout.md ``` A synthetic example of the last one, from a development checkout with no tag (a fixture copy, 2026-11-03 19:50 UTC): ```text INCIDENT | book-check | the desk checkout is not the pinned release v1.0.0: development checkout (no tag); no step ran | details in incidents/20261103T195000.000000Z-dirty-checkout.md ``` ## The routines per Bot | Bot | Grok routines (lean profile) | Slots (America/New_York) | | --- | --- | --- | | Aegis Desk Lead | `preopen`, `eod-brief` | 07:30 and 17:10, Mon-Fri | | Aegis Exit Sentinel | `book-check` (four routines), `eod`, `journal-close` | 10:05, 12:05, 14:05, 15:35, 16:35 and 17:30, Mon-Fri | | Aegis Position Control | `final-call`, `post-expiry` | 15:20 Mon-Fri, and 09:30 Saturday | | Aegis Structuring Desk | none: it answers only when the owner asks | none | | Aegis Book & Risk Analyst | `opening-marks`, `pre-event-stress`, `weekend-stress` | 10:20 and 14:50 Mon-Fri, and 10:00 Saturday | | Aegis Events and Calendar Analyst | `calendar-build`, `event-sheet` | 07:40 and 07:50, Monday | | Aegis Rules Steward (direct message) | `rules-sanity`, `rulebook-memo` | 16:45 Mon-Fri, and 17:20 Friday | | Aegis Review Desk (direct message) | `weekly-review` | 11:00 Saturday | The active profile adds four book-check routines on the Exit Sentinel, at 11:05, 13:05, 14:35 and 15:05. They are created paused. Each owning Bot creates its own routines, reads them back to the owner, and keeps them paused until the owner turns monitoring on. The 10:05 book check also refreshes the threshold levels, the 12:05 one may post the watch-alive line, and the 15:35 one always posts the pre-close line. The 16:35 eod run snapshots the book, builds the threshold-level sheet from the snapshot and reconciles the positions file. There is no 12:20 routine on early-close days. ## Quiet rules (verbatim) Every routine has one written quiet rule in the manifest: - preopen: "Always one message: the doctor line, the recon verdict, standing signals, the docket and last night's levels; a missing or late upstream artifact is UNAVAILABLE." - book-check: "Posts only a verdict change, a new rule firing, a standing UNAVAILABLE or a ladder re-post; 12:05 posts watch alive when nothing posted since the open; 15:35 always posts the pre-close line." - final-call: "Posts on an expiry day (act-by times), the day before a held contract's last trading day (T-1 preview) and when a pin or dividend tier fires; otherwise quiet. On an early-close day it runs no step: the 07:30 Morning Desk Sheet carries the early-close line." - eod: "Always one message: the end-of-day threshold-level sheet from the snapshot." - eod-brief: "Always one message: P/L today, MTD and YTD, signals, the docket, N of N routines ran with late and missed runs named, the owner's to-do list." - post-expiry: "Posts only in weeks a held contract expired: the inferred outcomes and the number of proposed edits (csv_recon.py --diff shows the rows); confirm against your broker." - opening-marks: "Always one message: YOUR BOOK as marked after the delayed open, with the net delta and, when the day's beta fit holds, the beta-weighted delta and its r2 flag." - pre-event-stress: "Posts only when a held symbol's earnings or ex-dividend date is within 2 trading days: the event stress of its groups, a computation on the book's model, not a forecast; otherwise quiet." - weekend-stress: "Always one message on Saturday: the scenario grid of the book as of the last close, a computation on the book's model, not a forecast; a group without usable marks is named and the total left out." - calendar-build: "Posts only a calendar finding (stale, missing or unknown dates, a held symbol without a yield), a cash dividend proposed from Alpaca's corporate actions for your tap, or an UNAVAILABLE source; otherwise quiet." - event-sheet: "Always one message on Monday: the decision calendar of the next two weeks (act-by times, last trading days, ex-dividend and earnings dates with their sources); a date nobody sourced is UNAVAILABLE." - journal-close: "Never posts on its own: it closes the day's signal journal (journal/outcomes/.json) and prints quiet; a failure is an incident line." - rules-sanity: "Posts only when the adopted rulebook no longer covers a structure you hold today (a position opened after the adoption), with each lint finding; otherwise quiet." - rulebook-memo: "Always one message on Friday: the memo of your adopted rulebook (its version and sha, when you adopted it, its rules by role, the structures you hold) and the lint's verdict against today's positions." - weekly-review: "Always one message on Saturday: the week's signals, each with its facts from the desk's records, the counts per rule in fixed words and, when a candidate rulebook waits in rules/, its replay over the week; counts only, never a money total, a rate or a ranking." ## Heartbeats, the day audit and missed runs - Every run that holds its routine's lock writes `state/heartbeat/.json` and appends to `state/heartbeat/history.jsonl`, a pin refusal included. The book check's `book_check.py --post` step writes its own heartbeat; `routine.py` writes it for every other routine. - A run is late when it starts more than 20 minutes after its slot. A slot is missed when no heartbeat exists 45 minutes after it. - A late run says so in its quote segment, for example `run 45 min late`. - Missed runs are never backfilled and never replayed. The next run evaluates the market as it is then. - The EOD Desk Brief names the day's late and missed runs in its `routines:` line; the brief's own run is not counted. `routine_audit.py` gives the full audit: ```text python3 /workspace/aegis-grok-desk/scripts/routine_audit.py --desk-root /workspace/aegis-desk ``` A synthetic example on a fresh fixture copy at 2026-11-03 22:10 UTC, where no routine had run (the first two lines): ```text routine audit Tue 2026-11-03 (profile lean, as of 22:10 UTC): 0 of 8 due slots ran; missed: preopen 07:30 ET, book-check 10:05 ET, book-check 12:05 ET, book-check 14:05 ET, final-call 15:20 ET, book-check 15:35 ET; pending: eod 16:35 ET, eod-brief 17:10 ET preopen 07:30 ET: missed (no heartbeat 45 min after the slot) ``` When every run of a day starts a constant 60 or 120 minutes off its slot, the audit reports "timezone offset suspected": the owning Bot's Timezone is not America/New_York. ## Upstream late: consumers refuse stale records A routine reads the records earlier routines wrote: the morning sheet reads the doctor's result, the reconciliation, the docket and last night's levels; the brief reads the day's book snapshot and journals. A record that is missing, or older than the day it should be from, is never reused. Its line becomes UNAVAILABLE: ```text UNAVAILABLE: