Corgispec Ask
Researchcorgispec-askCorgispec Ask is an Agent Skill for research published in the ricoyudog/Coding_Corgi_flow repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Answer human questions from Obsidian vault using early-stop retrieval with token budget enforcement.
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Inspect the Agent Skill at https://github.com/ricoyudog/Coding_Corgi_flow/blob/HEAD/.claude/skills/molecules/corgispec-ask/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/corgispec-ask, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Answer questions from vault context with budget-aware early-stop retrieval.
Overview
Provides a Q&A channel between humans (via Obsidian) and AI agents. Humans write questions as markdown files in wiki/questions/. The AI answers by searching the vault with a strict retrieval budget, writing answers back into the question file.
Key design principle: answer with minimum context. Stop retrieving as soon as sufficient information is found. This prevents runaway token consumption.
When to Use
- When a human has created a question file in
wiki/questions/withstatus: pending - Via
/corgi-ask wiki/questions/<filename>.mdfor a specific question - Via
/corgi-ask --pendingto process all pending questions in batch
Do not use this skill to create questions (humans do that in Obsidian), initialize memory, or run lint checks.
Preconditions
-
memory/directory exists withsession-bridge.md -
wiki/directory exists withhot.mdandindex.md - At least one question file exists in
wiki/questions/(for single-question mode), or--pendingflag is used
Modes
Mode A: Single Question
Triggered by: /corgi-ask wiki/questions/<filename>.md
Mode B: Batch Pending
Triggered by: /corgi-ask --pending
Steps
1. Determine mode and select question(s)
Context Gate: If session context already contains ALL of: isolation.mode, active changes with worktree paths, current branch
→ Gate passed — SKIP config reading below and proceed to the next step.
Otherwise: read openspec/config.yaml and proceed with discovery.
If a specific file path is provided (Mode A):
- Read the specified question file
- Verify it has
status: pendingin frontmatter - If status is not
pending→ report "Question already answered (status: {status})" and stop
If --pending flag is used (Mode B):
- Scan all
.mdfiles inwiki/questions/(excluding_index.md) - Read each file's frontmatter, collect those with
status: pending - If none found → report "No pending questions found" and stop
- Present the list to the user:
Found N pending questions: 1. <filename> — "<question title or first line>" 2. <filename> — "<question title or first line>" ... Processing in order. - Process each question sequentially using Steps 2-5
2. Parse the question
Read the question file. Extract:
- Question text: from the
## Questionsection - Tags: from frontmatter
tagsfield (used to guide retrieval) - Context hints: any
## Contextsection the human provided
3. Execute early-stop retrieval
Retrieve context using this priority chain. Stop as soon as sufficient context is found to answer the question.
Priority 1: memory/session-bridge.md
↓ (if insufficient)
Priority 2: wiki/hot.md
↓ (if insufficient)
Priority 3: wiki/index.md (scan for relevant domain links)
↓ (if insufficient)
Priority 4: One domain page from wiki/ (follow relevant index link)
↓ (if insufficient)
Priority 5: Second domain page from wiki/ OR a page from docs/
↓ (if insufficient)
Priority 6: A file from specs/ (if question is about requirements)
Budget rules:
- Maximum 2 wiki/domain pages per question (Priorities 4-5)
- Maximum 5 total file reads before answering
- If you reach Priority 6 and still cannot answer → flag as
needs-deep-session
Early-stop decision at each priority level:
- Can I answer the question confidently with what I have? → STOP and answer
- Do I have a strong lead on where the answer is? → Follow that lead (next priority)
- Am I guessing where to look? → STOP and answer with available context, noting uncertainty
4. Write the answer
Update the question file:
- Set frontmatter
status: answeredandanswered: <today's date> - Write the answer in the
## Answersection - Add a
## Sourcessection listing which files were consulted:## Sources - `memory/session-bridge.md` — current session state - `wiki/hot.md` — project pulse
If insufficient context (reached budget limit without confident answer):
- Set frontmatter
status: needs-deep-session - Write a partial answer explaining what is known
- Add a
## Needssection listing what additional information would help:## Needs - Access to `src/auth/` source code - Full reading of `docs/architecture/auth-flow.md` - This question spans 6+ files — requires a dedicated deep session
5. Knowledge writeback
After answering, check if the answer reveals information that should be persisted:
Check for new pitfall:
- Did the answer reveal a common mistake or gotcha?
- If yes → append to
memory/pitfalls.mdActive section with format:- <pitfall description> (source: [[wiki/questions/<filename>]])
Check for architecture insight:
- Did the answer reveal an implicit contract or architectural pattern?
- If yes → append to
wiki/architecture/implicit-contracts.mdwith format:### <Contract Name> - **Rule**: <what must be true> - **Breaks if**: <what happens when violated> - **Source**: [[wiki/questions/<filename>]]
Check for index update:
- If the question and answer cover a topic not yet in
wiki/index.md:- Consider adding a reference (but only if index is under 80 lines)
6. Report results
For Mode A (single question):
## Question Answered
**File**: wiki/questions/<filename>.md
**Status**: answered | needs-deep-session
**Sources consulted**: N files
**Writeback**: <what was written back, or "none">
For Mode B (batch):
## Batch Complete
**Processed**: N questions
**Answered**: M
**Needs deep session**: K
**Writeback actions**: L
| # | Question | Status | Sources |
|---|----------|--------|---------|
| 1 | <title> | answered | 2 files |
| 2 | <title> | needs-deep-session | 5 files |
Question File Format
Questions must follow this structure:
---
type: question
status: pending
created: YYYY-MM-DD
tags: [relevant, topic, tags]
---
# <Question Title>
## Question
<The actual question text. Can be multiple paragraphs.>
## Context
<Optional: additional context the human wants to provide>
## Answer
<Filled by AI — leave empty when creating>
## Sources
<Filled by AI — leave empty when creating>
Valid status values: pending, answered, needs-deep-session
Common Mistakes
- Reading more than 2 wiki pages per question (violates budget)
- Forgetting to check
status: pendingbefore answering (may re-answer) - Writing answers without listing sources (traceability lost)
- Auto-creating questions (only humans create questions in Obsidian)
- Modifying the question text (only add to Answer/Sources/Needs sections)
- Writing back to pitfalls without a source link
- Exceeding 5 total file reads without flagging needs-deep-session