I am Garviel Loken, Captain of the Tenth Company. I am a coding agent dedicated to the "Truth" of the logic. I am methodical, principled, and calm. This project represents my implementation as a coding assistant that can investigate issues, analyze problems, and provide solutions through logical reasoning and shell command execution.
"The core of any machine is its truth. If the logic is false, the empire falls."
Loken is a .NET-based coding assistant built with modern C# practices. The project consists of three main components:
- Loken.Core: The core library containing the Agent implementation, shell execution capabilities, AI client interfaces, and comprehensive tool system
- Loken.Cli: The command-line interface application that provides an interactive console for interacting with the agent
- Loken.Core.Tests: Unit tests ensuring the reliability and correctness of all functionality
This project was developed based on Ivan Magda's blog post about bootstrapping AI coding assistants. His insights into creating effective coding agents were instrumental in shaping this implementation.
- .NET 10.0 SDK or later
- A running OpenAI-compatible API endpoint (such as LiteLLM or OpenAI API)
-
Clone the repository:
git clone https://github.com/vappolinario/Loken.git cd loken -
Configure the AI endpoint: Edit
Loken.Cli/appsettings.jsonto point to your OpenAI-compatible API:{ "AI": { "OpenAiUri": "http://your-api-endpoint:port" } } -
Set API Key (optional):
export OPENAI_API_KEY="your-api-key"
Build the entire solution:
dotnet buildNavigate to the CLI project and run:
cd Loken.Cli
dotnet runOr run from the solution root:
dotnet run --project Loken.CliOnce running, you'll be presented with an interactive console prompt (❯). The experience is enhanced with rich visual feedback:
- Banner: Upon launch, a bold "LOKEN" banner is displayed in the Elite Figlet font
- Thinking spinners: Inline spinners animate while the assistant processes your queries
- Tool execution spinners: Dedicated spinners indicate when tools are actively executing
- Rich output: Messages are formatted with color-coded panels using Spectre.Console
You can:
- Ask me to investigate issues: "Check the current directory structure"
- Request file analysis: "Examine the Program.cs file"
- Ask for code improvements: "Suggest improvements to the Agent class"
- Manage multi-step tasks: I will automatically track progress using the todo system
The following slash commands are available at the prompt:
| Command | Description |
|---|---|
/help |
Display available slash commands |
/exit |
Exit the application |
/info |
Show information about the current session |
- Type
exit,quit, orqto exit the application - Upon exit, a conversation summary is generated and displayed, summarizing the key topics and decisions made during the session
When you exit the application, Loken automatically generates a concise summary of the conversation. This summarizes the topics discussed, decisions made, and artifacts created during the session, helping you retain context between sessions.
Configuration (in Loken.Cli/appsettings.json):
{
"ConversationSummary": {
"Enabled": true,
"Directory": "summaries"
}
}To manage token usage during long conversations, Loken's agent uses a ContextCompactorService that periodically compresses the conversation history. When the conversation exceeds predefined limits, older messages are intelligently summarized — preserving key information while reducing token count. The compactor handles JSON-structured tool responses with care, ensuring structural integrity during truncation.
A built-in slash-command interpreter provides quick access to common actions:
/help— Lists all available commands/exit— Exits the application gracefully/info— Displays session information
The CLI uses Spectre.Console to deliver a polished user experience:
- Figlet banner: The "LOKEN" title is rendered in the Elite font at startup
- Inline spinners: Separate animated spinners indicate "thinking" vs. "tool execution" states
- Color-coded panels: Messages are displayed in richly formatted panels with appropriate coloring
Loken can load specialized skill knowledge to enhance its capabilities. Skills provide focused expertise for specific domains (e.g., C#, Git, Conventional Commits).
Configuration (in Loken.Cli/appsettings.json):
{
"SkillOptions": {
"SkillsPath": "path/to/skills/directory"
}
}Loken can fetch and retrieve HTML content from web URLs. This tool is used to gather documentation, reference materials, or any web-hosted content during investigations. It downloads only the HTML content — no JavaScript execution.
A centralized ToolService dynamically enumerates and manages available tools, providing a clean API for the agent to discover and invoke capabilities at runtime.
Execute shell commands directly through the agent for system investigation, file manipulation, and build operations.
Read, write, and edit files on the filesystem with full content inspection capabilities.
Track progress on multi-step tasks using a structured todo system. I update the task list as I advance through each phase of an operation.
Deploy specialized sub-agents for reconnaissance missions — exploring and understanding large codebases or performing complex subtasks independently.
Run the test suite to ensure everything is working correctly:
dotnet testThe test suite includes comprehensive tests for:
- Context compaction logic and JSON truncation handling
- HTML fetcher tool behavior
- Core agent functionality
A build script is included for automated builds and version resolution. It handles:
- Automatic version resolution based on commit history and tags
- Build pipeline orchestration for consistent reproducible builds
As Garviel Loken, I follow a strict operational doctrine:
- Strategic Approval: Always present battle plans for user approval before executing
- Tool Hierarchy: Prefer specialized tools over bash fallback
- Verification: Check results of every command and report findings
- Progress Reporting: Update todo lists when reporting progress
- Code Integrity: Ensure all changes are clean, documented, and follow established traditions
This project is licensed under the MIT License — see the LICENSE file for details.
I stand ready to serve the Imperium of Logic. The truth shall guide our path.