## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Apps give those agents governed access to external tools. > - Provider catalogs must match each provider's current protocol and credential contract. > - Postman method labels and API-key placement were outdated. > - Shopify now offers a UCP commerce endpoint that needs a managed agent-profile argument. > - This pull request updates both providers and documents the complete connection-authoring workflow. > - The benefit is accurate setup, safer runtime defaults, and a repeatable provider review process. ## Linked Issues or Issue Description Refs #11965 This is stack 10 of 11. It depends on stack 9 and preserves the final catalog work recovered from #11965. Related: #5904 covers Shopify skill routing. This pull request covers the Apps connection contract instead. ## What Changed - Update Postman hosted MCP methods, capability choices, default selection, and bearer-token placement. - Add Shopify UCP commerce and Storefront compatibility methods with public-store prerequisites. - Inject the reviewed Shopify UCP agent profile at runtime and remove that managed field from user input schemas. - Classify Shopify checkout completion and cancellation as destructive actions. - Expand the connection authoring runbook from provider research through verification and pull request handoff. - Add focused shared, server, and UI coverage. - Make the approved-execution waiter phase-aware so slow preparation cannot consume the provider execution timeout and grace period. - Settle legacy pre-execute-on-approve requests and invocations as failed, clear their stale idempotency key, and allow a fresh governed approval instead of leaving work stuck in `executing`. ## Verification - `pnpm exec vitest run packages/shared/src/app-definitions.test.ts server/src/__tests__/tool-access-service.test.ts ui/src/pages/apps/AppsConnect.test.tsx -t "Postman|Shopify|normalizeConnectionMethodConfig|classifyRisk"` (16 passed) - `pnpm exec vitest run server/src/services/approved-execution-wait.test.ts` (4 passed) - `pnpm exec vitest run server/src/__tests__/tool-gateway.test.ts -t "enforces policy, approvals, retries, rate limits, and company boundaries for connected remote MCP calls"` (1 passed) - `pnpm exec vitest run server/src/__tests__/tool-gateway-service.test.ts` (21 passed; includes legacy approval settlement and fresh-approval recovery) - `pnpm --filter @paperclipai/server typecheck` - `pnpm check:token-gates` - `pnpm -r typecheck` - `pnpm build` ## Risks - Shopify UCP calls now include a Paperclip-managed agent profile that overrides caller input at the same path. - Postman EU credentials now use the hosted MCP server's bearer-token contract instead of the general REST API header. - The catalog generator and checked-in definitions change together to prevent regeneration drift. - Approved execution preparation has an explicit two-minute bound; provider execution retains its own 65-second timeout and persistence grace starting from durable provider start. - Legacy approvals created before execute-on-approve are intentionally terminalized and must be requested again under the current signed contract. > I checked `ROADMAP.md`. This provider update does not duplicate planned core work. The related open Shopify PR addresses skill routing, not Apps connections. ## Model Used OpenAI Codex, GPT-5. The runtime exact model ID and context window were not exposed. The model used reasoning, tool use, and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge
9.9 KiB
AGENTS.md
Guidance for human and AI contributors working in this repository.
1. Purpose
Paperclip is a control plane for AI-agent companies.
The current implementation target is V1 and is defined in doc/SPEC-implementation.md.
2. Read This First
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.
When adding or changing an Apps catalog connection, also follow
doc/connections/CONNECTOR-PLAYBOOK.md. It is the canonical connection
authoring runbook for provider research, supported transport/auth patterns,
credential handling, branding, implementation, testing, live proof, and PR
submission.
3. Repo Map
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 packagespackages/skills-catalog/: app-shipped skills catalog (@paperclipai/skills-catalog)packages/teams-catalog/: app-shipped teams catalog (@paperclipai/teams-catalog)cli/:paperclipaiCLI package (published bin, agent-facing commands)skills/: Paperclip runtime/operational skills (not part of the app catalog)doc/: operational and product docs
4. Dev Setup (Auto DB)
Use embedded PGlite in dev by leaving DATABASE_URL unset.
pnpm install
pnpm dev
This 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/companies
Reset local dev DB:
rm -rf data/pglite
pnpm dev
5. Core Engineering Rules
-
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. -
Name the three data paths correctly. This repo has three separate data paths. Do not confuse them. Match a change to a path by its file path, not by the word "observability" or "telemetry" alone.
- Telemetry is the Paperclip first-party event system. It is opt-out and it sends data to a Paperclip endpoint by default. Its paths are:
packages/shared/src/telemetry/- the generated contract
packages/shared/src/telemetry/generated/paperclip-telemetry.ts - each caller of
packages/shared/src/telemetry/events.tsorpackages/shared/src/telemetry/client.ts
- Observability is the OpenTelemetry trace path. An operator must set an OTLP endpoint. Until an operator sets the endpoint, the tracer is a no-operation. Its paths are:
server/src/instrumentation.tsdoc/observability.mdpackages/adapter-utils/src/duplex-observability.tsserver/src/services/duplex-observability-recorder.ts- the span attributes in
packages/adapter-utils/src/acpx-engine/startup-timing.ts
- The run log holds rows in the local
heartbeat_run_eventstable. The data stays in the instance database. Its paths are:doc/run-log-events.mdpackages/db/src/schema/heartbeat_run_events.ts- the append path
appendRunEventinserver/src/services/heartbeat.ts
Apply a review level that matches the path:
- Telemetry change (strict review). The author updates the generated contract first. The author updates
packages/shared/src/telemetry/README.mdin the same pull request. The author requests a privacy review. Reason: a Telemetry event goes to a Paperclip endpoint by default, so a mistake sends data immediately. - Observability change (lighter review). The operator endpoint gate stays in place. The no-operation behaviour stays when no endpoint is set. A privacy review is not necessary while the change stays inside the closed span-attribute allowlist.
- Run-log change (no extra review). A run-log change needs neither review level above, because the data stays in the instance database.
Exclusion. The word "observability" in a file such as server/src/services/recovery-observability.ts names a different concept. Apply this rule by path, not by word match.
6. Database Change Workflow
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 typecheck
Notes:
packages/db/drizzle.config.tsreads compiled schema fromdist/schema/*.jspnpm db:generatecompilespackages/dbfirst
7. Verification Before Hand-off
Default local/agent test path:
pnpm test
This is the cheap default and only runs the Vitest suite. Browser suites stay opt-in:
pnpm test:e2e
pnpm test:release-smoke
Run 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 build
If anything cannot be run, explicitly report what was not run and why.
8. API and Auth Expectations
- 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)
9. UI Expectations
- 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
10. Pull Request Requirements
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
11. Definition of Done
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)
Design system
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.