Berkay Orhan
WorkResearchExperienceAboutAskContact
Contact
← All projects

PROJECT / 2026

rust-pantry

Rust Building Blocks for AI Agents

A store of Rust project templates and opt-in recipe crates, cataloged so an AI agent can pick the few pieces an app needs instead of writing them from scratch.

type
Template and recipe store
templates
cli, server, tauri, egui
recipes
9 opt-in crates
generator
new.sh <template> <dest> --with <recipes>
agent entry point
AGENTS.md catalog with pick-when / skip-when lines
stack
Rust · Cargo workspaces · clap · axum · sqlx · SQLite · Tauri · egui · React · Vite · Vitest · MCP · GitHub Actions · Bash

01 / Overview

rust-pantry is a store of copy-and-run Rust skeletons and add-on crates, written to be read by an AI agent as much as by a person. Four templates cover a command-line tool, an axum server with a shared wire-type crate, a Tauri desktop app with a React front end, and a native egui app. Nine recipes add one capability each, such as a command registry that makes an app agent-ready over MCP, an embedded Claude Code or Codex assistant behind an approval gate, background jobs, settings with migrations, signed self-update, or a service wrapped behind a trait with a fake. The catalog in AGENTS.md gives every item a pick-when and a skip-when line, so an agent can match the app in front of it and take only what it needs.

02 / Key features

  • –Four templates (cli, server, tauri, egui): each builds, lints and tests on its own; server, tauri and egui keep their logic in a UI-free core or protocol crate
  • –new.sh generator: copies a template, renames the myapp placeholders in file contents and paths, runs git init, and prints each chosen recipe's wiring steps
  • –Agent-ready recipe: one command registry callable from the UI, a CLI, a token-gated loopback JSON-lines channel and an MCP server
  • –Embedded-agent recipe: runs the user's own Claude Code or Codex CLI as the app's assistant, with the app's commands as its only tools and every call through an approval gate
  • –Desktop and service recipes: background jobs with cancel, versioned settings with migrations, single-instance forwarding, opaque file handles, argon2 and session auth, and Ed25519-signed self-update
  • –Providers recipe: wraps an external service behind a trait with a deterministic fake and a demo mode, so tests and CI run without network or accounts
  • –Shared conventions in every template: unsafe code forbidden, clippy -D warnings in CI, thiserror in libraries and anyhow in binaries and one pinned toolchain, plus, in the multi-crate templates, a cargo xtask layers check that keeps UI dependencies out of core crates
  • –Root CI that checks every template, the recipes workspace on Linux and Windows, and a project generated by new.sh from each template with all the recipes that fit it

03 / Challenges

  • –Writing a catalog an agent can act on: every item needs honest pick-when and skip-when lines, or the agent takes recipes speculatively and leaves the app with code nobody asked for
  • –Keeping recipes adoptable into an existing app, where the host's error types, logging and async runtime win over the recipe's own choices
  • –Running an embedded agent safely: the assistant gets only the app's own commands, and a missing answer, a dropped reply or a cancelled turn must all mean deny
  • –Making a self-updating binary trustworthy: a validly signed manifest for the wrong app or platform must still be rejected

04 / Solution

Each recipe is a small crate with a recipe.toml that carries its pick-when and skip-when lines, and a README that explains how it works, how to wire it in and how to adopt it into an existing app. The ai recipe starts Claude Code with its built-in tools off and only the app's own MCP server, refuses to start Codex unless a check before each start shows its dangerous features and outside MCP servers off, and routes every tool call through one gate where an unanswered approval always means deny. Self-update verifies the Ed25519 signature over the raw manifest bytes before anything is parsed, then checks app, platform and version before it downloads and swaps the executable. A cargo xtask layers check and a root CI that generates a project from every template keep the store itself from drifting.

05 / Outcome

A private repository that is planned to be made public. A new Rust app can start from a template that builds, lints and tests on its own and take only the recipes it needs, with CI generating and checking a project from every template to keep them working.

Berkay Orhan© 2026

WorkResearchExperienceCVBack to top ↑