using-archipy-adapters

using-archipy-adapters is a cursor rule for Cursor from SyntaxArc/archipy-plugin. It costs 1,181 tokens per session, scanned A, original, MIT.

A set of rules for connecting ArchiPy applications to services such as Redis, PostgreSQL, Kafka, and object storage through adapters. It also covers ports, test doubles, and where domain-specific adapter code belongs.

In plain words
What is it for?
Use it when adding service integrations, defining interfaces for dependency injection, or creating small domain wrappers around ArchiPy adapters. It also helps structure optional in-memory test versions.
Why use it?
It keeps outside services behind clear boundaries, so application logic does not depend directly on database or service clients. This makes code easier to replace and test.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: positional $N argument.

Good fit Use it when adding service integrations, defining interfaces for dependency injection, or creating small domain wrappers around ArchiPy adapters. It also helps structure optional in-memory test versions.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/syntaxarc/archipy-plugin/using-archipy-adapters
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.

Clone the repo
git clone --depth 1 https://github.com/SyntaxArc/archipy-plugin

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 using-archipy-adapters

README.md
[![agentmods](https://agentmods.dev/badge/rules/syntaxarc/archipy-plugin/using-archipy-adapters/github.svg)](https://agentmods.dev/rules/syntaxarc/archipy-plugin/using-archipy-adapters)
Your own site
<a href="https://agentmods.dev/rules/syntaxarc/archipy-plugin/using-archipy-adapters"><img src="https://agentmods.dev/badge/rules/syntaxarc/archipy-plugin/using-archipy-adapters/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for using-archipy-adapters

Your own site · 80×15
<a href="https://agentmods.dev/rules/syntaxarc/archipy-plugin/using-archipy-adapters"><img src="https://agentmods.dev/badge/rules/syntaxarc/archipy-plugin/using-archipy-adapters.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,181 This file is loaded in full into every session.
When invoked 1,181 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.01181 $0.01181
Opus 5.5 $0.00472 $0.00472
Sonnet 5.5 $0.00236 $0.00236
Haiku 4.5 $0.00118 $0.00118

Measured 2d ago against content hash 6bf7c3685511, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

using-archipy-adapters 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.

rules/using-archipy-adapters.mdc · 131 lines

How it starts

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

Using ArchiPy Adapters

Live: https://syntaxarc.github.io/ArchiPy/tutorials/adapters/

Prefer ArchiPy First

Install the matching extra and use the shipped adapter:

uv add "archipy[redis]"
# examples: postgres, sqlalchemy, sqlalchemy-async, kafka, scylladb, minio, keycloak, ...
from archipy.adapters.redis.adapters import RedisAdapter

redis = RedisAdapter()  # reads BaseConfig.global_config().REDIS

Inject *Port abstractions into logics/repositories — not concrete adapters when DI is used.

Domain Adapter Shape

Domain adapters live under the domain repository — not a top-level adapters/ package:

repositories/<domain>/
├── adapters/
│   └── <domain>_<purpose>_adapter.py   # e.g. user_db_adapter.py
└── <domain>_repository.py

Thin wrappers around ArchiPy adapters (or external clients). Own entity construction and query building. Depend on ArchiPy ports when wrapping library adapters; add a local ABC only when the domain needs a custom contract. BDD runs adapters against real testcontainers; write a port-conforming fake only for a third-party API with no container.

Ports

from abc import ABC, abstractmethod

class CachePort(ABC):
    @abstractmethod
    def get(self, key: str) -> str | None: ...

    @abstractmethod
    def set(self, key: str, value: str, ttl: int | None = None) -> None: ...

Implementations and fakes must satisfy the same port.

Boundary Errors

Catch specific client/driver errors and map to domain errors with raise ... from e. A broad except Exception is allowed only at the outermost infrastructure boundary when the client exposes no typed root error; add a narrow # noqa: BLE001 reason. Never use bare except::

try:
    await self._client.produce(topic, message)
except KafkaError as e:
    raise KafkaProduceError("Failed to produce message") from e

Never leak raw driver exceptions into logics/services.

Partial Indexes and Bound Parameters

asyncpg runs every query as a server-side prepared statement (psycopg 3 does once a query has run more than its prepare_threshold times, 5 by default). Postgres plans the first five executions of a prepared statement with the actual values, then may switch to a generic plan, which sees $1 instead of the value (plan_cache_mode = auto; see the PostgreSQL docs). With asyncpg this happens from about the sixth execution on a connection; with psycopg 3 it starts later, after the statement is prepared. A partial index (CREATE INDEX ... WHERE status = 'PENDING') is usable only when the planner can prove its predicate, so a filter that binds the predicate's column (field == value, field.in_(values), or SQLAlchemyFilterMixin._apply_filter) stops matching the index once the plan goes generic. The query falls back to a broader index or a full scan. Nothing errors, and a small development database rarely shows it.

Read the full file on GitHub · 131 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 Changed · +43 lines · +536 tokens per session 6bf7c3685511
  2. 19d ago Changed · +1 lines · +11 tokens per session b741cb45d77b
  3. 1mo ago Changed · +7 lines · +86 tokens per session a154ec1073f6
  4. 1mo ago First seen · 80 lines · 548 tokens per session scan A 525e241b02c3

Subscribe to this mod's changes

using-archipy-adapters is a cursor rule published in the GitHub repository SyntaxArc/archipy-plugin (3 stars, last pushed 2d ago), licensed MIT. It adds 1,181 tokens to every session, about $0.0047 per session on Opus 5.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.