VaultysClaw
Copilot instructions82 starsChanged 6 months agoMITView on GitHub
Decentralized AI agent orchestration platform. Monorepo (pnpm workspaces + Turborepo) with three packages: See CLAUDE.md for the full architecture overview. Single test file: pnpm vitest run __tests__/channels.test.ts See docs/QUICK_START.md for setup and docs/DEVELOPMENT.md for full dev workflow. Client-side API calls → use the typed classes in packages/control-plane/lib/api/: One class per domain group (agents, channels, users, workspaces, workflows, models, skills, governance, knowledge, server, network, stats, chat, apiKeys, registrations, intents). All extend BaseApi which throws ApiError on non-2xx responses. Import singletons from…
- Reads credentials
- Installs packages
In this repository3 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- add-api-routeSkill
- add-ws-messageSkill
The file
We split this copilot-instructions.md into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 33
WebSocket protocol: All messages are typed envelopes from packages/shared/src/channel-types.ts.
- Distinctive: line 63
After creating a route:
- Very specific: line 65
Register in route registry: add an entry to packages/control-plane/lib/route-registry.ts (ROUTE_REGISTRY)
- Very specific: line 88
Always close WebSocket/HTTP servers in afterAll() — Vitest won't auto-clean.
- Very specific: line 93
Monorepo imports: Use @vaultysclaw/shared for cross-package imports.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
VaultysClaw — Agent Instructions
Decentralized AI agent orchestration platform. Monorepo (pnpm workspaces + Turborepo) with three packages:
packages/shared— core types, security utils, channel protocolpackages/control-plane— Next.js App Router dashboard + WebSocket server (port 3000 / WS 8080)packages/agent-controller— agent runtime CLI, tools, skills, memory
See CLAUDE.md for the full architecture overview.
Build & Test
pnpm install
pnpm build # All packages (shared must build first — handled by Turborepo)
pnpm dev # All packages dev mode
pnpm vaultysclaw:dev # Control plane only
pnpm dev -F @vaultysclaw/agent-controller
pnpm test # Vitest, no watch (default config)
pnpm type-check
pnpm lintSingle test file: pnpm vitest run __tests__/channels.test.ts
See docs/QUICK_START.md for setup and docs/DEVELOPMENT.md for full dev workflow.
Key Architecture Decisions
- ORM: Prisma with PostgreSQL. All DAOs live in
packages/control-plane/db/and use the Prisma client (db/client.ts). Schema inprisma/schema.prisma, migrations inprisma/migrations/. Never use raw SQL in route handlers — use the appropriate DAO. - Auth: Passwordless (VaultysId ECDSA challenge-response) via NextAuth. Each route handler calls
getAuthContext()from@/lib/auth-utils— no middleware file. - WebSocket protocol: All messages are typed envelopes from
packages/shared/src/channel-types.ts. Critical messages (policies, intents) carry ECDSA signatures verified before processing. @/*alias: Only works inpackages/control-plane(Next.js). Agent-controller uses relative imports.- Skills are pre-compiled JS: Skills discovered at runtime must be
.js/.mjsfiles, not.ts. - Agent-controller SQLite: The agent-controller keeps its own local SQLite (
agent.db) for identity, sessions, and memory — this is separate from the control plane's PostgreSQL.
Adding Things
Client-side API calls → use the typed classes in packages/control-plane/lib/api/:
import { agentsApi, channelsApi } from "@/lib/api";
// Each class exposes typed methods matching the route registry
const { agents } = await agentsApi.list({ workspace: workspaceId });
const channel = await channelsApi.getOne(id);One class per domain group (agents, channels, users, workspaces, workflows, models, skills, governance, knowledge, server, network, stats, chat, apiKeys, registrations, intents). All extend BaseApi which throws ApiError on non-2xx responses. Import singletons from @/lib/api — do not instantiate classes directly.
API route → packages/control-plane/app/api/<resource>/route.ts:
export async function GET(request: NextRequest) {
const auth = await getAuthContext(request); // ← always pass request (API key auth)
if (!auth) return unauthorized();
// query via the appropriate DAO from @/db (Prisma-based)
return NextResponse.json({ success: true, data: ... });
}After creating a route:
- Register in route registry: add an entry to
packages/control-plane/lib/route-registry.ts(ROUTE_REGISTRY) - Add Swagger JSDoc: annotate each handler with
@openapi(or runpnpm tsx scripts/generate-swagger-docs.ts)
API Key → managed in the "API Keys" tab at /server. Keys use X-API-Key header or Authorization: Bearer. Managed via ApiKeyDAO in db/api-key.dao.ts.
Tool → packages/agent-controller/src/tools/<name>.ts, export AgentToolDefinition, register in src/tools/index.ts.
Skill → packages/agent-controller/skills/<name>/index.ts, export SkillDefinition. Auto-discovered by src/skills/loader.ts.
WebSocket message type → add to packages/shared/src/channel-types.ts union, handle in lib/ws-server.ts (control plane) and src/agent.ts (agent).
Scripts
pnpm tsx scripts/check-api-coverage.ts— find routes in filesystem missing fromROUTE_REGISTRYpnpm tsx scripts/generate-swagger-docs.ts [--check] [--force]— AI-generate@openapiJSDoc (requiresOPENAI_API_KEYinpackages/control-plane/.env)pnpm tsx scripts/update-route-auth-calls.ts [--dry-run]— bulk-migrategetAuthContext()→getAuthContext(request)
Testing Conventions
- Framework: Vitest. Tests in
__tests__/(integration) andpackages/*/src/**/*.test.ts(unit). - Vitest configs: default (no Docker),
vitest.config.docker.mjs,vitest.config.litellm.mjs,vitest.config.ui.mjs(jsdom for React components). - Mock
getAuthContext()from@/lib/auth-utilsin every API route test. See__tests__/test-utils.tsforwaitFor,TestWebSocket, and other helpers. - Vitest aliases
next/serverto__tests__/mocks/next-server.ts— tests won't see real Next.js behavior. - Always close WebSocket/HTTP servers in
afterAll()— Vitest won't auto-clean.
Common Pitfalls
- Never edit
dist/or.next/— generated output only. - Monorepo imports: Use
@vaultysclaw/sharedfor cross-package imports; never use relative paths across package boundaries. - Build order matters:
sharedmust be built beforecontrol-planeoragent-controller.pnpm buildhandles this via Turborepo"dependsOn": ["^build"]. getAuthContext()is Next.js only: It callsgetServerSession()internally — mock it in tests outside Next.js route handlers.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

