Input guardrails
Prompt injection, PII redaction, keyword deny lists โ with homoglyph and zero-width normalization since v0.2.0
Input/output safety, structured output repair, cost budgets, audit logging, and tool policies โ verified with 163 automated tests
git clone https://github.com/sakurablush/shieldkit.git
cd shieldkit && npm ci && npm run demoSections 1โ8 use mocks only; section 9 needs Ollama. Expect Demo summary โ 31/31 checks passed.
import { generateText } from 'ai';
import { shield } from 'shieldkit';
const model = shield(yourModel, { mode: 'balanced' });
await generateText({
model,
prompt: 'Hello',
providerOptions: { aiShield: { sessionId: 'user-123' } },
});| Section | Link |
|---|---|
| Getting started | Install and first request |
| Architecture | Middleware chain |
| Features | Guards, repair, cost, audit, tools |
| Testing | Running tests ยท Verification matrix |
| Examples | Runnable scripts |
| API | Public exports |
| Contributing | Development guide ยท Cursor skills |