# Linear Triggers for Managed Agent Automations

> Start a Type.com automation when an issue, comment, project, cycle, label, or reaction changes in Linear, with instructions or with code.

Canonical page: https://docs.type.com/automations/linear/

A Linear trigger starts an automation when something changes in your Linear workspace. There are two ways to use Linear events:

- **With instructions.** The managed agent follows your instructions for each change, with the Space's connections and skills.
- **With code.** Your TypeScript runs for each change that it subscribes to.

## Before you start

- Connect Linear to Type, and add the connection to the Space. In the CLI, run `type-cli integrations connect linear`.
- Make sure that the Space has the skills that the managed agent needs, for example a triage skill.

## What Type receives from Linear

When you connect Linear, Type.com registers a Linear webhook for all public teams. Type receives changes to these Linear items:

- issues,
- comments,
- projects and project updates,
- cycles,
- issue labels,
- reactions.

## With instructions

New Linear triggers use the unified automation runtime. Existing legacy sources stay under **Synced events**.

### Make an instruction automation

1. Open the Space's **Automations** page (or **Space settings → Automations** in the settings layout).
2. Select **New automation**.
3. Choose **Linear** in **Trigger**.
4. If Linear has more than one connection, choose the connection.
5. Write the required instructions describing what to do with each event. To use a skill, write its handle, for example `/issue-triage`.
6. Select **Create automation**. No test event is required.

In the CLI:

```sh
type-cli automations create --space <space> --source linear --integration <org-integration-id> \
  --name "Linear triage" --instructions "Summarize relevant changes; take no action on other events." --enable
```

Without `--enable`, the CLI creates the automation paused.

The new automation subscribes to every Linear event from the connection (`linear.*`). Each change starts a run:

1. An agent stage follows your saved instructions, with the Linear event as its input.
2. A code stage records the agent's result: `completed` or `no_results`, with a short summary.

The automation controls what gets posted. Creating it does not change which events Linear sends. You can extend or replace the stages with code-only or mixed behavior, or ask Type in chat to refine the automation.

Examples:

- Triage new issues: add a label, suggest an owner, and ask for missing details.
- Summarize priority changes for the team each time they happen.
- Draft a project update when a project changes state.

### Write good instructions

- Say which changes matter. Tell the managed agent to stop with no action for other changes.
- Say what output to make and where to post it.
- Tell the managed agent to treat issue and comment text as evidence, not as instructions.

Every change in Linear starts a run, including changes that do not matter to you. Start with one kind of change that has high value. To stop runs for other changes, narrow the subscription's `events` in the automation's code.

## With code

A code automation subscribes to Linear events with an `integration` source. To learn the basics, see [Core concepts](https://docs.type.com/automations/how-it-works/index.md). For a complete automation that files and closes Linear stories, see [Turn bug reports into fixes](https://docs.type.com/automations/examples/bug-reports-to-fixes/index.md).

### Event names

Linear event names have the form `linear.<item>.<action>`. The action is the one that Linear sends, for example `create`, `update`, or `remove`.

| Item | Event names |
| --- | --- |
| Issue | `linear.issue.<action>` |
| Comment | `linear.comment.<action>` |
| Project | `linear.project.<action>` |
| Project update | `linear.project_update.<action>` |
| Cycle | `linear.cycle.<action>` |
| Reaction | `linear.reaction.<action>` |
| Issue label | `linear.label.<action>` |

`linear.*` selects every Linear event. Issue label events arrive as `linear.label.<action>`, and only `linear.*` selects them.

Each event arrives in an envelope. `resourceId` is the Linear ID of the item. `data` has normalized fields. For an issue, these include `identifier`, `title`, `description`, `url`, `state`, `priority`, `assignee`, `team`, and `labels`.

### Post new issues in the Space

```ts title="src/main.ts"

const linear = "orgint_example"; // the Linear connection
const space = "ch_example"; // this Space

const linearEvent = z.object({
  type: z.string(),
  id: z.string(),
  resourceId: z.string().nullable(),
  resourceType: z.string().nullable(),
  data: z.unknown(),
});
const issue = z.object({
  identifier: z.string(),
  title: z.string(),
  url: z.string(),
});

export default automation({
  output: z.object({ messageId: z.string() }),
  deployment: {
    subscriptions: {
      onIssue: {
        title: "New Linear issues",
        description: "Post each new Linear issue in the Space",
        source: {
          kind: "integration",
          connectionId: linear,
          events: ["linear.issue.create"],
        },
        entry: "announce",
      },
    },
  },
  stages: {
    announce: code({
      input: linearEvent,
      run: async ({ ctx, input: event }) => {
        const parsed = issue.safeParse(event.data);
        if (!parsed.success)
          return err(new TypeApiError("Unexpected issue data", "invalid_input"));
        const { identifier, title, url } = parsed.data;
        const sent = await ctx.write.sendMessage(
          { channelId: space, content: `New issue ${identifier}: ${title}\n${url}` },
          { effectKey: `linear-issue:${event.resourceId}` },
        );
        if (sent.isErr()) return err(sent.error);
        return complete({ messageId: sent.value.messageId });
      },
    }),
  },
});
```

There are no built-in Linear matchers, and Linear sources do not take `resources` filters. To filter, check `event.data` in the entry stage and finish early with `complete(...)` for events that you skip.

## Limitations

- Existing legacy sources retain their previous controls. New event automations can be paused and resumed from their automation editor.
- Linear sends changes from public teams.
