flagship_author

A set of authoring rules for adding a “flagship” example to the ks-cookbook project. It defines the required folders, Python files, README sections, and sample input.

In plain words
What is it for?
Use it when creating or editing a flagship, including its command-line entry point, agent code, output schema, documentation, and example data.
Why use it?
It gives contributors a fixed structure so new examples are complete and consistent with the rest of the project.

Cursor rule for Cursor

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 rules/knowledgestack/ks-cookbook/flagship_author
Clone the repo
git clone --depth 1 https://github.com/knowledgestack/ks-cookbook

Made for: Cursor.

Per session 10 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,118 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.00010 $0.01118
Opus 5 $0.00005 $0.00559
Sonnet 5 $0.00002 $0.00224
Haiku 4.5 $0.00001 $0.00112

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

Security

Grade A, and why

flagship_author 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 3d 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.

.cursor/rules/flagship_author.mdc · 119 lines

How it starts

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

Flagship author rule

Applies when you're adding or editing anything under flagships/<name>/.

File layout (enforced)

flagships/<name>/
├── pyproject.toml            # [project.scripts] entrypoint ks-cookbook-<slug>
├── README.md                 # title, tags, seed-data block, walkthrough
├── src/<module>/
│   ├── __main__.py           # argparse → agent.draft_*()
│   ├── agent.py              # pydantic-ai Agent + system prompt + MCP wiring
│   └── schema.py             # pydantic output model with Citation field(s)
└── sample_inputs/            # at least one concrete example input

Don't create additional top-level files inside the flagship unless there's a specific reason.

README template (required sections, in this order)

# <Vertical>: <Flagship Name>

**Tags:** `vertical` `subdomain` `framework`

<one-paragraph what-and-why>

## Seed data required

This demo reads from a folder in your Knowledge Stack tenant. You need to create
that folder and upload the expected documents **before** running.

**Expected corpus:** <one-line description>

Set-up steps:
1. Sign up at [app.knowledgestack.ai](https://app.knowledgestack.ai).
2. Create a folder in the dashboard and copy its folder ID.
3. Upload the documents described above.
4. Issue an API key from the dashboard and put it in `.env` as `KS_API_KEY`.
5. Run: `<CORPUS_FOLDER_ID=<id> make demo-<slug>>`

Full corpus matrix: [`https://github.com/knowledgestack/ks-cookbook/wiki/seed-data`](https://github.com/knowledgestack/ks-cookbook/wiki/seed-data).

## Run
<make command + override examples>

## Framework
<pydantic-ai | LangGraph | raw-OpenAI | raw-Anthropic | CrewAI | …>

## Bring your own data
<short note on pointing the demo at a different folder>

Agent wiring (copy this shape)

from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStdio
from .schema import Memo

SYSTEM_TEMPLATE = """..."""  # include the four prompt invariants

async def draft(*, corpus_folder_id: str, model: str, ...) -> Memo:
    mcp = MCPServerStdio(
        command=os.environ.get("KS_MCP_COMMAND", "uvx"),
        args=(os.environ.get("KS_MCP_ARGS", "knowledgestack-mcp") or "").split(),
        env={"KS_API_KEY": os.environ["KS_API_KEY"],
             "KS_BASE_URL": os.environ.get("KS_BASE_URL", "")},
    )
    agent = Agent(
        model=f"openai:{model}",
        mcp_servers=[mcp],
        system_prompt=SYSTEM_TEMPLATE.replace("__CORPUS_FOLDER_ID__", corpus_folder_id),
        output_type=Memo,
    )
    async with agent.run_mcp_servers():
        result = await agent.run(user_prompt)
    return result.output

Read the full file on GitHub · 119 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. 3d ago First seen · 119 lines · 10 tokens per session scan A 1afcd6bb8be3

Subscribe to this mod's changes

flagship_author is a cursor rule published in the GitHub repository knowledgestack/ks-cookbook (9 stars, last pushed 1mo ago), licensed MIT. It adds 10 tokens to every session and 1,118 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.