|
| 1 | +# Plan: Implement `/learn` Command and `learn.md` Agent |
| 2 | + |
| 3 | +## Objective |
| 4 | +Implement a new `/learn` command and a specialized `learn.md` agent to automate the process of exploring new technologies, experimenting with them, and codifying that knowledge into reusable "skills" within the project. |
| 5 | + |
| 6 | +## Architectural Impact |
| 7 | +- **New Workflow**: Introduces a structured learning lifecycle (Research -> Experiment -> Codify). |
| 8 | +- **Knowledge Management**: Systematically populates `.gemini/skills/` with vetted information and idiomatic examples. |
| 9 | +- **Agent Specialization**: Adds a `learner` agent to the existing suite of specialized agents (`planner`, `researcher`, etc.). |
| 10 | + |
| 11 | +## Step-by-Step Execution |
| 12 | + |
| 13 | + |
| 14 | +### Step 1: Create the Command Definition |
| 15 | + |
| 16 | +Create `.gemini/commands/learn.toml`: |
| 17 | +- **Description**: "Explore and master a new library or topic, generating a permanent project skill." |
| 18 | +- **Prompt**: Direct the agent to initialize the `learn` agent with the provided library/topic name. |
| 19 | + |
| 20 | +### Step 2: Create the Learning Agent |
| 21 | + |
| 22 | +Consult `cli_help` to determine the exact expected structure for a skill. |
| 23 | + |
| 24 | +Create `.gemini/agents/learn.md` with a high-discipline system prompt: |
| 25 | +- **Tools Required**: `google_web_search`, `web_fetch`, `read_file`, `write_file`, `list_directory`, `ask_user`, and the `learner` subagent. |
| 26 | +- **Phase 1: Environment Audit**: Check if the library is already installed (e.g., checking `pyproject.toml`, `package.json`, or using `pip show`). |
| 27 | +- **Phase 2: Research and Mapping**: |
| 28 | + - Use `google_web_search` and `web_fetch` to identify core concepts, API surface, and common patterns. |
| 29 | + - **Survey local source files briefly** to see if the library is already being used or if there are specific integration points. |
| 30 | +- **Phase 3: User Approval (Checkpoint)**: Present a structured "Learning Map" to the user for approval before proceeding. |
| 31 | +- **Phase 4: Grounded Experimentation**: |
| 32 | + - Use the `learner` subagent to write and run small test scripts. |
| 33 | + - Verify "gotchas," performance quirks, and idiomatic usage through actual code execution. |
| 34 | +- **Phase 5: Skill Generation**: |
| 35 | + - Create `.gemini/skills/<skill-name>/SKILL.md` and optional `reference-*.md` files. |
| 36 | + - Populate with a concise reference, common patterns, and links to example scripts. |
| 37 | +- **Phase 6: Asset Management & Cleanup**: |
| 38 | + - Move successful experiment scripts to the skill's assets folder. |
| 39 | + - Delete temporary files and artifacts. |
| 40 | + |
| 41 | +### Step 3: Align with Project Standards |
| 42 | +- Ensure the agent follows idiomatic preferences according to the language/framework/etc, but also aligned with the current project idioms if present. |
| 43 | + |
| 44 | +## Testing Strategy |
| 45 | +1. **Initial Run**: Execute `/learn httpx`. |
| 46 | +2. **Verification of Approval**: Ensure the agent stops and presents a structured "Learning Map" including local context if relevant. |
| 47 | +3. **Skill Validation**: Check that `.gemini/skills/httpx/SKILL.md` is created correctly. |
| 48 | +4. **Asset Check**: Verify that the skill directory contains at least one working example script. |
| 49 | +5. **Cleanliness**: Ensure no temporary experiment files remain in the root directory. |
0 commit comments