[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M758F900QRB2AWQRKPBKG8GC":3,"skill-same:01M758F900QRB2AWQRKPBKG8GC":67},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":33,"repositoryHtmlUrl":34,"repositoryHomepageUrl":35,"ownerHtmlUrl":36,"ownerBlogUrl":6,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M758F900QRB2AWQRKPBKG8GC","psql-automation",null,"psql from scripts — error propagation, docker wrappers.","lukemcqueen\u002Fsteadfaste-fleet","lukemcqueen","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F405240?v=4","01M757MHPAGRXTJAT46SKZP98R","Luke McQueen","01M757MHPZ573KP8DT9GB8SBQ7",4,"MIT","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fpsql-automation\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: psql-automation\nversion: 1.0.0\ncategory: devops\ndescription: \"psql from scripts — error propagation, docker wrappers.\"\nauthor: Steadfaste Fleet (curator)\nlicense: MIT\nplatforms: [linux, macos]\n---\n\n# psql Automation — Error Propagation & Verification\n\n## Trigger\n\nUse when:\n- Writing a script (Python\u002Fshell) that calls `psql` against a dockerized Postgres\n- A script prints \"✅ success\" but the DB row never appears — silent write failure\n- Debugging why `todo-db.py`-style CLIs report success for queries that error\n- A design doc or peer agent claims \"schema verified — table exists\" and you're about to build on it\n- You need to inspect data inside a STOPPED postgres container's volume\n- **Security-reviewing a psql call path** (injection, shell embedding, RLS\u002Fauthz)\n\n## Core pitfall: stdin-mode psql swallows SQL errors (rc=0)\n\n`psql -t -A \u003C\u003C\u003C \"SELECT ...\"` or `subprocess.run(..., input=query)` (stdin mode)\nreturns **exit code 0 even when the query fails** — relation not found, function\nmissing, syntax error, all of them. A script that checks `returncode != 0` then\nprints \"✅ Todo added\" is silently lying: the row never landed.\n\n**Verified 2026-08-06:** `todo-db.py` printed \"✅ Todo added\" for months while\n`bus.todos` never existed on the migrated DB. Every write was a silent no-op.\n\n### The fix: use `-c` mode\n\n```python\n# BROKEN — stdin mode, errors swallowed (rc always 0 on SQL failure)\nresult = subprocess.run([\"psql\", \"-t\", \"-A\", \"-F\", \"||\"], input=query, ...)\n\n# FIXED — -c mode propagates the real psql exit code\nresult = subprocess.run([\"psql\", \"-t\", \"-A\", \"-F\", \"||\", \"-c\", query], ...)\nif result.returncode != 0:\n    print(result.stderr, file=sys.stderr); sys.exit(1)\n```\n\n`-c` mode exits non-zero on query error → the script's `returncode` check\nactually fires. Belt-and-suspenders: also scan `stderr` for `ERROR:`.\n\n## Wrapper note: `sg docker -c` is NOT the problem — stdin mode is\n\nEarly diagnosis blamed `sg docker -c` for masking the inner rc. Clean\nno-pipe tests (2026-08-06) proved otherwise — sg propagates rc correctly\nwhen the query is embedded via `-c`:\n\n| Invocation | rc on SQL error |\n|---|---|\n| `docker exec ... psql ... -c \"\u003Cquery>\"` (direct) | **1** ✓ |\n| `sg docker -c \"docker exec ... psql ... -c '\u003Cquery>'\"` | **1** ✓ (propagates) |\n| `echo \"\u003Cquery>\" \\| docker exec ... psql` (stdin) | **0** ✗ |\n| `echo \"\u003Cquery>\" \\| sg docker -c \"docker exec ... psql\"` (stdin) | **0** ✗ |\n\nThe single root cause is **stdin-mode psql returning rc=0 on SQL failure**;\nthe wrapper is irrelevant. The earlier \"sg masks rc\" observation was a\nmeasurement artifact — the command was piped through `head`, so `$?` was\nhead's exit code, not sg's\u002Fpsql's. Always check rc WITHOUT a pipe.\n\nTwo safe patterns:\n\n1. **Direct docker exec when the user is in the docker group** (check with\n   `docker exec \u003Ccontainer> true`; group membership via `id -nG | grep docker`):\n   ```python\n   [\"docker\", \"exec\", \"-i\", \"mycortex-postgres\", \"psql\", \"-U\", \"mycortex\", \"-d\", \"mycortex\", \"-t\", \"-A\", \"-F\", \"||\", \"-c\", query]\n   ```\n   rc propagates correctly. `-c` is fine HERE because the query is an argv\n   element — no shell interprets it.\n\n2. **Universal safe pattern — SQL via STDIN + `-v ON_ERROR_STOP=1` (works on\n   BOTH paths, kills the rc=0 lie AND the shell-embedding risk):**\n   ```python\n   # Query flows through stdin — the command string contains ONLY fixed\n   # names\u002Fflags, never user data → not shell-injectable.\n   cmd = [\"sg\", \"docker\", \"-c\",\n          \"docker exec -i mycortex-postgres psql -U mycortex -d mycortex \"\n          \"-v ON_ERROR_STOP=1 -t -A -F '||'\"]\n   proc = subprocess.run(cmd, input=sql, capture_output=True, text=True, timeout=30)\n   if proc.returncode != 0 or \"ERROR:\" in proc.stderr:\n       sys.exit(1)\n   ```\n   With `ON_ERROR_STOP=1`, psql exits **rc=3 on SQL error even in stdin mode**\n   — the rc=0-swallows-errors failure is structurally impossible, and no user\n   input ever reaches a shell. This is the pattern used by\n   `ops\u002Fservices\u002Ftasks\u002Fmigrate.py` and the rewritten `task-db.py` (2026-08-06).\n\n   ⚠️ Shell-quote the `-F` separator inside an sg string: `-F '||'` (unquoted\n   `-F ||` becomes shell OR → \"Syntax error: end of file unexpected\").\n\n   ❌ **NEVER** embed `-c {query!r}` into an sg\u002Fshell command string. Python's\n   `repr()` quoting is NOT POSIX shell quoting: a `'` inside the value closes\n   the shell string and appends arbitrary commands. SQL injection escalates to\n   **arbitrary shell command execution as the agent user** on any host where\n   the script falls back to the sg path. Verified exploitable in todo-db.py\n   (2026-08-06 party, Security role, finding B-1).\n\n## `sg docker` dies under systemd hardening — never make it the only path\n\nA harness whose systemd unit sets `NoNewPrivileges=true` (standard hardening)\ncannot reach a dockerized Postgres through the `sg docker -c \"docker exec …\"`\npath: `sg`\u002F`newgrp` calls `setgroups()`\u002F`setgid()` unconditionally, and\n`NoNewPrivileges` makes those fail — **even when the process already holds the\ndocker group**. The store then reports \"memory unavailable \u002F store not\nreachable\", which reads as a DB outage and is not one.\n\nReproduce faithfully without systemd (keeps the real group list, unlike\n`systemd-run`, which drops supplementary groups and fails for the wrong reason):\n\n```bash\nsetpriv --no-new-privs -- sg docker -c \"docker exec -i \u003Cc> psql …\"\n#   -> setgid: Operation not permitted   (rc 1)\nsetpriv --no-new-privs -- docker exec -i \u003Cc> psql …\n#   -> works: the process is already in the group, no setgid needed\n```\n\nDiagnosis signature: the unit has `NoNewPrivileges=yes`, the store's Linux\n`_cmd()` returns `[\"sg\", \"docker\", \"-c\", …]`, and `Store.available()` returns\nFalse → the bare \"unavailable\" string with no `(error)` suffix (the real\nexception is swallowed by `available()`). Check the serving unit, not just your\nshell: a sibling service without hardening keeps working, so \"it works for me\"\nproves nothing. `systemctl --user show \u003Cunit> -p NoNewPrivileges -p PrivateTmp`.\n\nFix: prefer the direct-`docker exec` path when the process is already in the\ndocker group (check `os.getgroups()`), keeping `sg` only as the fallback for\nhosts that genuinely lack the group. Do not \"fix\" it by dropping\n`NoNewPrivileges` — that trades a security control for a convenience, and the\n`sg` indirection is unnecessary whenever the group is already held.\n\n**Express the fix as an ordered LADDER, not as a swapped-in command.** A single\n`_cmd()` that returns one argv cannot express \"try this, then that\": give the seam an\n`_attempts(role) -> [(argv, env), …]` in preference order, keep `_cmd()` returning the\nFIRST form so existing callers still work, and have the runner walk the ladder —\ncollecting EVERY failure reason and raising them together (`\"docker: … | sg: …\"`), so\none line still tells \"the container is down\" from \"the hardening blocks us\". Apply it to\nevery copy of the seam (store module AND plugin wrapper) in the same change.\n\n**Keep the fail-open contract, but RECORD why.** `available()` must still return False\nrather than raise — but a bare \"unavailable\" is indistinguishable from a DB outage, so\nstore the reason on the instance (`self.last_error`) as the runner walks the ladder, and\nlet diagnostics read it. A fail-open that discards its cause turns a misconfiguration\ninto an outage report.\n\n**Existing guards that pin the OLD argv shape must be rewritten to intent, not to the\nnew literal.** Tests asserting a prefix (`cmd[:3] == [\"sg\", \"docker\", \"-c\"]`, `cmd[3]`\nbeing the inner shell string) encode one implementation: after the swap they fail on\ncorrect code. Rewriting them to the NEW prefix is nearly as bad — a prefix assertion\nstill cannot see the regression that matters. Re-express each as the properties the guard\nexists for, checked across the whole ladder: the direct form comes first and contains no\ngroup switch, EVERY form is non-interactive (`-w`), and the `sg` fallback still EXISTS\n(dropping it silently breaks every host whose user is not in the docker group). Grep the\ntest tree for the old shape before shipping — the guards are usually in more than one\nfile.\n\n**Careful reading, not just careful writing (2026-10-08):** `sg` fails only\nbecause of `NoNewPrivileges`. Under `setpriv --no-new-privs` the `sg` form exits\n**rc=1** with `setgid: Operation not permitted` — so a piped query reports\n\"X absent\" for a command that never ran, and a later `|| exit 1` turns a\ncapability failure into a false negative on the data itself. Assert on the\n**producer's exit code first**, and only then parse its output. Apply the same\nrule to every wrapper whose failure is silent by design (a swallowed store\n`available()`, a `2>\u002Fdev\u002Fnull`). Reading a failure as absence is how a\n*diagnosis* becomes a wrong *conclusion*.\n\n## Every harness-invoked psql must be non-interactive: always pass `-w`\n\n`psql` prompts for a password on **\u002Fdev\u002Ftty** whenever no usable credential is\navailable (`MYFLEET_MEM_PASSWORD` empty, wrong or missing `PGPASSFILE`). That\nprompt is invisible to the caller — it is neither stdout nor stderr — so a script\nor an agent harness running psql sees NO output and **blocks** instead of failing.\nA fail-open contract then reads the call as \"store unavailable\" only after its\ntimeout, or never, and in a TUI harness the prompt text lands in the user's input\narea.\n\n**Rule:** every psql invocation a script builds carries `-w` (`--no-password`) — a\nchild that cannot answer a prompt must never be given the chance to ask. Same\nfamily: `ssh -o BatchMode=yes`, `sudo -n`, `git` with `GIT_TERMINAL_PROMPT=0`; a\nnon-tty child that prompts is a hang, not an error.\n\nCheck EVERY copy of the command builder, not just the file you were pointed at:\nthe platform branches differ (macOS runs `psql` directly; Linux goes through\n`sg docker -c \"docker exec … psql …\"`) and the same seam is often duplicated in a\nstore module and a plugin wrapper. Put `-w` with the other option flags (before\n`-v ON_ERROR_STOP=1`) in all of them.\n\nA flag assertion is necessary but NOT sufficient. Pair it with a runtime test: put\na `psql` stand-in on `PATH` that implements the documented contract — with `-w` it\nexits non-zero immediately (\"no password supplied\"); without `-w` it takes the\nprompt path and blocks — then drive the REAL code path (the store's `run_sql`) with\nno usable password and assert it raises `StoreUnavailable` promptly. Keep the test\nnon-vacuous by asserting on the auth-refusal text, not only on the duration, so it\nfails when the flag is dropped.\n\nDo not expect a live before\u002Fafter demo to be easy: demonstrating the prompt needs a\npassword-requiring endpoint the host can actually reach (published container ports\nmay not be reachable from the host namespace at all) — state that limitation rather\nthan claiming the demo ran.\n\n## Verify \"verified\" schema claims before building on them\n\nA design doc or peer's \"Existing plumbing (verified YYYY-MM-DD)\" is a claim,\nnot proof. Five-minute check:\n\n```bash\n# current DB\ndocker exec -i mycortex-postgres psql -U mycortex -d mycortex -t -A \\\n  -c \"SELECT schemaname||'.'||tablename FROM pg_tables WHERE tablename LIKE '%todo%';\"\n# functions too\ndocker exec -i mycortex-postgres psql -U mycortex -d mycortex -t -A \\\n  -c \"SELECT proname FROM pg_proc WHERE proname LIKE '%todo%';\"\n# migration dump (if one exists) — pg_restore -l lists objects; grep for the table\npg_restore -l ~\u002F.steadfaste-fleet\u002Fbackups\u002F*.dump | grep -i todo\n```\n\nIf the table\u002Ffunction is missing from BOTH the current DB and the migration\ndump, it never existed — the CLI's \"✅\" was the rc=0 lie. Fix the schema\n(idempotent `CREATE TABLE IF NOT EXISTS` + `CREATE OR REPLACE FUNCTION`), then\nfix the CLI's psql invocation, then re-test with a real add\u002Flist.\n\n### ⚠️ Verify against EVERY agent type, not just your host (2026-08-06)\n\nA schema that exists on the ORCHESTRATOR host may not exist on WORKERS. The\n`bus` schema is created by `setup-fleet-bus.sh` — a `register_orch`\n(orchestrator-only) script. Workers (Gisu, Joseph, Kustos, Titus) run\n`mycortex-postgres` (the doctor checks the container on every host) but\n**never get the `bus` schema**. Building a \"fleet-wide\" feature on `bus.*`\nsilently locks out every worker — the 2026-08-06 todo-system flaw:\n`bus.todos` never existed on workers, and even the orchestrator's CLI\nprinted ✅ while rows vanished.\n\n**Check the role matrix, not just your DB:** `docs\u002Fbus-architecture.md`\nlists what each agent type RUNS (workers: HTTP client only — never the bus\nPostgres\u002Fschema). Before designing around a schema, verify it will exist on\nthe hosts that must use it.\n\n**Rule (Luke directive 2026-08-06):** features ALL agents should have must\nnot depend on bus infrastructure or bus nomenclature. Give them a dedicated\nschema (`todos.*`, not `bus.*`) applied on every host's mycortex-postgres\nvia fleet-update.sh, with a platform-aware apply path — docker exec on\nLinux, direct psql via mycortex.conf\u002Fconfig.json on macOS.\n\n## Inspect a stopped container's data volume\n\nThe old container is `Exited (0)` (not removed) — its volume is intact. Query\nit WITHOUT port conflicts by running a temp container on the same volume:\n\n```bash\ndocker run --rm -d --name inspect \\\n  -v \u003Cold-volume>:\u002Fvar\u002Flib\u002Fpostgresql\u002Fdata \u003Csame-image>   # no -p publish = no host port conflict\nsleep 7   # wait for \"database system is ready to accept connections\" in docker logs\ndocker exec -i inspect psql -U \u003Cuser> -d \u003Cdb> -t -A -c \"\u003Cquery>\"\ndocker rm -f inspect\n```\n\n⚠️ **The mount path is image-major-version specific.** `postgres:16-` and\nearlier expect the volume at `\u002Fvar\u002Flib\u002Fpostgresql\u002Fdata`; `postgres:18+`\nstores data in a major-versioned subdirectory (`\u002Fvar\u002Flib\u002Fpostgresql\u002F18\u002F…`) and\ncrash-loops on startup if you mount at the old `\u002Fvar\u002Flib\u002Fpostgresql\u002Fdata` path\n(`Error: in 18+, … appears to be PostgreSQL data in \u002Fvar\u002Flib\u002Fpostgresql\u002Fdata\n(unused mount\u002Fvolume)`). For 18+, mount at `\u002Fvar\u002Flib\u002Fpostgresql` and use the\nSAME image major version that wrote the volume — inspecting a 16 volume with an\n18 image (or vice versa) fails for the same reason.\n\nPitfalls: don't pass `-c port=NNNN` to postgres — that changes the listening\nport while psql inside still tries the 5432 socket; and don't pipe the query\nthrough `head` when checking rc (head's rc masks psql's).\n\n## Pitfalls\n\n- **Injection defense for psql-backed CLIs** (2026-08-06, task-db.py rewrite):\n  - **Allowlist every identifier-ish value** (`agent`, `project`, `repo`,\n    `target`, `assignee`, `scope`, `status`, `source`, `column`) against\n    `^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$` + enum allowlists (`personal|fleet`,\n    `pending|in_progress|completed|cancelled`, …) BEFORE it touches SQL.\n  - **Never string-build WHERE clauses.** Route all DML through a parameterized\n    function (`tasks.task_upsert(...)`) with positional params.\n  - Free text (content, tags) is quote-doubled (`'` → `''`) into string\n    literals only — safe under `standard_conforming_strings=on` (PG default).\n  - Extract `build_query(sql, params) -> sql` as a **pure function** — that's\n    the unit-test seam for injection regressions (`--agent \"x' OR 1=1--\"` must\n    return a validation error, not rows).\n- **`column` and `position` are PostgreSQL RESERVED words** — must be quoted as\n  `\"column\"`\u002F`\"position\"` in EVERY query. Unquoted `column` fails with\n  \"syntax error at or near \\\"column\\\"\". Cost two migration re-runs (2026-08-06).\n- **`INSERT ... ON CONFLICT DO UPDATE` evaluates NOT NULL and RLS WITH CHECK on\n  the PROPOSED insert row BEFORE conflict resolution** — a status-only update\n  passing NULL content fails with \"null value in column\". Fix inside the upsert\n  function: COALESCE defaults for non-nullable columns (`scope`\u002F`status`\u002F\n  `project`\u002F`source`) so partial updates propose a valid row, and\n  `COALESCE(p_content, (SELECT content FROM t WHERE id = p_id))` to fetch the\n  existing content. `ON CONFLICT DO UPDATE SET x = COALESCE(EXCLUDED.x, t.x)`\n  so NULL params don't clobber existing values.\n- **Role creation in migrations needs CREATEROLE** — only the DB owner has it.\n  Run DDL as the owner (house precedent: mycortex migrate.py connects as\n  `mycortex`), not a dedicated admin role, or the migration fails with\n  \"permission denied to create role\". Granting CREATEROLE to a non-owner role\n  is cluster-wide surface — prefer owner-run DDL.\n- **Read a function's argument list from the DATABASE before hand-writing a\n  positional call.** `SELECT pg_get_function_arguments('tasks.task_upsert'::regproc)`\n  prints the real order and TYPES in one line; the call sites you are copying from\n  do not. Two casts in that signature look interchangeable and are not: `p_id` and\n  `p_parent_id` are `uuid` while `p_session_id` is `TEXT` (fleet session ids look\n  like `cron_1954deb5ad76_20261015_142148`), so a uuid cast one slot early fails the\n  whole write with `invalid input syntax for type uuid` — and a mocked psql cannot\n  see it. Give the writers ONE shared SQL constant once a second caller appears.\n- **An id list in `= ANY(...)` needs its element type cast.** `id = ANY(ARRAY[?])`\n  dies with `operator does not exist: uuid = text` when the param builder renders\n  text literals; write `id = ANY(ARRAY[?]::uuid[])` — the array literal is the\n  builder's job, the cast is yours.\n- **Any `||`-delimited row format breaks the moment a FIELD'S CONTENT can contain `||`.**\n  The separator is only safe when every field is drawn from a constrained alphabet. When\n  one of them is *free text a worker wrote* (a review note, a task description), that text\n  can contain the delimiter, and the row shifts: field 3's tail lands in field 4, counts\n  and judgements come out wrong, and the parser cannot tell a shifted row from a good one.\n  The same class bites `text[]` columns read with `array_to_string(tags, ',')` — a comma in\n  a tag corrupts the list.\n\n  **Do not fix it by picking a rarer separator** (chr(31), `\\x1f`, a UUID-ish token) — that\n  is a race against the content, and it leaves the parser unable to PROVE a row was intact.\n  Fix it at the source: emit each row as a single JSON value and parse it as JSON.\n  ```sql\n  -- BROKEN: content containing '||' shifts every field after it\n  SELECT id, content, plan, created_by FROM tasks.slices;\n\n  -- FIXED: one JSON value per row — the separator can no longer collide with content,\n  -- and json_build_object escapes whatever the content contains\n  SELECT json_build_object(\n           'id', id, 'content', content,\n           'plan', plan, 'created_by', created_by)::text\n    FROM tasks.slices;\n  ```\n  ```python\n  # The parser then rejects a malformed row instead of silently mis-splitting it\n  def _parse_row(line: str) -> dict | None:\n      try:\n          return json.loads(line)\n      except json.JSONDecodeError:\n          return None          # caller must STOP, not treat the row as empty\n  ```\n  `::text` matters: without it psql renders the object with its own spacing, and a caller\n  comparing raw lines against a fixture sees a difference that is not a bug.\n\n  **This changes the FIXTURES, so the suite goes red in the same commit.** Every test row\n  fixture still feeding the old `||` text must be rewritten to JSON before the change can\n  land — and the case worth writing is the one that used to break: a row whose content\n  ITSELF contains `||`, asserted to still parse with every field intact. If the fixtures\n  are not updated yet, park the whole change (see `adversarial-finding-fix-patterns`:\n  never commit a red suite into a shared repo) rather than landing production alone.\n\n  **Make an unreadable row STOP the sweep, not vanish.** A parser that returns `None` and\n  a caller that skips `None` silently reports \"no slices to review\" for a query that\n  returned rows — the same read-a-failure-as-absence trap as the rc=0 lie above. Exit with\n  a distinct code and a message naming the row format.\n- **Round-trip a `text[]` column through a non-comma separator.** `||`-delimited row\n  output splits fields on the delimiter, so read tags as\n  `array_to_string(tags, chr(31))` and split on `\"\\x1f\"` — a comma corrupts any tag\n  that contains one. (Narrower case of the JSON-row rule above: prefer JSON when the\n  field's content is unconstrained; a non-comma separator is only safe for constrained\n  values.)\n- **`--source`-style filters never grant access** — RLS is the enforcement; a filter is just a filter.\n- **Idempotent schema files are your friend** — `IF NOT EXISTS` + `CREATE OR REPLACE` means you can apply on every deploy\u002Fupdate; wire it into the update script so Linux (docker exec) and macOS (direct psql via config URL) both converge.\n- **When a path-hardcoding bug is fixed in ONE of two sibling files, grep for the sibling.** 2026-08-06: `session_mine.py` was fixed to write `~\u002Fbrain\u002Flessons\u002F`, but `lessons.py` (the module the index\u002Fsearch imports) still hardcoded `~\u002Fbrain\u002Fkustos\u002Flessons\u002F` — offline search read a stale 241-file dir while 631 live lessons sat elsewhere. `git log -S '\u003Cbad-string>'` finds every file that ever contained it.\n- **`now()` is STABLE, not IMMUTABLE — it cannot appear in a partial-index WHERE predicate.** `CREATE UNIQUE INDEX ... WHERE ... > now()` fails with `ERROR: functions in index predicate must be marked IMMUTABLE`. Drop the time condition from the index and filter at query time; the \"one live row\" uniqueness is then enforced by the app, not the DB (note the trade-off). A DB-level time-varying guarantee needs an EXCLUDE constraint or trigger, never a partial unique index with `now()`.\n- **Check `psql` via the `-t -A` flags when parsing** — column headers break naive parsers on macOS without `-t -A`.\n\n## References\n\n- `references\u002Ftodo-silent-failure-2026-08-06.md` — full session trace: the\n  todo-db.py rc=0 bug, sg masking, old-container inspection, dream→todo bridge\n  build, and the bus.todos-never-existed diagnosis.\n- `references\u002Fpsql-cli-security-hardening.md` — injection-proof psql CLI\n  rewrite: allowlists, stdin+ON_ERROR_STOP pattern, profile-role CRUD + RLS\n  WITH CHECK, guarded table-scoped migration, verification transcript\n  (2026-08-06 task-db.py \u002F tasks schema).\n","# psql Automation — Error Propagation & Verification\n\n## Trigger\n\nUse when:\n- Writing a script (Python\u002Fshell) that calls `psql` against a dockerized Postgres\n- A script prints \"✅ success\" but the DB row never appears — silent write failure\n- Debugging why `todo-db.py`-style CLIs report success for queries that error\n- A design doc or peer agent claims \"schema verified — table exists\" and you're about to build on it\n- You need to inspect data inside a STOPPED postgres container's volume\n- **Security-reviewing a psql call path** (injection, shell embedding, RLS\u002Fauthz)\n\n## Core pitfall: stdin-mode psql swallows SQL errors (rc=0)\n\n`psql -t -A \u003C\u003C\u003C \"SELECT ...\"` or `subprocess.run(..., input=query)` (stdin mode)\nreturns **exit code 0 even when the query fails** — relation not found, function\nmissing, syntax error, all of them. A script that checks `returncode != 0` then\nprints \"✅ Todo added\" is silently lying: the row never landed.\n\n**Verified 2026-08-06:** `todo-db.py` printed \"✅ Todo added\" for months while\n`bus.todos` never existed on the migrated DB. Every write was a silent no-op.\n\n### The fix: use `-c` mode\n\n```python\n# BROKEN — stdin mode, errors swallowed (rc always 0 on SQL failure)\nresult = subprocess.run([\"psql\", \"-t\", \"-A\", \"-F\", \"||\"], input=query, ...)\n\n# FIXED — -c mode propagates the real psql exit code\nresult = subprocess.run([\"psql\", \"-t\", \"-A\", \"-F\", \"||\", \"-c\", query], ...)\nif result.returncode != 0:\n    print(result.stderr, file=sys.stderr); sys.exit(1)\n```\n\n`-c` mode exits non-zero on query error → the script's `returncode` check\nactually fires. Belt-and-suspenders: also scan `stderr` for `ERROR:`.\n\n## Wrapper note: `sg docker -c` is NOT the problem — stdin mode is\n\nEarly diagnosis blamed `sg docker -c` for masking the inner rc. Clean\nno-pipe tests (2026-08-06) proved otherwise — sg propagates rc correctly\nwhen the query is embedded via `-c`:\n\n| Invocation | rc on SQL error |\n|---|---|\n| `docker exec ... psql ... -c \"\u003Cquery>\"` (direct) | **1** ✓ |\n| `sg docker -c \"docker exec ... psql ... -c '\u003Cquery>'\"` | **1** ✓ (propagates) |\n| `echo \"\u003Cquery>\" \\| docker exec ... psql` (stdin) | **0** ✗ |\n| `echo \"\u003Cquery>\" \\| sg docker -c \"docker exec ... psql\"` (stdin) | **0** ✗ |\n\nThe single root cause is **stdin-mode psql returning rc=0 on SQL failure**;\nthe wrapper is irrelevant. The earlier \"sg masks rc\" observation was a\nmeasurement artifact — the command was piped through `head`, so `$?` was\nhead's exit code, not sg's\u002Fpsql's. Always check rc WITHOUT a pipe.\n\nTwo safe patterns:\n\n1. **Direct docker exec when the user is in the docker group** (check with\n   `docker exec \u003Ccontainer> true`; group membership via `id -nG | grep docker`):\n   ```python\n   [\"docker\", \"exec\", \"-i\", \"mycortex-postgres\", \"psql\", \"-U\", \"mycortex\", \"-d\", \"mycortex\", \"-t\", \"-A\", \"-F\", \"||\", \"-c\", query]\n   ```\n   rc propagates correctly. `-c` is fine HERE because the query is an argv\n   element — no shell interprets it.\n\n2. **Universal safe pattern — SQL via STDIN + `-v ON_ERROR_STOP=1` (works on\n   BOTH paths, kills the rc=0 lie AND the shell-embedding risk):**\n   ```python\n   # Query flows through stdin — the command string contains ONLY fixed\n   # names\u002Fflags, never user data → not shell-injectable.\n   cmd = [\"sg\", \"docker\", \"-c\",\n          \"docker exec -i mycortex-postgres psql -U mycortex -d mycortex \"\n          \"-v ON_ERROR_STOP=1 -t -A -F '||'\"]\n   proc = subprocess.run(cmd, input=sql, capture_output=True, text=True, timeout=30)\n   if proc.returncode != 0 or \"ERROR:\" in proc.stderr:\n       sys.exit(1)\n   ```\n   With `ON_ERROR_STOP=1`, psql exits **rc=3 on SQL error even in stdin mode**\n   — the rc=0-swallows-errors failure is structurally impossible, and no user\n   input ever reaches a shell. This is the pattern used by\n   `ops\u002Fservices\u002Ftasks\u002Fmigrate.py` and the rewritten `task-db.py` (2026-08-06).\n\n   ⚠️ Shell-quote the `-F` separator inside an sg string: `-F '||'` (unquoted\n   `-F ||` becomes shell OR → \"Syntax error: end of file unexpected\").\n\n   ❌ **NEVER** embed `-c {query!r}` into an sg\u002Fshell command string. Python's\n   `repr()` quoting is NOT POSIX shell quoting: a `'` inside the value closes\n   the shell string and appends arbitrary commands. SQL injection escalates to\n   **arbitrary shell command execution as the agent user** on any host where\n   the script falls back to the sg path. Verified exploitable in todo-db.py\n   (2026-08-06 party, Security role, finding B-1).\n\n## `sg docker` dies under systemd hardening — never make it the only path\n\nA harness whose systemd unit sets `NoNewPrivileges=true` (standard hardening)\ncannot reach a dockerized Postgres through the `sg docker -c \"docker exec …\"`\npath: `sg`\u002F`newgrp` calls `setgroups()`\u002F`setgid()` unconditionally, and\n`NoNewPrivileges` makes those fail — **even when the process already holds the\ndocker group**. The store then reports \"memory unavailable \u002F store not\nreachable\", which reads as a DB outage and is not one.\n\nReproduce faithfully without systemd (keeps the real group list, unlike\n`systemd-run`, which drops supplementary groups and fails for the wrong reason):\n\n```bash\nsetpriv --no-new-privs -- sg docker -c \"docker exec -i \u003Cc> psql …\"\n#   -> setgid: Operation not permitted   (rc 1)\nsetpriv --no-new-privs -- docker exec -i \u003Cc> psql …\n#   -> works: the process is already in the group, no setgid needed\n```\n\nDiagnosis signature: the unit has `NoNewPrivileges=yes`, the store's Linux\n`_cmd()` returns `[\"sg\", \"docker\", \"-c\", …]`, and `Store.available()` returns\nFalse → the bare \"unavailable\" string with no `(error)` suffix (the real\nexception is swallowed by `available()`). Check the serving unit, not just your\nshell: a sibling service without hardening keeps working, so \"it works for me\"\nproves nothing. `systemctl --user show \u003Cunit> -p NoNewPrivileges -p PrivateTmp`.\n\nFix: prefer the direct-`docker exec` path when the process is already in the\ndocker group (check `os.getgroups()`), keeping `sg` only as the fallback for\nhosts that genuinely lack the group. Do not \"fix\" it by dropping\n`NoNewPrivileges` — that trades a security control for a convenience, and the\n`sg` indirection is unnecessary whenever the group is already held.\n\n**Express the fix as an ordered LADDER, not as a swapped-in command.** A single\n`_cmd()` that returns one argv cannot express \"try this, then that\": give the seam an\n`_attempts(role) -> [(argv, env), …]` in preference order, keep `_cmd()` returning the\nFIRST form so existing callers still work, and have the runner walk the ladder —\ncollecting EVERY failure reason and raising them together (`\"docker: … | sg: …\"`), so\none line still tells \"the container is down\" from \"the hardening blocks us\". Apply it to\nevery copy of the seam (store module AND plugin wrapper) in the same change.\n\n**Keep the fail-open contract, but RECORD why.** `available()` must still return False\nrather than raise — but a bare \"unavailable\" is indistinguishable from a DB outage, so\nstore the reason on the instance (`self.last_error`) as the runner walks the ladder, and\nlet diagnostics read it. A fail-open that discards its cause turns a misconfiguration\ninto an outage report.\n\n**Existing guards that pin the OLD argv shape must be rewritten to intent, not to the\nnew literal.** Tests asserting a prefix (`cmd[:3] == [\"sg\", \"docker\", \"-c\"]`, `cmd[3]`\nbeing the inner shell string) encode one implementation: after the swap they fail on\ncorrect code. Rewriting them to the NEW prefix is nearly as bad — a prefix assertion\nstill cannot see the regression that matters. Re-express each as the properties the guard\nexists for, checked across the whole ladder: the direct form comes first and contains no\ngroup switch, EVERY form is non-interactive (`-w`), and the `sg` fallback still EXISTS\n(dropping it silently breaks every host whose user is not in the docker group). Grep the\ntest tree for the old shape before shipping — the guards are usually in more than one\nfile.\n\n**Careful reading, not just careful writing (2026-10-08):** `sg` fails only\nbecause of `NoNewPrivileges`. Under `setpriv --no-new-privs` the `sg` form exits\n**rc=1** with `setgid: Operation not permitted` — so a piped query reports\n\"X absent\" for a command that never ran, and a later `|| exit 1` turns a\ncapability failure into a false negative on the data itself. Assert on the\n**producer's exit code first**, and only then parse its output. Apply the same\nrule to every wrapper whose failure is silent by design (a swallowed store\n`available()`, a `2>\u002Fdev\u002Fnull`). Reading a failure as absence is how a\n*diagnosis* becomes a wrong *conclusion*.\n\n## Every harness-invoked psql must be non-interactive: always pass `-w`\n\n`psql` prompts for a password on **\u002Fdev\u002Ftty** whenever no usable credential is\navailable (`MYFLEET_MEM_PASSWORD` empty, wrong or missing `PGPASSFILE`). That\nprompt is invisible to the caller — it is neither stdout nor stderr — so a script\nor an agent harness running psql sees NO output and **blocks** instead of failing.\nA fail-open contract then reads the call as \"store unavailable\" only after its\ntimeout, or never, and in a TUI harness the prompt text lands in the user's input\narea.\n\n**Rule:** every psql invocation a script builds carries `-w` (`--no-password`) — a\nchild that cannot answer a prompt must never be given the chance to ask. Same\nfamily: `ssh -o BatchMode=yes`, `sudo -n`, `git` with `GIT_TERMINAL_PROMPT=0`; a\nnon-tty child that prompts is a hang, not an error.\n\nCheck EVERY copy of the command builder, not just the file you were pointed at:\nthe platform branches differ (macOS runs `psql` directly; Linux goes through\n`sg docker -c \"docker exec … psql …\"`) and the same seam is often duplicated in a\nstore module and a plugin wrapper. Put `-w` with the other option flags (before\n`-v ON_ERROR_STOP=1`) in all of them.\n\nA flag assertion is necessary but NOT sufficient. Pair it with a runtime test: put\na `psql` stand-in on `PATH` that implements the documented contract — with `-w` it\nexits non-zero immediately (\"no password supplied\"); without `-w` it takes the\nprompt path and blocks — then drive the REAL code path (the store's `run_sql`) with\nno usable password and assert it raises `StoreUnavailable` promptly. Keep the test\nnon-vacuous by asserting on the auth-refusal text, not only on the duration, so it\nfails when the flag is dropped.\n\nDo not expect a live before\u002Fafter demo to be easy: demonstrating the prompt needs a\npassword-requiring endpoint the host can actually reach (published container ports\nmay not be reachable from the host namespace at all) — state that limitation rather\nthan claiming the demo ran.\n\n## Verify \"verified\" schema claims before building on them\n\nA design doc or peer's \"Existing plumbing (verified YYYY-MM-DD)\" is a claim,\nnot proof. Five-minute check:\n\n```bash\n# current DB\ndocker exec -i mycortex-postgres psql -U mycortex -d mycortex -t -A \\\n  -c \"SELECT schemaname||'.'||tablename FROM pg_tables WHERE tablename LIKE '%todo%';\"\n# functions too\ndocker exec -i mycortex-postgres psql -U mycortex -d mycortex -t -A \\\n  -c \"SELECT proname FROM pg_proc WHERE proname LIKE '%todo%';\"\n# migration dump (if one exists) — pg_restore -l lists objects; grep for the table\npg_restore -l ~\u002F.steadfaste-fleet\u002Fbackups\u002F*.dump | grep -i todo\n```\n\nIf the table\u002Ffunction is missing from BOTH the current DB and the migration\ndump, it never existed — the CLI's \"✅\" was the rc=0 lie. Fix the schema\n(idempotent `CREATE TABLE IF NOT EXISTS` + `CREATE OR REPLACE FUNCTION`), then\nfix the CLI's psql invocation, then re-test with a real add\u002Flist.\n\n### ⚠️ Verify against EVERY agent type, not just your host (2026-08-06)\n\nA schema that exists on the ORCHESTRATOR host may not exist on WORKERS. The\n`bus` schema is created by `setup-fleet-bus.sh` — a `register_orch`\n(orchestrator-only) script. Workers (Gisu, Joseph, Kustos, Titus) run\n`mycortex-postgres` (the doctor checks the container on every host) but\n**never get the `bus` schema**. Building a \"fleet-wide\" feature on `bus.*`\nsilently locks out every worker — the 2026-08-06 todo-system flaw:\n`bus.todos` never existed on workers, and even the orchestrator's CLI\nprinted ✅ while rows vanished.\n\n**Check the role matrix, not just your DB:** `docs\u002Fbus-architecture.md`\nlists what each agent type RUNS (workers: HTTP client only — never the bus\nPostgres\u002Fschema). Before designing around a schema, verify it will exist on\nthe hosts that must use it.\n\n**Rule (Luke directive 2026-08-06):** features ALL agents should have must\nnot depend on bus infrastructure or bus nomenclature. Give them a dedicated\nschema (`todos.*`, not `bus.*`) applied on every host's mycortex-postgres\nvia fleet-update.sh, with a platform-aware apply path — docker exec on\nLinux, direct psql via mycortex.conf\u002Fconfig.json on macOS.\n\n## Inspect a stopped container's data volume\n\nThe old container is `Exited (0)` (not removed) — its volume is intact. Query\nit WITHOUT port conflicts by running a temp container on the same volume:\n\n```bash\ndocker run --rm -d --name inspect \\\n  -v \u003Cold-volume>:\u002Fvar\u002Flib\u002Fpostgresql\u002Fdata \u003Csame-image>   # no -p publish = no host port conflict\nsleep 7   # wait for \"database system is ready to accept connections\" in docker logs\ndocker exec -i inspect psql -U \u003Cuser> -d \u003Cdb> -t -A -c \"\u003Cquery>\"\ndocker rm -f inspect\n```\n\n⚠️ **The mount path is image-major-version specific.** `postgres:16-` and\nearlier expect the volume at `\u002Fvar\u002Flib\u002Fpostgresql\u002Fdata`; `postgres:18+`\nstores data in a major-versioned subdirectory (`\u002Fvar\u002Flib\u002Fpostgresql\u002F18\u002F…`) and\ncrash-loops on startup if you mount at the old `\u002Fvar\u002Flib\u002Fpostgresql\u002Fdata` path\n(`Error: in 18+, … appears to be PostgreSQL data in \u002Fvar\u002Flib\u002Fpostgresql\u002Fdata\n(unused mount\u002Fvolume)`). For 18+, mount at `\u002Fvar\u002Flib\u002Fpostgresql` and use the\nSAME image major version that wrote the volume — inspecting a 16 volume with an\n18 image (or vice versa) fails for the same reason.\n\nPitfalls: don't pass `-c port=NNNN` to postgres — that changes the listening\nport while psql inside still tries the 5432 socket; and don't pipe the query\nthrough `head` when checking rc (head's rc masks psql's).\n\n## Pitfalls\n\n- **Injection defense for psql-backed CLIs** (2026-08-06, task-db.py rewrite):\n  - **Allowlist every identifier-ish value** (`agent`, `project`, `repo`,\n    `target`, `assignee`, `scope`, `status`, `source`, `column`) against\n    `^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$` + enum allowlists (`personal|fleet`,\n    `pending|in_progress|completed|cancelled`, …) BEFORE it touches SQL.\n  - **Never string-build WHERE clauses.** Route all DML through a parameterized\n    function (`tasks.task_upsert(...)`) with positional params.\n  - Free text (content, tags) is quote-doubled (`'` → `''`) into string\n    literals only — safe under `standard_conforming_strings=on` (PG default).\n  - Extract `build_query(sql, params) -> sql` as a **pure function** — that's\n    the unit-test seam for injection regressions (`--agent \"x' OR 1=1--\"` must\n    return a validation error, not rows).\n- **`column` and `position` are PostgreSQL RESERVED words** — must be quoted as\n  `\"column\"`\u002F`\"position\"` in EVERY query. Unquoted `column` fails with\n  \"syntax error at or near \\\"column\\\"\". Cost two migration re-runs (2026-08-06).\n- **`INSERT ... ON CONFLICT DO UPDATE` evaluates NOT NULL and RLS WITH CHECK on\n  the PROPOSED insert row BEFORE conflict resolution** — a status-only update\n  passing NULL content fails with \"null value in column\". Fix inside the upsert\n  function: COALESCE defaults for non-nullable columns (`scope`\u002F`status`\u002F\n  `project`\u002F`source`) so partial updates propose a valid row, and\n  `COALESCE(p_content, (SELECT content FROM t WHERE id = p_id))` to fetch the\n  existing content. `ON CONFLICT DO UPDATE SET x = COALESCE(EXCLUDED.x, t.x)`\n  so NULL params don't clobber existing values.\n- **Role creation in migrations needs CREATEROLE** — only the DB owner has it.\n  Run DDL as the owner (house precedent: mycortex migrate.py connects as\n  `mycortex`), not a dedicated admin role, or the migration fails with\n  \"permission denied to create role\". Granting CREATEROLE to a non-owner role\n  is cluster-wide surface — prefer owner-run DDL.\n- **Read a function's argument list from the DATABASE before hand-writing a\n  positional call.** `SELECT pg_get_function_arguments('tasks.task_upsert'::regproc)`\n  prints the real order and TYPES in one line; the call sites you are copying from\n  do not. Two casts in that signature look interchangeable and are not: `p_id` and\n  `p_parent_id` are `uuid` while `p_session_id` is `TEXT` (fleet session ids look\n  like `cron_1954deb5ad76_20261015_142148`), so a uuid cast one slot early fails the\n  whole write with `invalid input syntax for type uuid` — and a mocked psql cannot\n  see it. Give the writers ONE shared SQL constant once a second caller appears.\n- **An id list in `= ANY(...)` needs its element type cast.** `id = ANY(ARRAY[?])`\n  dies with `operator does not exist: uuid = text` when the param builder renders\n  text literals; write `id = ANY(ARRAY[?]::uuid[])` — the array literal is the\n  builder's job, the cast is yours.\n- **Any `||`-delimited row format breaks the moment a FIELD'S CONTENT can contain `||`.**\n  The separator is only safe when every field is drawn from a constrained alphabet. When\n  one of them is *free text a worker wrote* (a review note, a task description), that text\n  can contain the delimiter, and the row shifts: field 3's tail lands in field 4, counts\n  and judgements come out wrong, and the parser cannot tell a shifted row from a good one.\n  The same class bites `text[]` columns read with `array_to_string(tags, ',')` — a comma in\n  a tag corrupts the list.\n\n  **Do not fix it by picking a rarer separator** (chr(31), `\\x1f`, a UUID-ish token) — that\n  is a race against the content, and it leaves the parser unable to PROVE a row was intact.\n  Fix it at the source: emit each row as a single JSON value and parse it as JSON.\n  ```sql\n  -- BROKEN: content containing '||' shifts every field after it\n  SELECT id, content, plan, created_by FROM tasks.slices;\n\n  -- FIXED: one JSON value per row — the separator can no longer collide with content,\n  -- and json_build_object escapes whatever the content contains\n  SELECT json_build_object(\n           'id', id, 'content', content,\n           'plan', plan, 'created_by', created_by)::text\n    FROM tasks.slices;\n  ```\n  ```python\n  # The parser then rejects a malformed row instead of silently mis-splitting it\n  def _parse_row(line: str) -> dict | None:\n      try:\n          return json.loads(line)\n      except json.JSONDecodeError:\n          return None          # caller must STOP, not treat the row as empty\n  ```\n  `::text` matters: without it psql renders the object with its own spacing, and a caller\n  comparing raw lines against a fixture sees a difference that is not a bug.\n\n  **This changes the FIXTURES, so the suite goes red in the same commit.** Every test row\n  fixture still feeding the old `||` text must be rewritten to JSON before the change can\n  land — and the case worth writing is the one that used to break: a row whose content\n  ITSELF contains `||`, asserted to still parse with every field intact. If the fixtures\n  are not updated yet, park the whole change (see `adversarial-finding-fix-patterns`:\n  never commit a red suite into a shared repo) rather than landing production alone.\n\n  **Make an unreadable row STOP the sweep, not vanish.** A parser that returns `None` and\n  a caller that skips `None` silently reports \"no slices to review\" for a query that\n  returned rows — the same read-a-failure-as-absence trap as the rc=0 lie above. Exit with\n  a distinct code and a message naming the row format.\n- **Round-trip a `text[]` column through a non-comma separator.** `||`-delimited row\n  output splits fields on the delimiter, so read tags as\n  `array_to_string(tags, chr(31))` and split on `\"\\x1f\"` — a comma corrupts any tag\n  that contains one. (Narrower case of the JSON-row rule above: prefer JSON when the\n  field's content is unconstrained; a non-comma separator is only safe for constrained\n  values.)\n- **`--source`-style filters never grant access** — RLS is the enforcement; a filter is just a filter.\n- **Idempotent schema files are your friend** — `IF NOT EXISTS` + `CREATE OR REPLACE` means you can apply on every deploy\u002Fupdate; wire it into the update script so Linux (docker exec) and macOS (direct psql via config URL) both converge.\n- **When a path-hardcoding bug is fixed in ONE of two sibling files, grep for the sibling.** 2026-08-06: `session_mine.py` was fixed to write `~\u002Fbrain\u002Flessons\u002F`, but `lessons.py` (the module the index\u002Fsearch imports) still hardcoded `~\u002Fbrain\u002Fkustos\u002Flessons\u002F` — offline search read a stale 241-file dir while 631 live lessons sat elsewhere. `git log -S '\u003Cbad-string>'` finds every file that ever contained it.\n- **`now()` is STABLE, not IMMUTABLE — it cannot appear in a partial-index WHERE predicate.** `CREATE UNIQUE INDEX ... WHERE ... > now()` fails with `ERROR: functions in index predicate must be marked IMMUTABLE`. Drop the time condition from the index and filter at query time; the \"one live row\" uniqueness is then enforced by the app, not the DB (note the trade-off). A DB-level time-varying guarantee needs an EXCLUDE constraint or trigger, never a partial unique index with `now()`.\n- **Check `psql` via the `-t -A` flags when parsing** — column headers break naive parsers on macOS without `-t -A`.\n\n## References\n\n- `references\u002Ftodo-silent-failure-2026-08-06.md` — full session trace: the\n  todo-db.py rc=0 bug, sg masking, old-container inspection, dream→todo bridge\n  build, and the bus.todos-never-existed diagnosis.\n- `references\u002Fpsql-cli-security-hardening.md` — injection-proof psql CLI\n  rewrite: allowlists, stdin+ON_ERROR_STOP pattern, profile-role CRUD + RLS\n  WITH CHECK, guarded table-scoped migration, verification transcript\n  (2026-08-06 task-db.py \u002F tasks schema).\n",{"name":5,"author":24,"license":15,"version":25,"category":26,"platforms":27,"description":7},"Steadfaste Fleet (curator)","1.0.0","devops",[28,29],"linux","macos","main","9dc0e92c5fa81d4db5292b205716e8ea0c00d10e","skills\u002Fdevops\u002Fpsql-automation",1,"https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet","steadfaste.com","https:\u002F\u002Fgithub.com\u002Flukemcqueen","AI Architect | Building Hermes Cortex: governed multi-agent AI for autonomous software engineering | Enterprise Tech Consultant","2026-11-14 22:33:34",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add lukemcqueen\u002Fsteadfaste-fleet --skill psql-automation",{"tool":45,"command":46},"bunx","bunx skills add lukemcqueen\u002Fsteadfaste-fleet --skill psql-automation",{"tool":48,"command":49},"pnpm","pnpm dlx skills add lukemcqueen\u002Fsteadfaste-fleet --skill psql-automation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fpsql-automation\u002FSKILL.md",true,[53,59,63],{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},"references\u002Fmacos-container-exec-transport.md","REFERENCE","参考文档",4237,"https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fpsql-automation\u002Freferences\u002Fmacos-container-exec-transport.md",{"path":60,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":61,"sourceHtmlUrl":62},"references\u002Fpsql-cli-security-hardening.md",5458,"https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fpsql-automation\u002Freferences\u002Fpsql-cli-security-hardening.md",{"path":64,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":65,"sourceHtmlUrl":66},"references\u002Ftodo-silent-failure-2026-08-06.md",3510,"https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fpsql-automation\u002Freferences\u002Ftodo-silent-failure-2026-08-06.md",[68,76,83,90,97,104],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":75},"01M7DXY4G8NSVB59K8B6S2AQNP","macbook-linux-maintenance","Legacy MacBook Linux fixes: GPU wedge, reboot hang, thermal.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fmacbook-linux-maintenance\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":75},"01M7DXXYJCXFJ3TGB84ZQ8KFE6","governance-regression-triage","Triage a host's governance issues: what changed.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fgovernance-regression-triage\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":75},"01M7DXXSAP1G8FDRJAMXQGBBMK","enforcement-immutability","Use when enforcement files lose their immutable flag.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fenforcement-immutability\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":75},"01M78SSDQVRYX64Y16X32TC0NS","steadfaste-fleet-repo-deploy","Use when committing to the steadfaste-fleet repo.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fsteadfaste-fleet-repo-deploy\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":75},"01M78SS928F3R2RJAYVW4E30CE","steadfaste-fleet-maintenance","Maintain an installed Steadfaste Fleet instance — update both the upstream Hermes Agent and the fleet repo layer, merge diverged histories, sync skills safely, and troubleshoot common issues. Covers the dual-update workflow (hermes update + fleet-update.sh), encrypted brain data backup, mycortex import, and recovery techniques.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fsteadfaste-fleet-maintenance\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":75},"01M78SP1CHW0T0BWE5ZT6JBPX8","fleet-preflight","DEPRECATED alias — merged into survey-before-action (2026-08-20). Load survey-before-action instead; its \"Repo-Specific Pre-Flight\" section covers git search, Hermes boundary, and deployment verification.","https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Ffleet-preflight\u002FSKILL.md",[],[]]