This document defines how AI agents should work in this repository.
adamant-api-jsclient is a TypeScript/Node.js API library for the ADAMANT blockchain.
Agent output must optimize for:
- Security and cryptographic correctness
- Reliability of node access, retries, and failover
- Backward compatibility of the public API and transaction behavior
- Open-source maintainability and contributor clarity
If tradeoffs are required, preserve secret safety, signing correctness, and network compatibility first.
- Developers may communicate with AI in any language
- All repository artifacts must be in English only
- Write code, comments, docs, commit messages, issue text, and PR text in English
Use these sources when implementing or reviewing changes:
- This repository:
README.md,package.json,CONTRIBUTING.md, current code, and passing tests - ADAMANT docs: https://docs.adamant.im
- ADAMANT schema source for generated API types: https://github.com/Adamant-im/adamant-schema
- Related wallet metadata and OpenAPI spec: https://github.com/Adamant-im/adamant-wallets and https://github.com/Adamant-im/adamant-wallets/blob/dev/specification/openapi.json
- Org-wide issue and label governance: https://github.com/Adamant-im/.github
Important repository-specific rule:
- If docs and code disagree, treat current code and passing tests as implementation truth and document the drift
adamant-walletsis a related source for wallet-facing coin and token metadata, address regexes, node and service health-check settings, explorer links, and blockchain definitions; it is especially relevant when changingsrc/coins/*, external wallet integrations, or future wallet-oriented API contracts
When creating issues:
- Search existing issues first: https://github.com/Adamant-im/adamant-api-jsclient/issues
- Use a concise prefixed title
- Apply labels from
Adamant-im/.github/labels.json - Link related issues and PRs explicitly
Recommended issue title prefixes:
[Bug][Feat][Enhancement][Refactor][Docs][Test][Chore][Task]
Label policy:
- Use a small but informative set
- Prefer one type label and one or more domain labels such as
APIs,NodeJS,TypeScript,Security,Privacy, orNodes - Keep label casing aligned with org rules
PR and branch policy:
- Target
dev, notmaster - Keep PR titles in
Type: Short summaryform such asDocs: Add AGENTS.md - Do not use issue-style square-bracket prefixes in PR titles
- Keep commits compatible with Conventional Commits and current commitlint rules
Key areas of this repository:
src/index.ts: public exportssrc/api/index.ts:AdamantApiHTTP client, retries, request helpers, endpoint surfacesrc/api/generated.ts: generated API DTO types copied fromadamant-schemasrc/helpers/healthCheck.ts: node health checks, sync grouping, active-node selection, socket coordinationsrc/helpers/keys.ts: passphrase hashing, ADM keypair derivation, ADM address creationsrc/helpers/encryptor.ts: message encryption and decryptionsrc/helpers/transactions/*: transaction creation, hashing, signing, and IDssrc/helpers/wsClient.ts: Socket.IO subscriptions for incoming transactionssrc/coins/*.ts: BTC, ETH, LSK, DASH, and DOGE wallet helpers
- Never log passphrases, mnemonic seeds, private keys, decrypted payloads, or sensitive tokens
- Never weaken key derivation, encryption, signature generation, or transaction hashing behavior
- Never change transaction byte layout, IDs, or signature semantics without explicit coordinated protocol work
- Validate external inputs before using them in network requests, signing, or wallet generation
- Minimize new dependencies, especially cryptography and networking dependencies
- Do not hand-edit
src/api/generated.tsfor routine changes when regeneration from schema is the correct path
- Do not hardcode a single node as the only viable path
- Preserve health-check behavior, retry logic, and active-node switching unless the task explicitly changes them
- Keep node selection compatible with height-based sync checks and socket support filtering
- Fail safely on malformed data, timeouts, and partial node outages
- Prefer clear returned errors and logs over silent failure
For code changes, baseline validation is:
npm run compilenpm testnpm run lint
Additional repository-specific expectations:
- Add or update tests near the changed behavior in collocated
testsdirectories - If you change generated API types, regenerate from
adamant-schema, then run compile and tests - For docs-only changes, say explicitly that runtime tests were not run
- Prefer focused patches over broad rewrites
- Match local file style unless there is a strong reason to change it
- Preserve public exports and backward-compatible behavior where possible
- Update docs when behavior or workflow changes
- When a CLI tool accepts multi-line input, prefer a temporary file in
.ai-ignored/
A change is not complete until all of the following are true:
- Security-sensitive behavior is preserved or intentionally documented
- Relevant validation commands were run or an explicit blocker was reported
- Documentation was updated when behavior or workflow changed
- No secret exposure or single-point-of-failure regression was introduced