ktnip-ksp-processor

ktnip-ksp-processor is a cursor rule for Cursor from vendelieu/telegram-bot. It costs 0 tokens per session (482 once invoked), scanned A, original, Apache-2.0.

Architecture rules for a KSP processor that discovers annotated Kotlin functions and generates bot-related source code. The processor is organized into collectors that gather different kinds of handlers and a generator that writes the results.

In plain words
What is it for?
Extending ktnip’s annotation processing, collecting handlers, resolving parameters, and generating Kotlin files for activities, bot contexts, and loaders.
Why use it?
It gives contributors a defined place and process for adding new handler types or changing code generation. This reduces the risk of inconsistent discovery or incomplete generated files.

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/vendelieu/telegram-bot/ktnip-ksp-processor
Clone the repo
git clone --depth 1 https://github.com/vendelieu/telegram-bot

Made for: Cursor.

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 ktnip-ksp-processor

README.md
[![agentmods](https://agentmods.dev/badge/rules/vendelieu/telegram-bot/ktnip-ksp-processor.svg)](https://agentmods.dev/rules/vendelieu/telegram-bot/ktnip-ksp-processor)
Your own site
<a href="https://agentmods.dev/rules/vendelieu/telegram-bot/ktnip-ksp-processor"><img src="https://agentmods.dev/badge/rules/vendelieu/telegram-bot/ktnip-ksp-processor.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 482 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.00000 $0.00482
Opus 5 $0.00000 $0.00241
Sonnet 5 $0.00000 $0.00096
Haiku 4.5 $0.00000 $0.00048

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

Security

Grade A, and why

ktnip-ksp-processor 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/ktnip-ksp-processor.mdc · 51 lines

What it actually says

KSP Processor Rules

Architecture

ActivityProcessor -> Collectors -> ActivityCodeGenerator -> ParameterResolver + InvocationCodeGenerator

  • ActivityProcessorProvider: Entry; passes options, logger, codeGenerator
  • Collectors: BotCtxCollector, CommandCollector, InputCollector, CommonCollector, UpdateHandlerCollector, UnprocessedHandlerCollector, WizardCollector
  • Outputs: ActivitiesData.kt, BotCtx.kt (per package), KtGramCtxLoader, META-INF/services

ActivityProcessor

  • Single-pass; isProcessed guard
  • Options: package (semicolon-separated), autoAnswerCallback
  • FileBuilder = KotlinPoet FileSpec.Builder
  • Add @Suppress and @OptIn to generated files

Collectors

  • Implement Collector: collect(resolver: Resolver, ctx: CollectorsContext)
  • BaseCollector: extractActivityMetadata(), generateAndRegisterActivity()
  • Discovery: resolver.getAnnotatedFnSymbols(pkg, Annotation::class)
  • Annotations: use findAnnotationRecursively for meta-annotations
  • New collector: add to processPackage list in ActivityProcessor

ParameterResolutionStrategy

  • User, Chat, Bot, ProcessingContext, Update, TypedUpdate
  • StringParameter, PrimitiveParameter (Int, Long, etc.) - from parameters map
  • Injectable - from injectableTypes; @ParamMapping for name override
  • Unsupported - generates error
  • New strategy: add to ParameterResolver + InvocationCodeGenerator

Conventions

  • Use TypeConstants for type references (User, Chat, Bot, Update types)
  • DEFAULT_CODEGEN_PACKAGE = "eu.vendeli.tgbot.generated"
  • AnnotationExtractor: function > class > default for Guard, RateLimits, ArgParser
  • KSPExtensions: findAnnotationRecursively, hasAnnotationRecursively for meta-annotations

Tests

  • KSP tests: ./gradlew :ktnip:jvmTest (see ktnip-ksp-tests rule)
  • New collectors: add test data and runTest in ProcessorTest
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 · 51 lines · 0 tokens per session scan A fa59540f72d6

Subscribe to this mod's changes

ktnip-ksp-processor is a cursor rule published in the GitHub repository vendelieu/telegram-bot (248 stars, last pushed 7d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 482 tokens. 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.