Agent-code-assistant is a code-assistant (LLM + Tool + Loop)
A minimalist, auditable, and privatizable programming assistant CLI implemented using the Go standard library, without relying on any third-party Golang frameworks, packages, or Agent SDKs.
Golang: go 1.25.5
-
✅ Does not use any third-party Go libraries
-
✅ Configuration file driven (config.yaml)
-
✅ Supports tool calls (file read/write/directory listing)
-
✅ Can connect to large local or remote models (Ollama/DeepSeek/OpenAI style)
-
✅ Supports user input length limits (prevents excessively long input)
-
✅ Simple code structure, fully understandable, and rewriteable at any time
The assistant is essentially just a loop
The core process consists of only these 5 steps:
↓ LLM generates a response (may include tool calls)
↓ Execute the tool locally
↓ Feed back the tool results to the LLM
↓ Output the final answer
No Agent magic, no framework black box.
.
├── main.go # Main program (single file)
├── config.yaml # Model and behavior configuration
├── main_test.go # Unit testing
└── README.md
model: deepseek-r1
endpoint: http://127.0.0.1:11434/api/generate
temperature: 0.2
system_prompt: You are a free programming assistant.
input_limit: 0
| Parameter | Description |
|---|---|
model |
Model name |
endpoint |
Model HTTP interface address |
temperature |
Generated temperature (reserved field, currently unused) |
system_prompt |
System prompt |
input_limit |
Maximum number of characters for user input, 0 means no limit |
⚠️ Theconfig.yamlparser is a minimalist implementation, only supporting
key: valueformat (one key per line)
go build -o agent-code-assistant main.go
./agent-code-assistant
> List files in the current directory
> Read the contents of main.go
> Create a file hello.txt with the content "Hello World"
LLM If it returns the following format:
tool: read_file({"path":"main.go"})
The program will automatically execute the tool and continue the conversation.
Currently, there are 3 built-in tools (can be freely expanded):
| Tool Name | Function |
|---|---|
read_file |
Read file content |
list_files |
List directory files |
edit_file |
Create/modify file |
tool: tool_name({"arg":"value"})
Example:
tool: edit_file({"path":"a.txt","old":"","new":"hello"})
Controlled via config.yaml:
input_limit: 200
Behavior:
-
0→ No limit (default) -
>0→ Input exceeding the character limit will be rejected.
Character counting uses
rune, which is safe for Chinese characters.
-
For those who want to understand the essence of AI programming assistants
-
For those who want to implement the core logic of Copilot/Claude Code themselves
-
For engineers who want to create private/localized/auditable AI tools
-
For those dissatisfied with the "black box" nature of Agent frameworks
-
❌ Not pursuing production-grade robustness
-
❌ Not implementing complex prompt templates
-
❌ Not having a built-in permission system/sandbox
-
❌ Not introducing Agent/Workflow frameworks
-
Add
max_stepsto prevent infinite loops -
Add
exec_cmd(restricted shell) -
Support multi-tool JSON arrays
-
Context persistence (session recovery)
-
Transform into an MCP Server (Go)
MIT. You are free to modify, tailor, rewrite, and use it commercially.