Repository navigation
feat(shortcuts): add built-in /reset shortcut to wipe local runtime state - #1237
Merged
Merged
Conversation
…tate /reset lists the directories it will remove, asks for confirmation, then wipes every project's conversations, history, backups, tmp, artifacts and exports plus the userspace runtime dirs and logs, reusing the RuntimeArtifactDirNames and UserspaceRuntimeDirNames slices. The configured conversation store is deleted for jsonl (default or custom path) and sqlite (db plus WAL sidecars); remote backends are skipped with a notice. The current session is cleared the same way /new does.
This was referenced Sep 18, 2026
edenreich
marked this pull request as ready for review
September 18, 2026 11:54
edenreich
reviewed
Sep 18, 2026
edenreich
reviewed
Sep 18, 2026
edenreich
reviewed
Sep 18, 2026
edenreich
reviewed
Sep 18, 2026
edenreich
reviewed
Sep 18, 2026
Distil past sessions into a markdown report before /reset deletes them: which workflows repeat often enough to deserve a skill, and which tool calls keep failing the same way. Counts and error strings are computed in Go - per-tool totals from telemetry.Aggregate, failed ToolExecutions folded by normalised error across every project's sessions - and only the interpretation is left to one no-tools completion, so the model cannot invent a number. Reports are written to ~/.infer/insights, which /reset deliberately leaves alone, and carved out of the sandbox so the agent can read one back when asked to turn a suggestion into a skill. /reset insights runs the generator and then previews the wipe without deleting anything; /insights [since] runs the same generator on its own. Also fixes long-standing problems in /reset: - /reset confirm needed no preview, so a tab-completed confirm could wipe every project on the machine sight-unseen. It now previews instead, and that preview arms the next confirm for five minutes. - The first removal failure aborted the wipe, leaving the machine half cleared with no record of which half. Every target is now attempted and the failures are joined. - The SQLite file was unlinked while this process held it open, so later writes went to a deleted inode. Rows are now purged through the store's own API first. - The preview listed targets that did not exist. - "Proceed (y/N)?" promised a keypress nothing ever read. - /reset was advertised by /help but only registered when storage was enabled. CustomShortcut.callLLM is lifted to a package-level helper shared with the insights generator.
An empty "## Analysis" section shipped whenever the model returned no content: callLLM handed back a successful empty string. A reasoning model thinks against max_tokens, so it can spend the whole budget and answer with nothing - the same failure judge.go already guards against. callLLM now errors and names the token budget when the finish reason is length, which also covers custom shortcut snippets. The insights budget goes from 2000 to 4000 tokens. Reports now open with YAML frontmatter recording which model wrote the analysis and when: generated, model, infer_version, window_since, sessions, tool_calls, tool_failures, and the full path of every project covered.
/reset confirm left ~/.infer/{telemetry,schedules,run,tts,voice,media}
behind. targets() built its userspace list only from
config.UserspaceRuntimeDirNames, which cannot simply be extended: that list
doubles as the agent's writable-sandbox allowlist via isWithinRuntimeDirs,
so adding these would hand the agent write access to the telemetry store and
the daemon pid/lock files.
Append them in targets() instead. tts, voice and media go through their
config resolvers so a custom output_dir/recordings_dir/media.dir is wiped
too, not just the default path.
edenreich
reviewed
Sep 18, 2026
edenreich
reviewed
Sep 18, 2026
edenreich
reviewed
Sep 18, 2026
Contributor
|
🎉 This PR is included in version 0.203.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #1234
Summary
Adds a built-in
/resetshortcut that wipes all local runtime state so the agent starts as if freshly installed, while preserving configuration. It lists every directory it will remove and asks for a y/N-style confirmation (/reset confirm) before deleting anything. The current session is cleared the same way/newdoes, and remote conversation stores are skipped with a notice instead of an error.Changes
ResetShortcut(internal/presentation/shortcuts/reset.go):/resetpreviews the deletion targets and asks for confirmation; only/reset confirmperforms the wipe.~/.infer/projects/*/:conversations/plus the per-project runtime dirs (history,backups,tmp,artifacts,exports), and under~/.infer/:artifacts,plans,tmp,logs.storage.jsonl.path) or the SQLite database file (storage.sqlite.pathor the default~/.infer/conversations.db, plus its WAL sidecars). Postgres/Redis/D1 get a skip notice instead of an error./newdoes (fresh conversation before the wipe,SideEffectStartNewConversationafter, so the in-memory repo never re-saves the old conversation into the fresh store).config.yaml), custom shortcuts, skills andprojects.jsonare untouched.config.RuntimeArtifactDirNames,config.UserspaceRuntimeDirNames) andstorage.DefaultSQLitePath()so the shortcut reuses them instead of a second hardcoded list.NewMetadataRegistry(backs/helpandinfer shortcuts list) and in the chat TUI registry in the container.reset_test.go: confirm-gated state wipe with config preserved, preview deletes nothing, SQLite db (and WAL sidecars) removed, remote backend skip notice./resetentry in README and docs/shortcuts-guide.md.Notes