pkg-or-internal

pkg-or-internal is a cursor rule for Cursor from hiromaily/go-crypto-wallet. It costs 0 tokens per session (945 once invoked), scanned A, original, MIT.

A set of rules for deciding where Bitcoin-related Go code belongs in a project.

In plain words
What is it for?
Use it when adding or moving Bitcoin chain, RPC, and infrastructure code in a Go project.
Why use it?
It prevents code from being placed in the wrong package, especially when separating standalone logic, Bitcoin Core calls, and infrastructure-dependent code.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when adding or moving Bitcoin chain, RPC, and infrastructure code in a Go project.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/hiromaily/go-crypto-wallet/pkg-or-internal
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/hiromaily/go-crypto-wallet

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 pkg-or-internal

README.md
[![agentmods](https://agentmods.dev/badge/rules/hiromaily/go-crypto-wallet/pkg-or-internal/github.svg)](https://agentmods.dev/rules/hiromaily/go-crypto-wallet/pkg-or-internal)
Your own site
<a href="https://agentmods.dev/rules/hiromaily/go-crypto-wallet/pkg-or-internal"><img src="https://agentmods.dev/badge/rules/hiromaily/go-crypto-wallet/pkg-or-internal/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 pkg-or-internal

Your own site · 80×15
<a href="https://agentmods.dev/rules/hiromaily/go-crypto-wallet/pkg-or-internal"><img src="https://agentmods.dev/badge/rules/hiromaily/go-crypto-wallet/pkg-or-internal.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 945 The whole file, excluding the scripts and references it only reads on demand.
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.00000 $0.00945
Opus 5 $0.00000 $0.00473
Sonnet 5 $0.00000 $0.00189
Haiku 4.5 $0.00000 $0.00094

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

Security

Grade A, and why

pkg-or-internal 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 7d 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/chains/btc/pkg-or-internal.mdc · 103 lines

How it starts

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

BTC Package Placement Rules

pkg/chains/btc/*.go — Standalone Functions

  • Functions that can be defined independently without infrastructure or struct dependencies
  • Pure logic that depends only on stdlib or external Bitcoin libraries
  • Example: descriptor parsing, address utilities, multisig helpers

pkg/chains/btc/rpc/*.go — Raw RPC Operations

  • Functions that perform Bitcoin Core RPC calls via RawRequest
  • Each function wraps a single RPC command with request/response marshalling
  • Must NOT depend on internal/ packages
// Good: direct RPC call via RawRequest
rawResult, err := c.client.RawRequest("getaddressinfo", []json.RawMessage{input})

internal/infrastructure/api/btc/btc/ — Infrastructure-Dependent Logic

  • Code that depends on internal/ packages (domain, application, other infrastructure)
  • Code that requires Bitcoin struct properties (chainConf, coinTypeCode, version, feeRange, etc.)
  • Business logic that orchestrates multiple RPC calls or combines RPC results with domain logic
  • Facade methods that delegate to pkgrpc but hide the pkgrpc layer from callers
// Good: uses Bitcoin struct properties for business logic
func (b *Bitcoin) AdjustFee(fee float64) float64 {
    return fee * b.feeRange.Max
}

// Good: facade method — callers use this instead of b.pkgrpc.EstimateSmartFee()
//       pkgrpc is NOT exposed through the Bitcoiner interface
func (b *Bitcoin) EstimateSmartFee(confirmationBlock int) (float64, error) {
    return b.pkgrpc.EstimateSmartFee(confirmationBlock)
}

Anti-Pattern: Redundant Delegation Wrappers

Do NOT create methods in internal/ that simply delegate to pkg/ when the method is not part of the Bitcoiner interface and provides no value as a facade.

// Bad: pure pass-through with no callers
func (b *Bitcoin) SomeRPCMethod() error {
    return b.pkgrpc.SomeRPCMethod()
}

Facade Pattern: The Only Entrypoint to pkgrpc

The Bitcoin struct exposes all pkgrpc operations as its own facade methods. pkgrpc is a private field — it is NOT accessible outside the btc package. GetPkgRPC() does NOT exist. BCH overrides use promoted facade methods from Bitcoin.

Read the full file on GitHub · 103 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. 7d ago First seen · 103 lines · 0 tokens per session scan A abaf2dc8627d

Subscribe to this mod's changes

pkg-or-internal is a cursor rule published in the GitHub repository hiromaily/go-crypto-wallet (127 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 945 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-09-01.