Reuse the existing resolver/sampler for opt-in aggregate training summaries. Reject incomplete or undecodable snapshots without usable partial reports, retain best-effort readers elsewhere, and document cooperative extent checks rather than atomic snapshot guarantees. Include command-table/help, JSON, fixture and corruption regressions; no model training or promotion.
Allowlisting a hash suppresses new detections but does not delete findings
already stored for it (e.g. the /usr/bin/ss false-positive storm). That cleanup
now lives in doctor instead of a one-off compaction.
- DetectionPipeline::retire_allowlisted_findings(dry_run): a finding is stale
when it references at least one hash and every hash it references (from
metadata "hashes" and file_<sha256> nodes) is allowlisted, so a finding that
also implicates a non-allowlisted binary is never dropped. Mirrors
retire_superseded_findings (retire_finding + transaction).
- node_ids.hpp gains content_hash_of_file_node_id() (the inverse of
file_node_id for the content case) so the pipeline parses file ids through the
canonical helper, not a "file_" literal (source invariant R8).
- Doctor check findings.allowlisted (warn) with maintenance action
retire-allowlisted-findings; DoctorInputs.allowlisted_findings gathered by the
daemon; run_maintenance handles the action; CLI `doctor fix` help + completion
and API_CONTRACT updated.
Tests: test_retire_allowlisted_findings (two execs of a flagged binary -> a
finding; allowlist the hash -> dry-run lists it, apply retires it, idempotent);
doctor check ok/warn cases; CLI completion string. Suite 50/50; clang static
analyzer, clang-tidy and source invariants clean on the changed TUs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Second piece of tracker attribution (docs/tracker-attribution.md): which
programs reach domains on a trackers list. Advisory only: never a block,
never a finding (source invariant R11).
- OpenSnitch event listener: OpenSnitch's JSON "remote" logger is the
hostname source (Strawberry's eBPF connects have none). It streams over
TCP and cannot leave fields out, so events carry command lines and
environments. The listener binds 127.0.0.1 at a port below 1024 (only
root can), accepts only root-owned peers (/proc/net/tcp), bounds
clients/object size/buffering, and reads only pid, uid, path,
destination and action; arguments and environment are never copied.
- TrackerContacts: per program x domain, bounded at 20000 keys. A root-only
tracker_contact telemetry record (type 25) on the first contact, then at
most hourly with the count since.
- Status `privacy` block; control verb privacy-trackers; CLI
`strawberry privacy trackers [--json]`.
- `strawberry opensnitch enable-events` adds the logger to OpenSnitch's
config (with a .bak); the installer runs it when OpenSnitch is present,
unless privacy_trackers=false. Config: privacy_trackers (default true),
opensnitch_events (default 127.0.0.1:979).
- EasyPrivacy is a default trackers feed (GPL-3.0+ or CC-BY-SA-3.0,
downloaded at run time).
Tests: E1-E7 (test_opensnitch_events: event fields, stream splitting,
peer uid, address rules, listener end to end, contacts and record, config
editor), the control verb, CLI translation and help, daemon status. New
fuzz_opensnitch_events (90 s clean).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A promoted model (promoted.sbm, written only by `model promote` after the
gate) can now request real inspections. Only two, both additive:
- memory_scan: through the daemon's memory-scan queue;
- deep_rescan: the root's image re-scanned on demand; new matches are
recorded as indicators of kind model_inspection (findings titled "YARA
match found by a deeper rescan the inspection model requested") and
positive labels.
watch_subtree has no mechanism and rescan_on_next_rules is the retro-hunt's
job, so both are masked out of acting decisions (kExecutableActions), and
replay's policy evaluation uses the same action set.
Guardrails:
- InspectionExecutor (bounded queue, one low-priority worker, submit()
never blocks); WorkClass::model_inspect lets the governor defer it, and
a deferred decision is dropped.
- Each action rechecks that the promoted model is still active at the
decision's generation (demoting or replacing it revokes queued work),
that the root's node id and raw image path still match (decisions carry
root_image, not the feature template), and skips protected processes.
A deep rescan discards its result if the process, image or rules changed
during the scan.
- An acting decision is durably written before it is dispatched; every
attempt becomes an inspection_outcome record (queued, scanned, skipped,
deferred, revoked, queue_full, failed).
- Source invariant R10: no file may couple learning types to the
exec-guard, OpenSnitch or policy APIs (daemon_app.cpp and main.cpp, the
wiring points, are reviewed by hand). Models never block, contain, kill
or create findings directly.
- Config model_act and model_lambda; status model block reports acting
stats; timings.model_inspection.
docs/evaluation/stage4-execution-gate.md amends the gate's method (not its
thresholds): executable action set, greedy promoted decisions, budgets as
estimated inspection seconds by scan profile.
Also: TerminalSafeBuf's destructor no longer lets an exception escape;
the health message clamps huge durations; replay timestamp overflow; the
Docker test build runs with -j2.
Tests: test_inspection_executor (every skip and execute path, revocation,
queue limits); shadow and replay acting cases; R10 fixture; fault injection
and invariant updates. Validation reported by the session that wrote it:
48/48 local, 46/46 Docker plus privileged live checks, 20 fuzz targets
(9.5M runs), three paired KPI runs without regressions (no acting model
was loaded, so active-inspection cost is not measured yet).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- replay --policy-eval: over ranked windows, simulates the model and
rarity-greedy (the same chooser, rarity score / 48 as the value), each
with its own hourly budget, and tallies the shadow decisions the daemon
logged. Hits are inspected "extra" positives: late labels or injected
evaluation traces on windows rules did not flag at exec time. Labels are
known after the fact, so every action's payoff is computable without
propensity weighting. Reports CPU-seconds, inspections, hits, recall,
hits per CPU-second and budget refusals.
- docs/evaluation/stage4-promotion-gate.md (pre-registered): at least 10
extra positives, model efficiency >= 1.5x rarity-greedy, model recall
not lower. promotion_gate() checks it.
- strawberry model promote [--inject FILE] [--warmup H] [--yes]: replays
with the shadow model, applies the gate and only then writes
promoted.sbm; asks for confirmation.
- learn/inspection.hpp: options, the greedy chooser and the
inspection_action record, shared by shadow mode and the evaluation.
- Fix: the hourly budget reset whenever a window closed with an earlier
timestamp than the hour's start (windows close roughly, not strictly,
in time order), letting spend exceed the budget; in both shadow mode
and the evaluation.
Tests: test_replay R11 (gate criteria; extra positives exclude rule-flagged
windows; spend within the budget; logged shadow decisions joined to their
windows); CLI translations.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Replay builds each window's WindowSummary as it goes (exec depth and
locations, connections, writes, ptrace, module loads, scan outcomes,
surprisal) and can collect training examples: features, a label (a
detection or late label touched the window), time, root program and the
rarity score. Sampled to at most 50k: positives up to a fifth,
negatives by reservoir with at most 1% per root program.
--inject-train traces become positive examples and are not evaluated.
- learn/train: the value head (and hidden layers) learn P(teacher
positive) with a class-weighted log loss and Adam; positive-unlabeled
data, so unlabeled is "not known bad", documented. Split by time
(newest 20% tested); reports test loss, top-k hits and ROC AUC for the
model and for the rarity baseline. Refuses with fewer than 5 positives.
Deterministic for a seed. The policy head waits for shadow-mode
inspection outcomes.
- CLI: `strawberry model train [store_dir] [--inject-train FILE]
[--epochs N] [--seed N] [--out FILE] [--json]` writes the shadow model
(generation after the newest existing one, a note saying what it was
trained on); `strawberry model show [file]`; `strawberry replay --model
FILE` ranks windows (and evaluates injections) by the model's value.
Config model_dir (default /var/lib/strawberry/model).
- doctor: the model check loads promoted.sbm and shadow.sbm; an invalid
file is a problem (it is never used).
Tests: test_train (gradients against finite differences, skipping steps
that cross a ReLU kink; a planted pattern learned to high AUC; determinism;
refusal without labels; roc_auc); test_replay R10 (examples, labels,
per-program cap, training traces, model ranking); CLI and doctor cases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Decided 2026-10-27 (docs/cli-ux.md):
- Exit codes: 0 done/healthy, 1 negative result (unhealthy, not found,
daemon refused), 2 usage, 3 could not run here (daemon unreachable,
permission denied, store not readable, feature not built). Daemon
unreachable used to exit 2, like a usage error.
- Process kill/suspend, quarantine, allowlist-add, protection-set to
enforce, store compact and doctor fix (without --dry-run) say what they
will do and ask "Proceed? [y/N]" on a terminal; Enter or EOF is no.
Without a terminal they need --yes, else exit 2 with nothing done.
This applies to the flag form too (--policy-set process-kill ...).
The desktop app talks to the control socket directly and is unaffected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Evidence strings are attacker-controlled: every CLI command's stdout
and stderr now pass through a filter that shows control characters
(C0, DEL, C1) and invalid UTF-8 as \xNN (src/term_safe.hpp), so a
crafted process name or path cannot inject terminal escape sequences.
The daemon's journal output is unchanged.
- `strawberry` alone prints help; an unknown word (`strawberry fix`) is an
error with a "did you mean" hint. Both used to start a daemon as the
calling user with the word as its config path. Config paths (contain
'/' or end in .conf) still run the daemon, for older units.
- Shell completions generated from the command table: `strawberry
completion bash|zsh|fish`; install.sh installs them under
/usr/local/share.
- One correlation pass at daemon start (stored findings catch up with the
current rules, e.g. stable ids), and retire-superseded-findings
correlates first, so replacements exist before old copies are retired.
The user's first run reported "no duplicates" for that reason.
- docs/cli-ux.md: CLI UX rules adapted from yams (grammar, flags, human
and JSON output, status words, security rules for output, help and
completions, adding a command, known gaps). Exit code 3 and
confirmation prompts are proposed there, pending a decision. AGENTS.md
and CLAUDE.md point to it.
tests/test_cli.cpp: bare and unknown words, terminal_safe and the stream
filter, completion scripts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
strawberry [--config PATH] [--json] <command> [<subcommand>] [args] [--flags]
status, doctor, doctor fix <action>, daemon run, findings list/show/
correlate, process search/trace/trace-node/suspend/resume/kill, scan
file/processes/memory, rules reload/update/check/fetch, policy show/set,
opensnitch enable-checksums, store verify/compact, replay, demo seed,
help [command], version.
One table in src/cli_commands.cpp defines each command (words,
positionals, flags, help) and how it maps onto the existing flag form,
which main() still parses; help is generated from the same table.
Unknown options and wrong arity print the command's usage. Process
actions validate node ids before building their JSON payload.
The older flag form (strawberry --status, strawberry <config>) still
works. The systemd units now run `strawberry daemon run --config ...` and
`strawberry rules fetch --config ...`. README, AGENTS.md and the
false-positive guide use the command form.
doctor renders the daemon's checks with their fixes; doctor fix runs a
maintenance action (with --dry-run). Against an older daemon the CLI says
to reinstall rather than "unknown command". replay explains that
telemetry is root-only instead of reporting zeros, and keeps config
output out of --json.
tests/test_cli.cpp: translations, flag-form passthrough, errors, help.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>