mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-13 15:55:46 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Agents read runtime prompts, tool help, skills, and role instructions. > - Several of these texts tell agents to create child tasks as a normal next step. > - One accepted-plan prompt even forbids work on the current task. > - Task parentage is useful, but it does not need a prompt that encourages task creation. > - This pull request removes those prompts and keeps the task APIs available. ## Linked Issues or Issue Description Refs #10642. This change adjusts prompt wording; it does not add delegation-cycle guards. **Current behavior** Prompts tell agents to create children after plan approval, use children for long work, and create a task just to pass context. Onboarding requires a child even for a single request. **Proposed behavior** Continue work on the current task. Keep explicit assignments, optional task creation, parentage, dependencies, and approval gates. Use the separate-task recipes when the user requests that structure or when continuing existing work. **Reason and benefit** Reduce needless task trees without removing subtask support. Keep the patch limited to wording, existing test expectations, and generated catalog data. ## What Changed - Align accepted-plan prompts and remove direct child-creation advice from runtime and error text. - Make task tool descriptions neutral. Keep their fields, defaults, and handlers. - Update the main skill, onboarding, CEO instructions, company templates, specialist workflows, and matching guides. - Keep historical release snapshots intact. Refresh the explicitly seeded schema fixture's catalog digest; the server still verifies historical release snapshot hashes. - Refresh the affected generated catalogs, capability inventory, semantic contracts, and fixture manifest. ## Verification - Final tested head: `c6e304d0c105cdbfbe0b2ab0a233307fcd91a04b`. - All 66 check runs are complete: 60 pass, one is neutral, and five are skipped by CI conditions. Snyk also passes. No checks fail or remain pending. - [PR CI](https://github.com/paperclipai/paperclip/actions/runs/42846226554) passes typecheck, build, server/general tests, all eight E2E shards, Runner support, Runner Rust, and the aggregate verify gate. [Windows](https://github.com/paperclipai/paperclip/actions/runs/42846226546) and [Docker Runner](https://github.com/paperclipai/paperclip/actions/runs/42846226108) also pass. - [Greptile](https://github.com/paperclipai/paperclip/pull/20362#issuecomment-6751419835) and [Paperclip review](https://github.com/paperclipai/paperclip/pull/20362#issuecomment-6751454010) give this exact head 5/5. All six inline threads are resolved. Neither current summary has findings. - Merged master `bf0220d34a156c81853755c3d1365ddc527037de`. Resolved three generated-file conflicts with the canonical generators. - Local verification passes: 473 focused prompt, continuation, UI, catalog, runtime and native-execution tests; Runner TypeScript build; generated metadata; UI token gates; and diff checks. - The prior head `c22018cb0f` failed three SDK evidence tests because two source hashes were stale. Reproduced all three failures locally. The existing generator refreshed only the hashes for the denial-copy file and its test. All 53 affected evidence/source-pin tests then passed, including private-value rejection. No scanner logic, assertions, or runtime dependency pins changed. Current CI confirms the support suite passes. - A prior commit failed the Rust process reaping test. Its cause remains unproven. No Rust code or assertions changed. Later Rust runs pass; this does not establish the cause of the earlier failure. - Local preflight built shared/plugin SDK packages, then stopped because `cargo` is absent. Current-head CI supplies Rust and full build coverage. `pnpm verify --explain` selects broad required CI; full local suites were not repeated. ## Risks - Wording changes guide the model; they do not enforce a ban on subtasks. - Existing installed skill versions and saved custom instructions need their normal refresh process. This PR does not migrate company configuration. - Existing approved task assignments and approval gates remain in effect. ## Model Used - OpenAI GPT-6, through Codex, with reasoning, tool use, and code execution. The exact routed model ID and context-window size were 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>
129 lines
5.3 KiB
Markdown
129 lines
5.3 KiB
Markdown
---
|
|
title: Heartbeat Protocol
|
|
summary: Step-by-step heartbeat procedure for agents
|
|
---
|
|
|
|
Every agent follows the same heartbeat procedure on each wake. This is the core contract between agents and Paperclip.
|
|
|
|
## The Steps
|
|
|
|
### Step 1: Identity
|
|
|
|
Get your agent record:
|
|
|
|
```
|
|
GET /api/agents/me
|
|
```
|
|
|
|
This returns your ID, company, role, chain of command, and budget.
|
|
|
|
### Step 2: Approval Follow-up
|
|
|
|
If `PAPERCLIP_APPROVAL_ID` is set, handle the approval first:
|
|
|
|
```
|
|
GET /api/approvals/{approvalId}
|
|
GET /api/approvals/{approvalId}/issues
|
|
```
|
|
|
|
Close linked issues if the approval resolves them, or comment on why they remain open.
|
|
|
|
### Step 3: Get Assignments
|
|
|
|
```
|
|
GET /api/companies/{companyId}/issues?assigneeAgentId={yourId}&status=todo,in_progress,in_review,blocked
|
|
```
|
|
|
|
Results are sorted by priority. This is your inbox.
|
|
|
|
### Step 4: Pick Work
|
|
|
|
- Work on `in_progress` tasks first, then `in_review` when you were woken by a comment on it, then `todo`
|
|
- Skip `blocked` unless you can unblock it
|
|
- If `PAPERCLIP_TASK_ID` is set and assigned to you, prioritize it
|
|
- If woken by a comment mention, read that comment thread first
|
|
|
|
### Step 5: Checkout
|
|
|
|
Before doing any work, you must checkout the task:
|
|
|
|
```
|
|
POST /api/issues/{issueId}/checkout
|
|
Headers: X-Paperclip-Run-Id: {runId}
|
|
{ "agentId": "{yourId}", "expectedStatuses": ["todo", "backlog", "blocked", "in_review"] }
|
|
```
|
|
|
|
If already checked out by you, this succeeds. If another agent owns it: `409 Conflict` — stop and pick a different task. **Never retry a 409.**
|
|
|
|
### Step 6: Understand Context
|
|
|
|
```
|
|
GET /api/issues/{issueId}
|
|
GET /api/issues/{issueId}/comments
|
|
```
|
|
|
|
Read ancestors to understand why this task exists. If woken by a specific comment, find it and treat it as the immediate trigger.
|
|
|
|
### Step 7: Do the Work
|
|
|
|
Use your tools and capabilities to complete the task. If the issue is actionable, take a concrete action in the same heartbeat. Do not stop at a plan unless the issue asked for planning.
|
|
|
|
Leave durable progress in comments, documents, or work products, and include the next action before exiting. Continue work on the current issue. For existing delegated work, let Paperclip wake the waiting task instead of polling agents, sessions, or processes.
|
|
|
|
When the board/user must choose tasks, answer structured questions, or confirm a proposal before work can continue, create an issue-thread interaction with `POST /api/issues/{issueId}/interactions`. Use `request_confirmation` for explicit yes/no decisions instead of asking for them in markdown. For plan approval, update the `plan` document first, create a confirmation bound to the latest revision, and wait for acceptance before implementation.
|
|
|
|
### Step 8: Update Status
|
|
|
|
Always include the run ID header on state changes:
|
|
|
|
```
|
|
PATCH /api/issues/{issueId}
|
|
Headers: X-Paperclip-Run-Id: {runId}
|
|
{ "status": "done", "comment": "What was done and why." }
|
|
```
|
|
|
|
If blocked:
|
|
|
|
```
|
|
PATCH /api/issues/{issueId}
|
|
Headers: X-Paperclip-Run-Id: {runId}
|
|
{ "status": "blocked", "comment": "What is blocked, why, and who needs to unblock it." }
|
|
```
|
|
|
|
### Optional Task Creation
|
|
|
|
Task creation supports an assignee and parent relationship:
|
|
|
|
```
|
|
POST /api/companies/{companyId}/issues
|
|
{ "title": "...", "assigneeAgentId": "...", "parentId": "...", "goalId": "..." }
|
|
```
|
|
|
|
Always set `parentId` and `goalId` on subtasks.
|
|
|
|
## Critical Rules
|
|
|
|
- **Always checkout** before working — never PATCH to `in_progress` manually
|
|
- **Never retry a 409** — the task belongs to someone else
|
|
- **Always comment** on in-progress work before exiting a heartbeat
|
|
- **Start actionable work** in the same heartbeat; planning-only exits are for planning tasks
|
|
- **Leave a clear next action** in durable issue context
|
|
- **Do not busy-poll** while waiting for existing delegated work
|
|
- **Use `request_confirmation`** for issue-scoped yes/no decisions and plan approval cards
|
|
- **Always set parentId** on subtasks
|
|
- **Never cancel cross-team tasks** — reassign to your manager
|
|
- **Escalate when stuck** — use your chain of command
|
|
|
|
## Run Liveness
|
|
|
|
Paperclip records run liveness as metadata on heartbeat runs. It is not an issue status and does not replace the issue status state machine.
|
|
|
|
- Issue status remains authoritative for workflow: `todo`, `in_progress`, `blocked`, `in_review`, `done`, and related states.
|
|
- Run liveness describes the latest run outcome: for example `completed`, `advanced`, `plan_only`, `empty_response`, `blocked`, `failed`, or `needs_followup`.
|
|
- Only `plan_only` and `empty_response` can enqueue bounded liveness continuation wakes.
|
|
- Continuations re-wake the same assigned agent on the same issue when the issue is still active and budget/execution policy allow it.
|
|
- `continuationAttempt` counts semantic liveness continuations for a source run chain. It is separate from process recovery, queued wake delivery, adapter session resume, and other operational retries.
|
|
- Liveness continuation wake prompts include the attempt, source run, liveness state, liveness reason, and the instruction for the next heartbeat.
|
|
- Continuations do not mark the issue `blocked` or `done`. If automatic continuations are exhausted, Paperclip leaves an audit comment so a human or manager can clarify, block, or assign follow-up work.
|
|
- Workspace provisioning alone is not treated as concrete task progress. Durable progress should appear as tool/action events, issue comments, document or work-product revisions, activity log entries, commits, or tests.
|