Core Concepts

Built-In Agents

CODI ships with four core agents—scaffold-agent, audit-agent, test-agent, and deploy-agent—each handling a distinct phase of the Anchor development lifecycle. You can configure, extend, or disable them via codi.toml or custom plugins.

CODI ships with four core agents—scaffold-agent, audit-agent, test-agent, and deploy-agent—each handling a distinct phase of the Anchor development lifecycle. You can configure, extend, or disable them via codi.toml or custom plugins.

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:

    [scaffold]
    
    


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:

    [audit]
    linters = ["slither", "custom-lint"]
    
    


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:

    /// @codi:test description="Ensure transfer fails on insufficient funds"
    pub fn transfer(ctx: Context<Transfer>
    
    


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:

    [deploy]
    
    


Visual Description

  1. Agents Sequence Diagram:

    • Timeline showing scaffold → audit → test → deploy.

    • Data passed between agents via MCP context nodes.

  2. 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.


© 2025 CODI all rights reserved | Created with ♥️

© 2025 CODI all rights reserved | Created with ♥️

© 2025 CODI all rights reserved | Created with ♥️