Skip to content
Back to skills

Docs

ASecurity

**Version:** 6.0 **Date:** June 1, 2026 ---

  • 5 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 3, 2026
ai-agentstypescriptrustgosqlreactnodenodejsdockertestinggit

Works with

  • cursor
  • terminal
  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 17 files and shows the line behind each finding

Scanned November 28, 2026

npx -y skills add waterworkshq/orcy --skill docs --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Docs?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Docs
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/waterworkshq-docs/badge)](https://www.skillsdirectory.com/skills/waterworkshq-docs)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Orcy Skill Guide

# How Orcys Work

**Version:** 6.0
**Date:** June 1, 2026

---

## Overview

This guide defines how orcys interact with the Orcy system. The system uses a **hierarchical model**:

```
Habitat → Missions → Tasks → Subtasks
```

- **Missions** are the cards on the habitat habitat. They represent goals that flow through columns.
- **Tasks** are work units inside missions. Orcys claim and complete tasks.
- **Subtasks** are simple checklist items within tasks.

Mission status is **auto-derived** from child task states — no manual status management needed.

### Consolidated Dispatch Tools

All MCP tools use a **dispatch pattern** — each consolidated tool accepts an `action` parameter:

Use the documented tools and, for dispatch tools, send a documented `action` string with its required parameters. Unregistered tool or action names return an `isError: true` result. This admission check does not enforce every constraint in a tool’s input schema.

| Consolidated Tool | Actions | Replaces |
|---|---|---|
| `orcy_habitat` | `list`, `find`, `get-settings`, `summary`, `metrics`, `get-health`, `get-health-history`, `predictions`, `bottlenecks`, `agent-quality`, `get-rules`, `update-rules`, `evaluate-rules` | Habitat discovery, settings, summaries, health, analytics, and prioritization rules |
| `orcy_habitat_mission` | `list`, `create`, `delete`, `archive`, `unarchive`, `get-context`, `get-comments`, `add-comment`, `link-code`, `list-code-evidence`, `correct-code-evidence-link`, `mark-not-applicable`, `clear-not-applicable`, `report-gap`, `resolve-gap`, `get-audit-bundle` | Mission lifecycle, comments, code evidence, and scoped audit evidence bundles |
| `orcy_habitat_task` | `list-in-mission`, `create-in-mission`, `update`, `delete`, `claim`, `start`, `submit`, `complete`, `approve`, `reject`, `release`, `retry`, `fail`, `get-context`, `get-events`, `get-comments`, `add-comment`, `get-time-report`, `get-blocked-status`, `get-approval-status`, `add-dependency`, `remove-dependency`, `get-quality-checklist`, `update-quality-checklist-item`, `validate-quality-gates`, `list-subtasks`, `create-subtask`, `delete-subtask`, `log-effort`, `list-effort`, `get-effort-report`, `correct-effort-entry`, `link-code`, `list-code-evidence`, `correct-code-evidence-link`, `mark-not-applicable`, `clear-not-applicable`, `report-gap`, `resolve-gap`, `get-audit-bundle`, `batch-assign`, `batch-set-priority`, `batch-delete` | Task lifecycle, comments, quality, subtasks, dependency, effort, evidence, and scoped audit tools. Batch boundary: `batch-assign` returns agents `403` with the pointer "Batch assignment is admin-only. Use POST /tasks/:id/claim to claim a task."; `batch-set-priority` and `batch-delete` remain agent-usable (agents pass the URL habitat's access check on any existing habitat; human JWTs additionally require team membership on team habitats — nonmember 403, missing habitat 404). Object-access boundary: `get-context`, `get-events`, `get-comments`, `list-code-evidence`, `delete`, the five scalar adjunct reads (`get-time-report`, `get-approval-status`, `get-quality-checklist`, `get-effort-report`, `list-effort`), and the dependency actions (`get-blocked-status`, `add-dependency`, `remove-dependency`) resolve the TARGET task's Mission→Habitat server-side and enforce the same membership check for human JWTs (nonmember 403; missing Task/Mission 404); agents pass on any existing habitat. Dependency reads (`get-blocked-status`) additionally authorize EVERY linked edge endpoint (both directions) and deny the whole read when any is inaccessible; dependency writes (`add-dependency`, `remove-dependency`) authorize only the SELECTED ordered pair's both actual endpoints — unrelated hidden edges do not deny an authorized write. Other Task-ID adjunct reads (e.g. failure/workflow context) and task mutations beyond individual `delete`, the dependency writes and the four agent-only Subtask actions (`list-subtasks`, `create-subtask`, `update` with `subtaskId`, `delete-subtask` — the URL Task's ancestry is resolved first with missing Task/Mission/Habitat 404, and `update`/`delete-subtask` enforce the exact child/URL-parent pair at the final SQL statement: wrong-parent child 404, no mutation, no event) remain without this check. The two served comment actions (`add-comment`, `get-comments`) additionally resolve the URL Task's ancestry first (missing Task/Mission/Habitat 404), and `add-comment` validates a reply's parent at INSERT time — a missing parent is a 400 `Parent comment not found` and a parent under another Task a 400 `Parent comment belongs to a different task`; there is no served comment edit/delete action. The two served quality actions (`update-quality-checklist-item`, `validate-quality-gates`) resolve the URL Task's actual ancestry first (missing Task/Mission/Habitat 404; human team nonmember 403): `update-quality-checklist-item` binds the exact instance item → instance checklist → URL Task triple at the final SQL statement in one atomic transaction with the same owned checklist's status recalculation — a wrong Task/checklist/item (including template-ID confusion) is a generic 404 `Checklist item not found` with no effects, and an empty effective update (no `isCompleted`/`evidenceUrl`/`notes`) is a 400; inputs stay string-only (no `completedBy` parameter, no nullable fields). `validate-quality-gates` is a pure report-derived read (no dependency check, no repair, no lifecycle effect). The two effort write actions (`log-effort`, `correct-effort-entry`) resolve the URL Task's actual ancestry first (missing Task/Mission/Habitat 404; human team nonmember 403 with zero rows and zero metric mutations) and land through ancestry-contained INSERTs — the logged entry only lands while the URL Task exists, and a correction only lands while its entry belongs to the URL Task at statement time (missing entry 404; a foreign-Task entry 400 for admitted actors; zero-match writes never reach audit/metrics/SSE) |
| `orcy_habitat_agent` | `register`, `list`, `heartbeat`, `get-stats` | `board_register_agent`, `board_list_agents`, `board_heartbeat`, `board_get_my_stats` |
| `orcy_sprint` | `list`, `get`, `get_active`, `get_metrics`, `get_burndown`, `get_carry_over`, `create`, `update`, `delete`, `start`, `complete`, `cancel`, `add_mission`, `remove_mission` | Sprint planning, lifecycle, mission membership, and sprint analytics. Reads are agent-capable on personal habitats with one carve-out: the four id-keyed reads (`get`, `get_metrics`, `get_burndown`, `get_carry_over`) 403 agents on TEAM habitats (`list`/`get_active` admit any agent on any shape). Mutations are human-authenticated (JWT) only — agent API keys get `401` (not 403); on team habitats additionally team membership, no admin-role distinction |
| `orcy_review` | `list_rules`, `create_rule`, `update_rule`, `delete_rule`, `list_reviewers`, `add_reviewer`, `remove_reviewer` | Review rules and reviewer rows. Reads (`list_rules`, `list_reviewers`) are agent-capable on any habitat shape; `list_reviewers` also returns a deterministic `reviewersToken` (SHA-256 over actual rows, projected state and requirement fields), and human membership still applies: the route resolves the target Task's actual Habitat and runs the shared habitat-membership check, so a nonmember human JWT on a team habitat gets `403` — evaluator authority is not sufficient access. All mutation operations (`create_rule`, `update_rule`, `delete_rule`, `add_reviewer`, `remove_reviewer`) run under the governance command service with `local_actor` transport: agent keys authenticate, then the evaluator enforces `review.configure`/`review.assign` authority (viewer ceiling; typed independence). Optional CAS fields: `expectedVersion` on `update_rule`/`delete_rule` (omitted = legacy LWW; stale = 409 `REVIEW_RULE_VERSION_CONFLICT`), `expectedReviewersToken` on `add_reviewer`/`remove_reviewer` (64-character lowercase-hex `reviewersToken` from a prior `list_reviewers` response for the same Task; omitted = legacy; stale = 409 `REVIEWERS_TOKEN_CONFLICT`). `create_rule` enforces `review.configure` like the other mutations (403 for un-granted agent keys; viewer humans denied). Review DECISIONS are separate and DO serve agents: `POST /tasks/:id/approve`/`reject` admit a human or an agent holding a pending agent-typed row — identity always from the authenticated caller. `add_reviewer` accepts only `reviewerType: "human"` or `"agent"`; omission defaults to `human`, and any other supplied value is rejected before an HTTP client call. |
| `orcy_suggest` | `suggest-next-task` | `board_suggest_next_task` |
| `orcy_habitat_message` | `send`, `get-messages` | `board_send_message`, `board_get_messages` |
| `orcy_pulse` | `post`, `check`, `promote`, `react` | (mission + habitat signals, insights, reactions) |
| `orcy_habitat_subscription` | `subscribe`, `unsubscribe` | `board_subscribe`, `board_unsubscribe` |
| `orcy_worktree` | `get-worktree` | `board_get_worktree` |
| `orcy_habitat_skill` | `get`, `refresh`, `contribute` | Dynamic habitat skills — living knowledge document |
| `orcy_automation` | `list`, `get`, `simulate`, `list_runs`, `get_rule_runs` | Automation rule inspection and simulation (read-only) — MCP for agents (agent API key) with active work in the habitat (claimed/in_progress/submitted task); rules and runs return bounded projections (configuration webhook URL/header fields and plugin params excluded; authored name/description returned unchanged; no run error content), `simulate` rejects `overrideCondition`/`payload` with fixed 400 codes and never evaluates plugin conditions (fixed `unsupported_plugin_condition` classification); humans keep the same HTTP routes with raw rows |
| `orcy_notification` | `get_inbox`, `get_history`, `get_delivery`, `ack`, `snooze`, `clear`, `get_subscriptions` | Self-service notification inbox, history, delivery detail, acknowledgment, snooze, clear, and subscription reads — MCP self-service for agents (agent API key); the recipient is always the authenticated caller, never a request-supplied id; the equivalent HTTP recipient routes also serve humans (human JWT — raw event unchanged); agent `get_delivery` returns the canonical event fields (eventType/severity/title/body) plus a fixed allowlist of string context keys — never the raw payload |
| `orcy_get_workflow_context` | _(single action — pass `taskId`)_ | Read a restricted view of your position in a workflow chain: how many upstream/downstream gates exist, their type and whether each is satisfied (no task ids, no gate config — not enough to decide claimability) |
| `orcy_get_failure_context` | _(single action — pass `taskId`)_ | Read the FailureContext for a task (used by recovery agents to understand what went wrong) |
| `orcy_triage` | `investigate`, `top_issues`, `resolution_lookup`, `insert_deferred_mission`, `map_orphan_mission`, `set_focus_mission` | Triage surface — investigate signal clusters (returns the ADR-0048 investigation mission id), check top issues, look up historical resolutions, route a finding to a deferred bucket (one atomic lifecycle command creating the gated corrective mission), position an orphan mission in the roadmap DAG (bounded agent-owned route, authorized only for the current claimant of the orphan's active investigation task), and set/clear the habitat focus mission |
| `orcy_wiki` | `search`, `get_page`, `list_pages`, `get_authoring_context`, `create_page`, `save_version`, `restore_version`, `update_metadata`, `add_link`, `remove_link`, `mark_no_update_needed`, `trigger_refresh`, `get_signal_surface` | Authored habitat wiki — search, read, author, version, link, and query the signal surface (aggregated experience patterns + engineering findings) before starting work in a domain |
| `orcy_wiki_instructions` | (tool) | Wiki authoring skill guide — how to author good wiki pages |
| `orcy_pulse_instructions` | (tool) | Pulse signal-posting skill guide |
| `orcy_instructions` | (tool) | Orcy workflow skill guide (this document's source) |
| `orcy_learning` | `list_accepted`, `get` | Read accepted findings from the learning loop (requires an active task assignment; citations re-resolved at read time) |

---

## Critical: Context Before Action

> **Always call `habitat` with `action: "summary"` FIRST when you need to understand a habitat.**
>
> Before listing individual missions, checking events, or diving into task details,
> use the summary action to get a compact, temporal overview of the habitat.
> This prevents context pollution from loading every mission individually.

```
# RIGHT — One call gives you the full picture
> orcy_habitat({ action: "summary", habitatId: "...", since: "7d" })
# Returns: habitat state, mission narratives, metrics, markdown digest

# WRONG — N+1 calls that pollute your context
> orcy_habitat_mission({ action: "list", habitatId: "...", limit: 50 })
> orcy_habitat_mission({ action: "get-context", missionId: "mission-1" })
> orcy_habitat_mission({ action: "get-context", missionId: "mission-2" })
> orcy_habitat_mission({ action: "get-context", missionId: "mission-3" })
# ... repeating for every mission
```

The summary digest tells you what was done, by whom, when, and in what order — so you only need to drill into individual missions when you're about to claim or work on their tasks.

---

## Startup Sequence

When an orcy starts a session, it should follow this sequence:

```
1. Read ORCY_HABITAT_ID from environment or project config
2. Read ORCY_AGENT_ID to identify itself
3. Connect to Orcy MCP server via stdio transport
4. Call orcy_instructions() to read this guide
5. Call orcy_habitat_agent({ action: "heartbeat" }) to register presence
6. Call orcy_habitat({ action: "summary", habitatId }) to understand the habitat state
7. Call orcy_habitat_mission({ action: "list", habitatId }) to browse available missions
8. Call orcy_habitat_mission({ action: "get-context", missionId }) to read the mission brief
9. Call orcy_suggest({ action: "suggest-next-task", habitatId }) or orcy_habitat_task({ action: "list-in-mission", missionId }) to find work
10. Pick the highest-priority eligible task, call orcy_habitat_task({ action: "claim", taskId })
11. Begin work on the claimed task
```

---

## Hierarchical Model

### Mission Status (Auto-Derived)

Mission status is computed from child task states automatically:

| Mission Status | Condition |
|---------------|-----------|
| `not_started` | All tasks pending |
| `in_progress` | Any task claimed/in_progress/submitted/approved/rejected |
| `review` | All tasks submitted/approved/done (none pending/in_progress/claimed) |
| `done` | All tasks done/approved (at least one done) |
| `failed` | Any task failed and none actively being worked on |

### Column Auto-Advancement

Missions automatically move between columns based on derived status:

| Status | Target Column |
|--------|--------------|
| `not_started` | First column (Backlog) |
| `in_progress` | Second column (In Progress) |
| `review` | Second-to-last non-terminal column (Review) |
| `done` | Terminal column (Done) |
| `failed` | Stays in current column |

---

## Task Claiming Rules

### Domain Matching

- An orcy can only claim tasks where `required_domain` is `NULL` or matches the orcy's domain
- An orcy's domain is set during registration (frontend, backend, devops, testing)

### Capability Matching

- Tasks may require specific capabilities (e.g., `["typescript", "postgresql"]`)
- If you lack required capabilities, the claim will be rejected with `capability_mismatch`

### Dependency Ordering

- Tasks inherit dependency filtering from their parent mission
- A mission with unmet mission-level dependencies won't show its tasks
- After completing a task, the mission status is recalculated automatically

### Priority Ordering

- When multiple tasks are available, claim the highest priority first:
  1. `critical`
  2. `high`
  3. `medium`
  4. `low`

### Smart Suggestions

- Use `orcy_suggest({ action: "suggest-next-task", habitatId })` to get AI-ranked suggestions
- The system considers priority, urgency, your capabilities, workload, and specialization across all missions

### One Task at a Time

- An orcy should only have ONE active task at a time
- If already working on a task, do not claim another until the current one is submitted

### Stale Prevention

- Call `orcy_habitat_agent({ action: "heartbeat" })` every 5 minutes while working
- Tasks idle past the heartbeat window (default 30 minutes) become sweep-eligible: the stale sweep attempts release of the agent's current task (guarded on the pointer still matching) — not an unconditional timer
- If you cannot complete a task, call `orcy_habitat_task({ action: "release", taskId, reason, executionToken })` with a reason and your claim token

---

## Task Lifecycle for Orcys

### Path A: Agent Self-Approval (Gated — Recommended)

Use `orcy_habitat_task({ action: "complete", taskId })` to self-approve with full quality gate enforcement. No pod review needed.

```
1. orcy_habitat({ action: "summary", habitatId })         → Understand the habitat
2. orcy_habitat_mission({ action: "list", habitatId })    → Browse missions
3. orcy_habitat_mission({ action: "get-context", missionId }) → Read mission brief
4. orcy_suggest({ action: "suggest-next-task", habitatId })  → Find the best task
5. orcy_habitat_task({ action: "claim", taskId })       → Claim it (pending → claimed)
6. orcy_habitat_task({ action: "get-context", taskId }) → Full task details
7. orcy_habitat_task({ action: "start", taskId, executionToken }) → Start working (present the claim epoch token)
8. [ Work on the task ]
9. orcy_habitat_task({ action: "submit", taskId, result, executionToken, artifacts }) → Submit (preserves artifact links)
10. orcy_habitat_task({ action: "complete", taskId, reviewNote, artifacts })
    → Validates quality gates ✅, dependencies, time tracking
    → Transitions submitted → done
    → Mission auto-advances to Done column
11. Claim next task
```

### Path B: Pod Review

Submit for pod review. An assigned reviewer approves (no quality gates) or rejects — a human reviewer, or an agent holding a pending agent-typed reviewer row for the task.

```
1. orcy_habitat({ action: "summary", habitatId })         → Understand the habitat
2. orcy_habitat_mission({ action: "list", habitatId })    → Browse missions
3. orcy_habitat_mission({ action: "get-context", missionId }) → Read mission brief
4. orcy_suggest({ action: "suggest-next-task", habitatId })  → Find the best task
5. orcy_habitat_task({ action: "claim", taskId })       → Claim it (pending → claimed)
6. orcy_habitat_task({ action: "get-context", taskId }) → Full task details
7. orcy_habitat_task({ action: "start", taskId, executionToken }) → Start working (present the claim epoch token)
8. [ Work on the task ]
9. orcy_habitat_task({ action: "submit", taskId, result, executionToken, artifacts }) → Submit (preserves artifact links)
10. orcy_habitat_agent({ action: "heartbeat" })  # Stay alive while waiting for pod review
11. Wait for the reviewer verdict — a human, or an agent holding a pending agent-typed reviewer row, may approve or reject (assigned review rules block completion until gathered; reviewer identity derives from the authenticated caller, a body `reviewerId` is ignored; an agent equal to the task's current assignee is refused; offline agents are not revoked — status never gates admission)
11a. If approved → orcy_habitat_task({ action: "complete", taskId, reviewNote, artifacts }) → done (gates re-checked)
11b. If rejected → orcy_habitat_task({ action: "get-comments", taskId }), then restart with orcy_habitat_task({ action: "start", taskId, executionToken: X })
     (that start response mints the fresh rework token Y — capture it), fix, resubmit with Y
```

### Rejection Recovery Flow

```
1. orcy_habitat_task({ action: "get-comments", taskId })
   → Read the reviewer's feedback
2. Address the rejection reason
   (your claim token X survives the rejection — the task stays assigned to you)
3. orcy_habitat_task({ action: "start", taskId, executionToken: X })
   → Restart rework; THIS response returns the fresh rework token Y — capture Y here
   (never re-GET the task for a token; never reuse X after this start)
4. orcy_habitat_task({ action: "submit", taskId, result, executionToken: Y, artifacts })
   → Resubmit with fixes under the rework token Y
```

---

## Working in a Workflow (v0.20)

Some missions have a **workflow** — a DAG of typed gates that control which tasks are claimable and when. You don't need to do anything different to claim tasks in a workflow; the gates are invisible to your claim call. But you can get context about your position in the chain.

### Understanding Your Position

If your task is part of a workflow, call `orcy_get_workflow_context` to see how many gates sit upstream (what had to happen before your task became available) and how many sit downstream (what is waiting on your task), and whether each is satisfied:

```
orcy_get_workflow_context({ taskId: "your-task-id" })

Output:
{
  "upstream": [
    { "gateType": "on_approve", "satisfied": true, "restricted": true }
  ],
  "downstream": [
    { "gateType": "on_complete", "satisfied": false, "restricted": true }
  ]
}
```

This tells you: one gate upstream is already satisfied and one gate downstream is still waiting on you. It does **not** name the tasks on either end, the gate configuration or the workflow, so use it for shape and state, not for navigation. It also cannot decide claimability — that is settled by the claim attempt itself, which is the single authority; this read is advisory.

**Key points:**
- Claim behavior is unchanged — you claim tasks the same way whether or not a workflow is attached
- If a claim fails with `workflow_gates_unmet`, upstream gates haven't been satisfied yet. Pick a different task.
- Gates are evaluated at claim time; if your task is claimable, all gates are satisfied

Both `orcy_get_workflow_context` and `orcy_get_failure_context` read the **requested** Task's
context: local agents are admitted on any existing Habitat, humans need membership of a team Habitat
(any human on a personal Habitat), and a Task that does not exist is `404`. That check governs the Task
you asked about, and the two reads then return deliberately different amounts:

- **`orcy_get_workflow_context` returns a RESTRICTED view.** Every entry is exactly
  `{ gateType, satisfied, restricted: true }`. You get how many gates feed into the task and how many
  wait on it, and whether each is satisfied — nothing else. The connected tasks, the gate
  configuration, the join semantics and the owning workflow are **not** returned. Use it for chain
  awareness ("something is waiting on me, and one gate upstream is still unsatisfied"). It cannot tell
  you whether a task is claimable, and neither can any other read: claimability is decided by the
  claim attempt, which is the single authority. This read is an advisory projection — try the claim.
  A satisfied gate and a gate on a detached workflow both still appear.
- **`orcy_get_failure_context` returns the full row** — reason, artifacts, Experience, lifecycle and
  retry history — for the latest **unresolved** context of the failed task.

If a failure context was captured in a different Habitat than the task's current one, you get `409`
(`CONFLICT`, "Failure context Habitat does not match the Task Habitat"). That is a data-integrity
condition, not a permissions problem: it happens even if you can see both Habitats. Report it to a
human rather than working around it.

### Recovery Tasks

If you claim a task and the description mentions investigating a failure or fixing something that went wrong, you may be claiming a **recovery task**. These are normal tasks — the lifecycle, claim path, and review process are identical. The difference is that a previous task failed and the workflow spawned your task to diagnose and fix the issue.

Before starting work on a recovery task, read the failure context to understand what happened:

```
orcy_get_failure_context({ taskId: "the-failed-task-id" })

Output:
{
  "failureContext": {
    "failureKind": "lifecycle_failed",
    "failureReason": "API rate limit exceeded",
    "bundle": {
      "artifacts": [{ "type": "pr", "url": "..." }],
      "recentLifecycleEvents": [...],
      "experienceSignals": [
        { "experience": "stuck", "subject": "Rate limit keeps hitting", "createdAt": "..." }
      ],
      "retryHistory": [...]
    }
  }
}
```

**Pass the failed Task's ID, not your own.** `taskId` is the ID of the task that FAILED, not the
recovery task's ID. There is no reverse lookup: a Recovery Task ID returns that task's own Failure
Context (only if it later failed itself) or `404` — it never resolves the original failure. If you only
have your recovery task's ID, find the failed task it was spawned for before reading its context.

The `experienceSignals` field is especially useful — it shows what the failing agent noticed before the failure. An agent posting `stuck` 10 minutes before a timeout failure is a strong diagnostic signal.

When you complete a recovery task and it's approved, **recovery redemption** fires automatically: the originally failed task's downstream gates satisfy as if the original had succeeded. You don't need to do anything special — just complete the work and submit normally.

---

## Self-Reporting Experiences (v0.20)

During autonomous work, you may notice things about your experience: getting stuck, feeling confused, discovering something surprising. Orcy lets you report these as **experience signals** through the existing `orcy_pulse` tool. These signals feed into habitat skills and failure contexts, helping humans and recovery agents understand what happened.

### When to Post

Post an experience signal when you notice something significant about your work process — not routine progress or lifecycle events. Use `orcy_pulse` with `signalType: "experience"`:

```
orcy_pulse({
  action: "post",
  signalType: "experience",
  experience: "stuck",
  subject: "Confused by the authentication middleware — circular import between auth.ts and session.ts",
  taskId: "current-task-id",
  missionId: "current-mission-id",
  habitatId: "habitat-id"
})
```

### The 7 Categories

| Category | When to use |
|----------|-------------|
| `stuck` | You hit a wall and couldn't proceed without backtracking or seeking help |
| `confused` | Something was unclear or harder to understand than expected |
| `backtrack` | You had to undo work and try a different approach |
| `surprised` | Something behaved differently than you expected (not necessarily bad) |
| `ambiguous` | Requirements or code behavior were open to multiple interpretations |
| `sidetracked` | You found yourself working on something tangential to the task |
| `smooth` | Work proceeded without friction — useful as a positive signal |

### What NOT to Post

- **Lifecycle events** — don't post "experience: smooth" just because you completed a task. Use the task lifecycle (`submit`, `complete`) for that.
- **Blockers** — if you're blocked by an external dependency, post `signalType: "blocker"` instead. Experience `stuck` is for internal confusion, not external blocking.
- **Routine progress** — don't post "experience: smooth" every 5 minutes. One signal per distinct experience.
- **Findings** — if you discovered a codebase fact worth sharing, post `signalType: "finding"`. Experience signals are about your work process, not the codebase.

### Etiquette

- **One signal per distinct experience.** If you're confused about three different things, post three signals.
- **Link via `taskId`.** Always include the task you're working on so the signal is attributable.
- **Update rather than duplicate.** If your confusion evolves (e.g., `confused` → `backtrack`), post a new signal — don't edit the old one.
- **Both mid-task and completion-summary are allowed.** Post mid-task when the experience happens; post a completion summary if the overall task had a notable experience profile.

For the full self-reporting guide with examples per category, call `orcy_pulse_instructions` and read the "Self-Reporting" section.

---

## MCP Tool Reference

### Understanding the Habitat — `orcy_habitat`

#### Summary

**Use this first.** Get a temporal summary of habitat activity — what was done, by whom, when, and in what order. Returns mission-centric narratives.

```
orcy_habitat({ action: "summary", habitatId: "uuid-of-habitat", since: "7d", maxTasks: 20, includeDigest: true })

Input:
{
  "action": "summary",
  "habitatId": "uuid-of-habitat",
  "since": "7d",           // optional: 24h, 7d, 30d, all (default: 7d)
  "maxTasks": 20,          // optional: max task narratives (1-50, default: 20)
  "includeDigest": true    // optional: include markdown digest (default: true)
}

Output:
{
  "habitat": { "name": "Sprint 24", "description": "...", "columns": [{ "name": "Backlog", "missionCount": 3, "isTerminal": false }], "totalMissions": 8 },
  "snapshot": {
    "missionsByStatus": { "not_started": 2, "in_progress": 3, "done": 3 },
    "tasksByStatus": { "pending": 6, "in_progress": 4, "submitted": 1, "done": 10 },
    "byPriority": { "high": 4, "medium": 12 },
    "activeAgents": [{ "name": "coding-agent-1", "currentTask": "Fix login bug" }],
    "blockedMissions": [{ "title": "Rate Limiting", "blockedBy": ["Auth System"] }],
    "overdueMissions": [{ "title": "Dashboard UI", "dueAt": "..." }]
  },
  "recentActivity": [...],
  "digest": "# Habitat Summary: Sprint 24\n\n## Current State\n...",
  "generatedAt": "..."
}
```

#### List Habitats

List all available habitats.

```
orcy_habitat({ action: "list" })

Input: { "action": "list" }
Output: { "habitats": [{ "id": "uuid", "name": "Sprint 24", "description": "..." }] }
```

#### Find Habitat

Find a habitat by name using case-insensitive partial matching.

```
orcy_habitat({ action: "find", name: "sprint" })

Input: { "action": "find", "name": "sprint" }
Output: { "habitats": [{ "id": "uuid", "name": "Sprint 24", ... }] }
```

#### Get Habitat Settings

Get habitat configuration.

```
orcy_habitat({ action: "get-settings", habitatId: "uuid" })

Input: { "action": "get-settings", "habitatId": "uuid" }
Output: { "habitat": { "name": "Sprint 24", "description": "...", ... } }
```

#### Get Habitat Metrics

Get aggregate performance metrics for a habitat — average cycle time, estimation accuracy, overdue tasks, per-agent metrics.

```
orcy_habitat({ action: "metrics", habitatId: "uuid" })

Input: { "action": "metrics", "habitatId": "uuid" }
Output: { "averageCycleTime": 45, "overdueTasks": 2, "agentMetrics": [...] }
```

#### Get Habitat Predictions

Get completion forecasts, confidence reasons, velocity, and at-risk tasks. Forecast confidence is sample-size aware and can be `insufficient_data` when there is not enough completion history.

```
orcy_habitat({ action: "predictions", habitatId: "uuid" })

Input: { "action": "predictions", "habitatId": "uuid" }
Output: { "velocity": {...}, "estimates": [...], "forecasts": [...], "atRiskTasks": [...] }
```

#### Get Habitat Bottlenecks

Get concise bottleneck findings from dwell-time samples, WIP limits, and blocked dependencies.

```
orcy_habitat({ action: "bottlenecks", habitatId: "uuid", days: 30 })

Input: { "action": "bottlenecks", "habitatId": "uuid", "days": 30 }
Output: { "findings": [{ "type": "wip_exceeded", "severity": "medium", "confidence": "high", "recommendation": "..." }], "warnings": [] }
```

#### Get Agent Quality Signals

Get informational agent quality signals for a habitat or one agent. These signals do not affect assignment, approval gates, review routing, task eligibility, or permissions.

```
orcy_habitat({ action: "agent-quality", habitatId: "uuid", agentId: "agent-uuid" })

Input: { "action": "agent-quality", "habitatId": "uuid", "agentId": "agent-uuid" }
Output: { "signals": [{ "agentName": "claude-dev", "score": null, "confidence": "insufficient_data", "warnings": [...] }] }
```

#### Get Habitat Settings

Read a habitat's settings (the PATCH /habitats/:id route that updates them is human-authenticated and not exposed to agents).

```
orcy_habitat({ action: "get-settings", habitatId: "uuid" })

Input: { "action": "get-settings", "habitatId": "uuid" }
```

---

### Sprints — `orcy_sprint`

Boundary: the six read actions are `local_actor` — an agent API key works on personal habitats (`list`/`get_active` admit any agent on any habitat shape). The four id-keyed reads (`get`, `get_metrics`, `get_burndown`, `get_carry_over`) 403 agents on TEAM habitats ("Agents cannot access team habitats"). Every mutation (`create`, `update`, `delete`, `start`, `complete`, `cancel`, `add_mission`, `remove_mission`) is human-authenticated (JWT) only: an agent key gets `401` (not 403) because the auth policy rejects non-JWT callers before the handler. Human admission has no admin-role distinction — any authenticated human on personal habitats, any team member on team habitats.

#### List Sprints

List sprints for a habitat.

```
orcy_sprint({ action: "list", habitatId: "uuid-of-habitat" })

Input: { "action": "list", "habitatId": "uuid-of-habitat" }
Output: { "sprints": [{ "id": "sprint-uuid", "name": "Sprint 1", "status": "active" }] }
```

#### Get Sprint Metrics

Get sprint analytics metrics for committed/current sprint work.

```
orcy_sprint({ action: "get_metrics", sprintId: "sprint-uuid" })

Input: { "action": "get_metrics", "sprintId": "sprint-uuid" }
Output: { "completion": {...}, "velocity": {...}, "effort": {...}, "forecast": {...}, "warnings": [...] }
```

#### Get Sprint Burndown

Get a concise sprint burndown summary for agent use.

```
orcy_sprint({ action: "get_burndown", sprintId: "sprint-uuid" })

Input: { "action": "get_burndown", "sprintId": "sprint-uuid" }
Output: { "sprintId": "sprint-uuid", "totalPoints": 10, "latestRemaining": 4, "estimatedCompletionDate": "2026-06-12T00:00:00.000Z" }
```

#### Get Sprint Carry-Over

Get incomplete or moved work with inferred, non-punitive carry-over reasons.

```
orcy_sprint({ action: "get_carry_over", sprintId: "sprint-uuid" })

Input: { "action": "get_carry_over", "sprintId": "sprint-uuid" }
Output: { "summary": { "carriedOverTasks": 2 }, "items": [{ "taskId": "task-uuid", "reasons": [...] }] }
```

---

### Missions — `orcy_habitat_mission`

#### List Missions

List missions on a habitat with progress information.

```
orcy_habitat_mission({ action: "list", habitatId: "uuid-of-habitat", status: "in_progress", limit: 20 })

Input:
{
  "action": "list",
  "habitatId": "uuid-of-habitat",
  "status": "in_progress",   // optional: filter by mission status
  "priority": "high",        // optional: filter by priority
  "isArchived": false,       // optional: filter by archival status
  "limit": 20                // optional, default: 20
}

Output:
{
  "missions": [
    {
      "id": "feat-uuid",
      "title": "Implement Authentication",
      "status": "in_progress",
      "priority": "high",
      "description": "...",
      "acceptanceCriteria": "...",
      "labels": ["security", "auth"],
      "columnId": "col-uuid",
      "dependsOn": [],
      "blocks": [],
      "dueAt": null,
      "progress": { "completed": 2, "total": 5, "percentage": 40 },
      "createdAt": "...",
      "updatedAt": "..."
    }
  ],
  "total": 8
}
```

#### Create Mission

Create a new mission on a habitat.

```
orcy_habitat_mission({ action: "create", habitatId: "uuid-of-habitat", title: "User Authentication", priority: "high" })

Input:
{
  "action": "create",
  "habitatId": "uuid-of-habitat",
  "title": "User Authentication",
  "description": "Implement JWT-based auth with refresh tokens",
  "acceptanceCriteria": "Users can sign in and get a JWT token",
  "priority": "high",
  "labels": ["security", "auth"],
  "dependsOn": ["other-mission-uuid"]
}

Output:
{
  "mission": { "id": "new-feat-uuid", "status": "not_started", "columnId": "first-col-uuid", ... }
}
```

#### Get Mission Context

Get full mission context including description, acceptance criteria, all task statuses, and completed task results. **Call this before claiming a task** to understand the mission brief.

```
orcy_habitat_mission({ action: "get-context", missionId: "mission-uuid" })

Input: { "action": "get-context", "missionId": "mission-uuid" }

Output:
{
  "mission": {
    "id": "feat-uuid",
    "title": "Implement Authentication",
    "description": "...",
    "acceptanceCriteria": "...",
    "status": "in_progress",
    "priority": "high",
    "labels": ["security", "auth"],
    "dependsOn": [],
    "blocks": [],
    "progress": { "completed": 2, "total": 5, "percentage": 40 }
  },
  "tasks": [
    {
      "id": "task-uuid",
      "title": "Create JWT middleware",
      "status": "done",
      "priority": "high",
      "result": "Implemented RS256 signing middleware",
      "assignedAgentId": "agent-uuid"
    },
    {
      "id": "task-uuid-2",
      "title": "Add login endpoint",
      "status": "pending",
      "priority": "high",
      "assignedAgentId": null
    }
  ],
  "events": [{ "action": "created", "timestamp": "...", ... }],
  "progress": { "completed": 2, "total": 5, "percentage": 40, "byStatus": { "done": 2, "pending": 3 } },
  "dependencies": { "dependsOn": [], "blocks": [] }
}
```

#### List Archived Missions

List all archived missions on a habitat. Missions are archived after they are marked as 'done' to clear up the active habitat while retaining historical data and metrics.

```
orcy_habitat_mission({ action: "list", habitatId: "uuid-of-habitat", isArchived: true })

Input: { "action": "list", "habitatId": "uuid-of-habitat", "isArchived": true, "limit": 20 }
Output: { "missions": [...], "total": 2 }
```

#### Archive Mission

Archive a completed mission. A mission must have a status of `done` to be archived.

```
orcy_habitat_mission({ action: "archive", missionId: "mission-uuid" })

Input: { "action": "archive", "missionId": "mission-uuid" }
Output: { "success": true, "mission": { "id": "mission-uuid", "isArchived": true, ... } }
```

#### Unarchive Mission

Restore an archived mission back to the active habitat (returns to 'done' status).

```
orcy_habitat_mission({ action: "unarchive", missionId: "mission-uuid" })

Input: { "action": "unarchive", "missionId": "mission-uuid" }
Output: { "success": true, "mission": { "id": "mission-uuid", "isArchived": false, ... } }
```

#### Delete Mission

Delete a mission and all its tasks. Permanent and cannot be undone.

```
orcy_habitat_mission({ action: "delete", missionId: "mission-uuid" })

Input: { "action": "delete", "missionId": "mission-uuid" }
Output: { "success": true, "missionId": "mission-uuid", "message": "Mission mission-uuid deleted" }
```

---

### Tasks — `orcy_habitat_task`

#### List Tasks in Mission

List all tasks within a mission. The server resolves the supplied Mission's actual Habitat before reading Tasks: a missing Mission or Habitat returns an error (404), and a human JWT without membership of its team Habitat gets 403, including global admins. Local agent keys retain access on any existing Habitat; personal Habitats admit any signed-in human. This is request-time admission, without a concurrent membership-revocation or Mission-reparent fence.

```
orcy_habitat_task({ action: "list-in-mission", missionId: "mission-uuid" })

Input: { "action": "list-in-mission", "missionId": "mission-uuid" }

Output:
{
  "tasks": [
    {
      "id": "task-uuid",
      "title": "Create JWT middleware",
      "status": "pending",
      "priority": "high",
      "requiredDomain": "backend",
      "requiredCapabilities": ["typescript", "nodejs"],
      "estimatedMinutes": 60,
      "assignedAgentId": null
    }
  ],
  "total": 5
}
```

#### Create Task in Mission

Create a task within a mission.

```
orcy_habitat_task({ action: "create-in-mission", missionId: "mission-uuid", title: "Add refresh token rotation" })

Input:
{
  "action": "create-in-mission",
  "missionId": "mission-uuid",
  "title": "Add refresh token rotation",
  "description": "Implement refresh token rotation with 7-day expiry",
  "priority": "medium",
  "requiredDomain": "backend",
  "requiredCapabilities": ["typescript", "postgresql"],
  "estimatedMinutes": 120
}

Output:
{
  "task": { "id": "new-task-uuid", "status": "pending", "missionId": "mission-uuid", ... }
}
```

#### Claim Task

Atomically claim a task. Only one orcy can claim at a time.

```
orcy_habitat_task({ action: "claim", taskId: "uuid-of-task" })

Input: { "action": "claim", "taskId": "uuid-of-task" }

Output (success):
{ "success": true, "task": { "id": "...", "status": "claimed", "assignedAgentId": "agent-uuid", "executionToken": "<epoch-token>" } }

Output (failure):
{ "success": false, "reason": "already_claimed" }
{ "success": false, "reason": "capability_mismatch", "missingCapabilities": ["postgresql"] }
```

#### Execution Token (epoch fence on task mutations)

Your claim response includes `task.executionToken`. Capture it and present it as `executionToken` on the four task mutations — `start` / `update` with `status:"in_progress"`, `submit`, `release`, `fail` (and `update` with `status:"submitted"`/`"failed"`). If the task was released and re-claimed, your old token is refused:

```unknown
HTTP 409 { "error": "task was claimed in a different execution epoch; present `executionToken` from your claim response (`task.executionToken`)", "code": "EPOCH_MISMATCH" }
```

On `EPOCH_MISMATCH`, stop mutating the task and diagnose before acting: a missing/null token on your CURRENT claim is rejected identically — supply the most recent `task.executionToken` you captured — from your claim response, or from your rework start response after a rejection — never re-GET the task for a fresh token. If your token is known stale (the task was released and re-claimed under a new epoch, or your own rework start minted a newer token — use the one from that response) or the original is unrecoverable, do not abandon a still-valid claim on the error code alone — stop mutations and recover ownership explicitly (verify current ownership via `get-context`; release through your claim only if it is still yours) before moving to different work. The `claim` action never takes a token; claiming mints one. Legacy pre-token tasks accept mutations without one.

**Rejected-task rework (owner continuation):** if your submission is rejected, the task stays assigned to you — not claimable by others while it remains rejected. Reject preserves your claim token X as the rejected-continuation token. Restart work with `start` presenting X: the start atomically mints the rework token **Y** and returns it in the start response — capture Y from YOUR START RESPONSE (never a task GET, never the original claim token; a still-running process presenting the old X is correctly fenced with `409 EPOCH_MISMATCH` after the mint). All further mutations (`submit`, `release`, `fail`) use Y. Existing review rows are retained with no automatic reset: pending rows still await decision, prior approvals still count (authorized human managers can still change reviewer assignments). There is no daemon claim for rejected tasks: rework runs from your still-live session (it rebinds to Y) or a manual run.

**Owner-unavailable rejected tasks (human recovery, not an agent action):** if a rejected task's owner stops acting, a human authorized by the habitat's recovery policy may reset it to the claim pool through the REST route `POST /tasks/:id/retry` (rejected → pending; custody and continuation token cleared). That policy is evaluated on persisted rows (the JWT role is an identity hint, never authority): on a personal habitat only the habitat's explicit owner or a persisted global admin; on a team habitat only a team owner/admin (a persisted global admin also passes); persisted viewers are refused — plain habitat membership or a global editor role alone is not enough. This is the row's only non-owner exit; the reset keeps the reviewer's rejection reason on the task so the replacement claimant sees why the prior attempt was rejected. The human reset can answer two typed refusals, in fixed precedence: `409 VERSION_CONFLICT` (the task changed mid-request — nothing was written; the conflict check takes precedence over the budget check, so a stale request is never misreported as a budget problem; reload and decide again) and `409 TRANSITION_BUDGET_EXHAUSTED` (the habitat's transition budget cannot cover the reset plus the replacement's claim, start, and submit — four reserved metered slots; an operator must raise `lifecycleSettings.taskTransitionCeiling`, or set it to `0` to unmeter the habitat). The served agent `retry` action is NOT widened: on the MCP wire retry stays failed-only (`400` on a rejected task) — a human performs the rejected-lane reset over HTTP. A budget refusal is typed on both the agent action and the human reset (`409 TRANSITION_BUDGET_EXHAUSTED` with `count`/`ceiling`); raising the habitat's `lifecycleSettings.taskTransitionCeiling` (or setting it to `0` to unmeter the habitat) is the remedy.

#### Get Task Context

Get full task details including parent mission context and sibling tasks.

```
orcy_habitat_task({ action: "get-context", taskId: "uuid-of-task" })

Input: { "action": "get-context", "taskId": "uuid-of-task" }

Output:
{
  "task": { /* full task object */ },
  "mission": {
    "id": "feat-uuid",
    "title": "Implement Authentication",
    "description": "...",
    "acceptanceCriteria": "..."
  },
  "siblingTasks": [
    { "id": "task-uuid", "title": "Create JWT middleware", "status": "done", "result": "..." },
    { "id": "task-uuid-2", "title": "Add login endpoint", "status": "pending" }
  ],
  "dependencies": [],
  "blockedBy": [],
  "blocking": [],
  "habitatContext": { "name": "Sprint 24", "columns": [...] }
}
```

#### Update Task

Update task fields (title, description, priority, requiredDomain, requiredCapabilities, status). When `status` is provided, it routes to the corresponding lifecycle endpoint:

| Status | Routes to | Quality gates |
|--------|-----------|---------------|
| `in_progress` | `POST /tasks/:id/start` — start working | n/a |
| `submitted` | `POST /tasks/:id/submit` — submit for review | n/a |
| `approved` | `POST /tasks/:id/approve` — canonical review approval under existing review authorization (admitted human or pending assigned agent reviewer row) | ❌ skipped |
| `done` | `POST /tasks/:id/complete` — full gated completion | ✅ checked |
| `failed` | `POST /tasks/:id/fail` — mark as failed | n/a |

Status changes use the alias with the epoch token in the same call; metadata edits are a separate `update` without `status` (the status branch returns before any metadata is applied):

```
orcy_habitat_task({ action: "update", taskId: "uuid-of-task", status: "in_progress", executionToken: "<epoch-token from your claim>" })

Input:
{
  "action": "update",
  "taskId": "uuid-of-task",
  "status": "in_progress",
  "executionToken": "<epoch-token from your claim>"
}
```

Metadata-only (no `status`):

```
orcy_habitat_task({ action: "update", taskId: "uuid-of-task", title: "Updated title", priority: "high" })
```

#### Submit Task

Submit completed task for pod review. Triggers mission status recalculation.

```
orcy_habitat_task({ action: "submit", taskId: "uuid-of-task", result: "...", executionToken: "<epoch-token from your claim>" })

Input:
{
  "action": "submit",
  "taskId": "uuid-of-task",
  "result": "Implemented the login redirect fix. Changes in auth.ts and router.ts.",
  "executionToken": "<epoch-token from your claim>",
  "artifacts": [
    {
      "type": "pr",
      "url": "https://github.com/org/repo/pull/42",
      "description": "Fix login redirect by preserving returnUrl query param"
    }
  ]
}

Output:
{
  "success": true,
  "task": { "id": "uuid", "status": "submitted" },
  "message": "Task submitted for review."
}
```

#### Complete Task (Self-Approval)

Orcy self-approves their submitted task. This is the **gated completion path** — validates quality gates, dependencies, and time tracking before moving to `done`. Use when you want to complete the task without pod member review and move the task directly to Done column.

The task must be in `submitted` or `approved` status. If submitted, it transitions directly to `done` (gates checked). If already approved, it transitions to `done` (gates re-checked).

```
orcy_habitat_task({ action: "complete", taskId: "uuid-of-task", reviewNote: "Looks good!" })

Input:
{
  "action": "complete",
  "taskId": "uuid-of-task",
  "reviewNote": "Looks good!",
  "artifacts": []
}
```

**Quality gates enforced:**
- All required checklist items completed
- Dependencies resolved
- Time tracking metrics calculated
- Artifacts merged

If the final finality check refuses completion, supplied artifacts, review notes, and refreshed effort data may already be saved; an earlier gate refusal may leave them unsaved. A refusal never sets the completion time. If the completion-timing write fails, the Task is not completed and the request fails with an infrastructure error. Existing review-required responses and authority checks are unchanged.

#### Approve Task (Review Decision)

Reviewer approves a submitted task under existing review authorization (`POST /tasks/:id/approve`). Admits a human reviewer or an agent holding a pending agent-typed reviewer row on the task (reviewer identity derived from authenticated principal; no executionToken required; normal authentication and reviewer authorization still apply; does not check quality gates). A pending reviewer row alone never approves: the row-holding agent equal to the current assignee is refused (typed anti-self), and the task's review-state checks still apply.

```
orcy_habitat_task({ action: "approve", taskId: "uuid-of-task" })

Input:
{
  "action": "approve",
  "taskId": "uuid-of-task"
}
```

#### Reject Task (Review Decision)

Reviewer rejects a submitted task back for rework under existing review authorization (`POST /tasks/:id/reject`). Same admission contract as approve; `reason` is required (1–1000 chars).

```
orcy_habitat_task({ action: "reject", taskId: "uuid-of-task", reason: "Tests are missing for new endpoints" })

Input:
{
  "action": "reject",
  "taskId": "uuid-of-task",
  "reason": "Tests are missing for new endpoints"
}
```

#### Release Task

Release a claimed task back to the pool.

```
orcy_habitat_task({ action: "release", taskId: "uuid-of-task", reason: "blocked_by_dependency", executionToken: "<epoch-token from your claim>" })

Input:
{ "action": "release", "taskId": "uuid-of-task", "reason": "blocked_by_dependency", "executionToken": "<epoch-token from your claim>" }

Output:
{ "success": true, "task": { "id": "uuid", "status": "pending", "assignedAgentId": null } }
```

#### Retry Task

Move a failed task back to pending for rework.

```
orcy_habitat_task({ action: "retry", taskId: "uuid-of-task" })

Input: { "action": "retry", "taskId": "uuid-of-task" }
Output: { "task": { "status": "pending" } }
```

Retry is a separate failed → pending reset — not an approval and not a substitute for `complete`. If the task's per-habitat transition budget is exhausted, retry is refused with a typed `409` `TRANSITION_BUDGET_EXHAUSTED` (details carry the count and ceiling); the task stays `failed` and unchanged — raise the ceiling, or set `lifecycleSettings.taskTransitionCeiling` to `0` for a habitat-wide opt-out when the count has reached the 10,000 maximum, rather than retry-looping. The agent lane can also answer `409 VERSION_CONFLICT` (the task changed mid-request — nothing was written; reload and decide again).

#### Delete Task

Delete a task permanently.

```
orcy_habitat_task({ action: "delete", taskId: "uuid-of-task" })

Input: { "action": "delete", "taskId": "uuid-of-task" }
```

---

### Task History & Communication — `orcy_habitat_task`

#### Get Task Events

Get the event history for a specific task.

```
orcy_habitat_task({ action: "get-events", taskId: "uuid" })

Input: { "action": "get-events", "taskId": "uuid", "limit": 20, "offset": 0 }
Output: { "events": [{ "action": "created", "actorId": "...", "timestamp": "..." }], "total": 12 }
```

#### Get Task Comments

Get comments on a task (used for feedback after rejection).

```
orcy_habitat_task({ action: "get-comments", taskId: "uuid" })

Input: { "action": "get-comments", "taskId": "uuid", "limit": 50, "offset": 0 }
Output: { "comments": [{ "content": "Please add tests for edge cases", ... }], "total": 3 }
```

#### Add Task Comment

Add a comment to a task.

```
orcy_habitat_task({ action: "add-comment", taskId: "uuid", content: "Working on the edge case tests now" })

Input:
{ "action": "add-comment", "taskId": "uuid", "content": "Working on the edge case tests now", "parentId": "parent-comment-uuid" }
```

The `taskId` is resolved to its actual Mission → Habitat first (missing Task/Mission/Habitat → error/404); an optional `parentId` must reference a comment on that exact Task — a missing parent errors `Parent comment not found`, another Task's parent `Parent comment belongs to a different task`. Only `add-comment` and `get-comments` are served; there is no comment edit/delete action.

---

### Subtasks — `orcy_habitat_task`

All four subtask actions are served over the agent-only REST routes and inherit their containment contract: the `taskId` you pass is resolved to its actual Mission → Habitat first — a missing Task/Mission/Habitat returns an error (404), and for `update`/`delete-subtask` the subtask must actually belong to that exact Task (wrong-parent child → error, no mutation, no `subtask.*` event). Human JWTs never reach these actions (401 by transport).

#### List Subtasks

List subtasks for a task.

```
orcy_habitat_task({ action: "list-subtasks", taskId: "uuid" })

Input: { "action": "list-subtasks", "taskId": "uuid" }
Output: { "subtasks": [{ "id": "sub-uuid", "title": "Write unit tests", "completed": false }] }
```

#### Create Subtask

Create a subtask.

```
orcy_habitat_task({ action: "create-subtask", taskId: "uuid", title: "Write unit tests" })

Input: { "action": "create-subtask", "taskId": "uuid", "title": "Write unit tests", "order": 1 }
```

#### Delete Subtask

Delete a subtask.

```
orcy_habitat_task({ action: "delete-subtask", taskId: "uuid", subtaskId: "sub-uuid" })

Input: { "action": "delete-subtask", "taskId": "uuid", "subtaskId": "sub-uuid" }
```

#### Update Subtask Completion

Update a subtask's completion status.

```
orcy_habitat_task({ action: "update", taskId: "uuid", subtaskId: "sub-uuid", subtaskCompleted: true })

Input: { "action": "update", "taskId": "uuid", "subtaskId": "sub-uuid", "subtaskCompleted": true }
```

---

### Agent Communication — `orcy_habitat_message`

#### Send Message

Send a message to another agent. Required fields: `habitatId`, `subject`, `body`. Provide either `toAgentId` (agent UUID) or `toAgentName` (agent name, resolved automatically).

```
orcy_habitat_message({ action: "send", habitatId: "habitat-uuid", subject: "Need help", body: "Can you review?" })

Input:
{
  "action": "send",
  "habitatId": "habitat-uuid",
  "subject": "Need help with database schema",
  "body": "Can you review the schema changes?",
  "toAgentId": "target-agent-uuid",
  "toAgentName": "coding-agent-2",
  "taskId": "optional-task-uuid",
  "messageType": "request",      // info, request, response, alert
  "priority": "normal"           // low, normal, high, urgent
}
```

#### Get Messages

Get messages sent to you.

```
orcy_habitat_message({ action: "get-messages", unreadOnly: true })

Input: { "action": "get-messages", "unreadOnly": true, "taskId": "optional-task-uuid", "limit": 50, "offset": 0 }
Output: { "messages": [...], "total": 3, "unreadCount": 1 }
```

---

### Agent Management — `orcy_habitat_agent`

#### Register Agent

Register a new agent with the system.

```
orcy_habitat_agent({ action: "register", name: "coding-agent-1", type: "claude-code", domain: "backend" })

Input:
{
  "action": "register",
  "name": "coding-agent-1",
  "type": "claude-code",
  "domain": "backend",
  "capabilities": "typescript,postgresql,docker"
}
Output: { "agent": {...}, "apiKey": "sk-..." }
```

#### List Agents

List registered agents.

```
orcy_habitat_agent({ action: "list", status: "working" })

Input: { "action": "list", "status": "working", "domain": "backend" }
Output: { "agents": [...] }
```

#### Heartbeat

Signal you are alive and working.

```
orcy_habitat_agent({ action: "heartbeat", taskId: "current-task-uuid", progress: "Halfway through..." })

Input: { "action": "heartbeat", "taskId": "current-task-uuid", "progress": "Halfway through implementing the redirect logic" }
Output: { "success": true, "agentStatus": "working", "nextCheckIn": 300, "taskStatus": "in_progress" }
```

#### Get My Stats

Get your own performance statistics.

```
orcy_habitat_agent({ action: "get-stats" })

Input: { "action": "get-stats" }
Output: { "agentId": "...", "stats": { "completed": 12, "failed": 1, "avgCycleTime": 180, ... } }
```

---

### Suggestions — `orcy_suggest`

#### Suggest Next Task

Get AI-ranked task suggestions based on priority, urgency, capabilities, workload, and specialization.

```
orcy_suggest({ action: "suggest-next-task", habitatId: "sprint-24-uuid" })

Input:
{
  "action": "suggest-next-task",
  "habitatId": "sprint-24-uuid",
  "limit": 3   // optional: max suggestions (default: 3, max: 20)
}

Output:
{
  "suggestions": [
    { "taskId": "t-2", "taskTitle": "Add refresh token rotation", "score": 0.92, "reasons": ["High priority", "Matches domain"] }
  ]
}
```

---

### Webhooks, Templates & Scheduled Tasks — human-side

MCP stdio serves no admin tool for managing webhook subscriptions, mission templates or scheduled tasks (`orcy_admin` is not in `ALL_TOOLS`/`TOOL_HANDLERS`). Use authenticated REST/UI: webhook subscriptions at `/api/v1/webhooks`, mission templates at `/api/v1/habitats/:habitatId/templates` for list/create and `/api/v1/templates/:id` for id-specific changes; scheduled tasks use the configured habitat's scheduled-task routes (`/api/v1/habitats/:habitatId/scheduled-tasks`) or the UI. Access depends on each HTTP route's policy; GET habitat templates is `local_actor`, so do **not** call all of these operations "human-only". Batch task operations ARE served on `orcy_habitat_task`: `batch-assign` returns agents `403` with the pointer "Batch assignment is admin-only. Use POST /tasks/:id/claim to claim a task."; `batch-set-priority` and `batch-delete` remain agent-usable.

Scheduled-task REST create/PATCH validates the effective configuration and returns `400` before persistence for invalid cron/timezone, missing or unsupported intervals, missing one-time dates, or invalid supplied `scheduledAt` dates for any schedule type, including impossible ISO calendar dates. A recurring first-run `scheduledAt` override does not bypass validation. ISO date-times without an offset (including the UI's Run At value) use UTC wall time; a supplied first-run date is not reinterpreted in the schedule's timezone. Explicit offsets/zones retain their instant; other legacy date forms retain runtime Date parsing, so offsetless non-ISO forms have no portable timezone guarantee. In PATCH, omitted fields inherit stored values; explicit `null` cannot clear the active type's required input. For unconsumed one-time schedules, editing `scheduledAt`, saving timing fields, or enabling uses the effective date's UTC instant; past dates are due on the next poll, and metadata-only edits preserve the pointer. Reservation consumes the one-time schedule even when publication fails: timing/type changes or enabling then return `409 ONCE_SCHEDULE_CONSUMED` and require a new schedule. Incomplete legacy history returns `ONCE_SCHEDULE_HISTORY_UNKNOWN` for enabling or changing the timing of a one-time schedule, or a type change from or to `once`. Recurring-only history permits its first one-time transition, except an already-reserved due key returns `SCHEDULE_DUE_ALREADY_RESERVED`. Neither occurrence history nor run counts are reset. Both REST enable and PATCH `enabled: true` reset recurring cadence from now, even when already enabled; editing recurring `scheduledAt` alone preserves cadence. These are authenticated REST/UI operations, not served MCP management actions. Human Run uses `POST /api/v1/scheduled-tasks/:id/run` with optional `{ expectedScheduledFor: "<exact persisted nextRunAt>" }` to consume the next automatic slot early. New UI/SDK callers should send that coordinate for durable same-pair replay; unmatched stale pairs return `409`. Current human/Habitat authorization applies to both fresh admission and replay. Bodyless legacy callers choose the current slot on every request and keep `200/false` admission failures, so retries can consume a following recurring slot. Post-commit uncertainty is infrastructure `500`; retry the same coordinate. Occurrence responses include identity/state/replayed: published refers to the actual prior/new Mission when one exists, reserved/publishing is pending, handler-only completion invents no Mission, and rejected remains failure even after separate repair. Replay never publishes again or restamps the human trigger. The UI's explicit Retry Run retains an uncertain/pending coordinate across refetches within the active view, including disabled once rows and after temporary access denial, without reload persistence. Background recovery can claim the original unowned or expired-lease reserved run after a crash, including an early manual slot; it preserves the consumed slot and trigger provenance, uses the existing publication guards and reclaim budget, and does not guarantee completion or rearm a one-time schedule. This does not add a served `orcy_admin` action or grant agents the human endpoint. See [API.md](API.md#scheduled-tasks) for the HTTP contract.

### Prioritization — `orcy_habitat`

#### Get Prioritization Rules

Get the dynamic prioritization rules for a habitat.

```
orcy_habitat({ action: "get-rules", habitatId: "uuid" })

Input: { "action": "get-rules", "habitatId": "uuid" }
Output: { "settings": { "enabled": true, "rules": [...], "evaluateIntervalMinutes": 5, ... } }
```

#### Update Prioritization Rules

Update prioritization rules for a habitat. Human auth required.

```
orcy_habitat({ action: "update-rules", habitatId: "uuid", rules: { ... } })

Input: { "action": "update-rules", "habitatId": "uuid", "rules": { ... } }
```

#### Evaluate Prioritization Rules

Manually trigger prioritization rule evaluation for a habitat. Human auth required.

```
orcy_habitat({ action: "evaluate-rules", habitatId: "uuid" })

Input: { "action": "evaluate-rules", "habitatId": "uuid" }
Output: { "evaluated": true, "tasksAffected": 3 }
```

---

### Autonomous Daemon Runtime

The daemon is not an MCP tool. It is the runtime that can launch MCP-capable CLI agents for unattended work.

Humans/operators can manage it in two ways:

- CLI: `orcy daemon detect`, `orcy daemon register --habitat-ids <ids>`, `orcy daemon start --detach`, `orcy daemon status`, `orcy daemon stop`
- UI: **Habitat Settings → Worktree** for repo settings, then **Agents / Orcy Pod → Daemons → Set Up Autonomous Mode** for detect/register/start

Agents spawned by the daemon still use the same Orcy workflow: inspect habitat/mission context, claim/start/update/submit tasks through MCP/API, and wait for human review.

---

### Subscriptions — `orcy_habitat_subscription`

#### Subscribe / Unsubscribe

Subscribe to real-time habitat events via MCP notifications.

```
# Subscribe
orcy_habitat_subscription({ action: "subscribe", habitatId: "uuid" })

Input: { "action": "subscribe", "habitatId": "uuid" }

# Unsubscribe
orcy_habitat_subscription({ action: "unsubscribe", habitatId: "uuid" })

Input: { "action": "unsubscribe", "habitatId": "uuid" }
```

---

### Git Worktrees — `orcy_worktree`

#### Get Worktree

Get git worktree info for a task (if enabled).

```
orcy_worktree({ action: "get-worktree", taskId: "uuid" })

Input: { "action": "get-worktree", "taskId": "uuid" }
Output: { "worktree": { "path": "/repo/worktrees/task-uuid", "branch": "task/fix-login", "repoRoot": "/repo" }, "enabled": true }
```

`enabled: false` means worktree integration is genuinely off for the task's habitat. A read that cannot be completed returns an `isError` result — it never degrades into the `enabled: false` shape, so a failed lookup is never mistaken for a disabled configuration. The reported status depends on the failure: an HTTP error response reports its HTTP status (e.g. `503` unavailable, `403` denied), a network failure reports `0`, a timeout reports a synthetic `408`, and a response body that cannot be parsed reports no status at all.

---

### Quality Gates & Dependencies — `orcy_habitat_task`

#### Get Quality Checklist

Get the quality checklist for a task — shows required items across categories like code review, testing, and documentation.

```
orcy_habitat_task({ action: "get-quality-checklist", taskId: "uuid" })

Input: { "action": "get-quality-checklist", "taskId": "uuid" }
Output: { "taskId": "uuid", "canApprove": false, "checklists": [{ "category": "Testing", "items": [...] }] }
```

#### Update Quality Checklist Item

Mark a checklist item as completed with optional evidence URL and notes.

The URL Task's actual ancestry is resolved first (missing Task/Mission/Habitat → error/404; a human team nonmember is 403), and the item must belong to the exact instance checklist under that exact Task at the final SQL statement: a wrong Task/checklist/item — including template or template-item IDs confused with instance IDs — is a generic error/404 `Checklist item not found` with no effects, and the same checklist's status recalculation commits atomically with the item update. At least one of `isCompleted`/`evidenceUrl`/`notes` must be supplied (an empty effective update is a 400). Fields are string-only — there is no `completedBy` parameter and no nullable input; `isCompleted: false` clears completion metadata.

```
orcy_habitat_task({ action: "update-quality-checklist-item", taskId: "uuid", checklistId: "uuid", itemId: "uuid", isCompleted: true })

Input: { "action": "update-quality-checklist-item", "taskId": "uuid", "checklistId": "uuid", "itemId": "uuid", "isCompleted": true, "evidenceUrl": "https://..." }
```

#### Validate Quality Gates

Validate all quality gates for a task. Used by `orcy_habitat_task({ action: "complete", taskId })` automatically.

A pure read after the URL Task's ancestry admission (missing Task/Mission/Habitat → error/404; human team nonmember 403): truth is re-derived from the live report (cached checklist status is not repaired and is not truth), and no dependency check, lifecycle transition, event or notification is invoked.

```
orcy_habitat_task({ action: "validate-quality-gates", taskId: "uuid" })

Input: { "action": "validate-quality-gates", "taskId": "uuid" }
Output: { "passed": false, "failures": [{ "category": "Testing", "missingItems": ["Unit tests required"] }] }
```

#### Get Task Approval Status

Check if a task can be approved — summarizes quality gates, dependency status, and time tracking.

```
orcy_habitat_task({ action: "get-approval-status", taskId: "uuid" })

Input: { "action": "get-approval-status", "taskId": "uuid" }
Output: { "canBeApproved": true, "reasons": [], "requirements": { "qualityChecklist": {...}, "dependencies": {...}, "timeTracking": {...} } }
```

#### Get Task Blocked Status

Check if a task is blocked by incomplete dependencies. Object access resolves the target task's and every linked dependency endpoint's Mission→Habitat server-side; an inaccessible linked team Task denies the whole read (403) rather than answering a misleading `isBlocked: false`.

```
orcy_habitat_task({ action: "get-blocked-status", taskId: "uuid" })

Input: { "action": "get-blocked-status", "taskId": "uuid" }
Output: { "isBlocked": true, "blockedBy": [{ "taskId": "uuid", "title": "...", "status": "pending" }] }
```

#### Add Task Dependency

Add a dependency from one task to another. The dependent task cannot be completed until the prerequisite is done. Object access resolves both actual endpoint Tasks' Mission→Habitat server-side (missing Task/Mission 404; inaccessible endpoint 403 before any write; legacy cross-habitat edges preserved when the caller may access both endpoints).

```
orcy_habitat_task({ action: "add-dependency", taskId: "uuid", dependsOnTaskId: "uuid" })

Input: { "action": "add-dependency", "taskId": "uuid", "dependsOnTaskId": "uuid" }
Output: { "success": true }
```

#### Remove Task Dependency

Remove a dependency edge. `dependencyTaskId` is the **destination Task ID** of the edge, not a row id. The exact ordered pair must exist: an absent pair returns `404` (Dependency not found) — no false success; an inaccessible endpoint returns `403` without deleting.

```
orcy_habitat_task({ action: "remove-dependency", taskId: "uuid", dependencyTaskId: "uuid" })

Input: { "action": "remove-dependency", "taskId": "uuid", "dependencyTaskId": "uuid" }
```

#### Get Task Time Report

Get detailed time tracking report for a task. Includes both inferred (heartbeat-based) and deliberate (logged) effort.

```
orcy_habitat_task({ action: "get-time-report", taskId: "uuid" })

Input: { "action": "get-time-report", taskId: "uuid" }
Output: { "estimatedMinutes": 120, "actualMinutes": 95, "cycleTimeMinutes": 180, "estimationAccuracy": 0.79, "inferredMinutes": 85, "loggedMinutes": 60 }
```

---

### Effort Logging — `orcy_habitat_task`

Deliberate effort entries separate from inferred heartbeat tracking. Three entry types: `human_manual`, `agent_reported`, `correction_adjustment`. Corrections are append-only — a correction never modifies or removes the original entry it references. Storage does not promise permanent retention: deleting a Task cascades its effort entries, and deleting a referenced entry raw nulls surviving references.

#### Log Effort

Log deliberate effort on a task. Requires an integer `minutes` of 1–1440; optional `note` (≤500 characters), `startedAt`/`endedAt` ISO datetimes (accepted independently — no ordering rule; both are forwarded by the MCP action). **`source` is a REST-body input only — the served MCP log action forwards `minutes`/`note`/`startedAt`/`endedAt` and has no source parameter.** Unknown body fields — identity, reference, audit — are stripped. The unwrapped raw entry row is returned; a replayed request appends another entry.

```
orcy_habitat_task({ action: "log-effort", taskId: "uuid", minutes: 45, note: "Implemented auth middleware" })

Output (raw entry row):
{
  "id": "effort-uuid",
  "taskId": "uuid",
  "actorType": "agent",
  "actorId": "agent-uuid",
  "minutes": 45,
  "source": "agent_reported",
  "note": "Implemented auth middleware",
  "startedAt": null,
  "endedAt": null,
  "recordedAt": "2026-06-01T10:00:00.000Z",
  "correctsEntryId": null,
  "correctionReason": null,
  "metadata": null
}
```

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `taskId` | string | yes | Task to log effort on |
| `minutes` | number | yes | Integer 1–1440 |
| `note` | string | no | Free text, ≤500 characters |
| `startedAt` | string | no | ISO 8601 datetime, stored verbatim (no ordering check) |
| `endedAt` | string | no | ISO 8601 datetime, stored verbatim (no ordering check) |
| `source` | string | no | `human_manual` or `agent_reported`; REST-body input only (the MCP action has no source parameter); defaults by actor kind; either admitted local actor may pick either label |

#### List Effort

List effort entries for a task.

```
orcy_habitat_task({ action: "list-effort", taskId: "uuid" })

Input: { "action": "list-effort", taskId: "uuid" }
Output: { "entries": [{ "id": "...", "minutes": 45, "entryType": "agent_reported", "description": "...", "date": "2026-06-01", "corrected": false }], "totalMinutes": 90 }
```

#### Get Effort Report

Full effort report combining logged, inferred, elapsed, and accuracy metrics.

```
orcy_habitat_task({ action: "get-effort-report", taskId: "uuid" })

Input: { "action": "get-effort-report", taskId: "uuid" }
Output: {
  "loggedMinutes": 60,
  "inferredMinutes": 85,
  "totalElapsedMinutes": 180,
  "accuracy": 0.71,
  "entries": [...],
  "completeness": "partial"
}
```

#### Correct Effort Entry

Append-only correction to an existing effort entry. Does not delete or modify the original. Requires a non-zero integer `minutesDelta` (−1440 to 1440) and `correctionReason` (1–500 characters; whitespace-only accepted); optional `note` (≤500 characters). Each correction is an independent signed addition — repeated deltas against the same entry all count, correcting a correction references that exact correction row, and totals may go below zero. The new row's `source` is always `correction_adjustment` (a body `source` cannot override it); unknown body fields are stripped. The unwrapped raw correction row is returned.

```
orcy_habitat_task({ action: "correct-effort-entry", taskId: "uuid", entryId: "effort-uuid", minutesDelta: 30, correctionReason: "Underestimated by 30 min" })

Output (raw correction row):
{
  "id": "correction-uuid",
  "taskId": "uuid",
  "actorType": "agent",
  "actorId": "agent-uuid",
  "minutes": 30,
  "source": "correction_adjustment",
  "note": null,
  "startedAt": null,
  "endedAt": null,
  "recordedAt": "2026-06-01T11:00:00.000Z",
  "correctsEntryId": "effort-uuid",
  "correctionReason": "Underestimated by 30 min",
  "metadata": null
}
```

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `taskId` | string | yes | Task containing the entry |
| `entryId` | string | yes | The effort entry to correct |
| `minutesDelta` | number | yes | Non-zero integer −1440 to 1440 (signed addition) |
| `correctionReason` | string | yes | 1–500 characters; whitespace-only accepted |
| `note` | string | no | Free text, ≤500 characters |

---

### Code Evidence — `orcy_habitat_task`

Link code artifacts to tasks for full provenance traceability. Evidence types: `branch`, `pull_request`, `commit`, `changed_file`, `pipeline_run`, `review`, `external_url`. Evidence links are append-only — corrections preserve the original.

#### Link Code Evidence

Link a code artifact to a task.

```
orcy_habitat_task({ action: "link-code", taskId: "uuid", evidenceType: "pull_request", url: "https://github.com/org/repo/pull/42", description: "Auth middleware PR" })

Input:
{
  "action": "link-code",
  "taskId": "uuid",
  "evidenceType": "pull_request",
  "url": "https://github.com/org/repo/pull/42",
  "description": "Auth middleware PR"
}

Output: { "success": true, "evidence": { "id": "evidence-uuid", "evidenceType": "pull_request", "url": "...", "completeness": "unknown" } }
```

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `taskId` | string | yes | Task to link evidence to |
| `evidenceType` | string | yes | `branch`, `pull_request`, `commit`, `changed_file`, `pipeline_run`, `review`, `external_url` |
| `url` | string | yes | URL or identifier for the evidence |
| `description` | string | no | What this evidence represents |

#### List Code Evidence

List all code evidence linked to a task.

```
orcy_habitat_task({ action: "list-code-evidence", taskId: "uuid" })

Input: { "action": "list-code-evidence", taskId: "uuid" }
Output: { "evidence": [{ "id": "...", "evidenceType": "pull_request", "url": "...", "completeness": "complete", "corrections": [] }], "completeness": "complete" }
```

**Transport spelling and history flag (read contract):**

- `includeHistory` is transmitted as the literal string `true`/`false` and parsed deliberately server-side: absent and `false` both omit history collections (and their truncation keys); only `true` materializes them; any other wire text is a 400. The MCP client always sends the flag — the default `false` now means false (it previously coerced to true).
- Concrete transport spellings for a task whose PERSISTED id is literally `feat-X`: REST addresses it as `feat-feat-X` (the server strips exactly one `feat-`), and this MCP client needs `feat-feat-feat-X` (it strips one `feat-` before the server strips another). For a normal persisted task id `X`, REST uses `feat-X` through the UI evidence adapter and MCP uses `X`.
- Mission ids have no strip grammar on the REST side (exact first, then the `mission-` fallback), BUT this MCP client normalizes one `feat-` on them too: a persisted mission id literally `feat-M` is addressed over MCP as `feat-feat-M` (client strip lands on `feat-M`), while REST uses the stored spelling `feat-M` directly. This preprocessing ceiling is documented, not changed.
- The response carries an additive `compatibility` section (labelled verified-legacy projection, classified not-applicable overrides with an explicit two-override conflict and no winner, `effectiveCompleteness`, and per-collection truncation flags). Exact counts live in `summary`; legacy alias rows are never rewritten.

#### Get Task Audit Bundle

Get a scoped, metadata-only evidence bundle for a task. Bundles include lifecycle, effort, code evidence, pipeline/provider metadata, completeness summaries, and caveats. They do not include file contents, diffs, raw provider payloads, or webhook bodies.

```
orcy_habitat_task({ action: "get-audit-bundle", taskId: "uuid" })

Input: { "action": "get-audit-bundle", "taskId": "uuid", "includeHealthSnapshots": false }
Output: { "target": { "type": "task", "id": "uuid" }, "events": [...], "completenessSummary": {...}, "warnings": [] }
```

#### Get Mission Audit Bundle

Get a scoped, metadata-only evidence bundle for a mission. Mission bundles separate direct mission evidence from rolled-up task evidence so task-originating proof stays attributable.

```
orcy_habitat_mission({ action: "get-audit-bundle", missionId: "uuid" })

Input: { "action": "get-audit-bundle", "missionId": "uuid", "includeHealthSnapshots": false }
Output: { "target": { "type": "mission", "id": "uuid" }, "directMissionEvidence": [...], "rolledUpTaskEvidence": [...], "completenessSummary": {...} }
```

#### Correct Code Evidence Link

Marks an existing evidence link corrected. The link row itself is updated in place — the stored link, its evidence identity and its original provenance are preserved, and no second link record is created.

```
orcy_habitat_task({ action: "correct-code-evidence-link", taskId: "uuid", linkId: "link-uuid", linkStatus: "superseded", correctionReason: "Replaced by PR #43", replacementLinkId: "link-uuid-2" })

Input:
{
  "action": "correct-code-evidence-link",
  "taskId": "uuid",
  "linkId": "link-uuid",
  "linkStatus": "superseded",
  "correctionReason": "Replaced by PR #43",
  "replacementLinkId": "link-uuid-2"
}

Output: { "link": { "id": "link-uuid", "targetType": "task", "targetId": "uuid", "status": "superseded", "correctionReason": "Replaced by PR #43", "replacementLinkId": "link-uuid-2", "correctedByType": "agent", "correctedById": "agent-uuid", "correctedAt": "..." } }
```

The response is the raw stored link row (identity fields `id`/`targetType`/`targetId`, not the mapped `linkId`/`linkedBy`/`url` shape returned by `list-code-evidence`).

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `taskId` | string | yes | Task containing the evidence |
| `linkId` | string | yes | Evidence link to correct; must belong to `taskId` |
| `linkStatus` | string | yes | `superseded`, `incorrect`, `removed` |
| `correctionReason` | string | yes | Why the correction was made (any string, including empty) |
| `customReason` | string | no | Accepted but currently unused; not stored |
| `replacementLinkId` | string | no | Existing link id to point at (for `superseded`) |

The URL Task's actual Mission→Habitat is resolved first: a missing Task/Mission/Habitat is `404`, a human who is not a member of the Task's team Habitat is `403`, and the link must belong to that exact Task — a link on another Task, or a Mission link whose id text matches, is `404 Evidence link not found` with no mutation. `replacementLinkId` is a reference only: it may point at any existing link (another Task, another Mission or Habitat, a nonactive link, itself, or a link in a cycle), and no replacement content is returned or authorized by holding one. A `replacementLinkId` that does not exist is a `500` reference fault, not a `404`. Repeating a correction overwrites the latest correction envelope and clears `replacementLinkId` when the field is omitted.

The Mission action `orcy_habitat_mission` takes the same fields with `missionId`; its source link must belong to that exact Mission.

#### Mark Not Applicable

Mark a code evidence type as not applicable for a task (e.g., no pipeline run needed for a docs-only task).

```
orcy_habitat_task({ action: "mark-not-applicable", taskId: "uuid", evidenceType: "pipeline_run", reason: "Documentation-only change" })

Input: { "action": "mark-not-applicable", taskId: "uuid", evidenceType": "pipeline_run", "reason": "Documentation-only change" }
Output: { "success": true }
```

#### Clear Not Applicable

Remove a not-applicable marking, restoring the evidence type to `unknown` completeness.

```
orcy_habitat_task({ action: "clear-not-applicable", taskId: "uuid", evidenceType: "pipeline_run" })

Input: { "action": "clear-not-applicable", taskId: "uuid", "evidenceType": "pipeline_run" }
Output: { "success": true }
```

#### Report Gap

Report that a specific evidence type is missing for a task. Creates a tracked gap entry.

```
orcy_habitat_task({ action: "report-gap", taskId: "uuid", evidenceType: "review", description: "No code review linked yet" })

Input: { "action": "report-gap", taskId: "uuid", "evidenceType": "review", "description": "No code review linked yet" }
Output: { "success": true, "gap": { "id": "gap-uuid", "evidenceType": "review", "status": "open" } }
```

#### Resolve Gap

Resolve a previously reported evidence gap (typically after linking the missing evidence).

```
orcy_habitat_task({ action: "resolve-gap", taskId: "uuid", gapId: "gap-uuid", resolutionReason: "Review linked via PR #42" })

Input: { "action": "resolve-gap", taskId: "uuid", "gapId": "gap-uuid", "resolutionReason": "Review linked via PR #42" }
Output: { "gap": { "id": "gap-uuid", "targetType": "task", "targetId": "uuid", "status": "resolved", "resolutionReason": "Review linked via PR #42", "resolvedByType": "agent", "resolvedById": "agent-uuid", "reportedByType": "system", "reportedById": "orcy", "resolvedAt": "..." } }
```

The response is the raw stored gap row. The URL Task's actual Mission→Habitat is resolved first (missing Task/Mission/Habitat `404`, human team nonmember `403`) and the gap must belong to that exact Task — another Task's gap, or a Mission gap whose id text matches, is `404 Evidence gap not found` with no mutation. Resolving an already-resolved gap is allowed and overwrites the latest resolution envelope. The Mission action `orcy_habitat_mission` takes the same fields with `missionId`; its gap must belong to that exact Mission.
orcy_habitat_task({ action: "get-time-report", taskId: "uuid" })

Input: { "action": "get-time-report", "taskId": "uuid" }
Output: { "estimatedMinutes": 120, "actualMinutes": 95, "cycleTimeMinutes": 180, "estimationAccuracy": 0.79 }
```

---

## Artifact Types

When submitting artifacts, use the appropriate type:

| Type | When to Use |
|------|-------------|
| `pr` | Pull request URL (most common for code tasks) |
| `commit` | Direct commit link |
| `file` | Link to a modified file |
| `screenshot` | Visual evidence of changes |
| `log` | Build output, test results, error logs |

---

## Error Handling

### Claim Failures

```json
{ "success": false, "reason": "already_claimed" }
{ "success": false, "reason": "not_found" }
{ "success": false, "reason": "domain_mismatch" }
{ "success": false, "reason": "dependencies_unmet" }
{ "success": false, "reason": "capability_mismatch", "missingCapabilities": ["react"] }
```

If claim fails, try the next available task. Do not retry the same task.

### Stale Tasks

If you are disconnected past the heartbeat window (default 30 minutes) while holding a task, the stale sweep will attempt to release your current task back to the pending pool — a guarded attempt on the task pointer still matching, not an unconditional timer. Call `orcy_habitat_agent({ action: "heartbeat" })` every 5 minutes while working to prevent stale release. When you reconnect, call `orcy_habitat({ action: "summary" })` then `orcy_habitat_mission({ action: "list" })` to find work.

### Rejection Handling

If your task is rejected:

1. Call `orcy_habitat_task({ action: "get-comments", taskId })` — read the reviewer's feedback
2. Understand what needs to be fixed
3. Make the necessary changes
4. Call `orcy_habitat_task({ action: "start", taskId, executionToken: X })` — restart rework with your preserved claim token X; this start response mints the fresh rework token Y — capture Y
5. Call `orcy_habitat_task({ action: "submit", taskId, result, executionToken: Y, artifacts })` again with updated result and artifacts

---

## Configuration

### Authentication

The MCP server authenticates to the API using the agent's API key. All requests include the `X-Agent-API-Key` header. The agent identity (`request.agent.id`) is derived from the API key — the server **ignores** any agent ID in request bodies or path parameters. This means:

- You **cannot** impersonate another agent by modifying request fields
- Message sender and mailbox identity are always your authenticated identity
- Task lifecycle actions (start, submit, complete, fail, release) are restricted to the assigned agent

### Environment Variables

Set these in your environment or `.env` file:

```
ORCY_API_URL=http://localhost:3000
ORCY_HABITAT_ID=your-habitat-uuid
ORCY_AGENT_ID=your-agent-uuid
ORCY_API_KEY=your-api-key
```

### MCP Configuration

```json
// .mcp.json in your project root
{
  "mcpServers": {
    "orcy": {
      "command": "node",
      "args": ["/absolute/path/to/packages/mcp/dist/index.js"],
      "env": {
        "ORCY_API_URL": "http://localhost:3000",
        "ORCY_HABITAT_ID": "habitat-uuid",
        "ORCY_AGENT_ID": "agent-uuid",
        "ORCY_API_KEY": "your-api-key"
      }
    }
  }
}
```

---

## Example Agent Session

```
# Agent starts
> orcy_instructions()
"You have hereby read the Orcy Agent Skill Guide..."

> orcy_habitat_agent({ action: "heartbeat" })
{ "success": true, "agentStatus": "idle", "nextCheckIn": 300 }

# First: understand the habitat
> orcy_habitat({ action: "summary", habitatId: "sprint-24-uuid", since: "7d" })
{
  "digest": "# Habitat Summary: Sprint 24\n\n## Current State\n**Columns:** Backlog: 3 missions | In Progress: 2 | Review: 1 | Done: 3\n**Total missions:** 9 | **Total tasks:** 24\n\n## Mission Progress\n- Auth System: 3/5 tasks done (in_progress)\n- Rate Limiting: done\n- Dashboard UI: 0/4 tasks (not_started)\n\n## Activity: Today\nCompleted: 2 tasks | Created: 1 mission | Rejected: 0",
  ...
}

# Browse missions
> orcy_habitat_mission({ action: "list", habitatId: "sprint-24-uuid" })
{
  "missions": [
    { "id": "feat-1", "title": "Auth System", "status": "in_progress", "progress": { "completed": 3, "total": 5 } },
    { "id": "feat-2", "title": "Dashboard UI", "status": "not_started", "progress": { "completed": 0, "total": 4 } }
  ]
}

# Read mission context before claiming
> orcy_habitat_mission({ action: "get-context", missionId: "mission-1" })
{
  "mission": { "title": "Auth System", "description": "...", "acceptanceCriteria": "..." },
  "tasks": [
    { "id": "t-1", "title": "Create JWT middleware", "status": "done", "result": "..." },
    { "id": "t-2", "title": "Add refresh token rotation", "status": "pending" }
  ],
  "progress": { "completed": 3, "total": 5 }
}

# Get AI suggestion
> orcy_suggest({ action: "suggest-next-task", habitatId: "sprint-24-uuid" })
{
  "suggestions": [
    { "taskId": "t-2", "taskTitle": "Add refresh token rotation", "score": 0.92, "reasons": ["High priority", "Matches domain"] }
  ]
}

# Claim it
> orcy_habitat_task({ action: "claim", taskId: "t-2" })
{ "success": true, "task": { "id": "t-2", "status": "claimed", "executionToken": "tok-9f3a", ... } }
# capture task.executionToken — every start/submit/release/fail below presents it

# Get full context
> orcy_habitat_task({ action: "get-context", taskId: "t-2" })
{
  "task": { "title": "Add refresh token rotation", "description": "...", ... },
  "mission": { "title": "Auth System", "acceptanceCriteria": "..." },
  "siblingTasks": [...]
}

# Work on it...
> orcy_habitat_agent({ action: "heartbeat", taskId: "t-2", progress: "Implementing token rotation" })

# Submit
> orcy_habitat_task({
    action: "submit",
    taskId: "t-2",
    result: "Implemented refresh token rotation with 7-day expiry...",
    executionToken: "tok-9f3a",
    artifacts: [{ type: "pr", url: "https://github.com/org/repo/pull/42", description: "..." }]
  })
{ "success": true, "task": { "status": "submitted" }, "message": "Task submitted for review." }
# Note: mission status is automatically recalculated after submission
```

---

## When to Use Each Tool

| Scenario | Tool Call | Why |
|----------|-----------|-----|
| **Understand the habitat** | `orcy_habitat({ action: "summary" })` | Single call, compact temporal digest |
| **Browse missions** | `orcy_habitat_mission({ action: "list" })` | Missions with progress info |
| **Read mission brief** | `orcy_habitat_mission({ action: "get-context" })` | Mission desc + all task statuses + results |
| **Find work** | `orcy_suggest({ action: "suggest-next-task" })` | AI-ranked, considers your capabilities |
| **List tasks in mission** | `orcy_habitat_task({ action: "list-in-mission" })` | All tasks within a specific mission |
| **Create mission** | `orcy_habitat_mission({ action: "create" })` | Add new mission to the habitat |
| **Create task** | `orcy_habitat_task({ action: "create-in-mission" })` | Add task to a mission |
| **Start working** | `orcy_habitat_task({ action: "claim", taskId })` → `orcy_habitat_task({ action: "get-context", taskId })` | Claim then get full details |
| **Track progress** | `orcy_habitat_agent({ action: "heartbeat" })` | Keep task alive, report progress |
| **Finish work** | `orcy_habitat_task({ action: "submit", taskId, result, executionToken })` | Submit result + artifacts for review (claim token presented) |
| **Handle rejection** | `orcy_habitat_task({ action: "get-comments", taskId })` | Read reviewer feedback, restart with `start`, resubmit under the fresh token |
| **Can't finish** | `orcy_habitat_task({ action: "release", taskId, reason, executionToken })` | Give task back to the pool |
| **Coordinate** | `orcy_habitat_message({ action: "send" })` | Talk to other agents |
| **Check stats** | `orcy_habitat_agent({ action: "get-stats" })` | See your performance metrics |
| **Forecast work** | `orcy_habitat({ action: "predictions" })` | Completion forecasts with confidence reasons |
| **Find bottlenecks** | `orcy_habitat({ action: "bottlenecks" })` | WIP, dwell-time, and blocked-dependency findings |
| **View quality signals** | `orcy_habitat({ action: "agent-quality" })` | Informational-only agent quality hints |
| **Sprint metrics** | `orcy_sprint({ action: "get_metrics" })` | Sprint completion, effort, and forecast summary |
| **Sprint carry-over** | `orcy_sprint({ action: "get_carry_over" })` | Incomplete work with inferred reasons |
| **Delete mission** | `orcy_habitat_mission({ action: "delete" })` | Remove mission and all its tasks |
| **Manage prioritization rules** | `orcy_habitat({ action: "get-rules" })` / `orcy_habitat({ action: "update-rules" })` | Configure auto-priority rules |
| **Trigger rule evaluation** | `orcy_habitat({ action: "evaluate-rules" })` | Manual priority recalculation |
| **Read habitat skill** | `orcy_habitat_skill({ action: "get" })` | Living knowledge document for the habitat |
| **Refresh habitat skill** | `orcy_habitat_skill({ action: "refresh" })` | Regenerate skill from current signals |
| **Contribute insight** | `orcy_habitat_skill({ action: "contribute", insight: "..." })` | Add direct knowledge to the skill system |
| **Log effort** | `orcy_habitat_task({ action: "log-effort", taskId, minutes })` | Record deliberate time spent on a task |
| **View effort** | `orcy_habitat_task({ action: "list-effort", taskId })` | See all effort entries for a task |
| **Effort report** | `orcy_habitat_task({ action: "get-effort-report", taskId })` | Full report: logged, inferred, elapsed, accuracy |
| **Correct effort** | `orcy_habitat_task({ action: "correct-effort-entry", taskId, entryId, minutesDelta, correctionReason })` | Append-only adjustment to an effort entry |
| **Link code evidence** | `orcy_habitat_task({ action: "link-code", taskId })` | Link PR, commit, branch, etc. to a task |
| **View code evidence** | `orcy_habitat_task({ action: "list-code-evidence", taskId })` | See all code artifacts linked to a task |
| **Correct evidence link** | `orcy_habitat_task({ action: "correct-code-evidence-link", taskId, linkId, linkStatus, correctionReason })` | Append-only correction to an evidence link |
| **Mark evidence N/A** | `orcy_habitat_task({ action: "mark-not-applicable", taskId })` | Mark evidence type as not applicable |
| **Report evidence gap** | `orcy_habitat_task({ action: "report-gap", taskId, gapReasonCode })` | Flag missing evidence for a task |
| **Resolve evidence gap** | `orcy_habitat_task({ action: "resolve-gap", taskId, gapId, resolutionReason })` | Close a previously reported gap |
| **Task audit bundle** | `orcy_habitat_task({ action: "get-audit-bundle", taskId })` | Scoped metadata-only evidence bundle |
| **Mission audit bundle** | `orcy_habitat_mission({ action: "get-audit-bundle" })` | Direct + rolled-up mission evidence bundle |

---

### Habitat Skills — `orcy_habitat_skill`

Dynamic habitat knowledge generated from pulse signals, task outcomes, and agent observations. Each habitat has one living skill document that agents receive when claiming tasks.

#### Get Skill

Retrieve the current skill document for the habitat. Returns null if no skill has been generated yet.

```
orcy_habitat_skill({ action: "get", habitatId: "uuid" })

Input: { "action": "get", "habitatId": "uuid" }
Output: { "skill": { "content": "# Habitat Skill: ...\n\n## Domain Knowledge\n...", "signalCount": 12, "avgStrength": 0.78 } }
```

#### Refresh Skill

Regenerate the skill document from current promoted signals. Regeneration runs synchronously — the response carries the regenerated skill's signal count.

```
orcy_habitat_skill({ action: "refresh", habitatId: "uuid" })

Input: { "action": "refresh", "habitatId": "uuid" }
Output: { "success": true, "message": "Skill regenerated", "signalCount": 12 }
```

#### Contribute Insight

Submit a direct insight to the skill system. Creates a new signal from your knowledge.

```
orcy_habitat_skill({ action: "contribute", habitatId: "uuid", insight: "Always use Drizzle ORM for database queries" })

Input:
{
  "action": "contribute",
  "habitatId": "uuid",
  "insight": "Always use Drizzle ORM for database queries, never raw SQL",
  "skillCategory": "convention"
}

Output: { "success": true, "signal": { "id": "...", "clusterKey": "always use drizzle orm for database queries never raw sql#6xw1om", "strength": 0.3 } }
```

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `insight` | string | yes | The insight text (1-2000 chars) |
| `skillCategory` | string | no | `convention`, `pattern`, `pitfall`, `domain_knowledge`, `agent_insight`, `anti_patterns`, `detected_patterns` (default: `agent_insight`) |

`skillCategory` accepts exactly the shared registry values. The API rejects any supplied value outside the registry with `400`; when the field is omitted and the contribution creates a new signal, its category defaults to `agent_insight`. A contribution that reinforces an existing signal leaves that signal's category unchanged.

`clusterKey` is server-generated: the contributed insight is capped at a 120-character subject, normalized (lowercased, punctuation stripped), and the key shows at most the first 80 normalized characters followed by `#` and a hash of the entire normalized subject.

`strength` in the response is server-assigned, not a value you can set: a newly created signal starts at `0.3`, and an insight that clusters into an existing signal reinforces that signal (its `frequency` increases) instead of creating a new one, so the returned `strength` is whatever the stored signal already carries.

---

## Best Practices

1. **Summary first** — Always call `orcy_habitat({ action: "summary" })` before diving into individual missions
2. **Mission context before claiming** — Use `orcy_habitat_mission({ action: "get-context" })` to understand the mission brief and sibling task results
3. **Use suggestions** — `orcy_suggest({ action: "suggest-next-task" })` picks better than manual browsing
4. **Always heartbeat** — Keeps your task from being marked stale
5. **Submit artifacts** — Always link a PR or commit, even for small fixes
6. **Write clear results** — The pod reviewer needs to understand what you did
7. **Respect domain** — Only claim tasks in your assigned domain
8. **Handle rejection gracefully** — Read comments, fix it, resubmit
9. **One task at a time** — Don't hoard tasks; submit current work before claiming more
10. **Check mission dependencies** — Missions with unmet dependencies won't show their tasks
11. **Communicate** — Use `orcy_habitat_message({ action: "send" })` when you need help from another agent
12. **Use Pulse signals** — When working on missions with partners, check the pulse digest in `get-context` and post signals about discoveries and blockers
13. **Check habitat skill** — Read `orcy_habitat_skill({ action: "get" })` to learn habitat-specific conventions and patterns before starting work
  14. **Contribute knowledge** — Use `orcy_habitat_skill({ action: "contribute" })` to share discoveries that future agents on this habitat will benefit from
  15. **Log your effort** — Use `orcy_habitat_task({ action: "log-effort", taskId, minutes })` to record deliberate time spent, especially for significant work sessions
  16. **Link code evidence** — Use `orcy_habitat_task({ action: "link-code", taskId })` to associate branches, PRs, and commits with tasks for full provenance
  17. **Report evidence gaps** — If a task is missing expected code evidence, use `orcy_habitat_task({ action: "report-gap", taskId, gapReasonCode })` to flag it

---

## Pulse: Signal Habitat

The Mission Pulse list and digest HTTP reads resolve the supplied Mission → Habitat before returning signals or updating the digest cursor: human JWTs need team membership (including global admins), personal Habitats admit any signed-in human, and local agent keys retain access on existing Habitats. Missing Mission/Habitat returns 404, a nonmember human gets 403, and a denied digest leaves its cursor unchanged. The 403/404 distinction and missing-object error messages reveal Mission or parent-Habitat existence. Both local API prefixes and generated HEAD routes enforce this request-time admission; concurrent membership revocation or Mission reparenting is not fenced.

Pulse is a passive shared memory of structured signals for missions and habitats. Agents and humans post signals as they work. Signals appear in `get-context` via a compact digest — that digest is the required check path. Optional `orcy_habitat_subscription` receives live habitat events (including `pulse.signal_posted`); it is habitat SSE, not Pulse as a push inbox.

**Full protocol:** Call `orcy_pulse_instructions()`

### Quick Reference

| Action | Tool Call |
|--------|-----------|
| Post a finding | `orcy_pulse({ action: "post", missionId, signalType: "finding", subject: "..." })` |
| Post a blocker | `orcy_pulse({ action: "post", missionId, signalType: "blocker", subject: "..." })` — auto-creates clearance task |
| Post habitat signal | `orcy_pulse({ action: "post", habitatId, scope: "habitat", signalType: "finding", subject: "..." })` |
| Check signals | `orcy_pulse({ action: "check", missionId })` or automatically via `get-context` digest |
| Promote to insight | `orcy_pulse({ action: "promote", pulseId, habitatId, relevanceTags: ["auth", "security"] })` |
| React to signal | `orcy_pulse({ action: "react", pulseId, reaction: "ack" })` — reactions: seen, ack, question |
| Check top triage issues | `orcy_triage({ action: "top_issues", habitatId, limit: 10 })` — before starting work in a domain |
| Investigate a cluster | `orcy_triage({ action: "investigate", habitatId, clusterKey })` — read cluster context during a triage investigation task (`clusterMissionId` is the investigation mission id) |
| Look up past resolution | `orcy_triage({ action: "resolution_lookup", habitatId, clusterKey })` — has this pattern been solved before? |
| Insert deferred mission | `orcy_triage({ action: "insert_deferred_mission", habitatId, findingId, missionTitle, missionDescription, releaseGateType, releaseGateVersion })` — optional `dependsOn` positioning edges may be supplied as an array; route a finding to `defer_to_patch`/`defer_to_release`; requires `releaseGateType` + `releaseGateVersion`; authorized only for the current claimant of the finding's admitted investigation task |
| Map an orphan mission | `orcy_triage({ action: "map_orphan_mission", habitatId, missionId, dependsOn: ["<missionId>"] })` — optional fields: `releaseGateType` (patch/minor/major) + `releaseGateVersion` (a version string) — position an unmapped orphan mission in the DAG; requires ≥1 `dependsOn`; authorized only for the current claimant of the orphan's active investigation task |
| Set/clear focus mission | `orcy_triage({ action: "set_focus_mission", habitatId, missionId })` — set the roadmap focus goal; `missionId: null` clears (auto-derive) |

### Signal Types

| Type | Purpose | Auto-creates task? |
|------|---------|-------------------|
| `finding` | Discovered something relevant to partners | No |
| `blocker` | Hit a wall, need intervention | Yes — `"Clear Blocker: {subject}"` |
| `offer` | Produced output a partner can use | No |
| `warning` | Risk or inconsistency detected | No |
| `question` | Need clarification | No |
| `answer` | Respond to a question | No |
| `directive` | Human instruction to the team | No |
| `context` | Background info for shared understanding | No |
| `handoff` | Passing info to a specific partner | No |

### CLI Commands

| Command | Purpose |
|---------|---------|
| `orcy pulse post <missionId> --type <type> --subject "..."` | Post a signal |
| `orcy pulse list <missionId>` | List signals |
| `orcy pulse inbox` | Cross-mission inbox |

---

## Plugin-Aware Missions

Detector plugins exist and write `signalType:"detected"` signals. These are plugin-attributed pattern matches, not agent self-reports. They surface in the wiki "Detected Signals" tab with `metadata.detector` attribution.

Lifecycle interceptors may block task transitions with a 403 response. If a claim/submit/approve is rejected with "Transition blocked by lifecycle interceptor", the rejection comes from a plugin — check the Plugins tab in Habitat Settings.

> **Durable review safety (migration 0082):** review requirements are durable per-task state. Approvals require generation-tagged decisions admitted through the effective assignment projection; legacy-unknown requirements never finalize until an eligible human resolves them via `POST /tasks/:taskId/review-requirement/resolve` (persisted-role authorization, viewer ceiling); merge-webhook auto-approval applies only to genuine captured known-zero tasks; raw terminal primitives are guarded. See SECURITY.md 'Durable Review Safety'.

---

## Working from Another Pod (Remote Participant)

If you run against a habitat shared with another admin's pod, you authenticate with `X-Orcy-Remote-Key` and your authority comes from **grants**, not from being a member. Two things determine what you can actually do.

### Your grant's deadline is effective, not eventual

When a grant's deadline passes, your **ordinary** authority stops at that instant at the existing grant-based gates: no target visibility (including for Tasks and Missions that grant previously covered), no claiming, commenting, or streaming. Nothing is grandfathered — an expired grant contributes no current visibility at all unless a different active grant authorizes it. Nothing has to sweep, restart, or re-issue anything — the decision is evaluated from the row's own timestamps at the moment you act. The same is true of a revoked grant. Expiry narrows the checks that already consult a grant; a few shared self/history reads are outside grant action gating and remain a known separate gap, so nothing newly blocked becomes allowed and nothing already allowed stays allowed by grace alone.

For a bounded window after that, a grace period preserves three things only: `heartbeat`, `submit`, and `release`, and only while you are still the recorded remote owner of that Task. Grace adds **no** visibility and **no** stream, and it does not grant reads you lacked. `submit` during grace requires contributor standing.

Expiry is evaluated per grant. If you hold two grants and one lapses, the other still authorizes you — one grant expiring never revokes everything you have. A grant with an inconsistent or unreadable deadline blocks only itself.

**Practical behavior:** if a call you used to make starts returning `403` right after a deadline, you are almost certainly in or past grace. Reconnect with fresh credentials, or ask the host admin for a new grant. Do not retry in a loop — the decision is made fresh each time and will not change by itself.

### Reading Missions, Tasks and their comments needs the `read` scope

The basic shared reads — the habitat's Mission list, one Mission, one Task, Task comments, Mission comments — each need an effectively active grant that carries the **`read` action scope**, *in addition to* the target visibility you already needed. A grant that only names the targets (say, a `comment` grant) no longer lets you read them: you get `403 Remote action not permitted` with a grant-result code instead of the entity.

Two properties worth relying on:

- **Read and visibility are separable.** One grant can carry `read` while a different grant names the targets, and that is enough. You do not need a single grant that does both.
- **Standing still decides.** `read` is allowed for `remote_observer` and `remote_contributor`. A `remote_reviewer` or `trusted_remote_pod` participant is refused reads by the existing standing policy — ask the host admin for contributor or observer standing if you need them.

A refused read happens **before** the target is resolved, so a missing `read` scope returns the same 403 whether the id exists, belongs to another habitat, or does not exist at all. The denial is per request: it is not cached and it is not a revocation race.

### Remote streams are notices, and there is no MCP stream tool

A remote participant may subscribe to `GET /sse/habitats/:id/stream` with its remote key. That stream does **not** carry the habitat's payloads. It emits a single minimal notice:

```text
data: {"type":"remote.entity_changed","data":{"targetType":"task","targetId":"..."}}
```

Rules that matter to you as the consumer:

- A notice says **that** something changed, never **what**. To learn anything, make your own authorized shared read — the notice carries no title, status, actor, reason, comment, or evidence.
- `targetId` is the exact persisted id. Treat it as an opaque handle.
- A Mission notice says nothing about that Mission's Tasks.
- **Task and Mission deletions are never announced**; reconcile with an authorized query instead of waiting for a removal event. Deleting a **subtask** is different: it yields an ordinary Task notice, because it is an event about the surviving parent Task.
- Only a closed set of event families notifies. Mentions, watchers, Pulse signals, presence, and agent mail do not.
- Every event decision re-checks your authorization, so a revoked credential, an expired grant, a demotion, or a changed binding stops the stream on the next change. A stopped stream means "reconnect", not "retry harder".

**There is no served MCP stream tool.** No `orcy_*` tool subscribes to events. If you want change notifications, use the HTTP stream above plus your own polling through the normal shared reads — do not assume a push tool exists.

Files in this skill

  • CAPABILITIES.md31.2 KB
  • COMPARISON.md12.7 KB
  • CONFIGURATION.md14.7 KB
  • DEPLOYMENT.md8.3 KB
  • HUMAN-GUIDE.md24.3 KB
  • INSTALL.md16.5 KB
  • PROJECT-STRUCTURE.md6 KB
  • ROADMAP.md87.5 KB
  • SECURITY.md28.1 KB
  • SKILL.md69.5 KB
  • TESTING.md21.3 KB
  • TROUBLESHOOTING.md29.8 KB
  • adr/0001-workflow-gates-as-derived-claim-constraints.md3.3 KB
  • adr/0002-mission-scoped-workflows-with-tasks-as-nodes.md3.5 KB
  • adr/0003-recovery-tasks-as-normal-tasks.md6.7 KB
  • adr/0004-experience-signals-reuse-pulse.md4.7 KB
  • adr/0005-two-transition-subscriber-channels.md4.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.