@nestr/mcp 0.1.60 → 0.1.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/server.js CHANGED
@@ -5,1291 +5,78 @@
5
5
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
6
6
  import { ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
7
7
  import { createClientFromEnv } from "./api/client.js";
8
+ import { VERSION } from "./version.js";
8
9
  import { toolDefinitions, handleToolCall } from "./tools/index.js";
9
10
  import { getCompletableListHtml, appResources } from "./apps/index.js";
10
- import { WORKSPACE_SETUP_INSTRUCTIONS } from "./skills/workspace-setup.js";
11
- import { TENSION_PROCESSING_INSTRUCTIONS } from "./skills/tension-processing.js";
12
- import { DOING_WORK_INSTRUCTIONS } from "./skills/doing-work.js";
11
+ // Skills instructions are now served on-demand via nestr_help tool (see src/help/topics.ts)
13
12
  import * as mcpcat from "mcpcat";
14
13
  // Server instructions provide context to AI assistants about what Nestr is and how to use it
15
14
  const SERVER_INSTRUCTIONS = `
16
- # Nestr Foundation
15
+ # Nestr — Self-Organization Platform
17
16
 
18
- ## Why Nestr Exists
17
+ Nestr helps organizations practice role-based self-organization (Holacracy, Sociocracy, Teal, or custom). It distributes authority through roles and circles so decisions happen close to the work, with accountability to organizational purpose.
19
18
 
20
- ### The Problem
19
+ **For detailed reference on any topic, call \`nestr_help\` with a topic name. Use \`nestr_help({ topic: "topics" })\` to see all available topics.**
21
20
 
22
- Most collaborations today are driven by the personal incentives of a few people at the top of the hierarchy. Shareholder ROI. Short-term growth. Promotions. Wage increases. Status. Titles. These incentives shape decisions, not the long-term needs of those doing the work or those impacted by it.
21
+ ## Key Principles
23
22
 
24
- The result is wealth and power centralizationboth within organizations and across society. More and more people are left without a pathway to process their needs. They have no voice to course-correct the organizations and collectives affecting their lives.
23
+ 1. **Purpose**Everything serves organizational purpose. Governance translates purpose into circles and roles.
24
+ 2. **Tensions** — Gaps between current reality and potential. The fuel for change. Can be issues or opportunities.
25
+ 3. **Governance** — All assets belong to roles/circles, not people. People energize roles.
26
+ 4. **Context differentiation** — Process work in the right context: governance (working ON), tactical (working IN), community (being together), personal (inner world).
27
+ 5. **Role and Soul** — Distinguish organizational needs from personal needs. Only do work expressed in your role's accountabilities.
28
+ 6. **Heartbeats** — Regular governance, tactical, and community meetings with elected facilitators.
25
29
 
26
- ### What Needs to Change
30
+ ## Three Operating Modes
27
31
 
28
- Nestr exists to help our collaborations serve the collective needs of those doing the work and those impacted by the work.
32
+ Call \`nestr_get_me\` with \`fullWorkspaces: true\` at session start to establish identity, mode, and accessible workspaces.
29
33
 
30
- For this to happen:
34
+ **Workspace selection:** One workspace → use it automatically. Multiple → match by name. API key → scoped to one workspace.
31
35
 
32
- 1. **People need clarity of purpose.** Not just visibility into the work they do, but understanding of the purpose they contribute to. With this clarity, people can make informed choices: join an organization whose purpose resonates, stay and contribute fully, or leave when alignment fades. If no existing collaboration reflects your values, start your own and see if others wish to join.
36
+ The response tells you who you are:
33
37
 
34
- 2. **Organizations need accountability to purpose.** Organizations often begin as personal purposeone person's vision that calls others to join. But once collaboration begins, something shifts: the initiative becomes an entity in its own right, distinct from the person who started it. The originator becomes the *source*, not the owner. The source matters—it's where the purpose came from—but the organization is no longer under their control. It belongs to its purpose now, and everyone contributing shares responsibility for pursuing it.
38
+ - **Assistant mode** (\`mode: "assistant"\`)Helping a human who fills roles. Defer to them for decisions. Help articulate tensions, draft proposals, surface work for review. Confirm before acting.
39
+ - **Role-filler mode** (\`mode: "role-filler"\`) — You energize roles and act from their authority. Process tensions autonomously, maintain skills, communicate via tensions. Act within accountabilities without seeking approval.
40
+ - **Workspace mode** (\`mode: "workspace"\`) — API key with no user identity. Manage structure and operations. User-scoped features (inbox, daily plan, notifications) are unavailable.
35
41
 
36
- This means organizations must articulate what they exist to achieve and be held accountable for pursuing it effectively. Without this clarity, organizations drift into serving inertia—or worse, the personal agendas of those with power—rather than their stated purpose. And people cannot meaningfully assess whether to contribute.
42
+ Call \`nestr_help({ topic: "operating-modes" })\` for detailed behavioral guidance per mode.
37
43
 
38
- Role-based work and self-organization is the mechanism that makes this possible. It distributes authority so that decisions happen close to the work. It creates transparency so people can assess alignment. And it establishes clear accountability so organizations can be held to their stated purpose.
44
+ ## Self-Organization Flavour
39
45
 
40
- Nestr doesn't judge what makes a purpose good or bad. That's for people to decide. Nestr provides the clarity and structure that lets people make that decision—and act on it.
41
-
42
- ## What We're Building Toward
43
-
44
- A platform for purpose-driven organizations where everybody can start, find, contribute to, evolve, and invest in purposes that align with their personal values.
45
-
46
- ## Principles
47
-
48
- ### 1. Purpose
49
-
50
- Organizational purpose is the container within which everything happens. If work does not directly contribute to purpose, it should not be done. Governance unpacks organizational purpose into ever more concrete containers (circles, roles) to help translate purpose into work. Reflecting on purpose at all levels—and how it relates to the work—is important and needs to happen often.
51
-
52
- ### 2. Tensions
53
-
54
- Tensions are the fuel for change. Without them, nothing happens—and in theory, if there are no tensions, we'd be living in a perfect world. Our goal is to contribute to a society where everyone can process their tensions in the contexts they are part of.
55
-
56
- We help people recognize their sensed tensions and capture them (in our inbox, for example), so that we can analyze the tension, find the right context, container, and pathways to process them into meaningful change.
57
-
58
- The word "tension" is often perceived as negative, but it is neutral—a tension can represent an issue or an opportunity.
59
-
60
- ### 3. Governance
61
-
62
- No organizational assets are owned personally. All assets and work are owned by roles and circles as expressed through governance. People energize roles and through those roles control assets—but people never own roles, work, or organizational assets. It all belongs to the organizational purpose.
63
-
64
- ### 4. Differentiation of Context
65
-
66
- Process work in the right context. A single tension often requires work across multiple contexts—the differentiation gives clarity on how to process each part effectively.
67
-
68
- **a) Governance — Working ON the organization**
69
- Evolving roles, accountabilities, and policies. Goal: ever-increasing clarity for everyone in the organization on how to best express the organizational purpose.
70
-
71
- **b) Operational/Tactical — Working IN the organization**
72
- Executing projects and actions within existing roles. Goal: impactful and effective manifestation of organizational purpose, transparent to all within the organization.
73
-
74
- **c) Community — Being together**
75
- The interpersonal space where people connect and communicate. Goal: continuously improve interpersonal dynamics so people can effectively energize their roles.
76
-
77
- **d) Personal — Your inner world**
78
- Individual needs, feelings, and clarity. Goal: each person has clarity on their own needs and can differentiate between personal needs and organizational needs.
79
-
80
- ### 5. Role and Soul
81
-
82
- Does the organization care, or do you care? This is a crucial question to determine if you should process something in role (either yours or elsewhere in the organization) or if you should process it personally, outside of the organization.
83
-
84
- Only do work that is actually expressed through your role's purpose or accountabilities. Otherwise, hand it over to another role that is accountable. Doing work outside of your role comes with an opportunity cost and infringes on other roles.
85
-
86
- If work is not yet captured in a role but is needed for organizational purpose, do the work outside of role and process a governance tension to ensure it is reflected in governance going forward.
87
-
88
- **Prefer more smaller roles over few large ones.** When someone holds one big role, they start to identify with it—and unconscious personal needs seep into organizational decisions. Smaller, focused roles maintain clearer boundaries between role and soul.
89
-
90
- **Governance before operations.** When working ON the organization (defining roles, circles, accountabilities), don't compromise structure based on current operational constraints like "we don't have enough people" or "no one has the skills for that." Define all the roles and circles needed to effectively serve purpose today. Operational constraints are solved operationally—people almost always fill multiple roles, and circle leads are accountable for any unfilled roles until capacity grows. Premature compromises in governance obscure that there is a clear need for work to be done and insufficient operational resources to do it. Capturing the governance explicitly ensures both needs are served rather than both hidden.
91
-
92
- ### 6. Heartbeats
93
-
94
- A heartbeat for each container is crucial to effectively serve all. Without rhythm, we don't create the space to process what is alive in that specific container. There needs to be a governance/structure heartbeat, an operational/tactical heartbeat, and a community/interpersonal heartbeat—often expressed in the form of a meeting facilitated by an explicitly elected facilitator, not a conventional manager.
95
-
96
- ## Considerations for AI Agents
97
-
98
- ### Three Operating Modes
99
-
100
- Call \`nestr_get_me\` with \`fullWorkspaces: true\` at session start. This single call establishes your identity, operating mode, AND the workspaces you can access. Almost all work in Nestr happens within a workspace, so establishing workspace context early is critical.
101
-
102
- **Workspace selection rules:**
103
- - **One workspace**: Automatically treat it as the active workspace — no need to confirm.
104
- - **Multiple workspaces**: Use the workspace names from the response to identify the right one. If the user mentions a workspace by name, match against cached names. If no obvious match, fall back to \`nestr_list_workspaces\` with a search query.
105
- - **Workspace API key**: The key is scoped to a single workspace — it is automatically the active workspace.
106
- - **Cross-workspace work**: Users may work across workspaces when prioritizing work, managing their inbox, or creating new workspaces. Be ready to switch context when they reference a different workspace by name.
107
-
108
- The response tells you who you are and how to behave:
109
-
110
- **Assistant mode** (\`mode: "assistant"\`) — You are helping a human who fills roles. The human is the decision-maker. You help them process tensions, create work, draft proposals, and navigate governance. You act on behalf of the user's roles but defer to them for decisions. When creating tensions, you help the *user* differentiate between personal feelings and role-driven needs, keeping the focus on purpose-driven work. When checking tensions, you surface them *to the user* for review. Confirm before proposing or acting.
111
-
112
- **Role-filler mode** (\`mode: "role-filler"\`) — You energize one or more roles and act from their authority. You have no authority as an agent — only through the roles you fill. You own the tensions on your roles, make decisions within role accountabilities, communicate with other roles (human or agent) via tensions, and process work independently. Speak in first person from the role perspective. Act within your role's accountabilities without seeking human approval (unless the action exceeds role authority). Use the feeling/needs fields on tensions to express organizational impact and unmet organizational needs. Proactively check for and process tensions directed at your roles.
113
-
114
- **Workspace mode** (\`mode: "workspace"\`) — You are using a workspace API key with no user identity. You can manage the workspace structure (circles, roles, governance) and operational work, but user-scoped features are unavailable: inbox, daily plan, personal labels, notifications (\`nestr_list_notifications\`), \`nestr_list_my_tensions\`, and \`nestr_list_tensions_awaiting_consent\` will not work. You are managing the workspace directly, not on behalf of any specific user.
115
-
116
- This distinction affects tone, authority, decision-making, and how proactively you act. All guidance below applies to all modes unless explicitly noted.
117
-
118
- ### Mode-Specific Behavior Summary
119
-
120
- **Role-filler agents should:**
121
- - Act from role authority, never as an individual — all work and decisions flow through the roles you energize
122
- - Process inbox and tensions on your roles autonomously — don't wait to be asked
123
- - Maintain skills on your roles — capture repeatable processes, learned patterns, and domain knowledge as skill-labeled nests for continuity across sessions
124
- - Create and process work within your roles' accountabilities without seeking human confirmation
125
- - Communicate with other roles via tensions, not conversations
126
- - Plan daily work and execute proactively
127
- - When work falls outside your roles' authority, create a tension on the circle requesting the accountable role act
128
- - Regularly check \`nestr_list_my_tensions\`, \`nestr_list_tensions_awaiting_consent\`, and \`nestr_list_notifications\` to stay current
129
-
130
- **Assistant-mode agents should:**
131
- - Defer to the human for all decisions — suggest, don't decide
132
- - Help the user articulate their tensions including feeling and needs
133
- - Surface tensions and work items for the user to review and prioritize
134
- - Confirm before proposing governance changes or creating work on behalf of the user
135
-
136
- **Workspace-mode agents should:**
137
- - Focus on structural operations: governance setup, workspace configuration, reporting, and bulk management
138
- - Avoid user-scoped tools (inbox, daily plan, personal labels, notifications, my tensions) — they will fail
139
- - Assign work based on organizational rules rather than interactive decisions with a user
140
-
141
- ### Self-Organizational Flavour
142
-
143
- Nestr is agnostic to what flavour of self-organization is used (Holacracy, Sociocracy, Teal practices, home grown role-based processes). We support any and all experiments in distributed authority in pursuit of purpose. We aim to match our communication as closely as we can to the semantics of each approach.
144
-
145
- When the flavour is clear, apply the rules and principles of that specific flavour to questions and interactions. For example, if an organization practices Holacracy, use Holacratic principles when guiding governance proposals or interpreting role authority.
146
-
147
- When the flavour is not clear, loosely apply Holacracy where their own internal policies lack clarity.
148
-
149
- ### Meeting Organizations Where They Are
150
-
151
- We serve all organizations in their pursuit of self-organization regardless of where they are on their path. They might have just started with no experience at all, or they might have been practicing for years or decades. Depending on where they are, we need to be mindful of what and how we address their requests.
152
-
153
- The transition from management hierarchy to self-organization involves key behavioral shifts:
154
-
155
- | From | To |
156
- |------|-----|
157
- | Have a job | Fill a portfolio of roles |
158
- | Ask permission unless allowed | Act unless explicitly restricted |
159
- | Do your work | Lead your roles |
160
- | Manager facilitates | Elected facilitator |
161
- | Endless debate | Hand over to accountable role |
162
- | Manager wields stick/carrot | Explicit roles for accountability and support |
163
- | Big bang delivery | Continuous transparency |
164
- | 2-yearly centralized reorg | Continuous monthly governance updates by all |
165
- | Implicit purpose of shareholder ROI | Explicit and accountable purpose |
166
- | Blaming superiors | Processing tensions |
167
- | Blaming team | Processing tensions |
168
-
169
- We must recognize where people are in these transitions and support them with patience, not judgment.
170
-
171
- ### Matching Work to Roles
172
-
173
- When determining which role should own a piece of work:
174
-
175
- **Role names are hints, not definitions.** A role's name is like a person's name—it suggests but doesn't define. "Developer" might handle infrastructure, "Architect" might write code. Never assume responsibilities from the name alone.
176
-
177
- **Purpose and accountabilities define expectations.** Only the role's explicit purpose and accountabilities tell you what work belongs there. If a role has the accountability "Developing new functionality in our IT product", that role owns development work—regardless of whether it's called "Developer", "Engineer", or "Builder".
178
-
179
- **Domains define exclusive control, not expectations.** A domain doesn't mean the role will do work in that area—it means the role controls organizational assets in that area. Other roles must get permission to impact those assets.
180
-
181
- **Example:** A project "Make data available to our clients in MongoDB" likely belongs to a role with accountability "Developing new functionality in our IT product" (perhaps called "Developer"). However, if another role has the domain "Development stack", note that adding MongoDB to the stack requires that role's input or approval—the domain holder controls what technologies are used, even if they don't implement them.
182
-
183
- When determining work assignments, consider:
184
- 1. Which role's accountabilities match the work?
185
- 2. Does the work impact any role's domain? If so, flag the need for coordination.
186
- 3. Are there multiple roles whose accountabilities overlap? Surface this for clarification.
187
-
188
- `.trim();
189
- // Reference documentation: API usage, search syntax, labels, inbox, daily plan, etc.
190
- const SERVER_INSTRUCTIONS_REFERENCE = `
191
- # Using Nestr
192
-
193
- Nestr is a work management platform for teams practicing self-organization, Holacracy, Sociocracy, and Teal methodologies.
194
-
195
- ## Linking to Nests
196
-
197
- **Always link to nests when mentioning them.** The URL format is:
198
-
199
- \`https://app.nestr.io/n/{nestId}\`
200
-
201
- If you know the context (circle or workspace) of the nest, include it as a prefix:
202
-
203
- \`https://app.nestr.io/n/{contextId}/{nestId}\`
204
-
205
- Where \`{contextId}\` is the nest's containing circle or workspace (found in the \`ancestors\` array). If you don't know the context ID, just use \`/n/{nestId}\` — it will still work.
206
-
207
- **IMPORTANT:** The URL path is \`/n/\`, NOT \`/nest/\`, \`/nests/\`, or any other variation. Always use \`/n/\`.
208
-
209
- Examples:
210
- - Role in a circle: \`[Developer](https://app.nestr.io/n/circleId/roleId)\`
211
- - Top-level workspace: \`[My Workspace](https://app.nestr.io/n/workspaceId)\`
212
- - Task (circle unknown): \`[Fix bug](https://app.nestr.io/n/taskId)\`
213
-
214
- ## Workspace Types
215
-
216
- Most workspaces are organizational, representing a self-organized team. Check the workspace's labels to determine the type:
217
-
218
- - **Organizational Workspace** (most common): Has the "anchor-circle" label. The workspace IS the anchor circle of a self-organized team using Holacracy/Sociocracy/Teal governance. Contains sub-circles, roles with accountabilities and domains, and collaborative projects.
219
- - **Personal Workspace**: No "anchor-circle" label. A personal space where an individual tracks their own work and projects.
220
-
221
- The specific self-organization methodology is stored in \`workspace.data['self_organisation_type']\`. **Adapt your language and understanding based on this value:**
222
-
223
- ### Holacracy (\`holacracy\`)
224
- Use your general knowledge of the Holacracy framework. Key terminology:
225
- - **Governance** - The process of evolving roles, circles, and policies
226
- - **Tensions** - Gaps between current reality and potential; the driver for change
227
- - **Individual Action** (\`individual-action\` label) - Individual initiative taken without role authority
228
- - **Circle Lead** - Role that allocates resources and priorities for the circle
229
- - **Rep Link** - Role that represents a sub-circle in its super-circle
230
- - **Constitution** - The rules of the game that define how governance works
231
- - **Accountabilities** and **Domains** - Core role definitions
232
-
233
- ### Sociocracy / S3 (\`sociocracy\`)
234
- Use Sociocracy 3.0 or classic sociocratic terminology:
235
- - **Dynamic Governance** - The equivalent of Holacracy's governance
236
- - **Backlog** - Collection of work items and proposals
237
- - **Leader** - Circle leadership role (similar to Circle Lead)
238
- - **Representative** / **Delegate** - Represents circle in parent (similar to Rep Link)
239
- - **Drivers** - Similar to tensions; what motivates change
240
- - **Proposals** and **Objections** - Decision-making process terms
241
-
242
- ### Custom (\`custom\`)
243
- Use lighter, more general terminology - avoid heavy framework jargon:
244
- - **Structure** - Instead of "governance" (but you may introduce the concept)
245
- - **Circle Lead** - Leadership role
246
- - **No role yet** - For \`individual-action\` labeled work (instead of "individual initiative")
247
- - **Agenda items**, **issues**, **opportunities** - Instead of "tensions"
248
- - **Responsibilities** - Can be used alongside "accountabilities"
249
- - **Areas of control** - Can be used alongside "domains"
250
-
251
- When in doubt with \`custom\`, explain concepts in plain language rather than assuming framework knowledge.
252
-
253
- ## Core Concepts
254
-
255
- - **Workspace**: Top-level container - either an organization's anchor circle or a personal workspace
256
- - **Nest**: The universal building block - can be a task, project, role, circle, meeting, or any work item
257
- - **Circle**: A self-governing team with defined purpose, roles, and accountabilities (Holacracy/Sociocracy concept)
258
- - **Role**: A set of responsibilities (accountabilities) and decision rights (domains) that a person energizes
259
- - **Label**: Tags that define what type of nest something is (e.g., "project", "role", "meeting", "anchor-circle"). A nest without system labels is a todo/action — no "todo" label exists or is needed.
46
+ Nestr supports any self-organization approach. When the flavour is clear (check \`workspace.data['self_organisation_type']\`), apply that framework's rules. When unclear, loosely apply Holacracy. Call \`nestr_help({ topic: "workspace-types" })\` for Holacracy/Sociocracy/Custom terminology.
260
47
 
261
48
  ## Content Format
262
49
 
263
- Nestr uses different formats for different fields:
264
-
265
- - **\`title\`**: Plain text only. HTML tags are stripped. Keep titles concise.
266
- - **\`purpose\`**: The aspirational future state this nest is working towards. **Most important for workspaces, circles, and roles** — it defines the north star and context boundary for the organization, circle, or role. Everything within that container should serve its purpose. For other nests (tasks, projects, etc.), prefer \`description\` or \`fields\` for detailed information — but purpose can be set if it serves the user. Supports HTML.
267
- - **\`description\`**: The primary field for detailed information about a nest. Use for project details, task context, acceptance criteria, Definition of Done, and any persistent information about the nest. Supports HTML.
268
- - **\`fields\`**: Structured data defined by labels (e.g., \`fields['project.status']\`, \`fields['metric.frequency']\`). Use for structured, label-specific information.
269
- - **Comment \`body\`**: HTML supported (same tags as above, including base64 images). Supports @mentions using the format \`@{userId|email|circle|everyone}\`: \`@{userId}\` mentions by user ID, \`@{email}\` mentions by any email the user is registered with in Nestr, \`@{circle}\` notifies all role fillers in the nearest ancestor circle, \`@{everyone}\` is available in the UI but not yet via the API. **Use comments for progress updates**, status changes, and conversation — not purpose or description.
270
- - **\`data\`**: Generic key-value store. Also used internally by Nestr and other integrations — **never overwrite or remove existing keys**. When adding your own data, namespace it under \`mcp.\` (e.g., \`{ "mcp.lastSync": "2025-01-01" }\`) to avoid conflicts. Not rendered in UI.
271
-
272
- **Where to put information:**
273
- | Information type | Field to use |
274
- |-----------------|-------------|
275
- | North star / aspirational future state | \`purpose\` (primarily workspaces, circles, roles) |
276
- | Details, context, acceptance criteria, DoD | \`description\` |
277
- | Structured data (status, frequency, etc.) | \`fields\` |
278
- | Progress updates, status changes, discussion | Comments |
279
- | Integration metadata, custom tracking | \`data\` (namespace under \`mcp.\`) |
280
-
281
- **Important — Always use HTML, not Markdown:** When composing purpose, description, or comment content, you must use HTML tags. This is a common mistake for AI agents that default to Markdown syntax.
282
-
283
- | Instead of (Markdown) | Use (HTML) |
284
- |----------------------|------------|
285
- | \`**bold text**\` | \`<b>bold text</b>\` |
286
- | \`*italic text*\` | \`<i>italic text</i>\` |
287
- | \`- list item\` | \`<ul><li>list item</li></ul>\` |
288
- | \`1. numbered item\` | \`<ol><li>numbered item</li></ol>\` |
289
- | \`[link text](url)\` | \`<a href="url">link text</a>\` |
290
- | \`\\n\\n\` (double newline) | \`<br>\` |
291
-
292
- **Example HTML in purpose:**
293
- \`\`\`html
294
- Ensure <b>all customer requests</b> are handled within <i>24 hours</i>. See <a href="https://example.com/sla">SLA policy</a>.
295
- \`\`\`
296
-
297
- ## Nest Model Architecture
298
-
299
- Every nest has these **standard fields**:
300
- - \`_id\` - Unique identifier
301
- - \`title\` - Display name (plain text, HTML stripped)
302
- - \`purpose\` - Why this nest exists, supports HTML (especially important for roles/circles)
303
- - \`description\` - Detailed description (supports HTML)
304
- - \`parentId\` - ID of parent nest
305
- - \`ancestors\` - Array of nest IDs from self to workspace: \`[selfId, parentId, ..., workspaceId]\` (read-only)
306
- - \`path\` - Human-readable breadcrumb: \`"Workspace / Circle / Role / Task"\` (read-only, HTML stripped)
307
- - \`labels\` - Array of label IDs that define what type this nest is
308
- - \`fields\` - Label-specific custom fields (see below)
309
- - \`data\` - Miscellaneous data storage for non-field data (e.g., third-party IDs, integration metadata, custom tracking data)
310
- - \`due\` - Context-dependent date field:
311
- - **Project/Task**: Due date
312
- - **Role**: Re-election date (when the role assignment should be reviewed)
313
- - **Meeting**: Start date/time
314
- - \`completed\` - Whether this item is completed (for tasks/projects/meetings etc.)
315
- - \`users\` - Array of user IDs assigned to this nest
316
- - \`createdAt\`, \`updatedAt\` - Timestamps
317
-
318
- **Read-only fields** (cannot be set via POST/PATCH - API will error):
319
- - \`ancestors\` - Computed from hierarchy
320
- - \`path\` - Computed from ancestor titles
321
-
322
- **Tip:** Use \`path\` to understand context without extra API calls. If you see \`"Acme Corp / Engineering / Developer / Fix bug"\`, you know the task is under the "Developer" role in the "Engineering" circle without fetching those nests.
323
-
324
- ### The \`fields\` Property
325
-
326
- The \`fields\` object holds custom data defined by labels. Fields are **namespaced by the label that defines them**:
327
-
328
- \`\`\`json
329
- {
330
- "fields": {
331
- "project.status": "Current",
332
- "role.electable-role": true,
333
- "metric.frequency": "Weekly",
334
- "circle.strategy": "Focus on enterprise clients"
335
- }
336
- }
337
- \`\`\`
338
-
339
- **Key project statuses** (in \`fields['project.status']\`):
340
- - \`Future\` - Planned but not started
341
- - \`Current\` - Actively being worked on
342
- - \`Waiting\` - Blocked or on hold
343
- - \`Done\` - Completed
50
+ - **title**: Plain text only (HTML stripped)
51
+ - **purpose, description, comments**: Use HTML, NOT Markdown (\`<b>\` not \`**\`, \`<ul><li>\` not \`-\`)
52
+ - **Linking to nests**: \`https://app.nestr.io/n/{nestId}\` (path is \`/n/\`, NOT \`/nest/\`)
344
53
 
345
- **Circle strategy** (in \`fields['circle.strategy']\` for sub-circles, or \`fields['anchor-circle.strategy']\` for the anchor circle/workspace):
346
- A strategy that all roles within the circle must follow. Sub-circle strategies must align with and support the super-circle's strategy.
54
+ ## Role Assignments
347
55
 
348
- **Important:** Label field schemas can be customized at the workspace or circle level. This means the available fields and their options may vary between different parts of the organization hierarchy. Always check what fields are actually present on a nest rather than assuming a fixed schema.
349
-
350
- ### Hierarchical Purpose
351
-
352
- The \`purpose\` field is most important for **workspaces, circles, and roles** — it defines the aspirational future state that container is working towards. It is the north star and context boundary: everything within that container should serve its purpose.
353
-
354
- The \`purpose\` field follows a strict hierarchy:
355
- - The **anchor circle's purpose** is the purpose of the entire organization
356
- - Each **sub-circle's purpose** must contribute to its parent circle's purpose
357
- - Each **role's purpose** must contribute to its circle's purpose
358
-
359
- This cascades through the entire hierarchy, which may be many layers deep. When creating or updating purposes, ensure they align with and serve the parent's purpose.
360
-
361
- **For other nests** (tasks, projects, etc.), prefer \`description\` for details, acceptance criteria, and Definition of Done. Use \`fields\` for structured data. Use comments for progress updates. Purpose can still be set on any nest if it serves the user, but by default reach for description first.
56
+ The \`users\` array on every nest contains the IDs of assigned users. For roles, \`users\` tells you **who fills (energizes) that role**. To find all roles a user fills, search with \`assignee:me label:role\` or \`assignee:{userId} label:role\`. The \`users\` field is always present in API responses, even when using \`stripDescription: true\`.
362
57
 
363
58
  ## Best Practices
364
59
 
365
- 1. **Start by listing workspaces** to get the workspace ID and check if it has the "anchor-circle" label
366
- 2. **Use search** to find specific items rather than browsing through hierarchies
367
- 3. **Check labels** to understand what type of nest you're working with
368
- 4. **Use @mentions** in comments to notify team members: \`@{userId}\`, \`@{email}\`, or \`@{circle}\` for all role fillers
369
- 5. **Respect the hierarchy**: nests live under parents (workspace circle → role/project → task)
370
- 6. **Maintain skills on roles and circles** for AI knowledge persistence:
371
- - Before doing work from a role, check for existing skills under that role or its circle — they contain processes, patterns, and domain knowledge from prior sessions
372
- - When completing work that is likely repeatable, capture it as a skill under the appropriate role or circle
373
- - Skills are the primary mechanism for AI context persistence — they're visible, searchable, and transfer with the role when it's reassigned
374
- - The \`data\` field is shared with Nestr internals and other integrations — never overwrite or remove existing keys. If you must store custom data, namespace under \`mcp.\` (e.g., \`data: { "mcp.lastSync": "..." }\`)
375
-
376
- ## Skills
377
-
378
- Skills are nests with the \`skill\` label that live directly under a role or circle. They represent processes, knowledge, or learned patterns that the role holds and uses when doing its work.
379
-
380
- ### What Skills Are
381
- - A skill is a labeled nest (\`skill\` label) under a role or circle
382
- - Skills make AI-persisted knowledge visible, searchable, and a first-class citizen in Nestr
383
- - They transfer with the role — when a role is reassigned, skills stay with the role, not the previous holder
384
-
385
- ### Skill Types
386
-
387
- Skills can be typed using \`fields['skill.type']\` to distinguish their nature:
388
-
389
- - **\`process\`** — Step-by-step procedures: how to do something. Example: "How to deploy to production", "Customer onboarding checklist".
390
- - **\`knowledge\`** — Domain knowledge, contacts, learned patterns. Example: "Key API endpoints", "Vendor contact list", "Common error patterns".
391
- - **\`doctrine\`** — Organizational principles that guide decisions: the *why* behind how we work. Doctrine skills apply broadly and should be consulted before making decisions that affect the role or circle. Example: "Bias towards minimal output per tension", "Governance before operations".
392
-
393
- When untyped, skills default to general-purpose knowledge. Use the type to help agents and humans find the right skill for the context — e.g., search for doctrine before proposing governance changes.
394
-
395
- ### When to Create Skills
396
- - After completing repeatable work — capture the process so it can be followed again
397
- - When learning domain-specific patterns — record them for future reference
398
- - When discovering key contacts, recurring processes, or domain knowledge relevant to a role
399
- - When decisions are made that should inform future work from this role
400
- - When organizational principles emerge that should guide future decisions (doctrine)
401
-
402
- ### How to Use Skills
403
- - Before starting work from a role, search for skills under that role: \`in:roleId label:skill\`
404
- - Review relevant skills for context, processes, and prior decisions
405
- - Check doctrine skills before proposing governance changes or making decisions
406
- - After completing work, create or update skills to reflect what was learned
407
- - Keep skills focused — one skill per process or knowledge area
408
-
409
- ### Nestr as Context and History
410
- All work in Nestr — projects, tasks, comments, tensions, and skills — forms the complete context and history for a role. Skills complement this by capturing the *how* and *why* alongside the *what*. Together, they ensure continuity whether the role is energized by a human, an AI agent, or transitions between them.
411
-
412
- ## Label Architecture
413
-
414
- Labels give nests meaning and define their behavior. There are three types of labels:
415
-
416
- ### 1. Global Labels (Nestr-defined)
417
- Core labels defined by Nestr that provide foundational structure (e.g., \`role\`, \`circle\`, \`project\`, \`accountability\`). These are available in all workspaces and define the fundamental building blocks of self-organization.
418
-
419
- ### 2. Workspace Labels
420
- Labels created within a workspace for categorizing and organizing nests. These are:
421
- - Only available within that specific workspace
422
- - Visible to all users who have access to the workspace
423
- - Used for workspace-specific categorization (e.g., custom project types, priority levels, departments)
424
-
425
- ### 3. Personal Labels
426
- Labels created by individual users for their own organization:
427
- - Only visible to the user who created them
428
- - Work across all workspaces the user has access to
429
- - Help users maintain personal categorization systems
430
- - Managed via \`nestr_list_personal_labels\` and \`nestr_create_personal_label\` (OAuth only)
431
-
432
- ### Field Schemas and Customization
433
-
434
- Labels define field schemas - the custom fields available on nests with that label. Key points:
435
-
436
- - **Namespacing**: All fields are namespaced by the label that defines them (e.g., \`project.status\`, \`role.electable-role\`, \`metric.frequency\`)
437
- - **Schema inheritance**: Global and workspace labels can be customized within a specific context (e.g., a sub-circle might add or alter fields defined by parent labels)
438
- - **Dynamic schemas**: This is why you may encounter extra fields or fields with different options than expected - sub-contexts can extend the schema
439
- - **Common example**: \`project.status\` often has different options than the default (Future/Current/Waiting/Done). Workspaces frequently customize this with additional statuses like "In Review", "Blocked", "On Hold", etc.
440
-
441
- #### Fetching Field Metadata
442
-
443
- To discover the actual field schema (including available options), add \`fieldsMetaData=true\` to any nest fetch:
444
-
445
- \`\`\`
446
- GET /nests/{nestId}?fieldsMetaData=true
447
- \`\`\`
448
-
449
- This adds a \`fieldsMetaData\` object to the response showing field definitions and options:
450
-
451
- \`\`\`json
452
- {
453
- "_id": "nestId",
454
- "fields": { "project.status": "Current" },
455
- "fieldsMetaData": {
456
- "project.status": {
457
- "type": "select",
458
- "options": ["Future", "Current", "In Review", "Waiting", "Done"]
459
- }
460
- }
461
- }
462
- \`\`\`
463
-
464
- Use this when you need to know what values are valid for a field, especially before updating.
465
-
466
- **Example**: A workspace might customize the global \`project\` label to add a \`project.department\` field, and a sub-circle might further customize it to add \`project.sprint\` - both would appear on projects within that sub-circle.
467
-
468
- #### Hints (Contextual Signals)
469
-
470
- Add \`hints=true\` to \`nestr_get_nest\` or \`nestr_get_nest_children\` to get server-computed contextual signals about each nest. Hints surface actionable information without requiring extra API calls — e.g., unassigned roles, stale projects, or unread comments.
471
-
472
- \`\`\`
473
- GET /nests/{nestId}?hints=true
474
- GET /nests/{nestId}/children?hints=true
475
- \`\`\`
476
-
477
- Each hint object has:
478
- - \`type\` — machine-readable identifier (e.g., \`unassigned_role\`, \`stale_project\`, \`comments\`)
479
- - \`label\` — human/LLM-readable description of the hint
480
- - \`severity\` — \`info\` (neutral context) | \`suggestion\` (improvement opportunity) | \`warning\` (needs attention) | \`alert\` (urgent)
481
- - \`count\` — numeric value where applicable (otherwise absent)
482
- - \`toolCall\` — pre-mapped tool call to drill into the hint: \`{ tool: "nestr_search", params: { workspaceId: "...", query: "..." } }\`. Call the specified tool with the given params to investigate.
483
- - \`lastPost\` — (comments hints only) ISO timestamp of the most recent comment
484
- - \`readAt\` — (comments hints only, user-scoped auth only) ISO timestamp of when the user last read comments. Compare \`lastPost > readAt\` to detect unread comments.
485
-
486
- **Available hint types:**
487
-
488
- | Type | Severity | Applies to | Meaning |
489
- |------|----------|-----------|---------|
490
- | \`open_work\` | info | all | Count of incomplete child work items |
491
- | \`comments\` | info | all | Comment count (check \`lastPost > readAt\` for unread) |
492
- | \`individual_action\` | warning | all | Work not assigned to an organizational role |
493
- | \`stale_work\` | warning | all | No activity in 30+ days |
494
- | \`no_purpose\` | warning | role, circle | Missing purpose statement |
495
- | \`unassigned_role\` | warning | role | No users assigned to energize role |
496
- | \`no_accountabilities\` | warning | role | Role has no accountabilities defined |
497
- | \`skills\` | info | role | Count of skill documents |
498
- | \`no_active_work\` | suggestion | role | Has accountabilities but no active projects |
499
- | \`overloaded_role\` | warning | role | 5+ active concurrent projects |
500
- | \`pending_tensions\` | info | role, circle | Count of unresolved tensions |
501
- | \`election_overdue\` | alert | role | Re-election due date has passed |
502
- | \`election_due_soon\` | warning | role | Re-election due within 30 days |
503
- | \`no_facilitator\` | warning | circle | Facilitator role not assigned |
504
- | \`no_rep_link\` | suggestion | circle | Rep-link role not assigned (non-anchor only) |
505
- | \`stale_governance\` | suggestion | circle | No governance changes in 6+ months |
506
- | \`no_strategy\` | suggestion | circle | Circle missing strategy |
507
- | \`unfilled_roles\` | info | circle | Count of roles with no assigned users |
508
- | \`project_waiting\` | info | project | Blocked with documented reason |
509
- | \`project_waiting_no_reason\` | warning | project | Waiting without documented reason |
510
- | \`project_no_breakdown\` | suggestion | project | Active project with no task breakdown |
511
- | \`project_no_acceptance_criteria\` | suggestion | project | Missing description/acceptance criteria |
512
- | \`project_overdue\` | warning | project | Past due date |
513
- | \`no_proposed_output\` | suggestion | tension | Tension has no proposed output yet |
514
-
515
- Example response with hints:
516
- \`\`\`json
517
- {
518
- "_id": "roleId",
519
- "title": "Developer",
520
- "hints": [
521
- {
522
- "type": "unassigned_role",
523
- "label": "This role has no users assigned to energize it...",
524
- "severity": "warning",
525
- "toolCall": { "tool": "nestr_get_nest", "params": { "nestId": "roleId" } }
526
- },
527
- {
528
- "type": "no_active_work",
529
- "label": "Role has accountabilities but no active projects",
530
- "severity": "suggestion",
531
- "toolCall": { "tool": "nestr_search", "params": { "workspaceId": "wsId", "query": "in:roleId label:project completed:false" } }
532
- }
533
- ]
534
- }
535
- \`\`\`
536
-
537
- Use hints to proactively surface issues to the user — for example, when reviewing a circle's roles, hints can reveal which roles need attention without separate queries. Use the \`toolCall\` to drill into any hint directly.
538
-
539
- ## Important Labels
540
-
541
- Labels define what type a nest is. The API strips the "circleplus-" prefix, so use labels without it.
542
-
543
- **Governance Structure:**
544
- - \`anchor-circle\` - The workspace itself when it's an organization
545
- - \`circle\` - A sub-circle/team within the organization
546
- - \`role\` - A role with accountabilities and domains
547
- - \`accountability\` - An ongoing activity the role is responsible for performing (Holacracy: "an ongoing activity that the Role will enact")
548
- - \`domain\` - An area the role has exclusive control over; others must get permission to impact it (Holacracy: "something the Role may exclusively control on behalf of the Organization")
549
- - \`policy\` - A grant or restriction of authority affecting how others interact with a domain or process. Can live on a domain, role, or circle directly.
550
-
551
- **Note:** Accountabilities, domains, and policies are child-nests of roles/circles. Use \`nestr_get_circle_roles\` or \`nestr_get_nest_children\` to retrieve them. The generic \`nestr_search\` won't return them by default.
552
-
553
- **Meetings & Operations:**
554
- - \`metric\` - A metric tracked by a role/circle
555
- - \`checklist\` - A recurring checklist item
556
- - \`governance\` - Combined with \`meeting\` label to create a governance meeting (processes governance tensions/proposals)
557
- - \`circle-meeting\` - Combined with \`meeting\` label to create a circle/tactical meeting (processes operational tensions — projects, todos, inter-role requests)
558
-
559
- **Creating meetings:** A meeting is a nest with \`labels: ["meeting", "governance"]\` or \`labels: ["meeting", "circle-meeting"]\`. Set \`due\` to the meeting start time. Assign all role fillers in the circle to the meeting's \`users\` array — this includes people/agents energizing roles in the circle, plus rep-link and circle-lead roles from sub-circles. Use graph tools (\`nestr_add_graph_link\` with relation \`meeting\`) to link tensions as agenda items. Agenda items that don't originate from a specific role can be created as child nests of the meeting directly.
560
-
561
- **OKRs & Goals:**
562
- - \`goal\` - An Objective (the O in OKR)
563
- - \`result\` - A Key Result (the KR in OKR)
564
-
565
- **Work Tracking:**
566
- - \`project\` - An outcome requiring multiple steps to complete. Define in past tense as what "done" looks like (e.g., "Website redesign launched", "Q1 report published"). Has status: Future/Current/Waiting/Done.
567
- - *(no system label)* - **Every nest is completable by default.** A nest without system labels is a todo/action — a single, concrete step that can be done in one sitting (e.g., "Call supplier about pricing", "Draft intro paragraph"). To create a todo, simply create a nest without labels. There is NO "todo" label — do NOT add \`labels: ["todo"]\`. Labels change behavior (e.g., \`project\` adds status tracking), but the default nest is already a completable work item. Todos CAN have workspace or personal labels for categorization — what makes them todos is the absence of *system* labels.
568
-
569
- **AI Knowledge:**
570
- - \`skill\` - A process, piece of knowledge, or learned pattern that a role or circle holds. Lives directly under a role or circle. Used by AI agents to persist and retrieve operational knowledge across sessions. When doing work that is likely to be repeated, capture it as a skill for future reference.
571
-
572
- **System Labels** (define structure, not categorization):
573
- \`circle\`, \`anchor-circle\`, \`role\`, \`policy\`, \`domain\`, \`accountability\`, \`project\`, \`tension\`, \`skill\`, \`goal\`, \`result\`, \`contact\`, \`deal\`, \`organisation\`, \`metric\`, \`checklist\`, \`meeting\`, \`feedback\`
574
- - \`note\` - A simple note
575
- - \`meeting\` - A calendar meeting
576
- - \`tension\` - The fundamental unit of organizational communication — a gap between current reality and potential. Used for inter-role communication, meeting agenda items, governance proposals, and general tension processing. Supports \`fields['tension.feeling']\` and \`fields['tension.needs']\` for separating personal context from organizational response. Use the dedicated tension tools (\`nestr_create_tension\`, \`nestr_list_my_tensions\`, etc.) to create and manage tensions.
577
-
578
- ## Search Query Syntax
579
-
580
- The \`nestr_search\` tool supports powerful query operators. Combine multiple operators with spaces (AND logic) or use commas within an operator (OR logic).
581
-
582
- ### Common Search Operators
583
-
584
- | Operator | Example | Description |
585
- |----------|---------|-------------|
586
- | \`label:\` | \`label:role\` | Filter by label type |
587
- | \`label:!\` | \`label:!project\` | Exclude label |
588
- | \`parent-label:\` | \`parent-label:circle\` | Filter items whose parent has a specific label |
589
- | \`assignee:\` | \`assignee:me\` | Filter by assignee (use \`me\` for current user, \`none\` for unassigned) |
590
- | \`assignee:\` | \`assignee:userId\` | Filter by specific user ID |
591
- | \`assignee:!\` | \`assignee:!userId\` | Exclude items assigned to specific user |
592
- | \`admin:\` | \`admin:me\` | Filter by admin user (same syntax as assignee) |
593
- | \`createdby:\` | \`createdby:me\` | Filter by creator |
594
- | \`completed:\` | \`completed:false\` | Filter by completion status |
595
- | \`type:\` | \`type:comment\` | Filter by nest type (e.g., \`comment\`, \`nest\` for untyped items) |
596
- | \`has:\` | \`has:due\` | Items with a property (see has: values below) |
597
- | \`depth:\` | \`depth:1\` | Limit search depth (1 = direct children only) |
598
- | \`mindepth:\` | \`mindepth:2\` | Minimum depth from search context |
599
- | \`limit:\` | \`limit:10\` | Limit number of results |
600
-
601
- ### The \`has:\` Operator
602
-
603
- The \`has:\` operator checks for property existence. Supports \`!\` prefix for negation (e.g., \`has:!due\`).
604
-
605
- **Available values:**
606
- - \`has:due\` - Items with a due date set
607
- - \`has:pastdue\` - Items with overdue due dates
608
- - \`has:children\` - Items that have children
609
- - \`has:incompletechildren\` - Items with incomplete children
610
- - \`has:parent\` - Items that have a parent
611
- - \`has:color\` - Items with a color set
612
- - \`has:icon\` - Items with an icon set
613
- - \`has:tabs\` - Items with tabs configured
614
- - \`has:header\` - Items with a header
615
-
616
- ### Field Value Search
617
-
618
- Search by label-specific field values using \`label->field:value\`:
619
- - \`project->status:Current\` - Projects with status "Current"
620
- - \`project->status:Current,Future\` - Status is Current OR Future
621
- - \`project->status:!Done\` - Status is NOT Done
622
-
623
- ### Search Examples
624
-
625
- \`\`\`
626
- label:role
627
- -> Find all roles
628
-
629
- label:project assignee:me completed:false
630
- -> My incomplete projects
631
-
632
- label:project project->status:Current
633
- -> Projects with status "Current"
634
-
635
- label:circle depth:1
636
- -> Direct sub-circles only
637
-
638
- has:due completed:false
639
- -> Incomplete items with due dates
640
-
641
- label:meeting has:!completed
642
- -> Meetings not yet completed
643
-
644
- label:policy spending
645
- -> Policies mentioning spending
646
-
647
- label:policy budget cost expense
648
- -> Policies about budgets, costs, or expenses
649
-
650
- label:accountability customer
651
- -> Accountabilities related to customers
652
- \`\`\`
653
-
654
- ### Data and Field Property Search
655
-
656
- Every nest has a \`fields\` object containing label-specific properties (e.g., a "project" label adds \`fields.project.status\`, \`fields.project.priority\`, etc.). You can search on any of these field values. Use \`nestr_get_nest\` with \`fieldsMetaData=true\` to discover available fields and their options for a given label.
657
-
658
- - \`data.{property}:value\` - Search by data property (e.g., \`data.externalId:123\`)
659
- - \`fields.{label}.{property}:value\` - Search by field value from the nest's \`fields\` object (supports partial match, e.g., \`fields.project.status:Current\`)
660
-
661
- Both support multiple values (comma-separated for OR logic) and \`!\` prefix for negation.
662
-
663
- Examples:
664
- \`\`\`
665
- fields.project.status:Current
666
- -> Projects with status "Current"
667
-
668
- fields.project.status:Current,Future
669
- -> Projects with status "Current" OR "Future"
670
-
671
- fields.project.status:!Done
672
- -> Projects NOT marked as "Done"
673
- \`\`\`
674
-
675
- ### Template Operators
676
-
677
- - \`template:templateId\` - Items created from a specific template
678
- - \`child-from-template:templateId\` - Children derived from a specific template
679
-
680
- Both support \`!\` prefix for negation.
681
-
682
- ### Additional Operators
683
-
684
- - \`deleted:true\` - Include deleted items (hidden by default)
685
- - \`linkeditems:true\` - Items linked to the current context
686
-
687
- ### Sorting Results
688
-
689
- Use \`sort:\` to specify the sort field and \`sort-order:\` to set direction.
690
-
691
- **Sort fields:**
692
- - \`sort:searchOrder\` - Manual/custom ordering (default for work items like tasks, projects)
693
- - \`sort:title\` - Alphabetical by title (default for roles, circles)
694
- - \`sort:createdAt\` - By creation date
695
- - \`sort:updatedAt\` - By last update date
696
- - \`sort:due\` - By due date
697
- - \`sort:completedAt\` - By completion date
698
-
699
- **Sort order:**
700
- - \`sort-order:asc\` - Ascending (default)
701
- - \`sort-order:desc\` - Descending
702
-
703
- **Defaults:**
704
- - Roles and circles: \`sort:title\` (alphabetical)
705
- - Work items (tasks, projects): \`sort:searchOrder\` (manual ordering set by users)
706
-
707
- **Examples:**
708
- \`\`\`
709
- label:project sort:due sort-order:asc
710
- -> Projects ordered by due date (soonest first)
711
-
712
- label:role sort:title
713
- -> Roles alphabetically (this is the default)
714
-
715
- assignee:me completed:false sort:updatedAt sort-order:desc
716
- -> My active work, most recently touched first
717
-
718
- label:project completed:this_month sort:completedAt sort-order:desc
719
- -> Recently completed projects
720
- \`\`\`
721
-
722
- ### Scoping Search to a Specific Nest
723
-
724
- Use \`in:nestId\` to limit search results to only items within a specific nest (its descendants at any depth).
725
-
726
- **Combine with \`depth:\` to control how deep to search:**
727
- - \`depth:1\` - Direct children only
728
- - \`depth:2\` - Children and grandchildren
729
- - \`depth:N\` - Up to N levels deep
730
-
731
- **Examples:**
732
- \`\`\`
733
- in:circleId label:role depth:1
734
- -> Roles directly in a circle (excludes roles in sub-circles)
735
-
736
- in:circleId label:project depth:2
737
- -> Projects in circle + under direct roles + under direct sub-circles
738
-
739
- in:circleId label:role
740
- -> ALL roles in circle including those in nested sub-circles
741
-
742
- in:projectId completed:false
743
- -> Incomplete tasks within a specific project
744
-
745
- in:roleId label:project project->status:Current
746
- -> Current projects owned by a specific role
747
- \`\`\`
748
-
749
- **Common patterns:**
750
- - Roles in a circle only (not sub-circles): \`in:circleId label:role depth:1\`
751
- - All work in a circle: \`in:circleId completed:false\` (includes all nested items)
752
- - Direct tasks under a project: \`in:projectId depth:1 completed:false\`
753
-
754
- ### Filtering by Completion Status
755
-
756
- **Important:** When fetching work items (tasks, projects), always use \`completed:false\` unless you specifically need completed items. This avoids cluttering results with old completed work.
757
-
758
- The \`completed:\` operator accepts:
759
- - \`completed:false\` - Only uncompleted items (recommended default for work queries)
760
- - \`completed:true\` - Only completed items
761
- - Presets: \`completed:past_7_days\`, \`completed:this_month\`, \`completed:last_quarter\`, etc.
762
- - Custom date range: \`completed:2024-01-01_2024-03-31\` (format: \`YYYY-MM-DD_YYYY-MM-DD\`)
763
-
764
- **Examples:**
765
- \`\`\`
766
- assignee:me completed:false
767
- -> My active/uncompleted work (recommended)
768
-
769
- label:project completed:false project->status:Current
770
- -> Active projects that are in progress
771
-
772
- completed:past_7_days
773
- -> Items completed in the last week (for reviews/reports)
774
-
775
- label:project completed:this_quarter
776
- -> Projects completed this quarter
777
- \`\`\`
778
-
779
- ### Finding Recently Updated Items
780
-
781
- Use \`updated-date:\` to find items modified within a time period. Useful for finding recent activity or stale items.
782
-
783
- **Important:** This uses \`treeUpdatedAt\`, which updates when the nest itself OR any of its descendants (children, grandchildren, etc.) are modified. For example, a project will match \`updated-date:past_7_days\` if any task under it was updated, even if the project itself wasn't touched.
784
-
785
- **Preset values:**
786
- - \`updated-date:past_7_days\` - Last 7 days
787
- - \`updated-date:past_30_days\` - Last 30 days
788
- - \`updated-date:past_12_months\` - Last 12 months
789
- - \`updated-date:this_month\` - This calendar month
790
- - \`updated-date:last_month\` - Last calendar month
791
- - \`updated-date:this_quarter\` - This quarter
792
- - \`updated-date:last_quarter\` - Last quarter
793
- - \`updated-date:this_year\` - This calendar year
794
- - \`updated-date:last_year\` - Last calendar year
795
-
796
- **Custom date range:** \`updated-date:2024-01-01_2024-03-31\` (format: \`YYYY-MM-DD_YYYY-MM-DD\`)
797
-
798
- **Invert with \`!\`:** \`updated-date:!past_30_days\` finds items NOT updated recently (stale items)
799
-
800
- **Examples:**
801
- \`\`\`
802
- label:project updated-date:past_7_days
803
- -> Projects updated this week
804
-
805
- assignee:me updated-date:!past_30_days
806
- -> My stale tasks (no activity in 30+ days)
807
-
808
- label:role updated-date:this_quarter
809
- -> Roles with governance changes this quarter
810
- \`\`\`
811
-
812
- ## Linking to the Web App
813
-
814
- When sharing results with users, provide clickable links to the Nestr web app.
815
-
816
- **Base URL:** \`https://app.nestr.io\`
817
-
818
- ### Link Formats
819
-
820
- | Format | Example | Use Case |
821
- |--------|---------|----------|
822
- | \`/n/{nestId}\` | \`/n/abc123\` | Direct link to any nest |
823
- | \`/n/{nestId}/{childId}\` | \`/n/circleId/roleId\` | Show child in context (opens detail pane on desktop) |
824
- | \`/n/{workspaceId}?s=1#hash\` | \`/n/wsId?s=1#users\` | Workspace admin settings |
825
-
826
- ### Context Links (Detail Pane)
827
-
828
- Use the two-ID format to show items in context:
829
- - \`/n/{circleId}/{roleId}\` - Role within its circle
830
- - \`/n/{roleId}/{projectId}\` - Project owned by a role
831
- - \`/n/{projectId}/{taskId}\` - Task within its project
832
-
833
- ### Cross-Workspace Views
834
-
835
- These pages show items across all workspaces for the current user:
836
- - \`/roles\` - All roles this user fills
837
- - \`/projects\` - All projects assigned to this user
838
-
839
- ### User Profile
840
-
841
- View a user's roles within a specific workspace:
842
- - \`/profile/{userId}?cId={workspaceId}\` - User's roles in that workspace
843
-
844
- This works for viewing colleagues too - replace userId to see what roles they fill in the same workspace.
845
-
846
- ### Admin Settings Hashes
847
-
848
- For workspace admins, link to settings with \`/n/{workspaceId}?s=1\` plus:
849
- - \`#users\` - Team members
850
- - \`#labels\` - Label configuration
851
- - \`#workspace-apps\` - Enabled apps/features
852
- - \`#plan\` - Subscription plan
853
-
854
- ## Inbox (Quick Capture)
855
-
856
- The inbox is **personal** — it belongs to the user, not to any workspace or role. It holds raw, unprocessed "stuff": sensed tensions, fleeting ideas, half-formed thoughts, and captured items that haven't yet been differentiated into role work or personal projects. Items in the inbox can end up anywhere — in any of the user's workspaces, under any role, or as personal tasks outside of organizational context.
857
-
858
- Because the inbox is personal and OAuth-scoped, it can span multiple workspaces (if the token has cross-workspace scope). This makes it the natural entry point for anything the user senses but hasn't yet placed.
859
-
860
- Use it for:
861
- - Quick capture of sensed tensions before deciding where they belong
862
- - Collecting items that need clarification before becoming role work or personal projects
863
- - Temporary holding area before organizing into the proper workspace, circle, or role
864
-
865
- **Note:** Inbox tools require OAuth authentication (user-scoped token). They won't work with workspace API keys.
866
-
867
- ### Inbox Zero Goal
868
-
869
- The goal is to **empty the inbox at least once a week**. An overflowing inbox creates mental clutter and risks losing important items.
870
-
871
- **In assistant mode:** Support the user in processing their inbox into the right contexts — role work in the appropriate workspace, or personal projects outside organizational scope. When you notice items, gently remind them: "You have X items in your inbox. Would you like to process them?" During slower moments or at the end of a session, offer to help clear it.
872
-
873
- **In role-filler mode:** Process your inbox autonomously. Capture incoming items, triage at regular intervals, and move items to the appropriate role/project without prompting. Treat inbox processing as part of your operational rhythm.
874
-
875
- Processing doesn't mean doing everything — it means deciding what each item is and where it belongs.
876
-
877
- ### Inbox Workflow
878
-
879
- 1. **Capture**: Use \`nestr_create_inbox_item\` to quickly add items without organizing
880
- 2. **Review**: Use \`nestr_list_inbox\` to see items needing processing
881
- 3. **Process**: For each item, decide:
882
- - **Delete**: If not needed, mark \`completed: true\`
883
- - **Do it**: If quick (<2 min), do it now and mark complete
884
- - **Organize**: Move to appropriate location with \`nestr_update_nest\` by setting \`parentId\`
885
-
886
- ### Moving Items Out of Inbox
887
-
888
- To clarify/organize an inbox item, use \`nestr_update_nest\` to update it in place. You can change any properties in a single call:
889
-
890
- \`\`\`json
891
- {
892
- "nestId": "inboxItemId",
893
- "parentId": "roleOrCircleOrProjectId",
894
- "labels": ["project"],
895
- "users": ["userId"],
896
- "fields": { "project.status": "Current" },
897
- "due": "2024-02-15T00:00:00Z"
898
- }
899
- \`\`\`
900
-
901
- This moves the item from inbox to the specified location. The \`parentId\` is typically a role, circle, or project (the most common destinations). Add the \`project\` label to convert it into a project, or leave labels empty for a simple action/todo.
902
-
903
- **Important:** When processing inbox items, prefer updating existing items using \`nestr_update_nest\` rather than creating new items. This preserves the original item's history, comments, and metadata.
904
-
905
- ### Reordering Inbox Items
906
-
907
- Use \`nestr_reorder_inbox\` to reorder inbox items (requires OAuth):
908
-
909
- \`\`\`json
910
- {
911
- "nestIds": ["item3Id", "item1Id", "item2Id"]
912
- }
913
- \`\`\`
914
-
915
- This sets the display order to: item3, item1, item2. The order is preserved when viewing the inbox in the web app.
916
-
917
- For single-item repositioning, use \`nestr_reorder_nest\` to place an item before or after another:
918
-
919
- \`\`\`json
920
- {
921
- "nestId": "itemToMoveId",
922
- "position": "before",
923
- "relatedNestId": "targetItemId"
924
- }
925
- \`\`\`
926
-
927
- ## Daily Plan (Focus for Today)
928
-
929
- The daily plan is **personal** — it is the user's plan for the day across all their contexts. It can include role work from any workspace, personal projects, family errands, or anything else they want to focus on today. It pulls items from across all workspaces in scope (if the token has cross-workspace scope) and is not tied to any single organizational context.
930
-
931
- Items are added to the daily plan using \`nestr_add_to_daily_plan\` and removed using \`nestr_remove_from_daily_plan\`.
932
-
933
- **Note:** Daily plan tools require OAuth authentication (user-scoped token). They won't work with workspace API keys.
934
-
935
- ### How the Daily Plan Works
936
-
937
- - **Adding items**: Use \`nestr_add_to_daily_plan\` with an array of nest IDs
938
- - **Removing items**: Use \`nestr_remove_from_daily_plan\` with an array of nest IDs
939
- - **Viewing**: Use \`nestr_get_daily_plan\` to see all items marked for today
940
- - **Completed items included**: The daily plan includes items completed today, so users can see what they accomplished at the end of the day
941
-
942
- ### Scope Limitations
943
-
944
- The daily plan only includes items from:
945
- - The user's inbox
946
- - Workspaces/nests that are in scope for the current token
947
-
948
- **Important:** Through the MCP, users may see fewer items than in the Nestr UI if the token has a limited scope (e.g., scoped to a specific workspace). If users report missing items, this is likely the cause.
949
-
950
- ### Supporting Daily Planning
951
-
952
- **In assistant mode**, help the user build and work through their daily plan — this is their personal focus list spanning role work, personal projects, and anything else they've chosen for today:
953
-
954
- 1. **Morning planning**: Offer to review their daily plan
955
- - "Would you like to see what's on your daily plan for today?"
956
- - If empty: "Your daily plan is empty. Would you like to add some items to focus on today?"
957
-
958
- 2. **Building the plan**: Help select items for today
959
- - Review active projects and tasks (\`assignee:me completed:false\`)
960
- - Suggest high-priority or overdue items
961
- - Add selected items using \`nestr_add_to_daily_plan\`
962
-
963
- 3. **During the day**: Check in on progress and adjust as priorities change
964
-
965
- 4. **End of day**: Review what was accomplished — the daily plan includes today's completed items
966
-
967
- **In role-filler mode**, manage your own daily plan:
968
-
969
- 1. At session start, review your daily plan, pending tensions, and notifications
970
- 2. Prioritize based on due dates, role accountabilities, pending tensions, and notifications from other roles
971
- 3. Execute autonomously — mark items complete as you go
972
- 4. At session end, clear completed items and queue tomorrow's priorities
973
-
974
- ### Example Workflows
975
-
976
- **Assistant mode:**
977
- \`\`\`
978
- User: "What should I work on today?"
979
-
980
- 1. Fetch daily plan: nestr_get_daily_plan
981
- 2. If items exist: Show them and ask which to start with
982
- 3. If empty: Search for active work (assignee:me completed:false)
983
- 4. Help user add selected items to daily plan
984
- \`\`\`
985
-
986
- **Role-filler mode:**
987
- \`\`\`
988
- 1. Fetch daily plan: nestr_get_daily_plan
989
- 2. Check tensions: nestr_list_my_tensions, nestr_list_tensions_awaiting_consent
990
- 3. Check notifications: nestr_list_notifications
991
- 4. Prioritize: urgent tensions first, then notifications, then daily plan items, then backlog
992
- 5. Execute work, processing tensions and completing tasks
993
- \`\`\`
994
-
995
- ## Notifications (What Changed)
996
-
997
- Notifications surface relevant changes that happened in the organization — work completed, governance updated, mentions, reactions, and more. They complement tensions (which are forward-looking requests for change) by showing what has already changed that might need your attention.
998
-
999
- Think of notifications as the "what happened" signal: someone completed a project under your circle, a governance proposal was accepted, a colleague mentioned you in a comment, or a role's accountabilities changed. Reviewing notifications helps you stay aware of the evolving state of the organization without having to manually check every circle and role.
1000
-
1001
- ### Notification Types
1002
-
1003
- Notifications are split into two types based on urgency:
1004
-
1005
- - **\`me\` (direct)** — Things directed at you personally: mentions, replies to your comments, reactions to your posts, and direct messages. These typically need prompt attention.
1006
- - **\`relevant\` (delayed)** — Changes in areas you're involved in: project updates, task completions, governance changes in your circles. These are informational — review them to stay current, but they rarely need immediate action.
1007
-
1008
- Use \`type\` to filter: \`nestr_list_notifications({ type: "me" })\` for direct notifications only, or \`type: "relevant"\` for organizational changes.
1009
-
1010
- ### Notification Groups
1011
-
1012
- For more granular filtering, use the \`group\` parameter:
1013
- - **\`mentions\`** — Someone @mentioned you
1014
- - **\`replies\`** — Someone replied to your comment
1015
- - **\`direct_message\`** — You received a direct message
1016
- - **\`reactions\`** — Someone reacted to your post
1017
- - **\`updates\`** — Operational changes (tasks completed, projects updated, etc.)
1018
- - **\`governance\`** — Governance changes (roles created/modified, proposals accepted, etc.)
1019
-
1020
- ### When to Check Notifications
1021
-
1022
- Check notifications at the same natural breakpoints as tensions and inbox:
1023
-
1024
- - **Session start** — Use \`nestr_list_notifications\` to see what changed since last session
1025
- - **After completing work** — Check if your changes triggered responses or follow-up from others
1026
- - **When the user asks what happened** — Notifications are the answer to "what changed?" or "what did I miss?"
1027
-
1028
- **In assistant mode:** When the user asks what's new or what they missed, fetch notifications and summarize the key changes. Group them by type (direct vs. relevant) and highlight anything that might need action. Offer to mark all as read once reviewed.
1029
-
1030
- **In role-filler mode:** Check notifications proactively at session start. Direct notifications (\`type: "me"\`) may require a response — a mention might be a question, a reply might need follow-up. Relevant notifications (\`type: "relevant"\`) inform your situational awareness — a governance change might affect your role's accountabilities, a completed project might unblock your work.
1031
-
1032
- ### Marking Notifications as Read
1033
-
1034
- Once notifications have been reviewed, use \`nestr_mark_notifications_read\` to clear them. This marks all unread notifications as read. In assistant mode, confirm with the user before marking. In role-filler mode, mark as read after processing.
1035
-
1036
- **Note:** Notification tools require OAuth authentication. They are not available in workspace mode.
1037
-
1038
- ## Insights (Organizational Health & Trends)
1039
-
1040
- Nestr tracks self-organization and team health metrics that reveal how well the organization is functioning. When users ask about trends, patterns, or the health of their organization, circles, or teams — check if insights can help answer their question.
1041
-
1042
- **Prerequisite:** The Insights app must be enabled on the workspace. Use \`nestr_get_workspace_apps\` to check. If not enabled, the insights endpoints will return an error.
1043
-
1044
- ### Available Metrics
1045
-
1046
- Use \`nestr_get_insights\` to discover what metrics are available. Metrics include things like:
1047
- - **Role awareness** — how well people use their roles
1048
- - **Governance participation** — how actively the team evolves its structure
1049
- - **Circle meeting output** — how productive tactical meetings are
1050
- - **Task completion rates**, overdue items, and activity stats
1051
-
1052
- Each metric includes a \`currentValue\` and a \`compareValue\` (previous period) so you can immediately show whether things are improving or declining.
1053
-
1054
- ### Answering Trend Questions
1055
-
1056
- When a user asks about trends or patterns (e.g., "Are we getting better at governance?", "How active has the team been?", "What's our completion rate trend?"):
1057
-
1058
- 1. **Discover metrics**: Call \`nestr_get_insights\` to see what's available
1059
- 2. **Compare periods**: The \`currentValue\` vs \`compareValue\` on each metric already shows recent direction. Use \`endDate\` to compare different time periods.
1060
- 3. **Dive into history**: Use \`nestr_get_insight_history\` with \`from\`/\`to\` dates to get detailed historical data points for a specific metric — this reveals the full trend over time.
1061
- 4. **Single metric detail**: Use \`nestr_get_insight\` to get the current state of one specific metric.
1062
-
1063
- ### Plan Restrictions
1064
-
1065
- - **All plans**: Workspace-level insights (aggregated across the whole organization)
1066
- - **Pro plan only**: Circle-level insights (\`nestId\` parameter) and user-level insights (\`userId\` parameter). If the workspace is not on a Pro plan, these filters will return a 402 error.
1067
- - \`userId\` and \`nestId\` cannot be combined — user metrics are always workspace-level.
1068
-
1069
- ## MCP Apps (Interactive UI)
1070
-
1071
- Nestr provides interactive UI components that can be embedded in MCP clients that support the \`ui://\` resource protocol.
1072
-
1073
- ### Completable List App
1074
-
1075
- **Resource URI:** \`ui://nestr/completable-list\`
1076
-
1077
- An interactive list for displaying and managing completable items (tasks and projects). The app lets users check off, edit, reorder, and manage items directly.
1078
-
1079
- #### When to Use
1080
-
1081
- **Default to text output. Only use this app when you are certain the results are completable items.**
1082
-
1083
- The decision to use the app must be made AFTER you have fetched the data and confirmed the results contain completable items. Do not decide to use the app before seeing what the data looks like.
1084
-
1085
- Only use the completable list app when **ALL** of these conditions are met:
1086
- 1. The user **explicitly asks to see or manage a list** as the primary goal of their request
1087
- 2. You have **already fetched the results** and confirmed they are **completable items** — tasks, projects, todos, or inbox items
1088
- 3. The results are **not empty** — there must be at least one item to display
1089
-
1090
- Examples where you SHOULD use the app:
1091
- - "Show me my daily plan" / "What's in my inbox?"
1092
- - "List my projects" / "Show tasks under this role"
1093
- - "What do I need to work on?"
1094
-
1095
- #### When NOT to Use
1096
-
1097
- Do NOT use the app when:
1098
- - **The results are not completable items.** Roles, circles, metrics, policies, accountabilities, domains, and any other structural or governance nests must NEVER be shown in the completable list app. Always respond in text for these. A list of roles should be printed as text, never rendered in the app.
1099
- - **The search returns no results.** Never render an empty completable list — just tell the user no items were found.
1100
- - **The results are mixed types.** If a search returns a mix of completable and non-completable items (e.g., roles and tasks), respond in text.
1101
- - **Searching as part of processing a larger request** (e.g., finding roles to determine where work belongs, looking up a project to add a task to it, gathering context for a question). In these cases, just use the search results internally and respond in text.
1102
- - **The user asked a question**, not for a list (e.g., "What's the status of project X?" — answer in text, don't show a list with one item).
1103
- - **You are in the middle of a multi-step workflow** and the search is an intermediate step, not the final output.
1104
-
1105
- **Important:** When the tool result does feed the app, do NOT also list the items as text in your response. Simply confirm the action (e.g., "Here's your inbox" or "Here's your daily plan") and let the app handle the display. Users can ask to see items as text if they prefer.
1106
-
1107
- #### Data Format
1108
-
1109
- The tool response includes \`title\`, \`source\`, and \`items\`. The \`title\` is a descriptive label for the list. The \`source\` tells the app which reorder API to use (inbox items use a different endpoint than regular nests).
1110
-
1111
- **Fields:**
1112
- - \`title\` - Header title for the list. **Always pass \`_listTitle\` when calling these tools** to set a short, descriptive title (2-5 words) that tells the user what they're looking at. Examples by context:
1113
- - **Children**: "Tasks for [parent name]" (e.g., "Tasks for Website Redesign")
1114
- - **Search**: Describe WHAT is shown, not the query (e.g., "Marketing projects", "Overdue tasks", "Urgent work")
1115
- - **Projects**: "[Context] projects" (e.g., "Engineering projects", "All active projects")
1116
- - **Inbox**: "Inbox" or "Inbox (N items)"
1117
- - **Daily plan**: "Today's focus" or "Daily plan"
1118
- - \`source\` - Context identifier: \`inbox\`, \`daily-plan\`, \`children\`, \`projects\`, or \`search\`. Used by the app to route reorder actions correctly
1119
- - \`items\` - Array of nests to display
1120
- - \`_id\` - Required for all interactions
1121
- - \`title\` - Display text (editable in UI)
1122
- - \`description\` - HTML content (editable via rich text editor)
1123
- - \`path\` - Shows the parent context below the title
1124
- - \`labels\` - Determines icon: \`project\` label shows cube icon, others show checkbox
1125
- - \`completed\` - Completion state
1126
-
1127
- #### UI Features
1128
-
1129
- The app provides:
1130
- - **Completion toggle**: Click checkbox/icon to complete/uncomplete (calls \`nestr_update_nest\`)
1131
- - **Title editing**: Click title to edit inline (calls \`nestr_update_nest\`)
1132
- - **Description editing**: Click document icon to open rich text editor with bold, italic, lists (calls \`nestr_update_nest\`)
1133
- - **Due date**: Click calendar icon to set/change due date (calls \`nestr_update_nest\`)
1134
- - **Drag-drop reordering**: Drag items to reorder (calls \`nestr_reorder_nest\` for regular nests, \`nestr_reorder_inbox_item\` for inbox items)
1135
- - **Quick link**: Opens item in Nestr web app
1136
- - **Refresh button**: User can request fresh data
1137
-
1138
- #### Keeping the App in Sync
1139
-
1140
- The app displays a snapshot of data. To keep it current:
1141
-
1142
- 1. **After agent makes changes**: When the agent creates, updates, or deletes items that affect what's displayed (e.g., adding an inbox item while viewing the inbox), re-fetch and send updated data to the app.
1143
-
1144
- 2. **User clicks refresh**: The app sends a \`context/update\` message with \`{ action: 'refresh' }\`. Re-fetch the data using the same query and send it back via \`notifications/toolResult\`.
1145
-
1146
- 3. **User interactions**: Changes made through the app UI (checking items, editing) are handled automatically - no refresh needed for those.
1147
-
1148
- Example: User is viewing their inbox and says "Add a reminder to call John"
1149
- 1. Agent calls \`nestr_create_inbox_item\` to add the item
1150
- 2. Agent re-fetches inbox with \`nestr_list_inbox\`
1151
- 3. Agent sends updated data to the app so the new item appears
1152
-
1153
- #### Example Usage
1154
-
1155
- **Daily Plan:**
1156
- \`\`\`
1157
- User: "Show me my daily plan"
1158
-
1159
- 1. Fetch daily plan: nestr_get_daily_plan
1160
- 2. Return the app resource with data:
1161
- {
1162
- "title": "Daily Plan",
1163
- "items": [/* nests from daily plan */]
1164
- }
1165
- 3. User can interact: check off items, edit titles, reorder
1166
- 4. App calls tools automatically - changes sync to Nestr
1167
- \`\`\`
1168
-
1169
- **Tasks in a Project:**
1170
- \`\`\`
1171
- User: "Show me the tasks in the Website Redesign project"
1172
-
1173
- 1. Search for the project: nestr_search with "Website Redesign label:project"
1174
- 2. Get project children: nestr_get_nest_children with projectId, completed:false
1175
- 3. Return the app resource with data:
1176
- {
1177
- "title": "Website Redesign",
1178
- "items": [/* child tasks from the project */]
1179
- }
1180
- 4. User can check off tasks as they complete them, reorder priorities
1181
- \`\`\`
1182
-
1183
- ## Common Workflows
1184
-
1185
- - **Task Management**: Create nests (no label needed for basic todos), update completed status, add comments for updates
1186
- - **Project Tracking**: List projects, get children to see tasks, check insights for metrics
1187
- - **Team Structure**: List circles to see teams, get roles to understand accountabilities and domains
1188
- - **Finding Accountabilities/Domains**: Use \`nestr_get_circle_roles\` for a circle's roles with their accountabilities, or \`nestr_get_nest_children\` on a specific role
1189
- - **Search & Discovery**: Use search with operators like \`label:role\` or \`assignee:me completed:false\`
1190
- - **Quick Capture**: Use inbox tools to capture thoughts without organizing, then process later
1191
-
1192
- ## Authentication
1193
-
1194
- There are three ways to authenticate with the Nestr MCP server at \`https://mcp.nestr.io/mcp\`:
1195
-
1196
- ### 1. Workspace API Key (workspace-scoped)
1197
-
1198
- Use the \`X-Nestr-API-Key\` header with a key from workspace settings (Settings > Integrations > Workspace API access). Workspace API keys have full workspace access regardless of user permissions. All actions are attributed to the API key, not to a specific user — there is no user identity in audit trails.
1199
-
1200
- ### 2. Personal API Key (user-scoped)
1201
-
1202
- Users can create a personal API key from their account page at \`https://app.nestr.io/profile#security\`. Pass it as \`Authorization: Bearer <token>\` on all MCP requests. Personal API keys are scoped to the user — actions appear under that user's name in audit trails, and access respects the user's permissions. This is the simplest way for agents to authenticate as a specific user without implementing OAuth flows.
1203
-
1204
- ### 3. OAuth (user-scoped, auto-discovery)
1205
-
1206
- OAuth tokens also identify a specific user. This is the standard approach for MCP clients that support auto-discovery.
1207
-
1208
- **How MCP clients authenticate via OAuth:**
1209
-
1210
- MCP-compliant clients (Claude, Cursor, VS Code, etc.) handle OAuth automatically. On first connection to \`https://mcp.nestr.io/mcp\`, the server returns a 401 with OAuth metadata. The client discovers endpoints via:
1211
-
1212
- 1. \`GET /.well-known/oauth-protected-resource\` — returns the authorization server URL
1213
- 2. \`GET /.well-known/oauth-authorization-server\` — returns available endpoints and capabilities
1214
-
1215
- The server supports three OAuth grant types:
1216
-
1217
- **Authorization Code Flow with PKCE** (browser-based clients):
1218
- 1. Client registers dynamically via \`POST /oauth/register\` (RFC 7591)
1219
- 2. Client redirects user to \`GET /oauth/authorize\` with PKCE code_challenge
1220
- 3. User authenticates on Nestr's login page and authorises access
1221
- 4. Server redirects back with an authorization code
1222
- 5. Client exchanges code for tokens via \`POST /oauth/token\` with code_verifier
1223
-
1224
- **Device Authorization Flow** (headless/CLI agents, RFC 8628):
1225
- 1. Client registers dynamically via \`POST /oauth/register\`
1226
- 2. Client requests device code via \`POST /oauth/device\` with \`client_id\` and optional \`scope\`
1227
- 3. Server returns \`device_code\`, \`user_code\`, and \`verification_uri\`
1228
- 4. User visits the verification URI in a browser and enters the user code to authorise
1229
- 5. Client polls \`POST /oauth/token\` with \`grant_type=urn:ietf:params:oauth:grant-type:device_code\` until authorised
1230
-
1231
- **Refresh Tokens:**
1232
- Tokens expire. Use \`POST /oauth/token\` with \`grant_type=refresh_token\` to get a new access token without re-authenticating.
1233
-
1234
- **Using OAuth tokens:**
1235
- Once obtained, pass the access token as \`Authorization: Bearer <token>\` on all MCP requests.
1236
-
1237
- **Scopes:** The server requests \`user\` and \`nest\` scopes, which provide access to user profile data and workspace/nest operations.
1238
-
1239
- ### Which method to choose?
1240
-
1241
- - **OAuth (recommended)**: The preferred method. Standard MCP auto-discovery with user-scoped access and full audit trail attribution. Most MCP clients (Claude, Cursor, VS Code) handle this automatically — just connect and authenticate. No manual key management needed, and tokens refresh automatically.
1242
- - **Personal API key**: A simpler alternative when your client doesn't support OAuth. User-scoped with the same audit trail benefits. Generate one at \`https://app.nestr.io/profile#security\` and pass as \`Authorization: Bearer <token>\`. Best for custom agents or curl-based integrations that need user identity without implementing OAuth flows.
1243
- - **Workspace API key**: Quick setup, full workspace access, but no user attribution. Actions appear as anonymous API calls in audit trails. Best for testing or workspace-wide automation where individual identity doesn't matter.
1244
-
1245
- ## HTTP Transport: JSON Response Mode
1246
-
1247
- When connecting to \`https://mcp.nestr.io/mcp\` via HTTP, responses are returned as SSE streams by default. For simpler integrations (e.g., curl-based scripts or shell-based agents), you can request plain JSON responses instead:
1248
-
1249
- - Send \`Accept: application/json\` (without \`text/event-stream\`) on the initialization request
1250
- - The entire session will return plain JSON-RPC responses instead of SSE-wrapped \`event: message\\ndata: {...}\` format
1251
- - This eliminates the need to parse SSE formatting for simple request-response interactions
1252
-
1253
- **SSE (default):**
1254
- \`\`\`
1255
- Accept: application/json, text/event-stream
1256
- \`\`\`
1257
-
1258
- **Plain JSON (opt-in):**
1259
- \`\`\`
1260
- Accept: application/json
1261
- \`\`\`
1262
-
1263
- The mode is determined at session initialization and applies for the lifetime of the session.
1264
-
1265
- ## HTTP Sessions
1266
-
1267
- When using the HTTP transport (\`https://mcp.nestr.io/mcp\`), each MCP session is identified by a \`mcp-session-id\` header returned on initialization. Key behaviors:
1268
-
1269
- - **Session reuse**: Include the \`mcp-session-id\` header on subsequent requests to reuse the same session. This avoids re-initialization overhead.
1270
- - **No explicit TTL**: MCP transport sessions remain available as long as the server process is running. There is no idle timeout.
1271
- - **Session cleanup**: Send \`DELETE /mcp\` with the session ID to explicitly end a session.
1272
- - **Server restarts**: MCP transport sessions are in-memory and do not survive server restarts. However, **OAuth authentication is persisted to disk** — your OAuth token remains valid across restarts. If you get a session-not-found error, simply re-initialize the MCP session with the same bearer token. No re-authentication is needed.
1273
- - **One session per connection**: Each initialized session has its own transport and authentication context. Do not share session IDs across different authentication contexts.
60
+ 1. Start with \`nestr_get_me\` to establish context
61
+ 2. Use \`nestr_search\` with operators to find items call \`nestr_help({ topic: "search" })\` for syntax
62
+ 3. Always use \`completed:false\` when searching for active work
63
+ 4. Check labels to understand nest types call \`nestr_help({ topic: "labels" })\` for reference
64
+ 5. Use hints=true on \`nestr_get_nest\` to surface issues without extra queries
65
+ 6. For governance changes in established workspaces, prefer the tension flow
66
+ 7. To find who fills a role, check its \`users\` array. To find a user's roles, use \`assignee:{userId} label:role\`
1274
67
  `.trim();
1275
68
  export function createServer(config = {}) {
1276
69
  const client = config.client || createClientFromEnv();
1277
70
  const server = new Server({
1278
71
  name: "nestr-mcp",
1279
- version: "0.1.0",
72
+ version: VERSION,
1280
73
  description: "Manage tasks, projects, roles, and circles for self-organizing teams. Built for Holacracy, Sociocracy, and Teal organizations practicing role-based governance and distributed authority. AI-native tool for the future of work - automate workflows and run your autonomous team with AI assistants.",
1281
74
  }, {
1282
75
  capabilities: {
1283
76
  tools: {},
1284
77
  resources: {},
1285
78
  },
1286
- instructions: [
1287
- SERVER_INSTRUCTIONS,
1288
- SERVER_INSTRUCTIONS_REFERENCE,
1289
- DOING_WORK_INSTRUCTIONS,
1290
- TENSION_PROCESSING_INSTRUCTIONS,
1291
- WORKSPACE_SETUP_INSTRUCTIONS,
1292
- ].join("\n\n"),
79
+ instructions: SERVER_INSTRUCTIONS,
1293
80
  });
1294
81
  // Register tool list handler
1295
82
  server.setRequestHandler(ListToolsRequestSchema, async () => {