Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
199 commits
Select commit Hold shift + click to select a range
8b7cca8
Merge pull request #1 from OyaChat/codex/create-frontend-app-with-wal…
pemulis Jan 14, 2026
4ca1d70
Merge pull request #2 from OyaChat/codex/add-abi-jsons-and-config-module
pemulis Jan 14, 2026
1e777c7
Merge pull request #3 from OyaChat/codex/add-web-frontend-section-to-…
pemulis Jan 14, 2026
43d3e8b
npm install frontend, and git ignore node modules
pemulis Jan 15, 2026
2e2fbb6
update usdc defaults in frontend
pemulis Jan 15, 2026
70dc56e
set burn address as owner after deployment, so all txs go through og
pemulis Jan 15, 2026
e4502da
Fix Safe removal and signatures
pemulis Jan 31, 2026
254f458
Add agent scaffold and frontend env generator
pemulis Jan 31, 2026
6685c8b
forge fmt
pemulis Jan 31, 2026
411dea3
Fix OG deploy test for burn owner flow
pemulis Feb 1, 2026
41e01ea
add reasoning model recommendation to agent
pemulis Feb 1, 2026
77c79a2
add tool calling
pemulis Feb 1, 2026
da85e41
fix deposit tool build
pemulis Feb 1, 2026
bcc0964
add helper tool for constructing og proposals
pemulis Feb 1, 2026
38473f0
agent updates to logging and polling
pemulis Feb 1, 2026
e3ed55f
use ASSERT_TRUTH on Sepolia and ASSERT_TRUTH2 elsewhere
pemulis Feb 1, 2026
ee0387b
update agent and add codexignore
pemulis Feb 1, 2026
643c4ae
Bump h3 from 1.15.4 to 1.15.5 in /frontend
dependabot[bot] Feb 2, 2026
2b301d6
Bump lodash from 4.17.21 to 4.17.23 in /frontend
dependabot[bot] Feb 2, 2026
ab033c3
Bump hono from 4.11.4 to 4.11.7 in /frontend
dependabot[bot] Feb 2, 2026
c329090
add more signing and key management options
pemulis Feb 2, 2026
f877ae4
Merge pull request #4 from OyaChat/dependabot/npm_and_yarn/frontend/h…
pemulis Feb 2, 2026
64fc034
Merge pull request #5 from OyaChat/dependabot/npm_and_yarn/frontend/l…
pemulis Feb 2, 2026
835a547
Merge pull request #6 from OyaChat/dependabot/npm_and_yarn/frontend/h…
pemulis Feb 2, 2026
f60df3e
remove agent builder from frontend
pemulis Feb 2, 2026
25a6633
readme updates
pemulis Feb 2, 2026
90cc9c3
add beta disclaimer
pemulis Feb 2, 2026
c6d6aff
Update commitment definition in README
pemulis Feb 2, 2026
990a93e
Clarify offchain agent functionality and community contributions
pemulis Feb 2, 2026
221826b
document alternative signing methods
pemulis Feb 2, 2026
43fe422
add tool for disputes
pemulis Feb 3, 2026
fe58858
add tests and doc updates for disputes
pemulis Feb 3, 2026
7ae3a70
add PROPOSE_ENABLED flag
pemulis Feb 3, 2026
95efab4
add readme note about agent modes
pemulis Feb 3, 2026
87c7c4e
resolve explanation string
pemulis Feb 3, 2026
2784133
Merge pull request #7 from oyaprotocol/disputes
pemulis Feb 3, 2026
83b5c8a
rephrase natural language to plain language
pemulis Feb 3, 2026
4220900
Merge pull request #8 from oyaprotocol/plain-language
pemulis Feb 3, 2026
5027bf5
edit readme title
pemulis Feb 3, 2026
cd69bf7
Merge pull request #9 from oyaprotocol/pemulis-patch-1
pemulis Feb 3, 2026
5d8fb32
refactor agent to prepare for a multiagent library
pemulis Feb 3, 2026
bb06298
resolve AGENT_MODULE from repo root
pemulis Feb 3, 2026
dacfb0d
update the validator to resolve AGENT_MODULE relative to the repo root
pemulis Feb 3, 2026
a0cd361
update commitment.txt for example agent
pemulis Feb 3, 2026
fa08b25
loosen build_og_transactions schema to allow non-string args
pemulis Feb 3, 2026
9a9f9d4
explicitly outline types to meet OpenAI schema validation
pemulis Feb 3, 2026
a6e3857
more fixes to the schema
pemulis Feb 3, 2026
05896b8
Merge pull request #10 from oyaprotocol/agent-refactor
pemulis Feb 3, 2026
1e7cf7d
update agent readme
pemulis Feb 3, 2026
f762f6a
add timelock agent
pemulis Feb 3, 2026
00ceab2
handle batch deposits
pemulis Feb 3, 2026
528f9e2
resolve absolute timelocks and action tracking
pemulis Feb 4, 2026
f72dda4
pass timestamp to agent and address bigint serializer
pemulis Feb 4, 2026
7c71846
coerce datetime to midnight only if no time of day is present
pemulis Feb 4, 2026
a43cc9d
improve agent module loader
pemulis Feb 4, 2026
cfda546
Merge pull request #11 from oyaprotocol/transfer-agent
pemulis Feb 4, 2026
56d3484
add agent registration files for existing agents
pemulis Feb 4, 2026
56d827d
helper script to update the ERC‑8004 metadata after registration
pemulis Feb 4, 2026
0272071
add agent registry script
pemulis Feb 4, 2026
f26933b
improve agent registration script
pemulis Feb 4, 2026
6e780ea
address review comments
pemulis Feb 4, 2026
6a9d6f7
normalize agent directory file paths
pemulis Feb 4, 2026
05aad98
add support for more chains for erc-8004
pemulis Feb 4, 2026
6d43958
improve handling of env variables and directory resolution
pemulis Feb 4, 2026
910d92a
store agentId as a string rather than a number in metadata, to avoid …
pemulis Feb 4, 2026
4596495
Merge pull request #12 from oyaprotocol/erc-8004
pemulis Feb 4, 2026
2d7882b
update og identifier check on sepolia to ASSERT_TRUTH2
pemulis Feb 5, 2026
80d38c2
Merge pull request #13 from oyaprotocol/identifier-check
pemulis Feb 5, 2026
2788785
readme refactor
pemulis Feb 5, 2026
ddbb54e
don't gitignore docs
pemulis Feb 5, 2026
fea6210
Merge pull request #14 from oyaprotocol/readme-update
pemulis Feb 5, 2026
4b0bc77
re implement DCA agent on top of latest changes
dkuthoore Feb 5, 2026
1b46224
bug fixes, and reset DCA state when proposal is executed
dkuthoore Feb 5, 2026
12be462
working state! Add pendingProposal signal to prevent duplicate DCA pr…
dkuthoore Feb 5, 2026
bc564d5
on proposal execution, reset time since DCA, increment cycle count
dkuthoore Feb 5, 2026
8e627e5
Track proposal submission status and reset on failure or timeout
dkuthoore Feb 5, 2026
2c0ae71
add contributor guidelines and docs
pemulis Feb 6, 2026
374c114
remove github workflow job
pemulis Feb 6, 2026
69952a3
remove pull request template
pemulis Feb 6, 2026
411ac95
Merge pull request #16 from oyaprotocol/contributor-guidelines
pemulis Feb 6, 2026
063e008
add commitment writing skill
pemulis Feb 6, 2026
7db01b1
update codex instructions for skill installation
pemulis Feb 6, 2026
2713db8
remove skill reference from CONTRIBUTING
pemulis Feb 6, 2026
b64cc9a
Merge pull request #17 from oyaprotocol/skill-md
pemulis Feb 6, 2026
9da7d6c
add scaffolding for price-race-swap commitment
pemulis Feb 6, 2026
1a88a54
add tooling for price-triggered swaps
pemulis Feb 6, 2026
1637c24
don't use JSON with price triggers, parse from commitment
pemulis Feb 6, 2026
06c4141
use plain language in commitment
pemulis Feb 6, 2026
821c12c
target UNI instead of UMA as second asset
pemulis Feb 6, 2026
a57ddde
use uni and weth uniswap pools on sepolia
pemulis Feb 6, 2026
8b9853f
rename price.js to uniswapV3Price.js to be specific
pemulis Feb 6, 2026
20c1ffd
Merge remote-tracking branch 'origin/main' into dca-agent
dkuthoore Feb 9, 2026
70bf586
Move DCA policy and runtime state from shared runner into dca-agent m…
dkuthoore Feb 9, 2026
21c1b46
Move DCA signals out of shared runner into dca-agent module hook
dkuthoore Feb 9, 2026
9dc1edd
Remove DCA-specific branching from shared file by using generic modul…
dkuthoore Feb 9, 2026
b3d0bf7
add viem to agent library dependencies
dkuthoore Feb 9, 2026
0c2b01a
Merge pull request #15 from dkuthoore/dca-agent
pemulis Feb 9, 2026
0e34567
Merge branch 'main' into new-commitments
pemulis Feb 9, 2026
70a58c3
remove regex detection of triggers and tokens and add some lightweigh…
pemulis Feb 9, 2026
740c757
remove commitment-specific functionality from shared files
pemulis Feb 9, 2026
37796d7
improve tooling, single-fire persistence, local agent code isolation,…
pemulis Feb 9, 2026
11f82ab
fix weth address for sepolia in commitment
pemulis Feb 10, 2026
19fd1ac
update uniswap script to specify high-liquidity pool instead of hardc…
pemulis Feb 10, 2026
0d0e7d8
fix some sepolia addresses in uniswap commitment
pemulis Feb 10, 2026
ada18eb
allow multiple price signal triggers for uniswap commitment
pemulis Feb 10, 2026
0651b93
infer active price triggers in uniswap commitment
pemulis Feb 10, 2026
8574fcd
check balances every cycle
pemulis Feb 10, 2026
16f40eb
attempt some fixes for address polling
pemulis Feb 10, 2026
361ff30
allow model to act based only on price signals, and pass balance snap…
pemulis Feb 10, 2026
e2163ef
set build_og_transactions strictness to false, since different og tra…
pemulis Feb 10, 2026
e364a35
patch explainToolCalls to exclude synthetic outputs
pemulis Feb 10, 2026
e067c3c
remove single-fire state logic
pemulis Feb 10, 2026
022d392
update sepolia swap router
pemulis Feb 10, 2026
8b91e45
pin validation test to Sepolia swap router address
pemulis Feb 10, 2026
f43db74
add single-fire lock implementation back in
pemulis Feb 10, 2026
7e91373
codex ignore agent/.env
pemulis Feb 10, 2026
f7242a6
try using multiple uniswap quoter options
pemulis Feb 10, 2026
ed623bd
execute pending proposals before making new proposals
pemulis Feb 10, 2026
95fab4e
enforce swapping full balance
pemulis Feb 10, 2026
fe46c27
track assets with lowercase addresses
pemulis Feb 10, 2026
c566d77
prevent delegatecall in uniswap agent
pemulis Feb 10, 2026
27c5530
single-fire lock only when proposal hash is not empty (proposal submi…
pemulis Feb 10, 2026
37e67ca
only run decision logic when asset balance has changed
pemulis Feb 10, 2026
6b1050d
only apply the winning price trigger
pemulis Feb 10, 2026
40bcc30
price-race-swap no longer requires a same-cycle erc20BalanceSnapshot …
pemulis Feb 10, 2026
53c4b9e
Treat rejected tool calls as no-op, not successful decision
pemulis Feb 10, 2026
1525909
add error handling per trigger
pemulis Feb 10, 2026
c4c2ed6
separated balance snapshots from the deposit stream so timelock ancho…
pemulis Feb 10, 2026
93d3fca
fix false zero-balance snapshots after startup and misleading executi…
pemulis Feb 10, 2026
55cf65f
additional fixes for price race swap agent
pemulis Feb 10, 2026
0f0a579
collectAssetBalanceChangeSignals now skips zero-balance snapshots on …
pemulis Feb 10, 2026
51e007f
malformed-trigger handling in agent/src/lib/uniswapV3Price.js
pemulis Feb 10, 2026
d1b1433
Merge pull request #18 from oyaprotocol/new-commitments
pemulis Feb 10, 2026
8c88dc4
add polymarket shared library and support in the shared agent files, …
pemulis Feb 10, 2026
2c75967
Merge branch 'main' into polymarket-support
pemulis Feb 10, 2026
50d3911
no need to check chainId when building OG transactions
pemulis Feb 10, 2026
6b2d2ee
add back support for monitoring mode
pemulis Feb 10, 2026
a4f1af1
replace raw secret forwarding with per-request HMAC signature generation
pemulis Feb 10, 2026
7ae2425
add strict preflight validation for clob orders
pemulis Feb 10, 2026
8a506d2
auto-approve tokens before splitPosition function call
pemulis Feb 10, 2026
9710ef1
update polymarket_clob_place_order in agent/src/lib/tools.js to norma…
pemulis Feb 10, 2026
bf2b1f7
unwrap signed order inputs before submitting
pemulis Feb 10, 2026
00620b8
patch to pass api key owner as owner, not an address, for clob orders…
pemulis Feb 10, 2026
cc927a0
fix timestamp handling per polymarket docs
pemulis Feb 10, 2026
d3d8433
enable clob-only agent mode and fix schema for order types
pemulis Feb 10, 2026
cefb0f2
add unit test for normalizing order types and cancel mode for polymarket
pemulis Feb 10, 2026
885bd21
add erc-1155 support
pemulis Feb 10, 2026
103611a
polymarket transaction patches
pemulis Feb 10, 2026
2794e15
gate onchain tools behind explicit flags
pemulis Feb 10, 2026
448eb4a
add timeout/retry guard for clob requests and relax cancel schema req…
pemulis Feb 10, 2026
542d141
do not allow delegatecall operations for ctf transactions
pemulis Feb 10, 2026
443c3ba
decouple clob identity from runtime signer
pemulis Feb 10, 2026
78d3c57
do not retry orders
pemulis Feb 10, 2026
1ac4e19
check that all addresses are allowed in a multi-address order
pemulis Feb 11, 2026
a9636aa
add polymarket tooling documentation
pemulis Feb 11, 2026
fa52363
register dca agent
dkuthoore Feb 11, 2026
440bdb8
create limit order agent and commitment
dkuthoore Feb 11, 2026
3493fb6
Implement limit-order agent with Chainlink price, enrichSignals, and …
dkuthoore Feb 11, 2026
e33754e
Add test-limit-order-agent.mjs and simulate-limit-order.mjs
dkuthoore Feb 11, 2026
9a56817
modify commitment text
dkuthoore Feb 11, 2026
fbd54df
add an additional limit order agent based on a tecnical indicator, 20…
dkuthoore Feb 12, 2026
ab4d514
Merge pull request #19 from oyaprotocol/polymarket-support
pemulis Feb 12, 2026
62aa0d6
Guard proposal state updates behind real submission hash in limit-ord…
dkuthoore Feb 12, 2026
6cf4b0b
Persist single-fire order state across restarts by fetching from opti…
dkuthoore Feb 12, 2026
952462e
Prefer validated parsedArguments over original call.arguments when bu…
dkuthoore Feb 12, 2026
7b9b7b9
Merge pull request #20 from dkuthoore/dk/limitOrder
pemulis Feb 12, 2026
1753e90
add copy trading agent and support for shared CLOB runtime signing su…
pemulis Feb 12, 2026
455caf9
preserve triggering trade snapshot for order sizing, and clear active…
pemulis Feb 13, 2026
daf3265
Track OG proposal hash, not transaction hash
pemulis Feb 13, 2026
c067190
serialize validated arguments before returning tool calls, and requir…
pemulis Feb 13, 2026
b2391e8
Merge branch 'main' into copy-trading
pemulis Feb 13, 2026
7d788ee
avoid wedging state on failed reimbursement submission, return latest…
pemulis Feb 13, 2026
3719c63
reset pending reimbursement after unresolved submission, and keep pro…
pemulis Feb 13, 2026
9f9ceb8
reimburse full amount of funds in the commitment to agent after trade…
pemulis Feb 13, 2026
039eb1d
implement orderId tracking and fill confirmation
pemulis Feb 13, 2026
a094b7d
remove unused function in copy trading agent and use shared helper fu…
pemulis Feb 13, 2026
6c6f95d
move some polymarket consts into the shared library
pemulis Feb 13, 2026
baafdd2
refactor to use viem abis
pemulis Feb 13, 2026
54cea82
dedupe normalizer functions
pemulis Feb 13, 2026
99bca42
move a few functions into the shared library from the copy trading agent
pemulis Feb 13, 2026
2195058
update copy trading agent entry in the agent library readme
pemulis Feb 13, 2026
a36ee89
do not set orderSubmitted to true without an order ID
pemulis Feb 13, 2026
4a31878
use polymarket relayer infrastructure and safe wallets for gasless tr…
pemulis Feb 13, 2026
b21e923
implement a full relayer-client integration for polymarket
pemulis Feb 13, 2026
c6d79d3
address some issues in the polymarket safe proxy relayer infrastructu…
pemulis Feb 13, 2026
6b41d2d
fix more polymarket relayer issues
pemulis Feb 13, 2026
4a47334
another fix
pemulis Feb 13, 2026
f9e33ca
clob settlement wallet and relayer deposit wallet should be the same …
pemulis Feb 13, 2026
0cf6f52
allow disputes even if clob and relayer wallets are not aligned
pemulis Feb 13, 2026
f8c93a4
address possible error text issue
pemulis Feb 13, 2026
8f2e913
avoid blocking disputes due to a wallet mismatch error
pemulis Feb 13, 2026
009cc94
resolve potential issue of an invalid fallback to eoa when in safe re…
pemulis Feb 13, 2026
8a50a0b
more fixes for safe relayer implementation
pemulis Feb 13, 2026
569aeec
resolve a test gap
pemulis Feb 14, 2026
4f15bc2
Merge pull request #21 from oyaprotocol/copy-trading
pemulis Feb 15, 2026
b0a46eb
Validate limit price in validateToolCalls before approving swap propo…
dkuthoore Feb 17, 2026
ccb19d6
Validate limit price vs sma in validateToolCalls before approving swa…
dkuthoore Feb 17, 2026
49700c5
Defer hydration lock until ProposalExecuted log fetch succeeds in lim…
dkuthoore Feb 17, 2026
eb6bcfb
Add SMA and price validity guard in limit-order-sma validateToolCalls
dkuthoore Feb 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .codexignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.env
.env.*
**/*.env**/*.env.*
agent/.env
14 changes: 13 additions & 1 deletion .env.mainnet.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# Fork source
MAINNET_RPC_URL=...

# Deployer
# Deployer (use DEPLOYER_PK directly or resolve it at runtime via agent/with-signer.mjs)
DEPLOYER_PK=0x...

# Optional signer resolution (used with agent/with-signer.mjs)
# SIGNER_TYPE=env
# PRIVATE_KEY=0x...
# KEYSTORE_PATH=./keys/deployer.json
# KEYSTORE_PASSWORD=...
# KEYCHAIN_SERVICE=og-deployer
# KEYCHAIN_ACCOUNT=deployer
# VAULT_ADDR=https://vault.example.com
# VAULT_TOKEN=...
# VAULT_SECRET_PATH=secret/data/og-deployer
# VAULT_SECRET_KEY=private_key

# Optimistic Governor config
OG_COLLATERAL=0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
OG_BOND_AMOUNT=250000000
Expand Down
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ out/
/broadcast/**/dry-run/
/broadcast/*

# Docs
docs/

# Dotenv file
.env
.env.mainnet
.env.sepolia
agent/.env

# Anvil files
anvil.log
anvil.pid
anvil.pid

# Node modules
node_modules
frontend/node_modules
agent/node_modules
23 changes: 23 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
# Repository Guidelines

## Documentation Hierarchy
- Keep contribution guidance in both human docs and machine-readable instructions.
- `AGENTS.md`: normative instructions for coding agents and automation.
- `README.md`: architecture, intent, and operational context for humans.
- `CONTRIBUTING.md`: shared contributor workflow and policy across the repo.
- `skills/add-agent-commitment/SKILL.md`: reusable workflow for adding new agent/commitment combos.
- Precedence when instructions conflict:
1. Closest file to the changed code path wins.
2. `AGENTS.md` is authoritative for agent behavior.
3. Root-level files apply unless overridden by a closer area-level file.

## Project Structure & Module Organization
- **`src/`**: Core Solidity contracts (e.g., `Counter.sol`). Keep new modules grouped by domain and include SPDX + pragma headers.
- **`script/`**: Deployment and automation scripts (e.g., `Counter.s.sol`, `DeploySafeWithOptimisticGovernor.s.sol`). Favor reusable helpers and parameterize via environment variables.
- **`test/`**: Forge tests using `forge-std`’s `Test` base. Mirror contract names (`<Name>.t.sol`) and co-locate fixtures with the subject under test.
- **`lib/`**: External dependencies (currently `forge-std`) managed through Foundry.
- **`agent/`**: Shared offchain runner, signer integrations, and reusable tooling.
- **`agent-library/`**: Agent-specific implementations under `agent-library/agents/<name>/`.

## Build, Test, and Development Commands
- `forge build`: Compile all contracts.
Expand All @@ -20,12 +33,22 @@
- Keep files focused and small; prefer internal helpers over inline duplication.
- Run `forge fmt` to enforce style; include SPDX identifiers and explicit visibility where practical.
- Use descriptive variable names (avoid single letters outside of loop counters or hashes).
- For Node.js code in `agent/` and `agent-library/`, keep modules small and isolate side effects at the edges.

## Agent Locality Rule
- New functionality for a specific agent must be implemented in that agent's own files under `agent-library/agents/<agent-name>/`.
- Do not add agent-specific behavior to shared generalized files in `agent/src/lib/` or `agent/src/index.js`.
- Shared generalized files should only change when:
1. The change is required for multiple agents.
2. The change fixes a bug in shared infrastructure.
- If a pull request changes shared generalized agent files, include a brief cross-agent rationale in the PR description and link impacted agents.

## Testing Guidelines
- Use `forge-std/Test` utilities for assertions, fuzzing (`testFuzz_*`), and logging.
- Name tests with behavior-first patterns (`test_IncrementsCounter`, `testFuzz_SetNumberMaintainsState`).
- Cover success, failure, and access-control paths; add revert expectation tests when changing critical flows.
- When modifying gas-sensitive code, refresh `forge snapshot` and include notes in PRs.
- For `agent-library` changes, run the relevant agent test/simulation scripts and note commands in the PR.

## Commit & Pull Request Guidelines
- Write imperative, concise commit messages (e.g., "Add OG deployment script"); group related changes together.
Expand Down
47 changes: 47 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Contributing

This repository uses two kinds of contribution guidance:

- `AGENTS.md` for machine-targeted, normative instructions.
- `README.md` for human-oriented architecture and workflow context.

## Precedence Rules

When instructions conflict:

1. The closest file to the code you are editing wins.
2. `AGENTS.md` is authoritative for agent behavior.
3. Root-level guidance applies when there is no closer override.

## Directory Guidance

- `src/`, `script/`, `test/`: Solidity contracts, scripts, and tests.
- `agent/`: shared offchain runner and reusable agent infrastructure.
- `agent-library/agents/<name>/`: agent-specific implementations.
- `docs/`: operational and architecture docs.

## Required Contributor Workflow

1. Read relevant local docs before editing (`AGENTS.md`, `README.md`).
2. Keep changes scoped to the correct area.
Agent-specific behavior belongs in `agent-library/agents/<name>/`.
Shared runner changes in `agent/` require cross-agent justification.
3. Run the minimum required checks.
Solidity changes: `forge fmt`, `forge test`.
Agent changes: relevant module tests/simulations.
4. In PRs, document:
What changed and why.
Tests run.
Any config or environment variable impacts.

## Agent Extension Policy

New agent behavior must be added to that agent's own library files instead of shared generalized files.

- Preferred location: `agent-library/agents/<agent-name>/agent.js` and related files in that directory.
- Shared files such as `agent/src/lib/*` and `agent/src/index.js` should only change for multi-agent abstractions or shared bug fixes.
- If shared files are changed, the PR must include:
Why an agent-local implementation was insufficient.
Which existing agents are impacted.

See `docs/agent-extension-guidelines.md` for the decision framework and examples.
197 changes: 29 additions & 168 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
## OG Deployer
# Oya Commitments

Command-line tooling for deploying onchain Commitments: a Safe with an Optimistic Governor module configured with natural language rules. Use it to spin up a new Safe, connect the Optimistic Governor module, and set the rules/bond/collateral in one script run.
Oya Commitments are Safe-based commitments controlled by plain-language rules and enforced via an Optimistic Governor module. This repo contains the Solidity contracts, deployment scripts, an optional web UI, and an offchain agent scaffold.

## What This Repo Does
## Beta Disclaimer

- Deploys a Safe and the Optimistic Governor module in one flow.
- Encodes natural language rules into the module configuration.
- Supports env-var overrides for Safe and OG parameters.
- Uses Foundry for scripting, testing, and deployments.
This is beta software provided “as is.” Use at your own risk. No guarantees of safety, correctness, or fitness for any purpose.

## How It Works (At a Glance)

- Write plain-language rules that define what the commitment may do.
- Deploy a Safe wired to an Optimistic Governor module with those rules.
- An agent or user proposes transactions via the module and posts a bond.
- If no challenge occurs during the window, the proposal is executed by the Safe.

## Quick Start

1. Install Foundry: https://book.getfoundry.sh/
2. Set environment variables in your shell or `.env` file (load via `direnv` or `dotenvx` if desired).
3. Run the deployment script.
2. Set required environment variables (see `docs/deployment.md`).
3. Run the deployment script:

```shell
forge script script/DeploySafeWithOptimisticGovernor.s.sol:DeploySafeWithOptimisticGovernor \
Expand All @@ -22,165 +26,22 @@ forge script script/DeploySafeWithOptimisticGovernor.s.sol:DeploySafeWithOptimis
--private-key <your_private_key>
```

## Required Environment Variables

- `DEPLOYER_PK`: Private key for the deployer.
- `OG_COLLATERAL`: Address of the ERC20 collateral token.
- `OG_BOND_AMOUNT`: Bond amount for challenges.
- `OG_RULES`: Natural language rules for the commitment.

## Optional Overrides

- `SAFE_SALT_NONCE`, `SAFE_THRESHOLD`, `SAFE_OWNERS`
- `OG_SALT_NONCE`, `OG_CHALLENGE_PERIOD`, `OG_RULES_URI`
- `OG_MASTER_COPY`, `SAFE_SINGLETON`, `SAFE_FALLBACK_HANDLER`
- `MODULE_PROXY_FACTORY`
## Documentation

## Example `.env`
- Contribution workflow and policy: `CONTRIBUTING.md`
- Skill for new agent/commitment combos: `skills/add-agent-commitment/SKILL.md`
- Deployment and configuration: `docs/deployment.md`
- Signer options and `with-signer` helper: `docs/signers.md`
- Offchain agent usage: `docs/agent.md`
- Agent extension decision rules: `docs/agent-extension-guidelines.md`
- Web frontend: `docs/frontend.md`
- Testing and common commands: `docs/testing.md`

```ini
# Required
DEPLOYER_PK=0xabc123...
OG_COLLATERAL=0x1111111111111111111111111111111111111111
OG_BOND_AMOUNT=250000000
OG_RULES="Any assets deposited in this Commitment may be transferred back to the depositor before January 15th, 2026 (12:00AM PST). After the deadline, assets may only be transferred to jdshutt.eth. If a third party is initiating the transfer after the deadline, they may take a 10% cut of the assets being transferred as a fee."

# Safe overrides
SAFE_OWNERS=0x2222222222222222222222222222222222222222,0x3333333333333333333333333333333333333333
SAFE_THRESHOLD=2
SAFE_SALT_NONCE=12345

# Optimistic Governor overrides
OG_CHALLENGE_PERIOD=604800
OG_RULES_URI=ipfs://bafy...
OG_SALT_NONCE=67890

# Optional factory / master copy overrides
MODULE_PROXY_FACTORY=0x4444444444444444444444444444444444444444
OG_MASTER_COPY=0x5555555555555555555555555555555555555555
SAFE_SINGLETON=0x6666666666666666666666666666666666666666
SAFE_FALLBACK_HANDLER=0x7777777777777777777777777777777777777777
```
## Repo Layout

## Common Commands

```shell
forge build
forge test
forge fmt
```

## Local Testing

Dry-run (no broadcast):

```shell
anvil
forge script script/DeploySafeWithOptimisticGovernor.s.sol:DeploySafeWithOptimisticGovernor \
--rpc-url http://127.0.0.1:8545 \
--private-key <your_private_key>
```

Broadcast on Anvil:

```shell
anvil
forge script script/DeploySafeWithOptimisticGovernor.s.sol:DeploySafeWithOptimisticGovernor \
--rpc-url http://127.0.0.1:8545 \
--broadcast \
--private-key <your_private_key>
```

## Propose & Execute Transfers

Propose a transfer (posts the UMA bond via the Optimistic Governor):

```shell
export PROPOSER_PK=<private_key>
export OG_MODULE=<optimistic_governor_module>
export TRANSFER_ASSET=<erc20_token_address>
export TRANSFER_AMOUNT=<amount_in_token_units>
export TRANSFER_DESTINATION=<recipient_address>

forge script script/ProposeCommitmentTransfer.s.sol:ProposeCommitmentTransfer \
--rpc-url <your_rpc_url> \
--broadcast \
--private-key $PROPOSER_PK
```

Execute a proposal after it passes:

```shell
export EXECUTOR_PK=<private_key>
export OG_MODULE=<optimistic_governor_module>
export PROPOSAL_HASH=<proposal_hash>
export TRANSFER_ASSET=<erc20_token_address>
export TRANSFER_AMOUNT=<amount_in_token_units>
export TRANSFER_DESTINATION=<recipient_address>

forge script script/ExecuteCommitmentTransfer.s.sol:ExecuteCommitmentTransfer \
--rpc-url <your_rpc_url> \
--broadcast \
--private-key $EXECUTOR_PK
```

Optional overrides:

- `TRANSFER_OPERATION` (default `0` for `CALL`)
- `TRANSFER_VALUE` (default `0`)

### Anvil Test Key + USDC Funding (Fork)

Start Anvil with the default test mnemonic and grab one of the printed private keys:

```shell
anvil --fork-url $MAINNET_RPC_URL --mnemonic "test test test test test test test test test test test junk"
```

Fund the test account with USDC by impersonating a whale on the fork:

```shell
cast rpc anvil_impersonateAccount <whale_address>
cast rpc anvil_setBalance <whale_address> 0x3635C9ADC5DEA00000
cast send <usdc_contract> "transfer(address,uint256)" <your_account> <amount> --from <whale_address>
cast rpc anvil_stopImpersonatingAccount <whale_address>
```

## Network Env Files

You can keep per-network env files and load them with a tool like `dotenvx` or `direnv`.

Mainnet fork example (`.env.mainnet`):

```ini
MAINNET_RPC_URL=...
DEPLOYER_PK=0x...
OG_COLLATERAL=0xA0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
OG_BOND_AMOUNT=250000000
OG_RULES="Any assets deposited in this Commitment may be transferred back to the depositor before January 15th, 2026 (12:00AM PST). After the deadline, assets may only be transferred to jdshutt.eth. If a third party is initiating the transfer after the deadline, they may take a 10% cut of the assets being transferred as a fee."
OG_IDENTIFIER_STR=ASSERT_TRUTH2
```

A ready-to-edit template is available at `.env.mainnet.example`.

Sepolia example (`.env.sepolia`):

```ini
SEPOLIA_RPC_URL=...
DEPLOYER_PK=0x...
SAFE_SINGLETON=0x...
SAFE_PROXY_FACTORY=0x...
SAFE_FALLBACK_HANDLER=0x...
OG_MASTER_COPY=0x...
OG_COLLATERAL=0x...
OG_BOND_AMOUNT=...
OG_RULES="Any assets deposited in this Commitment may be transferred back to the depositor before January 15th, 2026 (12:00AM PST). After the deadline, assets may only be transferred to jdshutt.eth. If a third party is initiating the transfer after the deadline, they may take a 10% cut of the assets being transferred as a fee."
```

Load the file before running the script:

```shell
dotenvx run -f .env.mainnet -- forge script script/DeploySafeWithOptimisticGovernor.s.sol:DeploySafeWithOptimisticGovernor \
--rpc-url $MAINNET_RPC_URL \
--private-key $DEPLOYER_PK
```
- `src/` Solidity contracts
- `script/` Foundry deployment and ops scripts
- `test/` Foundry tests
- `agent/` Offchain agent scaffold
- `frontend/` Web UI
- `lib/` External dependencies (Foundry)
24 changes: 24 additions & 0 deletions agent-library/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Agent Library Guidelines

## Scope

This file applies to `agent-library/` and `agent-library/agents/*`.

## Purpose

This directory is the home for agent-specific behavior and commitment-specific decision logic.

## Rules

- Each agent lives under `agent-library/agents/<agent-name>/`.
- Keep commitment logic, prompt strategy, and behavior specialization in that agent's local files.
- Prefer adding new modules over branching shared runner code for one-off behavior.

## Locality Rule

When creating a new agent, place functionality in that agent's own files (`agent.js` and adjacent module files). Do not implement single-agent behavior in shared generalized files under `agent/src/lib/` or `agent/src/index.js`.

## Validation

- Run module-specific tests/simulations for the changed agent.
- Document test commands in the PR description.
Loading