๐Ÿ”ง Where my dotfiles lives in harmony and peace, most of the time

๐Ÿ“ Tighten web-search codex exec output handling

+60 -22
+60 -22
agents/skills/web-search/SKILL.md
··· 1 1 --- 2 2 name: web-search 3 - description: Use when you need fast, headless web search. 3 + description: Generic web search. Use when you need fast, headless web search. 4 4 --- 5 5 6 - # Jina AI Search 6 + # Web Search 7 + 8 + Search the web in a headless and fast way. 7 9 8 - Use Jina AIโ€™s public endpoints to search the web 10 + ## Search Workflow 9 11 10 - ## When to Use 12 + 1. Run the codex exec search 13 + 2. Open or fetch the most relevant pages 14 + 3. Merge, deduplicate, and use the findings accordingly 15 + 4. Repeat if needed 11 16 12 - - You need quick web search results without an API key or browser 13 - - You need readable page content from a URL for summarization or analysis 14 - - You need to access X/Twitter content 17 + ## Codex exec Search 15 18 16 - ## Reference 19 + Use `codex exec` non-interactively and capture only the final assistant message: 17 20 18 - ### Search (s.jina.ai) 21 + ```bash 22 + tmp="$(mktemp)" 23 + err="$(mktemp)" 24 + trap 'rm -f "$tmp" "$err"' EXIT 19 25 20 - ``` 21 - https://s.jina.ai/YOUR_SEARCH_QUERY 26 + if codex -m gpt-5.3-codex-spark exec --skip-git-repo-check --ephemeral \ 27 + --output-last-message "$tmp" \ 28 + "Search the web for: <QUERY>" \ 29 + >/dev/null 2>"$err" 30 + then 31 + cat "$tmp" 32 + else 33 + cat "$err" >&2 34 + exit 1 35 + fi 22 36 ``` 23 37 24 - 1. Search for pages 38 + - Do not use `--json` here. It emits the full event stream and pollutes context 39 + - `--output-last-message` writes the final assistant message to a file 40 + - Codex still writes run metadata and logs to stderr 41 + - Redirect stderr to a temp file and replay it only on failure 42 + - Use `-C <DIR>` when search needs repo context 43 + 44 + Example: 25 45 26 46 ```bash 27 - curl "https://s.jina.ai/jina%20ai%20reader%20usage" 47 + tmp="$(mktemp)" 48 + err="$(mktemp)" 49 + trap 'rm -f "$tmp" "$err"' EXIT 50 + 51 + if codex -m gpt-5.3-codex-spark exec --skip-git-repo-check --ephemeral \ 52 + --output-last-message "$tmp" \ 53 + "Search the web for the latest stable Rust release and cite the best sources" \ 54 + >/dev/null 2>"$err" 55 + then 56 + cat "$tmp" 57 + else 58 + cat "$err" >&2 59 + exit 1 60 + fi 28 61 ``` 29 62 30 - - URL-encode spaces and special characters in the query. 31 - - Output returns search results with titles/snippets/links (plain text). 63 + ## Readable page fetch 32 64 33 - 2. Fetch readable page content 65 + Use `r.jina.ai` to fetch readable text or markdown for specific pages. 34 66 35 67 ```bash 36 - curl "https://r.jina.ai/https://example.com/article" 68 + curl -fsSL "https://r.jina.ai/https://example.com/article" 37 69 ``` 38 70 39 - - Prepend `https://r.jina.ai/` to any HTTP/HTTPS URL. 40 - - Output is readable text/markdown for the target page. 71 + Notes: 41 72 42 - Typical workflow is to: 73 + - Prepend `https://r.jina.ai/` to any HTTP or HTTPS URL 74 + - Output is readable text or markdown for the target page 43 75 44 - 1. Use `s.jina.ai` to discover relevant links. 45 - 2. Use `r.jina.ai` to fetch readable content from those links. 76 + ## Default Behavior 77 + 78 + When asked to search the web: 79 + 80 + - run codex exec search 81 + - fetch the most relevant pages as needed 82 + - use `r.jina.ai` when a readable page view helps 83 + - provide an answer with the best results