ECC's selection, candidates, fallback and receipt stay unchanged. Installed non-ECC skills that also match the task are listed as companions in the resolver result, the ecc profile run launch input and the opt-in suggestion hook, so the host can use ECC's skill and the user's own together. A companion clears the automatic-load score bar and either has a matched word in its name or leads every other neighbor by the existing auto-admission margin. No constant changes.
ecc profile neighbors snapshots the provider home's other skills, including the project's own .claude/skills for Claude, and --neighbors or ECC_CONTEXT_NEIGHBORS passes the snapshot in.
DESTRUCTIVE_SQL matched only DROP TABLE, DELETE FROM and TRUNCATE.
`psql -c "DROP DATABASE prod"`, `DROP SCHEMA public CASCADE` and
`ALTER TABLE users DROP COLUMN email` went to the routine gate instead
of the destructive gate, even though each loses at least as much data
as DROP TABLE.
Add DROP DATABASE, DROP SCHEMA and an ALTER TABLE ... DROP COLUMN arm
to the phrase check. The DROP COLUMN arm stops at `;` so it never
matches across two statements. It requires the COLUMN keyword so
ALTER COLUMN ... DROP DEFAULT / DROP NOT NULL stay passive. Existing
literal and quote stripping keeps SQL strings, commit messages and
echo mentions passive.
Update the gateguard trigger list (en, ja-JP, zh-CN) and rebind the
skill-triggers registry digest for the SKILL.md body edit. Skill
descriptions and triggers are unchanged.
The JWT chain scanner only accepted a header at the start of a segment or
after `-`, so `session_<JWT>` reached the audit and cost logs unredacted.
Treat `_` as a prefix boundary too and cover it in the tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In double quotes Bash drops a backslash-newline before it expands
anything, so a tail of `$\<newline>HOME` after the substitution's `)` is
`$HOME` and expands. The expansion check read the tail with the
continuation still in it and saw an escaped newline, so the hook
validated `fix: a$HOME` with no warning. Continuations are now dropped
first, while other escapes stay for the check: `\$\<newline>HOME` is
still the literal `$HOME`.
In `-m "$(cat <<'EOF' … EOF\n)."` Bash drops the body's trailing newlines
and adds the period, so Git records `fix: update input.`, but the hook
checked only the here-document and missed the trailing-period warning.
Read the rest of the quoted value after the substitution's `)` and add
it to the message as double-quoted text. Commands or an expansion after
the here-document make the message unverifiable, as an expansion in an
unquoted body already does. The here-document reading moves into
readHeredocMessage, which also returns the Bash 3.2 note.
Since expanded here-document segments are queued too, a long substitution puts every segment in the queue, and shift() copied it each time: 130,000 segments took about 20 s, past the hook timeout. An index keeps the walk linear (under 0.3 s).
Bash ends a decoded $'...' string at its first NUL, so `cat <<$'EOF\0X'`
ends at the line EOF, but the splitter looked for EOF\0X and swallowed
the commands after the body. A carriage return or a no-break space is
not a blank to Bash, so `echo foo\r# && npm run dev` runs the dev
server, but the splitter read the # as a comment. And spreading a long
substitution's segments into push() threw RangeError, which the hook's
catch turned into an allow. Truncate the decoded part at the NUL, use
Bash's blanks for word starts, and append the segments one at a time.
printf decoded escapes in %s arguments too, so `printf '%s' 'gi\t push
--no-verify' | sh` read as `gi<tab> push` and passed, while the shell
reads `gi\t` as `git`. Escapes are now decoded in the format and in %b
arguments only. `1<&3` and the move `1>&3-` copy a descriptor like
`1>&3`, so restoring a saved stdout is followed. The format-reuse loop
charges the work budget before each piece, so a short command cannot
expand into a huge string. The bash-backed tests now run what the shell
reads with a stub git, which also sees how the shell unescapes words.
A group or pipeline producer counted whatever its redirections said, so
`{ echo 'git push --no-verify' >/dev/null | cat; } | bash` was blocked
although bash reads nothing, and printf filled no %s, so
`printf 'git %s --no-verify\n' push | sh` got through. shell-scan now
keeps a redirection's descriptor, and a stage's output counts only when
its descriptors, the stages after it and an `exec` earlier in its group
take it to the shell; an `exec` is carried only where it adds output.
printf fills %s, %b and %c and reuses its format; other conversions are
read like an unmodeled command. The header states what the model covers.
The tracker serialized any structured result with JSON.stringify before
redaction, so an encoding nested in it, such as a double-escaped JSON
token, reached tool-usage.jsonl whole, and Claude Code's Bash stdout went
in as text. Keep text only from the adapter's tool_output, as main did,
and from Claude Code's tool_response only the sizes of stdout and stderr
and its interrupted and image flags. Any other structure is left out.
The safety-classifier notice filter only covered the mechanical summary.
When generateSessionSummary runs (low context or message interval),
extractConversationText read the raw transcript and passed the notice to
the LLM as a user turn, so it could still reach saved context.
Move the check into one shared isClassifierNotice() in
scripts/lib/llm-summary.js and use it in both userMessageText() and
extractConversationText(). Add LLM-path regression tests, and split the
session-end classifier-notice tests into small functions (<50 lines).
Refs #3867
Assisted-by: Claude <noreply@anthropic.com>
The dev-guard half of 7632669d from #3735: segments that the splitter
reads from an expanded here-document body are scanned again, so a dev
command in a substitution nested inside one is still found.
(split from commit 7632669d28)
In an unquoted here-document, Bash removes a backslash-newline before Git
receives the message, so `fix: \` followed by `Update input.` commits
`fix: Update input.`, and a delimiter line right after a continued line
does not end the body. Read the body that way, keep `<<-` from stripping
the tabs of a continued line, and drop the backslash before $, ` and \.
A quoted body stays literal, as Bash 4 and later and zsh read it. Inside
"$(...)", Bash 3.2 joins its lines too, so the hook now notes when that
would change the subject.
The commit-quality half of 7632669d from #3735: a single-quoted -m
message keeps its backslashes, and an unquoted here-document whose body
Bash would expand yields an advisory that the subject cannot be validated
from the literal command.
(split from commit 7632669d28)
The lookbehind added to keep the JWT scan linear also skipped tokens right
after a `-`, so `--cookie "session=jwt-<JWT>"` reached the logs unredacted.
Scan each `[A-Za-z0-9_.-]` run once instead, checking every dot segment for
a header at its start or after a `-`, decoding at most once per segment so
long `ey-ey-...` runs stay linear.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move ECC_SHOW_RECOVERY_HINTS parsing into scripts/lib/hooks/recovery-hints.js so every hook trims and accepts the same truthy values. Add default-off and opt-in assertions for the condensed GateGuard denial, config-protection (protected and truncated payloads) and the fail-closed truncation wrapper.
Co-Authored-By: TRAE <noreply@trae.ai>
When a response is stopped by the safety classifier, the harness records
a notice ("Your response above was stopped by a safety classifier ...")
as a user entry in the transcript. session-end.js kept it as a user
message, so it was written under "### Tasks" and re-injected by
session-start.js on the next session.
userMessageText() now drops entries that start with that notice, next
to the existing HARNESS_NOISE filter. User messages that only mention
the phrase are kept, since the match is anchored to the start.
Fixes#3867
Assisted-by: Claude <noreply@anthropic.com>
- Replace the secret=/api_key= value regex with a single-pass, quote-aware
scanner so the whole Bash word is redacted when quoted and unquoted
fragments are joined (e.g. --secret='prefix-'suffix), while a value inside
an enclosing quoted string stops at that string's closing quote.
- Searching for the keyword itself (grep -n "secret =" file,
rg 'api_key:' dir) no longer redacts the rest of the command.
- Use a lookbehind instead of \b before the JWT header so long dot-free
ey-ey-... runs are scanned in linear time instead of quadratic.
- Add regression tests for joined fragments, keyword searches, and the
ey- performance case.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Denial reasons are tool output the guarded agent reads. Naming ECC_GATEGUARD=off, ECC_DISABLED_HOOKS and the exemption globs there handed the agent its own bypass. Hint text is now opt-in via ECC_SHOW_RECOVERY_HINTS, and the default denials keep only the factual requirement.
Co-Authored-By: TRAE <noreply@trae.ai>
The settings exemption skipped the first-touch gate for the files that hold ECC's own off-switches. Settings files now go through the normal gate, including the MultiEdit subagent path.
Co-Authored-By: TRAE <noreply@trae.ai>