mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-19 16:29:42 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - People keep their areas and responsibilities in Paperclip (experimental, `enableResponsibilities`). Agents chat with them about this work. > - Agents have no dedicated tool to read a person's responsibilities. The only path is the generic `search_api` and `call_api` fallback. > - That path needs the person's user ID, and nothing in a chat tells the agent that responsibilities exist. When the feature is off, every route returns a 404 that looks like "nothing there". > - So a chief-of-staff agent asked the person "what are your responsibilities, or where are they written down?" when Paperclip already had them. > - This pull request adds three read tools, makes the owner default to the person the run works for, and tells agents in chats how to use the tools or that the feature is off. > - The benefit is that an agent reads and maps a person's responsibilities itself. This is phase 1 of 4. Later pull requests add the change tools for areas, responsibilities, routines and skills. ## Linked Issues or Issue Description **Subsystem affected** Server (responsibility routes, native runner tool authority, chat prompt), native runner tool catalog, and the `paperclip` skill. **Problem or motivation** An agent in a chat cannot find a person's responsibilities. It has no dedicated tool. The list route requires `ownerUserId` from an agent, and the chat does not give the agent that ID. The chat prompt does not mention responsibilities. When the experiment is off, the 404 does not tell the agent that the feature is off. The agent then asks the person to list their responsibilities again. **Proposed solution** Add three optional native tools: `list_responsibilities`, `get_responsibility` and `find_responsibilities_for`. They call the existing routes with the run's agent token, so all route checks and the activity log stay the same. The owner defaults to the person the run works for. The routes return a `responsibilities_disabled` code while the feature is off. The tools are hidden while the feature is off, and the chat prompt then says that the feature is off. **Alternatives considered** Better `search_api` guidance alone still needs the user ID and many calls. A new read service in the tool authority would copy the route permission rules. The tools use the routes instead. ## What Changed - Add `list_responsibilities` (areas with their responsibilities, responsibilities with no area, totals, and company work filed under no responsibility), `get_responsibility` (one responsibility with its filed items, link IDs, skills and latest status report), and `find_responsibilities_for` (where a project, task or routine is filed; a task can be a `PAP-12` identifier). - Add `server/src/services/responsibility-tools.ts`. It calls the routes over HTTP with the run token and returns compact results with page links. - When an agent sends no `ownerUserId`, the responsibility list, create, summary, automation and dashboard routes use the person the run works for (`onBehalfOfUserId`). A run that works for no person still gets a 422 with a clear message. - The nine "not enabled" checks now throw one shared error. The 404 and its message do not change. The body now also has `code: "responsibilities_disabled"` and a remediation line. One `RESPONSIBILITIES_OFF_GUIDANCE` text is the remediation, the tool error and the chat prompt note. - `list_responsibilities` with `areaId` counts only that area. Archived areas are listed only on request. When only proposals are hidden, the tool says so. - `services/paperclip-api-loopback.ts` holds the tools' authenticated API call; the project tools use it too. - Show the tools only while the instance has Responsibilities on. A hidden tool that is called by name returns "Areas and responsibilities are turned off". - In standing chats, add an "Areas and responsibilities" prompt block: use the tools before you ask the person, or say that the feature is off. - `search_api` results for these routes now name the dedicated tools. - Add an "Areas and responsibilities" section to `skills/paperclip/SKILL.md` and to `references/api-reference.md`. Add one line to the chief-of-staff persona. - Register the tools in the runner catalogs. Regenerate the semantic contracts, the action catalog, protocol coverage, the operation-groups spec and the capability inventory. Update the pinned counts. ## Verification - `pnpm --filter @paperclipai/paperclip-runner exec vitest run src/catalog src/semantic-tools src/tools src/eval/workflow-evals.test.ts src/protocol-actions src/evals/native-execution.test.ts src/drivers/acpx/permission-policy.test.ts`: 276 passed. - All runner generator checks pass: protocol manifest, capability contract, capability inventory, protocol coverage, semantic contracts, semantic action catalog, operation groups, replay goldens, workflow traceability. - Server: `vitest run` of `responsibilit*` route tests, `responsibility-tools.test.ts` (new), `task-markdown.test.ts`, `task-context*`, `paperclip-runner-tool-authority.test.ts`, `runner-api.test.ts`, onboarding first-task tests and `user-facing-wording-guidance.test.ts`: 20 files, 2620 tests passed. - `node scripts/typecheck-layers.mjs` for the server: passed. - New tests cover these items: the owner default for an agent and the 422 without a person, the `responsibilities_disabled` code on every route, the tool projections, an identifier lookup, the "turned off" mapping, the tool visibility switch, and the chat prompt block. ## Risks - Low risk. The routes keep their permission checks. Agents can still only read and propose in this phase. - An agent that sends no `ownerUserId` now gets the responsible person's list instead of a 422. Agents that name an owner see no change. - The chat prompt gets one more short block in standing chats. - The flag is pinned when a turn opens. If an admin changes it during a turn, the tool list changes on the next turn. The routes always check the current setting. ## Model Used Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with 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 (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 - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>