A VS Code extension that brings the asl-parser CLI into the editor and adds a real local RAG index that lives entirely on your machine. No API keys, no cloud, no telemetry. Code, index, and prompts never leave the workspace.
This extension re-implements and extends the original asl-parser features (parse, prompt, rag) as native VS Code commands, plus a persistent RAG index, file watching, tree views, and webview result panels.
Features
| Area | What you get |
|---|---|
| Parse workspace | Generate agents.md with file/line/function stats and a structured agent-spec JSON block. Preview in a side webview and open the file in one click. |
| Prompt impact analysis | Describe a change ("add auth to login") and get a ranked list of files, functions, classes, and exact line numbers that would be affected. |
| Local RAG search | Build a persistent lexical RAG index of the workspace, then query it in natural language. Click results to jump to the file at the right line. |
| Recent searches | Re-run any past query from a sidebar view, or clear the history. |
| Incremental updates | A workspace file watcher updates the index as you save, create, or delete files. Re-indexing is skipped for unchanged files (mtime + size hash). |
| Status bar | Shows PE · Nf / Mc (files / chunks) in the status bar. Click to rebuild. |
| Tree view | "Local RAG Index" view in the PromptEngineer activity bar container lists every indexed file. |
| Configurable | Chunk size, overlap, top-K, ignore dirs, code extensions, max file size, auto-index, file watching — all in Settings. |
| Keybindings | Ctrl+Shift+R (RAG search), Ctrl+Shift+I (impact), Ctrl+Shift+P (parse) — configurable in VS Code keybindings. |
Quick start
-
Install the VSIX:
cd PromptEngineer npm install npm run build npx vsce package code --install-extension promptengineer-0.1.0.vsixOr, while developing, copy this folder into
~/.vscode/extensions/and runnpm install && npm run buildthere, then restart VS Code. -
Open a workspace in VS Code.
-
Build the index (one-time per workspace):
- Command Palette →
PromptEngineer: Build Local RAG Index - Or click the status bar item:
PE · no index
- Command Palette →
-
Search the index:
Ctrl+Shift+R→PromptEngineer: RAG Search Codebase- Type a query, hit Enter, results appear in a side webview.
-
Run an impact analysis:
Ctrl+Shift+I→PromptEngineer: Analyze Prompt Impact- Describe the change in one sentence.
-
Generate
agents.md:Ctrl+Shift+P→PromptEngineer: Parse Workspace to agents.md- The file is written to the workspace root and a preview opens in a side webview.
Commands
| Command ID | Title | Notes |
|---|---|---|
promptengineer.parseWorkspace |
Parse Workspace to agents.md | Writes agents.md to workspace root. |
promptengineer.openAgentsFile |
Open agents.md | Generates it on demand if missing. |
promptengineer.analyzePrompt |
Analyze Prompt Impact | Asks for a sentence, opens impact webview. |
promptengineer.ragSearch |
RAG Search Codebase | Asks for a query, opens results webview. |
promptengineer.ragSearchWith |
(used by recent list) | Pre-fills query. |
promptengineer.buildIndex |
Build Local RAG Index | Full reindex. |
promptengineer.clearIndex |
Clear Local RAG Index | Deletes .promptengineer/index.json. |
promptengineer.reindexFile |
Re-index File in RAG | Triggered from the editor context menu. |
promptengineer.copySnippet |
Copy Snippet | Copies active selection. |
promptengineer.openSnippet |
Open Snippet at Location | Reports the cursor line. |
Configuration
All settings live under PromptEngineer in VS Code settings:
| Setting | Default | Purpose |
|---|---|---|
promptengineer.outputFile |
agents.md |
Output filename for the parse command. |
promptengineer.chunkSize |
20 |
Lines per RAG chunk. |
promptengineer.chunkOverlap |
5 |
Lines of overlap between consecutive chunks. |
promptengineer.topK |
10 |
Default number of RAG results returned. |
promptengineer.ignoreDirs |
node_modules, .git, dist, ... |
Dirs skipped during parse + index. |
promptengineer.codeExtensions |
.js, .ts, .py, ... |
File types treated as code. |
promptengineer.autoIndex |
true |
Build the index automatically on first activation. |
promptengineer.watchFiles |
true |
Incrementally update the index on file changes. |
promptengineer.maxFileSizeKb |
1024 |
Skip files larger than this. |
How the local RAG works
- Indexing (
src/services/ragService.ts): walks the workspace respectingignoreDirsandcodeExtensions, reads each file, splits it into overlapping chunks ofchunkSizelines withchunkOverlapoverlap, and extracts lightweight context (function/class names, path parts) for each chunk. Each chunk gets a stable hash ID. - Persistence: the index is written to
.promptengineer/index.jsonin your workspace root. It survives VS Code restarts. - Incremental updates: a
FileSystemWatcherdebounces file change events (500 ms) and re-indexes only files whosemtime/sizechanged. Unchanged chunks are kept from the prior index. - Search: lexical BM25-lite — tokenizes the query, scores each chunk by token occurrences in the content (×2), context keywords (×1.5), and file path (×3). Returns top-K with a normalized 0–100% relevance.
- Privacy: nothing is sent off your machine. The index file is plain JSON and you can
.gitignoreit if you don't want to commit it.
Where things live in the project
PromptEngineer/
├── package.json # extension manifest
├── tsconfig.json # TypeScript config
├── esbuild.config.mjs # bundler config
├── .vscodeignore # VSIX exclude rules
└── src/
├── extension.ts # activate(), status bar, wiring
├── commands/
│ ├── parseCommand.ts # parse + open agents.md
│ ├── promptCommand.ts # impact analysis
│ ├── ragCommand.ts # RAG search + snippet helpers
│ └── indexCommand.ts # build / clear / refresh / reindex
├── services/
│ ├── parserService.ts # file walking, function/class detection, agents.md generator
│ ├── promptAnalyzer.ts # keyword extraction + impact scoring
│ ├── ragService.ts # chunking, indexing, watching, search
│ └── recentStore.ts # recent-searches JSON store
├── providers/
│ ├── ragExplorerProvider.ts # Local RAG Index tree view
│ └── recentSearchesProvider.ts # Recent searches tree view
├── webviews/
│ ├── ragResultsPanel.ts # RAG results webview
│ ├── impactPanel.ts # impact analysis webview
│ └── parseReportPanel.ts # agents.md preview webview
└── utils/
├── config.ts # settings + paths
└── types.ts # shared TypeScript types
Compared to the original asl-parser CLI
| CLI command | Extension command / surface |
|---|---|
asl parse |
promptengineer.parseWorkspace + preview webview |
asl prompt "..." |
promptengineer.analyzePrompt + impact webview |
asl rag "..." |
promptengineer.ragSearch + RAG results webview + persistent index |
The extension additionally adds:
- A persistent on-disk index (the CLI re-indexed on every run).
- A file watcher for incremental updates.
- A tree view of indexed files and recent searches.
- A status bar indicator.
- Result webviews with click-to-open and copy-snippet actions.
- A walkthrough that walks a new user through the three core commands.
Development
npm install
npm run watch # rebuild on save
npm run lint # tsc --noEmit
npm run build # one-shot bundle
npx vsce package # produce a VSIX
To run inside VS Code: open this folder, press F5 (it'll spawn an Extension Development Host).
Limitations
- The RAG is lexical, not semantic. It scores token overlap, not meaning. For most "find me the function that does X" tasks this is fast and accurate; for fuzzy concept search you'll want to add embeddings (a future extension point).
- The language heuristics for function/class detection cover JS/TS/Python/Java/Go/Rust/Ruby/PHP/Kotlin. Other languages are indexed and searched but not auto-tagged.
- Very large monorepos: the index is one JSON file. For 100k+ files, swap the storage layer in
src/services/ragService.tsfor SQLite or similar.
License
Apache-2.0 (same as the original asl-parser).