Use when you need a deep, topic-focused investigation of repository coverage and maturity (implemented/interface/missing), plus a formalized context pack for LLM/agent reasoning and Socratic dialogue.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Repo Topic Deep Research?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nickgou-nuke-repo-topic-deep-research)
---
name: repo-topic-deep-research
description: Use when you need a deep, topic-focused investigation of repository coverage and maturity (implemented/interface/missing), plus a formalized context pack for LLM/agent reasoning and Socratic dialogue.
---
<!-- repository-context-rule -->
## Repository context rule
For repository work, the current checked-out codebase is the context. Search
existing implementation and trace actual carriers, definitions, imports,
instances, theorem statements, and uses before claiming a structure is missing
or incorrect. A local absence is not a repository-wide absence. Names,
heuristics, summaries, and documentation guide discovery but do not override
source. Follow `docs/REPO_DEEP_SEARCH_PROTOCOL.md` before repo-wide gap claims.
## Constructive Closure Mandate
Replacing witness-gated and external-certificate leftovers with native Lean 4 proofs is the highest mandate. Treat witness packets, certificate fields, external certificates, assumption interfaces, literature owners, graph edges, and physics analogies as closure debt until discharged by kernel-checked Lean or imported mathlib theorems. Follow docs/CONSTRUCTIVE_CLOSURE_MANDATE.md; never promote anonymous or unformalized sockets as complete.
# Repo Topic Deep Research
Use this skill to investigate any topic in this repo (replace `einstein` with your target token set), then produce:
1. a reproducible coverage audit
2. a strict implementation-status matrix
3. a formalized context pack for downstream coding agents and Socratic dialogue
This skill is intentionally topic-agnostic.
## Inputs
Set these first:
- `TOPIC`: primary keyword (for example: `einstein`, `kramers`, `triality`, `router`)
- `ALIASES`: topic synonyms and adjacent terms
- `SCOPE`: default `lean/InfoGeometry docs/black_books docs reports`
- `OUTPUT_STEM`: kebab-case stem for outputs (for example: `einstein`, `triality-router`)
## Status Labels (mandatory)
Every concept row must be labeled with exactly one:
- `implemented`: theorem-bearing owner surface exists now
- `interface`: compiled skeleton/bridge, explicitly partial
- `missing`: no owner theorem surface found
- `docs-only`: present only in docs/black-books, not Lean owner code
- `speculative`: present as hypotheses/unproven registry claims
## Hard Rules
- Do not claim "exhaustive" without unbounded scan evidence (`rg --stats`).
- Separate textual mentions from semantic declarations.
- Prefer owner files over wrappers/umbrellas.
- Detect proof debt with bounded regex (`\\bsorry\\b`, declaration-level `axiom`).
- Mark inference as inference.
- Do not convert a fast exact-name miss into `missing` until DAG / LeanTrail /
import-surface retrieval has also been checked.
## Workflow
### 1) Unbounded recall scan
Run full-text scans with stats and machine-readable output:
```bash
TOPIC="einstein"
OUT="reports/${TOPIC}.matches.jsonl"
rg -i --stats --glob='*.lean' --glob='*.md' "${TOPIC}" lean/InfoGeometry docs/black_books docs reports
rg -i --json --glob='*.lean' --glob='*.md' "${TOPIC}" lean/InfoGeometry docs/black_books docs reports > "${OUT}"
```
Then scan aliases similarly and merge findings.
### 2) Candidate declaration extraction
Collect declaration candidates from Lean files:
```bash
rg -n --glob='*.lean' "theorem|lemma|def|structure|inductive|class" lean/InfoGeometry \
| rg -i "${TOPIC}|ALIAS1|ALIAS2"
```
### 3) Owner-surface verification
- Open candidate files directly.
- Verify whether declarations are theorem-bearing or only packaging wrappers.
- Record concrete anchors (file + declaration names).
### 3.5) Deep retrieval before absence claims
Before labeling a concept `missing`, run the maintained retrieval surfaces:
```bash
# DAG declaration/index recovery
rg -n "<TOKEN>|<ALIAS1>|<ALIAS2>" artifacts/dag/index/decls.jsonl artifacts/dag/index/morphisms.jsonl
# LeanTrail snapshot / adapters
rg -n "<TOKEN>|<ALIAS1>|<ALIAS2>" artifacts/leantrail/graph_snapshot.json artifacts/leantrail/arango/ig_nodes.jsonl artifacts/leantrail/arango/ig_edges.jsonl
```
If the task is corridor-level rather than declaration-level, also inspect:
```bash
rg -n "<TOKEN>|<ALIAS1>|<ALIAS2>" artifacts/dag/process-flow/defects.jsonl artifacts/dag/source-sink-bipartite.json artifacts/dag/structural-topology.json
```
Then classify the strongest result honestly as one of:
- owner theorem surface present
- compiled bridge/interface surface present
- lexical/docs-only evidence
- stale/seed-missing retrieval artifact
- missing after deep retrieval
### 4) Debt/vacuity pass
For topic-matched Lean files:
```bash
FILES=$(rg -l -i --glob='*.lean' "${TOPIC}|ALIAS1|ALIAS2" lean/InfoGeometry)
rg -n "\\bsorry\\b|^[[:space:]]*axiom\\b|^[[:space:]]*constant\\b" $FILES
```
### 5) Semantic expansion (Lean-aware)
Use Lean queries for non-token semantic neighbors:
- `#print prefix <Namespace>`
- `#find ...` (type-pattern search)
- `#print axioms <decl>` for capstones/critical declarations
### 6) Classify and write matrix
Produce one matrix row per concept with:
- concept name
- status label
- owner anchors
- short note explaining classification
### 7) Build context pack for agents
Generate a topic context pack containing:
- terminology map (canonical symbols + aliases)
- proved core and boundaries
- open gaps and suggested next owner surfaces
- Socratic prompts (challenge questions with expected evidence type)
## Output Contract
Create these artifacts per run:
- `reports/<OUTPUT_STEM>.matches.jsonl`
- `reports/<OUTPUT_STEM>.scan_stats.md`
- `docs/<OUTPUT_STEM>_coverage_matrix.md`
- `docs/<OUTPUT_STEM>_context_pack.md`
- `docs/research/<OUTPUT_STEM>.md` (topic dossier)
- `Research/Context/<OUTPUT_STEM>.lean` (Lean context pack)
- `docs/research/<OUTPUT_STEM>-architecture.md` (architecture snapshot)
Optional:
- `reports/<OUTPUT_STEM>.decl_candidates.tsv`
- `reports/<OUTPUT_STEM>.axiom_audit.md`
## Suggested Output Structure
Use the templates in:
- `skills/repo-topic-deep-research/templates/coverage_matrix_template.md`
- `skills/repo-topic-deep-research/templates/context_pack_template.md`
- `skills/repo-topic-deep-research/templates/gemini_cli_prompt_template.md`
- `skills/repo-topic-deep-research/templates/hermes_enrichment_prompt_template.md`
- `skills/repo-topic-deep-research/templates/openai_deep_research_brief_template.md`
- `skills/repo-topic-deep-research/templates/topic_dossier_template.md`
- `skills/repo-topic-deep-research/templates/lean_context_pack_template.lean`
- `skills/repo-topic-deep-research/templates/architecture_snapshot_template.md`
## Lane Mirrors
- Copilot workflow mirror:
- `.agents/workflows/repo-topic-deep-research/SKILL.md`
- `.agents/workflows/repo-topic-deep-research/templates/*`
- Gemini CLI creative lane:
- `skills/repo-topic-deep-research/templates/gemini_cli_prompt_template.md`
- Hermes verification lane:
- `skills/repo-topic-deep-research/templates/hermes_enrichment_prompt_template.md`
- OpenAI Deep Research lane:
- `tools/infra/openai_deep_research_gateway.py`
- `skills/repo-topic-deep-research/templates/openai_deep_research_brief_template.md`
## Quality Checklist
- Stats-backed recall evidence captured
- Every matrix row has a status label
- Every `implemented/interface/missing` claim has file anchors
- Every `missing` claim also records whether DAG / LeanTrail / import-surface
retrieval was checked and whether any carrier was stale or missing
- Docs-only/speculative content clearly separated from Lean owner code
- Axiom/debt checks run on topic-matched Lean files
- Context pack includes explicit boundaries and open questions
## UTMOST MANDATE: Native Lean proof closure over witness/certificate scaffolding
Effective immediately, replacing witness-gated and external-certificate leftovers with native Lean proofs is the top-priority mandate.
Policy requirements:
- Witness packets, certificate fields, external certificates, and assumption interfaces are temporary scaffolding only.
- They are not final mathematical closure and not promotion authority.
- Every promoted proposition must be discharged by native Lean derivation chains in-repo (owner -> translator -> mathlib-rooted proof path).
- When a native Lean proof is not yet available, the gap must be recorded explicitly as open closure debt; do not package it as complete.
- **Do not “resolve” debt with wording.** Progress must be structural, not just textual.
- **Do not remove debt labels** unless there is a native explicit Lean proof term checked by the kernel closing that specific debt.
- **Real progress** = replacing certificate/witness fields with theorem-backed native derivations.
Files in this skill
SKILL.md8.5 KB
templates/architecture_snapshot_template.md601 B
templates/context_pack_template.md998 B
templates/coverage_matrix_template.md833 B
templates/gemini_cli_prompt_template.md838 B
templates/hermes_enrichment_prompt_template.md942 B
templates/lean_context_pack_template.lean865 B
templates/openai_deep_research_brief_template.md982 B