Skip to content

Examples

End-to-end examples demonstrating Colony's multi-agent analysis capabilities. Each example includes a ready-to-run YAML config, an annotated walkthrough of the agent hierarchy, and key code from the Colony codebase.

Prerequisites

All examples assume a running Colony cluster. See Installation and the colony-env guide for setup.

colony-env up --workers 3
colony-env run --local-repo /path/to/codebase --config examples/impact-analysis.yaml

Code Analysis

  • Codebase Analysis


    Analyze a large codebase end-to-end. The coordinator spawns ClusterAnalyzer agents that shard the repo into VCM pages, perform local analysis, resolve cross-page queries, and synthesize a structural report.

    Run this example

    beginner page-sharding vcm cross-page-queries

  • Change Impact Analysis


    Trace the ripple effects of code changes across a codebase. Worker agents use multi-hop dependency propagation, hypothesis games validate critical impacts, and a game-theoretic merge produces a ranked impact report.

    Run this example

    intermediate hypothesis-games page-graph merge-policies

  • Compliance Audit


    Check license, security, and quality compliance. Agents build obligation graphs linking requirements to source evidence, detect license compatibility conflicts, and produce actionable remediation guidance.

    Run this example

    intermediate obligation-graphs merge-policies

  • Intent Inference


    Map code to business purposes. Agents infer function-level, class-level, or module-level intent, build intent graphs, detect misalignments between stated purpose and actual behavior, and reach consensus via game protocols.

    Run this example

    intermediate consensus-games intent-graphs

  • Contract Inference


    Infer function contracts — preconditions, postconditions, and invariants — at configurable formalism levels. Hypothesis games challenge and validate each contract before acceptance.

    Run this example

    intermediate hypothesis-games formal-specs

  • Program Slicing


    Extract the minimal code subset affecting a target variable. Supports backward, forward, chopping, and conditioned slices with LLM-based interprocedural dependency reasoning across page boundaries.

    Run this example

    intermediate slicing interprocedural

Advanced Workflows

  • Multi-Analysis Workflow


    Run impact analysis, compliance audit, and intent inference simultaneously on the same paged codebase. All agent teams share the VCM and page graph — pages loaded for one analysis are reusable by others via the shared KV cache.

    Run this example

    advanced concurrent-teams shared-vcm cache-reuse

Running Any Example

Every example follows the same workflow:

# Start from the built-in template
polymath init-config --output my_analysis.yaml

# Or use one of the example configs directly
cp examples/impact-analysis.yaml my_analysis.yaml
colony-env up --workers 3
colony-env run \
  --local-repo /path/to/codebase \
  --config my_analysis.yaml \
  --verbose
# Results are saved to the output directory
ls ./results/

# Or view the web dashboard
colony-env dashboard

Explore the CLI

Use polymath list analyses to see all available analysis types, polymath list capabilities to see attachable capabilities, and polymath describe impact to see the full agent hierarchy for a specific analysis.