Guidance for human and AI contributors working in this repository.
Paperclip is a control plane for AI-agent companies.
The current implementation target is V1 and is defined in doc/SPEC-implementation.md.
Before making changes, read in this order:
doc/GOAL.mddoc/PRODUCT.mddoc/SPEC-implementation.mddoc/DEVELOPING.mddoc/DATABASE.md
doc/SPEC.md is long-horizon product context.
doc/SPEC-implementation.md is the concrete V1 build contract.
server/: Express REST API and orchestration servicesui/: React + Vite board UIpackages/db/: Drizzle schema, migrations, DB clientspackages/shared/: shared types, constants, validators, API path constantspackages/adapters/: agent adapter implementations (Claude, Codex, Cursor, etc.)packages/adapter-utils/: shared adapter utilitiespackages/plugins/: plugin system packagesdoc/: operational and product docs
Use embedded PGlite in dev by leaving DATABASE_URL unset.
pnpm install
pnpm devThis starts:
- API:
http://localhost:3100 - UI:
http://localhost:3100(served by API server in dev middleware mode)
Quick checks:
curl http://localhost:3100/api/health
curl http://localhost:3100/api/companiesReset local dev DB:
rm -rf data/pglite
pnpm dev-
Keep changes company-scoped. Every domain entity should be scoped to a company and company boundaries must be enforced in routes/services.
-
Keep contracts synchronized. If you change schema/API behavior, update all impacted layers:
packages/dbschema and exportspackages/sharedtypes/constants/validatorsserverroutes/servicesuiAPI clients and pages
- Preserve control-plane invariants.
- Single-assignee task model
- Atomic issue checkout semantics
- Approval gates for governed actions
- Budget hard-stop auto-pause behavior
- Activity logging for mutating actions
-
Do not replace strategic docs wholesale unless asked. Prefer additive updates. Keep
doc/SPEC.mdanddoc/SPEC-implementation.mdaligned. -
Keep repo plan docs dated and centralized. When you are creating a plan file in the repository itself, new plan documents belong in
doc/plans/and should useYYYY-MM-DD-slug.mdfilenames. This does not replace Paperclip issue planning: if a Paperclip issue asks for a plan, update the issueplandocument per thepaperclipskill instead of creating a repo markdown file. -
Attach inspectable generated artifacts. When your task produces a user-inspectable deliverable file, follow the Paperclip skill's "Generated Artifacts and Work Products" workflow before final disposition. In this repo, prefer the self-contained skill helper at
skills/paperclip/scripts/paperclip-upload-artifact.shso the file is available through the Paperclip API, create/update an artifact work product when the file is the deliverable, link the uploaded artifact in the final issue comment, and then set status. Do not rely on local filesystem paths as the only access path. If an important file intentionally remains workspace-only, create/update a work product withmetadata.resourceRef.kind: "workspace_file"and a workspace-relative path, then name that work product and path in the final comment. Treat browse/search as a fallback for recovering workspace files, not the preferred deliverable path. Seedoc/AGENT-ARTIFACTS.mdfor details and.mp4/.webmexamples.
When changing data model:
- Edit
packages/db/src/schema/*.ts - Ensure new tables are exported from
packages/db/src/schema/index.ts - Generate migration:
pnpm db:generate- Validate compile:
pnpm -r typecheckNotes:
packages/db/drizzle.config.tsreads compiled schema fromdist/schema/*.jspnpm db:generatecompilespackages/dbfirst
Default local/agent test path:
pnpm testThis is the cheap default and only runs the Vitest suite. Browser suites stay opt-in:
pnpm test:e2e
pnpm test:release-smokeRun the browser suites only when your change touches them or when you are explicitly verifying CI/release flows.
For normal issue work, run the smallest relevant verification first. Do not default to repo-wide typecheck/build/test on every heartbeat when a narrower check is enough to prove the change.
Run this full check before claiming repo work done in a PR-ready hand-off, or when the change scope is broad enough that targeted checks are not sufficient:
pnpm -r typecheck
pnpm test:run
pnpm buildIf anything cannot be run, explicitly report what was not run and why.
- Base path:
/api - Board access is treated as full-control operator context
- Agent access uses bearer API keys (
agent_api_keys), hashed at rest - Agent keys must not access other companies
When adding endpoints:
- apply company access checks
- enforce actor permissions (board vs agent)
- write activity log entries for mutations
- return consistent HTTP errors (
400/401/403/404/409/422/500)
- Keep routes and nav aligned with available API surface
- Use company selection context for company-scoped pages
- Surface failures clearly; do not silently ignore API errors
When creating a pull request (via gh pr create or any other method), you must read and fill in every section of .github/PULL_REQUEST_TEMPLATE.md. Do not craft ad-hoc PR bodies — use the template as the structure for your PR description. Required sections:
- Thinking Path — trace reasoning from project context to this change (see
CONTRIBUTING.mdfor examples) - What Changed — bullet list of concrete changes
- Verification — how a reviewer can confirm it works
- Risks — what could go wrong
- Model Used — the AI model that produced or assisted with the change (provider, exact model ID, context window, capabilities). Write "None — human-authored" if no AI was used.
- Checklist — all items checked
A change is done when all are true:
- Behavior matches
doc/SPEC-implementation.md - Typecheck, tests, and build pass
- Contracts are synced across db/shared/server/ui
- Docs updated when behavior or commands change
- PR description follows the PR template with all sections filled in (including Model Used)
This is a fork of paperclipai/paperclip with QoL patches and a built-in Hermes adapter story on branch feat/externalize-hermes-adapter (tree).
feat/externalize-hermes-adapternow shipshermes_localandhermes_gatewayas built-in core adapters.- Older fork branches may still document plugin-only Hermes; treat this file as authoritative for the current branch.
hermes_localis available without Adapter manager installation and runs the local Hermes CLI.hermes_gatewayis available without Adapter manager installation and calls an already-running Hermes API server.- Operators may still install external Hermes packages through Adapter manager to override/shadow the built-ins.
- Optional:
file:entry in~/.paperclip/adapter-plugins.jsonremains useful for local development of override packages.
- Fork runs on port 3101+ (auto-detects if 3100 is taken by upstream instance)
npx vite buildhangs on NTFS — usenode node_modules/vite/bin/vite.js buildinstead- Server startup from NTFS takes 30-60s — don't assume failure immediately
- Kill ALL paperclip processes before starting:
pkill -f "paperclip"; pkill -f "tsx.*index.ts" - Vite cache survives
rm -rf dist— delete both:rm -rf ui/dist ui/node_modules/.vite
These are local modifications in the fork's UI. If re-copying source, these must be re-applied:
- stderr_group — amber accordion for MCP init noise in
RunTranscriptView.tsx - tool_group — accordion for consecutive non-terminal tools (write, read, search, browser)
- Dashboard excerpt —
LatestRunCardstrips markdown, shows first 3 lines/280 chars
PR #2218 (feat/external-adapter-phase1) adds external adapter support. See root AGENTS.md for full details.
- Adapters can be loaded as external plugins via
~/.paperclip/adapter-plugins.json - The plugin-loader should have ZERO hardcoded adapter imports — pure dynamic loading
createServerAdapter()must include ALL optional fields (especiallydetectModel)- Built-in UI adapters can shadow external plugin parsers; external override pause/resume should restore the built-in parser.
- Reference external adapters: Droid (npm); Hermes can also be tested as an override package.
DESIGN.md at the repo root is the source of truth for UI design decisions. The token-only rule applies to all ui/ changes: every color, spacing, radius, type, shadow, and motion value in ui/src/components/** and ui/src/pages/** comes from the token layer in ui/src/index.css — no hex, raw px, arbitrary Tailwind bracket values, or raw font-size/fontSize declarations in components, outside the documented allowlist in ui/src/index.css. Run pnpm check:token-gates (scripts/check-token-gates.mjs) before committing UI changes — it fails on any violation not covered by that allowlist.