- Use
pnpmonly; the repo pinspnpm@11.7.0and requires Node>=22. - Install with
pnpm install --frozen-lockfilewhen matching CI. - Full local gate and pre-push hook:
pnpm verify(format:check -> lint -> code-mode:check-api -> schema:check -> docs:check -> typecheck -> test -> benchmark:check -> build). - Fast focused checks:
pnpm format:check,pnpm lint,pnpm typecheck,pnpm test,pnpm build. - Run one package:
pnpm --filter @caplets/core test,pnpm --filter @caplets/sdk test,pnpm --filter caplets build, or replace the filter with@caplets/opencode,@caplets/pi, or@caplets/benchmarks. - Run one Vitest file by passing it after the package script, e.g.
pnpm --filter @caplets/core test -- test/config.test.ts. - Dev server:
pnpm devbuilds/watches@caplets/coreand restartspackages/cli/dist/index.js; runpnpm buildfirst if CLI dist output is missing.
packages/coreis the runtime/library source: config parsing, schema generation, MCP/OpenAPI/GraphQL/HTTP/CLI backends, native service exports.packages/sdkowns the independent public Caplets SDK. Its root is the browser/Node Fetch client generated from the canonical public HTTP contract plus curated Caplet Bundle helpers;@caplets/sdk/project-bindingowns the browser-safe fixed-v1 coordinator, and@caplets/sdk/project-binding/nodeowns marker-aware filesystem fingerprints. Keep caller authentication optional and caller-owned, require isolated clients and explicit service/WebSocket roots, and exclude MCP and dashboard-private routes.packages/clipublishes thecapletsbinary and delegates almost all behavior to@caplets/core;caplets servestarts the MCP server, while no args print help.packages/opencodeandpackages/piare native agent integrations that wrap@caplets/core/native; keep integration-specific schema/adapter code there.packages/benchmarksowns deterministic and opt-in live coding-agent benchmarks; deterministic benchmark docs are generated frompnpm benchmark.
Issues and PRDs live in GitHub Issues for spiritledsoftware/caplets; use gh with --repo spiritledsoftware/caplets. See docs/agents/issue-tracker.md.
Use the five canonical triage labels without overrides. See docs/agents/triage-labels.md.
This is a single-context repo: start with root CONTEXT.md and relevant ADRs in docs/adr/. See docs/agents/domain.md.
- Keep tests that protect behavior, user-visible contracts, generated artifacts, integrations, regressions, or data-safety boundaries. Remove or avoid tests that mostly restate implementation literals.
- Do not add tests that only assert package metadata, prompt/help copy substrings, Markdown wrapper scaffolding, export importability, or duplicated flag passthrough when stronger behavior coverage already exists.
- Do not add tests for marketing/blog/editorial prose, exact headlines, body copy, or subjective positioning. Copy is reviewed by humans, not locked by tests; only test durable content-system behavior such as schema validation, routing, metadata generation, or safety boundaries.
- Prefer Code Mode coverage through structured envelopes, session/recovery metadata, generated API checks, schema checks, and real tool execution. Avoid long prompt-description snapshots.
- Prefer benchmark tests that validate metric shape and failure thresholds. Do not pin static scenario IDs or improvement-name fixtures unless the exact list is the behavior under test.
- When deleting or skipping a narrow unit test, make sure a stronger integration test, generated-file check, or full gate still protects the meaningful behavior.
- Source code is authoritative. Keep durable product docs in
docs/product/, architecture docs indocs/, ADRs indocs/adr/, specs/plans indocs/specs/ordocs/plans/, and solution patterns indocs/solutions/. - Avoid committing short-lived plans unless explicitly requested. Do not use
docs/superpowers/in this repo. - Config schema source:
packages/core/src/config.ts. Generate withpnpm schema:generate; check withpnpm schema:check. - Code Mode API sources:
packages/core/src/code-mode/runtime-api.d.tsandpackages/core/src/code-mode/platform-entry.ts. Generate withpnpm code-mode:generate-api; check withpnpm code-mode:check-api. - Canonical HTTP API sources are the route-local Zod/OpenAPI definitions in
packages/core;pnpm openapi:generatewritesschemas/caplets-http.openapi.jsonandpackages/sdk/src/generated/.pnpm openapi:checkchecks both artifacts and the SDK contract. Do not hand-edit the generated SDK. - Benchmark report:
pnpm benchmarkupdatesdocs/benchmarks/coding-agent.md;pnpm benchmark:checkchecks staleness. - Live benchmarks are opt-in and local/model-dependent: build first, then run
CAPLETS_BENCH_LIVE=1 pnpm benchmark:live:opencode,CAPLETS_BENCH_LIVE=1 pnpm benchmark:live:pi, orCAPLETS_BENCH_LIVE=1 pnpm benchmark:live:pi-eval.
- Default user config path is resolved by core; tests commonly override with
CAPLETS_CONFIG. - Project config lives at
.caplets/config.json; project Markdown Caplet files load by default, while executable backend maps in project config are intentionally rejected. - Runtime config reload keeps the last known-good config on parse/validation errors; do not change this behavior without updating reload tests.
- Caplet tool names come from configured server IDs and expose progressive discovery operations (
get_caplet,list_tools/search_tools,get_tool,call_tool) rather than flattening downstream tools.
- CI runs
pnpm verifypluspnpm changeset status --since=origin/mainon PRs unless the PR has theno changesetlabel. - User-facing package changes usually need a changeset; current versioning is handled by Changesets and
pnpm version-packages/pnpm release. - Pre-commit only runs
pnpm lint-staged(oxfmt --checkandoxlinton staged JS/TS/config/docs files); pre-push runs the fullpnpm verify. - Alchemy deploy workflows are in
.github/workflows/deploy.ymland.github/workflows/pr-preview-deploy.yml; checkalchemy.run.tsandinfra/before changing deploy behavior.