caglue - Coding Agent Glue

AI coding agent that works with any OpenAI-compatible API

caglue terminal session

What is caglue?

caglue (Coding Agent Glue) is a terminal-based AI assistant that lives in your command line. You type a task in plain English (or Korean), and it uses AI models — running locally on your machine or in the cloud — to carry it out by reading, writing, and searching your files, running shell commands, browsing the web, managing git repositories, and more.

Think of it as an AI pair programmer that you control through your terminal. It works with any OpenAI-compatible backend, so you are never locked into a single provider.

Why caglue?

✅ Linux x86_64 — ready
✅ Linux aarch64 — ready
🚧 macOS (Apple Silicon / Intel) — experimental (no official binary release)
✅ No Python or Node.js required.

Download

curl \ https://www.minzkn.com/public/release/caglue/caglue-latest-linux-x86_64 \ -o caglue
→ Linux x86_64
curl \ https://www.minzkn.com/public/release/caglue/caglue-latest-linux-aarch64 \ -o caglue
→ Linux aarch64
chmod +x caglue
→ Make executable

All releases

Setup

caglue setup
→ Configure API key, model, preferences

Quick example

Here is what a real caglue session looks like. The user just types what they want in plain English, and caglue takes care of the rest:

$ caglue
→ Start the interactive REPL
You: explain src/parser.c in 3 sentences
→ caglue reads the file and summarises it
You: add a null-check before the memcpy call
→ caglue finds the code, edits it, and shows you the diff
You: run the tests to make sure nothing broke
→ caglue runs make check and reports pass/fail

How it works

  1. You describe the task — say "explain this function" or "fix the bug in main.c"
  2. caglue thinks and acts — it reads your code, runs commands, searches the web, edits files, all on its own
  3. You review the result — every change is shown as a diff; you approve or reject before anything is written

Usage

1. Check your installation

caglue --help
→ See all flags and subcommands
caglue --version
→ Print version and build info

2. Start the interactive REPL

Run caglue with no arguments to start an interactive session. You are talking to an AI — just describe what you need in plain language.

caglue
→ Start interactive REPL

Inside the REPL, these slash commands help you control the session:

/help
→ List available slash commands
/compact
→ Summarise conversation to save context
/instructions ...
→ Set custom system prompt for the session

caglue also loads ./.caglue/instructions/*.md automatically when the directory exists — commit these to your repository so every contributor (and AI) follows the same conventions. A user-global scope at ~/.config/caglue/instructions/*.md applies across all projects as well. Run caglue init to scaffold the project-local directory.

3. One-shot mode (no REPL)

Pass a task and file directly — caglue runs once and exits. Great for scripting or quick questions.

caglue "explain this function" -f parser.c
→ Explain a specific file
caglue "find potential bugs" -f src/
→ Review a directory
caglue "add error handling to main" -f main.c
→ Ask caglue to edit your code

4. Use a local LLM

Point caglue at Ollama, vLLM, or any OpenAI-compatible server running on your machine. No data leaves your computer.

caglue --no-tls --api-base http://localhost:11434/v1 \ --model llama3
→ Ollama on localhost

5. Set environment variables

Skip typing --api-base and --api-key every time by exporting these in your shell profile:

export OPENAI_API_KEY="sk-..."
→ Your API key
export OPENAI_API_BASE="https://api.openai.com/v1"
→ API base URL
export OPENAI_MODEL="gpt-4o"
→ Default model name

6. Non-interactive / auto-approve

When you trust caglue and want to skip confirmation prompts (e.g. in CI), pass --yes to auto-approve every action.

caglue --yes "fix all lint warnings" -f src/
→ Auto-approve mode

Skills & Automation

caglue ships with built-in skills — ready-to-use workflows that combine instructions and tool access patterns for common tasks. Use them from the REPL (/skill review) or the CLI:

Subagents (Multi-Agent Workflows)

Delegate focused subtasks to isolated conversation contexts. Each subagent runs with its own tool whitelist, model override, and depth limit — perfect for parallel security reviews, code analysis, or test generation.

/agent-run review "Check for SQL injection vulnerabilities"
→ Run a file-based subagent with custom prompt
caglue agent list
→ List available agent definitions

Agent files live in ~/.config/caglue/agents/*.md and ./.caglue/agents/*.md — define tools_whitelist, model_override, max_rounds, and custom system prompts per agent.

caglue skill run review
→ Run the review skill (or /skill review inside the REPL)

What can you do with caglue?

Tools at a glance

caglue ships with 65+ built-in tools organized by category. Every tool has an --api-base-agnostic JSON schema, so the AI knows exactly what parameters each one expects.

📁 File I/O — read_file, write_file, edit_file, multi_edit, apply_context_patch, apply_unified_diff, delete_file, move_file, copy_file, mkdir, chmod, symlink
📂 File Discovery — glob, list_dir, tree, search_files, file_stat, file_hash, resolve_path, file_meta, repository_map
📦 Archive — archive_extract, archive_create, archive_list (zip/tar/tgz/tbz2/txz)
🔍 Diff — diff_files, diff_dirs
🌐 Web — web_fetch, web_save, web_search
⚡ Process — bash, process_list, process_output, process_kill, process_input, process_wait, process_status
🧩 JSON & YAML — json_extract, json_patch, json_validate, yaml_to_json, yaml_validate
✏️ Text & Crypto — text_transform, regex_test, string_hash, random_bytes, uuid_v4
🔨 Build & Test — build, run_tests
🧠 Agent Meta — ask_user_question, notify_user, todo_write, memory_read, memory_write, memory_delete, memory_search, env_read, tools_list, tool_info, session_status, repository_map, attach_file
🗃️ Git — git_diff, git_status, git_log, git_show, git_add, git_commit, git_checkout, git_branch, git_push, git_merge, git_reset, git_stash, git_fetch, git_blame, git_tag, git_remote
🗃️ SVN — svn_diff, svn_status, svn_log, svn_info, svn_add, svn_revert, svn_delete, svn_commit, svn_update, svn_move, svn_cleanup, svn_copy
🔌 MCP — Model Context Protocol server integration (risk-classified tools)
🔍 LSP — clangd-powered code intelligence (lsp_*, auto-registered when clangd is available)

Full tool list: run caglue tools or call the tools_list tool from the REPL.

Update

caglue update
→ Check and install latest version

Provider Management

Switch between multiple AI providers (OpenAI, Ollama, Groq, OpenRouter, etc.) with a single command. Each provider has its own API endpoint, credentials, and default model — caglue resolves the active one at request time.

caglue provider list
→ List registered providers (active marked with *)
caglue provider add
→ Interactive wizard: pick preset → credentials → model
caglue provider use ollama
→ Switch active provider (persists)
caglue provider test openai --with-chat
→ Probe /v1/models + 1-token chat completion

Configuration

caglue reads settings from ~/.config/caglue/config (INI-style). Run caglue setup to create one interactively, or edit the file directly for fine-grained control.

Advanced

Permission modes

caglue has three permission modes that control what the AI can do. Switch between them with Shift+Tab inside the REPL:

Model Context Protocol (MCP)

Extend caglue with external tool servers using the MCP standard. Connect to databases, cloud services, or custom toolchains — caglue automatically classifies each MCP tool by risk level.

caglue --mcp-server "npx @modelcontextprotocol/server-filesystem /tmp"
→ Connect an MCP server

Browser mirror (webmirror)

Mirror your REPL session to a browser in real time — useful for demos, pairing, or monitoring from another device on the same LAN. The browser shows a full terminal emulator with ANSI color, CJK support, keyboard input, and a scrollback buffer.

⚠️ The browser view is session-equivalent — it can run commands, edit files, and answer permission gates. HTTP Basic Auth is the only protection. Set credentials via environment variables (CAGLUE_WEB_USER, CAGLUE_WEB_PASS, CAGLUE_WEB_PASS_ENV) or type them at the interactive prompt.

/start-web
→ Start mirror on a free port
/start-web 8080
→ Start on a specific port
/stop-web
→ Tear down the mirror
/clear-web
→ Forget cached credentials

While active, the footer shows a web chip with the current viewer count (real-time across LAN). Use /stop-web to shut it down when no longer needed.

Static web server (caglue serve)

Run a standalone HTTP/1.1 static-file server with FastCGI proxy support. Useful for local development, demos, or serving documentation.

caglue serve ./public --port 8080 --threads 8
→ Serve ./public on port 8080 with 8 workers
caglue serve --fcgi /=./public@127.0.0.1:9000
→ Proxy PHP requests to php-fpm
caglue serve --cert cert.pem --key key.pem
→ HTTPS with TLS 1.2+

Token usage tracking

Track token consumption per model and per day from local rollout logs. No API connection required — caglue reads ~/.local/share/caglue/rollout/*.jsonl.

caglue usage
→ Last 30 days (default)
caglue usage 7
→ Last 7 days
caglue usage 0
→ All time

Set CAGLUE_PRICE_<MODEL>_IN/_OUT/_CACHED (per-1M tokens) to add a USD column.

Debug mode

When something does not work as expected, run with --verbose (or -v) to see detailed logs of every HTTP request, tool dispatch, and AI response. Repeat for more verbosity (-vv).

caglue -v "explain this function" -f parser.c
→ Verbose debug output

Share caglue with your developer friends!

댓글