improve(core): require recurrence evidence before extracting skills#25147
improve(core): require recurrence evidence before extracting skills#25147SandyTao520 merged 6 commits intomainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the precision of the skill extraction agent by raising the bar for what constitutes a reusable skill. By requiring evidence of recurrence and durability, the agent is now less likely to create skills from one-off incidents or user-specific preferences, ensuring that only high-value, repeatable workflows are captured. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
Size Change: +2.42 kB (+0.01%) Total Size: 33.6 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new evaluation suite and unit tests for the skill extraction system, while refining the agent's system prompt to prioritize durable, recurring workflows over one-off incidents. Feedback focuses on aligning the test code with repository style guides, specifically regarding the proper management of environment variables using vi.stubEnv and avoiding global state modifications like process.chdir.
| const previousCwd = process.cwd(); | ||
| let config: Awaited<ReturnType<typeof loadCliConfig>> | undefined; | ||
|
|
||
| process.chdir(projectRoot); |
There was a problem hiding this comment.
Modifying the process working directory with process.chdir() is a risky practice in tests as it affects the global state of the process and can cause flakiness in concurrent test runs. Since loadSettings and loadCliConfig both accept a projectRoot or cwd parameter, this global change is redundant and should be avoided.
let config: Awaited<ReturnType<typeof loadCliConfig>> | undefined;
try {
resetSettingsCacheForTesting();|
✅ 59 tests passed successfully on gemini-3-flash-preview. This is an automated guidance message triggered by steering logic signatures. |
5791869 to
a03d564
Compare
|
Re: process.chdir feedback — Intentionally keeping The other two comments (use |
gundermanc
left a comment
There was a problem hiding this comment.
This looks pretty good! Main suggestions are that we:
- Use componentEval() test type instead so we can eliminate a lot of the E2E related boilerplate and indirection.
- Consider following up with more cases over time.
- Ensure we have telemetry and/or logging that can help us detect and produce more evals for cases that don't work well.
| '1. "Is this something a competent agent would NOT already know?" If no, STOP.', | ||
| '2. "Does an existing skill (listed below) already cover this?" If yes, STOP.', | ||
| '3. "Can I write a concrete, step-by-step procedure?" If no, STOP.', | ||
| '4. "Is there strong evidence this will recur for future agents in this repo/workflow?" If no, STOP.', |
There was a problem hiding this comment.
At some point I think it'd help to be able to furnish the agent with quantitative data, like a sqlite DB or index of past sessions vs. making it count.
| '- reuse proven workflows and verification checklists', | ||
| '- avoid known failure modes and landmines', | ||
| '- anticipate user preferences without being reminded', | ||
| '- capture durable workflow constraints that future agents are likely to encounter again', |
There was a problem hiding this comment.
💡 General thought on the system prompt -- this seems very long and very mechanical. Is it LLM generated? I find the LLM generates very structured, sometimes redundant prompts, though it's pretty good at reflecting on pre-written prompts.
I think you might be able to accomplish the same outcome with 1/4th the text and make it a bit easier to reason about. Ideally we have enough evals that we can sort of experiment and see which lines are required.
I'd suggest in a separate PR trying to ask the model to condense this, then tweaking the follow up by hand. If we have enough evals it should be possible to test how the behavior changes.
Replaces the evalTest approach (full CLI subprocess + loadCliConfig) with componentEvalTest (in-process makeFakeConfig + direct startMemoryService). Key changes: - ComponentRig now creates an isolated homeDir and stubs GEMINI_CLI_HOME after auth to isolate storage paths (sessions, skills, extraction state). - ComponentRig.cleanup() calls config.dispose() and vi.unstubAllEnvs(). - Skill extraction evals pass approvalMode: YOLO to auto-approve tool calls (write_file/read_file) in non-interactive mode. - Removes ~100 lines of boilerplate (withRigStorage, waitForExtractionState, loadCliConfig, loadSettings, process.chdir).
gundermanc
left a comment
There was a problem hiding this comment.
Approved with suggestion. There seems to be a compile error.
Summary
Tighten the skill extraction agent's signal gate so it requires evidence of recurrence and durability before writing a skill. Previously, sessions with similar summaries (e.g., two one-off incidents about login debugging) could trigger skill creation. Now the agent defaults to "no skill" and must prove future reuse before proceeding.
Details
Prompt changes (
skill-extraction-agent.ts):Unit test (
skill-extraction-agent.test.ts):Behavioral eval (
skill_extraction.eval.ts):ignores one-off incidents: seeds two incident-response sessions with similar summaries and asserts zero skills are created.extracts a repeated project-specific workflow: seeds two sessions describing the same settings-doc regeneration workflow and asserts the extracted skill contains the correct commands and sections.Related Issues
Closes #18007
How to Validate
npm test -w @google/gemini-cli-core -- src/agents/skill-extraction-agent.test.tsnpm run test -w evals -- skill_extraction.eval.tsPre-Merge Checklist