Skip to content

Commit 3c996ab

Browse files
authored
Merge pull request #76 from CastQuest/copilot/update-architecture-and-next-phase
Integrate agentic development workflows and CODE token rewards into V4 architecture
2 parents d4d53f0 + feb9e53 commit 3c996ab

2 files changed

Lines changed: 50 additions & 4 deletions

File tree

NEXT-PHASE.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
## 🚀 Phase 2: Core Contracts (NEXT)
1313

14+
**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.
15+
1416
### Priority 1: CAST Token Implementation
1517

1618
**File**: `packages/contracts/contracts/CAST.sol`
@@ -122,9 +124,42 @@ contract MediaTokenFactory {
122124
}
123125
```
124126

125-
### Priority 3: Bonding Curve Market
127+
### Priority 3: Agentic Development Foundation
128+
129+
**Integration with `castquest-code` for autonomous protocol expansion:**
130+
131+
This priority establishes the foundation for AI-powered development workflows within the CastQuest protocol:
132+
133+
- **Autonomous Protocol Expansion**: Integration with `castquest-code` (from SMSDAO) enables automated proposal and scaffolding of new protocol features, contracts, and extensions.
134+
135+
- **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.
136+
- 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
137+
138+
- **CODE Token Reward Mechanism**: Define and implement the CODE token distribution system that rewards validated code contributions from:
139+
- Autonomous builders and agents
140+
- Smart contract generation and audits
141+
- Protocol improvements and optimizations
142+
- Documentation and testing contributions
143+
144+
- **Smart Brain Integration**: The protocol's Smart Brain architecture coordinates with development agents to:
145+
- Evaluate code quality and security
146+
- Validate contributions before CODE token distribution
147+
- Track contribution history and reputation
148+
- Enable continuous, agent-assisted protocol evolution
149+
150+
**Implementation Tasks**:
151+
- [ ] Define CODE token reward tiers and validation criteria
152+
- [ ] Integrate castquest-code agent framework
153+
- [ ] Build automated contract scaffolding pipeline
154+
- [ ] Implement test generation for custom contracts
155+
- [ ] Create contribution validation and audit system
156+
- [ ] Deploy CODE token minting logic in CodeEngine
157+
158+
---
159+
160+
### Priority 4: Bonding Curve Market
126161

127-
**File**: `packages/contracts/contracts/MarketPlace.sol`
162+
**File**: `packages/contracts/contracts/market/Marketplace.sol`
128163

129164
```solidity
130165
// SPDX-License-Identifier: MIT

docs/architecture/V4.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Five vertical-specific tokens with no supply caps:
3535
- **MEDIA** - Media creation and rewards
3636
- **FRAME** - Frame-related actions
3737
- **GAME** - Game asset economics
38-
- **CODE** - Code generation rewards
38+
- **CODE** - Code generation rewards for autonomous builders and AI agents
3939
- **AGENT** - AI agent operations
4040

4141
These are minted by their respective Engines and used for fees, rewards, and liquidity.
@@ -168,7 +168,7 @@ Engines:
168168
├── MediaEngine.sol ← Mints MEDIA, creates media assets
169169
├── FrameEngine.sol ← Mints FRAME, processes frames
170170
├── GameEngine.sol ← Mints GAME, handles game logic
171-
├── CodeEngine.sol ← Mints CODE, manages code gen
171+
├── CodeEngine.sol ← Mints CODE, manages autonomous code generation, audits, and agentic incentives
172172
└── AgentEngine.sol ← Mints AGENT, AI operations
173173
```
174174

@@ -247,6 +247,17 @@ Users choose when to adopt V4 based on:
247247
- SubDAO features
248248
- Lower gas costs on Base
249249

250+
## Agentic Development Integration
251+
252+
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).
253+
V4's Smart Brain architecture integrates with agentic development frameworks to enable:
254+
- **Autonomous Protocol Expansion**: AI agents (e.g., castquest-code from SMSDAO) can propose and scaffold new protocol features off-chain
255+
- **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
256+
- **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
257+
- **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
258+
259+
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.
260+
250261
## Security Guarantees
251262

252263
1. **Supply Caps**: Enforced on-chain, cannot be bypassed

0 commit comments

Comments
 (0)