Enclave is a monorepo containing security-focused libraries for building safe AI agent systems:
| Library | Description | Version |
|---|---|---|
| ast-guard | AST-based JavaScript validator with 100% CVE protection | |
| vectoriadb | Lightweight in-memory vector database for semantic search | |
| enclave-vm | Secure AgentScript execution environment with defense-in-depth |
Production-ready AST security guard for JavaScript validation and code safety. Blocks all known vm2/isolated-vm/node-vm CVE exploits.
import { validate, PRESETS } from 'ast-guard';
const result = validate('const x = 1 + 2;', PRESETS.SECURE);
console.log(result.valid); // trueFeatures:
- 100% CVE coverage for vm2, isolated-vm, and node-vm exploits
- 613+ security tests with 95%+ code coverage
- Four security presets: STRICT, SECURE, STANDARD, PERMISSIVE
- Zero runtime dependencies (only acorn for parsing)
Lightweight, production-ready in-memory vector database for semantic search with HNSW indexing.
import { VectoriaDB } from 'vectoriadb';
const db = new VectoriaDB();
await db.initialize();
await db.insert({ id: '1', text: 'Hello world', metadata: {} });
const results = await db.search('greeting', 5);Features:
- HNSW (Hierarchical Navigable Small World) indexing
- Multiple embedding options (TF-IDF, transformer-based)
- Persistence adapters (File, Redis)
- Built-in security validation
Secure AgentScript execution environment with defense-in-depth architecture for running LLM-generated JavaScript safely.
import { Enclave } from 'enclave-vm';
const enclave = new Enclave({ securityLevel: 'SECURE' });
const result = await enclave.execute(`
const sum = 1 + 2;
return sum;
`);
console.log(result.value); // 3Features:
- Bank-grade security: 516+ security tests, 81+ blocked attack vectors
- Defense-in-depth: 6 security layers
- Worker Pool Adapter for isolated execution
- Reference Sidecar for sandboxed environments
- Node.js: >= 22.0.0
- Package Manager: yarn
# Clone the repository
git clone https://github.com/agentfront/enclave.git
cd enclave
# Install dependencies
yarn install
# Build all libraries
yarn build
# Run tests
yarn test# ast-guard
npm install ast-guard
# vectoriadb
npm install vectoriadb
# enclave
npm install enclave-vm# Build all projects
nx run-many -t build
# Test all projects
nx run-many -t test
# Lint all projects
nx run-many -t lint
# Build specific project
nx build ast-guard
nx build vectoriadb
nx build enclavePRs welcome! Please:
- Keep changes focused
- Add/adjust tests for your changes
- Run
yarn build && yarn test && yarn lintbefore submitting