linear-drain

linear-drain is a command for Claude Code from assafkip/kipi-system. It costs 13 tokens per session (1,008 once invoked), scanned A, original, MIT.

A command that sends locally queued Linear projects and issues to Linear, a service for tracking software work. Local scripts can record requests offline when they cannot access Linear directly.

In plain words
What is it for?
Use it to inspect pending queue entries, check existing Linear projects and issues, and create only the queued objects that are not already present.
Why use it?
It separates offline capture from network creation and checks Linear first to reduce the risk of creating duplicate permanent objects.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: reads .claude/ paths.

Part of the kipi-core plugin — 10 skills, 7 commands shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/assafkip/kipi-system/linear-drain
Clone the repo
git clone --depth 1 https://github.com/assafkip/kipi-system

Made for: Claude Code.

Or install kipi-core, the plugin that ships this one along with the rest of its 10 skills, 7 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for linear-drain

README.md
[![agentmods](https://agentmods.dev/badge/commands/assafkip/kipi-system/linear-drain.svg)](https://agentmods.dev/commands/assafkip/kipi-system/linear-drain)
Your own site
<a href="https://agentmods.dev/commands/assafkip/kipi-system/linear-drain"><img src="https://agentmods.dev/badge/commands/assafkip/kipi-system/linear-drain.svg" alt="Measured on agentmods" height="20"></a>
Per session 13 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,008 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00013 $0.01008
Opus 5 $0.00006 $0.00504
Sonnet 5 $0.00003 $0.00202
Haiku 4.5 $0.00001 $0.00101

Measured 6d ago against content hash 0bb4b7becb32, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

linear-drain scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/kipi-core/commands/linear-drain.md · 93 lines

How it starts

The opening of the file, as written. The whole thing — 93 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Drain the local Linear queue into real Linear objects.

Why this command exists

There is no Linear API key in ~/.config/kipi/, so a shell script (kipi new, kipi linear issue, any build hook) cannot reach the Linear MCP server. Those scripts capture intents into a local append-only queue instead. You are the half that has credentials. Capture is deterministic and offline; you do the network.

Before you create anything, read this

mcp__linear__*delete* and archive are blocked by ~/.claude/hooks/destructive-op-deny.sh, and you cannot set ALLOW_DESTRUCTIVE=1 for yourself. Every object you create is permanent. Duplicates cannot be cleaned up, only marked Duplicate. So the dedup check below is not optional and not a formality.

Step 1 — what is pending

python3 "${CLAUDE_PROJECT_DIR}/q-system/.q-system/scripts/linear-queue.py" pending --json

If the list is empty, say so and stop. Do not go looking for work to do.

Step 2 — the remote guard

For each distinct repo in the pending list, fetch what Linear already has. Never skip this step on the grounds that the queue "looks fresh": a parallel session, a wiped ledger, or a re-run all produce a queue that looks fresh and a Linear that already has the object.

  • mcp__linear__list_projects with team: a75b9b87-bfdf-4fb7-bff3-a5a1a2a6946f, to see whether the project exists.
  • mcp__linear__list_issues with project: <project id> for the issues, then parse each description for its <!-- kipi-key: ... --> marker.

Write the result to a snapshot file shaped like {"project": {...} | null, "issues": [{"id", "identifier", "title", "description"}]}.

Step 3 — plan, do not improvise

python3 "${CLAUDE_PROJECT_DIR}/q-system/.q-system/scripts/linear-sync.py" plan \
  --map <capability-map.json> --remote <snapshot.json> --out <plan.json>

The planner applies both guards (local ledger, then the remote markers) and tells you exactly what to create. Create only what the plan lists. If the plan is empty, everything already exists; say so and stop.

Read the full file on GitHub · 93 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 93 lines · 13 tokens per session scan A 0bb4b7becb32

Subscribe to this mod's changes

linear-drain is a command published in the GitHub repository assafkip/kipi-system (109 stars, last pushed today), licensed MIT. It adds 13 tokens to every session and 1,008 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.