Read-only repository miner that builds a corpus of excerpts. Extracts reusable prompts, instructions, personas, skills, methodologies, rules, standards, guidelines, agent behavior, and other context artifacts into a reviewable corpus.
corpex /path/to/repo --out repo_extraction --cleanInstalled via pip install -e .. The pre-rename entry points
(context_miner.py, cookbook_extractor.py, prompt_miner.py) were two-line
shims and have been dropped.
- Content detection is no longer extension-allowlist based. Extensionless and unusual text files are extracted when their bytes are actually text.
- Explicit support for
.prompt, XML/SVG, RTF, DOCX, PPTX, XLSX, ODT/ODS/ODP, PDF, JSONL/NDJSON, CSV, Mermaid, TeX, shell files, and arbitrary textual source files. - PDF extraction uses
pypdf, then PyMuPDF, thenpdftotextwhen available. - Whole semantic artifacts are preserved as
primarycandidates instead of being replaced by heading fragments. - Sections and embedded prompt values are still emitted as
fragmentcandidates for search/reuse. - Python static prompt composition resolves concatenation, f-strings, referenced constants,
.format(), anddedent()templates when possible. - Bare names like
system_descno longer count as prompt evidence just because they contain the wordsystem. - Exact-content deduplication retains all provenance occurrences instead of discarding duplicate source locations.
--scope tests,--only-tests, and--production-onlyallow clean test/production passes.- Repeatable
--exclude-globand--include-globsupport provenance/source filtering without hardcoded vendor structure. - The output directory is automatically excluded when it lives inside the source repository.
Production source only:
corpex /path/to/repo --out production_extraction --production-only --cleanTests only:
corpex /path/to/repo --out test_extraction --only-tests --cleanExclude a vendored copy of another library:
corpex /path/to/repo \
--exclude-glob 'EXAMPLES/vendored_library/**' \
--out repo_extraction --cleanRaise the per-file extraction budget:
corpex /path/to/repo --max-file-bytes 52428800repo_extraction/
├── README.md
├── summary.json
├── inventory.jsonl
├── candidates.csv
├── candidates.jsonl
├── candidates/
└── corpus/
corpus/ is the recall/completeness layer. candidates/ is the reusable-artifact discovery layer. Keep those responsibilities separate: a heuristic miss in candidate detection must not erase the extracted source text.
The miner has no mandatory third-party Python dependency for ordinary text, source, notebooks, RTF, Office Open XML, or OpenDocument extraction.
For PDF text extraction, it tries these backends in order:
pypdf- PyMuPDF (
fitz) - the
pdftotextexecutable
At least one is needed only if you want PDF extraction.