feat(skills): hierarchical skill optimization and search command#507
feat(skills): hierarchical skill optimization and search command#507dumko2001 wants to merge 2 commits intogoogleworkspace:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 0abc682 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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 significantly enhances the skill management system by introducing a hierarchical structure and a powerful search capability. The changes aim to optimize agent performance by reducing unnecessary context loading and improving the discoverability of specific tools. This refactoring also streamlines the skill generation process and cleans up the repository by removing redundant files. Highlights
Changelog
Activity
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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a hierarchical structure for skills to address context pollution, along with a new gws skills search command for discovery. The changes are extensive, refactoring the skill generation logic and updating numerous skill definition files.
My review has identified a few issues:
- A critical bug in the new
check_links.pyscript that prevents it from correctly identifying most local links. - A high-severity issue in the same script where file encoding is not specified, which could lead to errors on different operating systems.
- A high-severity typo in
.gitignorethat will prevent theskills/directory from being ignored correctly.
I've provided suggestions to fix these issues. The rest of the changes, particularly the refactoring of the Rust code for skill generation and the updates to the markdown files, appear to be correct and consistent with the goals of the pull request.
| docsdir = Path("docs").resolve() | ||
|
|
||
| # regex to find markdown links: [text](path) | ||
| link_regex = re.compile(r'\[.*?\]\(([^http].*?)\)') |
There was a problem hiding this comment.
The regular expression to find links is incorrect. The character set [^http] prevents matching any link that starts with 'h', 't', or 'p'. This will cause the script to miss many local links, such as [link](path/to/file.md), defeating the purpose of the link checker.
The regex should match any path, and then HTTP links should be filtered out inside the loop. After applying the suggested change to this line, you should also add a check for http: and https: links in the loop.
| link_regex = re.compile(r'\[.*?\]\(([^http].*?)\)') | |
| link_regex = re.compile(r'\[.*?\]\((.*?)\)') |
| # Generated | ||
| demo.mp4 | ||
| download.html No newline at end of file | ||
| download.htmlskills/ |
There was a problem hiding this comment.
| files_to_check = list(basedir.rglob("*.md")) + list(docsdir.rglob("*.md")) | ||
|
|
||
| for filepath in files_to_check: | ||
| with open(filepath, 'r') as f: |
There was a problem hiding this comment.
It's best practice to specify the file encoding when opening text files. Without it, the script may fail on systems with a different default encoding (like Windows) if a file contains non-ASCII characters. Please add encoding='utf-8'.
| with open(filepath, 'r') as f: | |
| with open(filepath, 'r', encoding='utf-8') as f: |
Description
This PR implements hierarchical skill optimization to solve the context-pollution problem raised in #82. Instead of loading all 40+ API service skills at once, we now use a "Discovery-First" architecture inspired by Claude and GitHub Copilot.
Key changes:
skills/directory, while granular technical references for individual services/helpers are moved toskills/references/.gws skills search <query>: A new command for semantic/keyword discovery of tools. This allows agents to find the right skill without pre-loading the entire library.gws-shared: Restored all safety rails (zsh expansion, JSON quoting) and added a "Discovery & Search" section.generate-skillsto handle the new hierarchy and update all internal Markdown cross-references automatically.Dry Run Output:
(Since
gws skills searchis a local discovery tool, it does not produce a JSON API request. Here is the command output instead):Checklist:
AGENTS.mdguidelines (no generatedgoogle-*crates).cargo fmt --allto format the code perfectly.cargo clippy -- -D warningsand resolved all warnings.pnpx changeset) to document my changes.