AI coding assistant that runs locally on your machine. Connects to OpenAI or any OpenAI-compatible endpoint (llama.cpp, vLLM, etc.) and gives you a web-based chat UI with file editing, shell execution, code search, and more.
CodeAssist is designed to run on your development machine, not a remote server. This means:
- Tools access your local filesystem directly -- no file sync, no daemons
- Shell commands run on your machine -- your env, your tools, your dependencies
- No network latency -- everything runs on localhost
- Your code never leaves your machine (except to the LLM API you configure)
Always specify your project folder. CodeAssist operates on whatever directory you give it. Running it without
--workspacedefaults to the current directory, which may not be what you intended. Get in the habit of always pointing it at the project you want to work on.
# Create environment
conda create -n codeassist python=3.12
conda activate codeassist
# Install
cd CodeAssist
pip install -e .
# Configure
cp config.example.toml config.toml
# Edit config.toml -- add your API key or llama.cpp server URL
# Run -- always specify your project folder
codeassist --workspace ~/Projects/myapppython -m venv .venv
source .venv/bin/activate
pip install -e .
cp config.example.toml config.toml
# Edit config.toml
# Always specify your project folder
codeassist --workspace ~/Projects/myapppython -m codeassist --workspace ~/Projects/myappIsolates the runtime in a container while mounting your project directory for full access.
# Copy the Docker example config
cp config.docker.toml config.toml
# Edit config.toml -- add your API key
# Build and start -- always point WORKSPACE at your project
WORKSPACE=~/Projects/myapp docker compose up --buildThe server starts at http://localhost:8090. Session history persists across restarts via a Docker volume.
Port configuration: The container reads the port from config.toml (default: 8090). This avoids conflicts with common tools like Portainer (which uses 8000).
To use a different port:
# Option 1: Edit port in config.toml
# Option 2: Use environment variables
HOST_PORT=9000 SERVER_PORT=9000 docker compose up --buildEnvironment variable overrides:
CODEASSIST_WORKSPACE-- override the workspace path inside the containerHOST_PORT-- host port to expose (default: 8090)SERVER_PORT-- container port (must match config.toml)
CodeAssist is an agentic tool. Once you give it a prompt, it can:
- Read and write files anywhere in the workspace directory
- Execute shell commands (build scripts, git, test runners, etc.)
- Search across your entire codebase
It will ask for confirmation before making changes or running commands, but you are granting it full access to the directory you specify. This is by design -- it needs that access to be useful -- but it also means:
- Always use
--workspaceto scope it to the project you are working on - Never point it at your home directory or any directory more broad than necessary
- Review the confirmation dialogs before approving operations, especially shell commands
- Use Docker if you want an additional isolation layer between the agent and your system
Edit config.toml:
[llm]
# For OpenAI:
model = "gpt-4o"
api_key = "sk-your-key-here"
base_url = ""
# For llama.cpp:
# model = "your-model-name"
# api_key = "none"
# base_url = "http://localhost:8080/v1"See config.example.toml for all options (agent settings, tool limits, MCP, skills, LSP, and more).
If you expose the server beyond localhost (e.g., host = "0.0.0.0"), set a password in config.toml:
[server]
password = "your-secret-here"Without a password, anyone who can reach the port has full access to the workspace.
CodeAssist includes several security layers:
- SSRF protection (
tools/security.py): DNS rebinding prevention, internal TLD blocking (.internal,.local,.corp), cloud metadata IP blocking (169.254.169.254) - Workspace path validation: All file operations are validated to stay within the workspace directory
- Tool trust system: Custom tools are scanned for dangerous patterns and require explicit approval
- Auth middleware: Password-based HTTP Basic Auth with WebSocket support via
sec-websocket-protocolheader - Secure WebSocket: Frontend derives
wss://orws://from page protocol automatically - Vendored frontend dependencies:
highlight.jsandmarkedare bundled locally instatic/vendor/instead of loaded from CDNs, eliminating external network requests at page load and removing the attack surface from CDN compromise or supply-chain attacks
CodeAssist automatically manages context window limits during long sessions:
- Token counting: Estimates token usage including tool schema overhead for accurate thresholds
- Two-level compaction: When context exceeds 75%, old messages are compacted:
- Level 0: Tool outputs summarized to 1-line, assistant content truncated, user messages preserved
- Level 1 (escalation): Old tool messages dropped entirely, only function names kept
- Compaction caching: Compacted messages are cached and only recomputed when new messages arrive
- Smart truncation: Tool output truncation preserves error/traceback lines for debugging
Configuration in config.toml:
[compaction]
enabled = true
threshold_pct = 75 # Trigger compaction at this usage percentage
keep_recent = 20 # Number of recent messages to preserve unchanged
tool_result_max_tokens = 4000 # Max tokens per tool outputCodeAssist includes several quality-of-life improvements:
- Message cache β session history is fetched from the database once per iteration, then tracked in-memory with a dirty flag. Subsequent iterations reuse the cache unless new messages were added.
- Streaming persistence β assistant messages are saved to the database at stream start (as a placeholder) and updated when the stream completes. If the server crashes mid-stream, the partial message is preserved.
- Embedding throttling β concurrent embedding generation is capped at 2 tasks via
asyncio.Semaphore, preventing overload of the embedding API. - Session hook lock β
on_session_endprocessing is serialized per-singleton withasyncio.Lock, preventing races between concurrent WebSocket disconnects. - Configurable web search engine β choose the backend via
config.toml:[tools] websearch_engine = "duckduckgo" # or "generic" (HTML scrape fallback)
- Parallel tool execution: Multiple independent tool calls from the LLM execute simultaneously via
asyncio.gather() - Streaming timeout: LLM streams time out after 120 seconds with a graceful error
- Max-iteration limit: When the agent reaches the maximum iteration count, it notifies the user rather than silently stopping
- Confirmation prompts: Destructive operations (file writes, shell commands) require user confirmation unless workspace is trusted
- Cost tracking: Real-time token usage tracking with configurable budget limits (tokens and cost per session)
- Question flow: The agent can pause and ask the user questions mid-task via the
questiontool
# Always specify your project
codeassist --workspace ~/Projects/myapp
# Custom port
codeassist --workspace ~/Projects/myapp --port 9000
# Don't auto-open browser
codeassist --workspace ~/Projects/myapp --no-browser- Chat with an AI that can read, write, and edit your code
- Run shell commands through the chat (build, test, git, etc.)
- Search code with regex patterns
- Find files with glob patterns
- Fetch web content for documentation lookup
- Track tasks across multi-step work
- Continue conversations with context
- Knowledge base - persistent learning across sessions with semantic search
CodeAssist learns from every session and builds a persistent knowledge base:
- Session Summaries - AI-generated summaries with key topics and quality scores
- Knowledge Extraction - Automatically captures patterns, conventions, and decisions
- Full-Text Search - FTS5 search across all knowledge (instant)
- Semantic Search - Vector embeddings for similarity search (requires embedding model)
- Tool Analytics - Track tool usage, success rates, and performance
- LLM Cost Tracking - Monitor token usage and estimated costs
- File History - Track modifications across sessions
- Fine-Tuning Ready - Structured Q&A pairs for future model training
All data stored in human-readable SQLite - query directly with SQL, DB Browser, or Python.
# Enable semantic search (optional)
# Add to config.toml:
[llm]
embedding_model = "text-embedding-3-small"See docs/knowledge-base-quickref.md for API endpoints and examples.
Access the KB dashboard via the π icon in the sidebar or the Knowledge Base link in the footer.
| Page | Purpose |
|---|---|
| Dashboard | Overview stats, entry counts, recent activity |
| Entries | Browse, filter, edit, delete knowledge entries |
| Search | Full-text and semantic search across all knowledge |
| Sessions | View session history with summaries |
| Analytics | Tool usage charts, LLM cost tracking |
| PII Manager | Scan for and redact personal information |
| Settings | Configure auto-creation, confidence thresholds |
| Export/Import | Download/upload KB data, clear entire KB |
The PII Manager automatically scans for:
- Email addresses
- IP addresses
- Phone numbers
- SSNs
- Credit card numbers
- API keys
Review flagged entries and redact or delete as needed.
CodeAssist can automatically create skills and tools when it detects repetitive patterns in your workflow.
- Pattern Detection - Monitors tool call sequences across sessions
- Repetition Recognition - Identifies workflows repeated 3+ times
- Auto-Creation - Creates skills when confidence threshold is met
- Hot-Reload - New skills available immediately (no restart)
[agent]
auto_create_skills = true # Auto-create skills for repetitive workflows
auto_create_tools = false # Disabled by default (security)
max_auto_creations = 3 # Per session limit
min_confidence = 0.7 # Threshold for auto-creationYou can create custom Python tools in .codeassist/custom_tools/:
# .codeassist/custom_tools/my_tool.py
from tools import ToolResult
TOOLS = {
"my_tool": {
"name": "my_tool",
"description": "Does something useful",
"parameters": {
"type": "object",
"properties": {
"input": {"type": "string"}
}
}
}
}
async def execute(input: str) -> ToolResult:
return ToolResult(output=f"Processed: {input}")- API:
GET /api/auto-creation/status- View auto-creation stats - API:
POST /api/skills/reload- Reload skills from disk - API:
POST /api/custom-tools/reload- Reload custom tools - GUI:
/static/kb.html- Knowledge Base dashboard
See docs/knowledge-base-quickref.md for full API reference.
| Tool | Description |
|---|---|
read |
Read file contents with line numbers, offset/limit support |
write |
Write or overwrite files, creates parent directories, backs up existing files to .bak |
edit |
Surgical string replacement with stale-edit detection and similar-content hints |
shell |
Execute shell commands with timeout |
glob |
Find files matching glob patterns |
grep |
Search file contents with regex, supports exclude patterns and context lines (uses ripgrep if available) |
webfetch |
Fetch and return content from a URL |
websearch |
Search the web for information |
todo |
Manage a task list across multi-step work |
git |
Full git operations: status, diff, log, commit, push, pull, branch, clone, worktree, apply patch |
fossil |
Fossil VCS operations: status, diff, log, commit, checkout, branch, tag |
database |
Execute SQL queries against SQLite databases |
directory |
List directory contents with metadata |
apply_patch |
Apply unified diff patches atomically across multiple files |
documentation |
Generate documentation from source code (Python, JS, TS) |
http |
Make HTTP requests to REST APIs |
process |
Manage long-running background processes |
question |
Ask the user a question and wait for their response |
create_skill |
Create new skills for repetitive workflows |
create_tool |
Create custom Python tools |
diff_preview |
Show unified diff before applying edits |
test_runner |
Auto-detect test framework and run tests with structured results |
symbol_search |
Go-to-definition and find-references using ctags |
package_manager |
Detect and manage dependencies (pip, npm, yarn, cargo, etc.) |
git_snapshot |
Auto-commit workspace state for safe experimentation |
docker |
Container management (build, run, stop, logs, compose) |
image_analyze |
Analyze screenshots and mockups using vision-capable LLMs |
lsp |
Query language servers for diagnostics, completions, and formatting |
CodeAssist supports multiple agent types with different tool permissions:
| Agent | Purpose | Tools Allowed |
|---|---|---|
| CodeAssist (default) | Full development agent | All tools (writes require confirmation) |
| Research | Read-only research | read, grep, glob, websearch, webfetch, symbol_search |
| Review | Code review | read, grep, glob, test_runner, diff_preview, symbol_search |
Access the Tool Manager via the π§ icon in the sidebar or the Tool Manager link in the footer.
| Page | Purpose |
|---|---|
| All Tools | Browse built-in and custom tools |
| Custom Tools | Review, trust/untrust, delete custom tools |
| Security Scan | Scan for dangerous code patterns |
| Usage Stats | View tool usage statistics |
Security: Custom tools are scanned for potentially dangerous patterns (network access, file operations, subprocess calls, etc.). Review and trust tools before allowing unrestricted execution.
Skills are reusable, guided workflows that extend CodeAssist's capabilities. They're markdown files with frontmatter that define specialized instructions for specific tasks.
Using skills: Type the slash command (e.g., /review, /music) in chat to invoke a skill. You can also mention the skill by name naturally (e.g., "review this code" or "help me debug this").
Built-in coding skills:
| Skill | Slash | Purpose |
|---|---|---|
code-review |
/review |
Review code for bugs, security, and quality |
refactor |
/refactor |
Systematic refactoring with safety checks and test verification |
debug |
/debug |
Step-by-step debugging workflow |
test |
/test |
Write unit and integration tests |
explain |
/explain |
Explain how code works |
document |
/doc |
Generate docstrings and documentation |
optimize |
/optimize |
Data-driven performance profiling and optimization |
clean |
/clean |
Remove dead code, organize imports |
security |
/security |
Audit for vulnerabilities |
convert |
/convert |
Convert between languages/frameworks |
generate |
/generate |
Generate boilerplate code |
migrate |
/migrate |
Database migration and data transformation |
lint |
/lint |
Fix linting and formatting issues |
Non-coding skill examples:
| Skill | Slash | Purpose |
|---|---|---|
music |
/music |
Generate structured song parameters for ACE-Step music generation |
imagegen |
/imagegen |
Generate Stable Diffusion prompts with proper syntax, weights, and negatives |
These skills demonstrate how CodeAssist's skill system extends beyond coding tasks:
musicgenerates properly formatted JSON payloads (caption, lyrics, metadata) for music generation engines, enforcing structure rules and duration-to-lyric mapping.imagegenproduces complete Stable Diffusion prompts with correct token weighting syntax(word:1.3), positive/negative prompt separation, and style-specific templates.
Both show the platform's flexibility for any domain where consistent, structured LLM output is valuable β creative tools, content generation, data formatting, and more.
Creating custom skills:
Add markdown files to .codeassist/skills/ with this structure:
---
name: my-skill
description: What this skill does and when to use it
slash: command
---
# Skill Name
Instructions and rules here...Skills are discovered automatically on startup.
CodeAssist/
βββ __main__.py # CLI entry point
βββ codeassist/ # Core package
β βββ server.py # FastAPI web server
β βββ agent.py # Agent loop (prompt -> tool calls -> repeat)
β βββ llm.py # OpenAI-compatible streaming client
β βββ config.py # Configuration loading
β βββ prompts.py # System prompt construction
β βββ session.py # SQLite session persistence
β βββ session_hook.py # Session lifecycle hooks (summarization, knowledge extraction)
β βββ session_manager.py # Session fork/export/import
β βββ tokens.py # Token counting and context window management
β βββ knowledge.py # Knowledge base CRUD and search
β βββ embeddings.py # Vector embeddings for semantic search
β βββ agents.py # Agent configuration and management (default, research, review)
β βββ cost_tracker.py # Real-time token budget enforcement
β βββ trust_registry.py # Tool trust/approval system
β βββ lsp_client.py # Language Server Protocol client (full implementation)
β βββ mcp_client.py # Model Context Protocol client
β βββ plugins.py # Plugin system
β βββ dynamic_tools.py # Dynamic tool loading
β βββ custom_tools_loader.py # Custom tool discovery
β βββ cli.py # CLI interface
β βββ routes/ # API route modules
β βββ config.py # Configuration endpoints
β βββ sessions.py # Session management endpoints
β βββ skills.py # Skill management endpoints
β βββ tools.py # Tool management endpoints
β βββ git.py # Git endpoints
β βββ knowledge.py # Knowledge base endpoints
β βββ mcp.py # MCP endpoints
β βββ plugins.py # Plugin endpoints
β βββ kb_gui.py # Knowledge base GUI
β βββ lsp.py # LSP endpoints
β βββ agents.py # Agent management endpoints
β βββ custom_tools.py # Custom tool endpoints
βββ tools/ # Tool implementations
β βββ __init__.py # ToolRegistry, Tool base class, ToolResult
β βββ read.py # Read file contents
β βββ write.py # Write file contents (with .bak backup)
β βββ edit.py # String replacement (with stale-edit detection)
β βββ shell.py # Execute shell commands
β βββ glob.py # Find files by pattern
β βββ grep.py # Search file contents (exclude, context lines)
β βββ webfetch.py # Fetch web content
β βββ todo.py # Task list management
β βββ git.py # Git operations
β βββ fossil.py # Fossil VCS operations
β βββ database.py # SQLite queries
β βββ directory.py # Directory listing
β βββ apply_patch.py # Unified diff patches
β βββ documentation.py # Source code documentation
β βββ http.py # HTTP requests
β βββ process.py # Background process management
β βββ advanced.py # Web search, question asking
β βββ security.py # SSRF protection, path validation, workspace enforcement
β βββ tool_manager.py # Dynamic tool management
β βββ create_skill.py # Skill creation
β βββ create_tool.py # Tool creation
β βββ diff_preview.py # Unified diff preview
β βββ test_runner.py # Test framework auto-detection and execution
β βββ symbol_search.py # ctags-based symbol search
β βββ package_manager.py # Dependency management
β βββ git_snapshot.py # Auto-commit for safe experimentation
β βββ docker_tool.py # Container management
β βββ image_analyze.py # Vision-capable image analysis
βββ .codeassist/ # Skills and plugins
β βββ skills/ # Skill markdown files
βββ static/ # Web UI
βββ tests/ # Test suite (198 tests)
βββ Dockerfile # Container image definition
βββ docker-compose.yml # One-command Docker startup
βββ config.toml # Your config (gitignored)
βββ config.example.toml # Config template
βββ config.docker.toml # Config template for Docker
- Python 3.11+
- An OpenAI-compatible API (OpenAI, llama.cpp, vLLM, etc.)
- Git (recommended, for repository operations)
A couple of screenshots of it in action.
MIT