agentrinse 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/README.md +281 -179
  2. package/dist/adapters/claude-cache.d.ts +3 -0
  3. package/dist/adapters/claude-cache.d.ts.map +1 -0
  4. package/dist/adapters/claude-cache.js +67 -0
  5. package/dist/adapters/claude-cache.js.map +1 -0
  6. package/dist/adapters/claude-debug.d.ts +3 -0
  7. package/dist/adapters/claude-debug.d.ts.map +1 -0
  8. package/dist/adapters/claude-debug.js +100 -0
  9. package/dist/adapters/claude-debug.js.map +1 -0
  10. package/dist/adapters/claude-retention.d.ts +36 -0
  11. package/dist/adapters/claude-retention.d.ts.map +1 -0
  12. package/dist/adapters/claude-retention.js +176 -0
  13. package/dist/adapters/claude-retention.js.map +1 -0
  14. package/dist/adapters/codex-database.d.ts +64 -0
  15. package/dist/adapters/codex-database.d.ts.map +1 -0
  16. package/dist/adapters/codex-database.js +409 -0
  17. package/dist/adapters/codex-database.js.map +1 -0
  18. package/dist/adapters/copilot-maintenance.d.ts +23 -0
  19. package/dist/adapters/copilot-maintenance.d.ts.map +1 -0
  20. package/dist/adapters/copilot-maintenance.js +53 -0
  21. package/dist/adapters/copilot-maintenance.js.map +1 -0
  22. package/dist/adapters/provider-adapter.d.ts +5 -0
  23. package/dist/adapters/provider-adapter.d.ts.map +1 -1
  24. package/dist/adapters/provider-adapter.js +352 -6
  25. package/dist/adapters/provider-adapter.js.map +1 -1
  26. package/dist/adapters/provider-root.d.ts +8 -0
  27. package/dist/adapters/provider-root.d.ts.map +1 -0
  28. package/dist/adapters/provider-root.js +27 -0
  29. package/dist/adapters/provider-root.js.map +1 -0
  30. package/dist/adapters/provider-specs.d.ts.map +1 -1
  31. package/dist/adapters/provider-specs.js +25 -0
  32. package/dist/adapters/provider-specs.js.map +1 -1
  33. package/dist/adapters/registry.d.ts +1 -0
  34. package/dist/adapters/registry.d.ts.map +1 -1
  35. package/dist/adapters/registry.js +2 -0
  36. package/dist/adapters/registry.js.map +1 -1
  37. package/dist/commands/adapters.d.ts.map +1 -1
  38. package/dist/commands/adapters.js +3 -1
  39. package/dist/commands/adapters.js.map +1 -1
  40. package/dist/commands/apply.d.ts +2 -0
  41. package/dist/commands/apply.d.ts.map +1 -1
  42. package/dist/commands/apply.js +24 -3
  43. package/dist/commands/apply.js.map +1 -1
  44. package/dist/commands/audit.d.ts +1 -0
  45. package/dist/commands/audit.d.ts.map +1 -1
  46. package/dist/commands/audit.js +3 -1
  47. package/dist/commands/audit.js.map +1 -1
  48. package/dist/commands/completion.js +1 -1
  49. package/dist/commands/doctor.d.ts.map +1 -1
  50. package/dist/commands/doctor.js +34 -0
  51. package/dist/commands/doctor.js.map +1 -1
  52. package/dist/commands/plan.d.ts +2 -0
  53. package/dist/commands/plan.d.ts.map +1 -1
  54. package/dist/commands/plan.js +11 -1
  55. package/dist/commands/plan.js.map +1 -1
  56. package/dist/commands/purge.d.ts +13 -1
  57. package/dist/commands/purge.d.ts.map +1 -1
  58. package/dist/commands/purge.js +52 -6
  59. package/dist/commands/purge.js.map +1 -1
  60. package/dist/commands/show.d.ts.map +1 -1
  61. package/dist/commands/show.js +6 -0
  62. package/dist/commands/show.js.map +1 -1
  63. package/dist/commands/undo.d.ts +7 -1
  64. package/dist/commands/undo.d.ts.map +1 -1
  65. package/dist/commands/undo.js +38 -3
  66. package/dist/commands/undo.js.map +1 -1
  67. package/dist/contracts/action.d.ts +517 -2
  68. package/dist/contracts/action.d.ts.map +1 -1
  69. package/dist/contracts/action.js +101 -1
  70. package/dist/contracts/action.js.map +1 -1
  71. package/dist/contracts/database-backup.d.ts +192 -0
  72. package/dist/contracts/database-backup.d.ts.map +1 -0
  73. package/dist/contracts/database-backup.js +70 -0
  74. package/dist/contracts/database-backup.js.map +1 -0
  75. package/dist/contracts/finding.d.ts +208 -2
  76. package/dist/contracts/finding.d.ts.map +1 -1
  77. package/dist/contracts/plan.d.ts +207 -2
  78. package/dist/contracts/plan.d.ts.map +1 -1
  79. package/dist/contracts/plan.js +11 -2
  80. package/dist/contracts/plan.js.map +1 -1
  81. package/dist/contracts/provider-file-quarantine.d.ts +221 -0
  82. package/dist/contracts/provider-file-quarantine.d.ts.map +1 -0
  83. package/dist/contracts/provider-file-quarantine.js +61 -0
  84. package/dist/contracts/provider-file-quarantine.js.map +1 -0
  85. package/dist/contracts/report.d.ts +208 -2
  86. package/dist/contracts/report.d.ts.map +1 -1
  87. package/dist/contracts/resource.d.ts +3 -0
  88. package/dist/contracts/resource.d.ts.map +1 -1
  89. package/dist/contracts/resource.js +1 -0
  90. package/dist/contracts/resource.js.map +1 -1
  91. package/dist/contracts/run.d.ts +194 -0
  92. package/dist/contracts/run.d.ts.map +1 -1
  93. package/dist/contracts/run.js +16 -0
  94. package/dist/contracts/run.js.map +1 -1
  95. package/dist/core/apply.d.ts +9 -1
  96. package/dist/core/apply.d.ts.map +1 -1
  97. package/dist/core/apply.js +147 -4
  98. package/dist/core/apply.js.map +1 -1
  99. package/dist/core/database-exclusion.d.ts +23 -0
  100. package/dist/core/database-exclusion.d.ts.map +1 -0
  101. package/dist/core/database-exclusion.js +133 -0
  102. package/dist/core/database-exclusion.js.map +1 -0
  103. package/dist/core/database-executor.d.ts +45 -0
  104. package/dist/core/database-executor.d.ts.map +1 -0
  105. package/dist/core/database-executor.js +436 -0
  106. package/dist/core/database-executor.js.map +1 -0
  107. package/dist/core/database-recovery.d.ts +25 -0
  108. package/dist/core/database-recovery.d.ts.map +1 -0
  109. package/dist/core/database-recovery.js +628 -0
  110. package/dist/core/database-recovery.js.map +1 -0
  111. package/dist/core/database-revalidation.d.ts +19 -0
  112. package/dist/core/database-revalidation.d.ts.map +1 -0
  113. package/dist/core/database-revalidation.js +70 -0
  114. package/dist/core/database-revalidation.js.map +1 -0
  115. package/dist/core/no-clobber-rename.d.ts +2 -0
  116. package/dist/core/no-clobber-rename.d.ts.map +1 -1
  117. package/dist/core/no-clobber-rename.js +88 -0
  118. package/dist/core/no-clobber-rename.js.map +1 -1
  119. package/dist/core/pinned-file.d.ts +37 -0
  120. package/dist/core/pinned-file.d.ts.map +1 -0
  121. package/dist/core/pinned-file.js +228 -0
  122. package/dist/core/pinned-file.js.map +1 -0
  123. package/dist/core/plan.d.ts.map +1 -1
  124. package/dist/core/plan.js +4 -1
  125. package/dist/core/plan.js.map +1 -1
  126. package/dist/core/process-ownership.d.ts +1 -0
  127. package/dist/core/process-ownership.d.ts.map +1 -1
  128. package/dist/core/process-ownership.js +17 -3
  129. package/dist/core/process-ownership.js.map +1 -1
  130. package/dist/core/provider-file-executor.d.ts +40 -0
  131. package/dist/core/provider-file-executor.d.ts.map +1 -0
  132. package/dist/core/provider-file-executor.js +259 -0
  133. package/dist/core/provider-file-executor.js.map +1 -0
  134. package/dist/core/provider-file-identity.d.ts +8 -0
  135. package/dist/core/provider-file-identity.d.ts.map +1 -0
  136. package/dist/core/provider-file-identity.js +113 -0
  137. package/dist/core/provider-file-identity.js.map +1 -0
  138. package/dist/core/provider-file-policy.d.ts +19 -0
  139. package/dist/core/provider-file-policy.d.ts.map +1 -0
  140. package/dist/core/provider-file-policy.js +72 -0
  141. package/dist/core/provider-file-policy.js.map +1 -0
  142. package/dist/core/provider-file-recovery.d.ts +25 -0
  143. package/dist/core/provider-file-recovery.d.ts.map +1 -0
  144. package/dist/core/provider-file-recovery.js +393 -0
  145. package/dist/core/provider-file-recovery.js.map +1 -0
  146. package/dist/core/provider-file-revalidation.d.ts +20 -0
  147. package/dist/core/provider-file-revalidation.d.ts.map +1 -0
  148. package/dist/core/provider-file-revalidation.js +60 -0
  149. package/dist/core/provider-file-revalidation.js.map +1 -0
  150. package/dist/core/provider-processes.d.ts +18 -0
  151. package/dist/core/provider-processes.d.ts.map +1 -0
  152. package/dist/core/provider-processes.js +90 -0
  153. package/dist/core/provider-processes.js.map +1 -0
  154. package/dist/index.d.ts +4 -2
  155. package/dist/index.d.ts.map +1 -1
  156. package/dist/index.js +4 -2
  157. package/dist/index.js.map +1 -1
  158. package/dist/main.d.ts.map +1 -1
  159. package/dist/main.js +4 -1
  160. package/dist/main.js.map +1 -1
  161. package/dist/state/json-file.d.ts +2 -1
  162. package/dist/state/json-file.d.ts.map +1 -1
  163. package/dist/state/json-file.js +59 -2
  164. package/dist/state/json-file.js.map +1 -1
  165. package/dist/state/layout.d.ts +2 -0
  166. package/dist/state/layout.d.ts.map +1 -1
  167. package/dist/state/layout.js +2 -0
  168. package/dist/state/layout.js.map +1 -1
  169. package/dist/state/run-journal.d.ts.map +1 -1
  170. package/dist/state/run-journal.js +8 -2
  171. package/dist/state/run-journal.js.map +1 -1
  172. package/dist/version.d.ts +1 -1
  173. package/dist/version.js +1 -1
  174. package/package.json +1 -1
  175. package/schemas/audit.schema.json +1029 -1
  176. package/schemas/database-backup.schema.json +648 -0
  177. package/schemas/plan.schema.json +1014 -1
  178. package/schemas/provider-file-quarantine.schema.json +741 -0
  179. package/schemas/run.schema.json +180 -0
package/README.md CHANGED
@@ -1,147 +1,273 @@
1
- # AgentRinse
2
-
3
- Safe, local-first cleanup for agentic development.
4
-
5
- AgentRinse inventories agent state and developer residue, explains why each
6
- resource is protected or eligible, creates content-addressed cleanup plans,
7
- and applies only actions that still pass every safety check.
8
-
9
- Version `0.3.0` adds recoverable quarantine for fully proven inactive linked
10
- Git worktrees. Quarantine is opt-in at the `recoverable` risk ceiling, keeps a
11
- tested undo path, and reports zero immediate disk reclaim until a separate
12
- purge. Exact configured rebuildable artifacts remain the only `safe` action.
13
- Provider state, runtimes, and Docker resources remain report-only.
14
-
15
- ## Install
1
+ # agentrinse 🫧
2
+
3
+ audit first. clean deliberately. recover when it matters.
4
+
5
+ ## what is agentrinse?
6
+
7
+ agentrinse is a local-first cleanup planner for machines where coding agents,
8
+ worktrees, build artifacts, runtimes, and Docker state accumulate faster than
9
+ humans can safely reason about them.
10
+
11
+ it does not treat "old", "large", or "missing from the current terminal" as
12
+ proof that something is disposable. agentrinse inventories the machine,
13
+ reconstructs ownership and reachability, explains why every resource is
14
+ protected or eligible, creates a content-addressed plan, and revalidates the
15
+ same facts immediately before mutation.
16
+
17
+ agentrinse is not audit-only. audit establishes the evidence; apply performs
18
+ the approved filesystem, Git metadata, and offline database changes. `0.5.0`
19
+ removes exact configured rebuildable artifacts, quarantines proven inactive
20
+ linked worktrees, repairs and locks their Git registrations, restores
21
+ quarantined worktrees, permanently purges explicitly selected quarantine
22
+ entries, and compacts supported Codex SQLite state with a retained rollback
23
+ copy. It also quarantines exact stale Claude debug logs and changelog cache
24
+ files with a seven-day undo window.
25
+
26
+ the point is confidence: make real cleanup changes without deleting the
27
+ session, branch, worktree, database content, or cache that another agent still
28
+ needs.
29
+ unknown state fails closed and recoverable worktrees are quarantined before
30
+ they can be purged.
31
+
32
+ agentrinse is deliberately not another generic disk cleaner. it understands
33
+ agent and Git ownership; [Mole](https://github.com/tw93/Mole) remains an
34
+ optional external handoff for broader macOS and project debris.
35
+
36
+ ## cleanup actions
37
+
38
+ | Action | Risk | What changes | Recovery |
39
+ | ---------------------- | ------------ | ------------------------------------------------------------------------------ | --------------------------------------- |
40
+ | 🧹 artifact removal | safe | atomically isolates and removes an exact configured rebuildable directory | rebuild from the project |
41
+ | 🌿 worktree quarantine | recoverable | moves a linked worktree, creates a recovery ref, and repairs Git registration | `agentrinse undo <run-id>` |
42
+ | 🧾 provider quarantine | recoverable | moves an exact provider-owned disposable file into private recovery storage | `agentrinse undo <run-id>` |
43
+ | 🗜️ Codex DB vacuum | experimental | builds and verifies a compacted SQLite copy, then retains the original file | `agentrinse undo <run-id>` before reuse |
44
+ | ↩️ recovery undo | recoverable | restores a quarantined worktree, provider file, or database original | recovery remains journaled |
45
+ | 🗑️ recovery purge | destructive | permanently removes an explicitly selected worktree, provider file, or DB copy | none |
46
+ | ⚙️ config init | operational | creates the default config without overwriting an existing file | edit or remove the generated config |
47
+ | 🔒 lock recovery | operational | removes only a stale AgentRinse lock after proving its process is gone | rerun the interrupted command |
48
+
49
+ provider sessions, transcripts, credentials, configuration, and logical
50
+ database records remain report-only. `0.5.0` supports explicit offline
51
+ compaction for the exact current Codex `state_5`, `logs_2`, `goals_1`, and
52
+ `memories_1` SQLite contracts. Claude cleanup is limited to exact old debug
53
+ text files and its rebuildable changelog cache. AgentRinse also reports
54
+ Claude's native retention policy and Copilot's native session and process-log
55
+ maintenance. Docker remains audit-only.
56
+
57
+ ## agent integrations
58
+
59
+ provider state is report-only unless the table below says otherwise.
60
+ agentrinse never erases transcripts, sessions, credentials, configuration, or
61
+ logical memory records.
62
+
63
+ | Logo | Client | Mode | What it protects |
64
+ | --------------------------------------------------------------------------- | ----------------------------------------------------------- | ----------------------- | ------------------------------------------------------------------- |
65
+ | <img width="48px" src="docs/client-openai.jpg" alt="OpenAI Codex" /> | [OpenAI Codex](https://github.com/openai/codex) | audit + offline vacuum | sessions, workspace roots, reachability, and supported SQLite state |
66
+ | <img width="48px" src="docs/client-claude.jpg" alt="Claude Code" /> | [Claude Code](https://code.claude.com/docs/en/overview) | retention + quarantine | sessions, caches, roots, native retention, and exact old files |
67
+ | <img width="48px" src="docs/client-cursor.jpg" alt="Cursor" /> | [Cursor](https://cursor.com/docs) | audit-only | local agent state and workspace references |
68
+ | <img width="48px" src="docs/client-copilot.png" alt="GitHub Copilot CLI" /> | [GitHub Copilot CLI](https://github.com/github/copilot-cli) | audit + native guidance | local sessions, process logs, and provider-owned maintenance |
69
+ | <img width="48px" src="docs/client-zed.svg" alt="Zed" /> | [Zed](https://zed.dev/docs/ai/overview) | audit-only | local agent state |
70
+ | <img width="48px" src="docs/client-opencode.png" alt="OpenCode" /> | [OpenCode](https://opencode.ai/) | audit-only | local agent state |
71
+ | <img width="48px" src="docs/client-grok-build.svg" alt="Grok Build" /> | [Grok Build](https://docs.x.ai/build/overview) | audit-only | local agent state |
72
+
73
+ ## cleanup surfaces
74
+
75
+ | Icon | Surface | Mode | What it understands |
76
+ | --------------------------------------------------------------------------- | ------------------------------------ | ------------------ | ----------------------------------------------------------------------- |
77
+ | 🌿 | Git worktrees | audit + quarantine | linked worktrees, refs, dirtiness, locks, processes, and provider roots |
78
+ | 🧹 | Build artifacts | safe-clean | exact configured rebuildable directories |
79
+ | 🗜️ | Codex SQLite state | experimental | schema versions, free pages, sidecars, owner processes, and rollback |
80
+ | <img width="48px" src="docs/client-claude.jpg" alt="Claude Code" /> | Claude native retention | report-only | default or user retention, settings validity, and provider ownership |
81
+ | <img width="48px" src="docs/client-claude.jpg" alt="Claude Code" /> | Claude logs and changelog cache | recoverable | exact old files, provider liveness, seven-day undo, and explicit purge |
82
+ | <img width="48px" src="docs/client-copilot.png" alt="GitHub Copilot CLI" /> | Copilot native maintenance | report-only | local session pruning and versioned process-log retention |
83
+ | ⚡ | Agent runtimes | audit-only, opt-in | installed agent executables and versions |
84
+ | <img width="48px" src="docs/client-docker-agent.svg" alt="Docker" /> | [Docker](https://docs.docker.com/) | audit-only, opt-in | images and containers |
85
+ | 🕳️ | [Mole](https://github.com/tw93/Mole) | suggestions only | external dry-run cleanup opportunities on macOS |
86
+
87
+ ## install
16
88
 
17
89
  Node.js 22 or newer is required.
18
90
 
19
91
  ```bash
20
- npm install --global agentrinse
21
- agentrinse --version
92
+ npm install -g agentrinse
93
+ # or
94
+ pnpm add -g agentrinse
95
+ # or
96
+ yarn global add agentrinse
97
+ # or
98
+ brew install vincentkoc/tap/agentrinse
22
99
  ```
23
100
 
24
- Homebrew:
101
+ one-off use:
25
102
 
26
103
  ```bash
27
- brew install vincentkoc/tap/agentrinse
104
+ npx agentrinse@0.5.0 doctor
28
105
  ```
29
106
 
30
- One-off use also works:
107
+ then:
31
108
 
32
109
  ```bash
33
- npx agentrinse@0.3.0 doctor
110
+ agentrinse --version
111
+ agentrinse doctor
112
+ agentrinse adapters
34
113
  ```
35
114
 
36
- ## Quickstart
115
+ ## quick rinse
37
116
 
38
- Create a default configuration without overwriting an existing file:
117
+ from a Git worktree, inspect repository-scoped agent residue:
39
118
 
40
119
  ```bash
41
- agentrinse config init
42
- agentrinse config path
120
+ agentrinse clean --profile closeout
43
121
  ```
44
122
 
45
- Edit the generated JSON and add explicit artifact roots:
46
-
47
- ```json
48
- {
49
- "schemaVersion": 1,
50
- "artifacts": {
51
- "projects": [
52
- {
53
- "root": "/absolute/path/to/project",
54
- "names": ["node_modules", "dist", ".cache"]
55
- }
56
- ],
57
- "minAgeMinutes": 1440,
58
- "minBytes": 67108864,
59
- "processCheck": "required"
60
- },
61
- "worktrees": {
62
- "minAgeMinutes": 20160,
63
- "quarantineTtlMinutes": 10080
64
- },
65
- "plan": {
66
- "ttlMinutes": 30,
67
- "maxRisk": "safe"
68
- }
69
- }
70
- ```
123
+ this audits the current repository, its linked worktrees, and relevant Codex
124
+ and Claude reachability metadata. the current worktree is always protected.
125
+ the command creates a plan but does not infer that your task is finished and
126
+ does not mutate anything unless `--apply` is present.
71
127
 
72
- Run diagnostics before the first audit:
128
+ apply only reviewed `safe` artifact actions:
73
129
 
74
130
  ```bash
75
- agentrinse config validate
76
- agentrinse doctor
131
+ agentrinse clean --profile closeout --apply
77
132
  ```
78
133
 
79
- Audit and save exact evidence:
134
+ automation must authorize explicitly:
80
135
 
81
136
  ```bash
82
- agentrinse audit --home "$HOME" --output audit.json
137
+ agentrinse clean --profile closeout --apply --yes --max-risk safe --json
83
138
  ```
84
139
 
85
- Create and review a bounded plan:
140
+ whole-worktree cleanup is recoverable and must be selected separately:
86
141
 
87
142
  ```bash
88
- agentrinse plan --audit audit.json --output plan.json
89
- cat plan.json
143
+ agentrinse clean --profile closeout --max-risk recoverable
144
+ agentrinse clean --profile closeout --max-risk recoverable --apply --yes
90
145
  ```
91
146
 
92
- Apply only after reviewing the plan:
147
+ that moves a proven inactive linked worktree into quarantine. it does not
148
+ reclaim disk immediately. restore it or inspect a later permanent purge:
93
149
 
94
150
  ```bash
95
- agentrinse apply --plan plan.json
151
+ agentrinse undo <run-id>
152
+ agentrinse purge --run <run-id>
153
+ agentrinse purge --run <run-id> --apply --yes
96
154
  ```
97
155
 
98
- Interactive apply asks for confirmation. Automation must pass `--yes`.
99
-
100
- ## Agent Closeout
101
-
102
- From a Git worktree, create a repository-scoped audit and plan:
156
+ offline Codex database compaction is a separate experimental workflow. quit
157
+ every Codex CLI and desktop process first:
103
158
 
104
159
  ```bash
105
- agentrinse clean --profile closeout
160
+ agentrinse audit --allow-offline-vacuum --output audit.json
161
+ agentrinse plan --audit audit.json --max-risk experimental --output plan.json
162
+ agentrinse apply --plan plan.json --max-risk experimental --yes
106
163
  ```
107
164
 
108
- The current worktree is always protected. The profile inventories its
109
- repository's linked worktrees, loads Codex and Claude reachability metadata,
110
- and ignores unrelated configured artifact projects. It does not infer that a
111
- task is finished.
112
-
113
- After reviewing the summary, a fresh closeout can apply existing `safe`
114
- artifact actions:
165
+ only databases with at least 512 MiB and 25 percent free pages are proposed.
166
+ apply holds exclusive SQLite-compatible file locks across an atomic path
167
+ exchange, so Codex cannot reopen either inode during installation. the original
168
+ file is retained for seven days. undo uses the same locked exchange and refuses
169
+ after Codex has reopened or changed the compacted database:
115
170
 
116
171
  ```bash
117
- agentrinse clean --profile closeout --apply
118
- agentrinse clean --profile closeout --apply --yes --max-risk safe --json
172
+ agentrinse undo <run-id>
173
+ agentrinse purge --expired
174
+ agentrinse purge --expired --apply --yes
119
175
  ```
120
176
 
121
- Whole-worktree quarantine must be selected explicitly:
177
+ apply reports zero reclaimed bytes while the original remains retained. run
178
+ journals record `retainedBackupBytes`; purge reports bytes only when that
179
+ rollback set is actually deleted.
180
+
181
+ ## commands
182
+
183
+ | Command | Purpose | Mutation |
184
+ | ----------------------------------------- | --------------------------------------------------------- | --------------------- |
185
+ | `agentrinse audit` | inventory a home and explain protection evidence | none |
186
+ | `agentrinse audit --allow-offline-vacuum` | propose supported offline Codex DB actions | none |
187
+ | `agentrinse plan` | create a bounded plan from a saved audit | persisted plan only |
188
+ | `agentrinse clean --profile closeout` | audit and plan the current repository | none |
189
+ | `agentrinse apply --plan <file>` | revalidate and apply an authorized plan | selected actions |
190
+ | `agentrinse undo <run-id>` | restore recoverable actions from a run | recovery restore |
191
+ | `agentrinse purge` | preview worktree and database recovery backups | none |
192
+ | `agentrinse purge --apply --yes` | permanently remove selected recovery backups | destructive |
193
+ | `agentrinse doctor` | diagnose platform, config, state, Git, and optional tools | none |
194
+ | `agentrinse adapters` | show adapter maturity and ownership | none |
195
+ | `agentrinse history` | list persisted cleanup runs | none |
196
+ | `agentrinse show` | inspect runs, plans, and resource findings | none |
197
+ | `agentrinse lock status` | inspect the global apply lock | none |
198
+ | `agentrinse lock recover --yes` | remove a stale lock after process proof | stale lock only |
199
+ | `agentrinse config` | locate, initialize, show, or validate configuration | `init` creates a file |
200
+ | `agentrinse completion <shell>` | generate bash, zsh, or fish completion | none |
201
+
202
+ run `agentrinse <command> --help` for the complete option set.
203
+
204
+ ## safety model
205
+
206
+ agentrinse is built around refusal:
207
+
208
+ 1. **discover** resources through owner APIs and structured state where
209
+ possible.
210
+ 2. **protect** anything active, reachable, dirty, pinned, provider-managed, or
211
+ unknown.
212
+ 3. **plan** exact actions against canonical paths and measured identities.
213
+ 4. **authorize** with an expiring, content-addressed plan and explicit risk
214
+ ceiling.
215
+ 5. **revalidate** paths, processes, refs, metadata, age, size, and provider
216
+ roots under the mutation lock.
217
+ 6. **isolate** the exact target with an atomic same-filesystem rename before
218
+ removal.
219
+ 7. **journal** every transition so interrupted work can be inspected,
220
+ recovered, or undone.
221
+
222
+ there is no generic `--force` escape hatch.
223
+
224
+ agentrinse `0.5.0` never removes:
225
+
226
+ - provider sessions, transcripts, logical database rows, credentials, or configuration
227
+ - unsupported provider databases or Codex databases with unknown migrations
228
+ - plugins, skills, memories, or agent instruction files
229
+ - Git branches, stashes, the main worktree, or the current worktree
230
+ - Docker images, containers, networks, volumes, or build cache
231
+ - sockets, pipes, devices, mounts, or symlink targets
232
+
233
+ ### build artifacts
234
+
235
+ direct removal is limited to exact names under explicitly configured project
236
+ roots:
122
237
 
123
238
  ```bash
124
- agentrinse clean --profile closeout --max-risk recoverable
125
- agentrinse clean --profile closeout --max-risk recoverable --apply --yes
239
+ agentrinse config init
240
+ agentrinse config path
126
241
  ```
127
242
 
128
- Quarantine moves bytes out of the active path but does not reclaim disk.
129
- Restore or permanently purge the resulting run:
243
+ edit the generated JSON and add explicit artifact roots:
130
244
 
131
- ```bash
132
- agentrinse undo <run-id>
133
- agentrinse purge --run <run-id>
134
- agentrinse purge --run <run-id> --apply --yes
245
+ ```json
246
+ {
247
+ "schemaVersion": 1,
248
+ "artifacts": {
249
+ "projects": [
250
+ {
251
+ "root": "/absolute/path/to/project",
252
+ "names": ["node_modules", "dist", ".cache"]
253
+ }
254
+ ],
255
+ "minAgeMinutes": 1440,
256
+ "minBytes": 67108864,
257
+ "processCheck": "required"
258
+ },
259
+ "worktrees": {
260
+ "minAgeMinutes": 20160,
261
+ "quarantineTtlMinutes": 10080
262
+ },
263
+ "plan": {
264
+ "ttlMinutes": 30,
265
+ "maxRisk": "safe"
266
+ }
267
+ }
135
268
  ```
136
269
 
137
- On macOS, an installed Mole binary adds external `mo purge --dry-run` and
138
- `mo clean --dry-run` suggestions. AgentRinse never runs those commands.
139
-
140
- ## Mutation Boundary
141
-
142
- AgentRinse has two mutation classes.
143
-
144
- `safe` artifact removal supports only these configured names:
270
+ supported artifact names:
145
271
 
146
272
  - `node_modules`
147
273
  - `dist`
@@ -154,113 +280,84 @@ AgentRinse has two mutation classes.
154
280
  - `target`
155
281
  - `.venv`
156
282
 
157
- Before removal it revalidates configured scope, canonical paths, device and
158
- inode identity, recursive metadata fingerprint, measured bytes, newest
159
- descendant age, mount boundaries, current working directory ownership,
160
- same-user processes, and plan expiration. The exact target is atomically moved
161
- to a same-parent tombstone and verified again before deletion.
283
+ before removal, agentrinse revalidates configured scope, canonical path,
284
+ device and inode identity, recursive metadata fingerprint, measured bytes,
285
+ newest descendant age, mount boundaries, current working directories,
286
+ same-user processes, and plan expiration.
162
287
 
163
- `recoverable` worktree quarantine supports only linked, unlocked, clean,
164
- pushed, branch-attached worktrees with complete measurement, no submodules,
165
- no live process, no pin or provider root, and sufficient age. A recovery ref
166
- is created before atomic same-filesystem rename. Git registration is repaired,
167
- locked, verified, and recorded in an owner-only manifest.
288
+ ### worktree quarantine
168
289
 
169
- Permanent purge reloads configuration and provider workspace metadata under
170
- the mutation lock. A current path, resource-ID, or Git-ref pin, provider-managed
171
- root, active/recent session, or unknown provider state protects the original,
172
- quarantine, or purge-isolation location and refuses deletion. The refresh runs
173
- again immediately before every normal or resumed permanent removal.
290
+ a worktree is eligible for recoverable quarantine only when agentrinse can
291
+ prove that it is:
174
292
 
175
- AgentRinse never removes provider sessions, transcripts, databases,
176
- credentials, configuration, plugins, skills, memories, Git branches, stashes,
177
- Docker images, containers, networks, volumes, or build cache in `0.3.0`.
293
+ - linked, unlocked, branch-attached, clean, and pushed
294
+ - old enough under the configured policy
295
+ - free of submodules and active same-user processes
296
+ - outside the current and main worktrees
297
+ - not pinned by a Git ref, provider root, or active/recent agent session
298
+ - completely measured with no unknown ownership state
178
299
 
179
- ## Operations
300
+ a recovery ref is created before the atomic move. Git registration is repaired
301
+ and locked, then the quarantine manifest is written with owner-only
302
+ permissions. permanent purge reloads configuration and provider metadata under
303
+ the mutation lock and refuses removal if any protection fact has changed.
180
304
 
181
- ```bash
182
- agentrinse history
183
- agentrinse show run <run-id>
184
- agentrinse show plan <plan-id>
185
- agentrinse show resource <resource-id>
186
- agentrinse undo <run-id>
187
- agentrinse purge
188
- agentrinse purge --expired --apply --yes
189
- agentrinse lock status
190
- ```
305
+ ## machine output
191
306
 
192
- Opt into report-only selected runtime inventory:
193
-
194
- ```json
195
- {
196
- "schemaVersion": 1,
197
- "adapters": {
198
- "runtime": { "enabled": true }
199
- }
200
- }
201
- ```
202
-
203
- A stale lock can be recovered only after AgentRinse proves the recorded local
204
- process identity no longer exists:
307
+ `--json` emits a versioned command envelope suitable for scripts and agent
308
+ tools:
205
309
 
206
310
  ```bash
207
- agentrinse lock status
208
- agentrinse lock recover --yes
311
+ agentrinse audit --json
312
+ agentrinse clean --profile closeout --json
313
+ agentrinse history --json
209
314
  ```
210
315
 
211
- Generate shell completion without modifying shell startup files:
212
-
213
- ```bash
214
- agentrinse completion bash
215
- agentrinse completion zsh
216
- agentrinse completion fish
217
- ```
218
-
219
- ## Machine Output
220
-
221
- `agentrinse audit --json` emits a versioned command envelope. Long audits can
222
- emit incremental event records:
316
+ long audits can stream versioned events:
223
317
 
224
318
  ```bash
225
319
  agentrinse audit --ndjson
226
320
  ```
227
321
 
228
- Create a non-executable report for issue filing:
322
+ create a non-executable report for issue filing:
229
323
 
230
324
  ```bash
231
325
  agentrinse audit --json --redact > audit-redacted.json
232
326
  ```
233
327
 
234
- Redaction replaces paths, salts identifiers per report, removes host fields,
235
- and strips candidate actions. Persisted state and `--output` evidence remain
236
- exact so they can be used for planning.
328
+ redaction replaces paths, salts identifiers per report, removes host fields,
329
+ and strips candidate actions. saved audit and plan evidence remains exact so
330
+ it can be verified before apply.
237
331
 
238
- ## Platform Support
332
+ ## platform support
239
333
 
240
- | Platform | `0.3.0` support |
241
- | -------------- | ------------------------------------------------------- |
242
- | macOS | audit, artifact removal, worktree quarantine/undo/purge |
243
- | Linux | audit, artifact removal, worktree quarantine/undo/purge |
244
- | WSL | Linux contract inside the WSL filesystem |
245
- | native Windows | audit-only; mutation remains blocked before `1.0.0` |
334
+ | Platform | `0.5.0` support |
335
+ | -------------- | --------------------------------------------------------------- |
336
+ | macOS | audit, artifact/worktree/Claude cleanup, DB vacuum, undo, purge |
337
+ | Linux | audit, artifact/worktree/Claude cleanup, DB vacuum, undo, purge |
338
+ | WSL | Linux contract inside the WSL filesystem |
339
+ | native Windows | audit-only; mutation remains blocked before `1.0.0` |
246
340
 
247
341
  Git and `lsof` are required for the complete diagnostic and process-ownership
248
- contract. Docker is optional. Doctor can detect the optional external Mole
249
- tool on macOS.
250
-
251
- ## Documentation
252
-
253
- - [Configuration](docs/configuration.md)
254
- - [Automation](docs/automation.md)
255
- - [Recovery](docs/recovery.md)
256
- - [Platform support](docs/platforms.md)
257
- - [Safety model](docs/safety.md)
258
- - [Adapter matrix](docs/adapters.md)
259
- - [Development](docs/development.md)
260
- - [Releasing](docs/releasing.md)
261
- - [Product specification](docs/product-spec.md)
262
-
263
- ## Development
342
+ contract. Codex DB maintenance additionally requires `sqlite3`. Docker is
343
+ optional. Mole detection is available on macOS.
344
+
345
+ ## docs
346
+
347
+ - [configuration](docs/configuration.md)
348
+ - [automation](docs/automation.md)
349
+ - [recovery](docs/recovery.md)
350
+ - [safety model](docs/safety.md)
351
+ - [adapter matrix](docs/adapters.md)
352
+ - [platform support](docs/platforms.md)
353
+ - [architecture](docs/architecture.md)
354
+ - [development](docs/development.md)
355
+ - [release process](docs/releasing.md)
356
+ - [roadmap](docs/roadmap.md)
357
+ - [product specification](docs/product-spec.md)
358
+ - [security policy](SECURITY.md)
359
+
360
+ ## development
264
361
 
265
362
  ```bash
266
363
  pnpm install
@@ -269,9 +366,14 @@ pnpm smoke
269
366
  pnpm pack:check
270
367
  ```
271
368
 
272
- Tests and smoke runs use guarded temporary synthetic roots. Never point an
369
+ tests and smoke runs use guarded temporary synthetic roots. never point an
273
370
  unreleased build at real developer state.
274
371
 
275
- ## License
372
+ ## status
373
+
374
+ `0.5.0` ships the complete audit → plan → revalidate → apply loop, safe
375
+ configured artifact cleanup, recoverable Git worktree and Claude file
376
+ quarantine, and recoverable offline Codex database compaction. Cursor, Zed,
377
+ OpenCode, Grok Build, and Docker remain report-only.
276
378
 
277
- MIT
379
+ MIT licensed. built by [Vincent Koc](https://github.com/vincentkoc).
@@ -0,0 +1,3 @@
1
+ import type { AuditContext, CollectionResult } from "../contracts/adapter.js";
2
+ export declare function collectClaudeChangelogCache(context: AuditContext, ownerRoot: string): Promise<CollectionResult>;
3
+ //# sourceMappingURL=claude-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-cache.d.ts","sourceRoot":"","sources":["../../src/adapters/claude-cache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAc9E,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,gBAAgB,CAAC,CA2D3B"}
@@ -0,0 +1,67 @@
1
+ import { lstat } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { sha256 } from "../core/digest.js";
4
+ import { inspectProviderFile } from "../core/provider-file-identity.js";
5
+ import { CLAUDE_CHANGELOG_CACHE_MIN_AGE_MINUTES, CLAUDE_CHANGELOG_CACHE_POLICY_ID, } from "../core/provider-file-policy.js";
6
+ function isMissing(error) {
7
+ return (error instanceof Error && "code" in error && error.code === "ENOENT");
8
+ }
9
+ export async function collectClaudeChangelogCache(context, ownerRoot) {
10
+ const cacheRoot = join(ownerRoot, "cache");
11
+ const path = join(cacheRoot, "changelog.md");
12
+ try {
13
+ const cacheStats = await lstat(cacheRoot);
14
+ if (cacheStats.isSymbolicLink() || !cacheStats.isDirectory()) {
15
+ return { resources: [], diagnostics: [] };
16
+ }
17
+ const stats = await lstat(path);
18
+ const cutoffMs = context.now.getTime() - CLAUDE_CHANGELOG_CACHE_MIN_AGE_MINUTES * 60_000;
19
+ if (!stats.isFile() || stats.isSymbolicLink() || stats.mtimeMs > cutoffMs) {
20
+ return { resources: [], diagnostics: [] };
21
+ }
22
+ const identity = await inspectProviderFile(path, ownerRoot, "claude");
23
+ const canonicalKey = `claude:changelog-cache:${identity.path}`;
24
+ return {
25
+ resources: [
26
+ {
27
+ resource: {
28
+ id: `claude:agent-cache:${sha256(canonicalKey)}`,
29
+ adapter: "claude",
30
+ kind: "agent-cache",
31
+ canonicalKey,
32
+ displayName: "Claude changelog cache",
33
+ path: identity.path,
34
+ },
35
+ observedAt: context.now.toISOString(),
36
+ exists: true,
37
+ measuredBytes: identity.measuredBytes,
38
+ facts: {
39
+ reportOnly: false,
40
+ maintenanceAction: "provider.file-quarantine",
41
+ policyId: CLAUDE_CHANGELOG_CACHE_POLICY_ID,
42
+ minAgeMinutes: CLAUDE_CHANGELOG_CACHE_MIN_AGE_MINUTES,
43
+ providerFileIdentity: identity,
44
+ },
45
+ },
46
+ ],
47
+ diagnostics: [],
48
+ };
49
+ }
50
+ catch (error) {
51
+ if (isMissing(error)) {
52
+ return { resources: [], diagnostics: [] };
53
+ }
54
+ return {
55
+ resources: [],
56
+ diagnostics: [
57
+ {
58
+ severity: "warning",
59
+ code: "CLAUDE_CHANGELOG_CACHE_INSPECTION_FAILED",
60
+ message: error instanceof Error ? error.message : String(error),
61
+ adapter: "claude",
62
+ },
63
+ ],
64
+ };
65
+ }
66
+ }
67
+ //# sourceMappingURL=claude-cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-cache.js","sourceRoot":"","sources":["../../src/adapters/claude-cache.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ import type { AuditContext, CollectionResult } from "../contracts/adapter.js";
2
+ export declare function collectClaudeDebugLogs(context: AuditContext, ownerRoot: string, maxEntries: number): Promise<CollectionResult>;
3
+ //# sourceMappingURL=claude-debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-debug.d.ts","sourceRoot":"","sources":["../../src/adapters/claude-debug.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAgB9E,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CA6F3B"}