Walks CONTEXT.md and CLAUDE.md files from a given folder up to the git root, assembles them into a context bundle via shell redirects (file contents never enter the calling session), then delegates a one-line question to MiniMax M2.7. Token cost to the main session: paths only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5.1 KiB
name, description, user_invocable, allowed-tools
| name | description | user_invocable | allowed-tools |
|---|---|---|---|
| ask-minimax-with-context | Walk CONTEXT.md and CLAUDE.md files from a folder up to the git root, assemble them into a context bundle via shell redirects (contents never enter this session), then delegate a one-line question to MiniMax. Saves context and Anthropic tokens even for simple questions. Usage: /ask-minimax-with-context <folder-path> <question> | true | Read, Write, Bash(ask-minimax-run *), Bash(date *), Bash(rm -f *), Bash(test *), Bash(pwd), Bash(bash *) |
ask-minimax-with-context
/ask-minimax-with-context Skill
Walk CONTEXT.md and CLAUDE.md files from a given folder up to the git root. Assemble them into a context bundle via shell redirects — file contents never appear in this session. Then delegate a one-line question to MiniMax; only a concise answer flows back.
Usage: /ask-minimax-with-context <folder-path> <question>
Example: /ask-minimax-with-context octopus/staging/ Has build 1.4.202 been deployed?
Pre-gathered context
Current date
!date +%Y-%m-%d
Working directory
!pwd
Instructions
Step 0 — Verify profile readiness
test -f ~/.claude-oreillyit-minimax/provider.env && echo "minimax profile: ready" || echo "minimax profile: MISSING"
If MISSING, tell the user the profile is not configured and stop.
Step 1 — Parse arguments
From $ARGUMENTS:
- Path: the first whitespace-delimited token
- Question: everything after the first token
If either is missing, tell the user the correct usage format and stop.
Step 2 — Generate a timestamp
date +%s
Note the integer as TS. Use it as a suffix on all temp files.
Step 3 — Walk the tree and assemble the context bundle
Run the following bash script, substituting the literal values of PATH_ARG (from Step 1) and TS (from Step 2) before executing. Do not use shell variables as placeholders — write the actual values inline.
The script resolves the path to absolute, walks up to the git root collecting CONTEXT.md and CLAUDE.md at each level (deepest first), and shell-redirects each file into the bundle. File contents never appear in stdout — only a summary line is returned.
bash -c '
set -e
path="PATH_ARG"
ts="TS"
bundle="/tmp/ask-minimax-ctx-${ts}.md"
# Resolve to absolute path
case "$path" in
/*) ;;
*) path="$(pwd)/$path" ;;
esac
path="${path%/}"
# Find git root (stop walking here)
git_root=$(git -C "$path" rev-parse --show-toplevel 2>/dev/null || echo "")
[ -z "$git_root" ] && git_root="/"
# Walk from given dir up to git root
dir="$path"
count=0
while true; do
for fname in CONTEXT.md CLAUDE.md; do
fpath="$dir/$fname"
if [ -f "$fpath" ]; then
echo "## Context from: $fpath" >> "$bundle"
echo "" >> "$bundle"
cat "$fpath" >> "$bundle"
echo "" >> "$bundle"
echo "---" >> "$bundle"
echo "" >> "$bundle"
count=$((count + 1))
fi
done
[ "$dir" = "$git_root" ] && break
parent=$(dirname "$dir")
[ "$parent" = "$dir" ] && break
dir="$parent"
done
echo "Bundle assembled: $bundle ($count files)"
'
If the output says (0 files), warn the user that no context files were found and ask whether to proceed with the question only.
Step 4 — Write the prompt file
Use the Write tool to create /tmp/ask-minimax-TS-prompt.txt (replace TS with the actual timestamp integer). Fill in all values — no placeholders in the written file.
You are running in non-interactive (-p) mode. Read the context bundle and answer
the question concisely. Write your full response to the output file specified below.
## Context bundle
Read this file fully before answering: /tmp/ask-minimax-ctx-TS.md
The bundle contains CONTEXT.md and CLAUDE.md files collected from a project directory
tree, deepest-first. Each section is prefixed with "## Context from: <path>" so you
know where each piece of context comes from.
## Question
QUESTION
## Output file
Write your complete response to: /tmp/ask-minimax-TS-result.md
Use the Write tool. Overwrite if it already exists.
## Constraints
- Read the context bundle fully before answering
- Keep your answer concise — this is a focused question, not an open-ended task
- Write the complete result to the output file
- One-line stdout acknowledgement is fine; content goes in the output file
Step 5 — Run the sub-session
Substitute TS with the actual timestamp integer before running:
ask-minimax-run \
--model MiniMax-M2.7 \
--allowedTools "Read,Write" \
--dangerously-skip-permissions \
-p "$(cat /tmp/ask-minimax-TS-prompt.txt)" \
> /tmp/ask-minimax-TS-stdout.txt 2>&1
Show the exit code after it completes.
Step 6 — Collect and present results
- Read
/tmp/ask-minimax-TS-result.mdusing the Read tool - If not found, read
/tmp/ask-minimax-TS-stdout.txtas fallback - Present a concise summary — do not dump the full file into the conversation
- Tell the user the result file path if they want the full output
Step 7 — Clean up
rm -f /tmp/ask-minimax-ctx-TS.md /tmp/ask-minimax-TS-prompt.txt /tmp/ask-minimax-TS-stdout.txt
Keep the result file.