Skip to content

feat(workflows): Create Camelot liquidity management agent#308

Draft
0xTomDaniel wants to merge 31 commits intonextfrom
feat/camelot-clmm-agent
Draft

feat(workflows): Create Camelot liquidity management agent#308
0xTomDaniel wants to merge 31 commits intonextfrom
feat/camelot-clmm-agent

Conversation

@0xTomDaniel
Copy link
Contributor

@0xTomDaniel 0xTomDaniel commented Nov 19, 2025

Summary

Create a new Camelot CLMM agent in a workflow.

Changes

  • replace delegation toolkit + bundler path with viem wallet clients and operator input schema updates
  • enhance pool data enrichment, decision logic, and execution telemetry, plus add targeted unit/e2e coverage
  • document and expose workflow demo + manual withdrawal scripts in the CLI package

Testing

  • Unit tests pass
  • Integration tests pass
  • Manual testing completed

Related Issues

Closes #

Notes

initialize concentrated liquidity management agent template with:
- agent card configuration for A2A protocol
- skills for general assistance and onchain actions
- MCP server registry for external tool integrations
- workflow plugin system with example workflow
- environment configuration for AI providers and wallet setup

template provides foundation for building specialized CLMM agents
that can optimize liquidity ranges on Camelot DEX
environment configuration should be managed at runtime or through
deployment configuration, not stored in template config directory
- update agent name to "Camelot Liquidity Optimizer"
- add comprehensive ERC-8004 agent identity configuration
- configure canonical operator on Arbitrum (chain 42161)
- add mirror deployments for Ethereum, Base, and Sepolia
- set identity registries for cross-chain agent resolution
- remove inline example-workflow.ts in favor of package-based workflows
- add sample-package-workflow demonstrating TypeScript package structure
- add usdai-workflow for concentrated liquidity management
- update skill configurations to reference new workflow IDs
- update workflow registry to load from package entry points
- update workflow examples to reference sample-package-workflow
- clarify packaged workflow structure and best practices
- format manifest for consistency
prevent pnpm from treating template config directories as
workspace packages to avoid dependency resolution conflicts
remove standalone usdai workflow package in favor of new
packaged workflow architecture using ERC-8004 approach
add camelot-clmm-rebalancer workflow with support for
automated liquidity position rebalancing in concentrated
liquidity market maker pools

includes:
- CLMM-specific skill documentation
- workflow implementation and configuration
- registry updates for new workflow
- set rulesync.jsonc global flag to false for local-only sync
- add sync:rules:global script for explicit global synchronization
- add template workflow test paths to include patterns
- enable unit, integration, and e2e tests within template configs
- standardize quote style to single quotes for consistency
- prohibit MSW, HTTP mocks, and recorded responses in e2e tests
- require real service/testnet endpoints for end-to-end validation
- clarify Anvil usage as target environment, not mock layer
- add non-negotiable directive that e2e tests must stay live
migrate agent from legacy Camelot-specific endpoints to Ember's
unified liquidity pool API with multi-DEX support and standardized
response schemas

- update EmberCamelotClient to consume /liquidity/pools endpoint
- add Algebra provider filter for Camelot CLMM pools
- implement USD price enrichment using pool ratios and stablecoins
- add ClmmRebalanceRequest/Response schemas for new API contract
- add ClmmWithdrawRequest schema for position withdrawals
- update types to match Ember unified position/pool response format
- remove ERC-8004 delegation dependencies from workflow
- use agent smart account directly instead of user delegations
- handle optional position fields (liquidity, tokensOwed)
- add helper functions to convert between Ember and Camelot formats
add unit, integration, and e2e tests for Ember API client and
USD price enrichment logic

- add emberApi.unit.test.ts for conversion utilities
- add usdPrices.unit.test.ts for price derivation logic
- add emberApi.e2e.test.ts for live API integration validation
- create test setup infrastructure in typescript/tests/
- tests validate Ember unified API response handling
enhance unit and e2e tests with additional validation scenarios
for pool snapshot fetching, wallet position loading, and USD
price enrichment

- add fetchPoolSnapshot helper tests for missing pool handling
- add normalizePool tests for type promotion and defaults
- expand e2e tests to validate live LP wallet position loading
- add decision engine integration tests with live pool data
- add rebalance/withdraw request construction tests
- expand USD price enrichment tests for API-provided prices
- add isUsdStableToken helper tests for case-insensitive matching
add comprehensive unit test coverage for workflow infrastructure
modules including allowance management, client setup, constants,
decision engine, and transaction execution

- add allowances.unit.test.ts for token approval flow validation
- add clients.unit.test.ts for onchain client initialization
- add constants.unit.test.ts for environment config resolution
- add decision-engine.unit.test.ts for rebalancing logic
- add transaction.unit.test.ts for execution flow validation
- add test setup infrastructure in tests/setup/vitest.setup.ts
- add vitest configuration for unit, integration, and e2e tests
- add ESLint and Prettier configuration
- add standard package.json scripts for build, test, lint, and format
- update tsconfig.json to match project standards
- add development dependencies (vitest, eslint, prettier, tsx)
previously sent approval transaction to agent account address
instead of token contract, now correctly sends to token address
- reorder imports to follow ESLint conventions
- add type-only imports where appropriate
- format code with Prettier
- fix line length and formatting issues
document workflow purpose, features, configuration, and usage
remove unused sample package after implementing CLMM agent
change web client to extract the A2A endpoint from the agent
card's url field instead of using a2a.endpoint or constructing
it from the base URL

also update configuration to use full agent card URL path
(including /.well-known/agent-card.json) rather than base URL
to eliminate URL construction logic
fix CLI to honor --port and --host flags by merging them into
the effective service config before server creation

also update terminal output to show actual agent card and A2A
endpoint URLs based on configured paths rather than hardcoded
assumptions
remove sample-package-workflow from both workflow.json and
general-assistant skill configuration as it was a placeholder
that has been replaced by the camelot-clmm-rebalancer workflow
Point testing references at the write-tests rulesync command and add the scripting conventions section so agents follow the required package script contract.
Drop the delegation toolkit + bundler path, drive allowances and all execution through a viem wallet client, and capture operator configuration directly from workflow input. Derive USD prices from pool data, gate decisions on live WETH quotes, and add helpers for token budgeting and withdrawal retries while extending the unit/e2e suites for the new behavior.
Expose workflow:demo and wallet:withdraw scripts, document usage in the README, and add standalone runners for streaming the workflow locally or manually executing withdrawal plans against live Ember data.
@0xTomDaniel 0xTomDaniel changed the title feat(workflows): run camelot workflow with agent wallet feat(workflows): Create Camelot liquidity management agent Nov 19, 2025
Add viem so the compare:camelot-midprice helper can read Algebra pool pricing and contrast Ember API quotes against onchain midprice.
Add Dockerfile and .dockerignore to package the Camelot CLMM workflow with prebuilt artifacts and runtime deps, and align the workflow lockfile for standalone installs.
Widen default tick bands and raise the rebalance threshold while
removing the idle-cycle safety net when positions stay in range.

Capture gas spend and detailed range diagnostics in telemetry entries
and summary artifacts for each cycle.

Refresh target ranges after withdrawals and cut retries to three,
simplify Ember price normalization, and update tests for new inputs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant