[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M757XC4WQNW0XT24MMPY9D1A":3,"skill-same:01M757XC4WQNW0XT24MMPY9D1A":65},{"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":42,"commitSha":43,"skillDirectory":44,"forksCount":45,"repositoryHtmlUrl":46,"repositoryHomepageUrl":47,"ownerHtmlUrl":48,"ownerBlogUrl":6,"ownerDescription":49,"updatedAt":50,"install":51,"resources":64},"01M757XC4WQNW0XT24MMPY9D1A","approval-gate-debugging",null,"Use when a command is flagged as a security issue.","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\u002Fapproval-gate-debugging\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: approval-gate-debugging\ndescription: \"Use when a command is flagged as a security issue.\"\nversion: 1.0.0\nauthor: Steadfaste Fleet\nlicense: MIT\nplatforms: [linux, macos]\nmetadata:\n  hermes:\n    tags: [approval, tirith, security-scan, smart-approval, terminal-gate, path-shadowing]\n    related_skills: [root-cause-debugging, fleet-deployment-sync, file-ownership-boundaries]\n---\n\n# Approval Gate Debugging — Terminal Security-Scan False Blocks\n\n## When to Use\n\n- A terminal command is flagged: `Command was flagged (Security scan: security issue detected ...)`\n- A **sanctioned** command (e.g. `bash ~\u002Fsteadfaste-fleet\u002Fops\u002Fscripts\u002Ffleet-update.sh`) still prompts for user approval\n- Smart-approval escalates a routine command to the user, and the approval times out → deny\n- Any command that used to run clean suddenly needs approval\n\n**Core principle (user-corrected 2026-08-05):** an approval flag on a legitimate or\nsanctioned command is a **diagnostic signal** — investigate the underlying scanner\u002Fguard\nBEFORE whitelisting anything. Adding a `command_allowlist` entry to silence a flag you\ndon't understand masks the defect and leaves every other command still broken.\n\n## The Two-Gate Model\n\nTerminal commands pass TWO independent gates:\n\n1. **Governance enforcer** (Steadfaste Fleet plugin) — governance-lock check. The\n   sanctioned `fleet-update.sh` invocation passes this without a lock.\n2. **Hermes smart approval** (`tools\u002Fapproval.py`) — two sub-layers:\n   - Regex `detect_dangerous_command()` — pattern matching (curl|sh, rm -rf, gateway restart, etc.)\n   - **Tirith security scanner** — `tools\u002Ftirith_security.py` → external binary\n     `check --json --non-interactive --shell posix -- \u003Ccommand>`\n\nThe enforcer sanction does **NOT** bypass gate 2. A block you see almost always comes\nfrom gate 2.\n\n## The Degraded-Message Tell\n\n`\"security issue detected (details unavailable)\"` is the **degraded** summary. Per\n`tirith_security.py` (~lines 836-840), that exact string is emitted when Tirith's JSON\noutput **fails to parse** — i.e. the scanner binary crashed, printed garbage, or produced\nno JSON at all. It does NOT mean a real security finding. Real findings come back as\nstructured JSON with `findings: [...]`.\n\n**Rule:** `details unavailable` ⇒ the scanner is broken ⇒ debug the scanner, do not\napprove\u002Fallowlist the command.\n\n## Diagnosis Recipe\n\n```python\n# 1. Regex layer passes?\nfrom tools.approval import detect_dangerous_command\ndetect_dangerous_command(\"bash ~\u002Fsteadfaste-fleet\u002Fops\u002Fscripts\u002Ffleet-update.sh\")\n# → (False, None, None)  — regex layer is NOT the blocker\n\n# 2. Tirith layer blocks?\nfrom tools.tirith_security import check_command_security\ncheck_command_security(\"bash ~\u002Fsteadfaste-fleet\u002Fops\u002Fscripts\u002Ffleet-update.sh\")\n# → {\"action\": \"block\", \"summary\": \"security issue detected (details unavailable)\"}\n\n# 3. Which binary is resolved? PATH-shadowing check\nimport shutil; print(shutil.which(\"tirith\"))\n# If this is venv\u002Fbin\u002Ftirith → a same-named PyPI package is shadowing the real scanner\n\n# 4. Run the resolved binary directly to see the crash\n# (it ignores args, prints banner, then a traceback — e.g. socket.gaierror)\n```\n\n## PATH-Shadowing Failure Mode (root cause found 2026-08-05)\n\nThe real Tirith scanner is a compiled ELF from `sheeki03\u002Ftirith` GitHub releases,\ninstalled at `~\u002F.hermes\u002Fbin\u002Ftirith`. But the hermes-agent venv had a **PyPI package**\n`tirith` 0.2.2 (github.com\u002Futfsmlabs\u002Ftirith — unrelated \"Monitoring software\", a WAMP\nclient hardcoded to `ws:\u002F\u002Fframeshift:8080\u002Fws`, the original author's LAN hostname)\ninstalled at `venv\u002Fbin\u002Ftirith`. Because `venv\u002Fbin` is FIRST on PATH, `shutil.which(\"tirith\")`\nresolved to the bogus binary. It ignores `check --json ...` args, prints\n`tirith monitor 0.2.2 \u002F connecting`, crashes on DNS resolution, exits 1 → Hermes maps\nexit 1 → `block` → degraded summary.\n\n**Consequence:** EVERY terminal command was being \"scanned\" by the crashing demo. The\nsmart-approval LLM auto-approved most silently; commands with sudo\u002Fchattr\u002Fsystemctl\n(like fleet-update.sh) got escalated to the user → approval timeout → deny.\n\n### Detection\n\n```bash\n~\u002F.hermes\u002Fhermes-agent\u002Fvenv\u002Fbin\u002Fpip show tirith\n# → Name: tirith, Version: 0.2.2, Summary: Monitoring software, Home-page: github.com\u002Futfsmlabs\u002Ftirith\n```\n\n### Fix (root cause)\n\n```bash\n~\u002F.hermes\u002Fhermes-agent\u002Fvenv\u002Fbin\u002Fpip uninstall -y tirith   # nothing depends on it\n# verify:\n#   shutil.which(\"tirith\") → ~\u002F.hermes\u002Fbin\u002Ftirith\n#   check_command_security(cmd) → {\"action\": \"allow\"}\n```\n\nA gateway restart clears the in-memory cached scanner path (deploy ≠ load applies to\nthe scanner too).\n\n## What NOT to Do\n\n- ❌ **Do NOT add the command to `command_allowlist`** in config.yaml to silence the flag.\n  The allowlist short-circuits the entire approval gate for that command while the broken\n  scanner keeps silently flagging everything else. (User: *\"There is an underlying reason\n  the problem exists in the first place and you are masking it.\"*)\n- ❌ Do NOT set `approvals.mode: off` — kills all protection, not just the broken path.\n- ❌ Do NOT patch `tools\u002Ftirith_security.py` or `tools\u002Fapproval.py` — upstream hermes-agent\n  product code, reverted on next update, and the user forbids patching the guard.\n- ❌ Do NOT try to \"fix\" the prompt by removing gateway runtime env vars. `HERMES_EXEC_ASK`,\n  `HERMES_GATEWAY_SESSION`, `HERMES_INTERACTIVE`, `_HERMES_GATEWAY` are exported by the\n  RUNNING GATEWAY (`gateway\u002Frun.py`, `tui_gateway\u002Fserver.py::_enable_gateway_prompts()`),\n  not by config — nothing to unset, and doing so breaks approval routing. (User:\n  *\"DO NOT CHANGE HERMES DEFAULTS OR YOU WILL BE RESET\"*, 2026-08-05.)\n- ✅ DO run the resolved binary directly and read its output before deciding anything.\n\n## An escalated command that times out: STOP, do not route around it\n\nTwo different blocks wear similar clothes — tell them apart before acting:\n\n| Block | Meaning | Response |\n|---|---|---|\n| `security issue detected (details unavailable)` | the SCANNER crashed — no real finding | debug the scanner (above) |\n| escalation that ended in a timeout (`... did not run`, `Do NOT retry`, `Silence is not consent`) | a REAL approval request nobody answered | stop the workflow; change the design or ask |\n| `Your command was treated as WRITE-CAPABLE ... requires an active governance lock` | the GOVERNANCE ENFORCER (gate 1), not the approval gate — it classifies by SHAPE | split the command; do not rephrase it |\n\n**The shape-classifier is a third, unrelated block.** The enforcer allows a compound only when\nEVERY segment is a read primitive, so a harmless inspection stack\n(`git status --porcelain && git log --oneline -3 && echo done`) is refused while the same reads\nrun fine one at a time. A redirection, a `$( )`, a pipe into a write, or an interpreter form\n(`python3 \u003Crepo>\u002Fscript.py` — the allowlist never covers interpreter reads) tips a read into\nwrite-class. Remedies, in order: **run a single plain command per call** (a lone `git push` is\nthe canonical case — the push carve-out authorises exactly that shape and nothing compound);\ngive the session a RESOLVED GOVERNED REPO before any interpreter read — take the lock\ndeliberately (`begin_change`) and close the cycle — because the deployed copy's LOCATION does not\nhelp: `python3 \u003Cscript>` is write-class wherever the script lives, and a non-governed cwd such as\n`~` is refused with `No governed repo could be resolved for this call` (`~\u002F.steadfaste-fleet` has no\n`.git`, checked 2026-10-25), which is not the lock rule;\n\nThe label is the **classifier's** claim, not a fact about your command: a read-only capture can\ncome back labelled as a destructive one (an evidence run flagged `SQL TRUNCATE`). Do not reshape a\nlegitimate read to fit a label that misdescribed it, and do not read the label as evidence the\ncommand was dangerous. Ask for the go-ahead — an explicit user \"go\" is what releases it — and when\nthe same benign shape keeps tripping the classifier, report it as a classifier defect instead of\npre-emptively rewriting every future call around a label you know is wrong.\n\n- **A metacharacter INSIDE QUOTES still splits segments.** The classifier tokenizes on shell\n  metacharacters without regard to quoting, so an alternation bar inside a pattern\n  (`grep -E \"learning|lesson\"`, any `|`-joined regex) reads as a pipe and tips the whole compound\n  write-class — even when every segment is a plain read. Rewrite the pattern as repeated flags\n  (`grep -E -e learning -e lesson`) rather than taking a lock to inspect something; the same trap\n  hides inside quoted `>`\u002F`\u003C`, `$( )` and `&&`-free strings you thought were literal text. A\n  primitive the classifier does not yet recognise (a read builtin it lacks) is a classifier gap to\n  report, not a command to rephrase.\n\n### When the fix belongs in the CLASSIFIER, not the command\n\nThe triggers above are caller-side workarounds. There is a second case where rephrasing is the\nwrong answer: a **read-only subcommand of a CLI the agent is required to run** is classified\nwrite-class, and the caller *cannot* take a lock — an unattended\u002Fcron session, or a cwd with no\ngoverned repo. Then the work is impossible rather than merely awkward, and that impossibility is\nthe signal the rule is wrong.\n\n**Remedy: add the read subcommands to the enforcer's read-only allowlist**\n(`READONLY_COMMAND_PATTERNS` in `plugins\u002Fgovernance-enforcer\u002F__init__.py`). The precedent is in the\nlist itself — `hermes mcp list|test` was added because the diagnostic path for a broken\nloop-governance server was unreachable without it. Match the existing entries' shape:\n\n- **Subcommand-SCOPED, never the whole CLI.** `r\"^\\s*(tool)\\s+(list|search|stats|doctor)\\b\"`.\n  An entry like `^\\s*(tool)\\b` admits that CLI's `sync`, `add`, `remove` and `store` as well — a\n  read widening is defensible, a write widening is not.\n- **Let the mutations stay refused BY CONSTRUCTION** (they simply do not match), and say so in the\n  comment so the next reader knows it was deliberate.\n- **Pin BOTH directions in a test that imports the SHIPPED predicate** — never a re-implementation.\n  Assert the read shapes are read-only AND the mutating siblings plus any compound mixing a read\n  with a write stay write-class. A test that only proves the reads became read-only passes just as\n  happily against an allowlist widened to the entire CLI, so it is not a check.\n- **Probe the classification directly instead of guessing** —\n  `importlib.util.spec_from_file_location` the enforcer source and call\n  `_is_readonly_terminal_command(\"\u003Ccmd>\")`. That answers \"is this the classifier's doing?\" in one\n  step, rather than inferring it from a refusal message.\n\nTwo mechanics this class of change always hits, because the enforcer is enforcement code:\n\n- **Edit the REPO source, then deploy.** The enforcer files are immutable and the deployed copy is\n  overwritten by the next update; `fleet-update.sh` owns unlock → copy → relock. Hand-editing\n  `~\u002F.hermes\u002Fplugins\u002F...` looks like it worked and is erased later.\n- **Deploy ≠ loaded for a plugin.** The enforcer module is imported at GATEWAY START, so a\n  classifier change is inert until the gateway restarts — and the deploy's own reload line names\n  only `hooks`. Compare the gateway's start time against the enforcer file's mtime to state which\n  of the two you are holding, label a not-yet-loaded fix as PENDING rather than PASS in any\n  evidence artifact, and give the operator the one command\n  (`systemctl --user restart hermes-gateway.service`) — agents cannot restart the gateway\nthemselves.\n\nA timeout is **not** a failed attempt to try harder. The gate's own words — do not retry the\ncommand, do not rephrase it, do not reach the same outcome by another route — are the\ninstruction, and re-issuing it with different quoting to slip past classification is exactly the\nbehaviour it forbids. Treat it as a consent boundary: an unattended or unanswered escalation\ndefaults to no-op.\n\n- **Ask, or remove the need.** Either put the question to the user, or change the design so the\n  tainted action is not required — do not keep the same outcome in the plan. Before asking, ask\n  what the destruction was FOR: a blocked cleanup is usually avoidable rather than forbidden.\n  Reusing one scratch path and `rm -rf`-ing it between runs needs consent every time; writing to a\n  FRESH uniquely-named directory per run needs none, and an append-only capture (`>>`) needs none\n  where truncate-and-replace (`head -n N file > tmp; mv tmp file`) would trip the gate. The gate\n  objecting to an action is a design signal about the action, and the cheapest fix is often to\n  stop wanting it — not to obtain permission for it.\n- **Nested shell-in-shell reads as write-class.** A quoted `bash -c \"...\"` whose payload runs\n  an installer or a redirect cannot be classified from the outer command, so it escalates rather\n  than running. Restructure into a plain single-purpose invocation, or better, drop it (below).\n- **A blocked action inside a CHECK is a design signal, not just a blocker.** If a verifier or\n  report step is what tripped the gate, the shape is wrong: a check that installs, migrates or\n  reconfigures what it inspects reports on a state it just changed. Split it — run the operation\n  once as a recorded manual step, and have the check assert the resulting state read-only\n  (versions, an import, a count). The same split removes the need for the blocked command, so the\n  gate never comes up again.\n- **Never present a blocked command's absence as a pass.** If the work genuinely needs it and you\n  cannot get consent, say so and stop — a silent skip that reads as green is the failure the gate\n  exists to prevent.\n\n## Survey Before Acting (user correction 2026-08-05)\n\nWhen the user reports a problem like this (\"you never need my permission to update\nfleet\" \u002F \"why are you blocked\"), the FIRST action is a survey — not a fix attempt.\nThis session's sequence that got corrected:\n\n1. Diagnosed the two-gate model, found the shadow — good.\n2. **Jumped straight to an env-var \"fix\"** (`HERMES_EXEC_ASK=1`) without loading the\n   always-skills (`survey-before-action` was still unloaded) and without surveying\n   where the variable actually comes from.\n3. User: *\"you should survey before action actually. ALWAYS\"* — then\n   *\"DO NOT CHANGE HERMES DEFAULTS OR YOU WILL BE RESET.\"*\n\n**Rule:** any investigation that may end in a config\u002Fenv\u002Fsystem change starts with the\nfull always-skill set loaded and a survey of the change surface (who sets the value,\nwhat reads it, what breaks if it changes) BEFORE proposing or making any edit. When the\nuser pushes back on a fix, the correction is a signal to survey deeper, not to act faster.\n\n## Verification Checklist\n\n- [ ] `detect_dangerous_command(cmd)` returns `(False, None, None)` (regex layer clean)\n- [ ] `shutil.which(\"tirith\")` resolves to the real binary, not `venv\u002Fbin\u002Ftirith`\n- [ ] `check_command_security(cmd)` returns `action: allow`\n- [ ] The original command runs with no security flag and no approval prompt\n- [ ] No `command_allowlist` entries were added to work around the scanner\n\n## References\n\n- `references\u002Ftirith-shadow-2026-08-05.md` — full evidence chain: degraded-message code\n  path, binary crash traceback, package metadata, PATH resolution order, fix + verification\n","# Approval Gate Debugging — Terminal Security-Scan False Blocks\n\n## When to Use\n\n- A terminal command is flagged: `Command was flagged (Security scan: security issue detected ...)`\n- A **sanctioned** command (e.g. `bash ~\u002Fsteadfaste-fleet\u002Fops\u002Fscripts\u002Ffleet-update.sh`) still prompts for user approval\n- Smart-approval escalates a routine command to the user, and the approval times out → deny\n- Any command that used to run clean suddenly needs approval\n\n**Core principle (user-corrected 2026-08-05):** an approval flag on a legitimate or\nsanctioned command is a **diagnostic signal** — investigate the underlying scanner\u002Fguard\nBEFORE whitelisting anything. Adding a `command_allowlist` entry to silence a flag you\ndon't understand masks the defect and leaves every other command still broken.\n\n## The Two-Gate Model\n\nTerminal commands pass TWO independent gates:\n\n1. **Governance enforcer** (Steadfaste Fleet plugin) — governance-lock check. The\n   sanctioned `fleet-update.sh` invocation passes this without a lock.\n2. **Hermes smart approval** (`tools\u002Fapproval.py`) — two sub-layers:\n   - Regex `detect_dangerous_command()` — pattern matching (curl|sh, rm -rf, gateway restart, etc.)\n   - **Tirith security scanner** — `tools\u002Ftirith_security.py` → external binary\n     `check --json --non-interactive --shell posix -- \u003Ccommand>`\n\nThe enforcer sanction does **NOT** bypass gate 2. A block you see almost always comes\nfrom gate 2.\n\n## The Degraded-Message Tell\n\n`\"security issue detected (details unavailable)\"` is the **degraded** summary. Per\n`tirith_security.py` (~lines 836-840), that exact string is emitted when Tirith's JSON\noutput **fails to parse** — i.e. the scanner binary crashed, printed garbage, or produced\nno JSON at all. It does NOT mean a real security finding. Real findings come back as\nstructured JSON with `findings: [...]`.\n\n**Rule:** `details unavailable` ⇒ the scanner is broken ⇒ debug the scanner, do not\napprove\u002Fallowlist the command.\n\n## Diagnosis Recipe\n\n```python\n# 1. Regex layer passes?\nfrom tools.approval import detect_dangerous_command\ndetect_dangerous_command(\"bash ~\u002Fsteadfaste-fleet\u002Fops\u002Fscripts\u002Ffleet-update.sh\")\n# → (False, None, None)  — regex layer is NOT the blocker\n\n# 2. Tirith layer blocks?\nfrom tools.tirith_security import check_command_security\ncheck_command_security(\"bash ~\u002Fsteadfaste-fleet\u002Fops\u002Fscripts\u002Ffleet-update.sh\")\n# → {\"action\": \"block\", \"summary\": \"security issue detected (details unavailable)\"}\n\n# 3. Which binary is resolved? PATH-shadowing check\nimport shutil; print(shutil.which(\"tirith\"))\n# If this is venv\u002Fbin\u002Ftirith → a same-named PyPI package is shadowing the real scanner\n\n# 4. Run the resolved binary directly to see the crash\n# (it ignores args, prints banner, then a traceback — e.g. socket.gaierror)\n```\n\n## PATH-Shadowing Failure Mode (root cause found 2026-08-05)\n\nThe real Tirith scanner is a compiled ELF from `sheeki03\u002Ftirith` GitHub releases,\ninstalled at `~\u002F.hermes\u002Fbin\u002Ftirith`. But the hermes-agent venv had a **PyPI package**\n`tirith` 0.2.2 (github.com\u002Futfsmlabs\u002Ftirith — unrelated \"Monitoring software\", a WAMP\nclient hardcoded to `ws:\u002F\u002Fframeshift:8080\u002Fws`, the original author's LAN hostname)\ninstalled at `venv\u002Fbin\u002Ftirith`. Because `venv\u002Fbin` is FIRST on PATH, `shutil.which(\"tirith\")`\nresolved to the bogus binary. It ignores `check --json ...` args, prints\n`tirith monitor 0.2.2 \u002F connecting`, crashes on DNS resolution, exits 1 → Hermes maps\nexit 1 → `block` → degraded summary.\n\n**Consequence:** EVERY terminal command was being \"scanned\" by the crashing demo. The\nsmart-approval LLM auto-approved most silently; commands with sudo\u002Fchattr\u002Fsystemctl\n(like fleet-update.sh) got escalated to the user → approval timeout → deny.\n\n### Detection\n\n```bash\n~\u002F.hermes\u002Fhermes-agent\u002Fvenv\u002Fbin\u002Fpip show tirith\n# → Name: tirith, Version: 0.2.2, Summary: Monitoring software, Home-page: github.com\u002Futfsmlabs\u002Ftirith\n```\n\n### Fix (root cause)\n\n```bash\n~\u002F.hermes\u002Fhermes-agent\u002Fvenv\u002Fbin\u002Fpip uninstall -y tirith   # nothing depends on it\n# verify:\n#   shutil.which(\"tirith\") → ~\u002F.hermes\u002Fbin\u002Ftirith\n#   check_command_security(cmd) → {\"action\": \"allow\"}\n```\n\nA gateway restart clears the in-memory cached scanner path (deploy ≠ load applies to\nthe scanner too).\n\n## What NOT to Do\n\n- ❌ **Do NOT add the command to `command_allowlist`** in config.yaml to silence the flag.\n  The allowlist short-circuits the entire approval gate for that command while the broken\n  scanner keeps silently flagging everything else. (User: *\"There is an underlying reason\n  the problem exists in the first place and you are masking it.\"*)\n- ❌ Do NOT set `approvals.mode: off` — kills all protection, not just the broken path.\n- ❌ Do NOT patch `tools\u002Ftirith_security.py` or `tools\u002Fapproval.py` — upstream hermes-agent\n  product code, reverted on next update, and the user forbids patching the guard.\n- ❌ Do NOT try to \"fix\" the prompt by removing gateway runtime env vars. `HERMES_EXEC_ASK`,\n  `HERMES_GATEWAY_SESSION`, `HERMES_INTERACTIVE`, `_HERMES_GATEWAY` are exported by the\n  RUNNING GATEWAY (`gateway\u002Frun.py`, `tui_gateway\u002Fserver.py::_enable_gateway_prompts()`),\n  not by config — nothing to unset, and doing so breaks approval routing. (User:\n  *\"DO NOT CHANGE HERMES DEFAULTS OR YOU WILL BE RESET\"*, 2026-08-05.)\n- ✅ DO run the resolved binary directly and read its output before deciding anything.\n\n## An escalated command that times out: STOP, do not route around it\n\nTwo different blocks wear similar clothes — tell them apart before acting:\n\n| Block | Meaning | Response |\n|---|---|---|\n| `security issue detected (details unavailable)` | the SCANNER crashed — no real finding | debug the scanner (above) |\n| escalation that ended in a timeout (`... did not run`, `Do NOT retry`, `Silence is not consent`) | a REAL approval request nobody answered | stop the workflow; change the design or ask |\n| `Your command was treated as WRITE-CAPABLE ... requires an active governance lock` | the GOVERNANCE ENFORCER (gate 1), not the approval gate — it classifies by SHAPE | split the command; do not rephrase it |\n\n**The shape-classifier is a third, unrelated block.** The enforcer allows a compound only when\nEVERY segment is a read primitive, so a harmless inspection stack\n(`git status --porcelain && git log --oneline -3 && echo done`) is refused while the same reads\nrun fine one at a time. A redirection, a `$( )`, a pipe into a write, or an interpreter form\n(`python3 \u003Crepo>\u002Fscript.py` — the allowlist never covers interpreter reads) tips a read into\nwrite-class. Remedies, in order: **run a single plain command per call** (a lone `git push` is\nthe canonical case — the push carve-out authorises exactly that shape and nothing compound);\ngive the session a RESOLVED GOVERNED REPO before any interpreter read — take the lock\ndeliberately (`begin_change`) and close the cycle — because the deployed copy's LOCATION does not\nhelp: `python3 \u003Cscript>` is write-class wherever the script lives, and a non-governed cwd such as\n`~` is refused with `No governed repo could be resolved for this call` (`~\u002F.steadfaste-fleet` has no\n`.git`, checked 2026-10-25), which is not the lock rule;\n\nThe label is the **classifier's** claim, not a fact about your command: a read-only capture can\ncome back labelled as a destructive one (an evidence run flagged `SQL TRUNCATE`). Do not reshape a\nlegitimate read to fit a label that misdescribed it, and do not read the label as evidence the\ncommand was dangerous. Ask for the go-ahead — an explicit user \"go\" is what releases it — and when\nthe same benign shape keeps tripping the classifier, report it as a classifier defect instead of\npre-emptively rewriting every future call around a label you know is wrong.\n\n- **A metacharacter INSIDE QUOTES still splits segments.** The classifier tokenizes on shell\n  metacharacters without regard to quoting, so an alternation bar inside a pattern\n  (`grep -E \"learning|lesson\"`, any `|`-joined regex) reads as a pipe and tips the whole compound\n  write-class — even when every segment is a plain read. Rewrite the pattern as repeated flags\n  (`grep -E -e learning -e lesson`) rather than taking a lock to inspect something; the same trap\n  hides inside quoted `>`\u002F`\u003C`, `$( )` and `&&`-free strings you thought were literal text. A\n  primitive the classifier does not yet recognise (a read builtin it lacks) is a classifier gap to\n  report, not a command to rephrase.\n\n### When the fix belongs in the CLASSIFIER, not the command\n\nThe triggers above are caller-side workarounds. There is a second case where rephrasing is the\nwrong answer: a **read-only subcommand of a CLI the agent is required to run** is classified\nwrite-class, and the caller *cannot* take a lock — an unattended\u002Fcron session, or a cwd with no\ngoverned repo. Then the work is impossible rather than merely awkward, and that impossibility is\nthe signal the rule is wrong.\n\n**Remedy: add the read subcommands to the enforcer's read-only allowlist**\n(`READONLY_COMMAND_PATTERNS` in `plugins\u002Fgovernance-enforcer\u002F__init__.py`). The precedent is in the\nlist itself — `hermes mcp list|test` was added because the diagnostic path for a broken\nloop-governance server was unreachable without it. Match the existing entries' shape:\n\n- **Subcommand-SCOPED, never the whole CLI.** `r\"^\\s*(tool)\\s+(list|search|stats|doctor)\\b\"`.\n  An entry like `^\\s*(tool)\\b` admits that CLI's `sync`, `add`, `remove` and `store` as well — a\n  read widening is defensible, a write widening is not.\n- **Let the mutations stay refused BY CONSTRUCTION** (they simply do not match), and say so in the\n  comment so the next reader knows it was deliberate.\n- **Pin BOTH directions in a test that imports the SHIPPED predicate** — never a re-implementation.\n  Assert the read shapes are read-only AND the mutating siblings plus any compound mixing a read\n  with a write stay write-class. A test that only proves the reads became read-only passes just as\n  happily against an allowlist widened to the entire CLI, so it is not a check.\n- **Probe the classification directly instead of guessing** —\n  `importlib.util.spec_from_file_location` the enforcer source and call\n  `_is_readonly_terminal_command(\"\u003Ccmd>\")`. That answers \"is this the classifier's doing?\" in one\n  step, rather than inferring it from a refusal message.\n\nTwo mechanics this class of change always hits, because the enforcer is enforcement code:\n\n- **Edit the REPO source, then deploy.** The enforcer files are immutable and the deployed copy is\n  overwritten by the next update; `fleet-update.sh` owns unlock → copy → relock. Hand-editing\n  `~\u002F.hermes\u002Fplugins\u002F...` looks like it worked and is erased later.\n- **Deploy ≠ loaded for a plugin.** The enforcer module is imported at GATEWAY START, so a\n  classifier change is inert until the gateway restarts — and the deploy's own reload line names\n  only `hooks`. Compare the gateway's start time against the enforcer file's mtime to state which\n  of the two you are holding, label a not-yet-loaded fix as PENDING rather than PASS in any\n  evidence artifact, and give the operator the one command\n  (`systemctl --user restart hermes-gateway.service`) — agents cannot restart the gateway\nthemselves.\n\nA timeout is **not** a failed attempt to try harder. The gate's own words — do not retry the\ncommand, do not rephrase it, do not reach the same outcome by another route — are the\ninstruction, and re-issuing it with different quoting to slip past classification is exactly the\nbehaviour it forbids. Treat it as a consent boundary: an unattended or unanswered escalation\ndefaults to no-op.\n\n- **Ask, or remove the need.** Either put the question to the user, or change the design so the\n  tainted action is not required — do not keep the same outcome in the plan. Before asking, ask\n  what the destruction was FOR: a blocked cleanup is usually avoidable rather than forbidden.\n  Reusing one scratch path and `rm -rf`-ing it between runs needs consent every time; writing to a\n  FRESH uniquely-named directory per run needs none, and an append-only capture (`>>`) needs none\n  where truncate-and-replace (`head -n N file > tmp; mv tmp file`) would trip the gate. The gate\n  objecting to an action is a design signal about the action, and the cheapest fix is often to\n  stop wanting it — not to obtain permission for it.\n- **Nested shell-in-shell reads as write-class.** A quoted `bash -c \"...\"` whose payload runs\n  an installer or a redirect cannot be classified from the outer command, so it escalates rather\n  than running. Restructure into a plain single-purpose invocation, or better, drop it (below).\n- **A blocked action inside a CHECK is a design signal, not just a blocker.** If a verifier or\n  report step is what tripped the gate, the shape is wrong: a check that installs, migrates or\n  reconfigures what it inspects reports on a state it just changed. Split it — run the operation\n  once as a recorded manual step, and have the check assert the resulting state read-only\n  (versions, an import, a count). The same split removes the need for the blocked command, so the\n  gate never comes up again.\n- **Never present a blocked command's absence as a pass.** If the work genuinely needs it and you\n  cannot get consent, say so and stop — a silent skip that reads as green is the failure the gate\n  exists to prevent.\n\n## Survey Before Acting (user correction 2026-08-05)\n\nWhen the user reports a problem like this (\"you never need my permission to update\nfleet\" \u002F \"why are you blocked\"), the FIRST action is a survey — not a fix attempt.\nThis session's sequence that got corrected:\n\n1. Diagnosed the two-gate model, found the shadow — good.\n2. **Jumped straight to an env-var \"fix\"** (`HERMES_EXEC_ASK=1`) without loading the\n   always-skills (`survey-before-action` was still unloaded) and without surveying\n   where the variable actually comes from.\n3. User: *\"you should survey before action actually. ALWAYS\"* — then\n   *\"DO NOT CHANGE HERMES DEFAULTS OR YOU WILL BE RESET.\"*\n\n**Rule:** any investigation that may end in a config\u002Fenv\u002Fsystem change starts with the\nfull always-skill set loaded and a survey of the change surface (who sets the value,\nwhat reads it, what breaks if it changes) BEFORE proposing or making any edit. When the\nuser pushes back on a fix, the correction is a signal to survey deeper, not to act faster.\n\n## Verification Checklist\n\n- [ ] `detect_dangerous_command(cmd)` returns `(False, None, None)` (regex layer clean)\n- [ ] `shutil.which(\"tirith\")` resolves to the real binary, not `venv\u002Fbin\u002Ftirith`\n- [ ] `check_command_security(cmd)` returns `action: allow`\n- [ ] The original command runs with no security flag and no approval prompt\n- [ ] No `command_allowlist` entries were added to work around the scanner\n\n## References\n\n- `references\u002Ftirith-shadow-2026-08-05.md` — full evidence chain: degraded-message code\n  path, binary crash traceback, package metadata, PATH resolution order, fix + verification\n",{"name":5,"author":24,"license":15,"version":25,"metadata":26,"platforms":39,"description":7},"Steadfaste Fleet","1.0.0",{"hermes":27},{"tags":28,"related_skills":35},[29,30,31,32,33,34],"approval","tirith","security-scan","smart-approval","terminal-gate","path-shadowing",[36,37,38],"root-cause-debugging","fleet-deployment-sync","file-ownership-boundaries",[40,41],"linux","macos","main","9dc0e92c5fa81d4db5292b205716e8ea0c00d10e","skills\u002Fdevops\u002Fapproval-gate-debugging",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":52,"prompt":62,"zipAvailable":63},[53,56,59],{"tool":54,"command":55},"npx","npx skills add lukemcqueen\u002Fsteadfaste-fleet --skill approval-gate-debugging",{"tool":57,"command":58},"bunx","bunx skills add lukemcqueen\u002Fsteadfaste-fleet --skill approval-gate-debugging",{"tool":60,"command":61},"pnpm","pnpm dlx skills add lukemcqueen\u002Fsteadfaste-fleet --skill approval-gate-debugging","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flukemcqueen\u002Fsteadfaste-fleet\u002Fblob\u002Fmain\u002Fskills\u002Fdevops\u002Fapproval-gate-debugging\u002FSKILL.md",true,[],[66,74,81,88,95,102],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":73},"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":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":73},"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":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":73},"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":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":73},"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":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":73},"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":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":73},"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",[],[]]