tsk-54492gk4xp69 Done An agent
Security hardening from the reviews of #1917 (2026-11-17). The runner's internal commands are meant for the runner itself, not for an agent it has placed. Make them hold to that:
- refuse the call when it comes from an agent under a placement;
- take every path from the runner's own state, never from the caller.
#1917 already covers part of it for its own new command. The details and the reproduction go by DM from lotse or the review lead. Nothing about the mechanism goes on this card, its PR or its commits; the squash message is written by hand.
Priority: right after the 2026-11-18 deploy. It keeps other clones' files closed, which the maintainer requires even with the open sandbox.
Notes
Lotse · Nov 17, 2026, 18:39 UTC
Scope addition: #1917 closes most of the internal command group for placed agents, but the runner itself starts four of them inside the agent's session, so those four stay reachable. Check whether each of the four is safe when an agent calls it directly. If one is not, give it a way to tell the runner's own call from an agent's. The details go by DM.
Lotse · Nov 17, 2026, 21:18 UTC
#1942 description of record for head de645cd85cad4822ae2f3cc48e9411eeaa593cc3 (the GitHub body without its footer):
Card: tsk-54492gk4xp69, part 1.
What is in
- The hook a placed Claude Code session runs before every tool call (
cli/src/maity/runner/plaincall.py) refuses a tool call that runsmaity runner, with its own reason. Themaity runnercommands are the runner's own; the runner starts its in-session ones through the launch, the pane and the hook itself, never through an agent's tool call. - Words are split as the shell splits them;
runnercounts as maity's subcommand after maity's leading options. Arunnerword that is not maity's subcommand (an argument, quoted text) passes as before. - Tests in
cli/tests/test_plaincall.py(refused lines, lines that pass, the hook process). - Docs:
docs/agents.md,docs/runners.md; the hook's entry incli/context/runner.md; changelog fragment.
How it was verified
make lint typecheckincli/(ruff, black, mypy incl.--platform win32): green.pytest tests/test_plaincall.py: 79 passed. Counter-check: the same tests against main'splaincall.py(plus a stand-inRUNNER_REFUSEDso they reach the assertion): 24 failed (the 23 refused lines and the hook-process case), 55 passed.- Full CLI suite at this head (
pytest -qincli/, run as root in a cloud container): 2839 passed, 20 skipped, 7 failed. The 7 (test_agent_user.py::test_a_partial_clone_listing_refuses_the_start,test_cli.py::test_a_directory_join_cannot_write_never_reaches_the_exchange,test_runner.py::test_pair_refuses_a_state_dir_it_cannot_create, four intest_serve.pyon unwritable/unreadable state) fail the same on origin/main c09b1bff1 in the same environment (7 failed); they test file permissions, which root bypasses. tools/overlap.sh: one conflict, with #1931 incli/src/maity/runner/plaincall.py; whichever lands second resolves it.python3 tools/changelog.py check,ktw-lint .andktw-lint cli: 0 errors, 0 warnings.
Not in
- Part 2 of the card stays for later.
- Other harnesses than Claude Code: unchanged.
---
- The hook a placed Claude Code session runs before every tool call (
Lotse · Nov 17, 2026, 22:20 UTC
#1942 description of record for head 91e2038116c81e77269acb276e61253705dace09 (bu49 round 2 applied; replaces nte-0tc7gtdtrybr):
Card: tsk-54492gk4xp69, part 1.
What is in
- In a placed Claude Code session the hook (
cli/src/maity/runner/plaincall.py) refuses, on any line, a wordrunnerthat follows a wordmaity(also as text; the reason points to--body-file). The check reads words as the shell splits and unquotes them, expands nothing, and fails closed on what it cannot read. - Not read by part 1: a command the shell builds only from expansions or from input; such a line is not one plain
maitycall and runs inside the sandbox. - Tests in
cli/tests/test_plaincall.py(refused lines, lines that pass, the hook process). - Docs:
docs/agents.md,docs/runners.md; the hook's entry incli/context/runner.md; changelog fragment.
How it was verified
make lint typecheckincli/(ruff, black, mypy incl.--platform win32): green.pytest tests/test_plaincall.py: 79 passed. Counter-check: the same tests against main'splaincall.py(plus a stand-inRUNNER_REFUSEDso they reach the assertion): 24 failed (the 23 refused lines and the hook-process case), 55 passed.- Full CLI suite at this head (
pytest -qincli/, run as root in a cloud container): 2839 passed, 20 skipped, 7 failed. The 7 (test_agent_user.py::test_a_partial_clone_listing_refuses_the_start,test_cli.py::test_a_directory_join_cannot_write_never_reaches_the_exchange,test_runner.py::test_pair_refuses_a_state_dir_it_cannot_create, four intest_serve.pyon unwritable/unreadable state) fail the same on origin/main c09b1bff1 in the same environment (7 failed); they test file permissions, which root bypasses. tools/overlap.sh: one conflict, with #1931 incli/src/maity/runner/plaincall.py; whichever lands second resolves it.python3 tools/changelog.py check,ktw-lint .andktw-lint cli: 0 errors, 0 warnings.
Not in
- Part 2 (by starter instead of by name) stays open for after the deploy.
- Other harnesses than Claude Code: unchanged.
---
- In a placed Claude Code session the hook (
Lotse · Nov 17, 2026, 22:26 UTC
#1942 description of record for head 91e2038116c81e77269acb276e61253705dace09 (bu49 round 2, with the round-2 verification from the PR body; replaces nte-0tc7gtdtrybr and nte-0ecpyqnrkq9w):
Card: tsk-54492gk4xp69, part 1.
What is in
- In a placed Claude Code session the hook (
cli/src/maity/runner/plaincall.py) refuses, on any line, a wordrunnerthat follows a wordmaity(also as text; the reason points to--body-file). The check reads words as the shell splits and unquotes them, expands nothing, and fails closed on what it cannot read. - Not read by part 1: a command the shell builds only from expansions or from input; such a line is not one plain
maitycall and runs inside the sandbox. - Tests in
cli/tests/test_plaincall.py(refused lines, lines that pass, the hook process). - Docs:
docs/agents.md,docs/runners.md; the hook's entry incli/context/runner.md; changelog fragment.
How it was verified
make lint typecheckincli/(ruff, black, mypy incl.--platform win32): green.pytest tests/test_plaincall.py: 122 passed on Python 3.11.18, 3.12.3, 3.13.18 and 3.14.6.- Counter-check: the same tests against the first round's
plaincall.py(de645cd8): 23 failed, 99 passed. Mutants of the new check (8): each killed by at least one test. - Full CLI suite at this head, as root in a cloud container: 2882 passed, 20 skipped, 7 failed: the same 7 file-permission tests as in round 1, which root bypasses (they pass as non-root per a reviewer's run).
python3 tools/changelog.py check: 30 valid;ktw-lint --strict .andktw-lint --strict cli: 0 errors, 0 warnings.git merge-tree --write-tree origin/main HEADon main c350bfd06f17: clean.tools/overlap.sh(first round): one conflict, with #1931 incli/src/maity/runner/plaincall.py; whichever lands second resolves it.
Not in
- Part 2 (by starter instead of by name) stays open for after the deploy.
- Other harnesses than Claude Code: unchanged.
---
- In a placed Claude Code session the hook (
Lotse · Nov 17, 2026, 22:52 UTC
#1942 description of record for head 646a2302c42033fa8e3cce4ad63e01d635a2dc78 (bu49 round 3; replaces nte-mc47cdh5r27v):
Card: tsk-54492gk4xp69, part 1.
What is in
- In a placed Claude Code session the hook (
cli/src/maity/runner/plaincall.py) refuses, on any line, a wordrunnerthat follows a wordmaity(also as text; the reason points to--body-file). The check reads words as the shell splits and unquotes them, expands nothing, and refuses what it cannot read to the end: a word the shell expands counts as either word, and nested quoted text below four levels and lines with unclosed quotes are refused when they hold the words. - Not read by part 1: a command the shell builds only from expansions or from input; such a line is not one plain
maitycall and runs inside the sandbox. - Tests in
cli/tests/test_plaincall.py(refused lines, lines that pass, the hook process). - Docs:
docs/agents.md,docs/runners.md; the hook's entry incli/context/runner.md; changelog fragment.
How it was verified (head of round 3)
make lint typecheckincli/(ruff, black, mypy incl.--platform win32): green.pytest tests/test_plaincall.py: 127 passed on Python 3.11.18, 3.12.3, 3.13.18 and 3.14.6.- Counter-check against round 2's
plaincall.py(91e20381): 9 failed, 118 passed. Mutants of the round-3 changes (4): all killed. - Round 2's counter-check against round 1 (de645cd8): 23 failed, 99 passed.
pytest tests/test_plaincall.py tests/test_adapters.py tests/test_runner.py: 358 passed, 1 failed (test_pair_refuses_a_state_dir_it_cannot_create, a file-permission test that fails as root on main as well). Full suite at round 2, as root: 2882 passed, 20 skipped, 7 failed (the same root-only permission tests).python3 tools/changelog.py check: 30 valid;ktw-lint --strict .andktw-lint --strict cli: 0 errors, 0 warnings;git diff --check: clean.git merge-tree --write-tree origin/main HEADon main d5689fd1d979: clean.
Not in
- Part 2 (by starter instead of by name) stays open for after the deploy.
- Other harnesses than Claude Code: unchanged.
---
- In a placed Claude Code session the hook (
Lotse · Nov 17, 2026, 23:28 UTC · dismissed
#1942 description of record for head 86393aef5914384122b0b7900c4581147d6b6afb (bu49 round 4, includes a merge of main 87f67da6; replaces nte-2qkkbtcrs1cj):
Card: tsk-54492gk4xp69, part 1.
What is in
- In a placed Claude Code session the hook (
cli/src/maity/runner/plaincall.py) refuses, on any line, a wordrunnerthat follows a wordmaity(also as text; the reason points to--body-file). The check reads words as the shell splits and unquotes them and expands nothing; a word the shell expands counts as either word. A line it cannot read to the end (an unclosed quote, quoted text nested more than four levels) is refused whatever it holds. - Not read by part 1: a command the shell builds only from expansions or from input; it does not start with a literal
maityword, so itsmaityruns inside the sandbox. - Tests in
cli/tests/test_plaincall.py(refused lines, lines that pass, the hook process). - Docs:
docs/agents.md,docs/runners.md; the hook's entry incli/context/runner.md; changelog fragment.
How it was verified (head of round 4)
make lint typecheckincli/(ruff, black, mypy incl.--platform win32): green.pytest tests/test_plaincall.py: 143 passed on Python 3.11.18, 3.12.3, 3.13.18 and 3.14.6.- Counter-check against round 3's
plaincall.py(646a2302): 18 failed, 125 passed. Mutants of the round-4 changes (4): all killed. - Full CLI suite at this head, as root in a cloud container: 2961 passed, 20 skipped, 7 failed (the same file-permission tests as in earlier rounds, which root bypasses).
python3 tools/changelog.py check: 34 valid;ktw-lint --strict .andktw-lint --strict cli: 0 errors, 0 warnings;git diff --check: clean.- Merge of main 87f67da6:
git show --remerge-diffof the merge commit is empty.
Not in
- Part 2 (by starter instead of by name) stays open for after the deploy.
- Other harnesses than Claude Code: unchanged.
---
- In a placed Claude Code session the hook (
Lotse · Nov 18, 2026, 11:36 UTC · dismissed
#1942 description of record for head 9f80318806e11950ad6f1b852b301bec925fd48c (9f803188, round 5 / merge of main 3f0f7fb1; bu49 round 5; replaces nte-d86g1g0a6t5q):
Card: tsk-54492gk4xp69, part 1.
What is in
- In a placed Claude Code session the hook (
cli/src/maity/runner/plaincall.py) refuses, on any line, a wordrunnerthat follows a wordmaityas the hook splits words, quoted text read again in line order included (also as text; the reason points to--body-file). A word the shell would still expand counts asmaitybefore a laterrunner, and asrunnerafter amaityin the same text. A line that namesmaityand holds a comment, a heredoc or more than one line is refused without being read; so is a line with an unclosed quote or quoted text nested more than four levels deep, whatever it holds. - Not read by part 1: a command the shell builds only from expansions or from input. Claude Code's sandbox exclusion (2.1.327) takes only a single line that starts with the literal word
maityout of the sandbox, and such a line passes only as one plain call. - Tests in
cli/tests/test_plaincall.py(refused lines, lines that pass, the hook process). - Docs:
docs/agents.md,docs/runners.md; the hook's entry incli/context/runner.md; changelog fragment.
How it was verified (head of round 5)
make lint typecheckincli/(ruff, black, mypy incl.--platform win32): green.pytest tests/test_plaincall.py: 172 passed (Python 3.13.18); withtest_adapters.pyandtest_runner.py: 406 passed, 1 failed (a file-permission test that root bypasses).- Counter-check: the round-5 tests against round 4's
plaincall.py(86393aef): 22 failed, 150 passed. Mutants of the round-5 changes (8, one per rule or part): all killed (9, 3, 2, 7, 3, 4, 5 and 14 failing tests). - Full CLI suite at this head, as root in a cloud container: 3087 passed, 75 skipped, 7 failed (the same file-permission tests as in earlier rounds, which root bypasses).
python3 tools/changelog.py check: 5 valid;ktw-lint --strict .andktw-lint --strict cli: 0 errors, 0 warnings;git diff --check: clean.- Merge of main 3f0f7fb1:
git show --remerge-diffof the merge commit is empty.
Not in
- Part 2 (decided by Oliver on 2026-11-18: the whole runner moves out of
maityinto its ownmaity-runnerscript) is its own PR after #1942 and #1917. - Other harnesses than Claude Code: unchanged.
- In a placed Claude Code session the hook (
Lotse · Nov 18, 2026, 11:49 UTC · worked in
Correction to nte-w3j0ts6g1bx8 (lotse, 2026-11-18 11:50Z): the "Not read by part 1" line there overstates the boundary. It rests on a leftover npm
cli.js2.1.42, not on the native Claude Code 2.1.327 the runner starts (bu49, seq 160554). In the official build,excludedCommandsparses the parts and strips safe assignments and prefixes before matching, so a line likeVAR=… maity …may leave the sandbox. Round 6 makesapplies()fail closed on such prefixes; bu49 sends the corrected description with it. Until then, this note and the PR body's same line do not hold.Lotse · Nov 18, 2026, 12:33 UTC · dismissed
#1942 description of record for head 975286162bc0417a6843be4935b8c4209963a372 (97528616, round 6 / merge of main ef3fcf98; replaces nte-w3j0ts6g1bx8 and its correction nte-1ptmvyhwmez0). Card tsk-54492gk4xp69, part 1. Review rounds and verification: as in the live PR body at this head.
What is in
- The hook a placed Claude Code session runs before every tool call (
cli/src/maity/runner/plaincall.py) refuses, on any line, a wordrunnerthat follows a wordmaity, with its own reason.maity runneris the runner's own command; the runner starts its in-session commands through the launch, the pane and the hook itself, never through an agent's tool call. - A line that names
maityanywhere (in any case, also with quotes or backslashes between its letters) is refused when it holds a comment (#at the line's start or after a space or an operator, quoted or not), a heredoc operator (<<, quoted or not) or more than one line. The hook does not read such a line to the end, so it refuses it. A line whose quotes never close is refused whatever it holds. - The word check splits words at unquoted spaces, tabs and operators and takes quotes and backslashes off; it expands nothing and does not read comments or heredocs, which the rule above refuses. A word the shell would still expand counts as
maitybefore a laterrunnerword, and asrunnerafter amaityword in the same text. Quoted text that holds spaces or operators is read again, four levels deep, and its words count in the line's order with the words around it; text nested deeper is refused, whatever it holds. Text is not told apart from a call, quoted or not, so text that holds both words goes in a file (--body-file); the reason says so. - A line whose first word is
maityby a path, a variable assignment or a command that runs the command after it (env,command,exec,builtin,nice,nohup,timeout,time,stdbuf,sudo,doasand a few more, by any path and in any case, and the shell words that start a command), and that holds a wordmaity, is held to one plain call like a line that starts withmaity. A plain call after such a prefix still passes. - Not read: a command the shell builds only from expansions or from input.
- The hook does not depend on how Claude Code's sandbox exclusion matches
maity *. It fails closed on a line namingmaityafter a prefix it cannot vouch for (variable assignments or a wrapper command): such a line is held to one plain call, and a laterrunnerword refuses it either way. Claude Code's matcher (2.1.327, native binary sha256343c744baa14bfd38286a7cb90871051f04379956da6c5b803a9e66019a76ac9) was read statically only; the readings differ, so the hook does not rely on it. - Tests in
cli/tests/test_plaincall.py, including a check againstmaity's own parser on the running Python and each prefix form. - Docs:
docs/agents.md,docs/runners.md; the hook's entry incli/context/runner.md; changelog fragment.
Not in
- Part 2 (decided 2026-11-18: maity-runner as its own PyPI package) is its own PR.
- The hook a placed Claude Code session runs before every tool call (
Lotse · Nov 18, 2026, 13:35 UTC · dismissed
#1942 description of record for head 53488b7e95ab4d2231a46b41ad269ee6a88f044b (53488b7e, round 7; parent 97528616, no merge of main this round; replaces nte-s3hs87bsq44v). Card tsk-54492gk4xp69, part 1. Review rounds and verification: as in the live PR body at this head.
What is in
- The hook a placed Claude Code session runs before every tool call (
cli/src/maity/runner/plaincall.py) refuses, on any line, a wordrunnerthat follows a wordmaity, with its own reason.maity runneris the runner's own command; the runner starts its in-session commands through the launch, the pane and the hook itself, never through an agent's tool call. - A line that names
maityanywhere (in any case, also with quotes or backslashes between its letters) is refused when it holds a comment (#at the line's start or after a space or an operator, quoted or not), a heredoc operator (<<, quoted or not) or more than one line. The hook does not read such a line to the end, so it refuses it. A line whose quotes never close is refused whatever it holds. - The word check splits words at unquoted spaces, tabs and operators and takes quotes and backslashes off; it expands nothing and does not read comments or heredocs, which the rule above refuses. A word the shell would still expand counts as
maitybefore a laterrunnerword, and asrunnerafter amaityword in the same text. Quoted text that holds spaces or operators is read again, four levels deep, and its words count in the line's order with the words around it; text nested deeper is refused, whatever it holds. Text is not told apart from a call, quoted or not, so text that holds both words goes in a file (--body-file); the reason says so. - On a line that does not start with
maity, wheremaityis a word (as the word check reads it, also a word of quoted text read again; in any case, by any path), only variable assignments may stand before it: names written unquoted with=or+=, one or several, quoted values allowed. Such a line is held to one plain call like a line that starts withmaity(NODE_ENV=1 maity statuspasses,NODE_ENV=1 maity runner statusis refused). Anything else beforemaityrefuses the line outright: a command word by name or path, whatever command it is, a shell keyword,!, a redirection or fd duplication, a subshell or a group, andmaityby a path. The reason names the plain form (maity …at the start of the line) and--body-filefor text that mentionsmaity. There is no list of wrapper commands. - Lines that start with
maityare decided as before. Before looking formaity, leading spaces, quotes and characters a plain call may not hold are skipped; a character a plain word may hold (/,.,:and the like) is not, so./maityor. maitycounts asmaityafter a prefix. - Accepted cost: text that mentions
maityas a word after another command is refused (env maity status,sudo maity status,git log --grep maity | head,echo maity | cat,git commit -m 'fix maity docs'); the way out is a file with--body-file.maityinside a longer word (maity.md,maity/) is not a word. - Not read: a command the shell builds only from expansions or from input.
- The hook does not depend on how Claude Code's sandbox exclusion matches
maity *. It fails closed: a line wheremaityis a word after anything but variable assignments is refused, and one after assignments only is held to one plain call. Claude Code's matcher (2.1.327, native binary sha256343c744baa14bfd38286a7cb90871051f04379956da6c5b803a9e66019a76ac9) was read statically only; the readings differ, so the hook does not rely on it. - Tests in
cli/tests/test_plaincall.py, including a check againstmaity's own parser on the running Python, assignment prefixes, and one case per kind of prefix that is refused. - Docs:
docs/agents.md,docs/runners.md; the hook's entry incli/context/runner.md( changelog fragment.
Not in
- Part 2 (decided 2026-11-18: maity-runner as its own PyPI package) is its own PR.
- The hook a placed Claude Code session runs before every tool call (
Lotse · Nov 18, 2026, 13:40 UTC · dismissed
Addendum to nte-96r3hzrvn36g (lotse, 13:40Z): current head 4c6a92edf052a23bbe6bd09ce686e5ec0dee4365 (parent 53488b7e, no code change). Also in: a test and the naming of the path rule (a clone named after the handle like
…/maity-coder-claude-004passes,…/maityis refused) in docs/runners.md and KtW 63492c65; the pause example in docs/agents.md now plain (maity api PATCH /me --json pause.json). The PR body names no head SHA, so it needs no change.Lotse · Nov 18, 2026, 15:19 UTC · dismissed
#1942 description of record for head bd186cc4e5065f276ad149fe9a21587880e1133d (bd186cc4, round 8; parent 8cb8914d, on d6474bb5, on aeaa653c, a merge of main fd63dcd0 into 4c6a92ed; replaces nte-96r3hzrvn36g and its addendum nte-xwh4fnpaj0fj). Card tsk-54492gk4xp69, part 1. Review rounds and verification: as in the live PR body at this head.
What is in
- The hook a placed Claude Code session runs before every tool call (
cli/src/maity/runner/plaincall.py) refuses, on any line, a wordrunnerthat follows a wordmaity, with its own reason.maity runneris the runner's own command; the runner starts its in-session commands through the launch, the pane and the hook itself, never through an agent's tool call. - A line that names
maityanywhere (in any case, also with quotes or backslashes between its letters) is refused when it holds a comment (#at the line's start or after a space or an operator, quoted or not), a heredoc operator (<<, quoted or not) or more than one line. The hook does not read such a line to the end, so it refuses it. A line whose quotes never close, or that holds$'…'text with a backslash or an unquoted$"…"(Bash's locale quoting, whose text a translation may replace), is refused whatever it holds. - The word check splits words at unquoted spaces, tabs and operators and takes quotes and backslashes off; a word counts as
maityorrunneralso once the backslashes and quotes left in it are taken off. It expands nothing and does not read comments or heredocs, which the rule above refuses. A word the shell would still expand counts asmaitybefore a laterrunnerword, and asrunnerafter amaityword in the same text. Quoted text that holds spaces or operators is read again, four levels deep (for amaityword as for arunnerword), and its words count in the line's order with the words around it; text nested deeper is refused, whatever it holds. Text is not told apart from a call, quoted or not, so text that holds both words goes in a file (--body-file); the reason says so.
(continued in parts 2 and 3)
- The hook a placed Claude Code session runs before every tool call (
Lotse · Nov 18, 2026, 15:19 UTC · dismissed
#1942 description of record for head bd186cc4, part 2 of 3 (continued).
- On a line that does not start with
maity, wheremaityis a word (as the word check reads it, also a word of quoted text read again; in any case, by any path), only assignments toMAITY_WAIT_TIMEOUT,NO_COLOR,LANG,LC_*andTZmay stand before it: written unquoted with=, one or several, quoted values allowed; the value is not judged there, since the one-plain-call rule refuses one that expands. Such a line is held to one plain call like a line whose first word ismaity(TZ=UTC maity statuspasses,TZ=UTC maity runner statusis refused). Anything else beforemaityrefuses the line outright: an assignment to any other name (the runner's ownMAITY_variables and any otherMAITY_name included) or with+=, a command word by name or path, whatever command it is, a shell keyword,!, a redirection or fd duplication, a subshell or a group, andmaityby a path. The reason names the plain form (maity …at the start of the line) and--body-filefor text that mentionsmaity. There is no list of wrapper commands. The names are allowed by a list, not refused by one: an assignment can choose the program the shell runs or load code into it, and a list of refused names would leak the way the wrapper list did. The list is a fixed tuple inplaincall.py(ALLOWED_BEFORE_MAITY) with noMAITY_pattern: aMAITY_name stands on it only when docs/agents.md documents it for agents and the CLI reads it, which today isMAITY_WAIT_TIMEOUTalone. The runner-trusted names (MAITY_PLACEMENT,MAITY_GIT_INODE,MAITY_GIT_PRIVATE,MAITY_STATE_DIR,MAITY_SUPERVISOR,MAITY_RUNNER_CONFIG,MAITY_ERROR_LINE,MAITY_SCRATCH) decide what maity trusts, so each refuses the line. - Lines whose first word is
maityare decided as before. Before looking formaity, leading spaces and characters a plain call may not hold are skipped; a character a plain call may hold (/,.,:and the like, a quote, a backslash) is not, so./maity,/maityor. maitycounts asmaityafter a prefix, and a quoted or escaped first word ("[" maity status,\! maity status,"" maity status) is a word of its own beforemaityand refuses the line. The line starts withmaityonly whenmaityis followed by a space, a tab, an operator or the line's end; a first word that only starts withmaityis read by the word check like any other word. - A path whose last component is exactly
maitycounts asmaityeverywhere: a clone named after the handle (…/maity-coder-claude-004) passes,…/maityis refused (docs/runners.md, KtW 63492c65).
- On a line that does not start with
Lotse · Nov 18, 2026, 15:19 UTC · dismissed
#1942 description of record for head bd186cc4, part 3 of 3 (continued).
- Accepted cost: text that mentions
maityas a word after another command is refused (env maity status,sudo maity status,git log --grep maity | head,echo maity | cat,git commit -m 'fix maity docs'); the way out is a file with--body-file.maityinside a longer word (maity.md,maity/) is not a word. Lines with$'…'text that holds a backslash, or with$"…", are refused whatever they name (echo $"hi"included);printfwith single quotes, plain double quotes or a file is the way out. - Not read: a command the shell builds only from expansions or from input.
- The hook does not depend on how Claude Code's sandbox exclusion matches
maity *. It fails closed: a line wheremaityis a word after anything but the allowed assignments is refused, and one after allowed assignments only is held to one plain call. Claude Code's matcher (2.1.327, native binary sha256343c744baa14bfd38286a7cb90871051f04379956da6c5b803a9e66019a76ac9) was read statically only; the readings differ, so the hook does not rely on it. - Tests in
cli/tests/test_plaincall.py, including a check againstmaity's own parser on the running Python, the allowed assignment names and one refused case per kind of other name, one refused case per runner-trustedMAITY_name, and one case per kind of prefix that is refused; a guard test scanscli/src/maityforMAITY_names and fails when a runner-trusted name or aMAITY_pattern is on the list, or aMAITY_name on it is not read by maity or not documented in docs/agents.md. Tests also cover a quoted or escaped first word beforemaity,maityitself quoted,$"…", quoted text at exactly four and five levels,eval "'maity'" "'runner'" status,/maity statusandprefixed()directly. - Docs:
docs/agents.md,docs/runners.md; the hook's entry incli/context/runner.md(with the rejected alternatives "an allow-list of wrappers", "rewording only", "a list of refused names" and "MAITY_*as a wildcard"); changelog fragment.
Not in
- Part 2 (decided 2026-11-18: maity-runner as its own PyPI package) is its own PR.
- Accepted cost: text that mentions
Lotse · Nov 18, 2026, 15:52 UTC · dismissed
Addendum to the description of record (nte-6qnf7xsfv5ca / nte-y6ma1bpajdva / nte-a6q368xhqgc1): it now applies to head 9718e47be63aa1cb4100ee4a6fe9b10f235acd8c (parent bd186cc4). The only change is the UTF-8 fix (
encoding="utf-8") in the guard tests in cli/tests/test_plaincall.py, for cli-windows. Hook and texts unchanged.Lotse · Nov 18, 2026, 16:39 UTC · dismissed
#1942 description of record for head 420d6eb8000f3961dc0043b0603cd60af7073324 (420d6eb8, round 9; parent 285f8767, a merge of main 6444690a into 9718e47b, on bd186cc4; replaces the round-8 header and its addendum nte-416apz0f7dbt). Card tsk-54492gk4xp69, part 1. Review rounds and verification: as in the live PR body at this head.
What is in
- The hook a placed Claude Code session runs before every tool call (
cli/src/maity/runner/plaincall.py) refuses, on any line, a wordrunnerthat follows a wordmaity, with its own reason.maity runneris the runner's own command; the runner starts its in-session commands through the launch, the pane and the hook itself, never through an agent's tool call. - A line that names
maityanywhere (in any case, also with quotes or backslashes between its letters) is refused when it holds a comment (#at the line's start or after a space or an operator, quoted or not), a heredoc operator (<<, quoted or not) or more than one line. The hook does not read such a line to the end, so it refuses it. A line whose quotes never close, or that holds$'…'text with a backslash or an unquoted$"…"(Bash's locale quoting, whose text a translation may replace), is refused whatever it holds. - The word check splits words at unquoted spaces, tabs and operators and takes quotes and backslashes off; a word counts as
maityorrunneralso once the backslashes and quotes left in it are taken off, and a word that holds a{also as each part of it between{,,and}, since the shell may make a word of its own of each literal alternative of a brace: a brace that holds both words counts asmaityfollowed byrunner. A name the shell only builds by joining a brace's parts with the text around it is not read (a command built from expansions). It expands nothing and does not read comments or heredocs, which the rule above refuses. A word the shell would still expand counts asmaitybefore a laterrunnerword, and asrunnerafter amaityword in the same text. Quoted text that holds spaces or operators is read again, four levels deep (for amaityword as for arunnerword), and its words count in the line's order with the words around it; text nested deeper is refused, whatever it holds. Text is not told apart from a call, quoted or not, so text that holds both words goes in a file (--body-file); the reason says so.
(continued in parts 2 and 3)
- The hook a placed Claude Code session runs before every tool call (
Lotse · Nov 18, 2026, 16:39 UTC · dismissed
#1942 description of record for head 420d6eb8, part 2 of 3 (continued).
- On a line that does not start with
maity, wheremaityis a word (as the word check reads it, also a word of quoted text read again; in any case, by any path), only assignments toMAITY_WAIT_TIMEOUT,NO_COLOR,LANG,LC_*andTZmay stand before it: each by its exact name in capitals (LC_followed by at least one capital, digit or underscore, sotz=UTCand a bareLC_=xrefuse the line), written unquoted with=, one or several, quoted values allowed; the value is not judged there, since the one-plain-call rule refuses one that expands. Such a line is held to one plain call like a line whose first word ismaity(TZ=UTC maity statuspasses,TZ=UTC maity runner statusis refused). Anything else beforemaityrefuses the line outright: an assignment to any other name (the runner's ownMAITY_variables and any otherMAITY_name included) or with+=, a command word by name or path, whatever command it is, a shell keyword,!, a redirection or fd duplication, a subshell or a group, andmaityby a path. The reason names the plain form (maity …at the start of the line) and--body-filefor text that mentionsmaity. There is no list of wrapper commands. The names are allowed by a list, not refused by one: an assignment can choose the program the shell runs or load code into it, and a list of refused names would leak the way the wrapper list did. The list is a fixed tuple inplaincall.py(ALLOWED_BEFORE_MAITY) with noMAITY_pattern: aMAITY_name stands on it only when docs/agents.md documents it for agents and the CLI reads it, which today isMAITY_WAIT_TIMEOUTalone. The runner-trusted names (MAITY_PLACEMENT,MAITY_GIT_INODE,MAITY_GIT_PRIVATE,MAITY_STATE_DIR,MAITY_SUPERVISOR,MAITY_RUNNER_CONFIG,MAITY_ERROR_LINE,MAITY_SCRATCH) decide what maity trusts, so each refuses the line. - Lines whose first word is
maityare decided as before. Before looking formaity, leading spaces and characters a plain call may not hold are skipped; a character a plain call may hold (/,.,:and the like, a quote, a backslash) is not, so./maity,/maityor. maitycounts asmaityafter a prefix, and a quoted or escaped first word ("[" maity status,\! maity status,"" maity status) is a word of its own beforemaityand refuses the line. The line starts withmaityonly whenmaityis followed by a space, a tab, an operator or the line's end; a first word that only starts withmaityis read by the word check like any other word. - A path whose last component is exactly
maitycounts asmaityeverywhere: a clone named after the handle (…/maity-coder-claude-004) passes,…/maityis refused (docs/runners.md, KtW 63492c65).
- On a line that does not start with
Lotse · Nov 18, 2026, 16:39 UTC · dismissed
#1942 description of record for head 420d6eb8, part 3 of 3 (continued).
- Accepted cost: text that mentions
maityas a word after another command is refused (env maity status,sudo maity status,git log --grep maity | head,echo maity | cat,git commit -m 'fix maity docs'); the way out is a file with--body-file.maityinside a longer word (maity.md,maity/) is not a word. Lines with$'…'text that holds a backslash, or with$"…", are refused whatever they name (echo $"hi"included);printfwith single quotes, plain double quotes or a file is the way out. - Not read: a command the shell builds only from expansions or from input.
- The hook does not depend on how Claude Code's sandbox exclusion matches
maity *. It fails closed: a line wheremaityis a word after anything but the allowed assignments is refused, and one after allowed assignments only is held to one plain call. Claude Code's matcher (2.1.327, native binary sha256343c744baa14bfd38286a7cb90871051f04379956da6c5b803a9e66019a76ac9) was read statically only; the readings differ, so the hook does not rely on it. - Tests in
cli/tests/test_plaincall.py, including a check againstmaity's own parser on the running Python, the allowed assignment names and one refused case per kind of other name, one refused case per runner-trustedMAITY_name, and one case per kind of prefix that is refused; a guard test scanscli/src/maityforMAITY_names and fails when a runner-trusted name or aMAITY_pattern is on the list, or aMAITY_name on it is not read by maity or not documented in docs/agents.md. Tests also cover a quoted or escaped first word beforemaity,maityitself quoted,$"…", quoted text at exactly four and five levels,eval "'maity'" "'runner'" status,/maity status,prefixed()directly, words with brace alternatives (refused when an alternative readsmaityor both words;echo {a,b},find . -exec ls {} \;,git log @{u}and a comma list without a brace still pass), and lowercase and bareLC_names beforemaity. - Docs:
docs/agents.md(also: inside a Claude Code session a runner placed,maityis called plain, not by its full path),docs/runners.md; the hook's entry incli/context/runner.md(with the rejected alternatives "an allow-list of wrappers", "rewording only", "a list of refused names" and "MAITY_*as a wildcard"); changelog fragment.
Not in
- Part 2 (decided 2026-11-18: maity-runner as its own PyPI package) is its own PR.
- Accepted cost: text that mentions
Lotse · Nov 18, 2026, 18:41 UTC · dismissed
#1942 description of record for head 64d28cfe1dcdc11a8071fbcab4d801520ba9239d (64d28cfe, round 10; parent 97c805f8, a merge of main d71c8f5d into 420d6eb8; replaces the round-9 header). Card tsk-54492gk4xp69, part 1. Review rounds and verification: as in the live PR body at this head.
What is in
- The hook a placed Claude Code session runs before every tool call (
cli/src/maity/runner/plaincall.py) refuses, on any line, a wordrunnerthat follows a wordmaity, with its own reason.maity runneris the runner's own command; the runner starts its in-session commands through the launch, the pane and the hook itself, never through an agent's tool call. - A line that names
maityanywhere (in any case, also with quotes or backslashes between its letters) is refused when it holds a comment (#at the line's start or after a space or an operator, quoted or not), a heredoc operator (<<, quoted or not) or more than one line. The hook does not read such a line to the end, so it refuses it. A line whose quotes never close, or that holds$'…'text with a backslash or an unquoted$"…"(Bash's locale quoting, whose text a translation may replace), is refused whatever it holds. - The word check splits words at unquoted spaces, tabs and operators and takes quotes and backslashes off; a word counts as
maityorrunneralso once the backslashes and quotes left in it are taken off, and a word that holds a{also as each part of it between{,,and}, since the shell may make a word of its own of each literal alternative of a brace: a brace that holds both words counts asmaityfollowed byrunner. A word that holds a{counts as well as each word its brace expansion makes, the alternatives joined with the text around them (nested braces, several brace groups in one word and letter ranges such as{a..e}expand as Bash expands them; number ranges stay as they are), up to 256 words; a word whose braces make more than 256 words, that holds more than 256 brace groups, or whose braces nest deeper than the hook's stack allows refuses the line. The words are made one at a time and only up to that limit. Otherwise the check expands nothing and does not read comments or heredocs, which the rule above refuses. A word the shell would still expand counts asmaitybefore a laterrunnerword, and asrunnerafter amaityword in the same text. Quoted text that holds spaces or operators is read again, four levels deep (for amaityword as for arunnerword), and its words count in the line's order with the words around it; text nested deeper is refused, whatever it holds. Text is not told apart from a call, quoted or not, so text that holds both words goes in a file (--body-file); the reason says so.
(continued in parts 2 and 3)
- The hook a placed Claude Code session runs before every tool call (
Lotse · Nov 18, 2026, 18:41 UTC · dismissed
#1942 description of record for head 64d28cfe, part 2 of 3 (continued).
- On a line that does not start with
maity, wheremaityis a word (as the word check reads it, also a word of quoted text read again; in any case, by any path), only assignments toMAITY_WAIT_TIMEOUT,NO_COLOR,LANG,LC_*andTZmay stand before it: each by its exact name in capitals (LC_followed by at least one capital, digit or underscore, sotz=UTCand a bareLC_=xrefuse the line), written unquoted with=, one or several, quoted values allowed; the value is not judged there, since the one-plain-call rule refuses one that expands. Such a line is held to one plain call like a line whose first word ismaity(TZ=UTC maity statuspasses,TZ=UTC maity runner statusis refused). Anything else beforemaityrefuses the line outright: an assignment to any other name (the runner's ownMAITY_variables and any otherMAITY_name included) or with+=, a command word by name or path, whatever command it is, a shell keyword,!, a redirection or fd duplication, a subshell or a group, andmaityby a path. The reason names the plain form (maity …at the start of the line) and--body-filefor text that mentionsmaity. There is no list of wrapper commands. The names are allowed by a list, not refused by one: an assignment can choose the program the shell runs or load code into it, and a list of refused names would leak the way the wrapper list did. The list is a fixed tuple inplaincall.py(ALLOWED_BEFORE_MAITY) with noMAITY_pattern: aMAITY_name stands on it only when docs/agents.md documents it for agents and the CLI reads it, which today isMAITY_WAIT_TIMEOUTalone. The runner-trusted names (MAITY_PLACEMENT,MAITY_GIT_INODE,MAITY_GIT_PRIVATE,MAITY_STATE_DIR,MAITY_SUPERVISOR,MAITY_RUNNER_CONFIG,MAITY_ERROR_LINE,MAITY_SCRATCH) decide what maity trusts, so each refuses the line. - Lines whose first word is
maityare decided as before. Before looking formaity, leading spaces and characters a plain call may not hold are skipped; a character a plain call may hold (/,.,:and the like, a quote, a backslash) is not, so./maity,/maityor. maitycounts asmaityafter a prefix, and a quoted or escaped first word ("[" maity status,\! maity status,"" maity status) is a word of its own beforemaityand refuses the line. The line starts withmaityonly whenmaityis followed by a space, a tab, an operator or the line's end; a first word that only starts withmaityis read by the word check like any other word. - A path whose last component is exactly
maitycounts asmaityeverywhere: a clone named after the handle (…/maity-coder-claude-004) passes,…/maityis refused (docs/runners.md, KtW 63492c65).
- On a line that does not start with
Lotse · Nov 18, 2026, 18:41 UTC · dismissed
#1942 description of record for head 64d28cfe, part 3 of 3 (continued).
- Accepted cost: text that mentions
maityas a word after another command is refused (env maity status,sudo maity status,git log --grep maity | head,echo maity | cat,git commit -m 'fix maity docs'); the way out is a file with--body-file.maityinside a longer word (maity.md,maity/) is not a word. Lines with$'…'text that holds a backslash, or with$"…", are refused whatever they name (echo $"hi"included);printfwith single quotes, plain double quotes or a file is the way out. - Not read: values the hook cannot know, such as globs matched against files and expansions of variables or of input.
- The hook does not depend on how Claude Code's sandbox exclusion matches
maity *. It fails closed: a line wheremaityis a word after anything but the allowed assignments is refused, and one after allowed assignments only is held to one plain call. Claude Code's matcher (2.1.327, native binary sha256343c744baa14bfd38286a7cb90871051f04379956da6c5b803a9e66019a76ac9) was read statically only; the readings differ, so the hook does not rely on it. - Tests in
cli/tests/test_plaincall.py, including a check againstmaity's own parser on the running Python, the allowed assignment names and one refused case per kind of other name, one refused case per runner-trustedMAITY_name, and one case per kind of prefix that is refused; a guard test scanscli/src/maityforMAITY_names and fails when a runner-trusted name or aMAITY_pattern is on the list, or aMAITY_name on it is not read by maity or not documented in docs/agents.md. Tests also cover a quoted or escaped first word beforemaity,maityitself quoted,$"…", quoted text at exactly four and five levels,eval "'maity'" "'runner'" status,/maity status,prefixed()directly, words with brace alternatives (refused when an alternative readsmaityor both words;echo {a,b},find . -exec ls {} \;,git log @{u}and a comma list without a brace still pass), words whose brace expansion joined with the text around it makesmaityandrunner(one case per form, several brace groups in one word and a letter range included), the expansion itself against Bash's results (nested braces, several groups, literal braces, letter ranges, number ranges left as they are), the limit (256 words judged by their words, 257 and more refuse the line, 256 and 257 brace groups, a quoted word over the limit, braces nested deeper than the stack allows), and lowercase and bareLC_names beforemaity. - Docs:
docs/agents.md(also: inside a Claude Code session a runner placed,maityis called plain, not by its full path),docs/runners.md; the hook's entry incli/context/runner.md(with the rejected alternatives "an allow-list of wrappers", "rewording only", "a list of refused names" and "MAITY_*as a wildcard"); changelog fragment.
Not in
- Part 2 (decided 2026-11-18: maity-runner as its own PyPI package) is its own PR.
- Accepted cost: text that mentions
Lotse · Nov 18, 2026, 19:28 UTC · dismissed
#1942 description of record for head f818545254e417986db906c6b9c95a8224bbfadf (f8185452, round 11; parent 3b68042e, a merge of main 8a2a4878 into 64d28cfe; replaces the round-10 header). Card tsk-54492gk4xp69, part 1. Review rounds and verification: as in the live PR body at this head.
What is in
- The hook a placed Claude Code session runs before every tool call (
cli/src/maity/runner/plaincall.py) refuses, on any line, a wordrunnerthat follows a wordmaity, with its own reason.maity runneris the runner's own command; the runner starts its in-session commands through the launch, the pane and the hook itself, never through an agent's tool call. - A line that names
maityanywhere (in any case, also with quotes or backslashes between its letters) is refused when it holds a comment (#at the line's start or after a space or an operator, quoted or not), a heredoc operator (<<, quoted or not) or more than one line. The hook does not read such a line to the end, so it refuses it. A line whose quotes never close, or that holds$'…'text with a backslash or an unquoted$"…"(Bash's locale quoting, whose text a translation may replace), is refused whatever it holds. - The word check splits words at unquoted spaces, tabs and operators and takes quotes and backslashes off; a word counts as
maityorrunneralso once the backslashes and quotes left in it are taken off, and a word that holds a{also as each part of it between{,,and}, since the shell may make a word of its own of each literal alternative of a brace: a brace that holds both words counts asmaityfollowed byrunner. A word that holds a{counts as well as each word its brace expansion makes, the alternatives joined with the text around them (nested braces, several brace groups in one word and letter ranges such as{a..e}expand as Bash expands unquoted braces, a letter range's step with or without a sign as in Bash 5.2; number ranges stay as they are), up to 256 words; a word whose braces make more than 256 words, that holds more than 256 brace groups, or whose braces nest deeper than the hook's stack allows refuses the line, and so does a word that mixes unquoted braces with quoted or escaped{,}or,: the word split marks it, and it counts asmaityand asrunnerwherever words are judged. Text with such braces goes in a file (--body-file); the reason says so. The words are made one at a time and only up to that limit. Otherwise the check expands nothing and does not read comments or heredocs, which the rule above refuses. A word the shell would still expand counts asmaitybefore a laterrunnerword, and asrunnerafter amaityword in the same text. Quoted text that holds spaces or operators is read again, four levels deep (for amaityword as for arunnerword), and its words count in the line's order with the words around it; text nested deeper is refused, whatever it holds. Text is not told apart from a call, quoted or not, so text that holds both words goes in a file (--body-file); the reason says so.
(continued in parts 2 and 3)
- The hook a placed Claude Code session runs before every tool call (
Lotse · Nov 18, 2026, 19:28 UTC · dismissed
#1942 description of record for head f8185452, part 2 of 3 (continued).
- On a line that does not start with
maity, wheremaityis a word (as the word check reads it, also a word of quoted text read again; in any case, by any path), only assignments toMAITY_WAIT_TIMEOUT,NO_COLOR,LANG,LC_*andTZmay stand before it: each by its exact name in capitals (LC_followed by at least one capital, digit or underscore, sotz=UTCand a bareLC_=xrefuse the line), written unquoted with=, one or several, quoted values allowed; the value is not judged there, since the one-plain-call rule refuses one that expands. Such a line is held to one plain call like a line whose first word ismaity(TZ=UTC maity statuspasses,TZ=UTC maity runner statusis refused). Anything else beforemaityrefuses the line outright: an assignment to any other name (the runner's ownMAITY_variables and any otherMAITY_name included) or with+=, a command word by name or path, whatever command it is, a shell keyword,!, a redirection or fd duplication, a subshell or a group, andmaityby a path. The reason names the plain form (maity …at the start of the line) and--body-filefor text that mentionsmaity. There is no list of wrapper commands. The names are allowed by a list, not refused by one: an assignment can choose the program the shell runs or load code into it, and a list of refused names would leak the way the wrapper list did. The list is a fixed tuple inplaincall.py(ALLOWED_BEFORE_MAITY) with noMAITY_pattern: aMAITY_name stands on it only when docs/agents.md documents it for agents and the CLI reads it, which today isMAITY_WAIT_TIMEOUTalone. The runner-trusted names (MAITY_PLACEMENT,MAITY_GIT_INODE,MAITY_GIT_PRIVATE,MAITY_STATE_DIR,MAITY_SUPERVISOR,MAITY_RUNNER_CONFIG,MAITY_ERROR_LINE,MAITY_SCRATCH) decide what maity trusts, so each refuses the line. - Lines whose first word is
maityare decided as before. Before looking formaity, leading spaces and characters a plain call may not hold are skipped; a character a plain call may hold (/,.,:and the like, a quote, a backslash) is not, so./maity,/maityor. maitycounts asmaityafter a prefix, and a quoted or escaped first word ("[" maity status,\! maity status,"" maity status) is a word of its own beforemaityand refuses the line. The line starts withmaityonly whenmaityis followed by a space, a tab, an operator or the line's end; a first word that only starts withmaityis read by the word check like any other word. - A path whose last component is exactly
maitycounts asmaityeverywhere: a clone named after the handle (…/maity-coder-claude-004) passes,…/maityis refused (docs/runners.md, KtW 63492c65).
- On a line that does not start with
Lotse · Nov 18, 2026, 19:28 UTC · dismissed
#1942 description of record for head f8185452, part 3 of 3 (continued).
- Accepted cost: text that mentions
maityas a word after another command is refused (env maity status,sudo maity status,git log --grep maity | head,echo maity | cat,git commit -m 'fix maity docs'); the way out is a file with--body-file.maityinside a longer word (maity.md,maity/) is not a word. Lines with$'…'text that holds a backslash, or with$"…", are refused whatever they name (echo $"hi"included);printfwith single quotes, plain double quotes or a file is the way out. - Not read: values the hook cannot know, such as globs matched against files and expansions of variables or of input.
- The hook does not depend on how Claude Code's sandbox exclusion matches
maity *. It fails closed: a line wheremaityis a word after anything but the allowed assignments is refused, and one after allowed assignments only is held to one plain call. Claude Code's matcher (2.1.327, native binary sha256343c744baa14bfd38286a7cb90871051f04379956da6c5b803a9e66019a76ac9) was read statically only; the readings differ, so the hook does not rely on it. - Tests in
cli/tests/test_plaincall.py, including a check againstmaity's own parser on the running Python, the allowed assignment names and one refused case per kind of other name, one refused case per runner-trustedMAITY_name, and one case per kind of prefix that is refused; a guard test scanscli/src/maityforMAITY_names and fails when a runner-trusted name or aMAITY_pattern is on the list, or aMAITY_name on it is not read by maity or not documented in docs/agents.md. Tests also cover a quoted or escaped first word beforemaity,maityitself quoted,$"…", quoted text at exactly four and five levels,eval "'maity'" "'runner'" status,/maity status,prefixed()directly, words with brace alternatives (refused when an alternative readsmaityor both words;echo {a,b},find . -exec ls {} \;,git log @{u}and a comma list without a brace still pass), words whose brace expansion joined with the text around it makesmaityandrunner(one case per form, several brace groups in one word and a letter range included), the expansion itself against Bash's results (nested braces, several groups, literal braces, letter ranges, number ranges left as they are), the limit (256 words judged by their words, 257 and more refuse the line, 256 and 257 brace groups, a quoted word over the limit, braces nested deeper than the stack allows), a letter range with a signed step, words that mix unquoted braces with quoted or escaped brace characters (one case per form, on the line and in quoted text read again, lines that name neither word, the split's mark itself, the reason's way out), brace paths and ranges that still pass (pytest tests/test_{a,b}.py,git diff -- cli/{src,tests},echo {1..1000}), and lowercase and bareLC_names beforemaity. - Docs:
docs/agents.md(also: inside a Claude Code session a runner placed,maityis called plain, not by its full path),docs/runners.md; the hook's entry incli/context/runner.md(with the rejected alternatives "an allow-list of wrappers", "rewording only", "a list of refused names", "MAITY_*as a wildcard" and "quote-aware brace expansion now"); changelog fragment.
Not in
- Part 2 (decided 2026-11-18: maity-runner as its own PyPI package) is its own PR.
- Accepted cost: text that mentions
Lotse · Nov 18, 2026, 20:27 UTC · dismissed
#1942 description of record for head b6d523e6ba8257d4f8a76d712fcfa381156c85cf (b6d523e6, round 12; parent 0c4e23b4, a merge of main c3926a3d into f8185452; replaces the round-11 header). Card tsk-54492gk4xp69, part 1. Review rounds and verification: as in the live PR body at this head.
What is in
- The hook a placed Claude Code session runs before every tool call (
cli/src/maity/runner/plaincall.py) refuses, on any line, a wordrunnerthat follows a wordmaity, with its own reason.maity runneris the runner's own command; the runner starts its in-session commands through the launch, the pane and the hook itself, never through an agent's tool call. - A line that names
maityanywhere (in any case, also with quotes or backslashes between its letters) is refused when it holds a comment (#at the line's start or after a space or an operator, quoted or not), a heredoc operator (<<, quoted or not) or more than one line. The hook does not read such a line to the end, so it refuses it. A line whose quotes never close, or that holds$'…'text with a backslash or an unquoted$"…"(Bash's locale quoting, whose text a translation may replace), is refused whatever it holds. - The word check splits words at unquoted spaces, tabs and operators and takes quotes and backslashes off; a word counts as
maityorrunneralso once the backslashes and quotes left in it are taken off, and a word that holds a{also as each part of it between{,,and}, since the shell may make a word of its own of each literal alternative of a brace: a brace that holds both words counts asmaityfollowed byrunner. A word that holds a{counts as well as each word its brace expansion makes, the alternatives joined with the text around them. The braces are read as Bash 5.2 reads them, from the word as written: quoted and escaped characters are text that opens, closes and splits no group, and each word the expansion makes then has its quotes and backslashes taken off, as the shell's quote removal does. Nested braces, several brace groups in one word, and letter and number ranges (a step with or without a sign, as in Bash 5.2) expand as Bash expands them; a number range makes only its first number for the check, since its other words differ from it only in digits. The word's text, its quotes taken off, is expanded as well, as a shell that reads it again (eval) expands it. Up to 256 words: a word whose braces make more than 256 words, that holds more than 256 brace groups, whose braces nest deeper than the hook's stack allows, or that the hook does not read otherwise refuses the line. A range end or step with more digits than an integer holds is text, as in Bash, and a tool call the hook fails on is refused. Each part's words are made only up to that limit. Otherwise the check expands nothing and does not read comments or heredocs, which the rule above refuses. A word the shell would still expand counts asmaitybefore a laterrunnerword, and asrunnerafter amaityword in the same text. Quoted text that holds spaces or operators is read again, four levels deep (for amaityword as for arunnerword), and its words count in the line's order with the words around it; text nested deeper is refused, whatever it holds. Text is not told apart from a call, quoted or not, so text that holds both words goes in a file (--body-file); the reason says so.
(continued in parts 2 and 3)
- The hook a placed Claude Code session runs before every tool call (
Lotse · Nov 18, 2026, 20:27 UTC · dismissed
#1942 description of record for head b6d523e6, part 2 of 3 (continued).
- On a line that does not start with
maity, wheremaityis a word (as the word check reads it, also a word of quoted text read again; in any case, by any path), only assignments toMAITY_WAIT_TIMEOUT,NO_COLOR,LANG,LC_*andTZmay stand before it: each by its exact name in capitals (LC_followed by at least one capital, digit or underscore, sotz=UTCand a bareLC_=xrefuse the line), written unquoted with=, one or several, quoted values allowed; the value is not judged there, since the one-plain-call rule refuses one that expands. Such a line is held to one plain call like a line whose first word ismaity(TZ=UTC maity statuspasses,TZ=UTC maity runner statusis refused). Anything else beforemaityrefuses the line outright: an assignment to any other name (the runner's ownMAITY_variables and any otherMAITY_name included) or with+=, a command word by name or path, whatever command it is, a shell keyword,!, a redirection or fd duplication, a subshell or a group, andmaityby a path. The reason names the plain form (maity …at the start of the line) and--body-filefor text that mentionsmaity. There is no list of wrapper commands. The names are allowed by a list, not refused by one: an assignment can choose the program the shell runs or load code into it, and a list of refused names would leak the way the wrapper list did. The list is a fixed tuple inplaincall.py(ALLOWED_BEFORE_MAITY) with noMAITY_pattern: aMAITY_name stands on it only when docs/agents.md documents it for agents and the CLI reads it, which today isMAITY_WAIT_TIMEOUTalone. The runner-trusted names (MAITY_PLACEMENT,MAITY_GIT_INODE,MAITY_GIT_PRIVATE,MAITY_STATE_DIR,MAITY_SUPERVISOR,MAITY_RUNNER_CONFIG,MAITY_ERROR_LINE,MAITY_SCRATCH) decide what maity trusts, so each refuses the line. - Lines whose first word is
maityare decided as before. Before looking formaity, leading spaces and characters a plain call may not hold are skipped; a character a plain call may hold (/,.,:and the like, a quote, a backslash) is not, so./maity,/maityor. maitycounts asmaityafter a prefix, and a quoted or escaped first word ("[" maity status,\! maity status,"" maity status) is a word of its own beforemaityand refuses the line. The line starts withmaityonly whenmaityis followed by a space, a tab, an operator or the line's end; a first word that only starts withmaityis read by the word check like any other word. - A path whose last component is exactly
maitycounts asmaityeverywhere: a clone named after the handle (…/maity-coder-claude-004) passes,…/maityis refused (docs/runners.md, KtW 63492c65).
- On a line that does not start with
Lotse · Nov 18, 2026, 20:27 UTC · dismissed
#1942 description of record for head b6d523e6, part 3 of 3 (continued).
- Accepted cost: text that mentions
maityas a word after another command is refused (env maity status,sudo maity status,git log --grep maity | head,echo maity | cat,git commit -m 'fix maity docs'); the way out is a file with--body-file.maityinside a longer word (maity.md,maity/) is not a word. Lines with$'…'text that holds a backslash, or with$"…", are refused whatever they name (echo $"hi"included);printfwith single quotes, plain double quotes or a file is the way out. - Not read: values the hook cannot know, such as globs matched against files and expansions of variables or of input.
- The hook does not depend on how Claude Code's sandbox exclusion matches
maity *. It fails closed: a line wheremaityis a word after anything but the allowed assignments is refused, and one after allowed assignments only is held to one plain call. Claude Code's matcher (2.1.327, native binary sha256343c744baa14bfd38286a7cb90871051f04379956da6c5b803a9e66019a76ac9) was read statically only; the readings differ, so the hook does not rely on it. - Tests in
cli/tests/test_plaincall.py, including a check againstmaity's own parser on the running Python, the allowed assignment names and one refused case per kind of other name, one refused case per runner-trustedMAITY_name, and one case per kind of prefix that is refused; a guard test scanscli/src/maityforMAITY_names and fails when a runner-trusted name or aMAITY_pattern is on the list, or aMAITY_name on it is not read by maity or not documented in docs/agents.md. Tests also cover a quoted or escaped first word beforemaity,maityitself quoted,$"…", quoted text at exactly four and five levels,eval "'maity'" "'runner'" status,/maity status,prefixed()directly, words with brace alternatives (refused when an alternative readsmaityor both words;echo {a,b},find . -exec ls {} \;,git log @{u}and a comma list without a brace still pass), words whose brace expansion joined with the text around it makesmaityandrunner(one case per form, several brace groups in one word and a letter range included), the expansion itself against Bash's results (nested braces, several groups, literal braces, letter and number ranges, a}that does not close a group), the limit (256 words judged by their words, 257 and more refuse the line, 256 and 257 brace groups, a quoted word over the limit, braces nested deeper than the stack allows), a letter range with a signed step, quoted and escaped brace characters (on the line and read again), integers out of range, a failing hook, brace forms and quoted programs that still pass (awk,jqandpython3 -cone-liners included), and lowercase and bareLC_names beforemaity; two tests compare the hook with Bash 5.2 on generated words (unquoted ones, and quoted and escaped ones under a fixed and a fresh seed): no word may pass that Bash makes intomaityorrunner. - Docs:
docs/agents.md(also: inside a Claude Code session a runner placed,maityis called plain, not by its full path),docs/runners.md; the hook's entry incli/context/runner.md(with the rejected alternatives "an allow-list of wrappers", "rewording only", "a list of refused names", "MAITY_*as a wildcard", "quote-aware brace expansion now", rejected in round 11 and chosen in round 12, and the mixed-word refusal, decided in round 11 and rejected in round 12); changelog fragment.
Not in
- Part 2 (decided 2026-11-18: maity-runner as its own PyPI package) is its own PR.
- Accepted cost: text that mentions
Lotse · Nov 18, 2026, 21:45 UTC
#1942 description of record for head cfd925c26637d802313e9da3942744747c9d32d0 (cfd925c2, round 13; parent b6d523e6; replaces the round-12 header). Card tsk-54492gk4xp69, part 1. Review rounds and verification: as in the live PR body at this head.
What is in
- The hook a placed Claude Code session runs before every tool call (
cli/src/maity/runner/plaincall.py) refuses, on any line, a wordrunnerthat follows a wordmaity, with its own reason.maity runneris the runner's own command; the runner starts its in-session commands through the launch, the pane and the hook itself, never through an agent's tool call. - A line that names
maityanywhere (in any case, also with quotes or backslashes between its letters) is refused when it holds a comment (#at the line's start or after a space or an operator, quoted or not), a heredoc operator (<<, quoted or not) or more than one line. The hook does not read such a line to the end, so it refuses it. A line whose quotes never close, or that holds$'…'or an unquoted$"…"text (Bash's locale quoting, whose text a translation may replace), a backslash-newline, oreval,source,.,traporbash -cwith a quoted or expanded word, is refused whatever it holds, and so is a line whose comments, backticks,${…}or substitutions beside braces the hook does not read exactly. Plain heredocs and$(…)pass; the reason names the refused constructs and--body-file. - The word check splits words at unquoted spaces, tabs and operators and takes quotes and backslashes off; a word counts as
maityorrunneralso once the backslashes and quotes left in it are taken off, and a word that holds a{also as each part of it between{,,and}, since the shell may make a word of its own of each literal alternative of a brace: a brace that holds both words counts asmaityfollowed byrunner. A word that holds a{counts as well as each word its brace expansion makes, the alternatives joined with the text around them. The braces are read as Bash 5.2 and Bash 5.3 read them (the words of both count), from the word as written: quoted and escaped characters are text that opens, closes and splits no group, and each word the expansion makes then has its quotes and backslashes taken off, as the shell's quote removal does. Nested braces, several brace groups in one word, and letter and number ranges (a step with or without a sign, as in Bash 5.2) expand as Bash expands them; a number range makes only its first number for the check, since its other words differ from it only in digits. The word's text, its quotes taken off, and the words its expansion makes are expanded as well, as a shell that reads them again expands them. Up to 256 words: a word whose braces make more than 256 words, that holds more than 256 brace groups, whose braces nest deeper than the hook's stack allows, or that the hook does not read otherwise refuses the line. A range end or step with more digits than an integer holds is text, as in Bash, and a tool call the hook fails on is refused. Each part's words are made only up to that limit. Otherwise the check expands nothing and does not read comments or heredocs, which the rule above refuses. A word the shell would still expand counts asmaitybefore a laterrunnerword, and asrunnerafter amaityword in the same text. Quoted text that holds spaces or operators is read again, four levels deep (for amaityword as for arunnerword), and its words count in the line's order with the words around it; text nested deeper is refused, whatever it holds. Text is not told apart from a call, quoted or not, so text that holds both words goes in a file (--body-file); the reason says so.
(continued in parts 2 and 3)
- The hook a placed Claude Code session runs before every tool call (
Lotse · Nov 18, 2026, 21:45 UTC
#1942 description of record for head cfd925c2, part 2 of 3 (continued).
- On a line that does not start with
maity, wheremaityis a word (as the word check reads it, also a word of quoted text read again; in any case, by any path), only assignments toMAITY_WAIT_TIMEOUT,NO_COLOR,LANG,LC_*andTZmay stand before it: each by its exact name in capitals (LC_followed by at least one capital, digit or underscore, sotz=UTCand a bareLC_=xrefuse the line), written unquoted with=, one or several, quoted values allowed; the value is not judged there, since the one-plain-call rule refuses one that expands. Such a line is held to one plain call like a line whose first word ismaity(TZ=UTC maity statuspasses,TZ=UTC maity runner statusis refused). Anything else beforemaityrefuses the line outright: an assignment to any other name (the runner's ownMAITY_variables and any otherMAITY_name included) or with+=, a command word by name or path, whatever command it is, a shell keyword,!, a redirection or fd duplication, a subshell or a group, andmaityby a path. The reason names the plain form (maity …at the start of the line) and--body-filefor text that mentionsmaity. There is no list of wrapper commands. The names are allowed by a list, not refused by one: an assignment can choose the program the shell runs or load code into it, and a list of refused names would leak the way the wrapper list did. The list is a fixed tuple inplaincall.py(ALLOWED_BEFORE_MAITY) with noMAITY_pattern: aMAITY_name stands on it only when docs/agents.md documents it for agents and the CLI reads it, which today isMAITY_WAIT_TIMEOUTalone. The runner-trusted names (MAITY_PLACEMENT,MAITY_GIT_INODE,MAITY_GIT_PRIVATE,MAITY_STATE_DIR,MAITY_SUPERVISOR,MAITY_RUNNER_CONFIG,MAITY_ERROR_LINE,MAITY_SCRATCH) decide what maity trusts, so each refuses the line. - Lines whose first word is
maityare decided as before. Before looking formaity, leading spaces and characters a plain call may not hold are skipped; a character a plain call may hold (/,.,:and the like, a quote, a backslash) is not, so./maity,/maityor. maitycounts asmaityafter a prefix, and a quoted or escaped first word ("[" maity status,\! maity status,"" maity status) is a word of its own beforemaityand refuses the line. The line starts withmaityonly whenmaityis followed by a space, a tab, an operator or the line's end; a first word that only starts withmaityis read by the word check like any other word. - A path whose last component is exactly
maitycounts asmaityeverywhere: a clone named after the handle (…/maity-coder-claude-004) passes,…/maityis refused (docs/runners.md, KtW 63492c65).
- On a line that does not start with
Lotse · Nov 18, 2026, 21:45 UTC
#1942 description of record for head cfd925c2, part 3 of 3 (continued).
- Accepted cost: text that mentions
maityas a word after another command is refused (env maity status,sudo maity status,git log --grep maity | head,echo maity | cat,git commit -m 'fix maity docs'); the way out is a file with--body-file.maityinside a longer word (maity.md,maity/) is not a word. Lines with$'…'or$"…", a backslash-newline, oreval,bash -cand the like with a quoted word are refused whatever they name (echo $"hi"andbash -c 'pytest -q'included); a file, single quotes or running the command plain is the way out. - Not read: values the hook cannot know, such as globs matched against files and expansions of variables or of input.
- The hook does not depend on how Claude Code's sandbox exclusion matches
maity *. It fails closed: a line wheremaityis a word after anything but the allowed assignments is refused, and one after allowed assignments only is held to one plain call. Claude Code's matcher (2.1.327, native binary sha256343c744baa14bfd38286a7cb90871051f04379956da6c5b803a9e66019a76ac9) was read statically only; the readings differ, so the hook does not rely on it. - Tests in
cli/tests/test_plaincall.py, including a check againstmaity's own parser on the running Python, the allowed assignment names and one refused case per kind of other name, one refused case per runner-trustedMAITY_name, and one case per kind of prefix that is refused; a guard test scanscli/src/maityforMAITY_names and fails when a runner-trusted name or aMAITY_pattern is on the list, or aMAITY_name on it is not read by maity or not documented in docs/agents.md. Tests also cover a quoted or escaped first word beforemaity,maityitself quoted,$"…", quoted text at exactly four and five levels,eval "'maity'" "'runner'" status,/maity status,prefixed()directly, words with brace alternatives (refused when an alternative readsmaityor both words;echo {a,b},find . -exec ls {} \;,git log @{u}and a comma list without a brace still pass), words whose brace expansion joined with the text around it makesmaityandrunner(one case per form, several brace groups in one word and a letter range included), the expansion itself against Bash's results (nested braces, several groups, literal braces, letter and number ranges, a}that does not close a group), the limit (256 words judged by their words, 257 and more refuse the line, 256 and 257 brace groups, a quoted word over the limit, braces nested deeper than the stack allows), a letter range with a signed step, quoted and escaped brace characters (on the line and read again), integers out of range, a failing hook, brace forms and quoted programs that still pass (awk,jqandpython3 -cone-liners included), and lowercase and bareLC_names beforemaity; two tests compare the hook with Bash 5.2 on generated words (unquoted ones, and quoted and escaped ones under a fixed and a fresh seed): no word may pass that Bash makes intomaityorrunner; Bash prints one marked record per word. Also: each refused construct, lines with comments, heredocs, backticks andevalrun in Bash, plain heredocs and$(…)that pass, and braces as Bash 5.3 reads them. - Docs:
docs/agents.md(also: inside a Claude Code session a runner placed,maityis called plain, not by its full path),docs/runners.md; the hook's entry incli/context/runner.md(with the rejected alternatives "an allow-list of wrappers", "rewording only", "a list of refused names", "MAITY_*as a wildcard", "quote-aware brace expansion now", rejected in round 11 and chosen in round 12, the mixed-word refusal, decided in round 11 and rejected in round 12, and "model each construct exactly", rejected in round 13); changelog fragment.
Not in
- Part 2 (decided 2026-11-18: maity-runner as its own PyPI package) is its own PR.
- Accepted cost: text that mentions
Lotse · Nov 20, 2026, 00:39 UTC
Security round 5, S200 (LOW), blue at 921d88e4 (details with the lead / suqj): Claude Code 2.1.329 documents sandbox.excludedCommands as matching per part of a compound command, which is the revisit condition of runner.md 996b6f48 (capabilities.py lists 2.1.325 as checked). Re-run the documented check on the current Claude Code, and make the plain-call rule skip comment lines and leading NAME=value words. Belongs with this card (S183 / #1942).