flow-import

A resumable command for turning an existing project's code, documents, and history into draft project knowledge. It runs several separate steps, from collecting sources to profiling the codebase and building knowledge candidates.

In plain words
What is it for?
Use it when starting the knowledge base for an existing project or continuing an import that stopped partway through.
Why use it?
It provides a controlled path for documenting a project whose important rules and decisions are not written down yet.

Command

Part of the cairnkit plugin — 2 skills, 7 commands, 11 agents 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/shenchangmin/cairnkit/flow-import
Clone the repo
git clone --depth 1 https://github.com/shenchangmin/cairnkit

Or install cairnkit, the plugin that ships this one along with the rest of its 2 skills, 7 commands, 11 agents.

Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 782 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 $0.00019 $0.00782
Opus 5 $0.00010 $0.00391
Sonnet 5 $0.00004 $0.00156
Haiku 4.5 $0.00002 $0.00078

Measured 2d ago against content hash d424336b1121, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

flow-import 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 2d 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.

commands/flow-import.md · 58 lines

How it starts

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

/flow-import

Make an existing project's implicit knowledge explicit as baseline draft entries.

Start or resume

Run cairn --root . import show. Resume when it succeeds. Run cairn --root . import init only when exit 2 specifically reports that no import is in progress; for any other error, surface it and stop.

The engine's current step is the source of truth:

step role mandate required output
doc-collect doc-collector docs/knowledge-import/01-sources.md
codebase-profile codebase-profiler docs/knowledge-import/02-profile.md
knowledge-build knowledge-builder docs/knowledge-import/knowledge-candidates.json and docs/knowledge-import/03-summary.md

Isolated dispatch for every step

Before each dispatch, resolve the plugin root exactly as the router did. Read the complete role mandate from resources/agents/<role>.md when resources/agents/ exists; otherwise read agents/<role>.md. Never use .codex/agents, ~/.codex/agents, a copied global mandate, or a same-named project or global profile.

Use a named role only when the host explicitly exposes that role as part of this cairnkit plugin. Installed Codex always uses a fresh generic worker with fork_turns="none". Supply only the full mandate, the original user request, current import step, exact allowed write scope from the mandate, and required output paths. Tell the worker not to edit docs/knowledge-import/import-state.json; the parent advances through cairn.

Confirm the worker inherits the required write access before dispatch. If not, stop; do not elevate permissions, never substitute the parent for the role, and never advance a failed dispatch.

After the worker returns, run the check for the current step:

test -f "docs/knowledge-import/01-sources.md" && test ! -L "docs/knowledge-import/01-sources.md" && test -s "docs/knowledge-import/01-sources.md"
test -f "docs/knowledge-import/02-profile.md" && test ! -L "docs/knowledge-import/02-profile.md" && test -s "docs/knowledge-import/02-profile.md"
test -f "docs/knowledge-import/knowledge-candidates.json" && test ! -L "docs/knowledge-import/knowledge-candidates.json" && test -s "docs/knowledge-import/knowledge-candidates.json"
test -f "docs/knowledge-import/03-summary.md" && test ! -L "docs/knowledge-import/03-summary.md" && test -s "docs/knowledge-import/03-summary.md"

Read the full file on GitHub · 58 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. 2d ago First seen · 58 lines · 19 tokens per session scan A d424336b1121

Subscribe to this mod's changes

flow-import is a command published in the GitHub repository shenchangmin/cairnkit (1 stars, last pushed 1mo ago), licensed MIT. It adds 19 tokens to every session and 782 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-31.