Ask

From Chanw-research/claude-code-paper-writing · View interactive version

Ask is an AI agent skill from the GitHub repository Chanw-research/claude-code-paper-writing. Ask the wiki a question, retrieve and synthesize relevant pages, optionally crystallize the answer back into the wiki

How to use this skill

Skill file

/ask

Ask a question to the wiki knowledge base. The LLM reads context_brief.md for global context,

retrieves relevant pages, synthesizes an answer with citations. Good answers can be

crystallized back into the wiki — written to outputs/ or as new concept/claim pages —

so exploration compounds like ingestion does.

Inputs

Outputs

Wiki Interaction

Reads

Writes (crystallize mode only)

Graph edges created (crystallize only)

Workflow

Precondition: confirm working directory is the wiki project root (containing wiki/, raw/, tools/).

Set WIKI_ROOT=wiki/.

Step 1: Load Global Context

  1. Read wiki/graph/context_brief.md — get compressed snapshot of wiki's current knowledge (claims, gaps, papers, edges)
  2. Read wiki/graph/open_questions.md — understand known open questions and knowledge gaps
  3. If both are missing, rebuild first:

```bash

python3 tools/research_wiki.py rebuild-context-brief wiki/

python3 tools/research_wiki.py rebuild-open-questions wiki/

```

Step 2: Retrieve Relevant Pages

  1. Read wiki/index.md, match relevant slugs against question keywords
  2. Extract claims and papers semantically related to the question from context_brief.md
  3. Sort by relevance, select top-K pages (K ≤ 15 to avoid exceeding context window)
  4. Read full content of selected pages
  5. If the question involves relationships (e.g. "difference between X and Y"), additionally read edges connecting X and Y from wiki/graph/edges.jsonl

Step 3: Synthesize Answer

  1. Synthesize an answer to the user's question based on collected page content
  2. Answer requirements:
  1. If the question exceeds the wiki's current knowledge, honestly say so and suggest:

Step 4: Assess Crystallize Value

  1. Judge whether the answer is worth writing back to the wiki (make a recommendation even if --crystallize was not specified)
  2. Signals that crystallize is worthwhile:
  1. Signals that crystallize is not worthwhile:
  1. Append a crystallize recommendation at the end of the answer:

```

💡 Crystallize recommendation: [worthwhile / not needed] — [reason]

```

Step 5: Crystallize Back to Wiki (if user confirms or --crystallize was specified)

Choose the crystallize target based on answer content:

Case A — Write to outputs/ (default):

  1. Generate slug: python3 tools/research_wiki.py slug "<query-summary>"
  2. Create wiki/outputs/{query-slug}.md:

```yaml


title: ""

slug: ""

query: "" # original question

source_pages: [] # slugs of all pages cited in the answer

date_created: YYYY-MM-DD


```

Body is the answer content (preserve wikilinks)

  1. Add a graph edge for each cited source page:

```bash

python3 tools/research_wiki.py add-edge wiki/ --from outputs/<slug> --to papers/<source-slug> --type derived_from --evidence "query answer"

```

Case B — Create new concept:

  1. If the answer reveals a new concept: create wiki/concepts/{slug}.md using the CLAUDE.md concept template
  2. maturity: emerging
  3. key_papers: extracted from answer citations
  4. Add graph edges (concept → papers)
  5. Append reverse links to relevant paper pages under ## Related

Case C — Create new claim:

  1. If the answer surfaces a new assertion: create wiki/claims/{slug}.md using the CLAUDE.md claim template
  2. status: proposed (synthesized from query, not direct experimental evidence)
  3. confidence: set initial value based on strength of cited evidence
  4. source_papers: extracted from answer citations
  5. Add graph edges (claim → papers)
  6. Append reverse links to relevant paper pages under ## Related

Step 6: Update Navigation and Graph (crystallize only)

  1. index.md: append new page entries under the appropriate category
  2. log.md:

```bash

python3 tools/research_wiki.py log wiki/ "ask | <question-summary> | crystallized: <target-path>"

```

If not crystallized:

```bash

python3 tools/research_wiki.py log wiki/ "ask | <question-summary> | answer-only"

```

  1. Rebuild derived graph files (only if crystallize created new pages):

```bash

python3 tools/research_wiki.py rebuild-context-brief wiki/

python3 tools/research_wiki.py rebuild-open-questions wiki/

```

Step 7: Report to User

Output a summary including:

Constraints

Error Handling

Dependencies

Tools(via Bash)

Skills(via Skill tool)

Shared References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.