Skip to content
Back to skills

Ops

ASecurity

Read live Elixir production safely, and find the migrate op that answers a question. `/ops <question>` picks the read (a migrate op, the public status endpoint, Logs Insights, a call capture) and runs it read-only; `/ops <op>` runs one op from the catalogue. `ops.md` beside this file lists every migrate Lambda op with its payload, its question, whether it only reads or WRITES, and who already names it; a test keeps it equal to the dispatcher. Use when asked why a tool is slow, what production...

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 29, 2026
devopspythongosqlnodeawsapidatabasebackend

Works with

  • cli
  • api
  • mcp

Security analysis

A92/100
  • mediumUses curl or wget to download content

Pro scans all 2 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add jthingelstad/elixir-mcp --skill ops --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ops?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ops
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jthingelstad-ops/badge)](https://www.skillsdirectory.com/skills/jthingelstad-ops)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ops
description: Read live Elixir production safely, and find the migrate op that answers a question. `/ops <question>` picks the read (a migrate op, the public status endpoint, Logs Insights, a call capture) and runs it read-only; `/ops <op>` runs one op from the catalogue. `ops.md` beside this file lists every migrate Lambda op with its payload, its question, whether it only reads or WRITES, and who already names it; a test keeps it equal to the dispatcher. Use when asked why a tool is slow, what production holds, where a job, collector, backfill or feedback item stands, or which op to run. It never authorizes a write.
---

# Ops

The production database is private: no psql path reaches it. What
production holds, how a tool's query plans, and why the pipeline did what
it did are read through the migrate Lambda's ops, the logs, the public
status endpoint and the call captures. This skill says how to run each
safely; `ops.md` is the catalogue of every op. Before it, the runbooks
named about a dozen ops and the rest could be found only by reading
`services/migrate/src/lambda.mjs`.

## Invocation

- `/ops <question>` ("why is clans_standings slow for #J2RGCRVG", "what
  is holding the database"): choose the read from "Choosing the read" and
  `ops.md`, run it, and answer with the numbers and where each came from.
- `/ops <op>` (`/ops capture_audit`): read the op's row in `ops.md`, then
  run it with `npm run op` and the payload the question needs. Reads
  take no lock; a write op is a proposal until its authority says go
  (rule 2).

## Rules

1. **Never verify with writes on live data.** Reads and refusal paths only
   (AGENTS.md rule 9). A write op changes production; it is never a check.
2. **A write op needs authority.** Each write row in `ops.md` names it:
   a section of `docs/OPERATIONS.md` that bounds the op, or Jamie.
   Without it, put the exact payload in your answer for Jamie. A granted
   write runs through `npm run op`, which takes the production lock. The session's permission check can
   refuse a live write anyway (the Gym's `{service_token_limits}`,
   2026-09-23); then hand Jamie the command.
3. **Never manufacture a request to diagnose** (DECISIONS). Read what the
   record holds: receipts, the job ledger, the audit, the captures. Do not
   pass `live: true`, mint a fetch or requeue a job to see what happens:
   it spends the one rate budget, and an error never advances freshness,
   so it shows nothing the next natural poll will not.
4. **Live diagnostics only through migrate ops** (DECISIONS). An EXPLAIN
   runs the exact SQL the tool serves, never a hand-typed version.
   `{profile_tool}` runs the registry's own handler, so it cannot drift;
   `{explain_participation}`, `{explain_standings}` and `{explain_timeline}`
   import the tool's SQL. Use
   `{profile_tool}` for another retained tool's actual SQL and handler.
5. **One invocation at a time, and no retries.** The function has reserved
   concurrency 1: a second call gets a 429 while the first runs, and so
   does a deploy's migration step. Set `AWS_MAX_ATTEMPTS=1`: on 2026-09-19
   the CLI retried a timed-out synchronous invoke of the jobs Lambda and
   the job ran twice. Never retry a heavy op on a 429.
6. **Heavy reads run once, on purpose.** Rows marked heavy scan a battle
   table or the corpus on a db.t4g.micro. Past 90 s an invocation fires
   `elixir-mcp-migrate-duration`, the alarm reaches the sysadmin queue
   and someone asks who and why, so
   name the run in your report. Thirteen `{probe}` runs in 25 minutes
   preceded the 2026-09-11 RDS memory recovery.
7. **A backfill is not finished until it is vacuumed, and never runs with
   a deploy** (DECISIONS). A bulk write empties the visibility map, so
   index-only scans read the heap until `{vacuum}` runs (a migration's
   `-- vacuum after:`, `{rewrite_table}` and `{read_facts_backfill}` do
   it themselves; `{visibility_check}` names any table still behind, and
   every deploy prints it); a looping
   backfill holds the function, so the deploy's migration step gets a 429
   and the deploy stops (twice on 2026-09-22). The procedure is the
   `migration` skill's.
8. **Only `{}` migrates.** A payload with no known key, a misspelt op or
   `{"stats": false}`, answers `"error": "unknown_op"` and runs nothing;
   until 2026-09-25 it fell through to the migration runner and applied
   anything pending. `{}` is the deploy's call: never send it by hand.
   Copy the key from `ops.md` and pass `true` or an object.
9. **Results stay out of the repo.** It is public, and results carry
   feedback text, email-hash prefixes, tags and people's timelines; every
   op also logs its result to the migrate log group.
   Quote only what the question needs.

## Running an op

The function is `elixir-mcp-migrate` (`MigrateFunction` in
`infra/template.yaml`, stack output `MigrateFunctionName`): Node 24, 1 GB,
300 s timeout, reserved concurrency 1, in the private subnets with the
database URL and `ARCHIVE_BUCKET`. Take the payload from the op's row,
and invoke once, synchronously.

**`npm run op`** (`infra/scripts/op.mjs`), from the repository root. It
is the only way to run a write, and the default for a read:

```sh
npm run op -- '{"capture_audit": {"days": 1}}'
npm run op -- '{"ledger": {"op": "requeue", "job_ids": ["123"]}}'
npm run op -- '{"shape_census": true}' --function jobs
```

It checks the caller is `assumed-role/ProjectsCloudEngineer/projects-cloud-engineer`,
invokes with profile `cloud-engineer`, no retries but a throttle (refused
before it ran, waited out for at most the function's timeout; exit 4 if
it stays busy) and a read timeout past the function's own, and prints
the result. It classifies the payload by
an allowlist (`infra/scripts/lib/ops-invoke.mjs`): a payload that is not
plainly a read is a write and takes the production lock
(`infra/scripts/lib/production-lock.mjs`) for the invocation. A read
takes no lock but does not run while the lock is held. Exit 3 means
locked: the output names the holder, since when and doing what. Wait;
never clear another holder's lock. A batch of calls holds the lock once
for the whole run with `npm run op:batch -- --purpose "<what>" --
<command>` (docs/OPERATIONS.md, "Batches"); each `npm run op` inside runs
under it.

The two raw paths below take no lock: **reads only**. Confirm the
identity first: `AWS_PROFILE=cloud-engineer aws sts get-caller-identity`
shows `assumed-role/ProjectsCloudEngineer/projects-cloud-engineer`.

**The AWS MCP server's `run_script`,** sandboxed and audited
(`~/Projects/AGENTS.md`):

```python
result = await call_boto3(service_name="lambda", operation_name="Invoke",
    region_name="us-east-1", params={"FunctionName": "elixir-mcp-migrate",
    "Payload": json.dumps({"stats": True})})
result
```

Check `api_calls` for exactly one Invoke, and `FunctionError` in the
response. The script cannot set the client's read timeout or retries, so
keep it for ops that finish well inside a minute.

**The CLI,** for a heavy read when `npm run op` cannot run:

```sh
AWS_PROFILE=cloud-engineer AWS_MAX_ATTEMPTS=1 aws lambda invoke \
  --region us-east-1 --function-name elixir-mcp-migrate \
  --cli-binary-format raw-in-base64-out --cli-read-timeout 300 \
  --payload '{"capture_audit": {"days": 1}}' /tmp/out.json
```

The read timeout matches the function's own, so the CLI waits instead of
retrying. `StatusCode` 200 means it ran; `"FunctionError": "Unhandled"`
means the op threw, with `errorMessage` in `/tmp/out.json`. Many ops
refuse without throwing and return `{"error": ...}`: read the body.

## The other read paths

**The public status endpoint.**
`curl -s https://elixir.poapkings.com/api/public/status`
(`services/web-api/src/routes/public.mjs`, about 60 s cached): the health
verdict, the budget, the job ledger (`queue`, `jobs.dead`), outbox dead
letters, 24 h capture-audit gaps, and each collector by card name with
heartbeat, version, channel, `yield_24h` and `edge_filtered_24h`. Start a
pipeline question here, then `{stats}`.

**CloudWatch Logs Insights.** Native HTTP logs are
`/aws/lambda/web/elixir-mcp-<name>-web` for `mcp`, `web-api` and `collector`.
Event Function logs remain `/aws/lambda/elixir-mcp-<name>` for `scheduler`,
`jobs`, `migrate`, `email-relay` and `timeline-sync` (30 days); `/aws/rds/instance/elixir-mcp-enc/postgresql` (14 days). CloudFront's
request log is `/elixir-mcp/web-access` (731 days; no IP, no query string).
Stamps are UTC; Jamie reads US Central.

- The native doors log structured objects under `message`: `message.http`
  (method and route), `message.status`, `message.ms`, `message.request_id`;
  MCP adds `message.rpc` and `message.tool`, web-api `message.connect_ms`
  and `message.timed_out`. Per-tool numbers are `{audit_census}`'s.
- **Why is the web slow?** `npm run web-latency -- --days 7`
  (`infra/scripts/web-latency.mjs`, read-only) reads the web-api door's
  outer `http_request` lines (real path, `ms`, `status`, `build`), its
  handler's `timed_out` lines (for Clan's routes carrying `elixir_ms` and
  `store_ms`) and the MCP door's tool lines, and prints per route and per
  tool samples, p50, p95, max, over 3 s, 5xx and a verdict against
  `infra/web-latency-ceilings.json` (`thin` under the minimum samples is
  never judged), Home by build so a deploy's effect shows, and how much
  of each Clan route is Elixir calls versus its own store. `--json` for
  the rows, `--check` to exit 1 when a judged route is over. The
  web-api door logs two lines per request: time the outer one, never
  both.
- The scheduler's EMF line, one a tick (`ElixirMCP/Ledger`), carries two
  metrics, `OldestQueuedAgeSeconds` and `DeadJobs` (behind the
  `elixir-mcp-ledger-dead-jobs` alarm), and plain properties: `QueuedJobs`, `PlannedJobs`,
  `SessionFollowupJobs`, `ReadCappedJobs`, `RequestedProfileJobs`,
  `RetryJobs` (planned only because a failed fetch owed a retry, 0188),
  `NotFoundHeld`, `FetchesHour`, `FetchErrorsHour`, `CeilingHour`,
  `Tokens`, `CollectorsActive`, `CollectorsDraining`. For example:
  `fields @timestamp, QueuedJobs, FetchesHour, CeilingHour | filter ispresent(DeadJobs) | sort @timestamp desc | limit 48`.
- Failures log by name: `call_capture_failed`, `audit_write_failed`,
  `output_schema_mismatch`, `db_connect_failed` (MCP),
  `email_compose_failed` (jobs). The migrate group is every op's result.
- **How long a first read takes** (2026-11-09). The collector group logs
  `message.event = "first_read_landed"` once per tracked player's first
  admitted profile (`endpoint` `player`) and first battle log with
  battles in it (`player_battlelog`), with `lane`, `seconds_from_tracked`
  (since the first account still tracking it added it),
  `seconds_from_minted` and `seconds_queued` (mint to lease; both null
  when no job id rode the submit); no tag (`packages/ingest/src/first-read.mjs`).
  The distribution by day, in `/aws/lambda/web/elixir-mcp-collector-web`:
  `fields message.endpoint as endpoint, message.seconds_from_tracked as s | filter message.event = "first_read_landed" | stats count(*) as n, pct(s, 50) as p50, pct(s, 90) as p90, max(s) as max_s by bin(1d), endpoint`.
  Add `message.lane as lane` and `by ... lane` to split a live first
  read from one the scheduler made. Whether the add asked at all is
  `message.event = "first_read_requested"` in the web-api and mcp
  groups, one line per endpoint asked (`message.endpoint` `player`,
  and from 2026-11-09 `player_battlelog` for a person's add), with
  `message.outcome` one of `minted`, `joined`, `no_token`,
  `first_reads_spent`, `fresh`, `read_today`, `failed_today`,
  `not_found_today`, `no_live_lane`, `no_account`, `error`, and for the
  battle log `not_recorded` and `profile_not_requested`:
  `filter message.event = "first_read_requested" | stats count(*) by bin(1d), message.endpoint, message.outcome`.
  Lines before 2026-11-09 carry no endpoint; they were all `player`.
  A `no_token` or `first_reads_spent` add lands on the scheduler's bulk
  lane, a tick or more later.

**Call captures.** The MCP door writes each tool call's request and
response, gzipped JSON, to the archive bucket (`ArchiveBucket`,
`elixir-mcp-archive-<account id>`) at
`calls/dt=<YYYY-MM-DD>/request_id=<id>.json.gz`, keyed by the call's UTC
day (`packages/tools/src/capture.mjs`). They expire after 90 days (the
body a day after its delete marker, `calls-purge-expired`), and
`mcp_call_audit.captured` says whether one was written. Take the request
id from the response's meta, the audit row or the door's log line; read
the object in the S3 console or with a GetObject
(`aws s3 cp s3://<bucket>/calls/dt=<day>/request_id=<id>.json.gz - | gunzip`).
`{refusal_census}` and `{controls_census}` read many at once. A Gym
finding's capture becomes a bite through `acceptance/bites/fetch.mjs`,
which stubs `attested` and `account` items. Attested facts are counted,
never quoted into a note or the repo: a capture holds them whole, and a
leaders-only fact read here is still leaders-only.

**Alarms.** Three (the account keeps alarms only where someone acts on
them): `elixir-mcp-ledger-dead-jobs` and `elixir-mcp-scheduler-missing`
since 2026-11-03, `elixir-mcp-turnstile-mail-dropped` since 2026-11-28
(docs/OPERATIONS.md, "Sign-in Turnstile"). Database free storage (under
2 GiB, or a week's trend reaching it within 7 days) and the three
dead-letter queues are otto-ops' hourly `check-cloud-metrics` Dagu job,
which posts to #sysadmin-log and the Otto Daily page. Each alarm
publishes to SNS `elixir-mcp-alarms`, which feeds the sysadmin
`projects-ops-alerts` queue, drained by otto-ops' `post-morning-digest`
at 05:55 Central into #ops-digest. No email.
Grafana on Otto (`otto-ops`: the Elixir and Elixir product dashboards)
shows the metrics and logs, including those the removed alarms read, for
a person looking.
Firing now: `aws cloudwatch describe-alarms --alarm-name-prefix elixir-mcp- --state-value ALARM`.

**The jobs Lambda** (`elixir-mcp-jobs`) has its own payload keys, such as
`{capture_efficiency}` and `{shape_census}`: scheduled product work,
outside this catalogue; `docs/OPERATIONS.md` names the ones worth
reading. Run them with `npm run op -- '<payload>' --function jobs`.
Every one of them is a write and takes the lock: the one read,
`{series_metrics}`, retired on 2026-11-13, as the clan report preview
did with the retired clan report's builder.

## Choosing the read

| Question | Read |
| --- | --- |
| Is the pipeline healthy? | the status endpoint, then `{stats}` |
| Why is the web slow? Which route or tool is over its ceiling? | `npm run web-latency -- --days 7` |
| Why is this tool slow for this call? | `{profile_tool}` with `"explain": true`; the tool's `explain_*` op if it has one |
| Which subjects lose battles to capture gaps? | `{capture_audit}` |
| Why was this subject or board not fetched? | `{poll_state}` |
| What are the dead jobs? | `{ledger}` with `"op": "dead"` |
| How do agents use the tools, and where do they fail? | `{audit_census}`, `{args_census}`, `{call_sequence_census}` |
| Which values were refused? | `{refusal_census}` |
| What feedback is unanswered? | `{feedback_pending}` |
| What was a Clan draft's model told? | `{clan_maintenance}` with `"lane": "draft_packet"` |
| What is the database doing right now? | `{backends}` |
| Where is the database's weight? | `{tables}` |
| How bloated are `battle`'s indexes? | `{reindex}` with only `table` |
| How much dead space does a table carry, and can a rewrite return it? | `{tables}` (heap, index and dead tuples); `{rewrite_table}` is the WRITE that returns it, Jamie's window only |
| What do the series tables hold? | `{series_status}` |

## Adding or removing an op

An op lands with its row in `ops.md` in the same commit, and leaves with
it: `services/migrate/test/ops-catalogue.test.mjs` compares the keys
`lambda.mjs` dispatches with the rows and fails `npm run verify` on a
difference either way. The op's doc comment states its payload, its
question, and that it only reads or what it writes; the row carries that,
marks a write plainly and names who may run it.

Files in this skill

  • SKILL.md15.8 KB
  • ops.md49.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in devops →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.