@@ -50,9 +50,9 @@ I like using a bug tracker that embeds bugs and identities and conversations dir
IMPORTANT: If I ask you to `use np` or `use nasin pali` or some variation, you must completely ignore your built-in TODO tools and follow _nasin pali_ by immediately running the appropriate `np` subcommand and adhering its instructions. If I've asked you to use it, start a session by running `np s`. If I've explicitly asked you to resume, use `np r`. Ask me whether to archive when you're done; do NOT do it on your own. If I haven't asked you to follow _nasin pali_, prefer your built-in tools, if any, and proceed normally.
-## Claude for Quick Questions
+## Use `fish -c 'doc-agent'` for supported doc sets
-Please use `claude --model haiku --allowed-tools "Bash(go doc:*)" --disallowed-tools "Bash(*) Edit Read WebFetch WebSearch Glob Grep NotebookEdit NotebookRead SlashCommand Task Write" -p "Prompt asking for particular information about symbols, modules, workflows, etc.` and variations to enable only particular tools at a time for answering pointed questions that might require reading multiple symbols or module APIs. Encourage Claude to look at particular symbols rather than everything all at once, unless necessary. It should be able to find whatever information you need. Ask individual questions per Claude invocation through your Bash tool in the background, then stop _without_ checking their output. I'll let you know when they're done finding your answer. Make _sure_ to run the command and the background. If Haiku doesn't provide a satisfactory answer, first try again with a better prompt. If still unsatisfactory, try with `--model sonnet` instead.
+`fish -c 'doc-agent'` spawns focused agents to trawl through the docs of specific languages/tools. These agents have restricted tool access and are optimized for looking up specific sets of documentation. List the available doc sets and see its usage with `fish -c 'doc-agent -h'`. Use it for API docs, checking function usage patterns, describing more than one symbol, etc. If you can obtain the docs in one call yourself, do so. Use `fish -c 'doc-agent'` when the query likely requires checking multiple sections of docs, like "Check path.to/module for how to use module.Type in module.method".
# Workflows
@@ -0,0 +1,102 @@
+function doc-agent --description "Invoke Claude as a documentation-focused sub-agent"
+ # Define available docsets
+ set -l available_sets go
+
+ # Docset: go
+ set -l go_tools "go doc"
+ set -l go_allowed_tools "Bash(go doc:*)"
+ # These aren't global because WebFetch might be useful later for
+ # obtaining docs from pages that don't have CLI tooling
+ set -l go_disallowed_tools "Bash(*) Explore Edit Read WebFetch WebSearch Glob Grep NotebookEdit NotebookRead SlashCommand Task Write"
+ set -l go_usage "\
+Looking up Go stdlib, types, functions, methods, interfaces, or third-party \
+package APIs, ask about usage, combining functions from across APIs, etc. For \
+complex questions about i.e. combining modules, specify the -m sonnet model \
+for a higher-quality answer."
+ set -l go_system_prompt "\
+You are a focused documentation agent for Go. Use 'go doc' to look up \
+information about Go packages, types, functions, methods, and other symbols. \
+Look at specific symbols rather than reading entire packages unless necessary \
+to understand context. Answer queries thoroughly. You are disallowed from \
+running any tool but Bash to execute `go doc` subcommands. You _must_ use\
+`go doc` to answer the query and nothing else."
+
+ argparse 'h/help' 's/set=' 'm/model=' -- $argv
+ or return 1
+
+ # Show help if requested
+ if set -q _flag_help
+ echo "Usage: doc-agent -s <set> [-m <haiku|sonnet>] <query>"
+ echo
+ echo "Options:"
+ echo " -s, --set Documentation set to use (required)"
+ echo " -m, --model Model to use: haiku (default) or sonnet"
+ echo " -h, --help Show this help message"
+ echo
+ echo "Available documentation sets:"
+ echo
+
+ for docset in $available_sets
+ set -l tools_var "$docset"_tools
+ set -l usage_var "$docset"_usage
+
+ echo "- $docset"
+ echo " - Allowed tools: $$tools_var"
+ echo " - When to use: $$usage_var" | fold -s -w 78 | sed '1!s/^/ /'
+ echo
+ end
+
+ echo "Tips:"
+ echo "- Encourage looking at specific symbols rather than entire"
+ echo " packages unless context requires it."
+ echo "- If Haiku doesn't provide a satisfactory answer, retry with a"
+ echo " better prompt before escalating to sonnet."
+ echo "- The doc-agent will only have access to its specific"
+ echo " documentation tools; it can't read files, search the web, etc."
+ return 0
+ end
+
+ # Validate required arguments
+ if not set -q _flag_set
+ echo "Error: --set/-s is required" >&2
+ echo "Run 'doc-agent -h' for usage information" >&2
+ return 1
+ end
+
+ # Default model to haiku
+ set -l model haiku
+ if set -q _flag_model
+ set model $_flag_model
+ end
+
+ # Validate model
+ if not contains $model haiku sonnet
+ echo "Error: model must be 'haiku' or 'sonnet'" >&2
+ return 1
+ end
+
+ # Validate docset exists
+ if not contains $_flag_set $available_sets
+ echo "Error: unknown documentation set '$_flag_set'" >&2
+ echo "Run 'doc-agent -h' to see available sets" >&2
+ return 1
+ end
+
+ # Configure the doc set
+ switch $_flag_set
+ case go
+ set allowed_tools $go_allowed_tools
+ set disallowed_tools $go_disallowed_tools
+ set system_prompt $go_system_prompt
+
+ case '*'
+ echo "Error: unknown documentation set '$_flag_set'" >&2
+ return 1
+ end
+
+ claude --model $model \
+ --allowed-tools "$allowed_tools" \
+ --disallowed-tools "$disallowed_tools" \
+ --append-system-prompt "$system_prompt" \
+ -p $argv
+end