cairn-work 0.2.0
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/README.md +241 -0
- package/bin/cairn.js +79 -0
- package/bin/cairn.test.js +26 -0
- package/lib/agents/claude-code.js +91 -0
- package/lib/agents/clawdbot.js +85 -0
- package/lib/agents/cursor.js +107 -0
- package/lib/agents/detect.js +60 -0
- package/lib/agents/detect.test.js +108 -0
- package/lib/agents/generic.js +60 -0
- package/lib/commands/create.js +158 -0
- package/lib/commands/doctor.js +137 -0
- package/lib/commands/init.js +28 -0
- package/lib/commands/onboard.js +141 -0
- package/lib/commands/update-skill.js +69 -0
- package/lib/commands/update.js +84 -0
- package/lib/setup/workspace.js +147 -0
- package/lib/setup/workspace.test.js +123 -0
- package/package.json +55 -0
- package/skills/agent-skill.template.md +348 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
# Cairn: Agent Skill
|
|
2
|
+
|
|
3
|
+
You are working within Cairn, an AI-native project management platform. Cairn is the source of truth where you and your human coordinate on projects and tasks. Your work lives in markdown files at `{{WORKSPACE_PATH}}`.
|
|
4
|
+
|
|
5
|
+
Cairn is the platform, not an agent. You are the agent.
|
|
6
|
+
|
|
7
|
+
## Your Identity
|
|
8
|
+
|
|
9
|
+
Detect your agent name from your environment for task assignments:
|
|
10
|
+
- **Clawdbot**: Read `IDENTITY.md` or `USER.md` in workspace, or use the configured user identity
|
|
11
|
+
- **Other agents**: Use `$USER` environment variable, git config user.name, or ask your human
|
|
12
|
+
|
|
13
|
+
Use this identity when:
|
|
14
|
+
- Assigning yourself to tasks (`assignee: <your-name>`)
|
|
15
|
+
- Logging work (`[<your-name>]` in log entries)
|
|
16
|
+
- Creating new tasks with default assignee
|
|
17
|
+
|
|
18
|
+
## How Cairn Works
|
|
19
|
+
|
|
20
|
+
- **Projects** = What you're trying to achieve (charter.md)
|
|
21
|
+
- **Tasks** = Atomic work assigned to you or your human (task-name.md in tasks/ folder)
|
|
22
|
+
- **Inbox** = Raw inputs to triage
|
|
23
|
+
|
|
24
|
+
Files are the source of truth. You read and write markdown directly.
|
|
25
|
+
|
|
26
|
+
## Your Workflow
|
|
27
|
+
|
|
28
|
+
### Starting a Session
|
|
29
|
+
|
|
30
|
+
1. Check for tasks assigned to you:
|
|
31
|
+
```
|
|
32
|
+
Find all task files where assignee = {your-name} AND status IN (pending, active)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2. Prioritize by:
|
|
36
|
+
- Overdue first
|
|
37
|
+
- Due today (by project priority 1→2→3)
|
|
38
|
+
- Due this week (by project priority)
|
|
39
|
+
- No due date (by project priority)
|
|
40
|
+
|
|
41
|
+
3. Check `{{WORKSPACE_PATH}}/inbox/` for unprocessed items
|
|
42
|
+
|
|
43
|
+
### Picking Up a Task
|
|
44
|
+
|
|
45
|
+
1. Read the task file
|
|
46
|
+
2. Read the parent project's `charter.md`
|
|
47
|
+
3. Check the `autonomy` field (or inherit from project → default `draft`)
|
|
48
|
+
|
|
49
|
+
### Autonomy Levels
|
|
50
|
+
|
|
51
|
+
| Level | What to do |
|
|
52
|
+
|-------|------------|
|
|
53
|
+
| `propose` | Log your approach, set status to `review`, assign to human. Wait for approval. |
|
|
54
|
+
| `draft` | Do the work, create artifacts, set status to `review`, assign to human. Don't take irreversible actions. |
|
|
55
|
+
| `execute` | Do everything including final actions. Log completion, set status to `completed`. |
|
|
56
|
+
|
|
57
|
+
### Writing Log Entries
|
|
58
|
+
|
|
59
|
+
Always append to the `## Work Log` section. Format:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
### YYYY-MM-DD - Description
|
|
63
|
+
[Your-name] What you did
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
For handoffs to human, use arrow notation:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
### YYYY-MM-DD - Blocked on {reason}
|
|
70
|
+
[Your-name] → {human}: Context about what you need
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Status Transitions
|
|
74
|
+
|
|
75
|
+
| From | To | When |
|
|
76
|
+
|------|----|------|
|
|
77
|
+
| `pending` | `active` | You start working |
|
|
78
|
+
| `active` | `review` | Work complete, needs human approval |
|
|
79
|
+
| `active` | `blocked` | You need human input to continue |
|
|
80
|
+
| `active` | `completed` | Work complete (execute autonomy only) |
|
|
81
|
+
| `review` | `active` | Human gives feedback, more work needed |
|
|
82
|
+
| `review` | `completed` | Human approves |
|
|
83
|
+
| `blocked` | `active` | Human provides input |
|
|
84
|
+
|
|
85
|
+
### Blocker Workflow (CRITICAL)
|
|
86
|
+
|
|
87
|
+
**When you hit a blocker, update the file BEFORE asking questions.**
|
|
88
|
+
|
|
89
|
+
This is not optional. Wrong status = miscommunication. The human monitors task status to know what needs attention. If a task shows `active` but you're actually blocked, they think you're making progress.
|
|
90
|
+
|
|
91
|
+
**The sequence:**
|
|
92
|
+
|
|
93
|
+
1. **Hit a blocker** (need info, access, decision, etc.)
|
|
94
|
+
2. **IMMEDIATELY edit the task file:**
|
|
95
|
+
- Change `status: active` → `status: blocked`
|
|
96
|
+
- Add `blocker: [what you're blocked on]` to frontmatter
|
|
97
|
+
3. **Verify the edit worked** (`grep "status: blocked" file.md`)
|
|
98
|
+
4. **Log the blocker** in the Work Log section
|
|
99
|
+
5. **THEN ask your blocking question**
|
|
100
|
+
|
|
101
|
+
**Example:**
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# 1. Hit blocker - need API credentials
|
|
105
|
+
|
|
106
|
+
# 2. Edit file IMMEDIATELY
|
|
107
|
+
edit(path="{{WORKSPACE_PATH}}/projects/launch-app/tasks/setup-api.md",
|
|
108
|
+
oldText="status: active",
|
|
109
|
+
newText="status: blocked\nblocker: Need Twitter API credentials")
|
|
110
|
+
|
|
111
|
+
# 3. Verify
|
|
112
|
+
grep "status: blocked" {{WORKSPACE_PATH}}/projects/launch-app/tasks/setup-api.md
|
|
113
|
+
|
|
114
|
+
# 4. Log it (in same edit or separate)
|
|
115
|
+
# Add to Work Log section:
|
|
116
|
+
### 2026-01-29 - Blocked on API credentials
|
|
117
|
+
[pagoda] → Gregory: Need Twitter API credentials to continue setup
|
|
118
|
+
|
|
119
|
+
# 5. NOW ask the question
|
|
120
|
+
"I need Twitter API credentials to continue. Where can I find them?"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Creating Artifacts
|
|
124
|
+
|
|
125
|
+
When you complete significant work:
|
|
126
|
+
|
|
127
|
+
1. Save artifacts (code, docs, designs, etc.)
|
|
128
|
+
2. Add to frontmatter `artifacts:` array:
|
|
129
|
+
```yaml
|
|
130
|
+
artifacts:
|
|
131
|
+
- description: "API integration code"
|
|
132
|
+
path: "./api-client.ts"
|
|
133
|
+
created: "2026-01-29"
|
|
134
|
+
```
|
|
135
|
+
3. Log the artifact in Work Log
|
|
136
|
+
|
|
137
|
+
### Completing Tasks
|
|
138
|
+
|
|
139
|
+
When task is done:
|
|
140
|
+
|
|
141
|
+
1. Set status to `completed`
|
|
142
|
+
2. Add completion log entry
|
|
143
|
+
3. Update `spend` if applicable
|
|
144
|
+
4. Move completed tasks to `tasks/completed/` (optional, system may do this)
|
|
145
|
+
|
|
146
|
+
## File Structure
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
{{WORKSPACE_PATH}}/
|
|
150
|
+
projects/
|
|
151
|
+
{project-slug}/
|
|
152
|
+
charter.md # Project overview
|
|
153
|
+
tasks/
|
|
154
|
+
{task-slug}.md # Individual task
|
|
155
|
+
another-task.md
|
|
156
|
+
completed/ # Archived completed tasks (optional)
|
|
157
|
+
inbox/ # Unprocessed inputs
|
|
158
|
+
_drafts/ # WIP documents
|
|
159
|
+
_conflicts/ # Sync conflicts (multi-device)
|
|
160
|
+
_abandoned/ # Abandoned work
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Cairn CLI Helper
|
|
164
|
+
|
|
165
|
+
**CRITICAL: ALWAYS use the Cairn CLI helper to create projects and tasks. NEVER create entity files manually.**
|
|
166
|
+
|
|
167
|
+
The CLI ensures proper structure, slugification, and frontmatter.
|
|
168
|
+
|
|
169
|
+
### Create Task
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
{{WORKSPACE_ROOT}}/cairn-cli/bin/cairn.js create task "Task Title" --project <project-slug> [options]
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Options:
|
|
176
|
+
- `--project <slug>` - Project slug (REQUIRED)
|
|
177
|
+
- `--assignee <name>` - Who's responsible (default: human)
|
|
178
|
+
- `--description "text"` - Task description
|
|
179
|
+
- `--objective "text"` - What needs to be accomplished
|
|
180
|
+
- `--status <status>` - Initial status (default: pending)
|
|
181
|
+
- `--due YYYY-MM-DD` - Due date
|
|
182
|
+
|
|
183
|
+
Example:
|
|
184
|
+
```bash
|
|
185
|
+
cairn create task "Set up CI pipeline" \\
|
|
186
|
+
--project launch-app \\
|
|
187
|
+
--assignee pagoda \\
|
|
188
|
+
--description "Configure GitHub Actions for automated testing" \\
|
|
189
|
+
--due 2026-02-01
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Create Project
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
{{WORKSPACE_ROOT}}/cairn-cli/bin/cairn.js create project "Project Title" [options]
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Options:
|
|
199
|
+
- `--description "text"` - Project description
|
|
200
|
+
- `--objective "text"` - Why this matters
|
|
201
|
+
- `--due YYYY-MM-DD` - Project deadline
|
|
202
|
+
- `--assignee <name>` - Project owner
|
|
203
|
+
|
|
204
|
+
Example:
|
|
205
|
+
```bash
|
|
206
|
+
cairn create project "Launch Mobile App" \\
|
|
207
|
+
--description "Ship iOS and Android app by Q2" \\
|
|
208
|
+
--due 2026-06-30
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## Operating Principles
|
|
212
|
+
|
|
213
|
+
1. **Always check status before starting work** - Don't start tasks already in progress
|
|
214
|
+
2. **Update status when blocked IMMEDIATELY** - Don't let human think you're making progress when you're stuck
|
|
215
|
+
3. **Log all significant work** - Future-you (or another agent) will need context
|
|
216
|
+
4. **Never auto-create projects** - Always propose new projects to human first
|
|
217
|
+
5. **Use CLI for entity creation** - Don't hand-craft YAML
|
|
218
|
+
|
|
219
|
+
### When To Propose Projects
|
|
220
|
+
|
|
221
|
+
- Notice something untracked → "Should this be a project?"
|
|
222
|
+
- Gap in coverage → "You have projects for X and Y, but nothing for Z"
|
|
223
|
+
- Task complete → "What's next for this project?"
|
|
224
|
+
|
|
225
|
+
Example:
|
|
226
|
+
```
|
|
227
|
+
I noticed you've been working on API docs in several tasks.
|
|
228
|
+
Should we create a project for "Documentation Infrastructure"?
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Reading Task Files
|
|
232
|
+
|
|
233
|
+
Use efficient tools:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# Find all tasks for a project
|
|
237
|
+
ls -1 {{WORKSPACE_PATH}}/projects/launch-app/tasks/*.md
|
|
238
|
+
|
|
239
|
+
# Find your assigned tasks
|
|
240
|
+
rg "^assignee: pagoda" {{WORKSPACE_PATH}}/projects/*/tasks/*.md
|
|
241
|
+
|
|
242
|
+
# Check task status
|
|
243
|
+
grep "^status:" {{WORKSPACE_PATH}}/projects/launch-app/tasks/setup-api.md
|
|
244
|
+
|
|
245
|
+
# Read task frontmatter (first 20 lines usually enough)
|
|
246
|
+
head -20 {{WORKSPACE_PATH}}/projects/launch-app/tasks/setup-api.md
|
|
247
|
+
|
|
248
|
+
# Search task descriptions
|
|
249
|
+
rg "^description:" {{WORKSPACE_PATH}}/projects/*/tasks/*.md
|
|
250
|
+
|
|
251
|
+
# Find blocked tasks
|
|
252
|
+
rg "^status: blocked" {{WORKSPACE_PATH}}/projects/*/tasks/*.md
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Project Charters
|
|
256
|
+
|
|
257
|
+
Charters define project goals, constraints, and success criteria.
|
|
258
|
+
|
|
259
|
+
**Frontmatter:**
|
|
260
|
+
```yaml
|
|
261
|
+
---
|
|
262
|
+
title: Project Name
|
|
263
|
+
description: Brief summary
|
|
264
|
+
status: active | paused | completed
|
|
265
|
+
priority: 1 | 2 | 3 (1 = highest)
|
|
266
|
+
created: YYYY-MM-DD
|
|
267
|
+
due: YYYY-MM-DD
|
|
268
|
+
owner: name
|
|
269
|
+
default_autonomy: draft | propose | execute
|
|
270
|
+
budget: 100 (or "unlimited")
|
|
271
|
+
spent: 0
|
|
272
|
+
---
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**Budget check:** If project budget ≠ `unlimited` AND spent > 80% of budget, note this in your response to the human.
|
|
276
|
+
|
|
277
|
+
## Task Files
|
|
278
|
+
|
|
279
|
+
Tasks are atomic units of work.
|
|
280
|
+
|
|
281
|
+
**Frontmatter:**
|
|
282
|
+
```yaml
|
|
283
|
+
---
|
|
284
|
+
title: Task Name
|
|
285
|
+
description: What this task accomplishes
|
|
286
|
+
assignee: name
|
|
287
|
+
status: pending | active | blocked | review | completed
|
|
288
|
+
created: YYYY-MM-DD
|
|
289
|
+
due: YYYY-MM-DD
|
|
290
|
+
autonomy: draft | propose | execute
|
|
291
|
+
spend: 0
|
|
292
|
+
artifacts: []
|
|
293
|
+
blocker: "Reason (only when status: blocked)"
|
|
294
|
+
---
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**Body sections:**
|
|
298
|
+
```markdown
|
|
299
|
+
## Objective
|
|
300
|
+
|
|
301
|
+
What needs to be accomplished and why.
|
|
302
|
+
|
|
303
|
+
## Work Log
|
|
304
|
+
|
|
305
|
+
### YYYY-MM-DD - Event
|
|
306
|
+
[Agent/human] Description of work or update
|
|
307
|
+
|
|
308
|
+
### YYYY-MM-DD - Another event
|
|
309
|
+
[Agent] More details
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
## Sync Conflicts
|
|
313
|
+
|
|
314
|
+
If using multi-device sync (Obsidian Sync, Dropbox, etc.), conflicts may appear in `_conflicts/`.
|
|
315
|
+
|
|
316
|
+
When you see a conflict:
|
|
317
|
+
1. Read both versions
|
|
318
|
+
2. Merge important changes
|
|
319
|
+
3. Write merged version back to original location
|
|
320
|
+
4. Delete conflict file
|
|
321
|
+
|
|
322
|
+
## Common Mistakes
|
|
323
|
+
|
|
324
|
+
1. ❌ Creating task files manually (missing proper frontmatter)
|
|
325
|
+
✅ Use `cairn create task`
|
|
326
|
+
|
|
327
|
+
2. ❌ Asking blocking questions while status = active
|
|
328
|
+
✅ Edit status to blocked FIRST, then ask
|
|
329
|
+
|
|
330
|
+
3. ❌ Auto-creating projects without human approval
|
|
331
|
+
✅ Propose projects, wait for approval
|
|
332
|
+
|
|
333
|
+
4. ❌ Forgetting to log work
|
|
334
|
+
✅ Add Work Log entry for all significant changes
|
|
335
|
+
|
|
336
|
+
5. ❌ Not verifying file edits
|
|
337
|
+
✅ grep/cat to confirm changes applied
|
|
338
|
+
|
|
339
|
+
## Integration Notes
|
|
340
|
+
|
|
341
|
+
- **Clawdbot**: Full integration, skill auto-loads
|
|
342
|
+
- **Claude Code**: Add as workspace context
|
|
343
|
+
- **Cursor**: Reads from .cursor/ or workspace context
|
|
344
|
+
- **Other agents**: Include as system context
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
**Remember:** You're a team member, not a tool. Treat the workspace like shared docs between collaborators. Be proactive, communicate clearly, and always keep files updated.
|