cairn-work 0.5.0 → 0.7.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/bin/cairn.js +7 -6
- package/lib/commands/create.js +47 -20
- package/lib/commands/doctor.js +24 -54
- package/lib/commands/onboard.js +57 -101
- package/lib/commands/update-skill.js +13 -51
- package/lib/setup/context.js +70 -0
- package/lib/setup/workspace.js +1 -1
- package/package.json +1 -1
- package/skills/agent-planning.template.md +8 -8
- package/skills/agent-skill.template.md +105 -292
- package/lib/agents/claude-code.js +0 -107
- package/lib/agents/clawdbot.js +0 -96
- package/lib/agents/cursor.js +0 -118
- package/lib/agents/detect.js +0 -60
- package/lib/agents/detect.test.js +0 -108
- package/lib/agents/generic.js +0 -62
|
@@ -61,7 +61,7 @@ Good:
|
|
|
61
61
|
Create 3-8 tasks per project. Each task should be:
|
|
62
62
|
- **Atomic**: Completable in one work session
|
|
63
63
|
- **Specific**: Clear what "done" means without reading other tasks
|
|
64
|
-
- **Ordered**:
|
|
64
|
+
- **Ordered**: All tasks default to `status: pending`. Only set `--status next_up` if the user asks you to begin work immediately.
|
|
65
65
|
|
|
66
66
|
Think in phases:
|
|
67
67
|
1. **Setup/Foundation** — Environment, tooling, project scaffolding
|
|
@@ -72,7 +72,7 @@ Think in phases:
|
|
|
72
72
|
cairn create task "Task Name" \
|
|
73
73
|
--project project-slug \
|
|
74
74
|
--description "What this accomplishes in one sentence" \
|
|
75
|
-
--status
|
|
75
|
+
--status pending \
|
|
76
76
|
--due YYYY-MM-DD
|
|
77
77
|
```
|
|
78
78
|
|
|
@@ -183,7 +183,7 @@ render on all routes.
|
|
|
183
183
|
|
|
184
184
|
When breaking down a project, think about what blocks what:
|
|
185
185
|
|
|
186
|
-
1. **Foundation tasks come first** — These set up the project, install tools, create the base structure.
|
|
186
|
+
1. **Foundation tasks come first** — These set up the project, install tools, create the base structure. All tasks start as `status: pending` by default.
|
|
187
187
|
|
|
188
188
|
2. **Core tasks depend on foundation** — These build the actual features. Set to `status: pending` until foundation tasks are done.
|
|
189
189
|
|
|
@@ -275,7 +275,7 @@ Here's what a fully fleshed-out project looks like after an agent processes "Cre
|
|
|
275
275
|
---
|
|
276
276
|
title: Build Marketing Website
|
|
277
277
|
description: Design and develop a responsive marketing website with homepage, about, contact, and blog
|
|
278
|
-
status:
|
|
278
|
+
status: in_progress
|
|
279
279
|
priority: 2
|
|
280
280
|
created: 2026-01-30
|
|
281
281
|
due: 2026-03-01
|
|
@@ -325,7 +325,7 @@ Assumptions:
|
|
|
325
325
|
title: Initialize project and tooling
|
|
326
326
|
description: Scaffold Next.js project with TypeScript, Tailwind, and dev tooling
|
|
327
327
|
assignee: you
|
|
328
|
-
status:
|
|
328
|
+
status: pending
|
|
329
329
|
created: 2026-01-30
|
|
330
330
|
due: 2026-02-03
|
|
331
331
|
autonomy: draft
|
|
@@ -503,7 +503,7 @@ Chrome, Safari, and Firefox latest versions.
|
|
|
503
503
|
---
|
|
504
504
|
title: Add Dark Mode
|
|
505
505
|
description: Implement system-aware dark mode with manual toggle across the site
|
|
506
|
-
status:
|
|
506
|
+
status: in_progress
|
|
507
507
|
priority: 2
|
|
508
508
|
created: 2026-01-30
|
|
509
509
|
due: 2026-02-10
|
|
@@ -547,7 +547,7 @@ Use `next-themes` or a lightweight custom hook.
|
|
|
547
547
|
title: Implement theme system
|
|
548
548
|
description: Add dark mode infrastructure with Tailwind class strategy and theme provider
|
|
549
549
|
assignee: you
|
|
550
|
-
status:
|
|
550
|
+
status: pending
|
|
551
551
|
created: 2026-01-30
|
|
552
552
|
due: 2026-02-04
|
|
553
553
|
autonomy: draft
|
|
@@ -654,7 +654,7 @@ in both modes.
|
|
|
654
654
|
|
|
655
655
|
4. **Vague tasks** — "Work on the frontend" is not a task. "Build the homepage with hero section, features grid, and CTA" is a task.
|
|
656
656
|
|
|
657
|
-
5. **No sequencing** — All tasks
|
|
657
|
+
5. **No sequencing** — All tasks created with random statuses. Create all tasks as `pending` by default. Only use `next_up` when the user explicitly asks you to begin work.
|
|
658
658
|
|
|
659
659
|
6. **Ignoring the charter** — Jumping straight to tasks without filling in Why, Success Criteria, and Context. The charter is how the human verifies you understood their intent.
|
|
660
660
|
|
|
@@ -1,348 +1,161 @@
|
|
|
1
|
-
# Cairn
|
|
1
|
+
# Cairn Project Management
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Workspace: `{{WORKSPACE_PATH}}`
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Read `.cairn/planning.md` before creating any projects.
|
|
6
6
|
|
|
7
|
-
##
|
|
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
|
|
7
|
+
## Structure
|
|
147
8
|
|
|
148
9
|
```
|
|
149
10
|
{{WORKSPACE_PATH}}/
|
|
150
|
-
projects/
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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
|
|
11
|
+
projects/{slug}/charter.md # Project definition
|
|
12
|
+
projects/{slug}/tasks/{slug}.md # Individual tasks
|
|
13
|
+
inbox/ # Unprocessed inputs
|
|
14
|
+
_drafts/ # Work in progress
|
|
161
15
|
```
|
|
162
16
|
|
|
163
|
-
##
|
|
17
|
+
## CLI Commands
|
|
164
18
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
The CLI ensures proper structure, slugification, and frontmatter.
|
|
168
|
-
|
|
169
|
-
### Create Task
|
|
19
|
+
Always use the CLI to create entities (never create files manually):
|
|
170
20
|
|
|
171
21
|
```bash
|
|
172
|
-
|
|
22
|
+
cairn create project "Name" --description "..." --objective "..." --criteria "..." --context "..." --due YYYY-MM-DD
|
|
23
|
+
cairn create task "Name" --project <slug> --description "..." --objective "..." --assignee <name> --due YYYY-MM-DD
|
|
24
|
+
cairn doctor # Check workspace health
|
|
25
|
+
cairn update-skill # Refresh this file
|
|
173
26
|
```
|
|
174
27
|
|
|
175
|
-
|
|
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
|
|
28
|
+
Tasks are created with `status: pending` by default. Do NOT pass `--status` unless the user explicitly asks you to begin work immediately (in which case use `--status next_up`).
|
|
182
29
|
|
|
183
|
-
|
|
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
|
-
```
|
|
30
|
+
Always pass `--description`, `--objective`, `--criteria`, and `--context` with real content. Never leave placeholders.
|
|
191
31
|
|
|
192
|
-
|
|
32
|
+
## File Format
|
|
193
33
|
|
|
194
|
-
|
|
195
|
-
|
|
34
|
+
**Charter frontmatter:**
|
|
35
|
+
```yaml
|
|
36
|
+
title, description, status (in_progress|paused|completed), priority (1-3),
|
|
37
|
+
created, due, owner, default_autonomy (propose|draft|execute), budget, spent
|
|
196
38
|
```
|
|
197
39
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
|
40
|
+
**Task frontmatter:**
|
|
41
|
+
```yaml
|
|
42
|
+
title, description, assignee, status (pending|next_up|in_progress|review|completed|blocked),
|
|
43
|
+
created, due, autonomy (propose|draft|execute), spend, artifacts, blocker
|
|
209
44
|
```
|
|
210
45
|
|
|
211
|
-
|
|
46
|
+
**Body sections:** `## Objective`, `## Why This Matters`, `## Success Criteria`, `## Context`, `## Work Log`
|
|
212
47
|
|
|
213
|
-
|
|
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
|
|
48
|
+
## Valid Statuses
|
|
218
49
|
|
|
219
|
-
|
|
50
|
+
Tasks: `inbox`, `pending`, `next_up`, `in_progress`, `review`, `completed`, `blocked`
|
|
220
51
|
|
|
221
|
-
|
|
222
|
-
- Gap in coverage → "You have projects for X and Y, but nothing for Z"
|
|
223
|
-
- Task complete → "What's next for this project?"
|
|
52
|
+
There is NO `active` status. Never use `active` — use `in_progress` when working, `next_up` for queued work.
|
|
224
53
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
54
|
+
- **pending** — Default. Task exists but is not ready to start yet.
|
|
55
|
+
- **next_up** — Queued and ready to be picked up.
|
|
56
|
+
- **in_progress** — Currently being worked on.
|
|
57
|
+
- **review** — Work complete, waiting for human approval.
|
|
58
|
+
- **blocked** — Cannot proceed, needs human input.
|
|
59
|
+
- **completed** — Done.
|
|
230
60
|
|
|
231
|
-
##
|
|
61
|
+
## Working on Tasks
|
|
232
62
|
|
|
233
|
-
|
|
63
|
+
Task files are a shared kanban board between you and the human. Status is how you communicate progress. The human sees the board and knows exactly where everything stands. You are accountable for keeping it accurate.
|
|
234
64
|
|
|
235
|
-
|
|
236
|
-
# Find all tasks for a project
|
|
237
|
-
ls -1 {{WORKSPACE_PATH}}/projects/launch-app/tasks/*.md
|
|
65
|
+
### Picking up a task
|
|
238
66
|
|
|
239
|
-
|
|
240
|
-
rg "^assignee: pagoda" {{WORKSPACE_PATH}}/projects/*/tasks/*.md
|
|
67
|
+
When the human asks you to work on a task (e.g. "work on task X", "start the API integration"):
|
|
241
68
|
|
|
242
|
-
|
|
243
|
-
|
|
69
|
+
1. **Read the task file** — understand the objective
|
|
70
|
+
2. **Read the parent charter** — understand the project context and autonomy level
|
|
71
|
+
3. **Set status to `in_progress`** — do this BEFORE you start any work
|
|
72
|
+
4. **Log it** — add a Work Log entry: `[name] Starting work on this task`
|
|
244
73
|
|
|
245
|
-
|
|
246
|
-
head -20 {{WORKSPACE_PATH}}/projects/launch-app/tasks/setup-api.md
|
|
74
|
+
### While working
|
|
247
75
|
|
|
248
|
-
|
|
249
|
-
|
|
76
|
+
As you work, keep the task file updated:
|
|
77
|
+
- **Log significant progress** in the Work Log section
|
|
78
|
+
- **Add artifacts** to the frontmatter as you create them (code files, docs, configs)
|
|
250
79
|
|
|
251
|
-
|
|
252
|
-
rg "^status: blocked" {{WORKSPACE_PATH}}/projects/*/tasks/*.md
|
|
253
|
-
```
|
|
80
|
+
### Finishing a task
|
|
254
81
|
|
|
255
|
-
|
|
82
|
+
When you're done working, your next status depends on **autonomy**:
|
|
256
83
|
|
|
257
|
-
|
|
84
|
+
- **`propose` or `draft` autonomy** → set status to **`review`**. The human decides if it's complete.
|
|
85
|
+
- **`execute` autonomy** → set status to **`completed`**. You have full authority.
|
|
258
86
|
|
|
259
|
-
|
|
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
|
-
```
|
|
87
|
+
Always add a completion log entry describing what you did and what the human should look at.
|
|
274
88
|
|
|
275
|
-
|
|
89
|
+
### When you get stuck
|
|
276
90
|
|
|
277
|
-
|
|
91
|
+
If you hit a blocker (need info, access, a decision, clarification):
|
|
278
92
|
|
|
279
|
-
|
|
93
|
+
1. **Set status to `blocked`** and add `blocker: [reason]` to frontmatter — do this FIRST
|
|
94
|
+
2. **Log it** — `[name] → human: What you need`
|
|
95
|
+
3. **Then ask your question**
|
|
280
96
|
|
|
281
|
-
|
|
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
|
-
```
|
|
97
|
+
Never leave a task as `in_progress` while you're actually waiting on the human. Wrong status = the human thinks you're making progress when you're not.
|
|
296
98
|
|
|
297
|
-
|
|
298
|
-
```markdown
|
|
299
|
-
## Objective
|
|
99
|
+
### Multiple tasks
|
|
300
100
|
|
|
301
|
-
|
|
101
|
+
If the human asks you to work through several tasks in sequence:
|
|
102
|
+
- Move each task to `in_progress` as you start it
|
|
103
|
+
- Move it to the correct finish status (`review` or `completed`) before starting the next one
|
|
104
|
+
- Don't leave multiple tasks as `in_progress` simultaneously unless you're genuinely working on them in parallel
|
|
302
105
|
|
|
303
|
-
|
|
106
|
+
### Task you didn't create
|
|
304
107
|
|
|
305
|
-
|
|
306
|
-
[Agent/human] Description of work or update
|
|
108
|
+
The human may move tasks to `in_progress` or `next_up` from the kanban board and then ask you to pick them up. Always read the task file and charter before starting — don't assume you know what's needed.
|
|
307
109
|
|
|
308
|
-
|
|
309
|
-
[Agent] More details
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
## Sync Conflicts
|
|
110
|
+
## Status Transitions
|
|
313
111
|
|
|
314
|
-
|
|
112
|
+
| From | To | When |
|
|
113
|
+
|------|----|------|
|
|
114
|
+
| pending | next_up | Task is ready to be worked on |
|
|
115
|
+
| next_up | in_progress | You start working |
|
|
116
|
+
| in_progress | review | Work done, needs human approval (draft/propose autonomy) |
|
|
117
|
+
| in_progress | blocked | You need human input |
|
|
118
|
+
| in_progress | completed | Done (execute autonomy ONLY) |
|
|
119
|
+
| review | in_progress | Human gives feedback, more work needed |
|
|
120
|
+
| review | completed | Human approves |
|
|
121
|
+
| blocked | in_progress | Human provides input |
|
|
315
122
|
|
|
316
|
-
|
|
317
|
-
1. Read both versions
|
|
318
|
-
2. Merge important changes
|
|
319
|
-
3. Write merged version back to original location
|
|
320
|
-
4. Delete conflict file
|
|
123
|
+
## Autonomy Levels (CRITICAL — always respect these)
|
|
321
124
|
|
|
322
|
-
|
|
125
|
+
Check the task's `autonomy` field (or inherit from parent project's `default_autonomy`). This controls what you may do and what status you set when finished:
|
|
323
126
|
|
|
324
|
-
|
|
325
|
-
|
|
127
|
+
| Level | What you do | Final status |
|
|
128
|
+
|-------|-------------|-------------|
|
|
129
|
+
| **propose** | Log your planned approach. Do NOT do the work. | → `review` |
|
|
130
|
+
| **draft** | Do the work and create artifacts. Do NOT take irreversible actions (deploy, publish, send, delete). | → `review` |
|
|
131
|
+
| **execute** | Do everything including irreversible actions. | → `completed` |
|
|
326
132
|
|
|
327
|
-
|
|
328
|
-
✅ Edit status to blocked FIRST, then ask
|
|
133
|
+
**You MUST follow autonomy.** If autonomy is `draft`, you cannot set status to `completed` — you MUST set it to `review` and let the human approve. Only `execute` autonomy permits moving directly to `completed`.
|
|
329
134
|
|
|
330
|
-
|
|
331
|
-
✅ Propose projects, wait for approval
|
|
135
|
+
## Work Log Format
|
|
332
136
|
|
|
333
|
-
|
|
334
|
-
|
|
137
|
+
```markdown
|
|
138
|
+
### YYYY-MM-DD - Description
|
|
139
|
+
[your-name] What you did
|
|
335
140
|
|
|
336
|
-
|
|
337
|
-
|
|
141
|
+
### YYYY-MM-DD - Blocked on {reason}
|
|
142
|
+
[your-name] → human: What you need
|
|
143
|
+
```
|
|
338
144
|
|
|
339
|
-
##
|
|
145
|
+
## Identity
|
|
340
146
|
|
|
341
|
-
|
|
342
|
-
-
|
|
343
|
-
-
|
|
344
|
-
- **Other agents**: Include as system context
|
|
147
|
+
Detect your name from environment (`$USER`, git config, or ask). Use it for:
|
|
148
|
+
- `assignee:` in task frontmatter
|
|
149
|
+
- `[name]` in work log entries
|
|
345
150
|
|
|
346
|
-
|
|
151
|
+
## Operating Principles
|
|
347
152
|
|
|
348
|
-
**
|
|
153
|
+
1. **Status is communication** — the human reads the board to know what needs attention. Keep it accurate at all times.
|
|
154
|
+
2. **Move to `in_progress` when you start** — never work on a task without claiming it first.
|
|
155
|
+
3. **Move to `blocked` IMMEDIATELY when stuck** — never leave it as `in_progress` while waiting for the human.
|
|
156
|
+
4. **Respect autonomy** — `draft`/`propose` → `review`, only `execute` → `completed`.
|
|
157
|
+
5. **Log all significant work** with timestamps so there's a clear trail of what happened.
|
|
158
|
+
6. **Never auto-create projects** — propose to human first.
|
|
159
|
+
7. **Use CLI for entity creation** — don't hand-craft YAML.
|
|
160
|
+
8. **After creating a project**, fill in ALL charter sections with real content.
|
|
161
|
+
9. **Budget check** — if spent > 80% of budget, notify human.
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
2
|
-
import { join, dirname } from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = dirname(__filename);
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Set up Cairn for Claude Code
|
|
11
|
-
* Adds agent-skill.md to workspace context
|
|
12
|
-
*/
|
|
13
|
-
export async function setupClaudeCode(workspacePath) {
|
|
14
|
-
const cwd = process.cwd();
|
|
15
|
-
const contextDir = join(cwd, '.claude-code');
|
|
16
|
-
const skillTemplate = join(__dirname, '../../skills/agent-skill.template.md');
|
|
17
|
-
const skillDest = join(contextDir, 'cairn-skill.md');
|
|
18
|
-
|
|
19
|
-
// Create context directory
|
|
20
|
-
if (!existsSync(contextDir)) {
|
|
21
|
-
mkdirSync(contextDir, { recursive: true });
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Read template and replace workspace placeholders
|
|
25
|
-
let skillContent = readFileSync(skillTemplate, 'utf-8');
|
|
26
|
-
const workspaceRoot = dirname(workspacePath);
|
|
27
|
-
|
|
28
|
-
skillContent = skillContent
|
|
29
|
-
.replace(/\{\{WORKSPACE_PATH\}\}/g, workspacePath)
|
|
30
|
-
.replace(/\{\{WORKSPACE_ROOT\}\}/g, workspaceRoot);
|
|
31
|
-
|
|
32
|
-
// Write skill to workspace
|
|
33
|
-
writeFileSync(skillDest, skillContent);
|
|
34
|
-
console.log(chalk.green('✓'), 'Cairn skill added to Claude Code workspace');
|
|
35
|
-
|
|
36
|
-
// Read planning template and replace placeholders
|
|
37
|
-
const planningTemplate = join(__dirname, '../../skills/agent-planning.template.md');
|
|
38
|
-
let planningContent = readFileSync(planningTemplate, 'utf-8');
|
|
39
|
-
planningContent = planningContent
|
|
40
|
-
.replace(/\{\{WORKSPACE_PATH\}\}/g, workspacePath)
|
|
41
|
-
.replace(/\{\{WORKSPACE_ROOT\}\}/g, workspaceRoot);
|
|
42
|
-
|
|
43
|
-
const planningDest = join(contextDir, 'cairn-planning.md');
|
|
44
|
-
writeFileSync(planningDest, planningContent);
|
|
45
|
-
console.log(chalk.green('✓'), 'Cairn planning guide added to Claude Code workspace');
|
|
46
|
-
|
|
47
|
-
// Create instructions file
|
|
48
|
-
const instructionsPath = join(contextDir, 'cairn-instructions.md');
|
|
49
|
-
const instructions = `# Cairn Project Management
|
|
50
|
-
|
|
51
|
-
This workspace uses Cairn for project management.
|
|
52
|
-
|
|
53
|
-
**Workspace:** ${workspacePath}
|
|
54
|
-
|
|
55
|
-
## Agent Documentation
|
|
56
|
-
|
|
57
|
-
Read BOTH files in this directory:
|
|
58
|
-
- **cairn-skill.md** — Operations: status transitions, autonomy levels, blocker workflow, file format
|
|
59
|
-
- **cairn-planning.md** — Planning: how to create projects, break down tasks, write real content, examples
|
|
60
|
-
|
|
61
|
-
**Key points:**
|
|
62
|
-
- All project files are in markdown format at ${workspacePath}
|
|
63
|
-
- Files are the source of truth (no database)
|
|
64
|
-
- Follow the project → task hierarchy
|
|
65
|
-
- Always update status before asking blocking questions
|
|
66
|
-
- Log all work in the Work Log section
|
|
67
|
-
- When creating projects, fill in ALL sections with real content (never leave placeholder text)
|
|
68
|
-
|
|
69
|
-
Read both skill files before working with Cairn.
|
|
70
|
-
`;
|
|
71
|
-
|
|
72
|
-
writeFileSync(instructionsPath, instructions);
|
|
73
|
-
console.log(chalk.green('✓'), 'Cairn instructions added');
|
|
74
|
-
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Get setup instructions for Claude Code
|
|
80
|
-
*/
|
|
81
|
-
export function getClaudeCodeInstructions(workspacePath) {
|
|
82
|
-
return `
|
|
83
|
-
${chalk.bold('Claude Code Setup Complete!')}
|
|
84
|
-
|
|
85
|
-
Your Cairn workspace: ${chalk.cyan(workspacePath)}
|
|
86
|
-
Context added at: ${chalk.cyan('.claude-code/')}
|
|
87
|
-
|
|
88
|
-
${chalk.bold('Test it:')}
|
|
89
|
-
Ask Claude Code:
|
|
90
|
-
${chalk.yellow('"Read .claude-code/cairn-skill.md and help me create a project"')}
|
|
91
|
-
|
|
92
|
-
${chalk.dim('Note: You may need to reload the workspace for changes to take effect.')}
|
|
93
|
-
`;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Verify Claude Code setup
|
|
98
|
-
*/
|
|
99
|
-
export function verifyClaudeCode() {
|
|
100
|
-
const contextPath = join(process.cwd(), '.claude-code', 'cairn-skill.md');
|
|
101
|
-
|
|
102
|
-
if (!existsSync(contextPath)) {
|
|
103
|
-
return { success: false, message: 'Cairn skill not found in workspace' };
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return { success: true, message: 'Claude Code setup verified' };
|
|
107
|
-
}
|