parsectx
v1.0.1
Published
Intelligent context engine for LLMs — token-aware packing, dependency graphs, and relevance scoring
Maintainers
Readme
ParseCTX
Your codebase is millions of tokens. Your LLM isn’t. ParseCTX decides what actually matters.
ParseCTX is a deterministic codebase snapshot and intelligent context engine.
It can flatten your entire project, track changes, search everything instantly, and assemble relevance-ranked context windows for LLMs.
Core Capabilities
Snapshot Layer (Deterministic Foundation)
build— Flatten entire codebase into a numbered snapshotchange— Detect diffs using Myers algorithmsearch— Full-text search across all filesstat— File stats, breakdowns, token estimates
Context Intelligence Layer
pack— Build token-budgeted, relevance-ranked LLM contextinspect— Analyze dependency graph and file importanceinit— Configure project defaults
Why This Exists
| Problem | Typical Approach | ParseCTX | |--------|----------------|----------| | Codebase too large | Paste random files | Packs only relevant context | | LLM confusion | Flat dumps | Structured, ranked context | | Finding dependencies | Manual grep | Import graph traversal | | Token waste | Include everything | Budget-aware packing | | Tracking changes | Git diff noise | Clean, line-level output |
Quick Start
npx parsectx buildor
npm install -g parsectxCommands
parsectx build
Creates a deterministic snapshot:
- Flattens all files into
parsectx/build.txt - Adds line numbers
- Stores SHA-256 hashes in
meta.json - Uses atomic writes
parsectx change
Detects changes since last snapshot:
- New files
- Modified files
- Deleted files
- Line-level diff (Myers algorithm)
Output:
parsectx/change.txtparsectx search <term>
Search entire codebase:
parsectx search "TODO"Options:
--case,-c— Case-sensitive--max=N— Limit results
parsectx stat
Displays snapshot analytics:
- File counts
- Output sizes
- Directory breakdown
- Top file types
Intelligent Context Engine
parsectx pack
Builds a token-budgeted context window for LLMs.
parsectx pack --budget 100000 --focus src/index.js --depth 2Process
Parses imports (JS, TS, Python, Go, Rust, Java)
Builds a dependency graph
Scores files using:
- PageRank-style centrality
- Recency
- Focus proximity
- Size penalty
Packs highest-value files first
Summarizes large low-priority files
Stops at token budget
Output Formats
- XML (Claude)
- Markdown (ChatGPT)
- JSON (pipelines)
parsectx inspect
Analyze codebase structure:
parsectx inspect --top 20
parsectx inspect --graph src/index.jsOutputs:
- Most important files
- Dependency graph
- Structural insights
parsectx init
parsectx initCreates:
.parsectx/config.jsonHow It Works
your-project/
├── src/
├── package.json
└── parsectx/
├── build.txt
├── change.txt
├── pack.md / pack.xml
└── meta.jsonSnapshot Engine
- Recursive scan
- Binary detection (null-byte heuristic)
- Deterministic ordering
- Atomic writes
Context Engine
- Dependency graph construction
- Centrality scoring
- Token-aware packing
- Relevance-first selection
Default Exclusions
node_modules.gitparsectx.parsectxvenv
Binary files are skipped automatically.
Use Cases
- LLM context generation (Claude, GPT, Gemini)
- Full-repo search without tooling overhead
- CI snapshot artifacts
- Deterministic project archiving
- Understanding large codebases
- Fast iteration without Git diff noise
Requirements
- Node.js >= 18
- No external dependencies
Philosophy
ParseCTX follows a simple principle:
Context is only useful if it is relevant and constrained.
License
MIT © Sagnick Das
