
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
agentic-compaction
Advanced tools
Walk a project directory and output a compact structural skeleton of the entire codebase
Walks a project directory, parses JS/TS/Python files, and outputs a compact structural skeleton of the entire codebase. Designed for feeding project context into LLM prompts with minimal token usage.
Typical compaction rate: ~95% token reduction.
npx agentic-compaction /path/to/project
npm install -g agentic-compaction
agentic-compaction [path] [options]
Options:
| Flag | Description |
|---|---|
--json | Save output as JSON (includes stats) |
--help, -h | Show help |
If no path is given, it defaults to the current directory.
Output is saved to the target directory as compacted_<project>_<date>.md.
Example:
$ npx agentic-compaction ~/projects/my-app
Saved to /home/user/projects/my-app/compacted_my-app_2026-02-12_15-30-00.md
Files: 96
Project tokens: 106.9K
Compacted tokens: 5.9K
Compaction rate: 94.4%
import { compactProject, compactFile } from 'agentic-compaction';
// Compact an entire directory
const { output, stats } = compactProject('/path/to/project');
console.log(output);
console.log(stats); // { files, rawTokens, compactedTokens }
// Compact a single file
const { skeleton, formatted } = compactFile('app.tsx', sourceCode);
Each file is rendered as a markdown heading followed by its structural skeleton:
## src/components/App.jsx
imports: 3 ext, ./hooks/useAuth, ./api/client
exports: App*
components: App:12
fn: handleSubmit:24, validate:40
hooks: useState(2), useEffect([user]):18, useAuth
The skeleton captures:
*)| Language | Parser | Extensions |
|---|---|---|
| JavaScript | @babel/parser (top-level only) | .js, .jsx, .mjs, .cjs |
| TypeScript | @babel/parser (top-level only) | .ts, .tsx, .mts, .cts |
| Python | Regex-based (top-level only, zero deps) | .py |
node_modules, dist, .git, target, build, .next, .turbo, out, coverage, .cache, __pycache__, .venv, venv, .idea, .vscode, and any dotfile directories.
src/
cli.js # CLI entry point
index.js # Library API: compactProject, compactFile
walker.js # Recursive directory walker with filtering
formatter.js # Output formatting + token estimation
parsers/
babel.js # JS/TS parsing via Babel AST
python.js # Python parsing via regex (top-level only)
npm test
MIT
FAQs
Walk a project directory and output a compact structural skeleton of the entire codebase
The npm package agentic-compaction receives a total of 11 weekly downloads. As such, agentic-compaction popularity was classified as not popular.
We found that agentic-compaction demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.