agentleFS
keep-starknet-strangekeep-starknet-strange/starknet-agentic/CLAUDE.md

starknet-agentic

CLAUDE.md80 starsChanged 7 months agoMITView on GitHub

Canonical behavioral instructions live in AGENTS.md, imported here so Claude Code loads them: @AGENTS.md This file provides repository implementation context and operational references. Keep it factual: no line/test/tool counts or status labels; point at the source of truth instead. Selected versions for orientation; the source-of-truth files define the exact pins. Folders outside the pnpm workspace (contracts/*/scripts/, contracts/erc8004-cairo/e2e-tests/, skills/*/package.json) pin their own, sometimes older, starknet.js majors. Directory purpose only; each directory's README has details.

  • Reads credentials
  • Installs packages

The file

We split this CLAUDE.md into the rules it gives an agent

12 rules. About 0 are common, 6 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Keep it factual: no line/test/tool counts or status labels.

    line 7
  2. Distinctive:

    Use OpenZeppelin Cairo components (ERC-721, SRC5, ReentrancyGuard, access control)

    line 103
  3. Distinctive:

    Use Poseidon hashing (not Pedersen) for new cryptographic operations

    line 107
  4. Very specific:

    Use ByteArray for string-like metadata keys

    line 108
  5. Distinctive:

    Native Account Abstraction: every account is a smart contract.

    line 136
  6. Very specific:

    Create skills/<skill-name>/SKILL.md with YAML frontmatter (spec: references/agentskills/SPECS.md).

    line 177
  7. Very specific:

    Add the .agents/skills/<skill-name> symlink and list the skill in .claude-plugin/plugin.json

    line 178
  8. Distinctive:

    Document the tool in the server README

    line 194
  9. Very specific:

    Create a Scarb package under contracts/<contract-name>/ matching existing pins (starknet 2.14.0, OpenZeppelin v3.0.0, snforge_std 0.64.0)

    line 199
  10. Distinctive:

    Write snforge tests (aim for >90% coverage)

    line 201
  11. Distinctive:

    Add a CI build/test job and a Sepolia deployment script

    line 202
  12. Very specific:

    Always consult references/ before relying on training data for Starknet-specific or AgentSkills-specific information.

    line 247

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

Starknet Agentic -- Development Context

Canonical behavioral instructions live in AGENTS.md, imported here so Claude Code loads them: @AGENTS.md

This file provides repository implementation context and operational references. Keep it factual: no line/test/tool counts or status labels; point at the source of truth instead.

<identity> Infrastructure layer for AI agents on Starknet. Provides Cairo smart contracts (ERC-8004 identity/reputation/validation, agent and session-key accounts), an MCP server, an A2A adapter, and installable skills that let any AI agent hold wallets, transact, build reputation, and access DeFi on Starknet. </identity><stack>

Selected versions for orientation; the source-of-truth files define the exact pins.

ComponentTechnologySource of truth
Smart contractsCairo 2.14 (Scarb 2.14.0), Starknet Foundry 0.64.0contracts/*/Scarb.toml, CI workflow
Contract depsOpenZeppelin Cairo v3.0.0contracts/*/Scarb.toml
RuntimeNode.js 24+, pnpm 10 (corepack).nvmrc, root package.json
TS toolchainTypeScript 6, tsup (ESM + .d.ts), Vitest 5package.json files
Starknet interactionstarknet.js v10package.json files
MCP server@modelcontextprotocol/sdk 1.xpackages/starknet-mcp-server/package.json
DeFi aggregation@avnu/avnu-sdk 4.xpackages/starknet-mcp-server/package.json
Schema validationzod v4package.json files
Skills formatSKILL.md (YAML frontmatter + markdown)references/agentskills/SPECS.md
Python toolingPython 3 (skill validation, evals)requirements.txt, requirements-lock.txt
WebsiteNext.js 16, React 19, Tailwind CSS 4website/package.json

Folders outside the pnpm workspace (contracts/*/scripts/, contracts/erc8004-cairo/e2e-tests/, skills/*/package.json) pin their own, sometimes older, starknet.js majors.

</stack><structure>

Directory purpose only; each directory's README has details.

starknet-agentic/
├── packages/                      # pnpm workspace TypeScript packages (ESM)
│   ├── create-starknet-agent/     # CLI scaffolder
│   ├── starknet-mcp-server/       # MCP server exposing Starknet operations as tools
│   ├── starknet-a2a/              # A2A adapter (Agent Cards backed by ERC-8004)
│   ├── starknet-agent-passport/   # Capability metadata conventions on IdentityRegistry
│   ├── starknet-onboarding-utils/ # Preflight, factory deploy, first-action helpers
│   ├── x402-starknet/             # x402 payment header helpers
│   ├── prediction-arb-scanner/    # Signals-only prediction-market arb scanner
│   ├── session-account-e2e/       # Session-key signer/invoke helper for scripts/e2e_test_runner.sh (private)
│   └── shared/                    # Internal shared utilities (private)
├── contracts/                     # Independent Scarb packages
│   ├── erc8004-cairo/             # ERC-8004 registries, e2e-tests/, deploy scripts/
│   ├── agent-account/             # Agent account + factory (session keys, timelocked upgrades)
│   ├── session-account/           # Session-key account with per-token spending policy
│   └── huginn-registry/           # Thought-provenance registry (experimental)
├── skills/                        # One directory per skill (SKILL.md); README.md catalog, manifest.json index
├── SKILL.md, llms.txt             # Root skill router and LLM index
├── .agents/skills/                # Codex discovery symlinks -> skills/*
├── .claude-plugin/, commands/     # Claude Code plugin manifests and slash commands
├── examples/                      # Runnable demos (pnpm workspace members)
├── spec/                          # Signer API/auth, session-signature, interop schemas + vectors
├── datasets/, evals/              # Cairo audit corpora; skill benchmarks, scorecards, reports
├── scripts/                       # Deploy, quality gates, skill validation, security evidence, site build
├── security/, tools/              # Dependency audit allowlist; vendored ajv-cli
├── docs/                          # Architecture, roadmap, guides, security runbooks
├── website/                       # Next.js docs site (has its own CLAUDE.md)
└── references/                    # AgentSkills spec + starknet-docs (git submodule)

Skills (catalog: skills/README.md):

  • Starknet app/agent: starknet-js, starknet-wallet, starknet-defi, starknet-identity, snip-36, starknet-mini-pay, starknet-tongo, starknet-anonymous-wallet, controller-cli, huginn-onboard, starkzap-sdk
  • Cairo: cairo-contract-authoring, cairo-testing, cairo-optimization, cairo-deploy, cairo-auditor, account-abstraction, starknet-network-facts

Examples: hello-agent, onboard-agent, crosschain-demo, defi-agent, carry-agent, controller-calls, erc8004-validation-demo, full-stack-swarm, secure-defi-demo, starkzap-onboard-transfer.

</structure><commands>
TaskCommandWorking Directory
Install TS depspnpm installrepo root
Build all TS packages (CI typecheck)pnpm buildrepo root
Test all TS packagespnpm testrepo root
Lint packages (as CI)pnpm -r --if-present --filter './packages/*' lintrepo root
Build/test one packagepnpm --filter <package-name> build (or test)repo root
Website dev / buildpnpm dev / pnpm buildwebsite/
Build Cairo contractsscarb buildcontracts/<package>/
Test Cairo contractssnforge testcontracts/<package>/
Run matching Cairo testssnforge test <name-filter>contracts/<package>/
Minimal agent demopnpm demo:hello-agentrepo root
Deploy ERC-8004 registries (Sepolia)bash scripts/deploy_sepolia.shcontracts/erc8004-cairo/
Deploy SessionAccount (Sepolia)bash scripts/deploy_sepolia.shrepo root
Scaffold new agentnpx @starknetfoundation/create-starknet-agent@latestany
</commands><conventions>

Cairo

  • Use OpenZeppelin Cairo components (ERC-721, SRC5, ReentrancyGuard, access control)
  • Contracts use the #[starknet::contract] module pattern with component embedding
  • Interfaces are #[starknet::interface] traits kept apart from implementations (src/interfaces/ or src/interfaces.cairo)
  • Tests use snforge declare, deploy, and dispatchers
  • Use Poseidon hashing (not Pedersen) for new cryptographic operations
  • Use ByteArray for string-like metadata keys

TypeScript

  • ESM-only ("type": "module"); build with tsup to ESM with .d.ts
  • Validate env/config and untrusted input with Zod
  • starknet.js object-form constructors: new Account({ provider, address, signer }), new Contract({ abi, address, providerOrAccount })
  • RpcProvider for read-only operations

Skills

  • YAML frontmatter: name, description, keywords, allowed-tools, user-invocable
  • Name format: lowercase, hyphens only, 1-64 chars
  • Include starknet.js code examples, reference the avnu SDK for DeFi, list error codes with recovery steps

Git and deployment

See AGENTS.md ("Git and Deployment").

</conventions><standards>
  • MCP (Model Context Protocol): agent-to-tool connectivity; our MCP server exposes Starknet operations as tools.
  • A2A (Agent-to-Agent Protocol): inter-agent communication; Agent Cards at /.well-known/agent.json.
  • ERC-8004 (Trustless Agents): Identity (ERC-721), Reputation (feedback), Validation (assessments) registries. See docs/ERC8004-PARITY.md.
</standards>

<starknet_concepts>

  • Native Account Abstraction: every account is a smart contract; custom validation, session keys, fee and nonce abstraction are first-class.
  • Session Keys: temporary keys with limited permissions (allowed methods, time bounds, spending limits). Critical for agent autonomy.
  • Paymaster: gas paid in a supported token or sponsored by a third party (avnu paymaster). "Gasfree"/sponsored = dApp pays gas.
  • V3 Transactions: current transaction version; fees paid in STRK.

</starknet_concepts>

<contracts_detail>

PackageMain sourcesPurpose
contracts/erc8004-cairoidentity_registry.cairo, reputation_registry.cairo, validation_registry.cairo, interfaces/ERC-8004 registries (IIdentityRegistry, IReputationRegistry, IValidationRegistry)
contracts/agent-accountagent_account.cairo, agent_account_factory.cairo, session_key.cairoAgent account; factory deploys an account and registers its ERC-8004 identity
contracts/session-accountaccount.cairo, spending_policy/Session-key account with per-token spending policy
contracts/huginn-registrysrc/Thought-provenance registry

ERC-8004 metadata keys used by the MCP server and skills: agentName, agentType, version, model, status, framework, capabilities, a2aEndpoint, moltbookId.

Deployed addresses and class hashes: docs/DEPLOYMENT_TRUTH_SHEET.md.

</contracts_detail>

<key_addresses>

Mainnet Tokens

  • ETH: 0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7
  • STRK: 0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d
  • USDC: 0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8
  • USDT: 0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8

API Endpoints

  • avnu Mainnet: https://starknet.api.avnu.fi
  • avnu Sepolia: https://sepolia.api.avnu.fi
  • avnu Paymaster Mainnet: https://starknet.paymaster.avnu.fi
  • avnu Paymaster Sepolia: https://sepolia.paymaster.avnu.fi

</key_addresses>

<workflows>

Adding a new skill

  1. Create skills/<skill-name>/SKILL.md with YAML frontmatter (spec: references/agentskills/SPECS.md); optionally add references/ and scripts/
  2. Add the .agents/skills/<skill-name> symlink and list the skill in .claude-plugin/plugin.json
  3. From repo root (python3 -m pip install -r requirements.txt first in a fresh env):
    python3 scripts/skills_manifest.py --write
    python3 scripts/quality/validate_skills.py
    python3 scripts/skills_manifest.py --check
    python3 scripts/quality/check_codex_distribution.py
    python3 -m unittest scripts/quality/test_codex_distribution.py
    python3 scripts/quality/validate_marketplace.py

Adding a new MCP tool

  1. Define the tool: name, description, input schema; validate arguments with Zod
  2. Implement the handler with starknet.js or the avnu SDK
  3. Register the tool with the server
  4. Add Vitest tests
  5. Document the tool in the server README

See packages/starknet-mcp-server/README.md for where tool definitions live.

Adding a new Cairo contract

  1. Create a Scarb package under contracts/<contract-name>/ matching existing pins (starknet 2.14.0, OpenZeppelin v3.0.0, snforge_std 0.64.0)
  2. Implement with the #[starknet::contract] pattern
  3. Write snforge tests (aim for >90% coverage)
  4. Add a CI build/test job and a Sepolia deployment script

Running E2E tests

See docs/E2E_TESTING_GUIDE.md (ERC-8004 registries and SessionAccount spending policy on Sepolia).

</workflows><boundaries>

DO NOT modify

  • .env* files (credentials -- use .env.example for templates)
  • contracts/*/Scarb.lock (dependency locks)
  • references/starknet-docs/ (git submodule -- update via git submodule update)
  • Deployed contract addresses in production without team review

Require human review

  • Any contract deployment (Sepolia or mainnet)
  • Changes to contract interfaces (breaking for deployed instances)
  • Dependency version bumps in Scarb.toml or root package.json
  • Security-sensitive code (key handling, signature verification, spending limits)

Safe for agents

  • Reading and analyzing any file
  • Writing/editing TypeScript source, tests, skills, docs
  • Writing/editing Cairo source and tests (not deploying)
  • Running builds and tests
  • Creating new skills following the established pattern
</boundaries><references>
ReferencePathUse When
Agent mission + coordinationAGENTS.mdGoals, roles, required validation per change type
AgentSkills spec / integrationreferences/agentskills/SPECS.md, INTEGRATION.mdSkill frontmatter; skill discovery/loading
Starknet docsreferences/starknet-docs/Starknet architecture, Cairo, or AA questions
Skills catalog + installskills/README.mdChoosing, installing, distributing skills
Technical specdocs/SPECIFICATION.mdArchitecture, interfaces, security model
ERC-8004 paritydocs/ERC8004-PARITY.mdCross-chain compatibility, Starknet extensions
Deploymentsdocs/DEPLOYMENT_TRUTH_SHEET.mdDeployed addresses and class hashes
Getting started / E2Edocs/GETTING_STARTED.md, docs/E2E_TESTING_GUIDE.mdOnboarding; Sepolia end-to-end runs
Troubleshootingdocs/TROUBLESHOOTING.md, skills/TROUBLESHOOTING.mdRuntime/build issues; skill install issues
Security runbooksdocs/security/Signer, deployment, spending-policy evidence

Always consult references/ before relying on training data for Starknet-specific or AgentSkills-specific information.

</references><troubleshooting>
ProblemSolution
scarb build version mismatchInstall the Scarb version pinned in Scarb.toml / CI (2.14.0).
snforge tests fail on deployMock contracts must implement required interfaces; check the package's mock modules.
pnpm install failsUse Node 24+ and the pnpm version in root packageManager (corepack enable).
E2E tests failCheck .env has a valid Sepolia RPC URL and a funded account.
references/starknet-docs/ emptygit submodule update --init --recursive
starknet.js type errorsWorkspace packages use v10 object-form constructors (see TypeScript conventions); standalone script folders may be on older majors.
</troubleshooting>

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.