hackquest logo

Companeon

A personal conversational AI agent for your wallet

Videos

Pila tecnológica

Next
Web3
Ethers
Node

Descripción

Companeon — A personal AI agent for your wallet

A wallet-native AI agent that turns conversational intent into safe, on-chain execution.

Just say what you want, and the agent handles the rest.


The Problem

Crypto wallet management is overly manual and fragmented.

To complete simple tasks, users must navigate multiple apps, interpret gas fees, understand transaction data, and manage permissions — often without clear explanations or feedback.

Automation tools promise convenience, but typically require users to:

  • Move funds into new systems

  • Grant sweeping permissions

  • Trust untested smart contracts

Users are forced to choose between manual complexity or unsafe automation with no middle ground.


Our Solution

Companeon introduces a prompt-driven, wallet-native AI agent that lets users interact with their crypto wallet through natural conversation.

Users issue plain-English prompts to:

  • Execute actions (transfers, swaps, x402 payments)

  • Or simply gain insight (balances, activity, limits, history)

All execution happens through ERC-7715 delegated permissions enforced by MetaMask, keeping custody, limits, and enforcement inside the wallet.
Envio provides real-time blockchain context and a verifiable audit trail of all agent actions.

The result is a wallet-native AI agent that can act, explain, and adapt — without custody, proprietary execution contracts, or dangerous approvals.


How It Works

  1. Users grant explicit, time-bound ERC-7715 permissions

  2. Permissions are scoped, revocable, and enforced on-chain

  3. Users interact through natural conversation

  4. The agent interprets intent and plans actions using tools

  5. Execution occurs only within wallet-enforced constraints


What You Can Do

Wallet Insights

  • “What are my balances and total USD value?”

  • “What happened in my wallet today?”

  • “How much can my agent still spend?”

Execution (within limits)

  • “Send 50 USDC to vitalik.eth”

  • “Swap 2 ETH to USDC using fast gas”

  • “Reduce the amount to fit my daily limit”

Safety & Transparency

  • “Why did my last transfer fail?”

  • “Have I sent to this address before?”

  • “What actions has my agent taken this week?”

Autonomous & Scheduled Actions (Agent-to-Agent)

  • “Send 0.5 USDC to vitalik.eth every week”

  • “DCA 100 dollars of ETH every month”


Core Features

Wallet-Enforced Autonomy (Advanced Permissions)

  • Executes transactions via ERC-7715 delegation enforced by MetaMask

  • No custody, no vaults, no proprietary execution contracts

  • Token-level, time-bound spending rules with instant revocation

  • Permission-aware state queries (remaining spend, reset timing, expiry)

Agentic Intelligence (Reasoning + Tool Chaining)

  • LLM-powered multi-step reasoning (ReAct loop)

  • Autonomous tool chaining and transactions (swaps, web browsing, transfers, gas, prices, security, history, etc)

  • Conversational and context-aware orchestration through a familiar chat interface

  • Automatic error recovery with plain-English explanations and actionable suggestions

Agent-to-Agent (A2A) Delegation & Automation

  • Enables automated agents (Transfer, DCA) using chained ERC-7715 delegations

  • Companeon can re-delegate a subset of permissions to specialized agents

  • Each agent operates with its own independent execution key

  • All executions are validated on-chain by MetaMask’s DelegationManager

  • Revoking the parent permission instantly disables all sub-agents

Full Wallet Operations

  • Transfers: ETH + any ERC-20

  • Swaps: Uniswap v4 Universal Router

  • Balances: Real-time portfolio with USD conversions

  • History: Full wallet history via Envio

x402 Integration (Paid Agent Tools)

  • Access to Perplexity Web Search, Image generation, and other paid APIs

  • USDC micropayments settled autonomously through agent

  • All payments executed under the same ERC-7715 constraints + audit trail


ERC-7715 Advanced Permissions Integration (MetaMask)

Companeon is built entirely on ERC-7715 delegated permissions using the MetaMask Smart Accounts Kit. Transfers, swaps, and x402 payments are executed through MetaMask’s DelegationManager and enforced directly by the user’s wallet.

There is no custody, no execution vault, and no proprietary smart contracts. All enforcement happens on-chain and remains wallet-native.

Permission model

Companeon uses two ERC-7715 permission types:

  • native-token-periodic for ETH transfers with independent limits

  • erc20-token-periodic for ERC-20 transfers such as USDC

Each token operates within its own permission context, allowing the agent to correctly route ETH and ERC-20 executions through the appropriate enforcers.

What each permission includes

Every delegation created by the user is explicit and human-readable. It defines:

  • A spending limit per period (for example, 1 ETH per day or 10 USDC per hour)

  • A period duration (hourly, daily, weekly, monthly, or yearly)

  • A start time

  • An expiration date

  • A justification string (such as “AI agent autonomous wallet operations”)

Permissions can be revoked instantly at any time.

Smart account upgrade (EOA → ERC-7702)

If the user begins with an EOA, Companeon performs a one-time upgrade to an ERC-7702 smart account using MetaMask Smart Accounts Kit. The user keeps full ownership of their wallet and keys.


Agent-to-Agent Delegation (ERC-7715 Re-Delegation)

Companeon uses ERC-7715’s authority chaining model to support agent-to-agent delegation.

A typical delegation flow looks like:

User Smart Account
  └─ Delegation → Companeon (conversational agent)
        └─ Sub-delegation → Specialized Agent (transfer / DCA)

Each sub-delegation:

  • References the hash of the parent delegation as its authority

  • Enforces equal or stricter limits than the parent

  • Is validated on-chain by MetaMask’s DelegationManager at execution time

Autonomous agents execute using their own keys, but must present the full delegation chain during execution. If the user revokes the original permission, all sub-delegations become invalid automatically.

This allows Companeon to support safe automation without introducing custody, execution vaults, or privileged contracts.


Permission-Aware Agent (MetaMask SDK Wrapped)

Instead of treating permissions as static guardrails, Companeon exposes live permission state directly to the agent as callable tools.

MetaMask Smart Accounts Kit functionality is wrapped so the LLM can read, reason about, and adapt to real permission constraints in real time.

  1. check_delegation_limits

This is a single agent tool call that returns a complete snapshot of all active ERC-7715 permissions using real on-chain data, not simulations or estimates.

Under the hood, one call orchestrates multiple official MetaMask SDK methods in sequence:

  • createCaveatEnforcerClient()
    Creates a client for interacting with ERC-7715 enforcer contracts

  • getSmartAccountsEnvironment()
    Loads chain configuration and DelegationManager addresses

  • decodeDelegations()
    Decodes stored permission contexts from the delegation

  • getNativeTokenPeriodTransferEnforcerAvailableAmount()
    Reads the actual remaining ETH allowance and reset timing

  • getErc20PeriodTransferEnforcerAvailableAmount()
    Reads the actual remaining ERC-20 allowance and reset timing for each token

  • decodeExpirationFromDelegation() (custom helper)
    Parses TimestampEnforcer caveats to extract expiration dates

From this single call, the agent learns:

  • Remaining ETH allowance

  • Remaining ERC-20 allowances by token

  • When each limit resets

  • When permissions expire

  • Which permission context applies to the current action

This allows the agent to proactively explain constraints before execution, for example:

“You have 0.5 ETH remaining today. Your limit resets in 3 hours.”
“Only 1.5 USDC is available under your current permission.”


  1. diagnose_delegation_error

When a delegated execution fails, the DelegationManager emits low-level enforcer revert messages.

This tool is a custom error interpreter that analyzes those real error strings and maps them to clear explanations.

Examples include:

  • NativeTokenPeriodTransferEnforcer:transfer-amount-exceeded

  • ERC20PeriodTransferEnforcer:transfer-amount-exceeded

  • Timestamp expiration failures

  • Scope or context violations

Instead of surfacing cryptic errors, Companeon explains what went wrong and suggests concrete next steps, such as reducing the amount, waiting for the reset, or extending the permission.


Why this matters

Together, these tools allow the Companeon agent to:

  • Predict failures before execution

  • Explain failures after execution

  • Adapt its behavior within wallet-enforced constraints

Permissions are not just safety rails. They become part of the conversation.


Envio Integration — Agent-Native Blockchain Intelligence

Companeon integrates Envio HyperSync directly into the agent runtime, exposing blockchain history and context as callable tools instead of dashboards, explorers, or background indexers.

Rather than returning raw logs or transaction hashes, Envio data is queried, structured, and interpreted by the agent so users can ask natural questions and receive clear explanations.

How Envio is used

Companeon uses Envio HyperSync’s /query endpoint as the single low-level primitive for all blockchain intelligence.

All Envio-wrapped agent tools are built on top of this endpoint. They differ only in the type of data queried, the filters applied, and how results are aggregated and interpreted.

This avoids RPC polling, custom indexers, or bespoke subgraphs.

Base endpoint

POST https://sepolia.hypersync.xyz/query

Common characteristics

  • Queries real on-chain logs and transactions

  • Uses selective field extraction for minimal payloads

  • Executes parallel queries when needed (ETH + ERC-20)

  • ~2000× faster than standard RPC


Envio-Wrapped Agent Tools

Each Envio tool is a single agent-level call that orchestrates one or more HyperSync queries and returns a meaningful snapshot of wallet state that the agent can reason over in natural language.

envio_get_recent_activity

  • Aggregates ETH + ERC-20 activity over a time window

  • Returns incoming/outgoing totals, net flow, transaction counts

envio_get_token_transfers

  • Queries ERC-20 Transfer event logs for a wallet

  • Returns token, amount, timestamp, counterparty

envio_get_eth_transfers

  • Queries native ETH transactions for a wallet

  • Returns value, timestamp, counterparty

envio_get_all_transfers

  • Runs ERC-20 log query + native ETH transaction query in parallel

  • Returns unified, timestamp-ordered transfer timeline

envio_count_wallet_transactions

  • Runs minimal ERC-20 log queries optimized for counting

  • Returns transaction counts and usage trends

envio_get_delegation_executions

  • Queries RedeemedDelegation events from DelegationManager

  • Returns when ERC-7715 permissions were redeemed and by whom

envio_get_subdelegation_activity

  • Filters RedeemedDelegation events by known autonomous agent addresses

  • Returns A2A execution history with agent name, timestamp, tx hash

envio_check_recipient

  • Queries historical ETH + ERC-20 interactions with a recipient

  • Returns first-time vs historical interaction and transfer frequency


Why this matters

Together, these Envio tools allow the Companeon agent to:

  • Recall and summarize wallet history on demand

  • Explain past actions with verifiable on-chain evidence

  • Reason about future actions using historical and security context

Envio turns raw blockchain data into agent memory, making Companeon a context-aware, auditable, wallet-native agent runtime rather than a dashboard or analytics tool.


Registered Tool List (Agent Tools)

Category

Tools

Description

Wallet

get_holdings, get_token_balance

Complete portfolio view and individual token balances with USD values

Transfers

preview_transfer, transfer_funds

ETH and ERC-20 transfers with preview, simulation, and gas breakdown

Swaps

get_swap_quote, execute_swap, check_pool_liquidity

Uniswap v4 Universal Router swaps with quotes, execution, and liquidity checks

Gas

get_gas_price, estimate_gas_cost

Real-time gas prices and transaction fee estimation

Security

goplus_check_address, envio_check_recipient

Address risk analysis and prior wallet interaction checks

Permissions

check_delegation_limits, diagnose_delegation_error

ERC-7715 limits, remaining spend, reset timing, expiry, and human-readable failure explanations

History (Envio)

envio_get_token_transfers, envio_get_eth_transfers, envio_get_all_transfers, envio_get_recent_activity, envio_count_wallet_transactions, envio_get_delegation_executions, envio_get_subdelegation_activity

HyperSync-powered wallet history, Companeon execution audit trail, and A2A sub-delegation activity

A2A – DCA Agent

schedule_dca, list_dca_schedules, pause_dca, resume_dca, cancel_dca

Create, manage, pause, resume, and cancel automated dollar-cost averaging schedules

A2A – Transfer Agent

preview_recurring_transfer, schedule_recurring_transfer, list_recurring_transfers, cancel_recurring_transfer

Preview, create, view, and cancel recurring transfer schedules

A2A – Management

list_all_scheduled, trigger_scheduled_now

View all autonomous tasks and manually trigger scheduled executions

x402 Payments

get_x402_quote, list_x402_services, pay_x402, request_x402_refund

USDC micropayment quotes, execution, service discovery, and refunds

x402 Services

browse_web, web_research, generate_image, onchain_analytics

Paid agent services accessed via x402 (Perplexity, image generation, analytics)


Tech Stack

Layer

Technology

Purpose

Frontend

Next.js

Conversational UI + wallet connection

Agent Runtime

Google Gemini 2.5 Pro

Intent reasoning + tool orchestration

Wallet Permissions

MetaMask Smart Accounts Kit (ERC-7715)

Wallet-native enforcement

Blockchain Intelligence

Envio HyperSync

History, context, audit trail

Backend Hosting

Google Cloud Run

Agent runtime + orchestration

Progreso del hackathon

Built a complete ERC-7715 conversational wallet agent with 40 tools, ReAct reasoning loop, and real on-chain execution. Features Envio HyperSync for 2000x faster blockchain queries, GoPlus security integration, x402 micropayments, subdelegation (A2A) automation, and live Sepolia testnet demo. Agent executes transfers, swaps, and API calls while maintaining zero custody through MetaMask delegation.

Estado de recaudación de fondos

None, open to fundraising
Líder del equipo
RRichard Chung
Enlace del proyecto
Sector
DeFiAIInfra