Cleaner concepts
A Cleaner is a versioned domain-rule package with evidence and compatibility constraints. It is not an arbitrary shell script and is not an executable cleanup plugin today.
Current built-ins
The repository contains two example packages:
| Cleaner ID | Description | Current surface |
|---|---|---|
org.sweepx.cargo-target | Cargo workspace target build outputs | metadata/report-only |
org.sweepx.chromium-rebuildable-cache | Chromium HTTP and Code Cache, separated from application state | metadata/report-only |
A package carries a manifest, rules, and evidence documentation. Rules use a constrained declarative VM. The current CLI gives them no I/O, external-command, or native-mutation path.
list versus show
cargo run -p sweepx-cli -- --format json cleaner list
cargo run -p sweepx-cli -- --format json cleaner show <CLEANER_REF>listsummarizes every built-in package and reportscompatible/incompatibleplusreportOnly.showacceptsidorid@version, but fails with a compatibility error when the current Core does not satisfyrequires.core.- No flag bypasses the compatibility gate, and visibility in list never makes a package executable.
Both built-in manifests require >=0.1.0, <0.2.0, which the current Core 0.1.0 satisfies, so list reports ok with no incompatible packages and show succeeds. A manifest whose range excludes the running Core is still reported honestly as incompatible and refused by show — the gate is intact, it simply is not being tripped by the shipped packages.
Current cargo-detect boundary
Beyond metadata, org.sweepx.cargo-target now also has the experimental read-only cleaner cargo-detect surface:
- The Scanner now provides a bounded locator batch reader for fixed file reads along already-admitted locators; all three backends share that bounded contract.
- The workspace fixed-input collector reads only
Cargo.toml,.cargo/config, and.cargo/config.toml, and fails closed on replacement, symlink/reparse, mount changes, resource limits, and cancellation. - When manifest binding is valid, typed workspace evidence can become
known. data.hints[].evidence.cargo.configScopenow exposes thecargo.config-scope.v1wire contract. Its top-level fields areschema,decoderId,workspace,ancestorConfigs,cargoHomeConfig,environment,cli,invocationCwd,precedenceComplete, andblockers[].workspace.pairSnapshotusesstable_snapshot|not_checked|failed; the contract forworkspace.config/workspace.configTomlallowspresent|verified_absent|not_checked|failed, but the current production projection downgrades time-local absence tonot_checkedwhenever the pair is not stable;workspace.selectedusesconfig|config_toml|none|not_checked; andworkspace.targetDirDeclarationusesknown|verified_absent|not_checked|unknown.environmentrecords presence only forCARGO_TARGET_DIR,CARGO_BUILD_TARGET_DIR, andCARGO_HOME: each entry ispresent_redacted|verified_absent.valueRedactedis always present and istruefor the former andfalsefor the latter; no environment value is retained or serialized.- The workspace
build.target-dirdeclaration is redacted in the same way. WhentargetDirDeclaration.state=known, the projection returns onlysource=config|config_tomlplusvalueRedacted=true, never the raw relative-path value. - Only an explicitly set, absolute
CARGO_HOMEis captured privately after the Cleaner compatibility gate and revalidated after the scan. The collector observes only whether direct-childconfig/config.tomlfiles exist under that home: a hit projects onlycargoHomeConfig.state=present_redacted, and the observation remains non-atomic. A miss, an unsetCARGO_HOME, or use of Cargo's default home remainsnot_checkedand is never promoted toverified_absent. The scanner performs bounded, no-follow, handle-bound metadata inspection of matched files; it never reads, parses, uses, or serializes config contents ortarget-dirvalues, and no environment value or home/config path enters the output. - The SweepX
cargo-detectCLI surface has no Cargo passthrough--target-diror--config, so that entry point recordscli.targetDirandcli.configOverridesas structurallyverified_absent. Plain Core calls remainnot_checkedunless they explicitly use the no-overrides invocation contract. - The process cwd is captured privately together with an identity snapshot only after the Cleaner compatibility gate passes. Exact native-path and identity equality with a revalidated workspace root yields only
path_matches_revalidated_workspace_root; because no cwd handle is retained across phases,invocation_cwd_identity_not_boundremains. The cwd path itself is never serialized. blockers[]is a sorted, deduplicated stable vocabulary. An explicit Cargo-home config hit usescargo_home_config_present_redacted; unchecked and failed observations usecargo_home_config_not_checked|cargo_home_config_failed. Other blockers continue to cover unresolved ancestor configs, environment overrides, CLI inputs, invocation cwd, and workspace config state..cargo/configand.cargo/config.tomlare now observed through one retained.cargohandle and one bounded enumeration cursor; ASCII case aliases and duplicate names fail closed. Directory enumeration still cannot exclude concurrent ABA, so the observation remains non-atomic: an unseen member staysnot_checkedand cannot becomeverified_absentor a stable selection.- The Cargo-home presence ledger uses only bounded, no-follow, handle-bound metadata inspection; config contents are not read, parsed, used, or serialized. Ancestor configs and the workspace pair are still unresolved, so
precedenceCompleteremainsfalse;targetDirremainsnot_checked(config_scope_not_checked)andtargetShaperemainsunknown(config_scope_not_checked). - Core library callers can use
cleaner_cargo_detect_with_cancel(..., &CancellationToken)to cooperatively cancel fixed-input/evidence collection after the scan. This token does not own the synchronous filesystem scan; that scan uses a separate internal token, so cancellation requested during the scan is first observed when post-scan collection begins. - If collection observes cancellation, the affected typed evidence fails closed as
unknown(cancelled), and the terminal envelope usesstatus=cancelled, exit 10, andreasonCode=cancelled. Cancellation does not promote an existing observation to a candidate and grants no plan, approval, execution, or mutation authority. - The current CLI only constructs a local token that is not connected to signals. There is no Ctrl-C handler, and neither
sweepx cancelnor a live in-process operation registry is wired to it. The caller-owned token is therefore a library integration seam, not a user-triggerable CLI cancellation capability today. - The result therefore remains
hint/report-only: it does not create a candidate and does not open plan, approval, or execution. Top-levelcandidateAllowed,planAllowed,approvalAllowed, andexecutionAllowedall remainfalse.
Rule output is not a cleanup action
Rule evaluation may express known/unknown state, evidence, risk, and report-only status. It cannot:
- invent a raw path not supported by scan evidence;
- lower risk when evidence is unknown;
- run Cargo, browser, or operating-system commands;
- delete, move, or trash a file;
- create a plan, authorization, or permit.
Even if a future Cleaner can produce candidates, stale/incomplete provenance from imported scan JSON still forces them non-executable.
Future qualification gates
Moving from “describable” to “eligible to participate in execution” requires, at minimum, package canonicalization, signing and revocation, Core/version compatibility, deterministic rules, platform and application-version evidence, reference/activity/recovery fixtures, complete live identity, and the common Safety Core plan/authorization flow. Those gates are not all complete, so the current promise is metadata/report-only.