@kavachos/prisma adapter lets you query every KavachOS table through your existing PrismaClient, no Drizzle installation required.
The Prisma adapter is a standalone query layer. It does not replace or wrap
the core KavachOS instance. Use it to read and write KavachOS data from
the parts of your codebase that already work with Prisma.
When to use it
- You have an existing Prisma project and want to avoid running two ORM clients.
- You need to query KavachOS tables inside Prisma transactions that span your own models.
- You prefer generated Prisma types over Drizzle’s schema for editor autocomplete.
- Your team finds Prisma’s DSL easier to maintain than raw SQL DDL.
Installation
kavachos itself, @prisma/client is the only peer dep.
Setup
1
Add the KavachOS models to your Prisma schema
Copy the models fromnode_modules/@kavachos/prisma/src/schema.prisma into your prisma/schema.prisma, or use it as a reference to add only the tables you need.The schema targets Postgres by default. Switch the datasource provider to sqlite or mysql as appropriate.2
3
Create the adapter
Usage
Agent operations
User operations
Session management
Audit log queries
Permissions
Transactions
The adapter wraps Prisma’s$transaction to let you compose KavachOS operations with your own Prisma queries:
Trust scores
Approval requests
Migration from Drizzle
If you started with the built-in Drizzle backend and want to switch to Prisma:- Keep the same table names, all KavachOS tables use the
kavach_prefix and the same column names in both Drizzle and Prisma. - Run
npx prisma introspectagainst your existing database to generate a Prisma schema from the Drizzle-created tables. - Replace calls to the Drizzle
dbdirectly withcreatePrismaAdapter(prisma). - Set
database.skipMigrations: trueincreateKavach(...)if the core KavachOS instance is still used for other features (agents, MCP, etc.), so Drizzle does not conflict with Prisma.
Reference schema
The full reference schema is innode_modules/@kavachos/prisma/src/schema.prisma. It includes all 30+ KavachOS models with correct column mappings, indexes, and default values.
Every model name follows KavachPascalCase and maps to a kavach_snake_case table, keeping your Prisma namespace clean and your SQL tables clearly scoped.