skills/docs/worklogs/2025-11-22-create-web-research-skill.org
dan 26a6469604 feat: add web-research skill and automate deployment
Includes:
- New 'web-search' skill
- New 'web-research' skill with multi-backend support (claude, llm, kagi)
- Automated deployment in bin/deploy-skill.sh
- Sops-nix integration for Kagi API key
- Documentation updates
2025-11-23 23:18:32 -08:00

84 lines
3.4 KiB
Org Mode

#+TITLE: Create Web Research Skill and Automate Deployment
#+DATE: 2025-11-22
#+KEYWORDS: web-research, kagi, sops-nix, automation, claude-code, skills
#+COMMITS: 0 (pending)
#+COMPRESSION_STATUS: uncompressed
* Session Summary
** Date: 2025-11-22
** Focus Area: Creating advanced web research capabilities and automating skill deployment.
* Accomplishments
- [X] Created `web-search` skill for quick information retrieval.
- [X] Automated skill deployment in `bin/deploy-skill.sh` (injects config into Nix files).
- [X] Added Antigravity/Global support to deployment script.
- [X] Created `web-research` skill for deep, synthesized research reports.
- [X] Implemented Multi-Backend support for `web-research` (`claude`, `llm`, `kagi`).
- [X] Integrated `sops-nix` for secure Kagi API key management.
- [X] Verified all backends and deployment automation.
* Key Decisions
** Decision 1: Hybrid Backend for LLM
- Context: `llm` CLI tool does not have built-in web search plugins installed.
- Options considered:
1. Install new plugins (risk of environment issues).
2. Use `curl` + `llm` (limited scraping capability).
3. Hybrid: Use `claude` to fetch context, `llm` to synthesize.
- Rationale: Leverages Claude's robust tool access for retrieval while allowing `llm` to use any model for synthesis.
- Impact: Flexible backend that works with existing tools.
** Decision 2: Sops-Nix for Kagi Key
- Context: Kagi API key is sensitive and shouldn't be in plain text env vars permanently.
- Options considered:
1. Manual `export KAGI_API_KEY`.
2. Hardcoded in script (insecure).
3. `sops-nix` secret file.
- Rationale: Aligns with existing infrastructure (`dotfiles` uses sops).
- Impact: Secure, persistent configuration via Nix.
* Problems & Solutions
| Problem | Solution | Learning |
|---------|----------|----------|
| `web_search` param deprecated in Kagi FastGPT | Removed parameter, relied on default behavior | APIs change; always check current docs. |
| `llm` backend verification hung | Increased timeout/patience (it was just slow) | Deep research takes time; progress indicators help. |
| `sudo` restriction for rebuild | Asked user to run rebuild manually | Agent limitations require human-in-the-loop for root ops. |
* Technical Details
** Code Changes
- Total files modified: ~10
- Key files changed:
- `bin/deploy-skill.sh`: Added `inject_nix_config` function.
- `skills/web-research/scripts/research.sh`: Main logic with backend switching.
- `skills/web-research/SKILL.md`: Documentation.
- `AGENTS.md`: Updated with new workflow.
** Commands Used
```bash
# Deploy skill
./bin/deploy-skill.sh web-research
# Run research with Kagi backend
RESEARCH_BACKEND=kagi ./skills/web-research/scripts/research.sh "topic"
```
* Process and Workflow
** What Worked Well
- **Iterative Development**: Started with `web-search`, then `web-research`, then backends.
- **Verification**: Testing each backend (Claude, LLM, Kagi) ensured robustness.
** What Was Challenging
- **Environment Restrictions**: Unable to run `sudo` or install global packages (`googler`), forcing creative solutions (Hybrid backend).
* Context for Future Work
** Next Steps
- Explore `playwright-skill` as a standalone skill for browser automation.
- Add more backends if needed (e.g., Perplexity).
* Session Metrics
- Commits made: 0 (pending)
- Files touched: 69 (scanned)
- Lines added: +13012 (mostly new skill files + logs)