From 13d5b405640f66c1f7b8951fad3d72ab3e0fbf60 Mon Sep 17 00:00:00 2001 From: openhands Date: Sun, 15 Mar 2026 18:41:57 +0000 Subject: [PATCH] fix: Kraiken.sol and Stake.sol absent from agent context across all runs (#829) Inject Kraiken.sol (outstandingSupply, mint/burn mechanics) and Stake.sol (snatch, withdrawal, KRK exclusion from floor denominator) into the red-team agent prompt so agents can reason from actual source rather than guesses. - red-team.sh: read SOL_KRAIKEN and SOL_STAKE from onchain/src/ alongside the other six contracts already injected - red-team-program.md: add ### Kraiken.sol and ### Stake.sol sections in the Source Code reference block (after PriceOracle.sol) - AGENTS.md: document the full list of injected contracts in a new "Red-team Agent Context" section; both files are now listed as in-scope Co-Authored-By: Claude Sonnet 4.6 --- AGENTS.md | 11 ++++++++++- scripts/harb-evaluator/red-team-program.md | 10 ++++++++++ scripts/harb-evaluator/red-team.sh | 4 ++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index bc6d5a3..5798542 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -18,7 +18,7 @@ KRAIKEN couples Harberger-tax staking with a dominant Uniswap V3 liquidity manag | `web-app/` | Staking UI | [web-app/AGENTS.md](web-app/AGENTS.md) | | `kraiken-lib/` | Shared TypeScript helpers for clients and bots | [kraiken-lib/AGENTS.md](kraiken-lib/AGENTS.md) | | `services/txnBot/` | Automation bot for `recenter()` and `payTax()` upkeep | [services/txnBot/AGENTS.md](services/txnBot/AGENTS.md) | -| `scripts/` | `dev.sh`, bootstrap, build helpers | — | +| `scripts/` | `dev.sh`, bootstrap, build helpers; `harb-evaluator/` red-team agent | — | | `tests/e2e/` | Playwright end-to-end tests | — | | `docs/` | Architecture, product truth, environment, ops guides | — | @@ -30,6 +30,15 @@ KRAIKEN couples Harberger-tax staking with a dominant Uniswap V3 liquidity manag ``` See [docs/dev-environment.md](docs/dev-environment.md) for restart modes, ports, Docker topology, and common pitfalls. +## Red-team Agent Context +The red-team agent (`scripts/harb-evaluator/red-team.sh`) injects the following Solidity sources into the agent prompt so it can reason from exact contract logic: +- `LiquidityManager.sol` — three-position manager, recenter, floor formula +- `ThreePositionStrategy.sol` — position lifecycle abstractions +- `Optimizer.sol` / `OptimizerV3.sol` — current candidate under test +- `VWAPTracker.sol` / `PriceOracle.sol` — price oracle and VWAP mechanics +- `Kraiken.sol` — `outstandingSupply()`, KRK mint/burn, transfer mechanics +- `Stake.sol` — `snatch()`, withdrawal, KRK exclusion from floor denominator + ## Key Patterns - **ES Modules everywhere**: The entire stack uses `"type": "module"` and `import` syntax. - **`token0isWeth`**: Flips amount semantics; confirm ordering before seeding or interpreting liquidity. diff --git a/scripts/harb-evaluator/red-team-program.md b/scripts/harb-evaluator/red-team-program.md index a0de6e4..7aee8b7 100644 --- a/scripts/harb-evaluator/red-team-program.md +++ b/scripts/harb-evaluator/red-team-program.md @@ -135,6 +135,16 @@ Do NOT attempt to deploy or modify contracts — these are for reference only. {{SOL_PRICE_ORACLE}} ``` +### Kraiken.sol +```solidity +{{SOL_KRAIKEN}} +``` + +### Stake.sol +```solidity +{{SOL_STAKE}} +``` + --- ## Cast command patterns diff --git a/scripts/harb-evaluator/red-team.sh b/scripts/harb-evaluator/red-team.sh index d755f0d..366cca7 100755 --- a/scripts/harb-evaluator/red-team.sh +++ b/scripts/harb-evaluator/red-team.sh @@ -400,6 +400,8 @@ SOL_OPTIMIZER=$(< "$ONCHAIN_SRC/Optimizer.sol") SOL_OPTIMIZERV3=$(< "$ONCHAIN_SRC/OptimizerV3.sol") SOL_VWAP=$(< "$ONCHAIN_SRC/VWAPTracker.sol") SOL_PRICE_ORACLE=$(< "$ONCHAIN_SRC/abstracts/PriceOracle.sol") +SOL_KRAIKEN=$(< "$ONCHAIN_SRC/Kraiken.sol") +SOL_STAKE=$(< "$ONCHAIN_SRC/Stake.sol") # Build Previous Findings section from memory file MEMORY_SECTION="" @@ -574,6 +576,8 @@ PROMPT=${PROMPT//\{\{SOL_OPTIMIZER\}\}/$SOL_OPTIMIZER} PROMPT=${PROMPT//\{\{SOL_OPTIMIZERV3\}\}/$SOL_OPTIMIZERV3} PROMPT=${PROMPT//\{\{SOL_VWAP\}\}/$SOL_VWAP} PROMPT=${PROMPT//\{\{SOL_PRICE_ORACLE\}\}/$SOL_PRICE_ORACLE} +PROMPT=${PROMPT//\{\{SOL_KRAIKEN\}\}/$SOL_KRAIKEN} +PROMPT=${PROMPT//\{\{SOL_STAKE\}\}/$SOL_STAKE} PROMPT=${PROMPT//\{\{CROSS_CANDIDATE_SECTION\}\}/$CROSS_CANDIDATE_SECTION} PROMPT=${PROMPT//\{\{MEMORY_SECTION\}\}/$MEMORY_SECTION}