feat(learn): mine agent session histories (opt-in) - #52
Conversation
Add opt-in mining (default off, asked at qr init) that extracts bash/exec commands from Claude, Codex, Pi, omp, and OpenCode histories for the current project into agent_commands. Enable via [learn].mine_agent_history or QR_LEARN_MINE_AGENT_HISTORY.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Review SummaryStatus: 1 Issue Found | Recommendation: Merge (non-blocking suggestion) Overview
Incremental review of Issue Details (click to expand)SUGGESTION
Files Reviewed (5 files)
Fix these issues in Kilo Cloud Previous Review Summaries (2 snapshots, latest commit 5068b3c)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 5068b3c)Status: No Issues Found | Recommendation: Merge The incremental commit
Additional hardening (not flagged previously): Changed files reviewed line-by-line; no new issues found on changed lines. Files Reviewed (3 files changed since 1e6d012)
Previous review (commit 1e6d012)Status: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (11 files)
Reviewed by glm-5.2-short · Input: 27.8K · Output: 23.2K · Cached: 1.3M |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1e6d012c67
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Hold the shared env lock in AI/config tests that mutate process env, snapshot HOME for omp encodings, and tighten mining: exclude parent Codex cwds, redact secret-like tokens, split short cd/&& chains, escape OpenCode LIKE wildcards, and cap Codex sessions after cwd filtering. Co-authored-by: Aanish Bhirud <baanish@users.noreply.github.com>
| match &words[start..] { | ||
| [_, target] => CdNavigation::Target(PathBuf::from(target)), | ||
| [_, option, target] if option == "--" => CdNavigation::Target(PathBuf::from(target)), | ||
| _ => CdNavigation::Invalid, |
There was a problem hiding this comment.
SUGGESTION: parse_cd_navigation only recognises cd <target> and cd -- <target>; every other cd invocation (e.g. POSIX-flagged forms like cd -P /path / cd -L /path, or bare cd) falls into the _ => CdNavigation::Invalid arm.
record_command_scoped breaks the whole chain on Invalid (see line 697), so a mined session line such as cd -P /repo && cargo test is dropped entirely — the useful cargo test is silently skipped instead of being attributed to the resolved workdir. Consider treating recognized cd options (-e, -L, -P) as a no-op (skip the flag, keep scanning the remainder) rather than Invalid-and-break.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Summary
feat/learn-common-commands).qr learn(default off).qr initasks whether to mine coding-agent session histories; stored as[learn].mine_agent_history(override withQR_LEARN_MINE_AGENT_HISTORY).~/.claude/projects/<encoded-path>/*.jsonl~/.codex/sessions/**/*.jsonl(filtered by session cwd)~/.pi/agent/sessions/<encoded-path>/**/*.jsonl~/.omp/agent/sessions/<encoded-path>/**/*.jsonl~/.local/share/opencode/opencode.dbparts for matching sessionsagent_commands(frequency-ranked), may fill empty role fields, and never clobber manifest-derived scripts. Inspection-only noise (ls,git status,cat, …) is filtered out.Test plan
cargo testcargo clippy --all-targets --locked -- -D warningscargo fmt --all -- --checkQR_LEARN_MINE_AGENT_HISTORY=truemines fixture under fakeHOMEqr learnin a project with real Claude/omp sessions → confirmagent_commandsin.qr/profile.json