pi-smart-compact 9.7.1 → 10.0.1

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 (206) hide show
  1. package/ARCHITECTURE.md +973 -372
  2. package/CHANGELOG.md +721 -0
  3. package/LICENSE +8 -0
  4. package/README.md +128 -640
  5. package/SECURITY.md +34 -12
  6. package/SUPPORT.md +26 -9
  7. package/assets/DejaVu-LICENSE.txt +187 -0
  8. package/assets/DejaVuSansMono.ttf +0 -0
  9. package/assets/README.md +26 -0
  10. package/assets/skills/context-management/SKILL.md +34 -0
  11. package/dist/app/anchor-cache.d.ts +36 -0
  12. package/dist/app/anchor-cache.d.ts.map +1 -0
  13. package/dist/app/artifact-storage.d.ts +47 -0
  14. package/dist/app/artifact-storage.d.ts.map +1 -0
  15. package/dist/app/background-preparation.d.ts +39 -0
  16. package/dist/app/background-preparation.d.ts.map +1 -0
  17. package/dist/app/compaction-commit-store.d.ts +5 -1
  18. package/dist/app/compaction-commit-store.d.ts.map +1 -1
  19. package/dist/app/context-evidence.d.ts +57 -0
  20. package/dist/app/context-evidence.d.ts.map +1 -0
  21. package/dist/app/context-guide.d.ts +3 -0
  22. package/dist/app/context-guide.d.ts.map +1 -0
  23. package/dist/app/context-operations.d.ts +106 -0
  24. package/dist/app/context-operations.d.ts.map +1 -0
  25. package/dist/app/effective-state.d.ts +23 -0
  26. package/dist/app/effective-state.d.ts.map +1 -0
  27. package/dist/app/global-settings-runtime.d.ts +3 -3
  28. package/dist/app/global-settings-runtime.d.ts.map +1 -1
  29. package/dist/app/hindsight-memory.d.ts +100 -0
  30. package/dist/app/hindsight-memory.d.ts.map +1 -0
  31. package/dist/app/host-cache-ledger.d.ts +68 -0
  32. package/dist/app/host-cache-ledger.d.ts.map +1 -0
  33. package/dist/app/lazy-tools.d.ts +36 -0
  34. package/dist/app/lazy-tools.d.ts.map +1 -0
  35. package/dist/app/memory-backend.d.ts +58 -0
  36. package/dist/app/memory-backend.d.ts.map +1 -0
  37. package/dist/app/mnemopi-memory.d.ts +13 -0
  38. package/dist/app/mnemopi-memory.d.ts.map +1 -0
  39. package/dist/app/mnemopi-protocol.d.ts +78 -0
  40. package/dist/app/mnemopi-protocol.d.ts.map +1 -0
  41. package/dist/app/mnemopi-worker.d.ts +2 -0
  42. package/dist/app/mnemopi-worker.d.ts.map +1 -0
  43. package/dist/app/model-feasibility.d.ts +20 -0
  44. package/dist/app/model-feasibility.d.ts.map +1 -0
  45. package/dist/app/native-compaction.d.ts +88 -0
  46. package/dist/app/native-compaction.d.ts.map +1 -0
  47. package/dist/app/native-continuity-bridge.d.ts.map +1 -1
  48. package/dist/app/navigation-data.d.ts +28 -0
  49. package/dist/app/navigation-data.d.ts.map +1 -0
  50. package/dist/app/navigation-types.d.ts +60 -0
  51. package/dist/app/navigation-types.d.ts.map +1 -0
  52. package/dist/app/pending-slot.d.ts +11 -1
  53. package/dist/app/pending-slot.d.ts.map +1 -1
  54. package/dist/app/preflight.d.ts.map +1 -1
  55. package/dist/app/register-context-tools.d.ts +16 -3
  56. package/dist/app/register-context-tools.d.ts.map +1 -1
  57. package/dist/app/register-navigation.d.ts +20 -0
  58. package/dist/app/register-navigation.d.ts.map +1 -0
  59. package/dist/app/register-smart-compact-command.d.ts +17 -2
  60. package/dist/app/register-smart-compact-command.d.ts.map +1 -1
  61. package/dist/app/register-smart-compact-tool.d.ts.map +1 -1
  62. package/dist/app/register-smart-context-tool.d.ts +55 -0
  63. package/dist/app/register-smart-context-tool.d.ts.map +1 -0
  64. package/dist/app/run-context.d.ts +1 -0
  65. package/dist/app/run-context.d.ts.map +1 -1
  66. package/dist/app/run-smart-compact.d.ts +3 -3
  67. package/dist/app/run-smart-compact.d.ts.map +1 -1
  68. package/dist/app/session-handoff.d.ts +64 -0
  69. package/dist/app/session-handoff.d.ts.map +1 -0
  70. package/dist/app/session-lineage.d.ts +17 -0
  71. package/dist/app/session-lineage.d.ts.map +1 -0
  72. package/dist/app/session-run-lock.d.ts +0 -2
  73. package/dist/app/session-run-lock.d.ts.map +1 -1
  74. package/dist/app/settled-auto-trigger.d.ts +2 -0
  75. package/dist/app/settled-auto-trigger.d.ts.map +1 -1
  76. package/dist/app/smart-compact-input.d.ts +1 -1
  77. package/dist/app/smart-compact-input.d.ts.map +1 -1
  78. package/dist/app/smart-compact-policy.d.ts +1 -1
  79. package/dist/app/smart-compact-policy.d.ts.map +1 -1
  80. package/dist/app/steps/extract.d.ts +45 -1
  81. package/dist/app/steps/extract.d.ts.map +1 -1
  82. package/dist/app/steps/metrics.d.ts +1 -0
  83. package/dist/app/steps/metrics.d.ts.map +1 -1
  84. package/dist/app/steps/persist.d.ts.map +1 -1
  85. package/dist/app/steps/prepare.d.ts.map +1 -1
  86. package/dist/app/steps/recover.d.ts +9 -0
  87. package/dist/app/steps/recover.d.ts.map +1 -1
  88. package/dist/app/steps/synthesize.d.ts.map +1 -1
  89. package/dist/app/steps/tier.d.ts.map +1 -1
  90. package/dist/app/steps/verify.d.ts.map +1 -1
  91. package/dist/app/steps/visual.d.ts +4 -0
  92. package/dist/app/steps/visual.d.ts.map +1 -0
  93. package/dist/app/steps/window.d.ts.map +1 -1
  94. package/dist/app/tool-artifacts.d.ts +27 -0
  95. package/dist/app/tool-artifacts.d.ts.map +1 -0
  96. package/dist/app/visual-archive.d.ts +29 -0
  97. package/dist/app/visual-archive.d.ts.map +1 -0
  98. package/dist/constants.d.ts +96 -1
  99. package/dist/constants.d.ts.map +1 -1
  100. package/dist/domain/compaction-usage.d.ts +16 -0
  101. package/dist/domain/compaction-usage.d.ts.map +1 -0
  102. package/dist/domain/model-capacity.d.ts +12 -0
  103. package/dist/domain/model-capacity.d.ts.map +1 -0
  104. package/dist/domain/provider-evaluation.d.ts +7 -0
  105. package/dist/domain/provider-evaluation.d.ts.map +1 -1
  106. package/dist/domain/telemetry.d.ts +43 -2
  107. package/dist/domain/telemetry.d.ts.map +1 -1
  108. package/dist/domain/tool-semantics.d.ts +23 -0
  109. package/dist/domain/tool-semantics.d.ts.map +1 -1
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +15757 -6942
  112. package/dist/infra/ai-messages.d.ts +1 -1
  113. package/dist/infra/ai-messages.d.ts.map +1 -1
  114. package/dist/infra/context-graph.d.ts +38 -7
  115. package/dist/infra/context-graph.d.ts.map +1 -1
  116. package/dist/infra/fs.d.ts.map +1 -1
  117. package/dist/infra/hindsight-client.d.ts +73 -0
  118. package/dist/infra/hindsight-client.d.ts.map +1 -0
  119. package/dist/infra/hindsight-receipts.d.ts +68 -0
  120. package/dist/infra/hindsight-receipts.d.ts.map +1 -0
  121. package/dist/infra/llm-client.d.ts +26 -23
  122. package/dist/infra/llm-client.d.ts.map +1 -1
  123. package/dist/infra/memory-ref.d.ts +27 -0
  124. package/dist/infra/memory-ref.d.ts.map +1 -0
  125. package/dist/infra/native-protocol.d.ts +54 -0
  126. package/dist/infra/native-protocol.d.ts.map +1 -0
  127. package/dist/infra/optional-components.d.ts +15 -0
  128. package/dist/infra/optional-components.d.ts.map +1 -0
  129. package/dist/infra/paths.d.ts +2 -0
  130. package/dist/infra/paths.d.ts.map +1 -1
  131. package/dist/infra/services.d.ts +15 -5
  132. package/dist/infra/services.d.ts.map +1 -1
  133. package/dist/infra/visual-renderer.d.ts +16 -0
  134. package/dist/infra/visual-renderer.d.ts.map +1 -0
  135. package/dist/mnemopi-worker.js +213 -0
  136. package/dist/phases/explore.d.ts +12 -9
  137. package/dist/phases/explore.d.ts.map +1 -1
  138. package/dist/phases/synthesize.d.ts +18 -3
  139. package/dist/phases/synthesize.d.ts.map +1 -1
  140. package/dist/phases/verify.d.ts +5 -1
  141. package/dist/phases/verify.d.ts.map +1 -1
  142. package/dist/rtk.d.ts +7 -0
  143. package/dist/rtk.d.ts.map +1 -0
  144. package/dist/rtk.js +767 -0
  145. package/dist/types.d.ts +128 -4
  146. package/dist/types.d.ts.map +1 -1
  147. package/dist/ui/dashboard-format.d.ts +2 -1
  148. package/dist/ui/dashboard-format.d.ts.map +1 -1
  149. package/dist/ui/dashboard-insights.d.ts +9 -1
  150. package/dist/ui/dashboard-insights.d.ts.map +1 -1
  151. package/dist/ui/error-format.d.ts +7 -2
  152. package/dist/ui/error-format.d.ts.map +1 -1
  153. package/dist/ui/handoff-overlay.d.ts +26 -0
  154. package/dist/ui/handoff-overlay.d.ts.map +1 -0
  155. package/dist/ui/home-overlay.d.ts +54 -0
  156. package/dist/ui/home-overlay.d.ts.map +1 -0
  157. package/dist/ui/metrics-dashboard-overlay.d.ts.map +1 -1
  158. package/dist/ui/metrics-report.d.ts.map +1 -1
  159. package/dist/ui/navigation-overlay.d.ts +92 -0
  160. package/dist/ui/navigation-overlay.d.ts.map +1 -0
  161. package/dist/ui/overlays.d.ts +12 -2
  162. package/dist/ui/overlays.d.ts.map +1 -1
  163. package/dist/ui/profiles.d.ts +51 -0
  164. package/dist/ui/profiles.d.ts.map +1 -0
  165. package/dist/ui/settings-complex.d.ts +49 -3
  166. package/dist/ui/settings-complex.d.ts.map +1 -1
  167. package/dist/ui/settings-list.d.ts +28 -0
  168. package/dist/ui/settings-list.d.ts.map +1 -0
  169. package/dist/ui/settings-overlay.d.ts +13 -6
  170. package/dist/ui/settings-overlay.d.ts.map +1 -1
  171. package/dist/ui/storage-report.d.ts +4 -0
  172. package/dist/ui/storage-report.d.ts.map +1 -0
  173. package/dist/utils/backups.d.ts.map +1 -1
  174. package/dist/utils/cache.d.ts +6 -2
  175. package/dist/utils/cache.d.ts.map +1 -1
  176. package/dist/utils/config.d.ts +12 -0
  177. package/dist/utils/config.d.ts.map +1 -1
  178. package/dist/utils/helpers.d.ts.map +1 -1
  179. package/dist/utils/id-fingerprint.d.ts +3 -1
  180. package/dist/utils/id-fingerprint.d.ts.map +1 -1
  181. package/dist/utils/issues.d.ts +61 -0
  182. package/dist/utils/issues.d.ts.map +1 -0
  183. package/dist/utils/pruning.d.ts.map +1 -1
  184. package/dist/utils/session-log.d.ts +0 -2
  185. package/dist/utils/session-log.d.ts.map +1 -1
  186. package/dist/utils/state.d.ts +3 -1
  187. package/dist/utils/state.d.ts.map +1 -1
  188. package/dist/utils/tokens.d.ts +10 -2
  189. package/dist/utils/tokens.d.ts.map +1 -1
  190. package/docs/MIGRATING_TO_V8.md +7 -1
  191. package/docs/README.md +69 -0
  192. package/docs/RELEASE.md +173 -56
  193. package/docs/assets/banner.png +0 -0
  194. package/docs/assets/banner.svg +1158 -70
  195. package/docs/assets/pi-smart-compact.png +0 -0
  196. package/docs/assets/pi-smart-compact.svg +24 -0
  197. package/docs/configuration.md +637 -0
  198. package/docs/evaluation.md +408 -0
  199. package/docs/guide.md +860 -0
  200. package/docs/hindsight-memory.md +314 -0
  201. package/docs/identity.md +124 -0
  202. package/package.json +44 -11
  203. package/dist/provider-eval.js +0 -2122
  204. package/dist/provider-scenario-eval.js +0 -2900
  205. package/dist/telemetry-report.js +0 -1973
  206. package/docs/provider-evaluation-2026-08-06.md +0 -63
Binary file
@@ -0,0 +1,24 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 320 320" role="img" aria-labelledby="title description">
2
+ <title id="title">Pi Continuity</title>
3
+ <desc id="description">An open return path with a gold anchor: useful context kept within reach.</desc>
4
+ <!-- Generated from banner.svg; regenerate using docs/identity.md. -->
5
+ <rect width="320" height="320" rx="64" fill="#F3F8F9"/>
6
+ <g transform="translate(-8 0)"><g id="continuity-mark">
7
+ <path fill="none" stroke="#183e4b" stroke-width="32" stroke-linecap="round" stroke-linejoin="round" d="M 232 88
8
+ L 143 88
9
+ C 106 88 76 118 76 155
10
+ L 76 165
11
+ C 76 202 106 232 143 232
12
+ L 190 232"/>
13
+ <path fill="none" stroke="#147d88" stroke-width="32" stroke-linecap="round" stroke-linejoin="round" d="M 190 232
14
+ L 213 232
15
+ C 239 232 260 211 260 185
16
+ C 260 159 239 138 213 138
17
+ L 150 138"/>
18
+ <path fill="#e8b55b" stroke="none" d="M 166 138
19
+ C 166 146.837 158.837 154 150 154
20
+ C 141.163 154 134 146.837 134 138
21
+ C 134 129.163 141.163 122 150 122
22
+ C 158.837 122 166 129.163 166 138 Z"/>
23
+ </g></g>
24
+ </svg>
@@ -0,0 +1,637 @@
1
+ # Pi Continuity configuration reference
2
+
3
+ This page lists every setting, its default and how settings combine. For
4
+ task-oriented instructions, start with the [user guide](./guide.md).
5
+
6
+ Pi Continuity is the product name only. Settings keep their technical names:
7
+ everything lives under the `smartCompact` key, and the settings screen is opened
8
+ with `/smart-compact settings`.
9
+
10
+ Defaults on this page were checked against Pi Continuity `10.0.1`. For an older
11
+ installation, use [the changelog](../CHANGELOG.md) and the
12
+ [upgrade notes](./guide.md#upgrade-from-9x) before adopting these settings.
13
+
14
+ ## Contents
15
+
16
+ - [Where settings live](#where-settings-live)
17
+ - [How settings combine](#how-settings-combine)
18
+ - [Presets](#presets)
19
+ - [Automatic strategies](#automatic-strategies)
20
+ - [Modes and budgets](#modes-and-budgets)
21
+ - [Models and reasoning](#models-and-reasoning)
22
+ - [Compaction engines](#compaction-engines)
23
+ - [Context hygiene and archives](#context-hygiene-and-archives)
24
+ - [Agent tools and session navigation](#agent-tools-and-session-navigation)
25
+ - [Memory](#memory)
26
+ - [Privacy and backups](#privacy-and-backups)
27
+ - [All settings](#all-settings)
28
+ - [Legacy and removed keys](#legacy-and-removed-keys)
29
+ - [Examples](#examples)
30
+
31
+ ## Where settings live
32
+
33
+ Global settings are stored in the `smartCompact` section of
34
+ `~/.pi/agent/settings.json` (Pi's own settings file). Only this global file is
35
+ read for `smartCompact`.
36
+
37
+ | Way to change | Notes |
38
+ | --- | --- |
39
+ | Home → **Settings** | Task-level presets: `How it runs`, `Summary format`, `Models`, `Memory` |
40
+ | `/smart-compact settings` or Settings → **Advanced settings** | Every setting by category, plus `This branch only` (TUI only) |
41
+ | Edit `settings.json` | Any key; read on the next operation |
42
+
43
+ The categorized screen groups settings as: `Compaction`, `Models & thinking`,
44
+ `Memory` (with `› Hindsight server`), `Agent tools & navigation`,
45
+ `Tool output cleanup`, `Privacy & safety`, `This branch only` and `Advanced`
46
+ (with `› Limits`, which contains `› Mode budgets`). Labels are for reading;
47
+ stored keys and values are unchanged.
48
+
49
+ Settings screen behavior:
50
+
51
+ - `•` marks a changed setting; each category shows how many are changed.
52
+ - `r` resets the selected row: the key is removed from `settings.json` so the
53
+ built-in default applies again. On the branch page, `r` resets to `global`.
54
+ - Rows that depend on another setting stay visible, marked inactive with the
55
+ reason (for example "used only when Memory store = Hindsight server").
56
+ - Invalid or converted values in `settings.json` are listed in one warning line
57
+ at the top.
58
+ - Each change is validated as a whole before writing. A preset is one atomic
59
+ write. Other Pi and extension keys are preserved.
60
+
61
+ Writes use a lock directory, `~/.pi/agent/settings.json.lock`, and fail closed
62
+ while it exists. If Pi was killed during a write, verify that no Pi process is
63
+ writing settings, then remove the stale lock directory by hand.
64
+
65
+ Invalid values in `settings.json` never stop the extension: the value is
66
+ discarded with a warning and the default is used. Invalid or unreadable JSON
67
+ means all defaults are used.
68
+
69
+ ### When changes take effect
70
+
71
+ | Change | Takes effect |
72
+ | --- | --- |
73
+ | Agent access, automatic compaction, footer status, memory tool exposure (from the TUI) | Immediately; tool schemas and prompt guidance update on the next agent turn |
74
+ | Mode, models, budgets, privacy, paths, profiles, monitoring | Next compaction or indexing; a running compaction keeps its starting configuration |
75
+ | Hand edits to `settings.json` | Next operation (the file's modification time is checked). Active tools and footer refresh on `/reload` or session restore; no file watcher runs. |
76
+
77
+ Changing agent-tool settings from the TUI re-applies the tool list at once.
78
+ Groups the agent loaded through `smart_tools` are forgotten at session start,
79
+ on a branch change and after a compaction; see
80
+ [agent tools](./guide.md#agent-tools).
81
+
82
+ ## How settings combine
83
+
84
+ From lowest to highest precedence:
85
+
86
+ 1. Built-in defaults.
87
+ 2. Global `smartCompact` settings in `~/.pi/agent/settings.json`.
88
+ 3. Branch overrides (`This branch only`) for three settings only.
89
+ 4. Per-run options on `/smart-compact` or the `smart_compact` tool (mode, focus
90
+ and budgets).
91
+
92
+ Hard caps apply on top of all of them, for example the
93
+ [automatic run cap](#automatic-runs-cap).
94
+
95
+ ### Branch overrides
96
+
97
+ `This branch only` holds sparse overrides stored in the session history, not in
98
+ `settings.json`. Moving in Pi's session tree restores each branch's overrides.
99
+
100
+ | Row | Values | Overrides |
101
+ | --- | --- | --- |
102
+ | `Agent can compact` | `global`, `Follow Pi`, `Allowed`, `Not allowed` | `agentToolAccess` |
103
+ | `Automatic compaction` | `global`, `enabled`, `disabled` | `autoTrigger` |
104
+ | `Footer status` | `global`, `enabled`, `disabled` | `showStatus` |
105
+
106
+ `global` means "use the saved setting". Each row shows the effective value.
107
+
108
+ ## Presets
109
+
110
+ Presets are shortcuts. The current preset is derived from the stored flags;
111
+ nothing new is stored.
112
+
113
+ ### How it runs
114
+
115
+ | Preset | `autoTrigger` | `autoTriggerStrategy` | `contextHygieneEnabled` | `agentToolAccess` |
116
+ | --- | --- | --- | --- | --- |
117
+ | `With Pi (default)` | `true` | `native-hook` | `false` | `inherit` |
118
+ | `Manual only` | `false` | unchanged | `false` | `disabled` |
119
+ | `Manual + agent` | `false` | unchanged | `false` | `enabled` |
120
+ | `Cleanup only` | `false` | unchanged | `true` | `disabled` |
121
+ | `Fully automatic` | `true` | `settled` | `true` | `disabled` |
122
+
123
+ `With Pi (default)` is the unchanged built-in default, not a preset you pick.
124
+ Any other combination is shown as `Custom` with a one-line description. Existing
125
+ `native-hook` configurations are not migrated to `settled`.
126
+
127
+ ### Summary format
128
+
129
+ | Preset | `compactionEngines` | `visualArchiveEnabled` |
130
+ | --- | --- | --- |
131
+ | `Verified text` | default (`["eesv"]`) | default (`false`) |
132
+ | `Text + images` | default (`["eesv"]`) | `true` |
133
+ | `Provider (experimental)` | `["native", "eesv"]` | default (`false`) |
134
+
135
+ `Provider (experimental)` needs a second `Enter` to confirm. A row shows
136
+ `text only now` when the current chat model cannot use images or provider
137
+ compaction; you can still select it.
138
+
139
+ ### Models
140
+
141
+ | Preset | Effect |
142
+ | --- | --- |
143
+ | `Chat model` | All stages use the model you are chatting with (all three model keys `null`) |
144
+ | `Choose summary model` | Sets `summaryModel`; segmentation and verification inherit it |
145
+ | `Advanced model routing` | Set each stage separately |
146
+
147
+ ## Automatic strategies
148
+
149
+ `autoTrigger` is the master switch for Smart Compact's own automatic
150
+ compaction. `autoTriggerStrategy` chooses how it starts.
151
+
152
+ | `autoTriggerStrategy` | TUI label (`Start when`) | Who decides when | Needs Pi auto-compaction |
153
+ | --- | --- | --- | --- |
154
+ | `native-hook` (default) | `Before Pi's compaction` | Pi | Yes |
155
+ | `settled` | `When idle` | Smart Compact, at an idle boundary | No |
156
+ | `background` | `Prepare in background` | Smart Compact; also prepares early | No |
157
+
158
+ Rules that hold for all strategies:
159
+
160
+ - `autoTrigger: false` disables **both** `settled` and `background`, and
161
+ `native-hook` replacement. It does not disable Pi's own compactor. Changing
162
+ the strategy never turns a disabled trigger back on.
163
+ - All strategies use Pi's normal compaction lifecycle. A summary is committed
164
+ only when Pi confirms the matching compaction.
165
+ - `requireApproval` applies to manual runs only.
166
+
167
+ ### native-hook: passive
168
+
169
+ Smart Compact acts only when Pi starts a compaction. `minContextPercent` is a
170
+ **replacement gate**, not a schedule: below it, Smart Compact lets Pi's own
171
+ summary run. Overflow recovery skips the percentage gate. Extensions cannot read
172
+ whether Pi's auto-compaction is enabled, so readiness reports it as `unknown`,
173
+ not as on. If it is off, nothing compacts automatically.
174
+
175
+ ### settled: idle boundary
176
+
177
+ At the next idle, queue-empty boundary where context is at least
178
+ `minContextPercent` of the active model's window (and at least 5,000 tokens),
179
+ Smart Compact asks Pi to compact. A running tool loop is not interrupted. After
180
+ any confirmed compaction there is a 10-minute cooldown. Pi's own threshold and
181
+ overflow triggers stay active.
182
+
183
+ ### background: early preparation
184
+
185
+ Like `settled`, but a summary is prepared earlier, on a completed turn's
186
+ snapshot, without adding a tool call or blocking the next turn. Preparation
187
+ hides latency, not cost: an unused summary still spends its model budget.
188
+
189
+ | Item | Value |
190
+ | --- | --- |
191
+ | Prepare gate | `prepareContextPercent`; must be 0–100 and strictly below `minContextPercent` |
192
+ | `prepareContextPercent: null` (Auto) | Starts 12.5% of the apply-token threshold earlier, bounded to 8,192–32,000 tokens |
193
+ | Concurrency | One speculative task per extension |
194
+ | Retry cooldown | 10 minutes |
195
+ | Ready result lifetime | 5 minutes |
196
+ | Context hygiene | Pressure-gated trims run under this strategy even if `contextHygieneEnabled` is off (needs active `smart_context`); break-even and cold-cache trims need `contextHygieneEnabled` |
197
+
198
+ Example: with `prepareContextPercent: 60` and `minContextPercent: 70` in a 200k
199
+ window, preparation starts at 120k and applies at 140k. With Auto and an 80%
200
+ apply gate in a 200k window, preparation starts at 140k (160k minus a 20k lead).
201
+
202
+ At apply, the prepared summary is revalidated against session, branch,
203
+ projected content, model, configuration, target and response headroom. A
204
+ changed, expired or unfinished preparation is discarded, and Smart Compact
205
+ falls back to a normal run or Pi's own compactor. New messages after the
206
+ snapshot stay verbatim. When cleanup changes the context first, preparation
207
+ waits for a later boundary. Preparation is silent while healthy; its state
208
+ appears in the effective-state view (`Readiness & details`, preflight `S`,
209
+ `metrics`).
210
+
211
+ ### Context cap for automatic percentages
212
+
213
+ `maxContextTokens` (default `0`, off) caps the window that automatic trigger
214
+ percentages are measured against: `min(model window, maxContextTokens)`. It
215
+ applies to the `native-hook` replacement gate, the `settled` trigger, the
216
+ `background` preparation window and the automatic run's admission gate. With
217
+ `maxContextTokens: 200000` and `minContextPercent: 60`, a 1M-window model
218
+ compacts from 120k tokens instead of 600k.
219
+
220
+ It does not change model requests, the model window Pi reports, Pi's own
221
+ compaction threshold, summary and retention sizing, or the hard response
222
+ headroom checked before a summary is applied; those keep the real window. A
223
+ cap at or above the model window has no effect. When a model window exceeds
224
+ 400k tokens and no smaller cap is set, Home shows a warning while automatic
225
+ compaction is on.
226
+
227
+ ### Automatic runs cap
228
+
229
+ Automatic runs (native-hook, settled and background) are capped at **60
230
+ seconds** and **four model calls**. `autoTriggerTimeoutMs` defaults to 120,000
231
+ ms and accepts up to 300,000 ms, but the effective automatic deadline is
232
+ `min(autoTriggerTimeoutMs × provider timeout multiplier, 60 s)`. The call cap is
233
+ `min(mode call budget, 4)`. When an automatic run times out or fails, it unwinds
234
+ so Pi's own compactor can run.
235
+
236
+ Manual runs are not subject to this cap; they use `maxLatencyMs` (default: no
237
+ limit) and the mode budgets below.
238
+
239
+ ## Modes and budgets
240
+
241
+ | Mode | Calls | Prompt tokens | Output tokens | Summary budget | Recent tail kept raw | Context target | Explore / LLM repair |
242
+ | --- | ---: | ---: | ---: | ---: | ---: | ---: | --- |
243
+ | `fast` | 3 | 100K | 20K | 3K | 10K | 30% | No / No |
244
+ | `balanced` | 6 | 200K | 40K | 6K | 20K | 40% | No / No |
245
+ | `thorough` | 8 | 300K | 80K | 10K | 30K | 50% | Yes / Yes |
246
+
247
+ - `auto` (default) is a selector, not a fourth policy. At 85% context or above
248
+ it picks `fast`. Otherwise it picks by extracted session risk: many
249
+ unresolved errors, decisions, constraints and modified files push toward
250
+ `thorough`, a simple session toward `fast`.
251
+ - `fast` can build the summary with no model call (`Local summaries`,
252
+ `zeroCallEnabled`) when extraction confidence is high.
253
+ - The mode's token target is binding. Recent turns stay raw only if they fit
254
+ the planned tail.
255
+ - The summary and tail sizes come from the profile each mode uses (`fast` →
256
+ `aggressive`, `balanced` → `balanced`, `thorough` → `light`). Change them in
257
+ `Advanced › Limits › Mode budgets` (`profiles`), which lists them by mode:
258
+ `Fast`, `Balanced`, `Thorough`. `auto` uses the budgets of the mode it picks
259
+ for the run.
260
+
261
+ ### How a budget is chosen
262
+
263
+ For calls (`maxLlmCalls`) and prompt tokens (`maxLlmInputTokens`):
264
+
265
+ | Source | Result |
266
+ | --- | --- |
267
+ | Per-run option (`--max-calls`, `max_calls`, ...) | Used as given, even above the mode limit |
268
+ | Config value `0` | The mode limit |
269
+ | Config value above `0` | `min(config value, mode limit)` |
270
+ | Automatic run | Additionally capped at 4 calls and 60 s |
271
+
272
+ With the default `maxLlmCalls: 8`, every mode keeps its own limit, because 8 is
273
+ not below any mode's call limit. A config value can only lower the limit.
274
+
275
+ Per-run options accept narrower ranges than the settings:
276
+
277
+ | Budget | Per-run option | Setting |
278
+ | --- | --- | --- |
279
+ | Calls | `--max-calls` / `max_calls`: 1–100 | `maxLlmCalls`: 0–100 |
280
+ | Prompt tokens | `--max-input-tokens` / `max_input_tokens`: 10,000–1,000,000 | `maxLlmInputTokens`: 0–1,000,000 |
281
+ | Deadline (ms) | `--max-latency` / `max_latency_ms`: 5,000–600,000 | `maxLatencyMs`: 0 or 5,000–7,200,000 |
282
+
283
+ Running out of calls or tokens falls back to a deterministic summary. A deadline
284
+ or cancellation stops the run: no staged summary, no apply, and a manual
285
+ timeout does not start Pi's compactor.
286
+
287
+ ### Provider capability guards
288
+
289
+ - Every request is clamped to the model's advertised output limit before it is
290
+ reserved and sent. 4,096 tokens of SDK headroom are also reserved.
291
+ - The model picker and readiness check planned stage requests against each
292
+ model's window. Models that cannot fit are unavailable with a reason. Sizes
293
+ known only after generation are rechecked before each request.
294
+ - ChatGPT/Codex subscription endpoints reject output-limit fields. Smart
295
+ Compact uses a client-side per-call watchdog (`codexMaxCallMs`; `0` derives
296
+ 15–90 s) and a streamed-output ceiling instead. This is not a hard provider
297
+ limit.
298
+ - Missing or partial provider usage is estimated conservatively.
299
+
300
+ ### Legacy `profile`
301
+
302
+ `profile` (`light`, `balanced`, `aggressive`) is a legacy setting with no
303
+ settings-screen row; `Mode` is the only selector. It selects the mode only when
304
+ `mode` is absent from `settings.json` (`light` → `thorough`, `balanced` →
305
+ `balanced`, `aggressive` → `fast`); the `Mode` row then notes that its current
306
+ value comes from the legacy setting. Once `mode` is saved, including `auto`,
307
+ each mode uses its own profile and `profile` does not change runs. Saving or
308
+ resetting `Mode` never rewrites `profile` or the `profiles` budgets.
309
+
310
+ ## Models and reasoning
311
+
312
+ | Stage | Key | TUI label | Default |
313
+ | --- | --- | --- | --- |
314
+ | Synthesis and assembly | `summaryModel` | `Summary model` | The chat model |
315
+ | Explore / topic split | `segmentationModel` | `Topic split model` | The summary model |
316
+ | Verification repair | `verificationModel` | `Check & repair model` | The summary model |
317
+
318
+ Model values are `provider/model` strings. Manual, agent and automatic runs use
319
+ the same routes. Choosing a summary model never switches the chat model.
320
+
321
+ | Key | TUI label | Default | Values |
322
+ | --- | --- | --- | --- |
323
+ | `summaryThinkingLevel` | `Summary thinking` | `minimal` | `minimal`, `low`, `medium`, `high`, `xhigh`, `max`, or `null` (provider default) |
324
+ | `segmentationThinkingLevel` | `Topic split thinking` | `minimal` | Same |
325
+
326
+ `summaryThinkingLevel` covers synthesis, assembly and repair. Both default to
327
+ `minimal` because reasoning tokens add up over multi-call compaction. An
328
+ explicit call-level reasoning option takes precedence.
329
+
330
+ Choosing a route based on evidence is covered in
331
+ [provider routing evidence](./evaluation.md#provider-routing-evidence).
332
+
333
+ ## Compaction engines
334
+
335
+ `compactionEngines` is an ordered, non-empty list of unique engines. Engines are
336
+ tried in order; the first success applies. If none succeeds, the conversation is
337
+ unchanged and one message lists every outcome.
338
+
339
+ | `Engine` label | `compactionEngines` |
340
+ | --- | --- |
341
+ | `Smart summary` (default) | `["eesv"]` |
342
+ | `Provider, then smart summary` | `["native", "eesv"]` |
343
+ | `Provider only` | `["native"]` |
344
+ | `Smart summary, then provider` | `["eesv", "native"]` |
345
+
346
+ `eesv` is the verified text summary. `native` is the provider's own compaction
347
+ (Anthropic Messages, OpenAI Codex subscription and OpenAI Responses API key
348
+ only). It is unverified and replayed only to the same provider and model;
349
+ summarizer routing does not apply to it. See the
350
+ [user guide](./guide.md#summary-format-provider-compaction-and-images) for
351
+ limits. For subscription users, `Provider, then smart summary` is the safer
352
+ choice because a rejected provider request falls back to the smart summary.
353
+
354
+ ## Context hygiene and archives
355
+
356
+ All three switches are off by default. Automatic trimming and offload run only
357
+ while the model can reach `smart_context`: active, or loadable through
358
+ `smart_tools` in On demand mode. With agent tools `off`, or `smart_context`
359
+ hidden with `/tools`, new automatic trims and offloads stop; existing archives
360
+ stay on disk and manual `/smart-compact trim` still works.
361
+
362
+ | Key | TUI label | Default | Effect |
363
+ | --- | --- | --- | --- |
364
+ | `contextHygieneEnabled` | `Automatic cleanup` | `false` | Batched, recoverable trimming. Needs 16,384 characters of net savings and eight assistant turns since the last trim, rewind or compaction; commits under pressure, at break-even, or once the prompt cache is cold (below). Works with `autoTrigger: false`. |
365
+ | `artifactOffloadEnabled` | `Offload huge outputs` | `false` | Saves eligible read-only text results of 16,384+ characters before the model sees them. Independent of pressure gates. |
366
+ | `visualArchiveEnabled` | `Image snapshots` | `false` | Experimental image snapshots beside the verified text. Adds image tokens; needs a vision model with a validated cost rule and the optional `@resvg/resvg-js` component (not installed with the extension; `Readiness & details` shows the install command). Without it, output falls back to text. |
367
+ | `pinPaths` | `Always-kept files` | `[]` | Paths every summary must keep |
368
+
369
+ ### Fixed hygiene limits
370
+
371
+ These limits are not configurable. Behavior and examples are in the guide's
372
+ [Clean up tool output](./guide.md#clean-up-tool-output).
373
+
374
+ | Item | Limit |
375
+ | --- | --- |
376
+ | Trim per boundary | At most 32 outputs of 4,096+ characters; the latest four assistant turns stay |
377
+ | Trimmed output types | Successful text from read-only tools, shell (`bash`) output whose call stays in context, and `smart_context` `read` pages (their markers point back at the source ID). Errors, writes, unknown tools and mixed turns stay whole. |
378
+ | Digest marker | At most 6 lines and 400 characters: retrieval line, call subject, first output line, up to three error/warning lines |
379
+ | Order within the 32 | Read-only outputs whose path a later call writes, edits or deletes; then those read again in full later (a plain `read` without `offset`/`limit`); then the rest, each in session order. Markers note `(superseded: edited later)` or `(superseded: read again in full later)`. Paths compare after `path.normalize` only (relative never matches absolute). This changes order and the note, not eligibility. |
380
+ | Integrity | Trim and rewind records store a SHA-256 and length of each archived output; `smart_context` `read`/`search` refuse text that no longer matches. Records from earlier versions have no hash and are read as before. |
381
+ | Automatic cleanup batch | At least 16,384 characters of net savings and eight assistant turns since the last trim, rewind or compaction |
382
+ | Offload | Read-only text results of 16,384+ characters; each artifact at most 2 MiB; at most 256 files or 32 MiB per origin session, after which new offloads stop |
383
+ | Retrieval | At most 4,096 characters per `read` |
384
+ | `scope: "lineage"` | Follows `parentSession` headers (handoff or fork) at most 3 levels, reads only files of at most 64 MiB, stops at a missing file or a cycle, and never writes them. Search limits apply across all sessions, active branch first. |
385
+ | Artifact retention | No expiry or garbage collection; see [storage](./guide.md#storage-and-privacy) |
386
+
387
+ ### Automatic trim timing
388
+
389
+ Let `X` be the estimated tokens a batch removes (net of its markers) and `T`
390
+ the estimated tokens of every message from the first trimmed output to the
391
+ end, the part of the prompt cache a trim rewrites. With the active model's
392
+ catalog prices, `r = cacheRead / input` and `w = cacheWrite / input` (`w = 1`
393
+ when no write price is listed). The trim pays back after
394
+ `N* = ((w - r) × T) / (r × X)` further requests (`0` when cache reads are
395
+ free).
396
+
397
+ At a completed turn boundary a ready batch commits with cause:
398
+
399
+ - `pressure` when usage reached the early pressure gate;
400
+ - `break-even` when `N* ≤ 24`;
401
+ - `cold` otherwise, after waiting. The batch is held (`smart_context`
402
+ `status` reports it as `deferredTrim`). The first request after the cache
403
+ expired (5 minutes after the last response, 1 hour when the last response
404
+ that wrote cache reported 1h retention) sends the trimmed messages, later
405
+ requests keep them, and the edits commit at the next completed, uncontested
406
+ turn.
407
+
408
+ An unknown price only allows `pressure` and `cold`. Manual and agent trims
409
+ commit at the next boundary as before (causes `manual`, `agent`).
410
+
411
+ A Pi cache-warming refresh counts as a response for this expiry. While a
412
+ batch is held, warming stops once
413
+ `p × (missCost − w' × X / 1e6) − warmCost < $0.05` (Pi's own rule, with the
414
+ miss cost net of the removed output's cache write; `w'` is the cache-write
415
+ price per million tokens, or the input price when none is listed).
416
+
417
+ A newer compaction, context edit, session change, queued manual/agent request,
418
+ or turning `contextHygieneEnabled` off drops the held batch. Prices are
419
+ catalog ratios, not measured cache behavior.
420
+
421
+ ## Agent tools and session navigation
422
+
423
+ Settings → **Agent tools & navigation**.
424
+
425
+ | Key | TUI label | Default | Effect |
426
+ | --- | --- | --- | --- |
427
+ | `toolLoading` | `Agent tools` | `lazy` | `lazy` (On demand): the agent sees the `smart_tools` loader and loads the `navigation`, `history`, `memory` or `compaction` group when needed; loaded groups reset at session start, branch change and compaction. `eager` (Always available): every permitted tool is active from the start. `off`: no context tools; Home, `/smart-compact` and the navigation panel keep working. |
428
+ | `contextNavigationEnabled` | `Session navigation` | `true` | Anchors, search and returning to an anchor. Off hides the panel and `smart_navigation`; recorded anchors and the keys below are kept. |
429
+ | `contextRecallEnabled` | `Search other sessions` | `true` | Read-only search of anchors saved by earlier sessions, this project by default. |
430
+ | `contextPivotEnabled` | `Return to an anchor` | `true` | Returning to an anchor on a new branch with a required carryover. |
431
+ | `contextAnchorCacheEnabled` | `Anchor prompt cache` | `true` | Anthropic models: keeps a prompt-cache marker on the newest anchor. |
432
+ | `contextAnchorStatusEnabled` | `Anchor status` | `true` | Shows the newest anchor on this branch in Pi's footer; display only. |
433
+ | `contextGuidanceEnabled` | `Navigation guide` | `true` | Lets you or the agent open the navigation guide on request; it is never added to a request otherwise. |
434
+
435
+ Group permissions apply in both `lazy` and `eager` modes: `compaction` follows
436
+ `agentToolAccess`, `memory` needs `contextGraphEnabled` or a non-local
437
+ `memoryBackend`, and `navigation` needs `contextNavigationEnabled`. Tools hidden
438
+ with Pi's `/tools` stay hidden until you show them again.
439
+
440
+ ## Memory
441
+
442
+ | Key | TUI label | Default | Notes |
443
+ | --- | --- | --- | --- |
444
+ | `contextGraphEnabled` | `Project memory` | `true` | Local store: index verified compaction state and enable recall/save. Explicit Hindsight/Mnemopi stores keep their tools with this off. |
445
+ | `memoryBackend` | `Memory store` | `local` | `local` (`This machine`), `hindsight` (`Hindsight server`), `mnemopi` (`Mnemopi (local SQLite)`; needs the optional `@oh-my-pi/pi-mnemopi` component and Bun 1.3.14+ on `PATH` or the optional `bun` component — `Readiness & details` shows the install command, see [Optional components](../README.md#optional-components)) |
446
+ | `hindsightBaseUrl` | `Server URL` | `null` | HTTPS, no credentials, query or fragment; plain HTTP only for loopback |
447
+ | `hindsightBankId` | `Memory bank` | `null` | Required; 1–128 letters, digits, `.`, `_`, `-`, starting with a letter or digit; never guessed |
448
+ | `hindsightApiKeyEnv` | `API key variable` | `null` | Name of the environment variable holding the key, not the key: 1–128 uppercase letters, digits and `_`, not starting with a digit |
449
+ | `hindsightTimeoutMs` | `Request timeout (ms)` | `12000` | 1,000–60,000 |
450
+ | `hindsightRecallMaxTokens` | `Recall size (tokens)` | `2048` | 128–4,096; output is also capped locally |
451
+ | `mnemopiDataDir` | `Mnemopi data folder` | `null` | Absolute or `~/` path; relative paths rejected. Default `~/.pi/agent/smart-compact-memory/mnemopi/<projectId>/` |
452
+
453
+ Selection rules:
454
+
455
+ - The selected store is the only store read or written. There is no fallback
456
+ to another store and no local copy; `hindsightLocalFallback` is gone.
457
+ - `scope: "session"` recall is supported only by `local`. On Hindsight and
458
+ Mnemopi it fails closed: nothing is read from any store.
459
+ - Switching stores leaves the others untouched. Refs stay bound to the store
460
+ and target where they were created.
461
+ - Continuity state, backups and artifacts do not depend on the memory store.
462
+ - Memory readiness never blocks compaction.
463
+
464
+ Hindsight setup, data flow and troubleshooting:
465
+ [Hindsight memory backend](./hindsight-memory.md).
466
+
467
+ ## Privacy and backups
468
+
469
+ | Key | TUI label | Default | Notes |
470
+ | --- | --- | --- | --- |
471
+ | `scrubSecrets` | `Scrub secrets` | `true` | High-confidence credential redaction before anything is sent or saved |
472
+ | `scrubPii` | `Scrub personal data` | `false` | Email, phone and card-shaped values |
473
+ | `backupEnabled` | `Backups` | `true` | Prepare a scrubbed backup; written only after Pi confirms the compaction |
474
+ | `backupDir` | `Backup folder` | `""` | Empty uses `~/.pi/agent/compact-backups` |
475
+ | `requireApproval` | `Ask before applying` | `true` | Manual review; only `A` applies. Cancel or error leaves the conversation unchanged. |
476
+
477
+ ## All settings
478
+
479
+ | Key | Type or range | Default | TUI label |
480
+ | --- | --- | --- | --- |
481
+ | `mode` | `auto` \| `fast` \| `balanced` \| `thorough` | `auto` | `Mode` |
482
+ | `profile` | `light` \| `balanced` \| `aggressive` | `balanced` | none (legacy; see [Legacy `profile`](#legacy-profile)) |
483
+ | `profiles` | per-profile numeric overrides | built-in | `› Mode budgets` |
484
+ | `summaryModel` | `provider/model` \| `null` | `null` | `Summary model` |
485
+ | `segmentationModel` | `provider/model` \| `null` | `null` | `Topic split model` |
486
+ | `verificationModel` | `provider/model` \| `null` | `null` | `Check & repair model` |
487
+ | `summaryThinkingLevel` | level \| `null` | `minimal` | `Summary thinking` |
488
+ | `segmentationThinkingLevel` | level \| `null` | `minimal` | `Topic split thinking` |
489
+ | `agentToolAccess` | `inherit` \| `enabled` \| `disabled` | `inherit` | `Agent can compact` |
490
+ | `toolLoading` | `lazy` \| `eager` \| `off` | `lazy` | `Agent tools` |
491
+ | `autoTrigger` | boolean | `true` | `Automatic compaction` |
492
+ | `autoTriggerStrategy` | `native-hook` \| `settled` \| `background` | `native-hook` | `Start when` |
493
+ | `minContextPercent` | 0–100 | `60` | `Start at context %` |
494
+ | `prepareContextPercent` | `null` or 0–100, below `minContextPercent` | `null` | `Prepare at context %` |
495
+ | `maxContextTokens` | `0` (off) or integer 16,384–2,000,000 | `0` | `Context cap for start % (tokens)` |
496
+ | `autoTriggerTimeoutMs` | integer 1,000–300,000 | `120000` | `Automatic run time limit (ms)`; capped at 60 s |
497
+ | `compactionEngines` | ordered list of `eesv`, `native` | `["eesv"]` | `Engine` |
498
+ | `requireApproval` | boolean | `true` | `Ask before applying` |
499
+ | `showStatus` | boolean | `true` | `Footer status` |
500
+ | `maxLlmCalls` | integer 0–100 | `8` | `Max model calls per run` |
501
+ | `maxLlmInputTokens` | integer 0–1,000,000 | `0` (mode limit) | `Max input tokens per run` |
502
+ | `maxLatencyMs` | `0` or integer 5,000–7,200,000 | `0` (no limit) | `Run time limit (ms)` |
503
+ | `codexMaxCallMs` | `0` or integer 5,000–3,600,000 | `0` (auto 15–90 s) | `Stuck-call timeout (ms)` |
504
+ | `pendingTtlMs` | integer 1,000–3,600,000 | `300000` | `Prepared summary lifetime (ms)` |
505
+ | `contextHygieneEnabled` | boolean | `false` | `Automatic cleanup` |
506
+ | `artifactOffloadEnabled` | boolean | `false` | `Offload huge outputs` |
507
+ | `visualArchiveEnabled` | boolean | `false` | `Image snapshots` |
508
+ | `pinPaths` | string array | `[]` | `Always-kept files` |
509
+ | `contextNavigationEnabled` | boolean | `true` | `Session navigation` |
510
+ | `contextRecallEnabled` | boolean | `true` | `Search other sessions` |
511
+ | `contextPivotEnabled` | boolean | `true` | `Return to an anchor` |
512
+ | `contextAnchorCacheEnabled` | boolean | `true` | `Anchor prompt cache` |
513
+ | `contextAnchorStatusEnabled` | boolean | `true` | `Anchor status` |
514
+ | `contextGuidanceEnabled` | boolean | `true` | `Navigation guide` |
515
+ | `scrubSecrets` | boolean | `true` | `Scrub secrets` |
516
+ | `scrubPii` | boolean | `false` | `Scrub personal data` |
517
+ | `backupEnabled` | boolean | `true` | `Backups` |
518
+ | `backupDir` | string | `""` | `Backup folder` |
519
+ | `contextGraphEnabled` | boolean | `true` | `Project memory` |
520
+ | `memoryBackend` | `local` \| `hindsight` \| `mnemopi` | `local` | `Memory store` |
521
+ | `hindsightBaseUrl` | URL \| `null` | `null` | `Server URL` |
522
+ | `hindsightBankId` | string \| `null` | `null` | `Memory bank` |
523
+ | `hindsightApiKeyEnv` | env var name \| `null` | `null` | `API key variable` |
524
+ | `hindsightTimeoutMs` | integer 1,000–60,000 | `12000` | `Request timeout (ms)` |
525
+ | `hindsightRecallMaxTokens` | integer 128–4,096 | `2048` | `Recall size (tokens)` |
526
+ | `mnemopiDataDir` | absolute or `~/` path \| `null` | `null` | `Mnemopi data folder` |
527
+ | `focusWeighting` | boolean | `true` | `Prioritize current task` |
528
+ | `zeroCallEnabled` | boolean | `true` | `Local summaries` |
529
+ | `onlineDamageMonitor` | boolean | `true` | `Watch for lost details` |
530
+ | `adaptiveDamageFeedback` | boolean | `false` | `Learn from lost details` |
531
+ | `telemetryChannel` | `stable` \| `canary` | `stable` | `Metrics tag`; local only, see [telemetry and canary gates](./evaluation.md#telemetry-and-canary-gates) |
532
+
533
+ Notes on specific keys:
534
+
535
+ - `minContextPercent` is relative to the **active model's** window, or to
536
+ `maxContextTokens` for automatic runs when that is smaller. It is the
537
+ apply gate for automatic and agent runs and the replacement gate for
538
+ `native-hook`. Manual `/smart-compact` shows a warning and ignores it. A
539
+ 5,000-token floor always applies.
540
+ - `pendingTtlMs` is how long a summary returned to Pi waits for Pi's matching
541
+ compaction confirmation. It does not change the fixed 5-minute window in
542
+ which a summary staged by the `smart_compact` tool must be applied with
543
+ `/compact`, or the 5-minute lifetime of a background preparation.
544
+ - `showStatus` adds a footer note only when compaction is manual-only or
545
+ disabled. Nothing is shown while healthy, and background preparation is not
546
+ shown in the footer.
547
+ - `agentToolAccess: "inherit"` (`Follow Pi`) respects Pi's `/tools`, host
548
+ allowlists and other extensions. Manual `/smart-compact` works regardless.
549
+
550
+ `profiles` accepts, per profile (`light` for `thorough`, `balanced` for
551
+ `balanced`, `aggressive` for `fast`; `› Mode budgets` shows them by mode):
552
+
553
+ | Field | Range | `light` (Thorough) | `balanced` (Balanced) | `aggressive` (Fast) |
554
+ | --- | --- | ---: | ---: | ---: |
555
+ | `summaryBudgetTokens` | 256–100,000 | 10,000 | 6,000 | 3,000 |
556
+ | `keepRecentTokens` | 1,000–500,000 | 30,000 | 20,000 | 10,000 |
557
+ | `minChunkTokens` | 100–100,000 | 800 | 500 | 300 |
558
+ | `maxChunkTokens` | 500–200,000 | 12,000 | 8,000 | 6,000 |
559
+ | `singlePassMaxTokens` | 1,000–500,000 | 40,000 | 30,000 | 20,000 |
560
+ | `batchMaxTokens` | 1,000–500,000 | 30,000 | 24,000 | 18,000 |
561
+
562
+ ## Legacy and removed keys
563
+
564
+ | Key | Behavior |
565
+ | --- | --- |
566
+ | `semanticCompact` (root key) | Read when `smartCompact` is absent |
567
+ | `agentToolEnabled` | Converted to `agentToolAccess` (`enabled`/`disabled`) with a warning |
568
+ | `mode: "aggressive"` | Converted to `fast` with a warning |
569
+ | `hindsightLocalFallback` | Removed; reported as stale and ignored |
570
+
571
+ ## Examples
572
+
573
+ Cleanup and offload without automatic compaction, with every permitted tool
574
+ visible to the agent from the start:
575
+
576
+ ```json
577
+ {
578
+ "smartCompact": {
579
+ "autoTrigger": false,
580
+ "toolLoading": "eager",
581
+ "contextHygieneEnabled": true,
582
+ "artifactOffloadEnabled": true
583
+ }
584
+ }
585
+ ```
586
+
587
+ Human-only session navigation, with no context tools shown to the agent:
588
+
589
+ ```json
590
+ {
591
+ "smartCompact": {
592
+ "toolLoading": "off",
593
+ "contextNavigationEnabled": true
594
+ }
595
+ }
596
+ ```
597
+
598
+ Automatic compaction that does not depend on Pi's auto-compaction (the
599
+ `Fully automatic` preset):
600
+
601
+ ```json
602
+ {
603
+ "smartCompact": {
604
+ "autoTrigger": true,
605
+ "autoTriggerStrategy": "settled",
606
+ "contextHygieneEnabled": true,
607
+ "agentToolAccess": "disabled"
608
+ }
609
+ }
610
+ ```
611
+
612
+ Background preparation with explicit gates and a separate summary model:
613
+
614
+ ```json
615
+ {
616
+ "smartCompact": {
617
+ "autoTrigger": true,
618
+ "autoTriggerStrategy": "background",
619
+ "prepareContextPercent": 60,
620
+ "minContextPercent": 70,
621
+ "summaryModel": "anthropic/claude-sonnet-4-6",
622
+ "summaryThinkingLevel": "high",
623
+ "segmentationThinkingLevel": "low"
624
+ }
625
+ }
626
+ ```
627
+
628
+ Mnemopi project memory in a custom folder:
629
+
630
+ ```json
631
+ {
632
+ "smartCompact": {
633
+ "memoryBackend": "mnemopi",
634
+ "mnemopiDataDir": "~/pi-memory"
635
+ }
636
+ }
637
+ ```