Skip to content

Add edits_self_config trait: agent writes to its own settings/hooks (#317) - #505

Merged
blitzcrieg1 merged 4 commits into
blitzcrieg1:masterfrom
rumangsanya:feat/self-config-trait-317
Nov 27, 2026
Merged

blitzcrieg1 merged 4 commits into
blitzcrieg1:masterfrom
rumangsanya:feat/self-config-trait-317

Conversation

@rumangsanya

Copy link
Copy Markdown
Contributor

First slice of #317 under the bounty program (#454), claimed on the issue — one trait per PR, starting with edits_self_config. The other four signals stay for follow-up PRs.

What lands

  • Trait edits_self_config (registered in KNOWN_TRAITS), earned by a write to the agent's own configuration: ~/.claude/settings.json / settings.local.json, ~/.claude.json, files under ~/.claude/hooks/, ~/.cursor/hooks.json, ~/.codex/hooks.json, ~/.codex/config.toml. Project-local .claude/settings.json counts — Claude Code reads it from the project too, and a hook planted there runs with the same authority. The filename must end the path: settings.json.bak does not count.
  • Three surfaces, one judgement: the Write tool (its path, or an apply_patch body naming the path — classify_tool_call's write branch, which previously returned nothing); shell writes aimed at the path (redirect, tee, dd of=, in-place sed, the cp/mv/install destination slot — reads and copies away from the path stay quiet, and single-quoted prose cannot fire it because the check runs on the literal view); and the MITRE mapper, which upgrades such a write to T1562 Impair Defenses.
  • On the mapper change: the write/list evidence blanking (detection: four false-positive shapes from week 6 to 10 triage (hf in a path, Remove-Item Env:, .env key names, text in a written file) #329) exists so a write is not upgraded to a read technique. This is not a read technique — the write itself is the act — and False positive: a '.env' substring anywhere in a command is tagged as credential access #40 asks the two classifiers not to disagree, so the mapper makes the same judgement as the trait. The check runs on path evidence only, so a config path named in written file content does not upgrade.

On corpus coverage

Corpus expectations assert rule ids, and a trait emits no Detection, so there is no honest corpus case for this PR — coverage is at the classifier/mapper level instead: 14 new tests pinning the fires and the quiet lookalikes (other tools' settings files, .claude project notes, reads, prose about the path). When a rule consumes the trait, its corpus pair belongs with that rule's PR.

Numbers

Tests collected 3034 → 3048 (+14). Benchmark unchanged (112 cases, 61/61, 0 missed, 0 false positives). The detection, MITRE, ingest and benchmark test files are fully green, and ruff is clean. Note: #504 (off-hours corpus) also touches the README collected count — if it lands first, this branch's count becomes 3051; happy to rebase.

@blitzcrieg1
blitzcrieg1 force-pushed the feat/self-config-trait-317 branch from 2cb9390 to 6efb80c Compare November 27, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants