wmentor/go-magnetar
소개
An AI smart shell (agent) with integrated tools, skills and an optional knowledge base. Chat with any OpenAI-compatible LLM, use built-in integrations (web search, Confluence, JIRA, GitHub, GitLab and more), index documents and web pages into a local vector database (RAG), and get answers grounded in your own content. MCP server mode is available.
데이터 및 분석What you can do
- file_read - Read local files (.md, .txt, .pdf, .docx, .xlsx, .ipynb, and more)
- file_list - List files in the current directory by glob pattern
- file_write - Write content to a file
- edit - Edit a plain-text file by replacing text (case-sensitive, exact match required)
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- +2
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Original
An AI smart shell with an integrated knowledge base and customizable skills. A single standalone binary with everything included — no dependencies to install, no go install needed. Just download, run, and start chatting with any OpenAI-compatible LLM, run shell commands, indexing documents and web pages into a local vector database, and get answers grounded in your own content.
What it does
- Chat — interactive REPL with multi-turn conversation and automatic context compaction
- Shell — execute shell commands directly without LLM in the same line as your chat message (e.g.,
ls -la,git status,cat file.txt) - Index —
/index <file|url>adds documents to your RAG knowledge base; documents become immediately available to the AI agent for answering questions - Skills — customize agent behavior with reusable skill files for specialized tasks
- Subagents — spawn specialized agents for complex tasks (exploration, research, parallel work)
- Integrations — Confluence, JIRA, GitHub, GitLab (all optional, disabled by default); when enabled, simply provide a URL to a page or resource, and the system automatically detects the platform and fetches the content as markdown for AI agent
- Smart reading - Transparent read a wide range of file formats (
.md,.txt,.csv,.tsv,.docx,.pdf,.pages,.odt,.pptx,.xlsx,.html,.eml,.epub,.numbers,.ipynb,.key) and convert into markdown. For a complete list of supported formats and their available modes, see docs/file_codecs.md. - MCP mode — run as an MCP (Model Context Protocol) server for advanced file reading, URL context fetching, knowledge base operations (built-in or external), and search capabilities; see docs/mcp_mode.md for complete documentation
- Notifications — send informational messages via SMTP, Telegram, and Slack
Requirements
- Go 1.27.4 (or download a pre-built binary)
- API key for any OpenAI-compatible provider (OpenAI, Azure OpenAI, Ollama, etc.)
Note: Qdrant is no longer required. The default vector store is Chromem (built-in, in-memory with optional persistence). Qdrant is available as an optional external store for production deployments.
Quick start
1. Install
Option A — pre-built binary (recommended):
Download a single standalone binary from GitHub Releases and place it in your $PATH.
Why a single binary? go-magnetar is distributed as a single self-contained binary with all dependencies compiled in. No need to install Go, manage dependencies, or worry about version conflicts. Just download, make executable, and run — everything you need is already there.
Option B — go install:
go install github.com/wmentor/go-magnetar/cmd/go-magnetar@latest
Option C — build from source:
git clone https://github.com/wmentor/go-magnetar.git
cd go-magnetar
make build # binary → bin/go-magnetar
2. Configure
On first run, go-magnetar creates ~/.go-magnetar/config.yml automatically.
Edit it to set your LLM API key and model:
version: "1.0"
language: english
verbose: true
profile: default
profiles:
default:
llm:
base_url: https://api.openai.com/v1
api_key: $env:OPENAI_API_KEY # or paste the key directly
model: gpt-4o
context: 128000
temperature: 0.9
Environment variables with the MAGNETAR_ prefix override corresponding configuration parameters. For example, MAGNETAR_CONFLUENCE_READONLY overrides confluence.readonly.
For a complete list of options see docs/configuration.md.
3. Run
go-magnetar
This opens the interactive chat REPL. Type a question and press Enter:
> What is the capital of France?
Paris is the capital of France.
> /help
...
> ^D ← Ctrl+D or /exit to quit
Project Context (AGENTS.md / CLAUDE.md)
If a file named AGENTS.md or CLAUDE.md exists in the current directory, its content is automatically loaded into the agent's system prompt. This allows you to define project-specific instructions, conventions, and context.
- Priority:
AGENTS.mdtakes precedence overCLAUDE.md. If both files exist, onlyAGENTS.mdis loaded. - Use cases: Custom instructions, coding standards, project-specific guidelines, API documentation, etc.
Example AGENTS.md:
You are an expert developer working on my-project. Follow these rules:
- Always write unit tests for new code
- Use Go 1.27+ features when appropriate
- Follow the project's coding style as documented in docs/style.md
The content is appended to the system prompt as a section titled "Project context". See docs/agent_tools.md for more information.
What the agent can do
Beyond answering questions, the agent has access to tools it can call automatically:
| Tool | Description |
|---|---|
file_read |
Read local files (.md, .txt, .pdf, .docx, .xlsx, .ipynb, and more) |
file_list |
List files in the current directory by glob pattern |
file_write |
Write content to a file |
edit |
Edit a plain-text file by replacing text (case-sensitive, exact match required) |
exec |
Run shell commands (with a built-in safety guard) |
system_grep |
Search file contents with rg (ripgrep) or grep (case-insensitive, recursive, line numbers) |
web_fetch |
Fetch a URL and return its content as Markdown (transparently handles Confluence, JIRA, GitHub, GitLab, RSS feeds when corresponding plugins are enabled). See docs/tool_web_fetch.md for complete documentation |
web_search |
Execute web search and return results in Markdown format |
rag_search |
Search knowledge base for relevant documents |
ssh |
Execute commands on a remote server via SSH (when enabled) |
cve |
Look up vulnerability info from the OSV database |
github_* |
Read GitHub repos, files, issues, milestones |
confluence_page_edit |
Edit a Confluence page by ID with Markdown content |
agent_<name> |
Spawn a specialized subagent for complex tasks (exploration, research, parallel work) |
For a complete list of tools and their detailed documentation, see docs/agent_tools.md.
The agent picks tools automatically based on your question. You don't need to specify which tool to use.
Skills
Skills are reusable files that customize the agent's behavior for specific tasks:
- Custom instructions — Define specialized workflows for coding, writing, research, etc.
- Templates — Enforce consistent output formats (e.g., bug reports, feature requests)
- Project-specific guidance — Tailor the agent to your project's conventions
- Enable/disable per project — Override user-level skills with project-specific ones
Skills are stored in:
- User skills:
~/.go-magnetar/skills/— global skills - Project skills:
{current_dir}/.go-magnetar/skills/— project-specific skills (takes priority)
Example skill file structure:
my-skill/
└── SKILL.md
SKILL.md content:
---
name: coding-assistant
description: Programming assistant with Go expertise
disable: false
---
You are an expert Go developer...
Usage:
> /skill coding-assistant
See docs/skill.md for complete skill documentation.
Using the knowledge base (RAG)
The RAG feature is optional. Enable it when you want the agent to answer questions based on your own documents.
Enable RAG in config
By default, RAG uses Chromem (built-in, in-memory). For persistent storage, set rag.chromem.data_dir:
rag:
enable: true
store:
type: chromem # or qdrant
llm:
base_url: https://api.openai.com/v1
api_key: $env:OPENAI_API_KEY
model: text-embedding-3-small
vector_size: 1536
chromem:
data_dir: ~/.go-magnetar/store # optional: set for persistence
collection: documents # collection name
The main ~/.go-magnetar/config.yml automatically loads plugin configurations from ~/.go-magnetar/plugins/ directory — no include directive is needed.
For Qdrant (external store), use:
rag:
enable: true
store:
type: qdrant
llm:
base_url: https://api.openai.com/v1
api_key: $env:OPENAI_API_KEY
model: text-embedding-3-small
vector_size: 1536
qdrant:
connstr: http://localhost:6333
collection: documents
Start Qdrant (optional, only if using Qdrant store)
docker run -p 6333:6333 -p 6334:6334 qdrant/qdrant
Index documents
go-magnetar
> /index docs/guide.md
> /index https://example.com/article
> /index https://your-domain.atlassian.net/wiki/spaces/SPACE/pages/123456
> /index https://jira.example.com/browse/PROJECT-123
The agent will now search the knowledge base before answering any question.
Chat commands
| Command | Alias | Description |
|---|---|---|
/help |
/h |
Show available commands |
/exit |
/quit |
Exit the program |
/index <path|url> |
/i |
Index a file or URL into the knowledge base |
/fetch <url> [file] |
/f |
Fetch URL content, display or save to file |
/copy [index] |
/c |
Copy an answer to clipboard (default: the last one) |
/write <file> |
/w |
Write last answer to a file |
/new |
— | Clear conversation history and start fresh |
/compact |
— | Compress conversation history immediately |
/stat |
— | Show context stats (tokens, messages, models) |
/profile [name] |
— | Show or switch profile |
/readonly |
— | Toggle read-only mode |
/timing [on|off] |
— | Show or toggle the execution time after each answer |
/tool <name> [json] |
— | Execute a registered tool directly with JSON parameters |
/tools |
/t |
List all available tools and their descriptions |
/confluence.edit <url> <content> |
— | Edit a Confluence page by URL with Markdown content |
/idxtab <file> |
— | Index multiple documents from a JSON lines file |
/session.save <file> |
— | Save conversation to a JSON file |
<shell command> |
— | If your message starts with a shell command (e.g., ls, git, cat), the agent automatically detects it and executes it in your shell, allowing you to combine the chat interface with your terminal interpreter without switching contexts |
Use ↑/↓ arrow keys to navigate command history (stored in ~/.go-magnetar-history.json).
Sessions
Save the current conversation to a file and restore it later:
> /session.save /tmp/my-session.json
# Resume later
go-magnetar --session /tmp/my-session.json
Data Residency
go-magnetar offers 100% local processing options:
- Chromem (built-in vector store) — no external dependencies
- Local LLMs (Ollama, lm-studio, etc.) — run on your machine
- Zero data exfiltration — everything stays on your computer
When configured with Chromem + local LLM, your documents, embeddings, and conversations never leave your machine.
See docs/data_residency.md for complete details.
Security
See docs/security.md for complete security information.
- Safety guard — dangerous commands (
rm -rf /,sudo,git push, package managers, etc.) are blocked automatically. Enable withguard.enable: truein config. - Read-only mode — toggle with
/readonlyto block all file writes and shell modifications for the session. - Root user — go-magnetar refuses to run as root.
- Sensitive env vars — variables matching patterns like
TOKEN,KEY,PASS,SECRETare stripped from the command environment before execution. - Automatic sensitive data masking — chat inputs and tool responses are automatically masked to prevent leakage of secrets and personal information.
See docs/security.md for details.
CLI flags
| Flag | Description |
|---|---|
-p <profile> |
Use a specific configuration profile |
-f <file> |
Non-interactive mode: read input from file, print answer, exit |
<prompt> |
Direct prompt argument(s) - execute prompt(s) directly without REPL |
--session <file> |
Load a previously saved conversation session |
--read-only |
Run in read-only mode (disable file writes and shell modifications) |
--enable-timing |
Show the execution time after every answer, whatever /timing says |
--config-dir <path> |
Set the configuration directory (default: ~/.go-magnetar). Can also be set via MAGNETAR_CONFIG_DIR environment variable. |
-d, --daemon |
Run as a background daemon. Requires --mcp with mcp.mode: http configuration. Starts go-magnetar in detached mode, suitable for long-running server processes. |
--mcp |
Launch in MCP (Model Context Protocol) server mode. For detailed information about MCP modes (stdio/HTTP), configuration, and client integration, see docs/mcp_mode.md. |
-h, --help |
Show help and exit |
-v, --version |
Show version information and exit |
# Direct prompt (non-interactive)
go-magnetar "What is go-magnetar?"
# Multiple prompt arguments
go-magnetar "Explain:" "How does RAG work?"
# Non-interactive (scripting / batch)
go-magnetar -f questions.txt
# Read from stdin (pipe mode)
echo "What is go-magnetar?" | go-magnetar
cat questions.txt | go-magnetar
# Combine stdin with a prompt (stdin comes before prompt)
ls -la | go-magnetar "Analyze this directory listing:"
# Load a saved session
go-magnetar --session session.json
# Use a named profile
go-magnetar -p production
# Run in read-only mode
go-magnetar --read-only
# Show the execution time of every answer
go-magnetar --enable-timing
# Use custom config directory
go-magnetar --config-dir ~/.custom-config
# or
export MAGNETAR_CONFIG_DIR=~/.custom-config
go-magnetar
# Launch in MCP server mode
go-magnetar --mcp
# Run as background daemon (requires mcp.mode: http)
go-magnetar --daemon --mcp
Note: In
-fmode, chat commands (/index,/fetch, etc.) are not available. Text preprocessor placeholders like{{date}},{{uuid}},{{file:path}}are expanded.
Note: In
--mcpmode, the agent runs as a console-based MCP server exposing all available tools to compatible MCP clients. Chat REPL functionality is disabled. For detailed information about MCP modes (stdio/HTTP), configuration, and client integration, see docs/mcp_mode.md.
Documentation
- Configuration reference
- Chat commands
- Agent tools
- File format support
- Text preprocessor
- Skills
- Security
- Data Residency
- User manual
License
See LICENSE.
관련 프로젝트 살펴보기
불러오는 중…