Files
PaperClipAI/maps/feature-map
Nicky LeachandPaperclip da9af67415 Persist agent-owned instance secrets through lifecycle results (#16191)
## Thinking Path

> - Paperclip coordinates agents and controls when they can run.
> - Lifecycle plugins prepare and remove resources for each agent.
> - Those resources can require private connection credentials.
> - The current SDK can resolve configured secrets but cannot save these
credentials securely.
> - Ordinary company secrets can be bound to agents and do not provide
the required server-only boundary.
> - This change saves agent-owned instance secrets through the existing
local lifecycle result and native secret service.
> - The tenant can retain runtime credentials through restarts without a
separate encryption system or remote API.

## Linked Issues or Issue Description

**Subsystem affected**

Agent lifecycle, plugin contract, and native secret storage.

**Problem or motivation**

Lifecycle plugins need to save private runtime connection details for
the owning agent. Worker memory loses these details on restart. Plugin
state and company secrets do not provide a private runtime-only
boundary.

**Proposed solution**

Add optional instance-secret changes to lifecycle results. Save them
through the existing secret service and local encrypted provider before
accepting the result. Require company, agent, plugin, phase, operation,
revision, and current unexpired attempt ownership. Supply saved values
through the existing local preparation/resume request.

**Alternatives considered**

A separate encrypted store duplicates the native secret system. Generic
plugin company-secret writes proposed by #5007 do not supply agent
ownership or a server-only secret scope. This change does not add that
general write API.

**Roadmap alignment**

Extends the existing lifecycle contract from #15631. It does not add a
resource provider or select an execution backend.

## What Changed

- Add an instance scope to native secrets with mandatory agent/plugin
ownership, a company-qualified agent foreign key, and key uniqueness per
owner. Existing company and user scopes retain their constraints.
- Reuse native creation, rotation, deletion, secret versions, access
audit, and the local encrypted provider. Keep values out of company
catalogs, normal bindings, agent access, and public agent records.
- Accept local secret patches only after locking and checking the
current lifecycle operation and required plugin selection. Storage
failure or a stale reply cannot complete setup. Expired or replaced
attempt owners cannot overwrite a successor's credentials.
- Keep vault-import conflicts company-scoped. Protect instance-owned
account-home paths during failed device-login cleanup with a private,
fail-closed scan.
- Skip decryption on stop and cleanup so a lost key cannot block
removal. Cascade secret records when their agent or plugin is deleted.
- Log fixed provider diagnostics without raw errors that can contain
credentials. Document the local contract, runtime resolver, and
access-map exclusions. Retain the five latest migration snapshots
through the normal generator pruning.

## Verification

- 239 focused tests passed across agent-instance-secrets, lifecycle,
secrets-service, secrets-routes, plugin-secrets-handler, and
agent-device-login-routes. Used disposable PostgreSQL 18 clusters
through the existing test constructor seam because the bundled binary
cannot start on this macOS host. The temporary harness is outside git.
- Regression tests reproduced the vault-import conflict and missed
cleanup claimant before the fixes; both pass after the fixes.
- New coverage includes encrypted native versions, rotation, restart
recovery, company/agent/plugin isolation, ordinary-read and binding
denial, stale replies, storage failure, safe logging, cleanup without
the master key, and same-name secret isolation, native account-home
mutation guards, lease takeover/expiry, and live agent/plugin deletion
cascades.
- Direct server TypeScript check, DB/shared typechecks, migration
numbering/safety checks, module boundaries, and git diff check passed.
- Full workspace typecheck and build were attempted; both stop at the
missing local cargo toolchain. The full test command was started and
stopped after failures in unchanged native-runtime/workspace suites plus
bundled-PostgreSQL skips; it did not complete. CI must verify the full
toolchain paths.
- Current head `c0f8bfd12477ad509252ecd40e168a6c84dbeb36`: all 55 CI
checks passed, including the previously canceled e2e shard. Greptile
Apex reviewed this exact head at 5/5 with no unresolved threads. GitHub
reports the branch mergeable and clean.
- No live provider probe, production data access, or deployment.
Reviewed the diff for credentials, private references, and run
artifacts.

## Risks

Apply migration 0339_luxuriant_iron_monger.sql before deploying tenant
code. It adds nullable ownership columns, a partial unique index,
foreign keys, and a stricter scope constraint. Existing rows remain
valid. Keep the schema on application rollback. Preserve the existing
secrets master key through deployments and backup restoration.

The lifecycle request/result now has a sensitive, server-only field.
Plugins must never log it or return it to an agent or browser. Values
stay in the tenant database through the existing encryption provider.
Trusted runtime consumers must apply normal execution admission before
resolving them. Older hosts omit instanceSecrets; plugins that require
durable storage must reject those hosts.

## Model Used

OpenAI GPT-6 via Codex, with reasoning, repository inspection, code
editing, and local test execution. The exact serving model identifier
and context window are not exposed in this session.

## 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 (e.g. `docs/...`, `fix/...`)
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

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-10-13 10:13:42 -07:00
..
…
…
…
…
…

Paperclip feature map

Start here when reproducing a user-facing bug, verifying a change, or deciding which surfaces a fix must cover. Each recipe describes what a person can do, where they can do it, the expected result, and the evidence needed to verify it. Product behavior is still governed by the implementation spec.

The sibling agent access map records APIs, agent entry points and permission boundaries for the same capability IDs. Follow the shared map contract when maintaining either map.

Features

The map is organized by user capability, not by source file. It covers 35 feature families across the product, CLI, and operator workflows, checked against source on 2026-10-12. Experimental and developer-only surfaces are labeled explicitly. Each recipe includes sub-features, current entry points, automated evidence, manual verification steps, and gotchas.

Getting started and access

Feature What it covers
Onboarding and first work Instance setup, company wizard, first agent and task.
Login, invitations, and access Sessions, bootstrap, membership, roles, and CLI authorization.
Companies and portability Company switching/settings, archival, package import/export.

Tasks and conversations

Feature What it covers
Task creation and lifecycle Creation, assignment, lists, properties, comments, and completion.
Delegation, dependencies, and signoff Child work, prerequisites, reviewers, and task-tree controls.
Inbox, decisions, and search Personal triage, decision queues, unread/blocked views, search, and personal task toasts.
Agent conversations and project handoff Persistent conversations, discovery, handoff, and gated board chat.
Questions and approvals Question/plan responses, formal approvals, and app-tool review.
Steering and queued messages Follow-ups, queue edits, interruption, and pause/resume.
Documents, attachments, and work products Versioned documents, annotations, files, outputs, and artifact library.

Agents and reusable capabilities

Feature What it covers
Hiring, configuration, and organization Agent identity, instructions, reporting lines, lifecycle, and built-ins.
Runs, harnesses, and model accounts Adapter/model setup, account validation, transcripts, and run history.
Skills and Skill Studio Discovery, sources, authoring, revisions, tests, and agent policies.
Team packages and installation Catalog preview/install via CLI/API; catalog UI availability called out.

Projects and execution

Feature What it covers
Projects and repositories Project lifecycle, task context, repository configuration, and defaults.
Goals and work alignment Goal hierarchy, ownership, status, and project/task context.
Workspaces, services, and files Provisioning, task bindings, services/logs, Git/files, and closure.
Execution environments Local, SSH, sandbox providers, target probes, and custom images.
Recovery Stopped work, workspace repair, bounded continuation, and reconnect.

Apps, channels, and extensions

Feature What it covers
Connection setup Catalog, MCP links, task requests, authentication, and setup resumption.
App access and action permissions Agent grants, off/ask/allowed actions, discovery, tests, and revocation.
External chat and email Provider-specific identity, threads, files, delivery, and endpoint upkeep.
Tool gateways and access profiles Tool exposure, client configuration, tokens, profiles, and activity.
Secrets and proposals Company/user credentials, grants, proposals, and vault import.
Plugins Installation/configuration, contributed pages/tools, and lifecycle.

Automation and structured work

Feature What it covers
Routines, schedules, and triggers Definitions, variables, scheduled/webhook/manual runs, and history.
Pipelines, review queues, and learnings Experimental stages, automation, items, review, and learning records.
Cases Experimental structured fields, relationships, revisions, and task links.
Status cards Experimental summaries, watched work, refresh history, and settings.

Oversight and operation

Feature What it covers
Costs and budgets Spend reports, scoped limits, incidents, hard stops, and resumption.
Dashboards and audit trails Company health, live work, activity, runs, routines, and timeline.
Navigation, profile, and announcements Sidebar state, favorites/recents, personal identity, and dismissals.
Instance operations Installation, updates, service health, configuration, and backups.
CLI/API and local worktrees Explicit context, resource commands, outputs, runs, and isolated instances.

Contributor surfaces

Feature What it covers
Developer previews and diagnostic labs Design examples, interaction fixtures, performance checks; not production acceptance.

These are verification instructions, not a claim that every journey passed a live test. A component test proves its component; a scripted provider proves that fixture integration. Record executed results separately from the map.

Before driving a journey

  1. Use this checkout's isolated test drive for manual product checks. It creates a temporary instance and prints its URL and data directory. Do not guess that a server on port 3100 belongs to you.
  2. Record the commit, URL, company, login role, relevant experimental settings, adapter, runtime mode, and live versus simulated dependencies. Use disposable tasks and provider resources. A fresh test drive creates a company and CEO, but no task or first run.
  3. Use the current navigation and company prefix. Paths in recipes omit that prefix. Record whether the streamlined or production shell is selected; Agent Chat, chat connectors, and the combined Inbox/Tasks view have separate gates. A hidden surface is an unmet prerequisite, not a successful test.
  4. Run the smallest relevant test first. Vitest commands below run from the repository root after installing dependencies. Playwright recipes use their named configuration and its isolated environment, not an unrelated running instance. Reserve expensive runner/provider tests for the behavior at issue.
  5. Exercise the actual user action, inspect its result, reload, and verify the persisted state or continuation. Use read-only API checks to corroborate UI evidence; creating state through the API does not prove the creation UI.

For agent-driven acceptance work, start with the Paperclip verification skill for an isolated launch, ownership/readiness checks, browser driving, evidence, and cleanup. It uses this directory as its feature map. The existing dev-workspace run/verify skill and evaluation skill describe runtime ownership and evidence handling. Reuse them; this map introduces no environment launcher, credentials, scheduled job, or second test framework.

Evidence contract

Report each entry point as passed, failed, blocked (with its missing prerequisite), or not run. Include the feature filename and entry-point ID, commit/environment, user action, expected and observed result, command/exit code, and evidence links. Screenshots or traces should show both the action and the discriminating result. Include task/run/request IDs when relevant, without secrets.

A fix is verified across its affected surfaces only when each has evidence or an explicit reason it does not apply. Shared code alone does not prove parity. Keep product regressions visible; do not change the recipe to bless a failure. For Paperclip-assigned work, attach evidence through the artifact workflow.

Inventory and remaining depth

The UI coverage inventory accounts for every non-test TSX module under ui/src/pages, including supporting panels, legacy variants, and labs. Every product area now links to concrete recipes. Partial means the area still has the named variant or workflow gaps; unmapped is reserved for an area with no recipe. These statuses describe documentation, not runtime health.

The page inventory is a source snapshot dated 2026-10-05. The map also includes entry points hosted inside other modules (pipeline Review Queue and Learnings, task documents, onboarding), CLI-only operations, and operator work. The team recipe explicitly distinguishes the current CLI/API path from catalog UI components without a current top-level route. Refer to route registration and the CLI registry when changing reachability.

Remaining depth includes complete provider/auth/attachment matrices, every harness/model/environment capability combination, third-party plugin features, and every role/error/mobile/legacy-shell permutation. The recipes name relevant gaps instead of equating source presence with a working user journey. The index can include capabilities that do not add a page file.

Maintaining the reference

The map documents user journeys. It does not execute them automatically; coverage.json records documentation scope rather than live test health.

When maintaining a recipe, compare its entry points and expected results with the current source. Check that linked tests still exercise the stated behavior and that local references still exist. Refresh the inventory snapshot when it helps explain the current product. Keep the same-named agent access companion and stable sub-feature IDs aligned when behavior or access changes. Source-only access inventory remains distinct from live verification. Run node scripts/check-maps.mjs after map edits for structural/reference checks; follow the shared contract for the source and behavioral checks it cannot perform.

Each recipe starts with an H1 and a user-visible description, then exactly:

  1. Sub-features — stable backticked IDs and observable behavior/states.
  2. How to get to it (user POV) — one H3 backticked entry-point ID per surface.
  3. Driving it with — starts with Preconditions:; repeat each entry-point H3, with Automated: and Manual: paragraphs. Name test scope and gaps honestly.
  4. Gotchas — misleading look-alikes, feature gates, and invalid evidence.

New or updated entries follow Poteto's feature-map examples. Existing entries with a Driving it heading can adopt the named harness when their recipes are updated. The original format was inspired by Omnigent's feature map. Paperclip's recipes and checks follow its own task model and test infrastructure.