Merge pull request 'chore: gardener housekeeping 2026-03-23' (#1144) from chore/gardener-20260323-1807 into master

This commit is contained in:
johba 2026-03-23 22:36:18 +01:00
commit 3533571104
10 changed files with 57 additions and 53 deletions

View file

@ -1,4 +1,4 @@
<!-- last-reviewed: b276392e7a1d4eda36ec20a90ef22de471da2344 -->
<!-- last-reviewed: 209e0c798ea85204c5fe466ba7b54b874095e08f -->
# Agent Brief: Harb Stack
## What is KRAIKEN?
@ -20,6 +20,7 @@ KRAIKEN couples Harberger-tax staking with a dominant Uniswap V3 liquidity manag
| `services/txnBot/` | Automation bot for `recenter()` and `payTax()` upkeep | [services/txnBot/AGENTS.md](services/txnBot/AGENTS.md) |
| `formulas/` | TOML pipeline definitions (sense/act) for the evaluator | [formulas/AGENTS.md](formulas/AGENTS.md) |
| `scripts/` | `dev.sh`, bootstrap, build helpers; `harb-evaluator/` red-team agent | [scripts/harb-evaluator/AGENTS.md](scripts/harb-evaluator/AGENTS.md) |
| `packages/analytics/` | `@harb/analytics` — self-hosted Umami wrapper for funnel tracking | — |
| `tests/e2e/` | Playwright end-to-end tests | — |
| `docs/` | Architecture, product truth, environment, ops guides | — |

View file

@ -1,4 +1,4 @@
<!-- last-reviewed: b276392e7a1d4eda36ec20a90ef22de471da2344 -->
<!-- last-reviewed: 209e0c798ea85204c5fe466ba7b54b874095e08f -->
# Agent Brief: Formulas
Formulas are TOML files that declare automated pipeline jobs for the harb evaluator.

View file

@ -1,52 +1,32 @@
[
{
"action": "edit_body",
"issue": 1086,
"body": "Flagged by AI reviewer in PR #1065.\n\n## Problem\n\nBoth `candidate_commit` and `methodology` were added to `evidence/README.md` without a corresponding schema update. Future red-team runners have no schema definition for these fields, and automated validators may reject the file.\n\n## Affected files\n\n- `evidence/README.md` — add schema entries for `candidate_commit` and `methodology` fields\n\n## Acceptance criteria\n\n- [ ] `evidence/README.md` schema section defines the `candidate_commit` field (commit SHA of the optimizer candidate under test)\n- [ ] `evidence/README.md` schema section defines the `methodology` field (how the red-team run was conducted, e.g. snapshot-isolation)\n- [ ] Schema changes are backward-compatible with existing evidence JSON files\n\n## Related\n\n- #1083 (sibling — snapshot-isolation methodology doc for lm_eth fields)\n\n---\n*Auto-created from AI review of PR #1065*"
},
{
"action": "add_label",
"issue": 1086,
"label": "backlog"
},
{
"action": "edit_body",
"issue": 1083,
"body": "Flagged by AI reviewer in PR #1065.\n\n## Problem\n\n`evidence/README.md` is silent on whether `lm_eth_before`/`lm_eth_after` reflect cumulative or per-attack-reverted state. Now that snapshot isolation is the standard practice, the schema should define this so the fields are unambiguous to future test runners and the planner.\n\n## Affected files\n\n- `evidence/README.md` — add snapshot-isolation methodology section defining lm_eth field semantics\n\n## Acceptance criteria\n\n- [ ] `evidence/README.md` schema defines that `lm_eth_before`/`lm_eth_after` reflect per-attack state after snapshot isolation (not cumulative historical balance)\n- [ ] Schema clarifies that each attack begins from the same initial state via `vm.snapshot()`/`vm.revertTo()`\n- [ ] Schema clarifies that snapshot isolation is the standard methodology for all red-team runs\n\n## Related\n\n- #1086 (sibling — candidate_commit and methodology field schema)\n\n---\n*Auto-created from AI review of PR #1065*"
},
{
"action": "add_label",
"issue": 1083,
"label": "backlog"
},
{
"action": "remove_label",
"issue": 1099,
"label": "backlog"
},
{
"action": "add_label",
"issue": 1100,
"label": "backlog"
},
{
"action": "add_label",
"issue": 1101,
"label": "backlog"
"label": "blocked"
},
{
"action": "comment",
"issue": 1103,
"body": "Closing as actioned. This prediction was logged and labeled prediction/actioned. The underlying issue (preflight.sh CI DB unreachable) has been noted by the team. Closing to keep the backlog clean."
},
{
"action": "close",
"issue": 1103,
"reason": "prediction actioned and stale"
},
{
"action": "comment",
"issue": 1107,
"body": "Closing as actioned. The double-crash on 2026-03-21 was transient — subsequent gardener runs including 2026-03-22 06:00 and 2026-03-23 07:03 completed successfully (PHASE:done). No recurring crash pattern observed. Closing."
},
{
"action": "close",
"issue": 1107,
"reason": "transient crash resolved — subsequent runs successful"
},
{
"action": "comment",
"issue": 1020,
"body": "Closing: evidence/evolution/ now contains data (best.push3). The fitness baseline absence predicted here has been resolved."
},
{
"action": "close",
"issue": 1020,
"reason": "evidence/evolution/ now populated with best.push3"
},
{
"action": "comment",
"issue": 1022,
"body": "Partial resolution: evidence/holdout/ now contains 2026-03-22-issue517-adversarial-lp.json. evidence/user-test/ remains empty — UX conversion signal still absent. Keeping open for user-test gap."
"issue": 1099,
"body": "Unblocked: all upstream prerequisites (#1031, #997, #1067, #1054) closed. Dev-agent attempted PR #1139 but CI exhausted — blocked label removed so issue re-enters the queue for retry."
}
]

View file

@ -1,4 +1,4 @@
<!-- last-reviewed: b276392e7a1d4eda36ec20a90ef22de471da2344 -->
<!-- last-reviewed: 209e0c798ea85204c5fe466ba7b54b874095e08f -->
# Kraiken Library - Agent Guide
Shared TypeScript helpers used by the landing app, txnBot, and other services to talk to KRAIKEN contracts and the Ponder GraphQL API.

View file

@ -1,4 +1,4 @@
<!-- last-reviewed: b276392e7a1d4eda36ec20a90ef22de471da2344 -->
<!-- last-reviewed: 209e0c798ea85204c5fe466ba7b54b874095e08f -->
# Landing Interface - Agent Guide
Vue 3 + Vite application that delivers the public marketing site and forthcoming staking UI.
@ -10,6 +10,7 @@ Vue 3 + Vite application that delivers the public marketing site and forthcoming
- `@wagmi/vue` for wallet connection (injected, WalletConnect, Coinbase Wallet)
- `@tanstack/vue-query` — required peer dependency of `@wagmi/vue`; must be registered via `VueQueryPlugin` in `main.ts`
- `@harb/web3` shared composables for wagmi config and wallet hooks
- `@harb/analytics` — self-hosted Umami wrapper; call `initAnalytics(url, id)` in `main.ts`, use `trackCtaClick(label)` via the `navigateCta` helper in views
## Key Views & Components
- `HomeView.vue` - Launch countdown, feature overview, and staking CTA
@ -32,6 +33,15 @@ Vue 3 + Vite application that delivers the public marketing site and forthcoming
- `npm run type-check`
- Deployments assume hash-based routing and the Vite `base` setting configured for static hosting.
## Analytics
The landing page uses `@harb/analytics` (a self-hosted Umami wrapper) for conversion funnel tracking.
- `initAnalytics(VITE_UMAMI_URL, VITE_UMAMI_WEBSITE_ID)` is called in `main.ts` — the Umami `<script>` tag is injected dynamically so ad-blocker state is handled gracefully.
- CTA buttons use `navigateCta(path, label)` in `HomeView.vue` instead of `router.push()` directly — this fires `trackCtaClick(label)` before navigating. Tracked labels: `hero_get_krk`, `how_it_works_get_krk`, `getting_started_get_krk`, `view_protocol`, `how_it_works_docs`.
- All tracking calls are safe no-ops if Umami is unavailable (ad-blocked, env vars unset, dev mode without Umami running).
- Env vars required: `VITE_UMAMI_URL` (script URL), `VITE_UMAMI_WEBSITE_ID` (UUID). See `docs/ENVIRONMENT.md`.
## Upcoming Integrations
- Wallet connection with Base network switching
- Staking dashboard that reuses shared helpers from `kraiken-lib`

View file

@ -1,4 +1,4 @@
<!-- last-reviewed: b276392e7a1d4eda36ec20a90ef22de471da2344 -->
<!-- last-reviewed: 209e0c798ea85204c5fe466ba7b54b874095e08f -->
# Agent Brief: Kraiken Protocol
## Protocol Philosophy & Business Logic
@ -72,5 +72,6 @@ The staking system traces a triangle in (staking%, avgTax) space:
- `recenterAccess` is removed — `recenter()` always enforces cooldown and TWAP stability. No bypass path exists.
- `feeDestinationLocked` prevents CREATE2 bypass: once `feeDestination` is set to a contract address, it cannot be changed. `setFeeDestination` checks `.code.length > 0` to detect contract addresses.
- Optimizer input slots 0-7 all require `<= 1e18` — the overflow guard previously only applied to slot 0 (`percentageStaked`); slots 1-7 (including `averageTaxRate`) are now also validated (#997).
- Floor Ratchet attack (buy→stake→recenter oscillation) is defeated — evidence in `evidence/red-team/2026-03-22-floor-ratchet-oscillation.json` shows floor holds under 2000-trade oscillation (#1067).
- Floor Ratchet attack (buy→stake→recenter oscillation) is defeated — evidence in `evidence/red-team/2026-03-22-floor-ratchet-oscillation.json` and `2026-03-23-floor-ratchet-oscillation.json` shows floor holds under the full 2000-trade oscillation sequence (#1082). Attack script now uses 200-iteration `buy_recenter_loop` with large stake (10M KRK) and proper `vm.warp` time advancement.
- `AttackRunner.s.sol`: `taxRate` param to `snatch()` is an **index into `TAX_RATES[]`**, not a raw rate value. `buy_recenter_loop` now advances `block.timestamp` by 61s per iteration (past 60s recenter cooldown) and calls `recenter()` in the same broadcast as the buy to avoid multi-key issues.
- Fee-income delta_bps calculation is documented in `evidence/README.md`; `LmTotalEth.s.sol` now captures the auditable snapshot methodology (#1084).

View file

@ -1,4 +1,4 @@
<!-- last-reviewed: b276392e7a1d4eda36ec20a90ef22de471da2344 -->
<!-- last-reviewed: 209e0c798ea85204c5fe466ba7b54b874095e08f -->
# Agent Brief: harb-evaluator
The evaluator runtime executes formula-defined pipelines. Scripts in this

View file

@ -1,4 +1,4 @@
<!-- last-reviewed: b276392e7a1d4eda36ec20a90ef22de471da2344 -->
<!-- last-reviewed: 209e0c798ea85204c5fe466ba7b54b874095e08f -->
# Ponder Indexer - Agent Guide
Ponder-based indexer that records Kraiken protocol activity and exposes the GraphQL API consumed by the app and automation bot.

View file

@ -1,4 +1,4 @@
<!-- last-reviewed: b276392e7a1d4eda36ec20a90ef22de471da2344 -->
<!-- last-reviewed: 209e0c798ea85204c5fe466ba7b54b874095e08f -->
# Transaction Bot - Agent Guide
Automation service that maintains liquidity alignment and tax enforcement for the KRAIKEN protocol.

View file

@ -1,4 +1,4 @@
<!-- last-reviewed: b276392e7a1d4eda36ec20a90ef22de471da2344 -->
<!-- last-reviewed: 209e0c798ea85204c5fe466ba7b54b874095e08f -->
# Web App - Agent Guide
Vue 3 + TypeScript staking interface for KRAIKEN, enabling users to stake tokens, manage positions, and interact with Harberger-tax mechanics.
@ -46,6 +46,18 @@ Vue 3 + TypeScript staking interface for KRAIKEN, enabling users to stake tokens
- Relies on semantic HTML and ARIA attributes for selectors
- StakeHolder test hooks: `page.getByRole('slider', { name: 'Token Amount' })`, `page.getByLabel('Tax')`
## Analytics
The web app uses `@harb/analytics` (self-hosted Umami wrapper) for funnel event tracking. `initAnalytics(VITE_UMAMI_URL, VITE_UMAMI_WEBSITE_ID)` is called in `main.ts`. Tracked events:
| Event | Where | Helper |
|-------|-------|--------|
| `wallet_connect` | `useWallet.ts` — on first address set | `trackWalletConnect()` |
| `swap_initiated` | `useSwapKrk.ts` — before buy/sell tx | `trackSwapInitiated('buy'\|'sell')` |
| `stake_created` | `useStake.ts` — after PositionCreated event | `trackStakeCreated()` |
All calls are silent no-ops if Umami is unavailable. Env vars: `VITE_UMAMI_URL`, `VITE_UMAMI_WEBSITE_ID`.
## Quality Guidelines
- Composables accept `chainId` parameter instead of importing wallet state directly
- Each composable maintains its own `watchChainId()` listener for independence