Skip to main content
Igor Gulamov
ZK Researcher and AI Security Ethusiast
View all authors

We're building an autonomous senior-level auditor. Here's one of the pieces.

· 7 min read
Igor Gulamov
ZK Researcher and AI Security Ethusiast

Modern LLMs reason about code well. But they aren't specialized in smart contract auditing, and they have a knowledge cutoff. They know nothing about hacks from the last year. The Web3 attack surface shifts every month as new protocol types bring new failure modes.

When a senior auditor opens a lending protocol and sees rounding in share calculations, they already know where this broke before and what the attack looked like. They read code while flipping through a mental reference book built over years of practice.

We built that reference book for our AI agent. This post is about how.

HOWTO load non-standard projects to Savant Chat

· 2 min read
Igor Gulamov
ZK Researcher and AI Security Ethusiast

When you want to load a project from GitHub to Savant Chat, you can download the repository as a ZIP archive and upload it to Savant Chat.

example

In most cases, it's enough, and it will work OK.

But sometimes repositories use non-standard dependency manager configurations, outdated language versions, and especially non-open-source libraries. Additionally, during archiving, the structure of subrepositories may not be completely transferred, which is critical for foundry to work.

In this case, to upload your files to Savant Chat, you'll need to take a few additional steps.

First, download your project locally and install all its dependencies: both nodejs and foundry (if it's being used).

Then save the following script savant-build.sh in the root folder of your project:

#!/bin/bash

if command -v realpath >/dev/null 2>&1; then
DIR_NAME=$(basename "$(dirname "$(realpath "$0")")")
else
DIR_NAME=$(basename "$(dirname "$(cd "$(dirname "$0")" && pwd)")")
fi
TARGET_DIR="$DIR_NAME-savant"

if [ -d "$TARGET_DIR" ]; then
echo "The $TARGET_DIR directory already exists."
read -p "Do you want to delete $TARGET_DIR and $TARGET_DIR.zip and create an empty directory? (y/n): " answer
if [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
rm -rf "$TARGET_DIR"
[ -f "$TARGET_DIR.zip" ] && rm "$TARGET_DIR.zip"
mkdir "$TARGET_DIR"
else
echo "Operation cancelled."
exit 0
fi
else
mkdir "$TARGET_DIR"
fi

find . -name "*.sol" -not -path "./$TARGET_DIR/*" | while read file; do
target_dir="$TARGET_DIR/$(dirname "$file")"
mkdir -p "$target_dir"
cp "$file" "$target_dir/"
done

find . \( -name "*.md" -o -name "*.txt" \) -not -path "./$TARGET_DIR/*" -not -path "./node_modules/*" -not -path "./lib/*" | while read file; do
target_dir="$TARGET_DIR/$(dirname "$file")"
mkdir -p "$target_dir"
cp "$file" "$target_dir/"
done

if [ -f "./foundry.toml" ]; then
touch "$TARGET_DIR/.foundry"
fi

if command -v zip &> /dev/null; then
zip -r "$TARGET_DIR.zip" "$TARGET_DIR"
else
if command -v tar &> /dev/null; then
tar -czf "$TARGET_DIR.zip" "$TARGET_DIR"
else
echo "ERROR: Neither zip nor tar utilities were found for archiving."
exit 1
fi
fi

echo "Done! The $TARGET_DIR directory has been created and archived in $TARGET_DIR.zip"

To use the script:

  1. Save it as savant-build.sh
  2. Make it executable with: chmod +x savant-build.sh
  3. Run it with: ./savant-build.sh

Then you get a your-project-name-savant.zip archive in your project folder, with all dependencies included.

warning

If your foundry project uses non-standard path for its dependencies (other than lib/), rename it to lib and fix the remappings.txt file before running the script.