Get started in 3 steps:
  1. Install: npm install -g @tinfoil-code/qwen-code@latest
  2. Run: tinfoil-qwen
  3. Enter your Tinfoil API key when prompted
Your code stays private in secure hardware enclaves.

What is Tinfoil Code?

Tinfoil Code is a privacy-focused command-line AI coding assistant. Unlike traditional AI coding tools, it processes all AI inferences using Tinfoil, ensuring all data remains with secure hardware enclaves and never accessible by anyone.

Prerequisites

Installation and Setup

# Install
npm install -g @tinfoil-code/qwen-code@latest

# Run
tinfoil-qwen
You’ll be prompted for your API key on first run: Tinfoil Code API Key Setup

Using Tinfoil Code

Once setup is complete, you can start asking questions: Tinfoil Code Main Interface Try commands like:
  • > Analyze this codebase
  • > Explain this function
  • > Generate tests for this module
Analyze Codebase Command The AI will provide detailed analysis: Tinfoil Code Analysis Response

Configuration

Session Management

Control your token usage with configurable session limits to optimize costs and performance. Create or edit .tinfoil/settings.json in your home directory:
{
  "sessionTokenLimit": 32000
}
Session token limit applies to a single conversation, not cumulative API calls.

Alternative API Key Setup

Environment Variable:
export TINFOIL_API_KEY="your_api_key_here"
Project .env File: Create a .env file in your project root:
TINFOIL_API_KEY=your_api_key_here

Usage Examples

Explore Codebases

cd your-project/
tinfoil-qwen

# Architecture analysis
> Describe the main pieces of this system's architecture
> What are the key dependencies and how do they interact?
> Find all API endpoints and their authentication methods

Code Development

# Refactoring
> Refactor this function to improve readability and performance
> Convert this class to use dependency injection
> Split this large module into smaller, focused components

# Code generation
> Create a REST API endpoint for user management
> Generate unit tests for the authentication module
> Add error handling to all database operations

Automate Workflows

# Git automation
> Analyze git commits from the last 7 days, grouped by feature
> Create a changelog from recent commits
> Find all TODO comments and create GitHub issues

# File operations
> Convert all images in this directory to PNG format
> Rename all test files to follow the *.test.ts pattern
> Find and remove all console.log statements

Debugging & Analysis

# Performance analysis
> Identify performance bottlenecks in this React component
> Find all N+1 query problems in the codebase

# Security audit
> Check for potential SQL injection vulnerabilities
> Find all hardcoded credentials or API keys

Session Commands

  • /help - Display available commands
  • /clear - Clear conversation history
  • /compress - Compress history to save tokens
  • /stats - Show current session information
  • /exit or /quit - Exit Tinfoil Code