diff --git a/NEXT-PHASE.md b/NEXT-PHASE.md index 99b7a86..9db0839 100644 --- a/NEXT-PHASE.md +++ b/NEXT-PHASE.md @@ -11,6 +11,8 @@ ## 🚀 Phase 2: Core Contracts (NEXT) +**Note**: Phase 2 includes ongoing integration with development agents (castquest-code) for autonomous protocol evolution, building upon the Smart Brain foundation established in Phase 1. + ### Priority 1: CAST Token Implementation **File**: `packages/contracts/contracts/CAST.sol` @@ -122,9 +124,42 @@ contract MediaTokenFactory { } ``` -### Priority 3: Bonding Curve Market +### Priority 3: Agentic Development Foundation + +**Integration with `castquest-code` for autonomous protocol expansion:** + +This priority establishes the foundation for AI-powered development workflows within the CastQuest protocol: + +- **Autonomous Protocol Expansion**: Integration with `castquest-code` (from SMSDAO) enables automated proposal and scaffolding of new protocol features, contracts, and extensions. + +- **Automated Test Generation**: For future V4-only custom contracts following a "reduced external dependency" principle, development agents automatically generate comprehensive unit tests, ensuring code quality and security. + - Target for V4-only custom contracts: minimize external dependencies (ideally no new OpenZeppelin imports, no proxies, and pure token operations), while allowing existing core contracts to continue using audited libraries like OpenZeppelin where appropriate + +- **CODE Token Reward Mechanism**: Define and implement the CODE token distribution system that rewards validated code contributions from: + - Autonomous builders and agents + - Smart contract generation and audits + - Protocol improvements and optimizations + - Documentation and testing contributions + +- **Smart Brain Integration**: The protocol's Smart Brain architecture coordinates with development agents to: + - Evaluate code quality and security + - Validate contributions before CODE token distribution + - Track contribution history and reputation + - Enable continuous, agent-assisted protocol evolution + +**Implementation Tasks**: +- [ ] Define CODE token reward tiers and validation criteria +- [ ] Integrate castquest-code agent framework +- [ ] Build automated contract scaffolding pipeline +- [ ] Implement test generation for custom contracts +- [ ] Create contribution validation and audit system +- [ ] Deploy CODE token minting logic in CodeEngine + +--- + +### Priority 4: Bonding Curve Market -**File**: `packages/contracts/contracts/MarketPlace.sol` +**File**: `packages/contracts/contracts/market/Marketplace.sol` ```solidity // SPDX-License-Identifier: MIT diff --git a/docs/architecture/V4.md b/docs/architecture/V4.md index d6939e9..b0fd1e0 100644 --- a/docs/architecture/V4.md +++ b/docs/architecture/V4.md @@ -35,7 +35,7 @@ Five vertical-specific tokens with no supply caps: - **MEDIA** - Media creation and rewards - **FRAME** - Frame-related actions - **GAME** - Game asset economics -- **CODE** - Code generation rewards +- **CODE** - Code generation rewards for autonomous builders and AI agents - **AGENT** - AI agent operations These are minted by their respective Engines and used for fees, rewards, and liquidity. @@ -168,7 +168,7 @@ Engines: ├── MediaEngine.sol ← Mints MEDIA, creates media assets ├── FrameEngine.sol ← Mints FRAME, processes frames ├── GameEngine.sol ← Mints GAME, handles game logic -├── CodeEngine.sol ← Mints CODE, manages code gen +├── CodeEngine.sol ← Mints CODE, manages autonomous code generation, audits, and agentic incentives └── AgentEngine.sol ← Mints AGENT, AI operations ``` @@ -247,6 +247,17 @@ Users choose when to adopt V4 based on: - SubDAO features - Lower gas costs on Base +## Agentic Development Integration + +V4's Smart Brain architecture is the combined on-chain governance and upgrade surface plus off-chain agent orchestration layer (AI agents, code-generation pipelines, and security tooling) that coordinates agentic development of the protocol. It is specified in more detail in [Smart Brain Architecture](./SmartBrain.md). +V4's Smart Brain architecture integrates with agentic development frameworks to enable: +- **Autonomous Protocol Expansion**: AI agents (e.g., castquest-code from SMSDAO) can propose and scaffold new protocol features off-chain +- **Automated Contract Generation**: Off-chain development agents (via Smart Brain/CI) generate, audit, and deploy smart contracts; the on-chain CodeEngine does not call external systems and only verifies submitted results/metadata +- **CODE Token Rewards**: Once results are verified on-chain, CodeEngine mints and distributes CODE tokens to reward validated contributions from AI-powered development tools, agentic protocol expansion, and automated smart contract generation +- **Continuous Evolution**: The protocol evolves through a combination of human governance and AI-assisted, off-chain development, with on-chain contracts remaining pure and free of external dependencies + +This creates a flywheel where protocol improvements are incentivized through CODE tokens, enabling sustainable, community-driven growth while preserving the "No External Calls" and "No External Dependencies" guarantees of the on-chain system. + ## Security Guarantees 1. **Supply Caps**: Enforced on-chain, cannot be bypassed