agents/skills/sui/fork-ancestry/SKILL.md
Trigger Pattern Always (run during recon TASK 0, not breadth) - Inject Into Recon agent only (meta_buffer.md enrichment)
npx skillsauth add plamentsv/plamen fork-ancestryInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Trigger Pattern: Always (run during recon TASK 0, not breadth) Inject Into: Recon agent only (meta_buffer.md enrichment) Finding prefix:
[FA-N]Purpose: Detect known parent Sui packages and inherit their historical vulnerability patterns.
Grep the codebase for known parent Sui package signatures:
| Parent Project | Detection Patterns | Common Forks |
|---------------|-------------------|--------------|
| Cetus | cetus\|clmm\|tick\|concentrated_liquidity\|cetus_clmm\|tick_math\|sqrt_price_math\|CetusPool | Concentrated liquidity forks |
| Suilend | suilend\|lending_market\|reserve\|obligation\|refresh_reserve\|LendingMarket\|ObligationKey | Lending protocol forks |
| NAVI | navi\|navi_protocol\|lending\|pool_manager\|incentive\|StoragePool\|navi_lending | Lending protocol forks |
| Scallop | scallop\|s_coin\|market\|obligation\|borrow_dynamics\|ScallopMarket\|sCoin | Lending protocol forks |
| Turbos | turbos\|pool_factory\|position_manager\|turbos_clmm\|TurbosPool\|TurbosPosition | Concentrated liquidity forks |
| Curve StableSwap | stable_swap\|stableswap\|get_d\|get_y\|ramp_a\|stop_ramp_a\|A_PRECISION\|RATE_MULTIPLIER\|calc_withdraw_one_coin\|remove_liquidity_imbalance\|get_virtual_price\|admin_fee | StableSwap AMM forks — set STABLESWAP_FORK flag if MEDIUM+ confidence |
| DeepBook | deepbook\|clob\|order_book\|custodian\|deep_book\|DeepBookPool\|BalanceManager | Order book DEX forks |
| Aftermath | aftermath\|af_lp\|pool_registry\|amm_v2\|AftermathPool\|StakedSui | AMM / liquid staking forks |
| Bucket | bucket\|bucket_protocol\|tank\|well\|fountain\|BucketProtocol\|BUCK | Stablecoin / CDP forks |
| Kriya | kriya\|kriya_dex\|spot_dex\|clmm\|KriyaPool\|KriyaPosition | DEX forks |
| FlowX | flowx\|flowx_clmm\|router\|pair_v2\|FlowXPool\|FlowXRouter | DEX forks |
| Sui System Staking | staking_pool\|validator\|sui_system\|delegation\|StakedSui\|StakingPool\|ValidatorCap | Liquid staking / validator forks |
Also check:
Move.toml dependencies for parent package addresses or names (e.g., cetus_clmm = "0x...", deepbook = { addr = "0x..." })use cetus_clmm::, use deepbook::, use suilend::, etc.Git-based detection (complements code-pattern matching — catches forks that renamed all identifiers).
Skip if REPO_SHAPE: squashed_import in build_status.md — single-commit repos have no meaningful git metadata.
.gitmodules for submodule URLs pointing to known parent reposgit remote -v for origin URLs matching known Sui parent organizations (MystenLabs, cetus-technology, scallop-io, navi-protocol, suilend, deepbook, turbos-finance)GIT_ONLY_FORKOutput: List of detected parents with confidence level:
For each detected parent (confidence MEDIUM or HIGH):
// Query 1: Known high-quality issues
search_solodit_live(
keywords="{parent_name} sui move",
impact=["HIGH", "CRITICAL"],
language="Move",
quality_score=3,
sort_by="Quality",
max_results=15
)
// Query 2: Fork-specific divergence issues
search_solodit_live(
keywords="{parent_name} fork modified sui object",
impact=["HIGH", "MEDIUM"],
language="Move",
sort_by="Rarity",
max_results=10
)
tavily_search(query="{parent_name} sui move vulnerability exploit audit finding 2024 2025 2026")
Compile results into:
| Parent | Known Issue | Severity | Root Cause | Solodit Ref | Applicable to Fork? | |--------|-----------|----------|------------|-------------|---------------------| | {parent} | {issue title} | {severity} | {brief root cause} | {link/ID} | YES / NO / CHECK |
Applicability criteria:
If Solodit AND Tavily BOTH fail, use this minimum catalog -- check EACH applicable parent:
| Parent | Critical Known Issue | Root Cause | Search Keywords |
|--------|---------------------|------------|-----------------|
| CLMM DEX | Tick boundary crossing precision loss + liquidity accounting desync | sqrt_price calculation at tick boundaries, Position NFT state vs pool liquidity mismatch | clmm tick precision sqrt_price |
| Lending protocol (obligation-based) | Obligation refresh staleness + liquidation racing on shared objects | Reserve refresh not enforced before obligation health check, concurrent tx ordering | lending obligation refresh stale liquidation shared object |
| Lending protocol (pool-based) | Pool balance desync via flash loan deposit/withdraw + incentive calculation overflow | Balance tracking diverges from actual Coin balance, large TVL causes incentive arithmetic overflow | lending balance flash loan pool desync |
| Lending protocol (receipt-token) | Receipt token exchange rate manipulation via first depositor + borrow dynamics staleness | Empty market rounding in receipt token minting, stale interest rate applied across epochs | lending receipt token exchange rate first deposit borrow dynamics |
| Orderbook DEX | Order matching priority manipulation + balance manager accounting edge cases | Self-trading for priority manipulation, dust amounts in partial fills | orderbook order priority self-trade balance dust |
| CDP/stablecoin protocol | Reward distribution fairness + overflow at extreme collateral ratios | Discrete epoch distribution timing, arithmetic overflow in collateral ratio calculation | cdp reward epoch collateral overflow |
| Sui System Staking | Validator list manipulation via stake deposit ordering + reward fee timing | Stake account priority ordering in validator selection, reward distribution during epoch boundary | sui staking validator reward epoch boundary |
| Aftermath/AMM | LP share price manipulation via donation to pool + StakedSui exchange rate lag | Direct Coin transfer to pool object inflates share price, staking rewards not reflected immediately | aftermath pool share price donation stakedSui |
For each detected parent:
Compare fork vs parent in security-critical paths:
| Component | Parent Behavior | Fork Behavior | Security Impact | |-----------|----------------|---------------|-----------------| | {component} | {original} | {modified or SAME} | {new risk or NONE} |
Sui-specific divergence focus areas (ordered by criticality):
store ability from objects? Adding store = anyone can transfer; removing store = module-controlled transfer only.store to capability objects that the parent kept module-restricted? This allows capability transfer, potentially weakening admin control.store can be transferred to arbitrary addresses, including contracts that auto-execute.Balance<T> or Coin<T> objects are split, joined, or transferred?balance::zero() then never destroyed) or destroyed (via unmatched balance::destroy_zero())?For each modification:
Append to {SCRATCHPAD}/meta_buffer.md:
## Fork Ancestry Analysis
### Detected Parents
| Parent | Confidence | Patterns Found | Move.toml Dependency? |
|--------|-----------|---------------|----------------------|
### Inherited Vulnerabilities to Verify
| # | Parent Issue | Severity | Location in Fork | Status |
|---|-------------|----------|------------------|--------|
| 1 | {issue} | {severity} | {fork location: module::function} | CHECK / VERIFIED_SAFE / VULNERABLE |
### Fork Divergences (Security-Critical)
| # | Component | Change Type | Change Description | New Risk? |
|---|-----------|------------|-------------------|-----------|
| 1 | {component} | OWNERSHIP_MODEL / CAPABILITY / BALANCE / DYNAMIC_FIELD / OTHER | {what changed} | YES/NO/CHECK |
### Questions for Breadth Agents
1. {derived from inherited vulnerabilities}
2. {derived from divergence analysis}
3. {derived from ownership model changes}
| Section | Required | Completed? | Notes | |---------|----------|------------|-------| | 1. Detect Fork Indicators | YES | Y/N/? | Check Move.toml deps + source patterns | | 2. Query Known Parent Issues | IF parent detected | Y/N(no parent)/? | | | 2d. Hardcoded Known-Issue Floor | IF Solodit+Tavily both fail | Y/N(not needed)/? | | | 3. Divergence Analysis | IF parent detected | Y/N(no parent)/? | | | 3a. Object Ownership Model Changes | IF parent detected | Y/N(no parent)/? | Highest priority | | 3a. Capability and Admin Pattern Changes | IF parent detected | Y/N(no parent)/? | | | 3a. Balance and Coin Handling Changes | IF parent detected | Y/N(no parent)/? | | | 3a. Dynamic Field Schema Changes | IF parent detected | Y/N(no parent)/? | | | 4. Output to meta_buffer.md | YES | Y/N/? | |
After Step 1: If Move.toml shows specific parent package address dependencies, verify the addresses match known mainnet deployments (not test/devnet).
After Step 3a (Ownership Model): Feed changed ownership models to OBJECT_OWNERSHIP skill for targeted re-analysis of affected objects.
After Step 3a (Capability): Feed new/changed capabilities to SEMI_TRUSTED_ROLES skill for admin privilege analysis.
After Step 3a (Balance): Feed changed balance handling to TOKEN_FLOW_TRACING skill for flow analysis.
development
Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project documentation checks. Generates a scored Audit Readiness Report and optionally runs static analysis. Trigger on: "prepare for audit", "audit readiness", "pre-audit check", "audit prep", "NatSpec check", or any request to review a Solidity codebase before a security review.
development
Launch the Plamen deterministic Web3 security audit pipeline
development
Run the Plamen smart-contract audit wizard in Codex
testing
Launch the Plamen deterministic L1 infrastructure audit pipeline