Guide for AI coding agents working in smartcontractkit/chainlink-local.
Chainlink Local is a developer-focused testing package that simulates Chainlink services (especially CCIP) in local and forked environments.
- Local mode (
CCIPLocalSimulator,DataStreamsLocalSimulator) lets developers test app logic quickly without waiting for live offchain systems. - Fork mode (
CCIPLocalSimulatorFork,DataStreamsLocalSimulatorFork) runs against forked networks so integrations behave closer to real testnet conditions. - The intent is parity of user app behavior between local/fork testing and testnet deployment (minus environment-specific addresses/config).
- It is available for usage in Foundry, Hardhat 3, Hardhat 2 and Remix IDE environments.
- Official documentation is available at: https://docs.chain.link/chainlink-local
- Make minimal, correct changes that preserve simulator behavior and test ergonomics.
- Prefer targeted edits and targeted tests over broad refactors.
Load files in this order and stop as soon as you have enough context:
package.json(scripts, versions, docs/release commands)foundry.tomlandhardhat.config.ts(tooling layout)- Only the relevant
src/**files and matching tests intest/** - If docs task:
helper_doc/*.mjsandapi_reference/** - If release/publish task:
.github/workflows/publish.yml
Avoid loading large/unnecessary trees unless explicitly required:
lib/**,out/**,cache/**,artifacts/**,node_modules/**
src/: production contracts by service (ccip,data-feeds,data-streams)src/test/: helper/example contracts used by teststest/smoke/: local-mode teststest/e2e/: fork-mode teststest/unit/: unit-level testsscripts/: helpers for Hardhat users that write tests using JavaScript or TypeScripthelper_doc/: docs generation scripts (you shouldn't touch these)api_reference/: generated docs output (read only; do not edit directly)
- Never edit
lib/**. If user explicitly asks, use forge for dependency management. - Never edit
node_modules/**. If user explicitly asks, use npm for dependency management. - Keep changes surgical; do not refactor unrelated code.
- Preserve test placement conventions:
- local mode ->
test/smoke/** - fork mode ->
test/e2e/**
- local mode ->
- Do not hand-edit generated docs in
api_reference/**; regenerate via scripts. - If a command fails after deleting generated docs, restore state before continuing.
- Compile:
npm run forge-compilenpm run hardhat-compile
- Test:
npm run forge-testnpm run hardhat-testforge test <path-to-test>
- Docs:
npm run generate-docs(deterministic; does not fetch Register data)npm run update-register(networked; updatessrc/ccip/Register.sol)
For the full release workflow (beta, stable, branch policy, CHANGELOG requirements), see .agent/playbooks/RELEASE_PLAYBOOK.md.
- Keep
@chainlink/contractsand@chainlink/contracts-ccipas directdependencies. - Avoid introducing new tooling dependencies unless there is a clear maintenance win.
- If bumping Chainlink packages, do not move them to
devDependenciesorpeerDependencies.
| Package | Version |
|---|---|
@chainlink/contracts-ccip |
1.6.2 |
@chainlink/contracts |
1.5.0 |
Use these commands unless a maintainer requests something different.
- Add runtime dependency:
npm install <package>@<version>
- Add dev dependency:
npm install --save-dev <package>@<version>
- Update existing dependency:
npm install <package>@<new-version>
- Verify:
- check
package.json(dependenciesvsdevDependenciesplacement) - run the smallest relevant compile/test command
- check
- Example (
@chainlink/contracts->1.2.0):npm install @chainlink/contracts@1.2.0
- Optional: pull latest submodule state first (all or specific):
forge updateforge update lib/chainlink-evm lib/chainlink-ccip
- Install/update with pinned tag:
forge install <org>/<repo>@<tag>
- For direct dependencies:
@chainlink/contractsequivalent:forge install smartcontractkit/chainlink-evm@contracts-v<version>
@chainlink/contracts-ccipequivalent:forge install smartcontractkit/chainlink-ccip@contracts-ccip-v<version>
- Historical note:
- older docs may reference
chainlink-brownie-contracts; this repo useschainlink-evm.
- older docs may reference
- After install:
- verify
lib/points to the expected tag/commit - verify npm versions in
package.json - run
forge buildand relevant tests - never edit vendored files manually inside
lib/**ornode_modules/**
- verify
Before finishing:
- Run the smallest relevant compile/test command(s).
- Regenerate docs if your change affects docs sources.
- Confirm no accidental edits in unrelated files.
- Summarize:
- what changed
- what was intentionally not touched
- any residual risk or follow-up
- Node.js
22.xis the safe default for workflow parity. - Prefer
rgfor search. - Prefer explicit, boring solutions over abstraction-heavy changes.