agentleFS
fxsteinfxstein/ai-todo/.cursor/rules/linear-ai-todo-integration.mdc

ai-todo / rules

Cursor rule16 starsChanged 10 months agoApache-2.0View on GitHub

Linear integration: kickoff, branching, ai-todo planning, closing

  • Commits and pushes

The file

Show its rules and text

We split this linear-ai-todo-integration.mdc into the rules it gives an agent

21 rules. About 0 are common, 10 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Never: write code without a plan in TODO.md.

    line 16
  2. Distinctive:

    Never: start work without an assigned Linear Issue.

    line 17
  3. Distinctive:

    Trigger: When the user says "Start work", "Pick task", or "Kickoff":

    line 30
  4. Very specific:

    Call user-linear.list_issues with { "assignee": "me" }.

    line 34
  5. Very specific:

    Call user-linear.get_issue with that issue's id (UUID) to get full details including title, description.

    line 43
  6. Distinctive:

    Update from origin: git pull origin main

    line 52
  7. Distinctive:

    Verify clean state: git status (warn if uncommitted changes exist)

    line 53
  8. Very specific:

    Create slug from issue title: lowercase with hyphens (e.g., fix-login)

    line 58
  9. Distinctive:

    Example: If git config user.name returns "fxstein" and issue is AIT-12 "Fix Login":

    line 61
  10. Distinctive:

    After creating the branch:

    line 70
  11. Very specific:

    Offer: Ask: "Should I create an ai-todo task for this Linear issue?"

    line 72
  12. Very specific:

    Call ai-todo.add_task with:

    line 74
  13. Very specific:

    After branching (and optionally creating ai-todo tasks):

    line 82
  14. Distinctive:

    Offer: Ask: "Should I set this Linear issue to In Progress?"

    line 84
  15. Distinctive:

    If yes: Call user-linear.update_issue with:

    line 85
  16. Distinctive:

    Update from upstream: git pull origin main

    line 124
  17. Very specific:

    Delete local branch: git branch -d <branch-name>

    line 125
  18. Very specific:

    Delete remote branch: git push origin --delete <branch-name>

    line 126
  19. Very specific:

    Always offer to create ai-todo tasks from Linear issues.

    line 147
  20. Very specific:

    Use format [IDENTIFIER] Title for the main task.

    line 148
  21. Distinctive:

    Create subtasks if the Linear issue has steps.

    line 149

≈ “Common” is an estimate: at least 1 in 5 of the 6,668 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
linear-ai-todo-integration.mdc
---
description: "Linear integration: kickoff, branching, ai-todo planning, closing"
alwaysApply: true
---

# Linear + ai-todo Integration Protocol

Your workflow connects high-level strategy (Linear) with low-level execution (ai-todo).

**Design:** See `docs/linear_integration_design.md` for full specification.

---

## THE GOLDEN RULE

**Never** write code without a plan in `TODO.md`.
**Never** start work without an assigned Linear Issue.

---

## TOOLCHAIN

- **Macro (Strategy):** Linear MCP (`user-linear`) — read requirements, update stakeholders.
- **Micro (Tactics):** ai-todo MCP — track execution steps.

---

## KICKOFF WORKFLOW

**Trigger:** When the user says **"Start work"**, **"Pick task"**, or **"Kickoff"**:

### Step 1: List issues

Call **user-linear.list_issues** with `{ "assignee": "me" }`.

### Step 2: Present

List the returned issues (identifier, title, status) and ask which one to work on.

### Step 3: Get issue

Once the user selects an issue (e.g., AIT-12):
- Call **user-linear.get_issue** with that issue's `id` (UUID) to get full details including `title`, `description`.
- **CRITICAL:** Linear returns a `gitBranchName` field - **IGNORE IT**. It uses Linear's `displayName` (e.g., "oliver"), not the GitHub username (e.g., "fxstein").

### Step 4: Branch

**CRITICAL: Always start from updated main. Always construct branch name from git config. NEVER use Linear's gitBranchName.**

**Pre-branch checks:**
1. Switch to main: `git checkout main`
2. Update from origin: `git pull origin main`
3. Verify clean state: `git status` (warn if uncommitted changes exist)

**Create branch:**
4. Get GitHub username: `git config user.name` (use as-is, case-sensitive)
5. Extract IDENTIFIER from Linear issue (e.g., `AIT-12`, keep case from Linear)
6. Create slug from issue title: lowercase with hyphens (e.g., `fix-login`)
7. Run: `git checkout -b <username>/<IDENTIFIER>-<slug>`

**Example:** If `git config user.name` returns "fxstein" and issue is AIT-12 "Fix Login":
```bash
git checkout main
git pull origin main
git checkout -b fxstein/AIT-12-fix-login
```

### Step 5: ai-todo Planning

After creating the branch:

- **Offer:** Ask: "Should I create an ai-todo task for this Linear issue?"
- **If yes:**
  1. Call **ai-todo.add_task** with:
     - `title`: `[<IDENTIFIER>] <issue title>` (e.g., `[AIT-12] Fix login validation`)
     - `description`: The Linear issue description (or summary).
  2. **If the Linear issue has subtasks or steps in the description:** Create subtasks with **ai-todo.add_subtask** for each step.
  3. **Confirm plan with user:** Show the created task/subtasks and ask "Does this plan look correct?"

### Step 6: Set state to In Progress

After branching (and optionally creating ai-todo tasks):

- **Offer:** Ask: "Should I set this Linear issue to **In Progress**?"
- **If yes:** Call **user-linear.update_issue** with:
  - `id`: Issue UUID (from step 3).
  - `state: "In Progress"`.

---

## CLOSING WORKFLOW

### Open Pull Request

**Trigger:** User says **"Open PR"**, **"Ready for review"**, or **"Create PR"**:

**Actions:**
1. Push branch: `git push -u origin HEAD`
2. Create PR with:
   - Title: `[IDENTIFIER] Issue title`
   - Body format:
     ```
     Closes [IDENTIFIER](linear-issue-url)

     ## Summary
     [Brief description from Linear issue or ai-todo task]

     ## Changes
     - [Key changes from commit messages]

     ## Test Plan
     - [How to verify - optional]
     ```
3. Set Linear to **In Review**: Call **user-linear.update_issue** with `id` and `state: "In Review"`

### After PR Merged

**Trigger:** User says **"PR merged"**, **"Close issue"**, or **"Done"**:

**Actions:**
1. Set Linear to **Done**: Call **user-linear.update_issue** with `id` and `state: "Done"`
2. Cleanup branch:
   - Switch to main: `git checkout main`
   - Update from upstream: `git pull origin main`
   - Delete local branch: `git branch -d <branch-name>`
   - Delete remote branch: `git push origin --delete <branch-name>`

---

## CRITICAL REMINDERS

- **API tools (user-linear):**
  - ✅ Use **user-linear.get_user** with `{ "query": "me" }` (not `get_viewer`).
  - ✅ Use **user-linear.list_issues** with `{ "assignee": "me" }` (not `get_issues` with `assignee_id`).
  - ✅ Use **user-linear.update_issue** with `state` parameter (not `status`).

- **Branch creation:**
  - **ALWAYS start from updated main:** `git checkout main && git pull origin main`
  - **NEVER create branches from stale or feature branches** (causes merge conflicts).
  - **NEVER use Linear's `gitBranchName` field** (it uses displayName, not GitHub username).
  - **ALWAYS** construct: `<username>/<IDENTIFIER>-<slug>`
  - Get username from: `git config user.name` (use as-is, case-sensitive).
  - Example: `fxstein/AIT-12-fix-login` (NOT `oliver/AIT-12-fix-login`)
  - GitHub PR check accepts case-insensitive identifier (AIT or ait).

- **ai-todo planning:**
  - Always offer to create ai-todo tasks from Linear issues.
  - Use format `[IDENTIFIER] Title` for the main task.
  - Create subtasks if the Linear issue has steps.

---

*This rule combines kickoff, branching, ai-todo planning, and closing workflows. For full context: `docs/linear_integration_design.md`, `docs/linear_integration_assessment.md`.*

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.