Core Concepts
Built-In Agents
Written By: Harry Osborn
Last Updated on June 19, 2023
Introduction
CODI’s modularity stems from its built-in agents. Each agent encapsulates a single responsibility, enabling predictable orchestration and straightforward customization. This page details the purpose, inputs, outputs, and extension points for each core agent.
1. Scaffold Agent (scaffold-agent
)
Purpose: Bootstraps a new Anchor project with directory structure, boilerplate code, and configuration files.
Inputs:
--template
flag (e.g.,anchor
,spl-token
, custom templates).Outputs:
programs/<name>/lib.rs
,Anchor.toml
, frontend TypeScript stubs, sample tests.Hooks: Pre/post hooks in
codi.toml
:
2. Audit Agent (audit-agent
)
Purpose: Runs static and semantic security analyses on program code.
Inputs: Source files from scaffold or user workspace.
Outputs: JSON/Markdown audit report with severity levels, remediation suggestions, and metadata.
Extension: Integrate custom linters by specifying:
3. Test Agent (test-agent
)
Purpose: Auto-generates and executes unit and integration tests based on code and comments.
Inputs: Program IDL, Rust comments, developer annotations (e.g.,
/// @test-case
).Outputs: Test suites (Mocha/Chai or Rust), test coverage metrics, console reports.
Customization: Use
@codi:
annotations in Rust to guide test generation:
4. Deploy Agent (deploy-agent
)
Purpose: Compiles, packages, and deploys the Anchor program to the specified Solana cluster.
Inputs: Compiled artifacts, network flag (
--network devnet|testnet|mainnet
).Outputs: Program ID, transaction signature, IDL file on chain.
Rollbacks: Enabled by default; snapshots last successful deploy in
mcp.deploy
node.Config: Customize via
codi.toml
:
Visual Description
Agents Sequence Diagram:
Timeline showing scaffold → audit → test → deploy.
Data passed between agents via MCP context nodes.
Configuration Schema Snippet:
YAML-like depiction of
codi.toml
sections for all four agents.
Conclusion
CODI’s built-in agents encapsulate each stage of the smart-contract lifecycle, offering clear extension points and configuration options. Customize or disable any agent to tailor CODI to your team’s workflow.
Related to Core Concepts