How Kiro operates The Trinity Beast Infrastructure — pre-built API routines, deployment automation, and session-persistent context.
The Kiro Command Center (KCC) is a set of pre-built operational routines that Kiro uses to manage The Trinity Beast Infrastructure (TBI). It consists of a bash dispatcher (scripts/kcc.sh) with 35+ commands, a Python module layer (scripts/kcc_helpers/ — 14 scripts sharing ume.py), a steering file (.kiro/steering/kiro-command-center.md) that loads automatically at the start of every session, and a live web dashboard at cpmp-site.org/docs/dashboard.html.
Instead of building curl commands from scratch for every health check, deployment, or verification, Kiro calls the KCC script. This eliminates repetitive command construction, ensures consistency, and reduces the chance of errors during operations.
In short: The TBCC is Cory's Command Center (browser-based, WebSocket relay to Neo). The KCC is Kiro's Command Center (script-based, direct API calls from the development environment). Both operate the same infrastructure through the same API endpoints with the same admin key.
During a typical session, Kiro performs dozens of operations against The TBI — health checks after deployments, endpoint verification after code changes, cluster stats during monitoring, payment link status checks, and feed status reviews. Each of these requires:
https://api.cpmp-site.org for LPO, https://lrs.cpmp-site.org for LRS)X-Admin-Key headerWithout the KCC, every operation is a hand-built curl command. With the KCC, it's a single call:
# Without KCC (manual)
curl -s -H "X-Admin-Key: tbmc-admin-..." https://api.cpmp-site.org/admin/cluster-stats | python3 -m json.tool
# With KCC (one command)
bash scripts/kcc.sh cluster-stats
The steering file ensures Kiro always has the admin key, resource names, and operational procedures loaded in context — even after a session restart or context compaction.
Located at .kiro/steering/kiro-command-center.md with inclusion: auto. This means it is loaded into Kiro's context at the start of every session — no manual activation required. It contains:
Located at scripts/kcc.sh. A bash dispatcher that routes commands to the appropriate Python helper or executes inline bash logic. Each command:
ADMIN_KEY, LPO_BASE) for Python helperskcc_helpers/*.pyscripts/kcc_helpers/)A directory of 14 Python scripts that handle the heavy lifting. All share a single module: ume.py (Unified Messaging Envelope helper).
Single source of truth: The admin key lives in exactly ONE Python file (ume.py) + ONE shell script (kcc.sh). All 14 helper scripts import from ume.py — zero hardcoded keys elsewhere. On key rotation, update those 2 files. Everything downstream inherits automatically.
The shared ume.py module provides:
| Function | Purpose |
|---|---|
admin_get(path) | GET with admin key, returns raw UME envelope dict |
admin_post(path, body) | POST with admin key, returns raw UME envelope dict |
valkey(command) | POST /admin/valkey shorthand — one-liner for any Valkey command |
ume_unwrap(envelope, label) | Strict unwrap: check 2xx, return .data, raise UMEError on failure |
ume_get(path, label) | admin_get + ume_unwrap in one call |
ume_post(path, body, label) | admin_post + ume_unwrap in one call |
ume_get_or_exit(path) | Like ume_get but prints error and exits on failure |
New KCC helpers always import from ume.py — never hardcode credentials or re-implement the envelope unwrap logic.
The admin API key (tbcc-admin-*) authenticates every operational request against the TBI admin endpoints. As of June 2026, the key is fully centralized — no hardcoded copies exist outside the two canonical source files.
Two files own the key. Everything else inherits.
| Layer | File | How It Gets the Key |
|---|---|---|
| Python (canonical) | scripts/kcc_helpers/ume.py | os.environ.get("ADMIN_KEY", "<fallback>") — env override supported, fallback is the current key |
| Shell (canonical) | scripts/kcc.sh | Line 48: ADMIN_KEY="tbcc-admin-..." — exported to env for child processes |
| Python helpers (14) | scripts/kcc_helpers/*.py | from ume import ADMIN_KEY — zero local definitions |
| External scripts | scripts/seed_prewarm_traffic.py | sys.path.insert + from ume import ADMIN_KEY |
| Legacy shell scripts | scripts/{backfill,seed-valkey-langs,...}.sh | ${ADMIN_KEY:-fallback} — reads env var with inline fallback |
| Steering file | .kiro/steering/kiro-command-center.md | Plaintext reference (loaded into Kiro's context) |
| Lambda functions (6) | Environment variables | ADMIN_KEY env var on each function config |
| ECS tasks (2) | Task definition env | ADMIN_KEY in container environment (sync job + translate worker) |
On key rotation (bash scripts/kcc.sh rotate-admin-key):
kcc.sh self-updates (automated by the rotation command)scripts/kcc_helpers/ume.py — manual update (single line).kiro/steering/kiro-command-center.md — manual updateaws lambda update-function-configuration (no rebuild needed)All 14 Python helpers, all legacy scripts, and all external consumers inherit the new key immediately — no additional files to touch.
Key rotation race condition: When rotate-admin-key updates Aurora and calls reload-params, the reload request authenticates with the OLD key. Once the first container reloads, it rejects the old key — so subsequent reload calls to other containers may fail. The command mitigates this by calling reload rapidly in a loop so the ALB round-robins across all nodes before propagation completes.
All commands are invoked as bash scripts/kcc.sh <command>.
Checks all services — LPO health, LRS health, and cluster stats (3/3 nodes reporting). This is the first command run after every ECS deployment.
bash scripts/kcc.sh health
# Output:
# LPO: ✅ [LPO] [us-east-2] [BeastMirror] [/health] [200]
# LRS: ✅ [LRS] [us-east-2] [BeastLRS] [/health] [200]
# Cluster: Nodes: 3/3
# BeastMain: published 2026-04-26T19:04:29Z
# BeastMirror: published 2026-04-26T19:04:29Z
# BeastLRS: published 2026-04-26T19:04:28Z
Verifies the last nightly sync job ran successfully. Pulls the most recent log stream from CloudWatch (/aws/ecs/trinity-beast-sync) and displays run time (EST), completion status, duration, cache totals, and per-category sync counts (price logs, usage logs, API keys, app params, cleanup). Run this every morning right after health.
bash scripts/kcc.sh sync-check
# Output:
# Run Time: April 28, 2026 at 01:00 AM EST
#
# Status: ✅ Sync complete
# Duration: 186.909018ms
# Cache: 3285260 logs in Cache
#
# Sync Results:
# Price logs: 72 new logs loaded
# Usage logs: 19 entries written to Cache
# API keys: 2 keys written to Cache
# App params: 60 params written to Cache
# Cleanup: 🟢 Pruned 0 old logs (>93 days)
Hits 16 key endpoints (6 public + 10 admin) and reports the HTTP status code for each. Used after major changes to confirm nothing is broken.
bash scripts/kcc.sh verify
# Output:
# Public Endpoints:
# ✅ GET /health (LPO) — 200
# ✅ GET /health (LRS) — 200
# ✅ GET /exchanges — 200
# ✅ GET /asset-categories — 200
# ...
# Admin Endpoints:
# ✅ GET /admin/config — 200
# ✅ GET /admin/cluster-stats — 200
# ...
Returns the full cluster-wide metrics snapshot — all 24 counters aggregated across all 4 containers via ElastiCache pipeline read.
bash scripts/kcc.sh cluster-stats
Shows all 16 payment links with their enabled status, click counts, and Stripe URLs. Used to verify link configuration before and after Stripe setup.
bash scripts/kcc.sh payment-links
# Output:
# Total: 16 links
# Type Tier Enabled Clicks URL
# subscription pro ✅ 42 https://buy.stripe.com/xxx...
Shows the connection status of all 6 exchange WebSocket feeds with subscription counts and stale asset counts.
bash scripts/kcc.sh feed-status
# Output:
# coinbase_ws ✅ Connected Subs: 12 Stale: 0
# bitstamp_ws ✅ Connected Subs: 12 Stale: 0
# kraken_ws ✅ Connected Subs: 12 Stale: 0
# gateio_ws ✅ Connected Subs: 12 Stale: 0
# cryptocom_ws ✅ Connected Subs: 12 Stale: 0
# okx_ws ✅ Connected Subs: 12 Stale: 0
Full ECS deployment pipeline — Docker build (no-cache), ECR tag, ECR push, force deploy all 4 services. The most common deployment command.
bash scripts/kcc.sh deploy-ecs
# Builds → Tags → Pushes → Force deploys main, mirror, LRS
# Then: bash scripts/kcc.sh health (after ~40s)
Uploads HTML files to S3 and invalidates CloudFront. Automatically strips the cpmp-redesign/ prefix to determine the S3 path.
bash scripts/kcc.sh deploy-site cpmp-redesign/docs/Trinity-Beast-API-Reference.html
bash scripts/kcc.sh deploy-site cpmp-redesign/subscribe-listener.html cpmp-redesign/docs/index.html
Lists all 16 system profiles with their key parameters (QPS, burst, TTL, DB pool size).
bash scripts/kcc.sh profiles
Shows the current application parameters — cache TTL, prewarm intervals, pool sizes, demo key, etc.
bash scripts/kcc.sh config
Collects all infrastructure metrics (endpoints, feeds, cluster, Valkey, Lambda, sync, SQS queue, website analytics) and stores them as a single JSON blob in Valkey (kcc:daily key, 24h TTL). This is the data source for both the CLI daily command and the KCC Live Dashboard.
bash scripts/kcc.sh daily-collect
Renders the compact daily status dashboard from the Valkey cache. If no cached data exists, it auto-runs daily-collect first. Shows services, ECS nodes, Valkey health, Lambda, nightly sync, SQS queue depth, and 7-day website analytics.
bash scripts/kcc.sh daily
# Output:
# ════════════════════
# KCC — May 02 02:11PM EDT
# ════════════════════
# ─── Services ───
# ✅ LPO ✅ LRS ✅ Web
# Cluster: 3/3
# ─── SQS Usage Queue ───
# ✅ Pending: 0 In-flight: 0
# ─── Website (7d) ───
# Total 14,250 2.2GB Avg 2,035/day
Security dashboard — CloudFront WAF (24h blocks), API WAF (per-rule breakdown), GuardDuty threat detection, CloudWatch security alarms, and application rate limiting stats.
bash scripts/kcc.sh security
Reloads all application parameters from Aurora → local cache + ElastiCache, re-parses prewarm asset lists, flushes prices, and resets all timers across all containers. Use after changing application_parameters in the database.
bash scripts/kcc.sh force-deploy
Validates all 360 prewarm assets across 6 exchanges against their live APIs, in 5 layers (live-price check, EAM↔legacy-param drift, master-list sync, an end-to-end smoke test, and category hygiene). Reports any dead/delisted assets that need replacement. Run periodically — exchanges delist and rebrand assets more often than expected.
GET /admin/eam/audit (async, results in ~12s) and renders results visually — per-exchange bars, inline Disable/Replace buttons for dead assets, and one-click drift remediation. Use the CLI command for terminal sessions; use the panel for interactive maintenance.
bash scripts/kcc.sh prewarm-audit
# Output:
# ✅ COINBASE 26/26 OK
# ✅ CRYPTOCOM 24/24 OK
# ✅ GATEIO 24/24 OK
# ✅ BITSTAMP 29/29 OK
# ✅ KRAKEN 26/26 OK
# ✅ OKX 36/36 OK
Fetches the top 750 coins by market cap from CoinGecko's free API, matches by symbol against enabled EAM assets, and populates icon_url for any asset missing one. Icons are served to subscribers via the /asset-categories response and displayed in the demo dropdown.
bash scripts/kcc.sh sync-icons
# Output:
# Mode: Fill missing icons only
# Assets needing icons: 37
# Fetching CoinGecko market data...
# Page 1/3... 250 coins
# Page 2/3... 250 coins
# Page 3/3... 250 coins
# CoinGecko unique symbols: 712
# Matched: 28 | Still missing: 9
# Writing 28 icon URLs to Aurora... ✅ 28 rows updated (42ms)
# Use --force to overwrite all existing icon URLs:
bash scripts/kcc.sh sync-icons --force
Rebuilds the multi-lingual full-text search index from all 32 documents across 12 languages (384 total) plus daily operations reports (English only, 30-day rolling archive). Fetches each doc from CloudFront, parses HTML into sections, and stores per-language indexes in Valkey. Run after deploying new or updated documents. The nightly sync also triggers this automatically.
Search features: Paginated results (9 per page), multi-lingual scoring, daily report indexing, and an interactive Search Demo showing the English → Japanese flow.
bash scripts/kcc.sh build-search
Pushes all 12 language JSON files from cpmp-redesign/lang/ to Valkey (lang:{code} keys). The i18n system's primary source is the API (/public/lang/{code}), which reads from Valkey. If language files are edited locally and deployed to S3 but NOT pushed to Valkey, the API serves stale data and new i18n keys won't appear on the website. Run after any edit to language JSON files.
bash scripts/kcc.sh push-langs
Pushes the impact messages JSON (cpmp-redesign/data/impact-messages.json) to S3 and Valkey (impact:messages key). These are the localized donation impact messages used by the receipt Lambda (12 languages × 10 impact types). Run after editing any impact message text. The BeastReconciler also refreshes this nightly from S3.
bash scripts/kcc.sh push-impact-messages
Shows the current state of the email queue (trinity-beast-email-queue): messages waiting, messages in-flight, and optionally peeks at the oldest message. Useful for verifying the email-sender Lambda is draining correctly or debugging delivery delays.
bash scripts/kcc.sh email-queue
# Output:
# ═══════════════════════════════
# Email Queue Status
# ═══════════════════════════════
# Messages waiting: 0
# Messages in-flight: 0
# ✅ Queue is empty (emails delivered)
Manually enqueues an email message to the email queue for delivery by the email-sender Lambda. Useful for testing the SQS → SES pipeline or sending one-off operational emails through the standard delivery path.
bash scripts/kcc.sh email-send "user@example.com" "Test Subject" /tmp/email-body.html
Validates that TBI-CHUNK markers are preserved through the translation reassembly pipeline for a given document. Checks that chunk count in the source matches chunk count in the reassembled output. Run before submitting a document to the translation engine to confirm chunk integrity.
bash scripts/kcc.sh delta-validate Trinity-Beast-API-Reference.html
# Output:
# Source chunks: 12
# Output chunks: 12
# ✅ Chunk markers preserved — safe to submit
Scans a document and reports the size of each chunk between TBI-CHUNK markers. Flags any chunks that exceed the translation engine's size policy (15 KB baseline, 18 KB max, 12 KB for dense/code-heavy sections). Also suggests where to add new markers if any chunk is over-limit. Run before submitting large or recently updated documents to the translation engine.
bash scripts/kcc.sh chunk-size cpmp-redesign/docs/Trinity-Beast-API-Reference.html
# Output:
# Chunk 1: 11.2 KB ✅
# Chunk 2: 14.8 KB ✅
# Chunk 3: 17.1 KB ⚠️ approaching limit
# Chunk 4: 9.3 KB ✅
# Chunk 5: 19.4 KB 🛑 OVER LIMIT — add TBI-CHUNK near line 412
Forensic trace of an IP address — WAF blocks (last 24h sampled requests) and usage logs from Aurora. Shows what the IP was doing and whether WAF caught it.
bash scripts/kcc.sh trace-ip 45.148.10.247
Forensic trace of an API key — owner details (email, name, tier), recent activity (last 50 calls), and unique IPs used.
bash scripts/kcc.sh trace-key demo-public-2026-03-01-abc123
Full account trace — user account, API keys, transactions, and support tickets for an email address.
bash scripts/kcc.sh trace-email user@example.com
Shows WAF blocks by rule (last 24h) and GuardDuty findings (severity ≥ MEDIUM). Quick threat visibility without the full security dashboard.
bash scripts/kcc.sh threat-log
Current defense posture — manually blocked IPs (WAF IP set) and any firing CloudWatch alarms.
bash scripts/kcc.sh threat-status
Adds an IP to the WAF block list (trinity-beast-blocked-ips IP set). Creates the IP set if it doesn't exist. Immediate effect — all requests from this IP get 403.
bash scripts/kcc.sh block-ip 1.2.3.4
Removes an IP from the WAF block list.
bash scripts/kcc.sh unblock-ip 1.2.3.4
Immediately revokes an API key — sets status to 'revoked' in Aurora and deletes the cached key from ElastiCache. All subsequent requests with this key get 403 Forbidden.
bash scripts/kcc.sh kill-key abc123-compromised-key
Sends a threat warning email to the subscriber who owns the specified API key. Uses the ThreatWarning SES template. Does not revoke the key — this is a first-strike warning.
bash scripts/kcc.sh warn-subscriber abc123-key "Unusual request patterns detected from your API key"
Full subscriber termination — revokes key, cancels Stripe subscription (prorated refund), blocks all source IPs, and sends termination notice via SES. Irreversible. Generates a violation ID for audit trail.
bash scripts/kcc.sh terminate-subscriber abc123-key "Repeated abuse after warning"
Generates a new admin key, updates Aurora application_parameters, flushes the old key from Valkey, force-deploys params to all containers, and self-updates the KCC script. The old key is immediately invalid. Use when the admin key may be compromised.
After rotation, only 2 files need manual update: ume.py (Python canonical source) and the steering file. All 14 helpers and legacy scripts inherit automatically. See Section 3 — Credential Centralization for the full propagation map.
bash scripts/kcc.sh rotate-admin-key
# Output:
# Old key: tbcc-admin-ec...e380
# New key: tbcc-admin-7f3a...b291
# [1/4] Updating Aurora application_parameters...
# [2/4] Flushing old key from Valkey...
# [3/4] Force deploying params to all containers...
# [4/4] Updating KCC script with new key...
# ✅ Admin key rotated successfully
#
# Post-rotation (manual):
# 1. Update ume.py fallback value
# 2. Update kiro-command-center.md steering
# 3. Update 6 Lambda env vars (aws lambda update-function-configuration)
# 4. Update 2 ECS task definitions (sync job + translate worker)
Creates a WAF rule (priority 0 — highest) that blocks ALL /admin/* requests unless they originate from the specified IP. Emergency use — locks out everyone except you. To find your IP: curl -s ifconfig.me
bash scripts/kcc.sh lockdown-admin 73.42.156.89
# Only 73.42.156.89 can now reach /admin/* endpoints
# All other IPs get blocked at WAF before reaching the server
Removes the admin lockdown WAF rule, restoring normal admin access for all authenticated requests.
bash scripts/kcc.sh unlock-admin
Adds a geo-match WAF rule to the ALB that blocks ALL traffic from specified countries (ISO 3166-1 alpha-2 codes). Idempotent — running again replaces the previous list. Use during sustained regional attacks.
bash scripts/kcc.sh block-country "RU CN"
bash scripts/kcc.sh block-country "RU CN IR KP"
Removes the country geo-block rule entirely, allowing all geographic traffic.
bash scripts/kcc.sh unblock-country
Resets a customer's API key tier with full history tracking. Applies rate_limit_template values for the target tier, resets monthly usage to 0, and invalidates the API key cache across all ECS nodes. The stripe_customer_id is preserved so dashboard login continues to work.
When to use: Customer requests cancellation/downgrade via support, admin testing (cycling through tiers), or correcting a tier set incorrectly. If the customer has an active Stripe subscription, cancel it in Stripe first, then run this to reset the local tier.
# Basic tier reset (no refund)
bash scripts/kcc.sh admin-tier-reset customer@email.com free
# With full refund of most recent charge
bash scripts/kcc.sh admin-tier-reset customer@email.com free --refund
# With partial refund ($50)
bash scripts/kcc.sh admin-tier-reset customer@email.com free --refund-amount 50.00
# Specify which key (if customer has multiple)
bash scripts/kcc.sh admin-tier-reset customer@email.com free --key-id bb1fdafb-a009-...
Valid tiers: free, pro, enterprise, unlimited, lifetime
Options:
--key-id <uuid> — Specify which key (required if customer has multiple non-translation keys)--refund — Issue a full refund of the most recent Stripe charge--refund-amount <N.NN> — Issue a partial refund (in dollars)What it does (in order):
--refund: issues Stripe refund via POST /admin/refund — customer receives refund email automaticallytier_change_history (source: admin-tier-reset)rate_limit_templatecurrent_usage to 0What it preserves: stripe_customer_id (dashboard login), the API key string itself, user_id (account association), and all historical data.
Refund ≠ Subscription Cancellation. The --refund flag refunds the most recent charge. It does NOT cancel an active Stripe subscription. For recurring subscriptions, cancel in Stripe first. For one-time purchases (Go Lifetime), there is no subscription to cancel — just refund + tier reset.
Appends a release note to the weekly accumulator in Valkey (autoops:release-notes:week). These notes are read by the digest Lambda on Monday morning and included as a "What's New" section in the weekly subscriber newsletter. Run at the end of each session to capture subscriber-facing improvements.
bash scripts/kcc.sh release-notes "Branded HTML email notifications for all AutoOps alerts"
# Output:
# ✅ Release note added (#3 this week)
# Branded HTML email notifications for all AutoOps alerts
Shows all accumulated release notes for the current week. Use to review what will appear in Monday's newsletter.
bash scripts/kcc.sh release-notes-show
# Output:
# 1. [2026-05-10] Branded HTML email notifications via SES
# 2. [2026-05-10] SNS-to-Lambda notification pipeline
# 3. [2026-05-10] Weekly newsletter Gmail-compatible dark theme
#
# Total: 3 notes
Clears all accumulated release notes. Done automatically after the weekly newsletter sends successfully. Manual use only needed if you want to start fresh mid-week.
bash scripts/kcc.sh release-notes-clear
Lists recent Stripe events with type, ID, and timestamp. Filterable by event type (supports wildcards like customer.subscription.*), result count, and delivery status. Defaults to last 15 events.
bash scripts/kcc.sh stripe-events --type charge.refunded --limit 5
# Output:
# ID Type Created
# ----------------------------- ----------------------- -------------------
# evt_3TuExsAM8MECeobB0olAbqXO charge.refunded 07/17 12:50 PM
# evt_3TuEw7AM8MECeobB2Ex9TNai charge.refunded 07/17 12:48 PM
# Total: 2 events shown
Shows full details of a Stripe event — type, timestamp, mode (test/live), API version, pending webhooks, object summary (ID, status, customer, amount, subscription), and metadata.
bash scripts/kcc.sh stripe-event evt_1TuF8QAM8MECeobBhajm1tnT
# Output:
# Type: customer.subscription.updated
# Created: 2026-07-17 01:01:14 PM EST
# Mode: 🧪 TEST
# ─── Object Summary ───
# ID sub_1TuF8LAM8MECeobBnvuXZvh8
# Status active
# Customer cus_Uu3ETfHHwcRs3G
Resends a Stripe event to the webhook endpoint (receipt.cpmp-site.org/webhook) and tails the receipt Lambda logs for 15 seconds. Shows event details first so you confirm what you're replaying before it fires.
bash scripts/kcc.sh stripe-replay evt_3TuExsAM8MECeobB0olAbqXO
# Output:
# ─── Event Details ───
# Type: charge.refunded
# Created: 2026-07-17 12:50 PM
# Mode: 🧪 TEST
# amount: $1.00
# ─── Resending to Webhook ───
# ✅ Event resent successfully
# ─── Lambda Logs (tailing 15s) ───
# 2026/07/17 18:28:54 [us-east-2|ReceiptLambda|Lifecycle] 🟡 Refund event has no customer ID — skipping
Use cases: testing receipt Lambda after a deploy, debugging failed deliveries, re-triggering emails, verifying plan-switch or refund handling end-to-end.
Deploys an English document to S3, invalidates CloudFront, updates the doc registry in Valkey, queues for translation, and triggers a search index rebuild. One command handles the entire publish pipeline.
bash scripts/kcc.sh doc-publish Trinity-Beast-API-Reference.html --reason "Added EAM endpoints"
Finalizes a session report — uploads to S3, appends to the session log in Valkey (docs:session:log), and writes the plain-text version for the weekly newsletter (report:text:YYYY-MM-DD).
bash scripts/kcc.sh session-close 2 "UME helper migration, doc updates, steering cleanup"
Without flags: validates all queued docs' Mermaid diagrams, then submits to the translation engine in batches of 6. With --list: shows the pending queue without submitting. Reads from docs:pending:translation sorted set.
bash scripts/kcc.sh translate-pending --list
# Output:
# 39 docs pending translation:
# Trinity-Beast-API-Reference.html — "Added EAM endpoints" (2026-06-11)
# Trinity-Beast-Go-Application-Features.html — "Multi-provider Bedrock" (2026-06-07)
# ...
Shows the full document registry (44 docs: ✓ current / ⏳ pending / ★ new). Use --pending to see only docs queued for translation, or --status <file> for a single doc's entry.
bash scripts/kcc.sh doc-registry --pending
Audits every CloudWatch alarm for three failure modes an alarm can be in without ever telling you: blind dimensions (pointing at a resource that no longer exists), flapping (≥6 ALARM transitions in the window, default 24h), and muted-but-still-automating (ActionsEnabled: false that still fires the self-heal EventBridge rule on every state change). A fourth check inverts the direction — coverage — enumerating what should be monitored and diffing against what actually has an alarm, which is the only way to catch a resource that was never alarmed on at all. Multi-region by default (us-east-2 + us-east-1); every result line states its scope.
bash scripts/kcc.sh alarm-audit # us-east-2 + us-east-1
bash scripts/kcc.sh alarm-audit --advisory # list every advisory-tier coverage gap
bash scripts/kcc.sh alarm-audit --all-regions # sweep all enabled regions
Checks ownership, not health. Finds hand-maintained resources that look fine today and will rot silently on the next deploy — target groups no ECS service declares in its loadBalancers config, empty non-default VPCs, Lambda log groups whose function is gone, log groups with no retention, unattached security groups and volumes, and undocumented VPC Lattice resources. Built after the 2026-07-30 PrivateLink incident, where two target groups held stale ip-type targets from long-dead tasks for months because nothing owned them. 13 checks, multi-region by default.
bash scripts/kcc.sh orphan-audit --quiet
Configuration is not delivery. This checks whether each S3-delivered log feed (WAF, ALB, CloudFront, S3-access, CloudTrail) is actually landing objects, by recency — not by whether the delivery config still names the bucket. Built after WAF and ALB logs were silently dead for 50 days (a bucket-policy overwrite) while every config check still reported the destination as configured.
bash scripts/kcc.sh log-freshness
Confirms three stores agree on every transactional-email label key: the Go code that calls frame(), the data file (email-frames.json) that defines the key across all 12 languages, and the live Valkey email:frames hash the Lambda actually reads. A key present in one store but not the next renders raw keys or falls back to English silently — both have happened. Checks language completeness, placeholder-token parity, and flags any data-file key no code path references (informational, not a failure).
bash scripts/kcc.sh frames-check
Runs prewarm-audit, alarm-audit, orphan-audit, and log-freshness in sequence and rolls the four verdicts into one pass/fail, exiting non-zero if any fails. --quiet collapses a clean audit to one line and prints full detail only for a failure. --skip-orphan skips the slow orphan-audit leg for routine post-deploy checks — the convention is to run the full five-audit set (this command plus frames-check) once per day during the morning sweep, and use --skip-orphan every other invocation that day.
bash scripts/kcc.sh audit-all --quiet --skip-orphan # standard post-deploy combo
The only command that tests the public UDP API — curl can't speak UDP, so nothing else covers ports 2679 (LPO price feed) and 2680 (LRS reports) from outside AWS. Sends 30 loss-probes per port by default, reports reply-loss %, latency spread, which cluster nodes answered, and UME envelope conformance. Since 2026-08-07 also covers the Webhook Push Test Receiver, both transports — an HTTPS probe expecting a 403 (the allow-list correctly rejecting an unauthenticated request) and a UDP probe verified via a Valkey receipt rather than a socket reply, since that receiver is fire-and-forget by design. WARN at ≥3 lost probes, FAIL at ≥33% loss — calibrated so ordinary UDP loss (the protocol, not a fault) doesn't cry wolf.
bash scripts/kcc.sh udp-check # 30 probes/port, routine volume
bash scripts/kcc.sh udp-check --quick # reachability only
bash scripts/kcc.sh udp-check --probes 33 # custom volume
(alias secview.) Renders all five defence layers on one screen — perimeter (WAF/Shield), application (rate limits/honeypot), detection (GuardDuty/alarms/Bedrock), autonomous response (WAF auto-block set + AutoOps actions), and visibility (is the WAF log feed actually delivering) — ending in one posture verdict: SECURE, ELEVATED, or CRITICAL. Replaces running security + threat-log + threat-status + a manual Bedrock pull separately. Layer 5 (visibility) is deliberately included because a stale WAF log feed once went unnoticed for 50 days while every other layer looked fine.
bash scripts/kcc.sh security-view
The entire First Session (and Last Session) morning routine in one invocation: daily-collect + daily, udp-check, the full audit-all (always the full five-audit set — this is the once-daily orphan-audit anchor, and does not accept --skip-orphan), and security-view. One rolled-up verdict at the end. Runtime ~90-120s for a default two-region run; replaces four separate invocations and the chance of skipping one.
bash scripts/kcc.sh morning
The honeypot auto-block WAF IP set grows without bound by design — every decoy-path hitter gets added, nothing removes them. This ages out honeypot-attributed blocks after 90 days (default), using a durable ledger that is independent of the flaky per-IP Valkey hash. Dry-run by default; never expires a manually-added block-ip entry, since those have no honeypot evidence and should stay permanent.
bash scripts/kcc.sh honeypot-prune # dry-run, reports only
bash scripts/kcc.sh honeypot-prune --apply # commit the prune
Pulls real, exchange-reported 24-hour USD trading volume for every prewarm asset — one bulk-ticker call per exchange, not one call per asset — and writes it to exchange_asset_map.volume_24h_usd/volume_updated_at. This is market-wide trading volume, deliberately distinct from our own query-count ranking; it powers the "Most Traded" sort toggle on the webhook and partner asset pickers. Run weekly, or before a asset-rebalance pass.
bash scripts/kcc.sh refresh-volume # all 6 exchanges
bash scripts/kcc.sh refresh-volume bitstamp # single exchange
Manages who the in-process Webhook Push Test Receiver (webhook.cpmp-site.org / udp.cpmp-site.org:2681) will accept deliveries for — table-driven against webhook_test_receiver_allowlist since 2026-08-09, replacing what used to be a hardcoded Go allow-list. A change here takes effect within 10 seconds (the same TTL as the server's own in-memory cache) — zero ECS redeploy, zero restart.
bash scripts/kcc.sh webhook-test-allowlist list
bash scripts/kcc.sh webhook-test-allowlist add <subscription_id> "<label>"
bash scripts/kcc.sh webhook-test-allowlist remove <subscription_id>
bash scripts/kcc.sh webhook-test-allowlist add-by-email <email> "<label>"
Backfills and maintains stripe_customer_xref — the table mapping many Stripe cus_... customer records to one users.id, keyed by case-insensitive email. Standalone Stripe Payment Links (the LRS addon, and others) mint a new Stripe customer on every purchase, orphaned from the account's real customer record — this closes that gap so a repeat purchase can attach to the existing customer instead of creating a disconnected one. Read-only by default; never writes to Stripe, never cancels or refunds anything.
bash scripts/kcc.sh stripe-xref --view # print the current table
bash scripts/kcc.sh stripe-xref --apply # commit the backfill
Translates JSON string values through the same Qwen 3 235B pipeline the doc-translation engine uses — brand-term tokenization plus mechanical verification (placeholder parity, correct script per language, not identical to English) — for one-off key additions that don't warrant a full document translation job. Built after the same ad hoc "translate these dashboard i18n keys" or "translate this new email-frame family" script had been hand-rebuilt from scratch three separate times.
Two modes: --namespace reads the English value(s) directly from cpmp-redesign/lang/en.json under the given dotted key path and merges the translations straight into all 11 other language files. --pairs takes an arbitrary {"key": "English text"} object and prints the per-language result to stdout, for cases like email-frames.json where the caller decides the destination.
bash scripts/kcc.sh translate-kv --namespace docLibrary --keys cardTitle33,cardDesc33
bash scripts/kcc.sh translate-kv --pairs '{"newKey":"New English string"}' --dry-run
Escalation Sequence (Admin Key Compromise):
bash scripts/kcc.sh lockdown-admin $(curl -s ifconfig.me) — lock everyone else out NOWbash scripts/kcc.sh rotate-admin-key — invalidate the compromised keybash scripts/kcc.sh threat-log — check what damage was donebash scripts/kcc.sh trace-ip <attacker_ip> — forensicsbash scripts/kcc.sh block-ip <attacker_ip> — permanent banbash scripts/kcc.sh unlock-admin — restore normal access once safeThe steering file at .kiro/steering/kiro-command-center.md is marked with inclusion: auto, which means it is loaded into Kiro's context automatically at the start of every session. This ensures Kiro always has access to:
| Information | Purpose |
|---|---|
| Admin API Key | Authenticate against all admin endpoints without asking |
| LPO / LRS Base URLs | Construct API calls without looking up DNS |
| S3 Bucket Name | Deploy website files to the correct bucket |
| CloudFront Distribution ID | Invalidate the CDN cache after deployments |
| ECR Repository | Push Docker images to the correct registry |
| ECS Cluster + Service Names | Force deploy the correct services |
| Operational Rules | Always health check after deploy, always verify after changes |
Context Persistence: Even if the conversation is compacted due to context window limits, the steering file is reloaded automatically. This means Kiro never loses access to the operational essentials — the admin key, resource names, and procedures survive context compaction.
A typical day starts with a morning check, then moves into the code change → deploy → verify cycle:
~/daily-reports/tbi-ops-YYYY-MM-DD-session-N.html from the last session to pick up context, pending items, and roadmap ideasbash scripts/kcc.sh daily-collect then bash scripts/kcc.sh daily (full infrastructure snapshot — services, ECS, Valkey, Lambda, sync, SQS queue, analytics)bash scripts/kcc.sh prewarm-audit (validate 169 assets across 6 exchanges)bash scripts/kcc.sh threat-log + bash scripts/kcc.sh threat-status (WAF blocks, GuardDuty, alarms, block list)~/daily-reports/tbi-ops-YYYY-MM-DD-session-N.html and S3, open in browsertbi-ops-*)Every session produces an operational report — an HTML document that serves as both a health snapshot and a session log. Reports are stored locally and on S3, accessible via cpmp-site.org/daily-reports/.
| Attribute | Value |
|---|---|
| Naming | tbi-ops-YYYY-MM-DD-session-N.html |
| Local path | ~/daily-reports/ |
| S3 path | s3://trinity-beast-website-east2/daily-reports/ |
| Public URL | cpmp-site.org/daily-reports/ |
| Language | English (Google Translate widget on every report for 130+ languages) |
| Retention | 30 days (default — extensible, not hardcoded) |
Each report contains:
go build ./cmd/server/bash scripts/kcc.sh deploy-ecsbash scripts/kcc.sh health (confirm 3/3 nodes)bash scripts/kcc.sh verify (confirm all 200s)bash scripts/kcc.sh deploy-site cpmp-redesign/docs/...This entire cycle takes about 3 minutes of active work plus ~40 seconds of waiting for ECS. Without the KCC, each step would require constructing individual commands with the correct URLs, headers, and parameters.
The KCC Live Dashboard is a browser-based visual interface at cpmp-site.org/docs/dashboard.html that renders the same data collected by daily-collect. It provides:
The dashboard is also linked from the TBCC CloudWatch Monitoring widget for quick access during operations.
The Trinity Beast Infrastructure has two command centers, each designed for a different operator:
| Aspect | TBCC (Cory's) | KCC (Kiro's) |
|---|---|---|
| Operator | Cory Dean Kalani | Kiro (AI Development Environment) |
| Interface | Browser-based dashboard | Bash script + steering file + Live Dashboard |
| Access Method | WebSocket relay to Neo MacBook | Direct API calls from dev environment |
| Terminal | Built-in browser terminal | IDE terminal (Kiro's tool execution) |
| Widgets | Newsletter, Support, Email, CloudWatch, Stripe, Testing, AWS Ops, Partners, Exchange Manager, Cluster Health | 35+ bash/Python commands covering health, deploy, security, translation, analytics, and more |
| Authentication | Admin key stored in localStorage | Admin key in ume.py (single source) + steering file (auto-loaded) |
| Deployment | Copy commands → paste in local terminal | Direct execution via deploy-ecs and deploy-site |
| Persistence | Browser session | Steering file survives context compaction |
| URL | cpmp-site.org/admin/trinity-beast-command-center.html | scripts/kcc.sh |
Same API, different interfaces. Both command centers call the same endpoints with the same admin key. The TBCC is optimized for visual monitoring and manual operations. The KCC is optimized for automated, repeatable operations during development sessions.
The KCC includes a full set of commands for operating the custom Bedrock-powered translation engine. This engine translates all 32 technical documents into 11 languages using sentinel preprocessing to protect code blocks, Mermaid diagrams, and brand terms. Never use AWS Translate for document translation — it corrupts code blocks and brand terms.
Cost guardrails: $600/day spend cap (autoops:bedrock:spend:daily) + 50M combined token/day secondary cap (autoops:bedrock:tokens:input:daily + autoops:bedrock:tokens:output:daily). Both reset at midnight UTC via 24h TTL. Kill switch: SET autoops:bedrock:kill 1 in Valkey to halt all translation immediately.
Enqueues a translation job. The engine handles everything: sentinel preprocessing, Bedrock translation, S3 deployment, CloudFront invalidation, search index rebuild, and email notification. Fire and forget — one API call does it all.
# Single document, all 11 languages
curl -s -X POST -H "X-Admin-Key: $ADMIN_KEY" -H "Content-Type: application/json" \
-d '{"docs":["Trinity-Beast-API-Reference.html"],"langs":"all"}' \
"$LPO_BASE/admin/translate" | jq .
# Multiple documents, specific languages
curl -s -X POST -H "X-Admin-Key: $ADMIN_KEY" -H "Content-Type: application/json" \
-d '{"docs":["Trinity-Beast-API-Reference.html","Trinity-Beast-Architecture-Guide.html"],"langs":["es","pt","fr"]}' \
"$LPO_BASE/admin/translate" | jq .
# Delta mode — skip pairs where translated S3 file is newer than source (saves up to 90%)
curl -s -X POST -H "X-Admin-Key: $ADMIN_KEY" -H "Content-Type: application/json" \
-d '{"docs":["Trinity-Beast-API-Reference.html"],"langs":"all","options":{"delta":true}}' \
"$LPO_BASE/admin/translate" | jq .
# With idempotency key (safe to retry)
curl -s -X POST -H "X-Admin-Key: $ADMIN_KEY" -H "X-Idempotency-Key: api-ref-2026-05-27" \
-H "Content-Type: application/json" \
-d '{"docs":["Trinity-Beast-API-Reference.html"],"langs":"all"}' \
"$LPO_BASE/admin/translate" | jq .
Limits: Max 6 docs per request (multiples-of-3 convention). Max 3 active jobs (additional queue in SQS, depth 12). Max 12 languages per request. Typical cost: ~$1.65 per doc-language pair, ~$18 for 1 doc × 11 langs.
Real-time per-pair progress from Valkey. Shows each language pair's status (pending, in_progress, completed, failed), token counts, and cost.
curl -s -H "X-Admin-Key: $ADMIN_KEY" "$LPO_BASE/admin/translate/status/{job_id}" | jq .
Shows all active and queued jobs with their current state.
curl -s -H "X-Admin-Key: $ADMIN_KEY" "$LPO_BASE/admin/translate/queue" | jq .
Translation engine health snapshot — daily spend, token usage (input + output vs 50M limit), active job count, queue depth. The KCC Live Dashboard also shows this data in the Translation Engine card.
curl -s -H "X-Admin-Key: $ADMIN_KEY" "$LPO_BASE/admin/translate/health" | jq .
# Key fields in response:
# daily_spend_usd — dollars spent today
# daily_input_tokens — input tokens consumed today
# daily_output_tokens — output tokens consumed today
# daily_token_limit — 50,000,000 (50M combined cap)
# active_jobs — currently running Step Functions
# queue_depth — jobs waiting in SQS
Last 50 completed jobs from Aurora — the permanent ledger. Includes job ID, docs, languages, total cost, duration, and completion time.
curl -s -H "X-Admin-Key: $ADMIN_KEY" "$LPO_BASE/admin/translate/history" | jq .
Stops the Step Function immediately. Already-completed pairs are not rolled back — S3 files written before cancellation remain.
curl -s -X POST -H "X-Admin-Key: $ADMIN_KEY" "$LPO_BASE/admin/translate/cancel/{job_id}"
Retries only the failed language pairs from a partial job. Successful pairs are not re-translated. Cost-efficient recovery from partial failures.
curl -s -X POST -H "X-Admin-Key: $ADMIN_KEY" "$LPO_BASE/admin/translate/retry-failed/{job_id}"
Before submitting any document to the translation engine, run these two checks:
Reports the size of each chunk between TBI-CHUNK markers. Policy: 15 KB baseline, 18 KB max, 12 KB for dense/code-heavy sections. Flags over-limit chunks and suggests where to add markers. Do not submit and hope — verify first.
bash scripts/kcc.sh chunk-size cpmp-redesign/docs/Trinity-Beast-API-Reference.html
Confirms that TBI-CHUNK markers survive the translation reassembly pipeline. Chunk count in source must match chunk count in output. Run before submitting documents that have been recently edited.
bash scripts/kcc.sh delta-validate Trinity-Beast-API-Reference.html
| Component | Resource | Purpose |
|---|---|---|
| Worker | ECS Fargate service tbi-translate-worker-service (Python 3.11, 2 vCPU / 6 GB, persistent) | Polls SQS directly, sentinel preprocessing, Bedrock translation, batch job polling, validation |
| CloudFront | Worker handles invalidation directly (boto3) | Immediate invalidation after S3 write |
| Finalization | POST /admin/translate/complete/{job_id} | Search rebuild, notification, cost computation, scale-down (runs in LPO server) |
| Step Function | tbi-translation-orchestrator (v3.0: PerLang Map) | One container per language, all docs sequentially |
| SQS Queue | trinity-beast-translation-queue | Decouples submission from execution |
| Batch Artifacts | S3 trinity-beast-translation-jobs | Bedrock batch inference JSONL input/output |
| Aurora Tables | translation_jobs, translation_job_events, translation_parameters | Permanent ledger + audit log + cost/pricing params |
| Valkey Keys | tx:job:{id}, tx:active, tx:history, autoops:bedrock:spend:daily | Live state + cost tracking |
The KCC calls these endpoints through the unified messaging envelope. All admin endpoints require the X-Admin-Key header.
| Command | Endpoints Called | Auth |
|---|---|---|
health | GET /health (LPO + LRS), GET /admin/cluster-stats | None + Admin |
sync-check | CloudWatch Logs: describe-log-streams, get-log-events on /aws/ecs/trinity-beast-sync | AWS credentials |
verify | 16 endpoints (6 public + 10 admin) | Mixed |
cluster-stats | GET /admin/cluster-stats | Admin |
payment-links | GET /admin/payment-links | Admin |
feed-status | GET /admin/feed-status | Admin |
deploy-ecs | Docker + ECR + ECS (AWS CLI, not HTTP) | AWS credentials |
deploy-site | S3 + CloudFront (AWS CLI, not HTTP) | AWS credentials |
profiles | GET /admin/profiles | Admin |
config | GET /admin/config | Admin |
trace-ip | WAF get-sampled-requests + POST /admin/sql | AWS + Admin |
trace-key | POST /admin/sql (2 queries) | Admin |
trace-email | POST /admin/sql (4 queries) | Admin |
kill-key | POST /admin/sql-batch + POST /admin/valkey | Admin |
terminate-subscriber | POST /admin/sql + Stripe API + WAF + SES | Admin + AWS + Stripe |
rotate-admin-key | POST /admin/sql-batch + POST /admin/valkey + GET /admin/force-deploy-params | Admin |
lockdown-admin | WAF create-ip-set / update-web-acl | AWS credentials |
block-country | WAF update-web-acl (geo-match rule) | AWS credentials |
push-langs | S3 sync + POST /admin/valkey (SET lang:{code}) | AWS + Admin |
build-search | POST /admin/build-search-index | Admin |
doc-publish | S3 + CloudFront + POST /admin/doc-registry/set + POST /admin/doc-pending/add | AWS + Admin |
session-close | S3 + POST /admin/doc-session/log + POST /admin/valkey | AWS + Admin |
doc-registry | GET /admin/doc-registry + GET /admin/doc-pending | Admin |
asset-rebalance | Exchange public APIs + POST /admin/sql-batch + force-deploy | Admin |
sync-eam | POST /admin/sql + POST /admin/sql-batch | Admin |
sync-icons | CoinGecko API + POST /admin/sql-batch | Admin |
seed-traffic | GET /price + GET /prices (demo key, ~173 calls) | None (public API) |
translate-worker-status | ECS describe-services + SQS get-queue-attributes | AWS credentials |
translate-scale | ECS update-service (desired count) | AWS credentials |
refresh-token-ratios | POST /admin/sql + POST /admin/valkey | Admin |
delta-validate | Local file read + chunk marker count comparison | None |
chunk-size | Local file read + awk chunk size analysis | None |
translate (submit) | POST /admin/translate | Admin |
translate (status) | GET /admin/translate/status/{id} | Admin |
translate (queue) | GET /admin/translate/queue | Admin |
translate (health) | GET /admin/translate/health | Admin |
translate (history) | GET /admin/translate/history | Admin |
translate (cancel) | POST /admin/translate/cancel/{id} | Admin |
translate (retry) | POST /admin/translate/retry-failed/{id} | Admin |
admin-tier-reset | POST /admin/sql-batch + POST /admin/refund (optional) + GET /admin/invalidate-key | Admin |