feat(autocomplete): personalise suggestions via accepted-completion history#76
Merged
senamakel merged 8 commits intoMar 30, 2026
Merged
Conversation
Introduces history.rs — a thin persistence layer over the existing local
KV store (MemoryClient::new_local()) that stores every accepted completion
and surfaces them as formatted style examples for in-context learning.
Public API:
- save_accepted_completion(context, suggestion, app_name)
- load_recent_examples(n) → Vec<String>
- list_history(limit) → Vec<AcceptedCompletion>
- clear_history() → usize
Storage: KV namespace "autocomplete", keys "accepted:{ts_ms:018}",
auto-trimmed to 50 entries on each save.
Refs: tinyhumansai#71
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds `mod history` and re-exports the public types/functions so they are accessible from sibling modules (core.rs, ops.rs, schemas.rs). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…mples Three additions to the autocomplete engine: 1. After RPC accept (accept method): fire-and-forget tokio::spawn to save the accepted completion context + suggestion to KV history. 2. After Tab-key accept (try_accept_via_tab): same fire-and-forget save. 3. Before inline_complete() in refresh(): load the 6 most recent accepted completions from history, merge with user's static style_examples (capped at 8 total), and pass as dynamic examples — giving the model in-context personalisation from prior acceptances. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds two new async handler functions and their param/result structs: - autocomplete_history(limit?) → AutocompleteHistoryResult - autocomplete_clear_history() → AutocompleteClearHistoryResult Both delegate to the history module and return via RpcOutcome, following the established pattern of existing autocomplete ops handlers. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds ControllerSchema definitions and handler wiring for the two new RPC methods: openhuman.autocomplete_history and openhuman.autocomplete_clear_history. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds AcceptedCompletion, AutocompleteHistoryResult, and AutocompleteClearHistoryResult interfaces plus two exported async functions (openhumanAutocompleteHistory, openhumanAutocompleteClearHistory) following the existing callCoreRpc pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a new UI section between Settings and Test in the autocomplete settings panel showing accepted completion history: - Scrollable list of entries with timestamp, app name, context tail, and accepted suggestion - Clear History button (red-toned, disabled when empty) - Summary line with entry count - Auto-loads on mount alongside existing settings load Uses local component state only (no Redux) — history is fetched via the new openhumanAutocompleteHistory RPC stub. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Auto-formatted by pre-push hooks — import ordering, line wrapping, and brace style adjustments. No logic changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
autocomplete_history,autocomplete_clear_history) with full controller schema registrationMemoryClientKV infrastructureProblem
inline_complete()call already supportsstyle_examplesfor in-context learning but they were only static (user-configured) — no automatic personalisation existedSolution
history.rsmodule persists each accepted completion (context,suggestion,app_name,timestamp_ms) under KV namespace"autocomplete"with zero-padded timestamp keys for correct ordering, auto-trimmed to 50 entriestokio::spawnsaves the completion — zero latency impact on the acceptance pathrefresh(), the 6 most recent accepted completions are loaded from KV and merged with user's static style examples (capped at 8 total), then passed toinline_complete()— the model sees what this user liked beforeMemoryClient::new_local()is called inline per operation (not stored onAutocompleteEngine) to avoid changing theLazysingleton constructor — matches the established pattern inmemory/ops.rsTesting
cargo check --manifest-path Cargo.toml --bin openhumanprettier --check,eslint,tsc --noEmit,cargo fmt --checkyarn -s compilecargo check --manifest-path app/src-tauri/Cargo.tomlImpact
~/.openhuman/workspaceSQLite — negligible disk footprintBreaking Changes
Related
history.rs, E2E test for history RPC roundtrip🤖 Generated with Claude Code