97840e25ab
7 curated knowledge cards extracted from RFCs and docs: - architecture: core pipeline, extension points, process isolation - sense: compute behavior, Sense→Workflow, config - workflow: engine, threads, WorkflowSpec - adapter: AgentFn protocol, available adapters, extract layer - coding-conventions: functional-first, Result type, naming - monorepo: package structure, dependency rules - knowledge-layer: sync/query CLI, embedding service knowledge.yaml indexes .knowledge/**/*.md only.
1.2 KiB
1.2 KiB
Nerve Coding Conventions
Functional-First
typeoverinterface,functionoverclass- No
this, no inheritance, composition over inheritance - Immutability first:
Readonly<T>,as const
No Optional Properties
Never use ?:. Use T | null for nullable fields. Use discriminated unions for mutually exclusive fields.
// ✅ Good
type Config = { throttle: string | null }
// ❌ Bad
type Config = { throttle?: string }
Error Handling
Result<T, E>for expected failuresthrowonly for programmer errors (bugs)- No try-catch for flow control
Naming
| Type | Style |
|---|---|
| Files | kebab-case.ts |
| Types | PascalCase |
| Functions/vars | camelCase |
| Constants | UPPER_SNAKE |
Exports
- Always named exports, never default
- One module = one responsibility
Async
- Always
async/await, never.then()chains
No Dynamic Import
Static import only. Exceptions: sense-runtime.ts, workflow-worker.ts (runtime module paths).
Toolchain
pnpm + TypeScript (strict) + Biome (lint/format) + Vitest (test)
pnpm run check # biome check
pnpm test # vitest
pnpm run build # full build