Skip to main content

Prepare Any Codebase for an AI Audit

The simplest upload is a ZIP of your repository. That works for most projects — whatever the language. This guide is for when you want a tighter package: a defined scope inside a monorepo, a ZK circuit crate, one node subsystem, a single backend service — without shipping node_modules, build artifacts, and vendored dependencies that only add noise and cost.

tip

For Foundry / Solidity projects with git submodules, use the dedicated HOWTO for non-standard projects instead — it preserves the layout Foundry needs.

What to include

  • The source under audit — the module, service, or circuit you want reviewed.
  • The interfaces it touches — type definitions, trait/interface files, and the immediate callers, so the auditor sees how the code is used.
  • Documentation — README, architecture notes, invariants. Context materially improves finding quality.

What to exclude

Dependency and build directories: node_modules, target, dist, build, vendor, .venv, .git, test fixtures with large binary data.

Packaging script

Save this as savant-pack.sh in your project root and adjust INCLUDE_EXT and EXCLUDE_DIRS to your stack — the exclude list prunes every directory with a matching name at any depth, so remove a name if that directory holds source you want audited (a Go package named build/, a vendor/ tree in scope). Then run bash savant-pack.sh:

#!/bin/bash
# Packages source files into <project>-savant.zip for a Savant Chat audit.

INCLUDE_EXT="sol vy rs circom nr go cpp hpp c h ts tsx js py move cairo fc func md txt toml yml yaml"
EXCLUDE_DIRS="node_modules target dist build vendor .git .github artifacts cache out .venv venv"

DIR_NAME=$(basename "$(pwd)")
TARGET_DIR="$DIR_NAME-savant"

rm -rf "$TARGET_DIR" "$TARGET_DIR.zip" "$TARGET_DIR.tar.gz"
mkdir "$TARGET_DIR"

PRUNE_ARGS=(-samefile "$TARGET_DIR" -prune -o)
for dir in $EXCLUDE_DIRS; do
PRUNE_ARGS+=(-type d -name "$dir" -prune -o)
done

NAME_ARGS=()
for ext in $INCLUDE_EXT; do
[ ${#NAME_ARGS[@]} -gt 0 ] && NAME_ARGS+=(-o)
NAME_ARGS+=(-name "*.$ext")
done

find . "${PRUNE_ARGS[@]}" \( "${NAME_ARGS[@]}" \) -type f -print | while IFS= read -r file; do
mkdir -p "$TARGET_DIR/$(dirname "$file")"
cp "$file" "$TARGET_DIR/$(dirname "$file")/"
done

if command -v zip >/dev/null 2>&1; then
ARCHIVE="$TARGET_DIR.zip"
zip -qr "$ARCHIVE" "$TARGET_DIR"
else
ARCHIVE="$TARGET_DIR.tar.gz"
tar -czf "$ARCHIVE" "$TARGET_DIR"
fi

echo "Done: $ARCHIVE ($(find "$TARGET_DIR" -type f | wc -l) files)"

Then upload the resulting your-project-savant.zip — or your-project-savant.tar.gz if zip isn't installed — to Savant Chat.

Scoping a monorepo

Audit one subsystem at a time. If it imports shared types or interfaces from elsewhere in the monorepo, copy those files into the subdirectory first (an external/ folder works), then run the script from that subdirectory. A focused 5,000-line scope produces sharper findings than a 300,000-line dump — and costs proportionally less.

For very large scopes (a full node client, an entire backend), a flat quote usually beats per-line pricing — contact us.